Jump to content

  • Log In with Google      Sign In   
  • Create Account


Games with menus


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 0026sd   Members   -  Reputation: 132

Like
0Likes
Like

Posted 20 September 2012 - 12:03 PM

Hi everyone,

Just a general question. Are game menus (Start menu, pause menu, etc) typically put into their own class where all the drawing and logic would take place or are the menus all programmed in the main game logic class?

A lot of the tutorials and books I'm reading all have the start menu in the main game class however these are very simple menus (An image that says press enter to start game). I want to make complex menus with character stat selection and pause menus with options. Surely menus with so much logic wouldn't all be crammed into the main game class...?

Thanks,
Scott

Sponsor:

#2 ColinDuquesnoy   Members   -  Reputation: 1074

Like
1Likes
Like

Posted 20 September 2012 - 01:08 PM

In my main game class, I use a StateMachine to manage game states transitions.

A game state may be viewed as a specific game screen( a menu, a level, credits,...) and all game states communicate through the main game instance.

You might want to have a look at those articles that explains a general game engine architecture and game states management: http://lspiroengine.com/?p=351 and http://lspiroengine.com/?p=361

#3 bennettbugs   Members   -  Reputation: 493

Like
1Likes
Like

Posted 20 September 2012 - 04:15 PM

What I have for my engine are 2 states: "In Game" and "In Screen". Since it is a 3D game, I separated the game and screen drawing and logic. So if the user goes into the credits, the main menu, the pause menu, etc. it switches states. I also have an interface for "Screens" or "Menus" which helps for general or specific menus.

I even wrote my own external menu loader that can load script files that are human-readable, or compiled for faster loading, and custom compiler.

#4 0026sd   Members   -  Reputation: 132

Like
0Likes
Like

Posted 21 September 2012 - 05:26 AM

Thank you both for your insight! This is excalty what I'm looking for!

#5 Pointer2APointer   Members   -  Reputation: 283

Like
0Likes
Like

Posted 22 September 2012 - 02:33 PM

You should code in the parts of your game structure the way you see it best.

You can actually have hierarchial classes that manage game states and share some resources(e.g. drawing, animation, level, menu, AI), you can use enumerations, or even simple function/method calls for basic tasks, non-member.

I'd place a menu controller inside a class, and pass the necessary constructor to create the data for character stat selection, and call a drawing function to take it on from there.

Lastly, you can have a garbage collection member-class (if necessary) to deallocate all the used memory as well.
Yes, this is red text.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS