Qube's Game Framework - The dreaded GUI

Started by Qube, April 09, 2019, 01:19:33

Previous topic - Next topic

Qube

#45
Oh what a fun day this has been.. So I finally begin to add in GUI windows via code that the GUI designer outputs. Up pops the window but not as a focused one ( why not!, why? ), the buttons are disabled and the text boxes won't accept input :o completely fubared for some reason.

The GUI creation code is fine but there is an issue with just inserting windows + gadgets into the mix. This is really odd as the test GUI functions ( you've seen the videos ) does exactly that and that has been rock solid since day one. Really really weird.

I bet this turns out to be a tiny crappy super quick bug to fix but finding where sucks the life out of you.

I've stress tested the GUI via the test function and created 5000 windows and it works fine, yet something is causing a massive problem with adding a new window which oddly is the exact method as the working stress test. Gah!, as said it's more likely something really stupid that I'm just missing but I'm giving up tonight to recharge the old brain cells. I'll aim for the "code in your sleep" solution ;D

Hopefully I'll find the stupid cause of this stupid issue later today but if you say "Hi Qube" today and I rip your head off you'll know I'm still bug hunting ;D
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Derron

Is AGK code position dependent (include vs import) and now definitions are done later?
Are some code lines called differently now? (Split update / Draw)?

Bye
Ron

blinkok

Sounds like a job for AGK Studio monitoring variables at a really slow frame rate

Dabz

Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Steve Elliott

You wouldn't like me when I'm angry lol   ;)
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Qube

Quote from: Dabz on June 12, 2019, 18:27:01
Hi Qube

*Dabz runs*

Dabz
I'm OK now, I've pinned down the bugs and reworked a few sections and it's all back to working how it should be ;D
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Steve Elliott

Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Qube

Finally in the final stages of what turned out to be a beast to code and get all working together :(

The GUI designer was a hell of a lot more work than I thought and as I've never done a full on proper GUI before it's been a bit of a fight at times with some really odd bugs cropping up. I did write a very basic GUI on the Amiga but it was all static windows with very few controls and limited in so many ways.

At least I'm now 95% complete on both the GUI and GUI designer, yay!.. No doubt there will be more to add over time which I'll do as and when certain gadgets / features need adding.

No thrilling videos today ( sorry :P ) but a couple of screen shots :

1.. Creating a very simple dialog box to test the code creation.



2.. Using the created source code by the GUI designer to aid in making GUI designer forms :P



I can save and load forms into the designer in case I need to tweak or alter them at a later date and also output to the source code. The source code is split up into form and logic code

Form :


// Create the Window and Gadgets for Window "Load GUI Window"

gui_Create_Window( 1, 188, 17, 152, 200, "Load GUI Window", 255, 255, 255, 0, 0, "", 1, 0 )
gui_Create_TextLabel( 1, "label 1", 8, 129, "Filename", "left", 255, 255, 255 )
gui_Create_Button( 1, "button 1", 1, 8, 158, 56, "Load", 1 )
gui_Create_Button( 1, "button 2", 1, 89, 157, 56, "Cancel", 1 )
gui_Create_TextBox( 1, "textbox 1", 44, 124, 100, "", defaultCharset, 256, 255, 255, 255, 1 )
gui_Create_ListBox( 1, "listbox 1", 8, 8, 136, 112, 1 )

// gui_Window_Show( 1 ) // window is not shown by default


Logic :


// Event code for the Window "Load GUI Window"

// ListBox - Label 'listbox 1'
If gui_Event_Get( thisEvent ) = gui_Event_Match( 1, "listbox 1" )
    gui_Gadget_Find( 1, "listbox 1" )
    // code here if you need to take action when an item is selected
    // itemID = guiGadgets[ guiFoundGadget ].itemId
    // itemText = guiGadgets[ guiFoundGadget ].itemText
    // To add items to a listbox : gui_ListBox_Add_Item( label_of_listbox, item_text )
EndIf

// TextBox Clicked - Label 'textbox 1'
If gui_Event_Get( thisEvent ) = gui_Event_Match( 1, "textbox 1" )
    gui_Gadget_Find( 1, "textbox 1" )
    // code here if you need to take action when this textbox is selected
    // text = guiGadgets[ guiFoundGadget ].text
EndIf

// Text Label Clicked - Label 'label 1' - 'Filename'
If gui_Event_Get( thisEvent ) = gui_Event_Match( 1, "label 1" )
    gui_Gadget_Find( 1, "label 1" )
    // code here if you need to take action when this label is clicked on
    // labelName = guiGadgets[ guiFoundGadget ].text
EndIf

// Button Clicked - Label 'button 1' - 'Load'
If gui_Event_Get( thisEvent ) = gui_Event_Match( 1, "button 1" )
    gui_Gadget_Find( 1, "button 1" )
    // code here if you need to take action when this button is clicked on
    // buttonName = guiGadgets[ guiFoundGadget ].text
EndIf

// Button Clicked - Label 'button 2' - 'Cancel'
If gui_Event_Get( thisEvent ) = gui_Event_Match( 1, "button 2" )
    gui_Gadget_Find( 1, "button 2" )
    // code here if you need to take action when this button is clicked on
    // buttonName = guiGadgets[ guiFoundGadget ].text
EndIf


All the possible events are included with helper information for each gadget. Just delete what you don't need and code where you do. I've still to add more helper info to some gadgets but most are done.

Overall this will save a lot of time when I start the tools as manually writing out GUI stuff is very slow.
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Dabz

This looks brill, very swish Qubey hey!  8)

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

blinkok

Looking very nice.
The code looks good too

Qube

Quote from: Dabz on June 16, 2019, 06:14:42
This looks brill, very swish Qubey hey!  8)

Quote from: blinkok on June 17, 2019, 02:19:09
Looking very nice.
The code looks good too
Thanks :) - It's been a months+ worth of sometimes mind numbing / brain twisting work but it'll save a lot of time having the visual side create the source over hand coding such things.

All this work to create a few game based tools :o - I could of written the tool in something like VS or Delphi but I want to me able to jump in and out of game dev and see the real onscreen results, hence this mad venture.

Luckily I'm not too far away now from this side being all complete as up until towards the end it became very boring to do :P
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

MikeHart


Qube

Quote from: MikeHart on June 17, 2019, 05:18:13
Good job Qube.
Cheers :) - I know it's a very boring subject and not exciting but soon I can start on the swishy whishy new level maker which will have some cool features in it which should make for more exciting postings / videos, like visually drawing enemy paths and actions and it'll output pure source code. Another big time saver is where you can quickly create the basics of a game and then dive in and alter / tweak it to how you want without being limited to what the level maker can do or manually having to create huge amounts of code repeatedly over games.

The main reason for all this was while dabbling with Unity I thought it'd be great to have visual tools to build basic parts of games and then output the pure optimised source code with no big back end runtime.

That's my overall goal and sadly why I had to start with doing a boring GUI and a designer. Not sure how all these plans will turn out but what I've worked out in my head the end result should be a big time saver.

Loads to do and it may all end up as a shit show but we'll see. As for now it's heading in the right direction. Next up are the game making tools which will be more fun to do as the crappy GUI side is almost done and I can start on the more visual fun side.
Mac Studio M1 Max ( 10 core CPU - 24 core GPU ), 32GB LPDDR5, 512GB SSD,
Beelink SER7 Mini Gaming PC, Ryzen 7 7840HS 8-Core 16-Thread 5.1GHz Processor, 32G DDR5 RAM 1T PCIe 4.0 SSD
MSI MEG 342C 34" QD-OLED Monitor

Until the next time.

Xerra

This reminds me of the time I wrote a program in Blitz on the Amiga to read in files created by GadTools library GUI creator and export Blitz source code files that formed the start of a new application. I did a pretty basic program and then found someone had already beaten me to it and done a much better job of it too. I bought his tool and my version went to the code graveyard in the sky. Oh the days before we had the internet and could preserve all our old crap :-)
M2 Pro Mac mini - 16GB 512 SSD
ACER Nitro 5 15.6" Gaming Laptop - Intel® Core™ i7, RTX 3050, 1 TB SSD
Vic 20 - 3.5k 1mhz 6502

Latest game - https://xerra.itch.io/Gridrunner
Blog: http://xerra.co.uk
Itch.IO: https://xerra.itch.io/

Rick Nasher

_______________________________________
B3D + physics + shaders + X-platform = AGK!
:D ..ALIENBREED *LIVES* (thanks to Qube).. :D
_______________________________________