Skip to main content
GameDev.net gamedev.net
🔒 Locked

Designing a menu system

Started by cptrnet Sep 27, 2006 at 2:30 PM 7 replies 2.3k views
Original Post
cptrnet
cptrnet
Hello gamedev, I have tried to design a menu system and I think that I don't know what I am doing. First of all I made it in C++ but I would like to design something for any language. I just made it like the menus that windows use like Menu, Submenu, MenuItem type stuff. But I was thinking about how to make a menu appear on the main screen, like One Player, Two Player, Options, etc. And then for options it would be another menu. So I would have just two classes Menu and MenuItem. For menu I would have if it is active or not whether or not it renders. I would need it to have input so it would cycle through the menu items. And a command key to whether or not they select them item, that is just for the keyboard. The mouse would be easy, if they clicked on the menu item it would run the command for that item. Should I just start off with that? Am I going to far for something simple, I just want something that I can apply to all my games but a menu system is simple enough I think it doesn't have to have all this complicated stuff, I don't know. If anyone can give me some pointers it would be appreciated.
If you insist on saying "DUH", try to make a post that makes a little more sense
Grain
Grain
Not sure about your overall question, but I notice that if Menu is derived from MenuItem. Then sub menus are easy to do just by sticking one menu inside another as one of its items.
cptrnet
cptrnet
My question is about designing a Menu System. I listed some things I thought it should have and then asked if I should go through all the trouble of building a system or just make a different one per game meaning every game I make I write code for.
If you insist on saying "DUH", try to make a post that makes a little more sense
Endar
Endar
Quote:
Original post by cptrnet
My question is about designing a Menu System. I listed some things I thought it should have and then asked if I should go through all the trouble of building a system or just make a different one per game meaning every game I make I write code for.


Unless, you're attempting to learn how to create a menu system, you should find a third party GUI that does all of this, and then use it in your games.

It will be much quicker, and as long as you find a reputable one, you can be reasonably sure that it won't be broken.

I'm currently trying to use Crazy Eddie's GUI.
[size="2"][size=2]Mort, Duke of Sto Helit: NON TIMETIS MESSOR -- Don't Fear The Reaper
cptrnet
cptrnet
Yes I am trying to learn how to do this. Using other peoples code is great and I would like to learn from their code but finding code is the hard part. I would just like to find out how other people are doing this so I can at least make something simple. Thanks for the link.
If you insist on saying "DUH", try to make a post that makes a little more sense
Extrarius
Extrarius
I would probably use three main classes: MenuBar, Menu, MenuItem
MenuBar is an ordered collection of Menu objects, and Menu is an ordered collection of MenuItem objects.

Next, make MenuItem polymorphic and make two subclasses: MenuCommand and SubMenu. MenuCommand will make the menu send a message, return a value, or otherwise indicate to other parts of the program that it's been clicked. SubMenu tells the program to pop up the Menu object it contains.

That is really all you need for the menu system itself, but it requires that you already have a basic GUI system in place.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
flangazor
flangazor
I'm not sure what you mean by menu system here, but if you mean a data driven menu interface, please reconsider. If you have so many options to choose from that you can't be bothered to go through them all and code a proper interface for them, a user isn't going to like going through a menu! It's simply too many items!

Consider a combo box that looks for the option the user types -like a URL bar in most browsers; or intellisense/omnicomplete in many editors.

This way, it can be data driven AND nice to use.

If you're not doing a data driven menu system, I'll shut up now.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.