• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

[Programming Project] Renderer unspecific GUI Library

Joined
Apr 26, 2008
Messages
1,126 (0.19/day)
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
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:
Joined
Apr 19, 2012
Messages
12,062 (2.76/day)
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
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
18,914 (2.86/day)
Location
Piteå
System Name Black MC in Tokyo
Processor Ryzen 5 5600
Motherboard Asrock B450M-HDV
Cooling Be Quiet! Pure Rock 2
Memory 2 x 16GB Kingston Fury 3400mhz
Video Card(s) XFX 6950XT Speedster MERC 319
Storage Kingston A400 240GB | WD Black SN750 2TB |WD Blue 1TB x 2 | Toshiba P300 2TB | Seagate Expansion 8TB
Display(s) Samsung U32J590U 4K + BenQ GL2450HT 1080p
Case Fractal Design Define R4
Audio Device(s) Line6 UX1 + some headphones, Nektar SE61 keyboard
Power Supply Corsair RM850x v3
Mouse Logitech G602
Keyboard Cherry MX Board 1.0 TKL Brown
VR HMD Acer Mixed Reality Headset
Software Windows 10 Pro
Benchmark Scores Rimworld 4K ready!
Meh, Java isn't so bad.
 

FordGT90Concept

"I go fast!1!11!1!"
Joined
Oct 13, 2008
Messages
26,259 (4.65/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
Last edited:

Aquinus

Resident Wat-man
Joined
Jan 28, 2012
Messages
13,147 (2.96/day)
Location
Concord, NH, USA
System Name Apollo
Processor Intel Core i9 9880H
Motherboard Some proprietary Apple thing.
Memory 64GB DDR4-2667
Video Card(s) AMD Radeon Pro 5600M, 8GB HBM2
Storage 1TB Apple NVMe, 4TB External
Display(s) Laptop @ 3072x1920 + 2x LG 5k Ultrafine TB3 displays
Case MacBook Pro (16", 2019)
Audio Device(s) AirPods Pro, Sennheiser HD 380s w/ FIIO Alpen 2, or Logitech 2.1 Speakers
Power Supply 96w Power Adapter
Mouse Logitech MX Master 3
Keyboard Logitech G915, GL Clicky
Software MacOS 12.1
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
26,259 (4.65/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
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.57/day)
Location
Dallas, Tx
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
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,850 (0.36/day)
System Name Eldritch
Processor AMD Ryzen 5 5800X3D
Motherboard ASUS TUF X570 Pro Wifi
Cooling Satan's butthole after going to Taco Bell
Memory 64 GB G.Skill TridentZ
Video Card(s) Vega 56
Storage 6*8TB Western Digital Blues in RAID 6, 2*512 GB Samsung 960 Pros
Display(s) Acer CB281HK
Case Phanteks Enthoo Pro PH-ES614P_BK
Audio Device(s) ASUS Xonar DX
Power Supply EVGA Supernova 750 G2
Mouse Razer Viper 8K
Software Debian Bullseye
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
13,147 (2.96/day)
Location
Concord, NH, USA
System Name Apollo
Processor Intel Core i9 9880H
Motherboard Some proprietary Apple thing.
Memory 64GB DDR4-2667
Video Card(s) AMD Radeon Pro 5600M, 8GB HBM2
Storage 1TB Apple NVMe, 4TB External
Display(s) Laptop @ 3072x1920 + 2x LG 5k Ultrafine TB3 displays
Case MacBook Pro (16", 2019)
Audio Device(s) AirPods Pro, Sennheiser HD 380s w/ FIIO Alpen 2, or Logitech 2.1 Speakers
Power Supply 96w Power Adapter
Mouse Logitech MX Master 3
Keyboard Logitech G915, GL Clicky
Software MacOS 12.1
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
26,259 (4.65/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
I'd rather Microsoft open up .NET and people create languages/compilers for .NET instead of JVM.
 
Joined
Feb 8, 2012
Messages
3,012 (0.68/day)
Location
Zagreb, Croatia
System Name Windows 10 64-bit Core i7 6700
Processor Intel Core i7 6700
Motherboard Asus Z170M-PLUS
Cooling Corsair AIO
Memory 2 x 8 GB Kingston DDR4 2666
Video Card(s) Gigabyte NVIDIA GeForce GTX 1060 6GB
Storage Western Digital Caviar Blue 1 TB, Seagate Baracuda 1 TB
Display(s) Dell P2414H
Case Corsair Carbide Air 540
Audio Device(s) Realtek HD Audio
Power Supply Corsair TX v2 650W
Mouse Steelseries Sensei
Keyboard CM Storm Quickfire Pro, Cherry MX Reds
Software MS Windows 10 Pro 64-bit
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
26,259 (4.65/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
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,126 (0.19/day)
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
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,126 (0.19/day)
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
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)
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.
 
Joined
Apr 19, 2012
Messages
12,062 (2.76/day)
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
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
26,259 (4.65/day)
Location
IA, USA
System Name BY-2021
Processor AMD Ryzen 7 5800X (65w eco profile)
Motherboard MSI B550 Gaming Plus
Cooling Scythe Mugen (rev 5)
Memory 2 x Kingston HyperX DDR4-3200 32 GiB
Video Card(s) AMD Radeon RX 7900 XT
Storage Samsung 980 Pro, Seagate Exos X20 TB 7200 RPM
Display(s) Nixeus NX-EDG274K (3840x2160@144 DP) + Samsung SyncMaster 906BW (1440x900@60 HDMI-DVI)
Case Coolermaster HAF 932 w/ USB 3.0 5.25" bay + USB 3.2 (A+C) 3.5" bay
Audio Device(s) Realtek ALC1150, Micca OriGen+
Power Supply Enermax Platimax 850w
Mouse Nixeus REVEL-X
Keyboard Tesoro Excalibur
Software Windows 10 Home 64-bit
Benchmark Scores Faster than the tortoise; slower than the hare.
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.
 
Top