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

Author Topic: How check if "ANY" key is pressed (real time) in SFML.Net (C#)  (Read 2599 times)

0 Members and 1 Guest are viewing this topic.

Tigre Pablito

  • Full Member
  • ***
  • Posts: 226
    • View Profile
    • Email
Hi Ladies and Guys

I would need to check if "ANY" key is pressed, and if so, then see which of them is; but if no key is pressed, then ignore the "if" block.

I tried with "Keyboard.Key.Unknown" as argument of the "Keyboard.IsKeyPressed()" function, but if always returns false.

Is there any solution for this, that is not checking in the outer "if" block, one by one the possible keys that might be pressed?

The "if" block is into a "while (true) {}" loop, that ends depending on the input (it´s a menu).

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Why are you not using events?

Also don't just try random things and hope it does "something". That's not how programming works. ;)
Read the docs and understand the function's use case.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything