Game menu system

I’m wondering about design concept for menu systems. I don’t want to hard-code manually in my game the functionality and behaviour of my menu system, but rather want to design some abstract system that I can then use to implement a menu that is defined in like a xml file.

Let’s say you start a game, and you get this menu:

New game
Settings
About game
Exit game

And when you press Settings you get:
Audio settings
Video settings

But when you press “Audio settings” you get a little slider, sliding from low to high volume. And in “Video settings” you would be able to select a resolution. It’s really not possible to define this functionality in a xml file, that would be a overkill.

Any ideas? ???

I used a xml file to describe a gui and it worked fine. Code and example can be found here:
http://home.halden.net/tombr/gui/gui.html

Not sure I really need a complete gui system ::slight_smile:

I have to admit I did not know what your question was. First you said you want to use a xml instead of hard-coding. Then at the end you say xml would be overkill.

Anyway, the source I linked to contains code to read the xml and create a gui. There is also an example of the xml file. Since you mentioned gui and xml in your first post I thought it might be something you could look at as an example.

Nevermind, I think I can implement this without xml and the overhead that comes with creating a full blown gui menu system.

My idea is to create a abstract class MenuSheet, and then a class called MainMenuSheet (extends MenuSheet) which implements the behaviour of that menu. Or at least something in that direction.

You can think of each MenuSheet as a…sheet or a page, only one sheet is visible at any given time.
Each sheet contains buttons, and a button contains a pointer to the sheet it should display if clicked on.
When the button is clicked on the current sheet is rendered invisible, and the sheet the button points to is rendered visible.

I think it will be relatively fast, since only the active sheet is updated and drawn each frame.