• We've upgraded our forums. Please post any issues/requests in this thread.

[Programming Project] Renderer unspecific GUI Library

Joined
Apr 26, 2008
Messages
1,106 (0.31/day)
Likes
178
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
#1
Disclaimer: This thread is mostly for keeping me motivated since I'm a lazy something or other. So feel free to be annoying.


I code in Java using OpenGL and hate Java Swing with all my heart. I usually make crappy ad hoc UIs for every thing I code (not that I code much), so I decided to make my own GUI library.
Since I'm a noob it'd make a good learning experience, what with never having coded a library before. I'm making it renderer unspecific for the same reason.

Although I'm coding it in Java, I'm going to try to not use any Java packages (the import thingies). This way it'll pretty much be OO psuedo-code in Java form, easily convertible into whichever OO language I decide to learn next. Also, it'd increase the cool factor, which is good for motivation.
Renderer unspecific basically means that the library won't handle any of the drawing. You'll have to make your own renderer using whatever graphics library you prefer (in my case, that would be OpenGL).

-A script generates a UI via the library.
-UI takes in KB/M data from whatever program (now known as Jimmy) is using the library.
-UI updates element positions (x,y coordinates), states and orders (what goes on top of what) based on KB/M input.
-UI sends element positions, orders and states/events to Jimmy.
-Jimmy renders a GUI using received UI element positions and orders.
-Jimmy performs functions and updates its variables using received UI element states/events.
-Have everything about the GUI (including what each element does when triggered) be determined via a script.
-Layers (e.g. inventory screen) that are resizeable, repositionable and min/maximizable during runtime.
-Buttons, text-boxes, drop-down lists, sliders and scrollbars.
-Elements hold very abstracted state/event data (e.g. a double between 0 and 1 for sliders).
-Buttons and layers have click detection.
-Layers are reordered when clicked on.
-Layers are repositioned when you click and drag them.
-Horizontal and vertical scroll bars for layers.
-Layers can be resized.
I'm not very good at explaining things so I hope what I've said so far makes sense. If not, just ask.

I̶'̶l̶l̶ ̶u̶p̶l̶o̶a̶d̶ ̶t̶h̶e̶ ̶s̶o̶u̶r̶c̶e̶ ̶a̶f̶t̶e̶r̶ ̶I̶'̶v̶e̶ ̶c̶o̶d̶e̶d̶ ̶a̶ ̶b̶i̶t̶ ̶m̶o̶r̶e̶ ̶a̶n̶d̶ ̶a̶d̶d̶e̶d̶ ̶c̶o̶m̶m̶e̶n̶t̶s̶.̶.̶.̶ Also, scripting support will be the last thing I do, so the source won't be for a library, it'll be for a program with all the classes intended for the library plus a Core class (main) to simulate/act as an abstraction of Jimmy and his renderer.

Compiled runnable version,
http://www.mediafire.com/download/0tl8k4819xkr3i0/GuiDemo.rar
It works like a standard UI. Drag the scroll bar to scroll, click a button to click a button, drag the bottom right corner to resize and drag anywhere else to drag the layer.


Source,
http://pastebin.com/u/razaron
It's under "GUI Library/". Requires LWJGL.


This is all part of a larger goal, the first step of which is to be able to quickly and easily make UIs. By around October I hope to have learned basic AI, coded a fairly versatile cellular automaton library, coded an impulse based physics library and gotten my head around scripting (so I don't have to hard-code everything). I've already learned A*, know how I'm going to do the cellular automaton library and coded a verlet based physics engine beforehand. The only thing I know jack squat about is scripting.
 
Last edited:

RCoon

Gaming Moderator
Staff member
Joined
Apr 19, 2012
Messages
11,370 (5.50/day)
Likes
9,511
Location
Gypsyland, UK
System Name HP Omen 17
Processor i7 7700HQ
Memory 16GB 2400Mhz DDR4
Video Card(s) GTX 1060
Storage Samsung SM961 256GB + HGST 1TB
Display(s) 1080p IPS G-SYNC 75Hz
Audio Device(s) Bang & Olufsen
Power Supply 230W
Mouse Roccat Kone XTD+
Software Win 10 Pro
#2
1st - Please dont code in Java, please let it die along with flash
2nd - use the time saved to order and wait for pizza
3rd - enjoy

Thank me later.
 

Frick

Fishfaced Nincompoop
Joined
Feb 27, 2006
Messages
14,886 (3.45/day)
Likes
5,416
System Name A dancer in your disco of fire
Processor i3 4130 3.4Ghz
Motherboard MSI B85M-E45
Cooling Cooler Master Hyper 212 Evo
Memory 4 x 4GB Crucial Ballistix Sport 1400Mhz
Video Card(s) Asus GTX 760 DCU2OC 2GB
Storage Crucial BX100 120GB | WD Blue 1TB x 2
Display(s) BenQ GL2450HT
Case AeroCool DS Cube White
Power Supply Cooler Master G550M
Mouse Intellimouse Explorer 3.0
Keyboard Dell SK-3205
Software Windows 10 Pro
#3
Meh, Java isn't so bad.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
20,922 (6.24/day)
Likes
10,023
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#4
Last edited:

Aquinus

Resident Wat-man
Joined
Jan 28, 2012
Messages
10,401 (4.84/day)
Likes
5,481
Location
Concord, NH
System Name Kratos
Processor Intel Core i7 3930k @ 4.2Ghz
Motherboard ASUS P9X79 Deluxe
Cooling Zalman CPNS9900MAX 130mm
Memory G.Skill DDR3-2133, 16gb (4x4gb) @ 9-11-10-28-108-1T 1.65v
Video Card(s) MSI AMD Radeon R9 390 GAMING 8GB @ PCI-E 3.0
Storage 2x120Gb SATA3 Corsair Force GT Raid-0, 4x1Tb RAID-5, 1x500GB
Display(s) 1x LG 27UD69P (4k), 2x Dell S2340M (1080p)
Case Antec 1200
Audio Device(s) Onboard Realtek® ALC898 8-Channel High Definition Audio
Power Supply Seasonic 1000-watt 80 PLUS Platinum
Mouse Logitech G602
Keyboard Rosewill RK-9100
Software Ubuntu 17.10
Benchmark Scores Benchmarks aren't everything.
#5
Java completely lacks brilliance.
No, but languages that are built on top of it can be brilliant. The JVM is not slow and it runs on just about any platform. There are benefits to using Java for more reasons than how you program it.

Clojure is a good example of brilliance, and it's on top of Java.

So as a general question, what do you not like about Swing? Don't get me wrong, I don't like it either, but what about it in particular do you dislike? You might be able to change what you want without re-inventing the wheel.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
20,922 (6.24/day)
Likes
10,023
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#6
The way it handles events (needlessly breaks them into separate functions) and especially the lack of a ShowDialog() method which passes the GUI thread to another form and sends it back on closure. I had to expose variables that shouldn't have been exposed and other really stupid tactics to get around it.

Lets not forget it looks like shit, has no WYSIWYG editor, and is overall clunky.
 
Joined
May 5, 2008
Messages
3,318 (0.94/day)
Likes
301
Processor Intel i5-3570K @ 3.4Ghz
Motherboard Asrock LGA1155 Z77 Extreme 4
Cooling Cooler Master Evo 212
Memory 16GB (4X4) G.Skill Ripjaw 2 DDR3-1600
Video Card(s) Nvidia gForce GTX 660ti
Storage 1x Samsung 840 EVO 256GB 6Gb/s, 1x WD 500GB 6Gb/s, 1x WD 80GB 3Gb/s
Display(s) ASUS VH242H Black + 2 HP 2311x 23" LED
Case Fractal Design R4
Audio Device(s) Realtek OnBoard Both
Power Supply Cooler Master 850w
Software Windows 7 Ultimate 64-bit SP1
#7
1st - Please dont code in Java, please let it die along with flash
2nd - use the time saved to order and wait for pizza
3rd - enjoy

Thank me later.
Hoping for Java to die is like Hell freezing over, it ain't gonna happen.
 
Joined
Feb 18, 2010
Messages
1,715 (0.60/day)
Likes
408
System Name Eldritch
Processor AMD Ryzen 5 1500X
Motherboard MSI B350 PC Mate
Cooling Satan's butthole after going to Taco Bell
Memory 16 GB G.Skill Flare X
Video Card(s) nVidia (Gigabyte) GT 740 2GB
Storage 80 GB IBM, 2 TB WD Green
Display(s) Dell 2007WFP
Software Debian Buster
#8
Hoping for Java to die is like Hell freezing over, it ain't gonna happen.
But could you imagine how much happier programmers would be when nobody forces them to learn and/or use it?
 

Aquinus

Resident Wat-man
Joined
Jan 28, 2012
Messages
10,401 (4.84/day)
Likes
5,481
Location
Concord, NH
System Name Kratos
Processor Intel Core i7 3930k @ 4.2Ghz
Motherboard ASUS P9X79 Deluxe
Cooling Zalman CPNS9900MAX 130mm
Memory G.Skill DDR3-2133, 16gb (4x4gb) @ 9-11-10-28-108-1T 1.65v
Video Card(s) MSI AMD Radeon R9 390 GAMING 8GB @ PCI-E 3.0
Storage 2x120Gb SATA3 Corsair Force GT Raid-0, 4x1Tb RAID-5, 1x500GB
Display(s) 1x LG 27UD69P (4k), 2x Dell S2340M (1080p)
Case Antec 1200
Audio Device(s) Onboard Realtek® ALC898 8-Channel High Definition Audio
Power Supply Seasonic 1000-watt 80 PLUS Platinum
Mouse Logitech G602
Keyboard Rosewill RK-9100
Software Ubuntu 17.10
Benchmark Scores Benchmarks aren't everything.
#9
But could you imagine how much happier programmers would be when nobody forces them to learn and/or use it?
It really depends on what you consider bad. Do you consider Java as a programming language bad or do you consider the JVM bad? Personally, I've been enjoying Clojure, which is a functional language and a dialect of Lisp and it was written on top of Java and the JVM. Now I can write Clojure code (which I think looks pretty elegant as a language,) and I still have the benefits that Java provides while writing a minimal of Java code.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
20,922 (6.24/day)
Likes
10,023
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#10
I'd rather Microsoft open up .NET and people create languages/compilers for .NET instead of JVM.
 
Joined
Feb 8, 2012
Messages
2,678 (1.25/day)
Likes
1,914
Location
Zagreb, Croatia
System Name Windows 7 64-bit Core i5 3570K
Processor Intel Core i5 3570K @ 4.2 GHz, 1.26 V
Motherboard Gigabyte GA-Z77MX-D3H
Cooling Scythe Katana 4
Memory 4 x 4 GB G-Skill Sniper DDR3 @ 1600 MHz
Video Card(s) Gainward NVIDIA GeForce GTX 970 Phantom
Storage Western Digital Caviar Blue 1 TB, Seagate Baracuda 1 TB
Display(s) Dell P2414H
Case CoolerMaster Silencio 550
Audio Device(s) VIA HD Audio
Power Supply Corsair TX v2 650W
Mouse Steelseries Sensei
Keyboard CM Storm Quickfire Pro, Cherry MX Reds
Software MS Windows 7 Enterprise 64-bit SP1
#11
I'd rather Microsoft open up .NET and people create languages/compilers for .NET instead of JVM.
Mono is open. Unity game engine has Mono embedded and uses #C (.NET 2.0 subset) as scripting language. It works really well.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
20,922 (6.24/day)
Likes
10,023
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#12
Mono doesn't have WPF. C# is not a new language to the .NET framework. It is using the same compilers already included with .NET. I was talking about new languages compiled for .NET like Haskell, Java, or whatever. That way you could use .NET instead of JVM.
 
Joined
Apr 26, 2008
Messages
1,106 (0.31/day)
Likes
178
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
#13
Rewrote how shapes are handled and added scroll bar functionality.
PS. All buttons are always visible for convenient bug finding.

Microsoft's implementation is brilliant:
http://msdn.microsoft.com/en-us/library/system.windows.forms.aspx

If you're talking GPU accelerated forms, Windows Presentation Foundation is also brilliant, but difficult to master:
http://msdn.microsoft.com/en-us/library/system.windows.aspx
I prefer to make my own libraries. It's more entertaining that way. Since I don't program for any serious reasons, that's the only thing that matters.


EDIT: Added a crappy tech demo to the OP.
 
Last edited:
Joined
Apr 26, 2008
Messages
1,106 (0.31/day)
Likes
178
Location
london
System Name Staggered
Processor Intel i5 6600k (XSPC Rasa)
Motherboard Gigabyte Z170 Gaming K3
Cooling RX360 (3*Scythe GT1850) + RX240 (2*Scythe GT1850) + Laing D5 Vario (with EK X-Top V2)
Memory 2*8gb Team Group Dark @3000Mhz 16-16-16-36 1.25v
Video Card(s) Inno3D GTX 1070 HerculeZ
Storage 256gb Samsung 830 + 2*1tB Samsung F3 + 2*2tB Samsung F4EG
Display(s) Flatron W3000H 2560*1600
Case Cooler Master ATCS 840 + 1*120 GT1850 (exhaust) + 1*230 Spectre Pro + Lamptron FC2 (fan controller)
Power Supply Enermax Revolution 85+ 1250W
Software Windows 10 Pro 64bit
#14
Added resize functionality and cleaned up the maths in the Layer class. The only thing left for the Layer class is minimizing/maximizing and closing.
 

Zygmunt

New Member
Joined
Jul 19, 2013
Messages
8 (0.00/day)
Likes
1
#15
Java Is a broad language.

My dear Java is totally object oriented and broad language. You can do many things which you can't do in other language. You can use Net beans to code java project or GUI forum design, It would help you and make Java easy for you.
 

RCoon

Gaming Moderator
Staff member
Joined
Apr 19, 2012
Messages
11,370 (5.50/day)
Likes
9,511
Location
Gypsyland, UK
System Name HP Omen 17
Processor i7 7700HQ
Memory 16GB 2400Mhz DDR4
Video Card(s) GTX 1060
Storage Samsung SM961 256GB + HGST 1TB
Display(s) 1080p IPS G-SYNC 75Hz
Audio Device(s) Bang & Olufsen
Power Supply 230W
Mouse Roccat Kone XTD+
Software Win 10 Pro
#16
My dear Java is totally object oriented and broad language. You can do many things which you can't do in other language. You can use Net beans to code java project or GUI forum design, It would help you and make Java easy for you.
Only spammers use the phrase "my dear"

I'm watching you.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
20,922 (6.24/day)
Likes
10,023
Location
IA, USA
System Name BY-2015
Processor Intel Core i7-6700K (4 x 4.00 GHz) w/ HT and Turbo on
Motherboard MSI Z170A GAMING M7
Cooling Scythe Kotetsu
Memory 2 x Kingston HyperX DDR4-2133 8 GiB
Video Card(s) PowerColor PCS+ 390 8 GiB DVI + HDMI
Storage Crucial MX300 275 GB, Seagate 6 TB 7200 RPM
Display(s) Samsung SyncMaster T240 24" LCD (1920x1200 HDMI) + Samsung SyncMaster 906BW 19" LCD (1440x900 DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay
Audio Device(s) Realtek Onboard, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse SteelSeries Sensei RAW
Keyboard Tesoro Excalibur
Software Windows 10 Pro 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
#18
Java is not "totally object oriented," only partially. All primitives are not objects in Java (e.g. int, char, float, etc.). C#.NET and VB.NET are "totally object oriented." Everything is derived from the base class System.Object.