Sign in to follow this  
  • entries
    223
  • comments
    165
  • views
    79327

GUI code design

Sign in to follow this  
Stephen R

74 views

I got my fonts rendering nicely. It wasn't really that much of a challenge and I already had most of the groundwork in place from my general sprite drawing functions.

Most of the work has been done in the Input class for Immediate input. I just have to code up a few more client functions for checking whether keys were just released etc., and then I'll be able to get down to working on my GUI code.

I want to design the interface in such a way that I can easilly add new ellements, such as buttons and ingame windows. At the moment the engine is working off a basic game state stack system, with the various screens being represented by a new game state. Its how I did Maul Ball and my last few graphical games. This game is going to require a better GUI interface so I may as well do it properly.

I'm think the best thing to do would have a base GUIParent class, which I will inherit from my game state interface and the GUIElement class. The GUIElement class would have children GUIElements and would form a basic tree structure. Each GUIElement would contain a pointer to the GUIParent class as well as their immediate GUIElement parent. This would allow me to filter down mouse clicks to the correct objects quickly as well as allowing each of the objects to make changes to the game state easilly.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now