Forum de la communauté SFML

Aide => Général => Discussion démarrée par: Kargan le Janvier 14, 2017, 07:16:21 pm

Titre: Empty the Keyboard Event Buffer
Posté par: Kargan le Janvier 14, 2017, 07:16:21 pm
Hi !
I am a beginner in Game Programming and I have got a problem with "Keyboard::isKeyPressed"
I am doing this :

if(Keyboard::isKeyPressed(Keyboard::Return) && curseur==0)
          gameState=INTRO;

And in my 'INTRO' loop, i have this :

  if(Keyboard::isKeyPressed(Keyboard::Return))
          gameState=JEU;


The problem is when I press Return to enter the INTRO loop, I am entering directly in my JEU loop.

I know i could just use an other key but I don't like this solution
Titre: Re : Empty the Keyboard Event Buffer
Posté par: Laurent le Janvier 15, 2017, 09:46:41 am
You should use events instead.