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!
