Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: The key pressed delay  (Read 2600 times)

0 Members and 1 Guest are viewing this topic.

led

  • Newbie
  • *
  • Posts: 28
    • View Profile
The key pressed delay
« on: January 30, 2010, 10:55:26 pm »
Hi,

Im doing a sprite to move to the left, and using:
Code: [Select]
if (evento.Type == evento.KeyPressed &&
evento.Key.Code == Key::A)
sMao.SetPosition(sMao.GetPosition().x - (1000*Window.GetFrameTime()),sMao.GetPosition().y);


but, when i press the A button still it does the same as im writing a text: the 1st A goes there but then a delay, after that delay it goes sending the A all over (if always pressed). Is there a solution for that?
Thanks
while (!idle)
{
   DoSomething();
}

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
The key pressed delay
« Reply #1 on: January 30, 2010, 10:58:24 pm »
Look at sf::Input. There are more explanations in the tutorial about events.
Laurent Gomila - SFML developer

led

  • Newbie
  • *
  • Posts: 28
    • View Profile
The key pressed delay
« Reply #2 on: January 31, 2010, 01:02:11 am »
It's working now thanks :wink:
while (!idle)
{
   DoSomething();
}