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

Author Topic: No respond from "sf::Event::KeyPressed" when i press a letter  (Read 3101 times)

0 Members and 1 Guest are viewing this topic.

zael2100

  • Newbie
  • *
  • Posts: 1
    • View Profile
When i press a letter "sf::Event::KeyPressed" dont work but when i press arrow keys or ctr, alt it is responding.
I'm using Linux: Solus

void Game::processEvents()
{
    sf::Event event;
    while (mWindow.pollEvent(event));
    {
        switch (event.type)
        {
            case sf::Event::KeyPressed:
                handlePlayerInput(event.key.code, true);
                log("key pressed");
                break;
           
            case sf::Event::KeyReleased:
                handlePlayerInput(event.key.code, false);
                log("key released");
                break;

            case sf::Event::Closed:
                mWindow.close();
                break;
        }
    }
}
 

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: No respond from "sf::Event::KeyPressed" when i press a letter
« Reply #1 on: May 25, 2020, 04:34:52 am »
Quote
while (mWindow.pollEvent(event));
Don't put ; at the end of your while line.