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

Author Topic: Small isKeyPressed question  (Read 2556 times)

0 Members and 2 Guests are viewing this topic.

Fairlight0110

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Small isKeyPressed question
« on: March 29, 2024, 05:55:32 pm »
I've been trying to figure out how to get the key-code from a keypress in isKeyPressed.
This is easy to retrieve from event.key.code, but for the life of me I can't seem to weasel it out of isKeyPressed.

Any help would be appreciated.  Thanx in advance.

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Small isKeyPressed question
« Reply #1 on: March 30, 2024, 12:44:53 am »
You don't get the keycode from isKeyPressed, you pass as an argument the one you want to check.
https://www.sfml-dev.org/tutorials/2.6/window-inputs.php#keyboard

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Re: Small isKeyPressed question
« Reply #2 on: March 30, 2024, 01:06:29 pm »
Event handling and real-time input checks are two different concepts.

Whenever possible we recommend to handle events.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything