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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - tortugapower

Pages: [1]
1
Window / Keyboard Input : event::keypressed vs. keyboard::isKeyPressed
« on: January 17, 2022, 08:34:27 pm »
[edit]
Too hasty a post, as I have found this chain:
https://en.sfml-dev.org/forums/index.php?topic=14350.0

To which zsbzsb's answer has given me something to chew on.

Cheers.



[original]
Hello. I have seen implementations for keyboard input done two ways:
1) while polling events, check event.type for event::keypressed
2) directly query keyboard::isKeyPressed(key)

I saw an SFML dev reference that either one could be used for, e.g., a player entity's movement (so long as the event method sets a boolean input state rather than enact movement directly, in order to avoid the initial stutter).

I have seen both of these work on my own (including correcting for the stutter). My question: is there a difference? It could be subtle or obvious, but I'd be happy to know more.

Thank you.

Pages: [1]