May 31, 2007
Creating a GUI Module
First of all, I’m not sure if this has been done already by someone in the BlitzMAX community, since I didn’t search for one. It’s very likely that it exists, but even so, I decided to create my own GUI module that will work inside the game itself, not as a separate window like I did in beta 0.4b. What will I use this for? Showing the user profiles; creating, editing, deleting profiles; main menu buttons; options menu; some in-game menus; and on and on… Well, I won’t make a complete module for this, I will only add what I will need in this game. In the future, if I need something else, I’ll just add. This will be a very personal module, without any documentation or explanation of the features, only designed for my own personal use.
I started working on it tonight, and things have been good so far. Until now, I only created three types: the basic entity, the window and the menu types. I won’t even explain the “features” since this screenshot shows it all:
The windows are drag-able. The window focus is not manual, it is controlled by the program. So, you won’t be able to select a window by clicking the title bar; if I want you to see a window, you’ll see that window 😛 At first this sounds as a limitation, but there are no cases in the game where this will be needed. For example, when you click the “New Profile” button, this happens:
I don’t want people to be able to drag the “Create New Profile” window away and mess with the main profile window. Of course I could just disable manual focus in this case, but like I said, there are zero situations in the game that will need a manual focus.
As for how things work, I was thinking about making the button emit a event when it is pressed, same for the window when it is dragged, but I realized that I would still need to make the event be emitted manually(unless there is a reason to do that automatically that I don’t know of), so having some code to detect where the mouse is and what it pressed so then the event can be emitted and another part of code to check if an event was emitted, who emitted it, and then execute the action would just make things larger. So this will be like that unless I find a better use to the events.
I have also worked on the game a bit, as you can see up there. In addition to this neat window, I also made several changes to the game itself, added new buildings and weapons, and kinda made things more challenging 🙂
Until next time.