Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - nikoloz

Pages: [1]
1
Window / pollEvent takes too long to respond on keyRelease Event
« 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).


Pages: [1]
anything