SFML community forums

Help => System => Topic started by: KarmaKilledtheCat on September 21, 2013, 01:14:08 am

Title: Getting multiple key presses in the same frame
Post by: KarmaKilledtheCat 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?
Title: Re: Getting multiple key presses in the same frame
Post by: zsbzsb 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 (http://en.sfml-dev.org/forums/index.php?topic=12922.msg90416#msg90416) for my answer.