The means to pause
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. Let's implement the OnCreate method for the last time in this chapter:
void State_Paused::OnCreate(){
SetTransparent(true); // Set our transparency flag.
m_font.loadFromFile("arial.ttf");
m_text.setFont(m_font...