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

Author Topic: Event  (Read 1176 times)

0 Members and 1 Guest are viewing this topic.

wvtrammell

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
Event
« on: October 28, 2010, 04:47:23 pm »
Which is proper to use in graphics:

If(App.GetInput().IsKeyDown(sf::Key::F1))

or  

if(Event.Type == sf::Event::KeyPressed):: && (Event.Key.Code == sf::Key::F1))

They both appear to function.

Thanks
Warren

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Event
« Reply #1 on: October 28, 2010, 04:54:06 pm »
The first one will return true as long as the key is down.
With the second one, you will be notified once when the key is pressed.

So it depends what you want to do.

Have you read the events tutorial?
Laurent Gomila - SFML developer

 

anything