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

Author Topic: Scancodes Round 3 & Release Readiness  (Read 582 times)

0 Members and 1 Guest are viewing this topic.


  • SFML Team
  • Hero Member
  • *****
  • Posts: 10467
    • View Profile
    • development blog
    • Email
Scancodes Round 3 & Release Readiness
« on: February 23, 2023, 10:46:30 am »
Already some weeks ago, we've merge the scancode implementation to the 2.6.x branch and thus closing the final feature of SFML 2.6
You can use the pre-built binaries or the SFML CMake Template to get started quickly.

Now, we're looking for people to help us test the version further and especially also try and make use of scancodes.
If you have a game or other project using SFML, I recommend to update to the 2.6.x branch and see how you can add keyboard layout independent keyboard handling with scancodes.

There are essentially four additions or enhancements to the existing API:

  • Introduction of a new enum for scancodes: sf::Keyboard::Scancode
  • Enhancement of the KeyEvent event union to also return the scan code: event.key.scancode
  • Real-time querying of the keyboard state: sf::Keyboard::isKeyPressed(sf::Keyboard::Scancode)
  • Best effort translation from scancodes to the current keyboard layout: sf::Keyboard::Key localize(sf::Keyboard::Scancode code)
  • Best effort translation from the current keyboard layout to scancodes: sf::Keyboard::Scancode delocalize(sf::Keyboard::Key key)
  • Retrieving of a human readable key description (e.g. for in-game UIs): sf::String getDescription(sf::Keyboard::Scancode code)

If you want to test the inputs independently, there's also the existing SFML-Input example.

Let us know how things work out for you and report any issues encountered.
Happy testing! :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
Dev Blog: https://duerrenberger.dev/blog/


  • Hero Member
  • *****
  • Posts: 3100
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Scancodes Round 3 & Release Readiness
« Reply #1 on: February 27, 2023, 05:39:58 pm »
Now that I know there's a binary available, I'll switch and do some testing :)
Selba Ward - SFML drawables
Kairos - Timing Library
Rectangular Boundary Collision - Rectangular SAT Collision

Hapaxia Links