SFML community forums

Help => Graphics => Topic started by: vro on August 06, 2011, 08:53:01 pm

Title: Best way to do a game menu, or main menu, pause menu, etc
Post by: vro 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
}
Title: Best way to do a game menu, or main menu, pause menu, etc
Post by: Spidyy on August 06, 2011, 11:10:37 pm
Don't draw objects that are not supposed to be displayed.

First choice.
Title: Best way to do a game menu, or main menu, pause menu, etc
Post by: thePyro_13 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.