Systems are good..

I’m really glad that I took the extra effort to clean up and refine our menu system. It helped me crank our new menus for our pause menu, options menu, controller layout screen etc. really easily.

I’ll describe briefly the architecture for the menu system ( big thanks to Ron Romero for his contribution).

The game has a MenuManager which knows about all the menu states that exist. It is the class which loads all your menus at the beginning, and the class you rely on to toggle between menu states. All of these menu states derive from a base MenuState class. The base class has functionality which lets it know about the player controlling the menu, as well as arrays to store the normal, rollover, and pressed textures for all the buttons in the derived classes. It also has an array of delegates ( or function pointers) which point to the callback associated with each button. When you create a new menu state, you derive from this class, and based on the number of buttons in your current menu, you initialize the texture arrays. You do not need to specify each of the locations for the textures for each button. I’ve created functionality which maps a string like “Options” to options_text_normal, options_text_rollover, and options_text_pressed, so that all these textures can be loaded automatically. All you have to do is fill in an array corresponding to these buttons ( Something like array={“Resume”, “ControlsLayout”, “Quit”}). You also have to decide what happens when each button is pressed, but that’s it! You menu is ready 🙂


Leave a Reply