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

Author Topic: Getting multiple key presses in the same frame  (Read 3690 times)

0 Members and 1 Guest are viewing this topic.

KarmaKilledtheCat

  • Newbie
  • *
  • Posts: 23
    • View Profile
    • Email
Getting multiple key presses in the same frame
« on: September 21, 2013, 01:14:08 am »
bool InputManager::KeyPressed(int key, sf::Event Event)
{
        if (Event.type == sf::Event::KeyPressed)
                if (Event.key.code == key)
                        return true;
        return false;
}
 

I'm using this code to handle input in my game but this function can't receive 2 key presses in the same frame(even with 2 separate function calls). Does anybody have any ideas to fix this?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Getting multiple key presses in the same frame
« Reply #1 on: September 21, 2013, 01:22:29 am »
I have answered this multiple times in the .NET section, but the same principle applies to C++. See my reply here for my answer.
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

 

anything