Jump to content
Sign in to follow this  
  • entries
  • comments
  • views

GUI code design

Sign in to follow this  
Stephen R


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  


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
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!