Hello, i have a little Problem. I'm programming a little Pong Game. For this I'm using two Gamestates, the MainMenu and the Playstate. Now if I am at the Playstate, i want the ESCPAE Button to go back to the MainMenu.
Now if I'm in the Playstate and move the mouse to the left side of the window, it also goes back to the MainMenu.
With this code :
if (event.type = sf::Event::KeyPressed)
{
if (event.key.code == sf::Keyboard::Escape)
{
game.ChangeState(Game::gameStates::MAINMENU);
}
}
I'm checking if ESCAPE was pressed. Now if I dont use this code, it doesnt move back to the MainMenu if i move the mouse to the left of the window.
Do you have any ideas what I'm doing wrong?