Hi!
I am using this code:
sf::RenderWindow window(sf::VideoMode(800, 600, 32), "");
window.setKeyRepeatEnabled(false);
But, when I check if a key was pressed, the event runs (is triggered) 2 times.
To check the key, I use:
void GameManager::Update(sf::Event event)
{
ReleasedKey=sf::Keyboard::KeyCount; //basically "NoKey"
PressedKey =sf::Keyboard::KeyCount; //bascically "No Key"
switch (event.type)
{
case sf::Event::KeyReleased: ReleasedKey=event.key.code;
case sf::Event::KeyPressed: PressedKey=event.key.code;
default: break;
}
}
And:
GameManager game;
...
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed) window.close();
game.Update(event);
if (game.keyboard_check_pressed(sf::Keyboard::A))
std::cout << 'A' << endl;
}
I can not find the error... Please help me.
Note: I use Windows 7, Code::Blocks, MinGW, SFML 2.0.