Using DDGui
To start using DDGui in your programs, you need to add the DDGui.gbas file to your program. You can do this by adding the file from the Samples → Common to your project.
The file will then be added to the sources list. Your project layout could then look like :
You could compile the project like this, but it certainly won't do much, so the first thing we need to do is create a window, using the following :
DDgui_pushdialog(0,0,100,100,FALSE)
This creates a window 100 by 100 pixels in height, positioned at 0 pixels across and 0 pixels down from the top left corner of the screen. We make sure that the window is not centred to the middle of the screen
To keep showing the window, we need to call the show window command in a loop, which in this case is DDgui_show.
This command takes one parameter which determines whether all created windows are displayed, or just the last one. Like all graphics commands in GLBasic, SHOWSCREEN has to be called to swap screen buffers and update the display.
So, the routine will be :
WHILE TRUE
DDgui_show(FALSE)
SHOWSCREEN
WEND
The full program looks like :
DDgui_pushdialog(0,0,100,100)
WHILE TRUE
DDgui_show(FALSE)
SHOWSCREEN
WEND
The full code is :
DDgui_pushdialog(0,0,100,100)
WHILE TRUE
DDgui_show(FALSE)
SHOWSCREEN
WEND
And the results look like :
As mentioned in the GLBasic Programmers Reference Guide, the fault font makes text hard to read, so its always a good idea to create a readable font at this point, and place it in the with the executable (non-Mac), or for the Mac, place in the Media directory and manually load the font.