Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Windows scancode implementation #1294

Merged
merged 4 commits into from Jan 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 11 additions & 12 deletions include/SFML/Window/Keyboard.hpp
Expand Up @@ -29,11 +29,12 @@
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Window/Export.hpp>
#include <SFML/System/String.hpp>


namespace sf
{
class String;

////////////////////////////////////////////////////////////
/// \brief Give access to the real-time state of the keyboard
///
Expand Down Expand Up @@ -169,14 +170,14 @@ class SFML_WINDOW_API Keyboard
////////////////////////////////////////////////////////////
/// \brief Scancodes
///
/// The enumerators are bound to a physical key and do *not* depend
/// on the keyboard layout used by the operating system. Usually, the AT-101
/// The enumerators are bound to a physical key and do not depend on
/// the keyboard layout used by the operating system. Usually, the AT-101
/// keyboard can be used as reference for the physical position of the keys.
///
/// The scancodes are based on a subset of Table 12: Keyboard/Keypad Page
/// of Universal Serial Bus (USB): HID Usage Tables, v1.12.
///
/// \todo When porting this for SFML 3, remove the `s` prefix and use
/// \todo When porting this for SFML 3, remove the `Scan` prefix and use
/// enum class.
///
////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -219,26 +220,24 @@ class SFML_WINDOW_API Keyboard
ScanNum8, ///< Keyboard 8 and * key
ScanNum9, ///< Keyboard 9 and ) key
ScanNum0, ///< Keyboard 0 and ) key
ScanEnter, ///< Keyboard Return (ENTER) key
ScanEnter, ///< Keyboard Enter/Return key
ScanEscape, ///< Keyboard Escape key
ScanBackspace, ///< Keyboard Backspace key
// TODO above it's BackSpace, but is it correct? What do we use here?
ScanTab, ///< Keyboard Tab key
ScanSpace, ///< Keyboard Space key
ScanHyphen, ///< Keyboard - and _ key
ScanEquals, ///< Keyboard = and +
ScanLBracket, ///< Keyboard [ and { key
ScanRBracket, ///< Keyboard ] and } key
ScanBackslash, ///< Keyboard \ and | key
// TODO capitalisation
ScanDash, ///< Keyboard Non-US # and ~
// TODO hyphen vs minus vs dash
ScanSemicolon, ///< Keyboard ; and : key
// TODO capitalisation
ScanQuote, ///< Keyboard ' and " key
ScanGraveAccent, ///< Keyboard ` and ~ key
ScanComma, ///< Keyboard , and < key
ScanPeriod, ///< Keyboard . and > key
ScanForwardSlash, ///< Keyboard / and ? key
ScanSlash, ///< Keyboard / and ? key
ScanF1, ///< Keyboard F1 key
ScanF2, ///< Keyboard F2 key
ScanF3, ///< Keyboard F3 key
Expand Down Expand Up @@ -273,8 +272,8 @@ class SFML_WINDOW_API Keyboard
ScanMultiply, ///< Keypad * key
ScanMinus, ///< Keypad - key
ScanPlus, ///< Keypad + key
ScanPadEquals, ///< keypad = key, probably Mac only
ScanReturn, ///< Keypad Enter (return) key
ScanNumpadEquals, ///< keypad = key, probably Mac only
ScanNumpadEnter, ///< Keypad Enter/Return key
ScanDecimal, ///< Keypad . and Delete key
ScanNumpad1, ///< Keypad 1 and End key
ScanNumpad2, ///< Keypad 2 and Down Arrow key
Expand Down Expand Up @@ -381,7 +380,7 @@ class SFML_WINDOW_API Keyboard
/// "Left Command" on macOS.
///
/// The current keyboard layout set by the operating system is used to
/// interpret the scancode: for example, sf::Keyboard::SemiColon is
/// interpret the scancode: for example, sf::Keyboard::Semicolon is
/// mapped to ";" for layout and to "é" for others.
///
/// \return The localized description of the code
Expand Down
1 change: 1 addition & 0 deletions src/SFML/Window/Keyboard.cpp
Expand Up @@ -27,6 +27,7 @@
////////////////////////////////////////////////////////////
#include <SFML/Window/Keyboard.hpp>
#include <SFML/Window/InputImpl.hpp>
#include <SFML/System/String.hpp>


namespace sf
Expand Down