June 18, 2019, 07:10:51 PM

Author Topic: Qube's Game Framework - The dreaded GUI  (Read 1194 times)

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1901
Re: Qube's Game Framework - The dreaded GUI
« Reply #45 on: June 12, 2019, 03:46:22 AM »
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
Until the next time...

Offline Derron

  • Hero Member
  • *****
  • Posts: 2154
Re: Qube's Game Framework - The dreaded GUI
« Reply #46 on: June 12, 2019, 06:06:56 AM »
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

Offline blinkok

  • Jr. Member
  • **
  • Posts: 98
Re: Qube's Game Framework - The dreaded GUI
« Reply #47 on: June 12, 2019, 07:14:25 AM »
Sounds like a job for AGK Studio monitoring variables at a really slow frame rate

Offline Dabz

  • Full Member
  • ***
  • Posts: 150
  • Is it cos I is ginger?
    • dabzy.co.uk
Re: Qube's Game Framework - The dreaded GUI
« Reply #48 on: June 12, 2019, 06:27:01 PM »
Hi Qube

*Dabz runs*

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

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 1802
Re: Qube's Game Framework - The dreaded GUI
« Reply #49 on: June 12, 2019, 06:42:54 PM »
You wouldn't like me when I'm angry lol   ;)
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
MacOS Mojave, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB.
Linux Mint 19.1, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1901
Re: Qube's Game Framework - The dreaded GUI
« Reply #50 on: June 12, 2019, 10:35:32 PM »
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
Until the next time...

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 1802
Re: Qube's Game Framework - The dreaded GUI
« Reply #51 on: June 12, 2019, 10:38:27 PM »
\o/
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
MacOS Mojave, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB.
Linux Mint 19.1, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1901
Re: Qube's Game Framework - The dreaded GUI
« Reply #52 on: June 16, 2019, 02:14:32 AM »
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 :

Code: [Select]
// 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 :

Code: [Select]
// 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.
Until the next time...

Offline Dabz

  • Full Member
  • ***
  • Posts: 150
  • Is it cos I is ginger?
    • dabzy.co.uk
Re: Qube's Game Framework - The dreaded GUI
« Reply #53 on: June 16, 2019, 06:14:42 AM »
This looks brill, very swish Qubey hey!  8)

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

Offline blinkok

  • Jr. Member
  • **
  • Posts: 98
Re: Qube's Game Framework - The dreaded GUI
« Reply #54 on: June 17, 2019, 02:19:09 AM »
Looking very nice.
The code looks good too

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1901
Re: Qube's Game Framework - The dreaded GUI
« Reply #55 on: June 17, 2019, 02:35:09 AM »
This looks brill, very swish Qubey hey!  8)

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
Until the next time...

Offline MikeHart

  • Hero Member
  • *****
  • Posts: 585
  • Cerberus-X Dev Team
    • Cerberus X
Re: Qube's Game Framework - The dreaded GUI
« Reply #56 on: June 17, 2019, 05:18:13 AM »
Good job Qube.

Offline Qube

  • Administrator
  • Hero Member
  • *****
  • Posts: 1901
Re: Qube's Game Framework - The dreaded GUI
« Reply #57 on: June 17, 2019, 07:06:47 AM »
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.
Until the next time...

Offline Xerra

  • Hero Member
  • *****
  • Posts: 602
    • Retro Evolved
Re: Qube's Game Framework - The dreaded GUI
« Reply #58 on: June 17, 2019, 05:26:19 PM »
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 :-)

Offline Rick Nasher

  • Hero Member
  • *****
  • Posts: 707
Re: Qube's Game Framework - The dreaded GUI
« Reply #59 on: June 17, 2019, 09:19:38 PM »
Looking good Qube!
_______________________________________
 B3D + physics + shaders + X-platform = AGK!
:D ..ALIENBREED *LIVES* (thanks to Qube).. :D
_______________________________________