Improving my GUI

Blitz3D Forums/Blitz3D Programming/Improving my GUI

OwlEpicurus(Posted 2009) [#1]
Any suggestions on how to improve this GUI? Mainly I am looking for ways to make it more effecient or to make it shorter (if possible).

There are two main areas of concern:
1) CheckMouse function -- The way the code is currently structured, the program would check all GUI items to see if the mouse is over anything at all. It then, over the course of several other functions, checks all of the items again. The purpose of this was to make sure MouseHit() and MouseDown() would only be counted if the user actually clicked on something. Is there a better way to do this? How?

2) Color and Image functions -- Towards the end of the code are four functions used to determine the color and background image of the window/button/etc. Would it be better to combine them into one function that alters global variables, or keep them as four seperate functions that return a value?

Any other comments are also welcome.



By itself the code won't run. To see a sample window, include this code:



Note that the colors can be changed by altering the values in the functions DetermineRed(), DetermineBlue(), and DetermineGreen(), and that one can add a background image or texture to the GUI by loading an image in the function DeterminImage().

Thanks in advance for your help.