r/ComputerCraft • u/ElectronGames • Aug 22 '25
I'm building a framework to make building GUI's easier
Its a hassle normally to make a GUI with buttons and positioning so i built a GUI library to help with it.
You would give it a table that defines the structure kinda similar to how HTML works in a way i would think, it would take this table and recursively go through it creating new terminals for each section. Every section with a name value gets that terminal stored in an array where its easy to access each terminal to edit different sections of your GUI independently.
GUI's made with this will also be responsive, meaning they will work on larger screens. The size value of the sections define how many lines it will take of the parent section, but if its set to "fill", the library will automatically determine the size of the section to fill as much space as possible without becoming too large. If the size value is not set it will default to the fill mode.
It also provides a function for making clickable buttons easier which you just pass the name of the terminal you want to check for, and the x and y of the click and it will return true or false for whether that terminal was clicked or not.
Here's the table that defines the GUI layout in the screenshot:
local menu = {{
name = 'top',
size = 4
}, {
flow = "horizontal",
contents = {{
name = 'left',
}, {
name = 'right',
contents = {{
name = 'testButton',
size = 3,
}}
}}
}, {
name = 'bottom',
size = 2
}}local menu = {{
name = 'top',
size = 4
}, {
flow = "horizontal",
contents = {{
name = 'left',
}, {
name = 'right',
contents = {{
name = 'testButton',
size = 3,
}}
}}
}, {
name = 'bottom',
size = 2
}}Let me know if y'all have any questions or suggestions for it, its not done yet i still plan on adding more features
6
u/toasohcah toastonryeYT Aug 22 '25
Will it be easier than Basalt? Basalt looks very cool but I have a hard time understanding anything outside the few examples.
1
u/[deleted] Aug 22 '25
Nice! How are you handling the drawing and clicks on buttons? Are you using some kind of callback or a loop to check? Do you use a loop which constantly redraws or only when it needs to? Do you use timers?
1
u/No_Substance_9569 Aug 22 '25
Have you seen PixelUI yet?
https://shlomo1412.github.io/pixelui-website/
1
u/tretarius Aug 23 '25
Always nice to see a fellow Lua enjoyer
1
u/Perfect-Ad7440 Dec 05 '25
https://www.reddit.com/r/electronjs/comments/1ow2p8d/ucbuilder_build_and_manage_electron_apps_easily/?utm_source=share&utm_medium=mweb3x&utm_name=mweb3xcss&utm_term=1&utm_content=share_button
0
u/[deleted] Aug 22 '25
[deleted] — view deleted comment