3
« on: March 11, 2018, 03:36:13 pm »
I have a multiplayer_game class in my game, which is responsible for playing that game between two players. After pressing the Escape button, I want to go instantly back to the choose_player window, where you can choose the game mode(singleplayer/multiplayer). To do that, I'm using this code :
sf::Event event;
while (window->pollEvent(event))
{
if ((event.type == sf::Event::KeyReleased) && (event.key.code == sf::Keyboard::Escape))
{
coreState.SetState(new choose_player);
}
}
The problem is, hitting the escape button doesn't always respond (most of the time it takes me back to the choose_player mode,but sometimes several pressing on the escape is necessary).