Bienvenue, Invité. Merci de vous connecter ou de vous inscrire.
Avez-vous perdu votre e-mail d'activation ?

Auteur Sujet: Empty the Keyboard Event Buffer  (Lu 894 fois)

0 Membres et 1 Invité sur ce sujet

Kargan

  • Newbie
  • *
  • Messages: 2
    • Voir le profil
Empty the Keyboard Event Buffer
« 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

Laurent

  • Administrator
  • Hero Member
  • *****
  • Messages: 32504
    • Voir le profil
    • SFML's website
    • E-mail
Re : Empty the Keyboard Event Buffer
« Réponse #1 le: Janvier 15, 2017, 09:46:41 am »
You should use events instead.
Laurent Gomila - SFML developer