using enum

hey der in sfml 2.3.1... i want to use 3 keys in keyboard for the same function..my code below does work but was hoping if there is an easier way to do dis using enum or something else.....am very new in sfml..thanx in advance..


1
2
3
4
 if(sf::Keyboard::isKeyPressed(sf::Keyboard::Space))&&(sf::Keyboard::isKeyPressed(sf::Keyboard::Left))&&(sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) 
{  
//some code
}
You generally should not use isKeyPressed, instead you should listen to keydown and keyup events and track the key states yourself as part of the event loop. This guarantees consistent behavior from the point of view of the player.
Topic archived. No new replies allowed.