December 2015
Beginner to intermediate
522 pages
11h 21m
English
One might simply consider navigating to the main menu from the game state as a way of putting the game on pause. While that's technically true, why not explore a second option, which looks much trendier than simply popping the main menu open? After writing so much code, we deserve a nice looking paused state:
class State_Paused : public BaseState{
public:
...
void Unpause(EventDetails* l_details);
private:
sf::Text m_text;
sf::RectangleShape m_rect;
};This one is quite simple. Once more, we define an additional method, in this case Unpause, to switch to a different state. There's also only two data members used in order to draw the text "PAUSED" on screen, as well as a nice semi-transparent backdrop, represented by the sf::RectangleShape ...
Read now
Unlock full access