A likely mistake that might be made when using this system is the absence of registration of newly added states. If you have built a state and it simply draws a black screen when you switch to it, chances are it was never registered in the constructor of StateManager
.
The window not responding to the F5 key being pressed or the close button being hit is a sign of the global callbacks not being set up right. In order to make sure a callback is invoked no matter which state you're in, it must be set up with the state type of 0, like so:
m_eventManager->AddCallback(StateType(0),"Fullscreen_toggle", &Window::ToggleFullscreen,this); m_eventManager->AddCallback(StateType(0),"Window_close", &Window::Close,this);
Finally, remember that when the mouse position is retrieved in the main menu state, the coordinates stored inside the event are automatically relative to the window. Obtaining coordinates through sf::Mouse::GetPosition
is not going to do the same, unless...