Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Best way to do a game menu, or main menu, pause menu, etc  (Read 4140 times)

0 Members and 1 Guest are viewing this topic.

vro

  • Newbie
  • *
  • Posts: 44
    • View Profile
Best way to do a game menu, or main menu, pause menu, etc
« on: August 06, 2011, 08:53:01 pm »
Is it better to have a separate sf::view for a menu, and move between it and the game view when the player presses the pause button or whatever.

Or do you just keep the default view as the only view and then draw whatever is needed? Like this (pseudo code)?

Code: [Select]

if (game_paused)
{
    app.draw(menu);
    updateGame = false;
}


or this?

Code: [Select]

if (game_paused)
{
    App.SetView(menu); // some view located at a different x, y
}

Spidyy

  • Sr. Member
  • ****
  • Posts: 493
    • View Profile
Best way to do a game menu, or main menu, pause menu, etc
« Reply #1 on: August 06, 2011, 11:10:37 pm »
Don't draw objects that are not supposed to be displayed.

First choice.

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
Best way to do a game menu, or main menu, pause menu, etc
« Reply #2 on: August 07, 2011, 09:17:20 am »
I'd keep separate views(it can make your game scrolling code, and menu code simpler). But as said, only draw the ones that you need in a given frame.

 

anything