diff --git a/include/SFML/Window/Keyboard.hpp b/include/SFML/Window/Keyboard.hpp index b6669ddc7..8ff2993fc 100644 --- a/include/SFML/Window/Keyboard.hpp +++ b/include/SFML/Window/Keyboard.hpp @@ -176,165 +176,170 @@ public: /// keyboard can be used as reference for the physical position of the keys. /// //////////////////////////////////////////////////////////// - enum Scancode + struct Scan { - ScanUnknown = -1, //!< Represents any scancode not present in this enum - ScanA = 0, //!< Keyboard a and A key - ScanB, //!< Keyboard b and B key - ScanC, //!< Keyboard c and C key - ScanD, //!< Keyboard d and D key - ScanE, //!< Keyboard e and E key - ScanF, //!< Keyboard f and F key - ScanG, //!< Keyboard g and G key - ScanH, //!< Keyboard h and H key - ScanI, //!< Keyboard i and I key - ScanJ, //!< Keyboard j and J key - ScanK, //!< Keyboard k and K key - ScanL, //!< Keyboard l and L key - ScanM, //!< Keyboard m and M key - ScanN, //!< Keyboard n and N key - ScanO, //!< Keyboard o and O key - ScanP, //!< Keyboard p and P key - ScanQ, //!< Keyboard q and Q key - ScanR, //!< Keyboard r and R key - ScanS, //!< Keyboard s and S key - ScanT, //!< Keyboard t and T key - ScanU, //!< Keyboard u and U key - ScanV, //!< Keyboard v and V key - ScanW, //!< Keyboard w and W key - ScanX, //!< Keyboard x and X key - ScanY, //!< Keyboard y and Y key - ScanZ, //!< Keyboard z and Z key - ScanNum1, //!< Keyboard 1 and ! key - ScanNum2, //!< Keyboard 2 and @ key - ScanNum3, //!< Keyboard 3 and # key - ScanNum4, //!< Keyboard 4 and $ key - ScanNum5, //!< Keyboard 5 and % key - ScanNum6, //!< Keyboard 6 and ^ key - ScanNum7, //!< Keyboard 7 and & key - ScanNum8, //!< Keyboard 8 and * key - ScanNum9, //!< Keyboard 9 and ) key - ScanNum0, //!< Keyboard 0 and ) key - ScanEnter, //!< Keyboard Enter/Return key - ScanEscape, //!< Keyboard Escape key - ScanBackspace, //!< Keyboard Backspace key - ScanTab, //!< Keyboard Tab key - ScanSpace, //!< Keyboard Space key - ScanHyphen, //!< Keyboard - and _ key - ScanEqual, //!< Keyboard = and + - ScanLBracket, //!< Keyboard [ and { key - ScanRBracket, //!< Keyboard ] and } key - // For US keyboards mapped to key 29 (Microsoft Keyboard Scan Code Specification) - // For Non-US keyboards mapped to key 42 (Microsoft Keyboard Scan Code Specification) - // Typical language mappings: Belg:£µ` FrCa:<>} Dan:*' Dutch:`´ Fren:µ* Ger:'# Ital:§ù LatAm:[}` Nor:*@ Span:ç} Swed:*' Swiss:$£} UK:~# Brazil:}] - ScanBackslash, //!< Keyboard \ and | key OR various keys for Non-US keyboards - ScanSemicolon, //!< Keyboard ; and : key - ScanApostrophe, //!< Keyboard ' and " key - ScanGrave, //!< Keyboard ` and ~ key - ScanComma, //!< Keyboard , and < key - ScanPeriod, //!< Keyboard . and > key - ScanSlash, //!< Keyboard / and ? key - ScanF1, //!< Keyboard F1 key - ScanF2, //!< Keyboard F2 key - ScanF3, //!< Keyboard F3 key - ScanF4, //!< Keyboard F4 key - ScanF5, //!< Keyboard F5 key - ScanF6, //!< Keyboard F6 key - ScanF7, //!< Keyboard F7 key - ScanF8, //!< Keyboard F8 key - ScanF9, //!< Keyboard F9 key - ScanF10, //!< Keyboard F10 key - ScanF11, //!< Keyboard F11 key - ScanF12, //!< Keyboard F12 key - ScanF13, //!< Keyboard F13 key - ScanF14, //!< Keyboard F14 key - ScanF15, //!< Keyboard F15 key - ScanF16, //!< Keyboard F16 key - ScanF17, //!< Keyboard F17 key - ScanF18, //!< Keyboard F18 key - ScanF19, //!< Keyboard F19 key - ScanF20, //!< Keyboard F20 key - ScanF21, //!< Keyboard F21 key - ScanF22, //!< Keyboard F22 key - ScanF23, //!< Keyboard F23 key - ScanF24, //!< Keyboard F24 key - ScanCapsLock, //!< Keyboard Caps %Lock key - ScanPrintScreen, //!< Keyboard Print Screen key - ScanScrollLock, //!< Keyboard Scroll %Lock key - ScanPause, //!< Keyboard Pause key - ScanInsert, //!< Keyboard Insert key - ScanHome, //!< Keyboard Home key - ScanPageUp, //!< Keyboard Page Up key - ScanDelete, //!< Keyboard Delete Forward key - ScanEnd, //!< Keyboard End key - ScanPageDown, //!< Keyboard Page Down key - ScanRight, //!< Keyboard Right Arrow key - ScanLeft, //!< Keyboard Left Arrow key - ScanDown, //!< Keyboard Down Arrow key - ScanUp, //!< Keyboard Up Arrow key - ScanNumLock, //!< Keypad Num %Lock and Clear key - ScanNumpadDivide, //!< Keypad / key - ScanNumpadMultiply, //!< Keypad * key - ScanNumpadMinus, //!< Keypad - key - ScanNumpadPlus, //!< Keypad + key - ScanNumpadEqual, //!< keypad = key - ScanNumpadEnter, //!< Keypad Enter/Return key - ScanNumpadDecimal, //!< Keypad . and Delete key - ScanNumpad1, //!< Keypad 1 and End key - ScanNumpad2, //!< Keypad 2 and Down Arrow key - ScanNumpad3, //!< Keypad 3 and Page Down key - ScanNumpad4, //!< Keypad 4 and Left Arrow key - ScanNumpad5, //!< Keypad 5 key - ScanNumpad6, //!< Keypad 6 and Right Arrow key - ScanNumpad7, //!< Keypad 7 and Home key - ScanNumpad8, //!< Keypad 8 and Up Arrow key - ScanNumpad9, //!< Keypad 9 and Page Up key - ScanNumpad0, //!< Keypad 0 and Insert key - // For US keyboards doesn't exist - // For Non-US keyboards mapped to key 45 (Microsoft Keyboard Scan Code Specification) - // Typical language mappings: Belg:<\> FrCa:«°» Dan:<\> Dutch:]|[ Fren:<> Ger:<|> Ital:<> LatAm:<> Nor:<> Span:<> Swed:<|> Swiss:<\> UK:\| Brazil: \|. - ScanNonUsBackslash, //!< Keyboard Non-US \ and | key - ScanApplication, //!< Keyboard Application key - ScanExecute, //!< Keyboard Execute key - ScanModeChange, //!< Keyboard Mode Change key - ScanHelp, //!< Keyboard Help key - ScanMenu, //!< Keyboard Menu key - ScanSelect, //!< Keyboard Select key - ScanRedo, //!< Keyboard Redo key - ScanUndo, //!< Keyboard Undo key - ScanCut, //!< Keyboard Cut key - ScanCopy, //!< Keyboard Copy key - ScanPaste, //!< Keyboard Paste key - ScanVolumeMute, //!< Keyboard Volume Mute key - ScanVolumeUp, //!< Keyboard Volume Up key - ScanVolumeDown, //!< Keyboard Volume Down key - ScanMediaPlayPause, //!< Keyboard Media Play Pause key - ScanMediaStop, //!< Keyboard Media Stop key - ScanMediaNextTrack, //!< Keyboard Media Next Track key - ScanMediaPreviousTrack, //!< Keyboard Media Previous Track key - ScanLControl, //!< Keyboard Left Control key - ScanLShift, //!< Keyboard Left Shift key - ScanLAlt, //!< Keyboard Left Alt key - ScanLSystem, //!< Keyboard Left System key - ScanRControl, //!< Keyboard Right Control key - ScanRShift, //!< Keyboard Right Shift key - ScanRAlt, //!< Keyboard Right Alt key - ScanRSystem, //!< Keyboard Right System key - ScanBack, //!< Keyboard Back key - ScanForward, //!< Keyboard Forward key - ScanRefresh, //!< Keyboard Refresh key - ScanStop, //!< Keyboard Stop key - ScanSearch, //!< Keyboard Search key - ScanFavorites, //!< Keyboard Favorites key - ScanHomePage, //!< Keyboard Home Page key - ScanLaunchApplication1, //!< Keyboard Launch Application 1 key - ScanLaunchApplication2, //!< Keyboard Launch Application 2 key - ScanLaunchMail, //!< Keyboard Launch Mail key - ScanLaunchMediaSelect, //!< Keyboard Launch Media Select key + enum Scancode + { + Unknown = -1, //!< Represents any scancode not present in this enum + A = 0, //!< Keyboard a and A key + B, //!< Keyboard b and B key + C, //!< Keyboard c and C key + D, //!< Keyboard d and D key + E, //!< Keyboard e and E key + F, //!< Keyboard f and F key + G, //!< Keyboard g and G key + H, //!< Keyboard h and H key + I, //!< Keyboard i and I key + J, //!< Keyboard j and J key + K, //!< Keyboard k and K key + L, //!< Keyboard l and L key + M, //!< Keyboard m and M key + N, //!< Keyboard n and N key + O, //!< Keyboard o and O key + P, //!< Keyboard p and P key + Q, //!< Keyboard q and Q key + R, //!< Keyboard r and R key + S, //!< Keyboard s and S key + T, //!< Keyboard t and T key + U, //!< Keyboard u and U key + V, //!< Keyboard v and V key + W, //!< Keyboard w and W key + X, //!< Keyboard x and X key + Y, //!< Keyboard y and Y key + Z, //!< Keyboard z and Z key + Num1, //!< Keyboard 1 and ! key + Num2, //!< Keyboard 2 and @ key + Num3, //!< Keyboard 3 and # key + Num4, //!< Keyboard 4 and $ key + Num5, //!< Keyboard 5 and % key + Num6, //!< Keyboard 6 and ^ key + Num7, //!< Keyboard 7 and & key + Num8, //!< Keyboard 8 and * key + Num9, //!< Keyboard 9 and ) key + Num0, //!< Keyboard 0 and ) key + Enter, //!< Keyboard Enter/Return key + Escape, //!< Keyboard Escape key + Backspace, //!< Keyboard Backspace key + Tab, //!< Keyboard Tab key + Space, //!< Keyboard Space key + Hyphen, //!< Keyboard - and _ key + Equal, //!< Keyboard = and + + LBracket, //!< Keyboard [ and { key + RBracket, //!< Keyboard ] and } key + // For US keyboards mapped to key 29 (Microsoft Keyboard Scan Code Specification) + // For Non-US keyboards mapped to key 42 (Microsoft Keyboard Scan Code Specification) + // Typical language mappings: Belg:£µ` FrCa:<>} Dan:*' Dutch:`´ Fren:µ* Ger:'# Ital:§ù LatAm:[}` Nor:*@ Span:ç} Swed:*' Swiss:$£} UK:~# Brazil:}] + Backslash, //!< Keyboard \ and | key OR various keys for Non-US keyboards + Semicolon, //!< Keyboard ; and : key + Apostrophe, //!< Keyboard ' and " key + Grave, //!< Keyboard ` and ~ key + Comma, //!< Keyboard , and < key + Period, //!< Keyboard . and > key + Slash, //!< Keyboard / and ? key + F1, //!< Keyboard F1 key + F2, //!< Keyboard F2 key + F3, //!< Keyboard F3 key + F4, //!< Keyboard F4 key + F5, //!< Keyboard F5 key + F6, //!< Keyboard F6 key + F7, //!< Keyboard F7 key + F8, //!< Keyboard F8 key + F9, //!< Keyboard F9 key + F10, //!< Keyboard F10 key + F11, //!< Keyboard F11 key + F12, //!< Keyboard F12 key + F13, //!< Keyboard F13 key + F14, //!< Keyboard F14 key + F15, //!< Keyboard F15 key + F16, //!< Keyboard F16 key + F17, //!< Keyboard F17 key + F18, //!< Keyboard F18 key + F19, //!< Keyboard F19 key + F20, //!< Keyboard F20 key + F21, //!< Keyboard F21 key + F22, //!< Keyboard F22 key + F23, //!< Keyboard F23 key + F24, //!< Keyboard F24 key + CapsLock, //!< Keyboard Caps %Lock key + PrintScreen, //!< Keyboard Print Screen key + ScrollLock, //!< Keyboard Scroll %Lock key + Pause, //!< Keyboard Pause key + Insert, //!< Keyboard Insert key + Home, //!< Keyboard Home key + PageUp, //!< Keyboard Page Up key + Delete, //!< Keyboard Delete Forward key + End, //!< Keyboard End key + PageDown, //!< Keyboard Page Down key + Right, //!< Keyboard Right Arrow key + Left, //!< Keyboard Left Arrow key + Down, //!< Keyboard Down Arrow key + Up, //!< Keyboard Up Arrow key + NumLock, //!< Keypad Num %Lock and Clear key + NumpadDivide, //!< Keypad / key + NumpadMultiply, //!< Keypad * key + NumpadMinus, //!< Keypad - key + NumpadPlus, //!< Keypad + key + NumpadEqual, //!< keypad = key + NumpadEnter, //!< Keypad Enter/Return key + NumpadDecimal, //!< Keypad . and Delete key + Numpad1, //!< Keypad 1 and End key + Numpad2, //!< Keypad 2 and Down Arrow key + Numpad3, //!< Keypad 3 and Page Down key + Numpad4, //!< Keypad 4 and Left Arrow key + Numpad5, //!< Keypad 5 key + Numpad6, //!< Keypad 6 and Right Arrow key + Numpad7, //!< Keypad 7 and Home key + Numpad8, //!< Keypad 8 and Up Arrow key + Numpad9, //!< Keypad 9 and Page Up key + Numpad0, //!< Keypad 0 and Insert key + // For US keyboards doesn't exist + // For Non-US keyboards mapped to key 45 (Microsoft Keyboard Scan Code Specification) + // Typical language mappings: Belg:<\> FrCa:«°» Dan:<\> Dutch:]|[ Fren:<> Ger:<|> Ital:<> LatAm:<> Nor:<> Span:<> Swed:<|> Swiss:<\> UK:\| Brazil: \|. + NonUsBackslash, //!< Keyboard Non-US \ and | key + Application, //!< Keyboard Application key + Execute, //!< Keyboard Execute key + ModeChange, //!< Keyboard Mode Change key + Help, //!< Keyboard Help key + Menu, //!< Keyboard Menu key + Select, //!< Keyboard Select key + Redo, //!< Keyboard Redo key + Undo, //!< Keyboard Undo key + Cut, //!< Keyboard Cut key + Copy, //!< Keyboard Copy key + Paste, //!< Keyboard Paste key + VolumeMute, //!< Keyboard Volume Mute key + VolumeUp, //!< Keyboard Volume Up key + VolumeDown, //!< Keyboard Volume Down key + MediaPlayPause, //!< Keyboard Media Play Pause key + MediaStop, //!< Keyboard Media Stop key + MediaNextTrack, //!< Keyboard Media Next Track key + MediaPreviousTrack, //!< Keyboard Media Previous Track key + LControl, //!< Keyboard Left Control key + LShift, //!< Keyboard Left Shift key + LAlt, //!< Keyboard Left Alt key + LSystem, //!< Keyboard Left System key + RControl, //!< Keyboard Right Control key + RShift, //!< Keyboard Right Shift key + RAlt, //!< Keyboard Right Alt key + RSystem, //!< Keyboard Right System key + Back, //!< Keyboard Back key + Forward, //!< Keyboard Forward key + Refresh, //!< Keyboard Refresh key + Stop, //!< Keyboard Stop key + Search, //!< Keyboard Search key + Favorites, //!< Keyboard Favorites key + HomePage, //!< Keyboard Home Page key + LaunchApplication1, //!< Keyboard Launch Application 1 key + LaunchApplication2, //!< Keyboard Launch Application 2 key + LaunchMail, //!< Keyboard Launch Mail key + LaunchMediaSelect, //!< Keyboard Launch Media Select key - ScancodeCount //!< Keep last -- the total number of scancodes + ScancodeCount //!< Keep last -- the total number of scancodes + }; }; + typedef Scan::Scancode Scancode; + //////////////////////////////////////////////////////////// /// \brief Check if a key is pressed /// @@ -377,7 +382,7 @@ public: /// /// \return The scancode corresponding to the key under the current /// keyboard layout used by the operating system, or - /// sf::Keyboard::ScanUnknown when the key cannot be mapped + /// sf::Keyboard::Scan::Unknown when the key cannot be mapped /// to a sf::Keyboard::Scancode. /// /// \see localize @@ -393,7 +398,7 @@ public: /// used in user interfaces, as the description for the key takes /// the users keyboard layout into consideration. /// - /// \warning The result is OS-dependent: for example, sf::Keyboard::ScanLSystem + /// \warning The result is OS-dependent: for example, sf::Keyboard::Scan::LSystem /// is "Left Meta" on Linux, "Left Windows" on Windows and /// "Left Command" on macOS. /// @@ -460,7 +465,7 @@ public: /// { /// // quit... /// } -/// else if (sf::Keyboard::isKeyPressed(sf::Keyboard::ScanGrave)) +/// else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Scan::Grave)) /// { /// // open in-game command line (if it's not already open) /// } diff --git a/src/SFML/Window/OSX/HIDInputManager.hpp b/src/SFML/Window/OSX/HIDInputManager.hpp index 811f14e1b..3f01df230 100644 --- a/src/SFML/Window/OSX/HIDInputManager.hpp +++ b/src/SFML/Window/OSX/HIDInputManager.hpp @@ -115,7 +115,7 @@ public: /// Try to convert a virtual keycode (HID level) into a /// SFML scancode. /// - /// Return sf::Keyboard::ScanUnknown if the keycode is unknown. + /// Return sf::Keyboard::Scan::Unknown if the keycode is unknown. /// //////////////////////////////////////////////////////////// static Keyboard::Scancode nonLocalizedKey(UniChar virtualKeycode); @@ -252,7 +252,7 @@ private: /// /// \param usage Any kHIDUsage_Keyboard* usage /// \return the scancode associated with the given HID key usage - /// or ScanUnknown if it is associated with no scancode. + /// or Scan::Unknown if it is associated with no scancode. /// //////////////////////////////////////////////////////////// static Keyboard::Scancode usageToScancode(UInt32 usage); @@ -276,9 +276,9 @@ private: // Member data //////////////////////////////////////////////////////////// IOHIDManagerRef m_manager; ///< Underlying HID Manager - IOHIDElements m_keys[Keyboard::ScancodeCount]; ///< All the keys on any connected keyboard + IOHIDElements m_keys[Keyboard::Scan::ScancodeCount]; ///< All the keys on any connected keyboard Keyboard::Scancode m_keyToScancodeMapping[Keyboard::KeyCount]; ///< Mapping from Key to Scancode - Keyboard::Key m_scancodeToKeyMapping[Keyboard::ScancodeCount]; ///< Mapping from Scancode to Key + Keyboard::Key m_scancodeToKeyMapping[Keyboard::Scan::ScancodeCount]; ///< Mapping from Scancode to Key //////////////////////////////////////////////////////////// /// m_keys' index corresponds to sf::Keyboard::Scancode enum. diff --git a/src/SFML/Window/OSX/HIDInputManager.mm b/src/SFML/Window/OSX/HIDInputManager.mm index e1e0fb013..7a724b4f4 100644 --- a/src/SFML/Window/OSX/HIDInputManager.mm +++ b/src/SFML/Window/OSX/HIDInputManager.mm @@ -103,7 +103,7 @@ bool HIDInputManager::isKeyPressed(Keyboard::Key key) //////////////////////////////////////////////////////////// bool HIDInputManager::isKeyPressed(Keyboard::Scancode code) { - return (code != Keyboard::ScanUnknown) && isPressed(m_keys[code]); + return (code != Keyboard::Scan::Unknown) && isPressed(m_keys[code]); } @@ -129,98 +129,98 @@ String HIDInputManager::getDescription(Keyboard::Scancode code) // Phase 1: Get names for layout independent keys switch (code) { - case sf::Keyboard::ScanEnter: return "Enter"; - case sf::Keyboard::ScanEscape: return "Escape"; - case sf::Keyboard::ScanBackspace: return "Backspace"; - case sf::Keyboard::ScanTab: return "Tab"; - case sf::Keyboard::ScanSpace: return "Space"; + case sf::Keyboard::Scan::Enter: return "Enter"; + case sf::Keyboard::Scan::Escape: return "Escape"; + case sf::Keyboard::Scan::Backspace: return "Backspace"; + case sf::Keyboard::Scan::Tab: return "Tab"; + case sf::Keyboard::Scan::Space: return "Space"; - case sf::Keyboard::ScanF1: return "F1"; - case sf::Keyboard::ScanF2: return "F2"; - case sf::Keyboard::ScanF3: return "F3"; - case sf::Keyboard::ScanF4: return "F4"; - case sf::Keyboard::ScanF5: return "F5"; - case sf::Keyboard::ScanF6: return "F6"; - case sf::Keyboard::ScanF7: return "F7"; - case sf::Keyboard::ScanF8: return "F8"; - case sf::Keyboard::ScanF9: return "F9"; - case sf::Keyboard::ScanF10: return "F10"; - case sf::Keyboard::ScanF11: return "F11"; - case sf::Keyboard::ScanF12: return "F12"; - case sf::Keyboard::ScanF13: return "F13"; - case sf::Keyboard::ScanF14: return "F14"; - case sf::Keyboard::ScanF15: return "F15"; - case sf::Keyboard::ScanF16: return "F16"; - case sf::Keyboard::ScanF17: return "F17"; - case sf::Keyboard::ScanF18: return "F18"; - case sf::Keyboard::ScanF19: return "F19"; - case sf::Keyboard::ScanF20: return "F20"; - case sf::Keyboard::ScanF21: return "F21"; - case sf::Keyboard::ScanF22: return "F22"; - case sf::Keyboard::ScanF23: return "F23"; - case sf::Keyboard::ScanF24: return "F24"; + case sf::Keyboard::Scan::F1: return "F1"; + case sf::Keyboard::Scan::F2: return "F2"; + case sf::Keyboard::Scan::F3: return "F3"; + case sf::Keyboard::Scan::F4: return "F4"; + case sf::Keyboard::Scan::F5: return "F5"; + case sf::Keyboard::Scan::F6: return "F6"; + case sf::Keyboard::Scan::F7: return "F7"; + case sf::Keyboard::Scan::F8: return "F8"; + case sf::Keyboard::Scan::F9: return "F9"; + case sf::Keyboard::Scan::F10: return "F10"; + case sf::Keyboard::Scan::F11: return "F11"; + case sf::Keyboard::Scan::F12: return "F12"; + case sf::Keyboard::Scan::F13: return "F13"; + case sf::Keyboard::Scan::F14: return "F14"; + case sf::Keyboard::Scan::F15: return "F15"; + case sf::Keyboard::Scan::F16: return "F16"; + case sf::Keyboard::Scan::F17: return "F17"; + case sf::Keyboard::Scan::F18: return "F18"; + case sf::Keyboard::Scan::F19: return "F19"; + case sf::Keyboard::Scan::F20: return "F20"; + case sf::Keyboard::Scan::F21: return "F21"; + case sf::Keyboard::Scan::F22: return "F22"; + case sf::Keyboard::Scan::F23: return "F23"; + case sf::Keyboard::Scan::F24: return "F24"; - case sf::Keyboard::ScanCapsLock: return "CapsLock"; - case sf::Keyboard::ScanPrintScreen: return "PrintScreen"; - case sf::Keyboard::ScanScrollLock: return "ScrollLock"; + case sf::Keyboard::Scan::CapsLock: return "CapsLock"; + case sf::Keyboard::Scan::PrintScreen: return "PrintScreen"; + case sf::Keyboard::Scan::ScrollLock: return "ScrollLock"; - case sf::Keyboard::ScanPause: return "Pause"; - case sf::Keyboard::ScanInsert: return "Insert"; - case sf::Keyboard::ScanHome: return "Home"; - case sf::Keyboard::ScanPageUp: return "PageUp"; - case sf::Keyboard::ScanDelete: return "Delete"; - case sf::Keyboard::ScanEnd: return "End"; - case sf::Keyboard::ScanPageDown: return "PageDown"; + case sf::Keyboard::Scan::Pause: return "Pause"; + case sf::Keyboard::Scan::Insert: return "Insert"; + case sf::Keyboard::Scan::Home: return "Home"; + case sf::Keyboard::Scan::PageUp: return "PageUp"; + case sf::Keyboard::Scan::Delete: return "Delete"; + case sf::Keyboard::Scan::End: return "End"; + case sf::Keyboard::Scan::PageDown: return "PageDown"; - case sf::Keyboard::ScanLeft: return "Left Arrow"; - case sf::Keyboard::ScanRight: return "Right Arrow"; - case sf::Keyboard::ScanDown: return "Down Arrow"; - case sf::Keyboard::ScanUp: return "Up Arrow"; + case sf::Keyboard::Scan::Left: return "Left Arrow"; + case sf::Keyboard::Scan::Right: return "Right Arrow"; + case sf::Keyboard::Scan::Down: return "Down Arrow"; + case sf::Keyboard::Scan::Up: return "Up Arrow"; - case sf::Keyboard::ScanNumLock: return "NumLock"; - case sf::Keyboard::ScanNumpadDivide: return "Divide (Numpad)"; - case sf::Keyboard::ScanNumpadMultiply: return "Multiply (Numpad)"; - case sf::Keyboard::ScanNumpadMinus: return "Minus (Numpad)"; - case sf::Keyboard::ScanNumpadPlus: return "Plus (Numpad)"; - case sf::Keyboard::ScanNumpadEqual: return "Equal (Numpad)"; - case sf::Keyboard::ScanNumpadEnter: return "Enter (Numpad)"; - case sf::Keyboard::ScanNumpadDecimal: return "Decimal (Numpad)"; + case sf::Keyboard::Scan::NumLock: return "NumLock"; + case sf::Keyboard::Scan::NumpadDivide: return "Divide (Numpad)"; + case sf::Keyboard::Scan::NumpadMultiply: return "Multiply (Numpad)"; + case sf::Keyboard::Scan::NumpadMinus: return "Minus (Numpad)"; + case sf::Keyboard::Scan::NumpadPlus: return "Plus (Numpad)"; + case sf::Keyboard::Scan::NumpadEqual: return "Equal (Numpad)"; + case sf::Keyboard::Scan::NumpadEnter: return "Enter (Numpad)"; + case sf::Keyboard::Scan::NumpadDecimal: return "Decimal (Numpad)"; - case sf::Keyboard::ScanNumpad0: return "0 (Numpad)"; - case sf::Keyboard::ScanNumpad1: return "1 (Numpad)"; - case sf::Keyboard::ScanNumpad2: return "2 (Numpad)"; - case sf::Keyboard::ScanNumpad3: return "3 (Numpad)"; - case sf::Keyboard::ScanNumpad4: return "4 (Numpad)"; - case sf::Keyboard::ScanNumpad5: return "5 (Numpad)"; - case sf::Keyboard::ScanNumpad6: return "6 (Numpad)"; - case sf::Keyboard::ScanNumpad7: return "7 (Numpad)"; - case sf::Keyboard::ScanNumpad8: return "8 (Numpad)"; - case sf::Keyboard::ScanNumpad9: return "9 (Numpad)"; + case sf::Keyboard::Scan::Numpad0: return "0 (Numpad)"; + case sf::Keyboard::Scan::Numpad1: return "1 (Numpad)"; + case sf::Keyboard::Scan::Numpad2: return "2 (Numpad)"; + case sf::Keyboard::Scan::Numpad3: return "3 (Numpad)"; + case sf::Keyboard::Scan::Numpad4: return "4 (Numpad)"; + case sf::Keyboard::Scan::Numpad5: return "5 (Numpad)"; + case sf::Keyboard::Scan::Numpad6: return "6 (Numpad)"; + case sf::Keyboard::Scan::Numpad7: return "7 (Numpad)"; + case sf::Keyboard::Scan::Numpad8: return "8 (Numpad)"; + case sf::Keyboard::Scan::Numpad9: return "9 (Numpad)"; - case sf::Keyboard::ScanApplication: return "Application"; - case sf::Keyboard::ScanExecute: return "Execute"; - case sf::Keyboard::ScanHelp: return "Help"; - case sf::Keyboard::ScanMenu: return "Menu"; - case sf::Keyboard::ScanSelect: return "Select"; - case sf::Keyboard::ScanStop: return "Stop"; - case sf::Keyboard::ScanRedo: return "Redo"; - case sf::Keyboard::ScanUndo: return "Undo"; - case sf::Keyboard::ScanCut: return "Cut"; - case sf::Keyboard::ScanCopy: return "Copy"; - case sf::Keyboard::ScanPaste: return "Paste"; - case sf::Keyboard::ScanSearch: return "Search"; - case sf::Keyboard::ScanVolumeMute: return "Volume Mute"; - case sf::Keyboard::ScanVolumeUp: return "Volume Up"; - case sf::Keyboard::ScanVolumeDown: return "Volume Down"; + case sf::Keyboard::Scan::Application: return "Application"; + case sf::Keyboard::Scan::Execute: return "Execute"; + case sf::Keyboard::Scan::Help: return "Help"; + case sf::Keyboard::Scan::Menu: return "Menu"; + case sf::Keyboard::Scan::Select: return "Select"; + case sf::Keyboard::Scan::Stop: return "Stop"; + case sf::Keyboard::Scan::Redo: return "Redo"; + case sf::Keyboard::Scan::Undo: return "Undo"; + case sf::Keyboard::Scan::Cut: return "Cut"; + case sf::Keyboard::Scan::Copy: return "Copy"; + case sf::Keyboard::Scan::Paste: return "Paste"; + case sf::Keyboard::Scan::Search: return "Search"; + case sf::Keyboard::Scan::VolumeMute: return "Volume Mute"; + case sf::Keyboard::Scan::VolumeUp: return "Volume Up"; + case sf::Keyboard::Scan::VolumeDown: return "Volume Down"; - case sf::Keyboard::ScanLControl: return "Left Control"; - case sf::Keyboard::ScanLShift: return "Left Shift"; - case sf::Keyboard::ScanLAlt: return "Left Alt"; - case sf::Keyboard::ScanLSystem: return "Left Command"; - case sf::Keyboard::ScanRControl: return "Right Control"; - case sf::Keyboard::ScanRShift: return "Right Shift"; - case sf::Keyboard::ScanRAlt: return "Right Alt"; - case sf::Keyboard::ScanRSystem: return "Right Command"; + case sf::Keyboard::Scan::LControl: return "Left Control"; + case sf::Keyboard::Scan::LShift: return "Left Shift"; + case sf::Keyboard::Scan::LAlt: return "Left Alt"; + case sf::Keyboard::Scan::LSystem: return "Left Command"; + case sf::Keyboard::Scan::RControl: return "Right Control"; + case sf::Keyboard::Scan::RShift: return "Right Shift"; + case sf::Keyboard::Scan::RAlt: return "Right Alt"; + case sf::Keyboard::Scan::RSystem: return "Right Command"; default: { @@ -330,7 +330,7 @@ void HIDInputManager::loadKey(IOHIDElementRef key) { UInt32 usage = IOHIDElementGetUsage(key); sf::Keyboard::Scancode code = usageToScancode(usage); - if (code != Keyboard::ScanUnknown) + if (code != Keyboard::Scan::Unknown) { CFRetain(key); m_keys[code].push_back(key); @@ -343,8 +343,8 @@ void HIDInputManager::buildMappings() { // Reset the mappings for (int i = 0; i < Keyboard::KeyCount; ++i) - m_keyToScancodeMapping[i] = Keyboard::ScanUnknown; - for (int i = 0; i < Keyboard::ScancodeCount; ++i) + m_keyToScancodeMapping[i] = Keyboard::Scan::Unknown; + for (int i = 0; i < Keyboard::Scan::ScancodeCount; ++i) m_scancodeToKeyMapping[i] = Keyboard::Unknown; // Get the current keyboard layout @@ -362,7 +362,7 @@ void HIDInputManager::buildMappings() // For each scancode having a IOHIDElement, we translate the corresponding // virtual code to a localized Key. - for (int i = 0; i < Keyboard::ScancodeCount; ++i) + for (int i = 0; i < Keyboard::Scan::ScancodeCount; ++i) { Keyboard::Scancode scan = static_cast(i); UInt8 virtualCode = scanToVirtualCode(scan); @@ -481,202 +481,202 @@ sf::Keyboard::Scancode HIDInputManager::usageToScancode(UInt32 usage) { switch (usage) { - case kHIDUsage_KeyboardErrorRollOver: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardPOSTFail: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardErrorUndefined: return sf::Keyboard::ScanUnknown; + case kHIDUsage_KeyboardErrorRollOver: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardPOSTFail: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardErrorUndefined: return sf::Keyboard::Scan::Unknown; - case kHIDUsage_KeyboardA: return sf::Keyboard::ScanA; - case kHIDUsage_KeyboardB: return sf::Keyboard::ScanB; - case kHIDUsage_KeyboardC: return sf::Keyboard::ScanC; - case kHIDUsage_KeyboardD: return sf::Keyboard::ScanD; - case kHIDUsage_KeyboardE: return sf::Keyboard::ScanE; - case kHIDUsage_KeyboardF: return sf::Keyboard::ScanF; - case kHIDUsage_KeyboardG: return sf::Keyboard::ScanG; - case kHIDUsage_KeyboardH: return sf::Keyboard::ScanH; - case kHIDUsage_KeyboardI: return sf::Keyboard::ScanI; - case kHIDUsage_KeyboardJ: return sf::Keyboard::ScanJ; - case kHIDUsage_KeyboardK: return sf::Keyboard::ScanK; - case kHIDUsage_KeyboardL: return sf::Keyboard::ScanL; - case kHIDUsage_KeyboardM: return sf::Keyboard::ScanM; - case kHIDUsage_KeyboardN: return sf::Keyboard::ScanN; - case kHIDUsage_KeyboardO: return sf::Keyboard::ScanO; - case kHIDUsage_KeyboardP: return sf::Keyboard::ScanP; - case kHIDUsage_KeyboardQ: return sf::Keyboard::ScanQ; - case kHIDUsage_KeyboardR: return sf::Keyboard::ScanR; - case kHIDUsage_KeyboardS: return sf::Keyboard::ScanS; - case kHIDUsage_KeyboardT: return sf::Keyboard::ScanT; - case kHIDUsage_KeyboardU: return sf::Keyboard::ScanU; - case kHIDUsage_KeyboardV: return sf::Keyboard::ScanV; - case kHIDUsage_KeyboardW: return sf::Keyboard::ScanW; - case kHIDUsage_KeyboardX: return sf::Keyboard::ScanX; - case kHIDUsage_KeyboardY: return sf::Keyboard::ScanY; - case kHIDUsage_KeyboardZ: return sf::Keyboard::ScanZ; + case kHIDUsage_KeyboardA: return sf::Keyboard::Scan::A; + case kHIDUsage_KeyboardB: return sf::Keyboard::Scan::B; + case kHIDUsage_KeyboardC: return sf::Keyboard::Scan::C; + case kHIDUsage_KeyboardD: return sf::Keyboard::Scan::D; + case kHIDUsage_KeyboardE: return sf::Keyboard::Scan::E; + case kHIDUsage_KeyboardF: return sf::Keyboard::Scan::F; + case kHIDUsage_KeyboardG: return sf::Keyboard::Scan::G; + case kHIDUsage_KeyboardH: return sf::Keyboard::Scan::H; + case kHIDUsage_KeyboardI: return sf::Keyboard::Scan::I; + case kHIDUsage_KeyboardJ: return sf::Keyboard::Scan::J; + case kHIDUsage_KeyboardK: return sf::Keyboard::Scan::K; + case kHIDUsage_KeyboardL: return sf::Keyboard::Scan::L; + case kHIDUsage_KeyboardM: return sf::Keyboard::Scan::M; + case kHIDUsage_KeyboardN: return sf::Keyboard::Scan::N; + case kHIDUsage_KeyboardO: return sf::Keyboard::Scan::O; + case kHIDUsage_KeyboardP: return sf::Keyboard::Scan::P; + case kHIDUsage_KeyboardQ: return sf::Keyboard::Scan::Q; + case kHIDUsage_KeyboardR: return sf::Keyboard::Scan::R; + case kHIDUsage_KeyboardS: return sf::Keyboard::Scan::S; + case kHIDUsage_KeyboardT: return sf::Keyboard::Scan::T; + case kHIDUsage_KeyboardU: return sf::Keyboard::Scan::U; + case kHIDUsage_KeyboardV: return sf::Keyboard::Scan::V; + case kHIDUsage_KeyboardW: return sf::Keyboard::Scan::W; + case kHIDUsage_KeyboardX: return sf::Keyboard::Scan::X; + case kHIDUsage_KeyboardY: return sf::Keyboard::Scan::Y; + case kHIDUsage_KeyboardZ: return sf::Keyboard::Scan::Z; - case kHIDUsage_Keyboard1: return sf::Keyboard::ScanNum1; - case kHIDUsage_Keyboard2: return sf::Keyboard::ScanNum2; - case kHIDUsage_Keyboard3: return sf::Keyboard::ScanNum3; - case kHIDUsage_Keyboard4: return sf::Keyboard::ScanNum4; - case kHIDUsage_Keyboard5: return sf::Keyboard::ScanNum5; - case kHIDUsage_Keyboard6: return sf::Keyboard::ScanNum6; - case kHIDUsage_Keyboard7: return sf::Keyboard::ScanNum7; - case kHIDUsage_Keyboard8: return sf::Keyboard::ScanNum8; - case kHIDUsage_Keyboard9: return sf::Keyboard::ScanNum9; - case kHIDUsage_Keyboard0: return sf::Keyboard::ScanNum0; + case kHIDUsage_Keyboard1: return sf::Keyboard::Scan::Num1; + case kHIDUsage_Keyboard2: return sf::Keyboard::Scan::Num2; + case kHIDUsage_Keyboard3: return sf::Keyboard::Scan::Num3; + case kHIDUsage_Keyboard4: return sf::Keyboard::Scan::Num4; + case kHIDUsage_Keyboard5: return sf::Keyboard::Scan::Num5; + case kHIDUsage_Keyboard6: return sf::Keyboard::Scan::Num6; + case kHIDUsage_Keyboard7: return sf::Keyboard::Scan::Num7; + case kHIDUsage_Keyboard8: return sf::Keyboard::Scan::Num8; + case kHIDUsage_Keyboard9: return sf::Keyboard::Scan::Num9; + case kHIDUsage_Keyboard0: return sf::Keyboard::Scan::Num0; - case kHIDUsage_KeyboardReturnOrEnter: return sf::Keyboard::ScanEnter; - case kHIDUsage_KeyboardEscape: return sf::Keyboard::ScanEscape; - case kHIDUsage_KeyboardDeleteOrBackspace: return sf::Keyboard::ScanBackspace; - case kHIDUsage_KeyboardTab: return sf::Keyboard::ScanTab; - case kHIDUsage_KeyboardSpacebar: return sf::Keyboard::ScanSpace; - case kHIDUsage_KeyboardHyphen: return sf::Keyboard::ScanHyphen; - case kHIDUsage_KeyboardEqualSign: return sf::Keyboard::ScanEqual; - case kHIDUsage_KeyboardOpenBracket: return sf::Keyboard::ScanLBracket; - case kHIDUsage_KeyboardCloseBracket: return sf::Keyboard::ScanRBracket; - case kHIDUsage_KeyboardBackslash: return sf::Keyboard::ScanBackslash; - case kHIDUsage_KeyboardNonUSPound: return sf::Keyboard::ScanBackslash; - case kHIDUsage_KeyboardSemicolon: return sf::Keyboard::ScanSemicolon; - case kHIDUsage_KeyboardQuote: return sf::Keyboard::ScanApostrophe; - case kHIDUsage_KeyboardGraveAccentAndTilde: return sf::Keyboard::ScanGrave; - case kHIDUsage_KeyboardComma: return sf::Keyboard::ScanComma; - case kHIDUsage_KeyboardPeriod: return sf::Keyboard::ScanPeriod; - case kHIDUsage_KeyboardSlash: return sf::Keyboard::ScanSlash; - case kHIDUsage_KeyboardCapsLock: return sf::Keyboard::ScanCapsLock; + case kHIDUsage_KeyboardReturnOrEnter: return sf::Keyboard::Scan::Enter; + case kHIDUsage_KeyboardEscape: return sf::Keyboard::Scan::Escape; + case kHIDUsage_KeyboardDeleteOrBackspace: return sf::Keyboard::Scan::Backspace; + case kHIDUsage_KeyboardTab: return sf::Keyboard::Scan::Tab; + case kHIDUsage_KeyboardSpacebar: return sf::Keyboard::Scan::Space; + case kHIDUsage_KeyboardHyphen: return sf::Keyboard::Scan::Hyphen; + case kHIDUsage_KeyboardEqualSign: return sf::Keyboard::Scan::Equal; + case kHIDUsage_KeyboardOpenBracket: return sf::Keyboard::Scan::LBracket; + case kHIDUsage_KeyboardCloseBracket: return sf::Keyboard::Scan::RBracket; + case kHIDUsage_KeyboardBackslash: return sf::Keyboard::Scan::Backslash; + case kHIDUsage_KeyboardNonUSPound: return sf::Keyboard::Scan::Backslash; + case kHIDUsage_KeyboardSemicolon: return sf::Keyboard::Scan::Semicolon; + case kHIDUsage_KeyboardQuote: return sf::Keyboard::Scan::Apostrophe; + case kHIDUsage_KeyboardGraveAccentAndTilde: return sf::Keyboard::Scan::Grave; + case kHIDUsage_KeyboardComma: return sf::Keyboard::Scan::Comma; + case kHIDUsage_KeyboardPeriod: return sf::Keyboard::Scan::Period; + case kHIDUsage_KeyboardSlash: return sf::Keyboard::Scan::Slash; + case kHIDUsage_KeyboardCapsLock: return sf::Keyboard::Scan::CapsLock; - case kHIDUsage_KeyboardF1: return sf::Keyboard::ScanF1; - case kHIDUsage_KeyboardF2: return sf::Keyboard::ScanF2; - case kHIDUsage_KeyboardF3: return sf::Keyboard::ScanF3; - case kHIDUsage_KeyboardF4: return sf::Keyboard::ScanF4; - case kHIDUsage_KeyboardF5: return sf::Keyboard::ScanF5; - case kHIDUsage_KeyboardF6: return sf::Keyboard::ScanF6; - case kHIDUsage_KeyboardF7: return sf::Keyboard::ScanF7; - case kHIDUsage_KeyboardF8: return sf::Keyboard::ScanF8; - case kHIDUsage_KeyboardF9: return sf::Keyboard::ScanF9; - case kHIDUsage_KeyboardF10: return sf::Keyboard::ScanF10; - case kHIDUsage_KeyboardF11: return sf::Keyboard::ScanF11; - case kHIDUsage_KeyboardF12: return sf::Keyboard::ScanF12; + case kHIDUsage_KeyboardF1: return sf::Keyboard::Scan::F1; + case kHIDUsage_KeyboardF2: return sf::Keyboard::Scan::F2; + case kHIDUsage_KeyboardF3: return sf::Keyboard::Scan::F3; + case kHIDUsage_KeyboardF4: return sf::Keyboard::Scan::F4; + case kHIDUsage_KeyboardF5: return sf::Keyboard::Scan::F5; + case kHIDUsage_KeyboardF6: return sf::Keyboard::Scan::F6; + case kHIDUsage_KeyboardF7: return sf::Keyboard::Scan::F7; + case kHIDUsage_KeyboardF8: return sf::Keyboard::Scan::F8; + case kHIDUsage_KeyboardF9: return sf::Keyboard::Scan::F9; + case kHIDUsage_KeyboardF10: return sf::Keyboard::Scan::F10; + case kHIDUsage_KeyboardF11: return sf::Keyboard::Scan::F11; + case kHIDUsage_KeyboardF12: return sf::Keyboard::Scan::F12; - case kHIDUsage_KeyboardPrintScreen: return sf::Keyboard::ScanPrintScreen; - case kHIDUsage_KeyboardScrollLock: return sf::Keyboard::ScanScrollLock; - case kHIDUsage_KeyboardPause: return sf::Keyboard::ScanPause; - case kHIDUsage_KeyboardInsert: return sf::Keyboard::ScanInsert; - case kHIDUsage_KeyboardHome: return sf::Keyboard::ScanHome; - case kHIDUsage_KeyboardPageUp: return sf::Keyboard::ScanPageUp; - case kHIDUsage_KeyboardDeleteForward: return sf::Keyboard::ScanDelete; - case kHIDUsage_KeyboardEnd: return sf::Keyboard::ScanEnd; - case kHIDUsage_KeyboardPageDown: return sf::Keyboard::ScanPageDown; + case kHIDUsage_KeyboardPrintScreen: return sf::Keyboard::Scan::PrintScreen; + case kHIDUsage_KeyboardScrollLock: return sf::Keyboard::Scan::ScrollLock; + case kHIDUsage_KeyboardPause: return sf::Keyboard::Scan::Pause; + case kHIDUsage_KeyboardInsert: return sf::Keyboard::Scan::Insert; + case kHIDUsage_KeyboardHome: return sf::Keyboard::Scan::Home; + case kHIDUsage_KeyboardPageUp: return sf::Keyboard::Scan::PageUp; + case kHIDUsage_KeyboardDeleteForward: return sf::Keyboard::Scan::Delete; + case kHIDUsage_KeyboardEnd: return sf::Keyboard::Scan::End; + case kHIDUsage_KeyboardPageDown: return sf::Keyboard::Scan::PageDown; - case kHIDUsage_KeyboardRightArrow: return sf::Keyboard::ScanRight; - case kHIDUsage_KeyboardLeftArrow: return sf::Keyboard::ScanLeft; - case kHIDUsage_KeyboardDownArrow: return sf::Keyboard::ScanDown; - case kHIDUsage_KeyboardUpArrow: return sf::Keyboard::ScanUp; + case kHIDUsage_KeyboardRightArrow: return sf::Keyboard::Scan::Right; + case kHIDUsage_KeyboardLeftArrow: return sf::Keyboard::Scan::Left; + case kHIDUsage_KeyboardDownArrow: return sf::Keyboard::Scan::Down; + case kHIDUsage_KeyboardUpArrow: return sf::Keyboard::Scan::Up; - case kHIDUsage_KeypadNumLock: return sf::Keyboard::ScanNumLock; - case kHIDUsage_KeypadSlash: return sf::Keyboard::ScanNumpadDivide; - case kHIDUsage_KeypadAsterisk: return sf::Keyboard::ScanNumpadMultiply; - case kHIDUsage_KeypadHyphen: return sf::Keyboard::ScanNumpadMinus; - case kHIDUsage_KeypadPlus: return sf::Keyboard::ScanNumpadPlus; - case kHIDUsage_KeypadEqualSign: return sf::Keyboard::ScanNumpadEqual; - case kHIDUsage_KeypadEnter: return sf::Keyboard::ScanNumpadEnter; - case kHIDUsage_KeypadPeriod: return sf::Keyboard::ScanNumpadDecimal; + case kHIDUsage_KeypadNumLock: return sf::Keyboard::Scan::NumLock; + case kHIDUsage_KeypadSlash: return sf::Keyboard::Scan::NumpadDivide; + case kHIDUsage_KeypadAsterisk: return sf::Keyboard::Scan::NumpadMultiply; + case kHIDUsage_KeypadHyphen: return sf::Keyboard::Scan::NumpadMinus; + case kHIDUsage_KeypadPlus: return sf::Keyboard::Scan::NumpadPlus; + case kHIDUsage_KeypadEqualSign: return sf::Keyboard::Scan::NumpadEqual; + case kHIDUsage_KeypadEnter: return sf::Keyboard::Scan::NumpadEnter; + case kHIDUsage_KeypadPeriod: return sf::Keyboard::Scan::NumpadDecimal; - case kHIDUsage_Keypad1: return sf::Keyboard::ScanNumpad1; - case kHIDUsage_Keypad2: return sf::Keyboard::ScanNumpad2; - case kHIDUsage_Keypad3: return sf::Keyboard::ScanNumpad3; - case kHIDUsage_Keypad4: return sf::Keyboard::ScanNumpad4; - case kHIDUsage_Keypad5: return sf::Keyboard::ScanNumpad5; - case kHIDUsage_Keypad6: return sf::Keyboard::ScanNumpad6; - case kHIDUsage_Keypad7: return sf::Keyboard::ScanNumpad7; - case kHIDUsage_Keypad8: return sf::Keyboard::ScanNumpad8; - case kHIDUsage_Keypad9: return sf::Keyboard::ScanNumpad9; - case kHIDUsage_Keypad0: return sf::Keyboard::ScanNumpad0; + case kHIDUsage_Keypad1: return sf::Keyboard::Scan::Numpad1; + case kHIDUsage_Keypad2: return sf::Keyboard::Scan::Numpad2; + case kHIDUsage_Keypad3: return sf::Keyboard::Scan::Numpad3; + case kHIDUsage_Keypad4: return sf::Keyboard::Scan::Numpad4; + case kHIDUsage_Keypad5: return sf::Keyboard::Scan::Numpad5; + case kHIDUsage_Keypad6: return sf::Keyboard::Scan::Numpad6; + case kHIDUsage_Keypad7: return sf::Keyboard::Scan::Numpad7; + case kHIDUsage_Keypad8: return sf::Keyboard::Scan::Numpad8; + case kHIDUsage_Keypad9: return sf::Keyboard::Scan::Numpad9; + case kHIDUsage_Keypad0: return sf::Keyboard::Scan::Numpad0; - case kHIDUsage_KeyboardNonUSBackslash: return sf::Keyboard::ScanNonUsBackslash; - case kHIDUsage_KeyboardApplication: return sf::Keyboard::ScanApplication; - case kHIDUsage_KeyboardPower: return sf::Keyboard::ScanUnknown; + case kHIDUsage_KeyboardNonUSBackslash: return sf::Keyboard::Scan::NonUsBackslash; + case kHIDUsage_KeyboardApplication: return sf::Keyboard::Scan::Application; + case kHIDUsage_KeyboardPower: return sf::Keyboard::Scan::Unknown; - case kHIDUsage_KeyboardF13: return sf::Keyboard::ScanF13; - case kHIDUsage_KeyboardF14: return sf::Keyboard::ScanF14; - case kHIDUsage_KeyboardF15: return sf::Keyboard::ScanF15; - case kHIDUsage_KeyboardF16: return sf::Keyboard::ScanF16; - case kHIDUsage_KeyboardF17: return sf::Keyboard::ScanF17; - case kHIDUsage_KeyboardF18: return sf::Keyboard::ScanF18; - case kHIDUsage_KeyboardF19: return sf::Keyboard::ScanF19; - case kHIDUsage_KeyboardF20: return sf::Keyboard::ScanF20; - case kHIDUsage_KeyboardF21: return sf::Keyboard::ScanF21; - case kHIDUsage_KeyboardF22: return sf::Keyboard::ScanF22; - case kHIDUsage_KeyboardF23: return sf::Keyboard::ScanF23; - case kHIDUsage_KeyboardF24: return sf::Keyboard::ScanF24; + case kHIDUsage_KeyboardF13: return sf::Keyboard::Scan::F13; + case kHIDUsage_KeyboardF14: return sf::Keyboard::Scan::F14; + case kHIDUsage_KeyboardF15: return sf::Keyboard::Scan::F15; + case kHIDUsage_KeyboardF16: return sf::Keyboard::Scan::F16; + case kHIDUsage_KeyboardF17: return sf::Keyboard::Scan::F17; + case kHIDUsage_KeyboardF18: return sf::Keyboard::Scan::F18; + case kHIDUsage_KeyboardF19: return sf::Keyboard::Scan::F19; + case kHIDUsage_KeyboardF20: return sf::Keyboard::Scan::F20; + case kHIDUsage_KeyboardF21: return sf::Keyboard::Scan::F21; + case kHIDUsage_KeyboardF22: return sf::Keyboard::Scan::F22; + case kHIDUsage_KeyboardF23: return sf::Keyboard::Scan::F23; + case kHIDUsage_KeyboardF24: return sf::Keyboard::Scan::F24; - case kHIDUsage_KeyboardExecute: return sf::Keyboard::ScanExecute; - case kHIDUsage_KeyboardHelp: return sf::Keyboard::ScanHelp; - case kHIDUsage_KeyboardMenu: return sf::Keyboard::ScanMenu; - case kHIDUsage_KeyboardSelect: return sf::Keyboard::ScanSelect; - case kHIDUsage_KeyboardStop: return sf::Keyboard::ScanStop; - case kHIDUsage_KeyboardAgain: return sf::Keyboard::ScanRedo; - case kHIDUsage_KeyboardUndo: return sf::Keyboard::ScanUndo; - case kHIDUsage_KeyboardCut: return sf::Keyboard::ScanCut; - case kHIDUsage_KeyboardCopy: return sf::Keyboard::ScanCopy; - case kHIDUsage_KeyboardPaste: return sf::Keyboard::ScanPaste; - case kHIDUsage_KeyboardFind: return sf::Keyboard::ScanSearch; + case kHIDUsage_KeyboardExecute: return sf::Keyboard::Scan::Execute; + case kHIDUsage_KeyboardHelp: return sf::Keyboard::Scan::Help; + case kHIDUsage_KeyboardMenu: return sf::Keyboard::Scan::Menu; + case kHIDUsage_KeyboardSelect: return sf::Keyboard::Scan::Select; + case kHIDUsage_KeyboardStop: return sf::Keyboard::Scan::Stop; + case kHIDUsage_KeyboardAgain: return sf::Keyboard::Scan::Redo; + case kHIDUsage_KeyboardUndo: return sf::Keyboard::Scan::Undo; + case kHIDUsage_KeyboardCut: return sf::Keyboard::Scan::Cut; + case kHIDUsage_KeyboardCopy: return sf::Keyboard::Scan::Copy; + case kHIDUsage_KeyboardPaste: return sf::Keyboard::Scan::Paste; + case kHIDUsage_KeyboardFind: return sf::Keyboard::Scan::Search; - case kHIDUsage_KeyboardMute: return sf::Keyboard::ScanVolumeMute; - case kHIDUsage_KeyboardVolumeUp: return sf::Keyboard::ScanVolumeUp; - case kHIDUsage_KeyboardVolumeDown: return sf::Keyboard::ScanVolumeDown; + case kHIDUsage_KeyboardMute: return sf::Keyboard::Scan::VolumeMute; + case kHIDUsage_KeyboardVolumeUp: return sf::Keyboard::Scan::VolumeUp; + case kHIDUsage_KeyboardVolumeDown: return sf::Keyboard::Scan::VolumeDown; - case kHIDUsage_KeyboardLockingCapsLock: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardLockingNumLock: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardLockingScrollLock: return sf::Keyboard::ScanUnknown; + case kHIDUsage_KeyboardLockingCapsLock: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardLockingNumLock: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardLockingScrollLock: return sf::Keyboard::Scan::Unknown; - case kHIDUsage_KeypadComma: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeypadEqualSignAS400: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardInternational1: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardInternational2: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardInternational3: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardInternational4: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardInternational5: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardInternational6: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardInternational7: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardInternational8: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardInternational9: return sf::Keyboard::ScanUnknown; + case kHIDUsage_KeypadComma: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeypadEqualSignAS400: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardInternational1: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardInternational2: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardInternational3: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardInternational4: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardInternational5: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardInternational6: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardInternational7: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardInternational8: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardInternational9: return sf::Keyboard::Scan::Unknown; - case kHIDUsage_KeyboardLANG1: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardLANG2: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardLANG3: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardLANG4: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardLANG5: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardLANG6: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardLANG7: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardLANG8: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardLANG9: return sf::Keyboard::ScanUnknown; + case kHIDUsage_KeyboardLANG1: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardLANG2: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardLANG3: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardLANG4: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardLANG5: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardLANG6: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardLANG7: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardLANG8: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardLANG9: return sf::Keyboard::Scan::Unknown; - case kHIDUsage_KeyboardAlternateErase: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardSysReqOrAttention: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardCancel: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardClear: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardPrior: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardReturn: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardSeparator: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardOut: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardOper: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardClearOrAgain: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardCrSelOrProps: return sf::Keyboard::ScanUnknown; - case kHIDUsage_KeyboardExSel: return sf::Keyboard::ScanUnknown; + case kHIDUsage_KeyboardAlternateErase: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardSysReqOrAttention: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardCancel: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardClear: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardPrior: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardReturn: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardSeparator: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardOut: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardOper: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardClearOrAgain: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardCrSelOrProps: return sf::Keyboard::Scan::Unknown; + case kHIDUsage_KeyboardExSel: return sf::Keyboard::Scan::Unknown; /* 0xa5-0xdf Reserved */ - case kHIDUsage_KeyboardLeftControl: return sf::Keyboard::ScanLControl; - case kHIDUsage_KeyboardLeftShift: return sf::Keyboard::ScanLShift; - case kHIDUsage_KeyboardLeftAlt: return sf::Keyboard::ScanLAlt; - case kHIDUsage_KeyboardLeftGUI: return sf::Keyboard::ScanLSystem; - case kHIDUsage_KeyboardRightControl: return sf::Keyboard::ScanRControl; - case kHIDUsage_KeyboardRightShift: return sf::Keyboard::ScanRShift; - case kHIDUsage_KeyboardRightAlt: return sf::Keyboard::ScanRAlt; - case kHIDUsage_KeyboardRightGUI: return sf::Keyboard::ScanRSystem; + case kHIDUsage_KeyboardLeftControl: return sf::Keyboard::Scan::LControl; + case kHIDUsage_KeyboardLeftShift: return sf::Keyboard::Scan::LShift; + case kHIDUsage_KeyboardLeftAlt: return sf::Keyboard::Scan::LAlt; + case kHIDUsage_KeyboardLeftGUI: return sf::Keyboard::Scan::LSystem; + case kHIDUsage_KeyboardRightControl: return sf::Keyboard::Scan::RControl; + case kHIDUsage_KeyboardRightShift: return sf::Keyboard::Scan::RShift; + case kHIDUsage_KeyboardRightAlt: return sf::Keyboard::Scan::RAlt; + case kHIDUsage_KeyboardRightGUI: return sf::Keyboard::Scan::RSystem; /* 0xe8-0xffff Reserved */ - case kHIDUsage_Keyboard_Reserved: return sf::Keyboard::ScanUnknown; - default: return sf::Keyboard::ScanUnknown; + case kHIDUsage_Keyboard_Reserved: return sf::Keyboard::Scan::Unknown; + default: return sf::Keyboard::Scan::Unknown; } } @@ -973,164 +973,164 @@ Keyboard::Scancode HIDInputManager::nonLocalizedKey(UniChar virtualKeycode) // /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/Headers/Events.h switch (virtualKeycode) { - case 0x00: return sf::Keyboard::ScanA; - case 0x0b: return sf::Keyboard::ScanB; - case 0x08: return sf::Keyboard::ScanC; - case 0x02: return sf::Keyboard::ScanD; - case 0x0e: return sf::Keyboard::ScanE; - case 0x03: return sf::Keyboard::ScanF; - case 0x05: return sf::Keyboard::ScanG; - case 0x04: return sf::Keyboard::ScanH; - case 0x22: return sf::Keyboard::ScanI; - case 0x26: return sf::Keyboard::ScanJ; - case 0x28: return sf::Keyboard::ScanK; - case 0x25: return sf::Keyboard::ScanL; - case 0x2e: return sf::Keyboard::ScanM; - case 0x2d: return sf::Keyboard::ScanN; - case 0x1f: return sf::Keyboard::ScanO; - case 0x23: return sf::Keyboard::ScanP; - case 0x0c: return sf::Keyboard::ScanQ; - case 0x0f: return sf::Keyboard::ScanR; - case 0x01: return sf::Keyboard::ScanS; - case 0x11: return sf::Keyboard::ScanT; - case 0x20: return sf::Keyboard::ScanU; - case 0x09: return sf::Keyboard::ScanV; - case 0x0d: return sf::Keyboard::ScanW; - case 0x07: return sf::Keyboard::ScanX; - case 0x10: return sf::Keyboard::ScanY; - case 0x06: return sf::Keyboard::ScanZ; + case 0x00: return sf::Keyboard::Scan::A; + case 0x0b: return sf::Keyboard::Scan::B; + case 0x08: return sf::Keyboard::Scan::C; + case 0x02: return sf::Keyboard::Scan::D; + case 0x0e: return sf::Keyboard::Scan::E; + case 0x03: return sf::Keyboard::Scan::F; + case 0x05: return sf::Keyboard::Scan::G; + case 0x04: return sf::Keyboard::Scan::H; + case 0x22: return sf::Keyboard::Scan::I; + case 0x26: return sf::Keyboard::Scan::J; + case 0x28: return sf::Keyboard::Scan::K; + case 0x25: return sf::Keyboard::Scan::L; + case 0x2e: return sf::Keyboard::Scan::M; + case 0x2d: return sf::Keyboard::Scan::N; + case 0x1f: return sf::Keyboard::Scan::O; + case 0x23: return sf::Keyboard::Scan::P; + case 0x0c: return sf::Keyboard::Scan::Q; + case 0x0f: return sf::Keyboard::Scan::R; + case 0x01: return sf::Keyboard::Scan::S; + case 0x11: return sf::Keyboard::Scan::T; + case 0x20: return sf::Keyboard::Scan::U; + case 0x09: return sf::Keyboard::Scan::V; + case 0x0d: return sf::Keyboard::Scan::W; + case 0x07: return sf::Keyboard::Scan::X; + case 0x10: return sf::Keyboard::Scan::Y; + case 0x06: return sf::Keyboard::Scan::Z; - case 0x12: return sf::Keyboard::ScanNum1; - case 0x13: return sf::Keyboard::ScanNum2; - case 0x14: return sf::Keyboard::ScanNum3; - case 0x15: return sf::Keyboard::ScanNum4; - case 0x17: return sf::Keyboard::ScanNum5; - case 0x16: return sf::Keyboard::ScanNum6; - case 0x1a: return sf::Keyboard::ScanNum7; - case 0x1c: return sf::Keyboard::ScanNum8; - case 0x19: return sf::Keyboard::ScanNum9; - case 0x1d: return sf::Keyboard::ScanNum0; + case 0x12: return sf::Keyboard::Scan::Num1; + case 0x13: return sf::Keyboard::Scan::Num2; + case 0x14: return sf::Keyboard::Scan::Num3; + case 0x15: return sf::Keyboard::Scan::Num4; + case 0x17: return sf::Keyboard::Scan::Num5; + case 0x16: return sf::Keyboard::Scan::Num6; + case 0x1a: return sf::Keyboard::Scan::Num7; + case 0x1c: return sf::Keyboard::Scan::Num8; + case 0x19: return sf::Keyboard::Scan::Num9; + case 0x1d: return sf::Keyboard::Scan::Num0; - case 0x24: return sf::Keyboard::ScanEnter; - case 0x35: return sf::Keyboard::ScanEscape; - case 0x33: return sf::Keyboard::ScanBackspace; - case 0x30: return sf::Keyboard::ScanTab; - case 0x31: return sf::Keyboard::ScanSpace; + case 0x24: return sf::Keyboard::Scan::Enter; + case 0x35: return sf::Keyboard::Scan::Escape; + case 0x33: return sf::Keyboard::Scan::Backspace; + case 0x30: return sf::Keyboard::Scan::Tab; + case 0x31: return sf::Keyboard::Scan::Space; - case 0x18: return sf::Keyboard::ScanEqual; - case 0x21: return sf::Keyboard::ScanLBracket; - case 0x1e: return sf::Keyboard::ScanRBracket; - case 0x2a: return sf::Keyboard::ScanBackslash; - case 0x1b: return sf::Keyboard::ScanHyphen; - case 0x29: return sf::Keyboard::ScanSemicolon; - case 0x27: return sf::Keyboard::ScanApostrophe; - case 0x32: return sf::Keyboard::ScanGrave; - case 0x2b: return sf::Keyboard::ScanComma; - case 0x2f: return sf::Keyboard::ScanPeriod; - case 0x2c: return sf::Keyboard::ScanSlash; + case 0x18: return sf::Keyboard::Scan::Equal; + case 0x21: return sf::Keyboard::Scan::LBracket; + case 0x1e: return sf::Keyboard::Scan::RBracket; + case 0x2a: return sf::Keyboard::Scan::Backslash; + case 0x1b: return sf::Keyboard::Scan::Hyphen; + case 0x29: return sf::Keyboard::Scan::Semicolon; + case 0x27: return sf::Keyboard::Scan::Apostrophe; + case 0x32: return sf::Keyboard::Scan::Grave; + case 0x2b: return sf::Keyboard::Scan::Comma; + case 0x2f: return sf::Keyboard::Scan::Period; + case 0x2c: return sf::Keyboard::Scan::Slash; - case 0x7a: return sf::Keyboard::ScanF1; - case 0x78: return sf::Keyboard::ScanF2; - case 0x63: return sf::Keyboard::ScanF3; - case 0x76: return sf::Keyboard::ScanF4; - case 0x60: return sf::Keyboard::ScanF5; - case 0x61: return sf::Keyboard::ScanF6; - case 0x62: return sf::Keyboard::ScanF7; - case 0x64: return sf::Keyboard::ScanF8; - case 0x65: return sf::Keyboard::ScanF9; - case 0x6d: return sf::Keyboard::ScanF10; - case 0x67: return sf::Keyboard::ScanF11; - case 0x6f: return sf::Keyboard::ScanF12; - case 0x69: return sf::Keyboard::ScanF13; - case 0x6b: return sf::Keyboard::ScanF14; - case 0x71: return sf::Keyboard::ScanF15; + case 0x7a: return sf::Keyboard::Scan::F1; + case 0x78: return sf::Keyboard::Scan::F2; + case 0x63: return sf::Keyboard::Scan::F3; + case 0x76: return sf::Keyboard::Scan::F4; + case 0x60: return sf::Keyboard::Scan::F5; + case 0x61: return sf::Keyboard::Scan::F6; + case 0x62: return sf::Keyboard::Scan::F7; + case 0x64: return sf::Keyboard::Scan::F8; + case 0x65: return sf::Keyboard::Scan::F9; + case 0x6d: return sf::Keyboard::Scan::F10; + case 0x67: return sf::Keyboard::Scan::F11; + case 0x6f: return sf::Keyboard::Scan::F12; + case 0x69: return sf::Keyboard::Scan::F13; + case 0x6b: return sf::Keyboard::Scan::F14; + case 0x71: return sf::Keyboard::Scan::F15; - case 0x6A: return sf::Keyboard::ScanF16; - case 0x40: return sf::Keyboard::ScanF17; - case 0x4F: return sf::Keyboard::ScanF18; - case 0x50: return sf::Keyboard::ScanF19; - case 0x5A: return sf::Keyboard::ScanF20; + case 0x6A: return sf::Keyboard::Scan::F16; + case 0x40: return sf::Keyboard::Scan::F17; + case 0x4F: return sf::Keyboard::Scan::F18; + case 0x50: return sf::Keyboard::Scan::F19; + case 0x5A: return sf::Keyboard::Scan::F20; /* TODO Those are missing: - * case 0x: return sf::Keyboard::ScanF21; - * case 0x: return sf::Keyboard::ScanF22; - * case 0x: return sf::Keyboard::ScanF23; - * case 0x: return sf::Keyboard::ScanF24; + * case 0x: return sf::Keyboard::Scan::F21; + * case 0x: return sf::Keyboard::Scan::F22; + * case 0x: return sf::Keyboard::Scan::F23; + * case 0x: return sf::Keyboard::Scan::F24; */ - case 0x39: return sf::Keyboard::ScanCapsLock; + case 0x39: return sf::Keyboard::Scan::CapsLock; /* TODO Those are missing: - * case 0x: return sf::Keyboard::ScanPrintScreen; - * case 0x: return sf::Keyboard::ScanScrollLock; - * case 0x: return sf::Keyboard::ScanPause; + * case 0x: return sf::Keyboard::Scan::PrintScreen; + * case 0x: return sf::Keyboard::Scan::ScrollLock; + * case 0x: return sf::Keyboard::Scan::Pause; */ - case 0x72: return sf::Keyboard::ScanInsert; - case 0x73: return sf::Keyboard::ScanHome; - case 0x74: return sf::Keyboard::ScanPageUp; - case 0x75: return sf::Keyboard::ScanDelete; - case 0x77: return sf::Keyboard::ScanEnd; - case 0x79: return sf::Keyboard::ScanPageDown; + case 0x72: return sf::Keyboard::Scan::Insert; + case 0x73: return sf::Keyboard::Scan::Home; + case 0x74: return sf::Keyboard::Scan::PageUp; + case 0x75: return sf::Keyboard::Scan::Delete; + case 0x77: return sf::Keyboard::Scan::End; + case 0x79: return sf::Keyboard::Scan::PageDown; - case 0x7c: return sf::Keyboard::ScanRight; - case 0x7b: return sf::Keyboard::ScanLeft; - case 0x7d: return sf::Keyboard::ScanDown; - case 0x7e: return sf::Keyboard::ScanUp; + case 0x7c: return sf::Keyboard::Scan::Right; + case 0x7b: return sf::Keyboard::Scan::Left; + case 0x7d: return sf::Keyboard::Scan::Down; + case 0x7e: return sf::Keyboard::Scan::Up; - case 0x47: return sf::Keyboard::ScanNumLock; - case 0x4b: return sf::Keyboard::ScanNumpadDivide; - case 0x43: return sf::Keyboard::ScanNumpadMultiply; - case 0x4e: return sf::Keyboard::ScanNumpadMinus; - case 0x45: return sf::Keyboard::ScanNumpadPlus; - case 0x51: return sf::Keyboard::ScanNumpadEqual; - case 0x4c: return sf::Keyboard::ScanNumpadEnter; - case 0x41: return sf::Keyboard::ScanNumpadDecimal; + case 0x47: return sf::Keyboard::Scan::NumLock; + case 0x4b: return sf::Keyboard::Scan::NumpadDivide; + case 0x43: return sf::Keyboard::Scan::NumpadMultiply; + case 0x4e: return sf::Keyboard::Scan::NumpadMinus; + case 0x45: return sf::Keyboard::Scan::NumpadPlus; + case 0x51: return sf::Keyboard::Scan::NumpadEqual; + case 0x4c: return sf::Keyboard::Scan::NumpadEnter; + case 0x41: return sf::Keyboard::Scan::NumpadDecimal; - case 0x53: return sf::Keyboard::ScanNumpad1; - case 0x54: return sf::Keyboard::ScanNumpad2; - case 0x55: return sf::Keyboard::ScanNumpad3; - case 0x56: return sf::Keyboard::ScanNumpad4; - case 0x57: return sf::Keyboard::ScanNumpad5; - case 0x58: return sf::Keyboard::ScanNumpad6; - case 0x59: return sf::Keyboard::ScanNumpad7; - case 0x5b: return sf::Keyboard::ScanNumpad8; - case 0x5c: return sf::Keyboard::ScanNumpad9; - case 0x52: return sf::Keyboard::ScanNumpad0; + case 0x53: return sf::Keyboard::Scan::Numpad1; + case 0x54: return sf::Keyboard::Scan::Numpad2; + case 0x55: return sf::Keyboard::Scan::Numpad3; + case 0x56: return sf::Keyboard::Scan::Numpad4; + case 0x57: return sf::Keyboard::Scan::Numpad5; + case 0x58: return sf::Keyboard::Scan::Numpad6; + case 0x59: return sf::Keyboard::Scan::Numpad7; + case 0x5b: return sf::Keyboard::Scan::Numpad8; + case 0x5c: return sf::Keyboard::Scan::Numpad9; + case 0x52: return sf::Keyboard::Scan::Numpad0; /* TODO Those are missing: - * case 0x: return sf::Keyboard::ScanNonUsBackslash; - * case 0x: return sf::Keyboard::ScanApplication; - * case 0x: return sf::Keyboard::ScanExecute; - * case 0x: return sf::Keyboard::ScanHelp; - * case 0x: return sf::Keyboard::ScanMenu; - * case 0x: return sf::Keyboard::ScanSelect; - * case 0x: return sf::Keyboard::ScanStop; - * case 0x: return sf::Keyboard::ScanRedo; - * case 0x: return sf::Keyboard::ScanUndo; - * case 0x: return sf::Keyboard::ScanCut; - * case 0x: return sf::Keyboard::ScanCopy; - * case 0x: return sf::Keyboard::ScanPaste; - * case 0x: return sf::Keyboard::ScanSearch; + * case 0x: return sf::Keyboard::Scan::NonUsBackslash; + * case 0x: return sf::Keyboard::Scan::Application; + * case 0x: return sf::Keyboard::Scan::Execute; + * case 0x: return sf::Keyboard::Scan::Help; + * case 0x: return sf::Keyboard::Scan::Menu; + * case 0x: return sf::Keyboard::Scan::Select; + * case 0x: return sf::Keyboard::Scan::Stop; + * case 0x: return sf::Keyboard::Scan::Redo; + * case 0x: return sf::Keyboard::Scan::Undo; + * case 0x: return sf::Keyboard::Scan::Cut; + * case 0x: return sf::Keyboard::Scan::Copy; + * case 0x: return sf::Keyboard::Scan::Paste; + * case 0x: return sf::Keyboard::Scan::Search; */ - case 0x4a: return sf::Keyboard::ScanVolumeMute; - case 0x48: return sf::Keyboard::ScanVolumeUp; - case 0x49: return sf::Keyboard::ScanVolumeDown; + case 0x4a: return sf::Keyboard::Scan::VolumeMute; + case 0x48: return sf::Keyboard::Scan::VolumeUp; + case 0x49: return sf::Keyboard::Scan::VolumeDown; /* NOTE Those are symmetric so we leave them out. * Thankfully handled through modifiers and not virtual codes. - * case 0x3b: return sf::Keyboard::ScanLControl; - * case 0x38: return sf::Keyboard::ScanLShift; - * case 0x3a: return sf::Keyboard::ScanLAlt; - * case 0x37: return sf::Keyboard::ScanLSystem; - * case 0x3b: return sf::Keyboard::ScanRControl; - * case 0x38: return sf::Keyboard::ScanRShift; - * case 0x3a: return sf::Keyboard::ScanRAlt; - * case 0x37: return sf::Keyboard::ScanRSystem; + * case 0x3b: return sf::Keyboard::Scan::LControl; + * case 0x38: return sf::Keyboard::Scan::LShift; + * case 0x3a: return sf::Keyboard::Scan::LAlt; + * case 0x37: return sf::Keyboard::Scan::LSystem; + * case 0x3b: return sf::Keyboard::Scan::RControl; + * case 0x38: return sf::Keyboard::Scan::RShift; + * case 0x3a: return sf::Keyboard::Scan::RAlt; + * case 0x37: return sf::Keyboard::Scan::RSystem; */ - default: return sf::Keyboard::ScanUnknown; + default: return sf::Keyboard::Scan::Unknown; } } @@ -1140,145 +1140,145 @@ UInt8 HIDInputManager::scanToVirtualCode(Keyboard::Scancode code) { switch (code) { - case sf::Keyboard::ScanA: return 0x00; - case sf::Keyboard::ScanB: return 0x0b; - case sf::Keyboard::ScanC: return 0x08; - case sf::Keyboard::ScanD: return 0x02; - case sf::Keyboard::ScanE: return 0x0e; - case sf::Keyboard::ScanF: return 0x03; - case sf::Keyboard::ScanG: return 0x05; - case sf::Keyboard::ScanH: return 0x04; - case sf::Keyboard::ScanI: return 0x22; - case sf::Keyboard::ScanJ: return 0x26; - case sf::Keyboard::ScanK: return 0x28; - case sf::Keyboard::ScanL: return 0x25; - case sf::Keyboard::ScanM: return 0x2e; - case sf::Keyboard::ScanN: return 0x2d; - case sf::Keyboard::ScanO: return 0x1f; - case sf::Keyboard::ScanP: return 0x23; - case sf::Keyboard::ScanQ: return 0x0c; - case sf::Keyboard::ScanR: return 0x0f; - case sf::Keyboard::ScanS: return 0x01; - case sf::Keyboard::ScanT: return 0x11; - case sf::Keyboard::ScanU: return 0x20; - case sf::Keyboard::ScanV: return 0x09; - case sf::Keyboard::ScanW: return 0x0d; - case sf::Keyboard::ScanX: return 0x07; - case sf::Keyboard::ScanY: return 0x10; - case sf::Keyboard::ScanZ: return 0x06; + case sf::Keyboard::Scan::A: return 0x00; + case sf::Keyboard::Scan::B: return 0x0b; + case sf::Keyboard::Scan::C: return 0x08; + case sf::Keyboard::Scan::D: return 0x02; + case sf::Keyboard::Scan::E: return 0x0e; + case sf::Keyboard::Scan::F: return 0x03; + case sf::Keyboard::Scan::G: return 0x05; + case sf::Keyboard::Scan::H: return 0x04; + case sf::Keyboard::Scan::I: return 0x22; + case sf::Keyboard::Scan::J: return 0x26; + case sf::Keyboard::Scan::K: return 0x28; + case sf::Keyboard::Scan::L: return 0x25; + case sf::Keyboard::Scan::M: return 0x2e; + case sf::Keyboard::Scan::N: return 0x2d; + case sf::Keyboard::Scan::O: return 0x1f; + case sf::Keyboard::Scan::P: return 0x23; + case sf::Keyboard::Scan::Q: return 0x0c; + case sf::Keyboard::Scan::R: return 0x0f; + case sf::Keyboard::Scan::S: return 0x01; + case sf::Keyboard::Scan::T: return 0x11; + case sf::Keyboard::Scan::U: return 0x20; + case sf::Keyboard::Scan::V: return 0x09; + case sf::Keyboard::Scan::W: return 0x0d; + case sf::Keyboard::Scan::X: return 0x07; + case sf::Keyboard::Scan::Y: return 0x10; + case sf::Keyboard::Scan::Z: return 0x06; - case sf::Keyboard::ScanNum1: return 0x12; - case sf::Keyboard::ScanNum2: return 0x13; - case sf::Keyboard::ScanNum3: return 0x14; - case sf::Keyboard::ScanNum4: return 0x15; - case sf::Keyboard::ScanNum5: return 0x17; - case sf::Keyboard::ScanNum6: return 0x16; - case sf::Keyboard::ScanNum7: return 0x1a; - case sf::Keyboard::ScanNum8: return 0x1c; - case sf::Keyboard::ScanNum9: return 0x19; - case sf::Keyboard::ScanNum0: return 0x1d; + case sf::Keyboard::Scan::Num1: return 0x12; + case sf::Keyboard::Scan::Num2: return 0x13; + case sf::Keyboard::Scan::Num3: return 0x14; + case sf::Keyboard::Scan::Num4: return 0x15; + case sf::Keyboard::Scan::Num5: return 0x17; + case sf::Keyboard::Scan::Num6: return 0x16; + case sf::Keyboard::Scan::Num7: return 0x1a; + case sf::Keyboard::Scan::Num8: return 0x1c; + case sf::Keyboard::Scan::Num9: return 0x19; + case sf::Keyboard::Scan::Num0: return 0x1d; - case sf::Keyboard::ScanEnter: return 0x24; - case sf::Keyboard::ScanEscape: return 0x35; - case sf::Keyboard::ScanBackspace: return 0x33; - case sf::Keyboard::ScanTab: return 0x30; - case sf::Keyboard::ScanSpace: return 0x31; + case sf::Keyboard::Scan::Enter: return 0x24; + case sf::Keyboard::Scan::Escape: return 0x35; + case sf::Keyboard::Scan::Backspace: return 0x33; + case sf::Keyboard::Scan::Tab: return 0x30; + case sf::Keyboard::Scan::Space: return 0x31; - case sf::Keyboard::ScanEqual: return 0x18; - case sf::Keyboard::ScanLBracket: return 0x21; - case sf::Keyboard::ScanRBracket: return 0x1e; - case sf::Keyboard::ScanBackslash: return 0x2a; - case sf::Keyboard::ScanHyphen: return 0x1b; - case sf::Keyboard::ScanSemicolon: return 0x29; - case sf::Keyboard::ScanApostrophe: return 0x27; - case sf::Keyboard::ScanGrave: return 0x32; - case sf::Keyboard::ScanComma: return 0x2b; - case sf::Keyboard::ScanPeriod: return 0x2f; - case sf::Keyboard::ScanSlash: return 0x2c; + case sf::Keyboard::Scan::Equal: return 0x18; + case sf::Keyboard::Scan::LBracket: return 0x21; + case sf::Keyboard::Scan::RBracket: return 0x1e; + case sf::Keyboard::Scan::Backslash: return 0x2a; + case sf::Keyboard::Scan::Hyphen: return 0x1b; + case sf::Keyboard::Scan::Semicolon: return 0x29; + case sf::Keyboard::Scan::Apostrophe: return 0x27; + case sf::Keyboard::Scan::Grave: return 0x32; + case sf::Keyboard::Scan::Comma: return 0x2b; + case sf::Keyboard::Scan::Period: return 0x2f; + case sf::Keyboard::Scan::Slash: return 0x2c; - case sf::Keyboard::ScanF1: return 0x7a; - case sf::Keyboard::ScanF2: return 0x78; - case sf::Keyboard::ScanF3: return 0x63; - case sf::Keyboard::ScanF4: return 0x76; - case sf::Keyboard::ScanF5: return 0x60; - case sf::Keyboard::ScanF6: return 0x61; - case sf::Keyboard::ScanF7: return 0x62; - case sf::Keyboard::ScanF8: return 0x64; - case sf::Keyboard::ScanF9: return 0x65; - case sf::Keyboard::ScanF10: return 0x6d; - case sf::Keyboard::ScanF11: return 0x67; - case sf::Keyboard::ScanF12: return 0x6f; - case sf::Keyboard::ScanF13: return 0x69; - case sf::Keyboard::ScanF14: return 0x6b; - case sf::Keyboard::ScanF15: return 0x71; + case sf::Keyboard::Scan::F1: return 0x7a; + case sf::Keyboard::Scan::F2: return 0x78; + case sf::Keyboard::Scan::F3: return 0x63; + case sf::Keyboard::Scan::F4: return 0x76; + case sf::Keyboard::Scan::F5: return 0x60; + case sf::Keyboard::Scan::F6: return 0x61; + case sf::Keyboard::Scan::F7: return 0x62; + case sf::Keyboard::Scan::F8: return 0x64; + case sf::Keyboard::Scan::F9: return 0x65; + case sf::Keyboard::Scan::F10: return 0x6d; + case sf::Keyboard::Scan::F11: return 0x67; + case sf::Keyboard::Scan::F12: return 0x6f; + case sf::Keyboard::Scan::F13: return 0x69; + case sf::Keyboard::Scan::F14: return 0x6b; + case sf::Keyboard::Scan::F15: return 0x71; - case sf::Keyboard::ScanCapsLock: return 0x39; + case sf::Keyboard::Scan::CapsLock: return 0x39; /* TODO Those are missing: - * case sf::Keyboard::ScanPrintScreen: return 0; - * case sf::Keyboard::ScanScrollLock: return 0; - * case sf::Keyboard::ScanPause: return 0; + * case sf::Keyboard::Scan::PrintScreen: return 0; + * case sf::Keyboard::Scan::ScrollLock: return 0; + * case sf::Keyboard::Scan::Pause: return 0; */ - case sf::Keyboard::ScanInsert: return 0x72; - case sf::Keyboard::ScanHome: return 0x73; - case sf::Keyboard::ScanPageUp: return 0x74; - case sf::Keyboard::ScanDelete: return 0x75; - case sf::Keyboard::ScanEnd: return 0x77; - case sf::Keyboard::ScanPageDown: return 0x79; + case sf::Keyboard::Scan::Insert: return 0x72; + case sf::Keyboard::Scan::Home: return 0x73; + case sf::Keyboard::Scan::PageUp: return 0x74; + case sf::Keyboard::Scan::Delete: return 0x75; + case sf::Keyboard::Scan::End: return 0x77; + case sf::Keyboard::Scan::PageDown: return 0x79; - case sf::Keyboard::ScanRight: return 0x7c; - case sf::Keyboard::ScanLeft: return 0x7b; - case sf::Keyboard::ScanDown: return 0x7d; - case sf::Keyboard::ScanUp: return 0x7e; + case sf::Keyboard::Scan::Right: return 0x7c; + case sf::Keyboard::Scan::Left: return 0x7b; + case sf::Keyboard::Scan::Down: return 0x7d; + case sf::Keyboard::Scan::Up: return 0x7e; - case sf::Keyboard::ScanNumLock: return 0x47; - case sf::Keyboard::ScanNumpadDivide: return 0x4b; - case sf::Keyboard::ScanNumpadMultiply: return 0x43; - case sf::Keyboard::ScanNumpadMinus: return 0x4e; - case sf::Keyboard::ScanNumpadPlus: return 0x45; - case sf::Keyboard::ScanNumpadEqual: return 0x51; - case sf::Keyboard::ScanNumpadEnter: return 0x4c; - case sf::Keyboard::ScanNumpadDecimal: return 0x41; + case sf::Keyboard::Scan::NumLock: return 0x47; + case sf::Keyboard::Scan::NumpadDivide: return 0x4b; + case sf::Keyboard::Scan::NumpadMultiply: return 0x43; + case sf::Keyboard::Scan::NumpadMinus: return 0x4e; + case sf::Keyboard::Scan::NumpadPlus: return 0x45; + case sf::Keyboard::Scan::NumpadEqual: return 0x51; + case sf::Keyboard::Scan::NumpadEnter: return 0x4c; + case sf::Keyboard::Scan::NumpadDecimal: return 0x41; - case sf::Keyboard::ScanNumpad1: return 0x53; - case sf::Keyboard::ScanNumpad2: return 0x54; - case sf::Keyboard::ScanNumpad3: return 0x55; - case sf::Keyboard::ScanNumpad4: return 0x56; - case sf::Keyboard::ScanNumpad5: return 0x57; - case sf::Keyboard::ScanNumpad6: return 0x58; - case sf::Keyboard::ScanNumpad7: return 0x59; - case sf::Keyboard::ScanNumpad8: return 0x5b; - case sf::Keyboard::ScanNumpad9: return 0x5c; - case sf::Keyboard::ScanNumpad0: return 0x52; + case sf::Keyboard::Scan::Numpad1: return 0x53; + case sf::Keyboard::Scan::Numpad2: return 0x54; + case sf::Keyboard::Scan::Numpad3: return 0x55; + case sf::Keyboard::Scan::Numpad4: return 0x56; + case sf::Keyboard::Scan::Numpad5: return 0x57; + case sf::Keyboard::Scan::Numpad6: return 0x58; + case sf::Keyboard::Scan::Numpad7: return 0x59; + case sf::Keyboard::Scan::Numpad8: return 0x5b; + case sf::Keyboard::Scan::Numpad9: return 0x5c; + case sf::Keyboard::Scan::Numpad0: return 0x52; /* TODO Those are missing: - * case sf::Keyboard::ScanNonUsBackslash: return 0; - * case sf::Keyboard::ScanApplication: return 0; - * case sf::Keyboard::ScanExecute: return 0; - * case sf::Keyboard::ScanHelp: return 0; - * case sf::Keyboard::ScanMenu: return 0; - * case sf::Keyboard::ScanSelect: return 0; - * case sf::Keyboard::ScanStop: return 0; - * case sf::Keyboard::ScanRedo: return 0; - * case sf::Keyboard::ScanUndo: return 0; - * case sf::Keyboard::ScanCut: return 0; - * case sf::Keyboard::ScanCopy: return 0; - * case sf::Keyboard::ScanPaste: return 0; - * case sf::Keyboard::ScanSearch: return 0; + * case sf::Keyboard::Scan::NonUsBackslash: return 0; + * case sf::Keyboard::Scan::Application: return 0; + * case sf::Keyboard::Scan::Execute: return 0; + * case sf::Keyboard::Scan::Help: return 0; + * case sf::Keyboard::Scan::Menu: return 0; + * case sf::Keyboard::Scan::Select: return 0; + * case sf::Keyboard::Scan::Stop: return 0; + * case sf::Keyboard::Scan::Redo: return 0; + * case sf::Keyboard::Scan::Undo: return 0; + * case sf::Keyboard::Scan::Cut: return 0; + * case sf::Keyboard::Scan::Copy: return 0; + * case sf::Keyboard::Scan::Paste: return 0; + * case sf::Keyboard::Scan::Search: return 0; */ - case sf::Keyboard::ScanVolumeMute: return 0x4a; - case sf::Keyboard::ScanVolumeUp: return 0x48; - case sf::Keyboard::ScanVolumeDown: return 0x49; + case sf::Keyboard::Scan::VolumeMute: return 0x4a; + case sf::Keyboard::Scan::VolumeUp: return 0x48; + case sf::Keyboard::Scan::VolumeDown: return 0x49; - case sf::Keyboard::ScanLControl: return 0x3b; - case sf::Keyboard::ScanLShift: return 0x38; - case sf::Keyboard::ScanLAlt: return 0x3a; - case sf::Keyboard::ScanLSystem: return 0x37; - case sf::Keyboard::ScanRControl: return 0x3b; - case sf::Keyboard::ScanRShift: return 0x38; - case sf::Keyboard::ScanRAlt: return 0x3a; - case sf::Keyboard::ScanRSystem: return 0x37; + case sf::Keyboard::Scan::LControl: return 0x3b; + case sf::Keyboard::Scan::LShift: return 0x38; + case sf::Keyboard::Scan::LAlt: return 0x3a; + case sf::Keyboard::Scan::LSystem: return 0x37; + case sf::Keyboard::Scan::RControl: return 0x3b; + case sf::Keyboard::Scan::RShift: return 0x38; + case sf::Keyboard::Scan::RAlt: return 0x3a; + case sf::Keyboard::Scan::RSystem: return 0x37; default: return 0x00; } @@ -1290,65 +1290,65 @@ Keyboard::Key HIDInputManager::localizedKeyFallback(Keyboard::Scancode code) { switch (code) { - case sf::Keyboard::ScanEnter: return sf::Keyboard::Return; - case sf::Keyboard::ScanEscape: return sf::Keyboard::Escape; - case sf::Keyboard::ScanBackspace: return sf::Keyboard::BackSpace; - case sf::Keyboard::ScanTab: return sf::Keyboard::Tab; - case sf::Keyboard::ScanSpace: return sf::Keyboard::Space; + case sf::Keyboard::Scan::Enter: return sf::Keyboard::Return; + case sf::Keyboard::Scan::Escape: return sf::Keyboard::Escape; + case sf::Keyboard::Scan::Backspace: return sf::Keyboard::BackSpace; + case sf::Keyboard::Scan::Tab: return sf::Keyboard::Tab; + case sf::Keyboard::Scan::Space: return sf::Keyboard::Space; - case sf::Keyboard::ScanF1: return sf::Keyboard::F1; - case sf::Keyboard::ScanF2: return sf::Keyboard::F2; - case sf::Keyboard::ScanF3: return sf::Keyboard::F3; - case sf::Keyboard::ScanF4: return sf::Keyboard::F4; - case sf::Keyboard::ScanF5: return sf::Keyboard::F5; - case sf::Keyboard::ScanF6: return sf::Keyboard::F6; - case sf::Keyboard::ScanF7: return sf::Keyboard::F7; - case sf::Keyboard::ScanF8: return sf::Keyboard::F8; - case sf::Keyboard::ScanF9: return sf::Keyboard::F9; - case sf::Keyboard::ScanF10: return sf::Keyboard::F10; - case sf::Keyboard::ScanF11: return sf::Keyboard::F11; - case sf::Keyboard::ScanF12: return sf::Keyboard::F12; - case sf::Keyboard::ScanF13: return sf::Keyboard::F13; - case sf::Keyboard::ScanF14: return sf::Keyboard::F14; - case sf::Keyboard::ScanF15: return sf::Keyboard::F15; + case sf::Keyboard::Scan::F1: return sf::Keyboard::F1; + case sf::Keyboard::Scan::F2: return sf::Keyboard::F2; + case sf::Keyboard::Scan::F3: return sf::Keyboard::F3; + case sf::Keyboard::Scan::F4: return sf::Keyboard::F4; + case sf::Keyboard::Scan::F5: return sf::Keyboard::F5; + case sf::Keyboard::Scan::F6: return sf::Keyboard::F6; + case sf::Keyboard::Scan::F7: return sf::Keyboard::F7; + case sf::Keyboard::Scan::F8: return sf::Keyboard::F8; + case sf::Keyboard::Scan::F9: return sf::Keyboard::F9; + case sf::Keyboard::Scan::F10: return sf::Keyboard::F10; + case sf::Keyboard::Scan::F11: return sf::Keyboard::F11; + case sf::Keyboard::Scan::F12: return sf::Keyboard::F12; + case sf::Keyboard::Scan::F13: return sf::Keyboard::F13; + case sf::Keyboard::Scan::F14: return sf::Keyboard::F14; + case sf::Keyboard::Scan::F15: return sf::Keyboard::F15; - case sf::Keyboard::ScanPause: return sf::Keyboard::Pause; - case sf::Keyboard::ScanInsert: return sf::Keyboard::Insert; - case sf::Keyboard::ScanHome: return sf::Keyboard::Home; - case sf::Keyboard::ScanPageUp: return sf::Keyboard::PageUp; - case sf::Keyboard::ScanDelete: return sf::Keyboard::Delete; - case sf::Keyboard::ScanEnd: return sf::Keyboard::End; - case sf::Keyboard::ScanPageDown: return sf::Keyboard::PageDown; + case sf::Keyboard::Scan::Pause: return sf::Keyboard::Pause; + case sf::Keyboard::Scan::Insert: return sf::Keyboard::Insert; + case sf::Keyboard::Scan::Home: return sf::Keyboard::Home; + case sf::Keyboard::Scan::PageUp: return sf::Keyboard::PageUp; + case sf::Keyboard::Scan::Delete: return sf::Keyboard::Delete; + case sf::Keyboard::Scan::End: return sf::Keyboard::End; + case sf::Keyboard::Scan::PageDown: return sf::Keyboard::PageDown; - case sf::Keyboard::ScanRight: return sf::Keyboard::Right; - case sf::Keyboard::ScanLeft: return sf::Keyboard::Left; - case sf::Keyboard::ScanDown: return sf::Keyboard::Down; - case sf::Keyboard::ScanUp: return sf::Keyboard::Up; + case sf::Keyboard::Scan::Right: return sf::Keyboard::Right; + case sf::Keyboard::Scan::Left: return sf::Keyboard::Left; + case sf::Keyboard::Scan::Down: return sf::Keyboard::Down; + case sf::Keyboard::Scan::Up: return sf::Keyboard::Up; - case sf::Keyboard::ScanNumpadDivide: return sf::Keyboard::Divide; - case sf::Keyboard::ScanNumpadMultiply: return sf::Keyboard::Multiply; - case sf::Keyboard::ScanNumpadMinus: return sf::Keyboard::Subtract; - case sf::Keyboard::ScanNumpadPlus: return sf::Keyboard::Add; + case sf::Keyboard::Scan::NumpadDivide: return sf::Keyboard::Divide; + case sf::Keyboard::Scan::NumpadMultiply: return sf::Keyboard::Multiply; + case sf::Keyboard::Scan::NumpadMinus: return sf::Keyboard::Subtract; + case sf::Keyboard::Scan::NumpadPlus: return sf::Keyboard::Add; - case sf::Keyboard::ScanNumpad0: return sf::Keyboard::Numpad1; - case sf::Keyboard::ScanNumpad1: return sf::Keyboard::Numpad2; - case sf::Keyboard::ScanNumpad2: return sf::Keyboard::Numpad3; - case sf::Keyboard::ScanNumpad3: return sf::Keyboard::Numpad4; - case sf::Keyboard::ScanNumpad4: return sf::Keyboard::Numpad5; - case sf::Keyboard::ScanNumpad5: return sf::Keyboard::Numpad6; - case sf::Keyboard::ScanNumpad6: return sf::Keyboard::Numpad7; - case sf::Keyboard::ScanNumpad7: return sf::Keyboard::Numpad8; - case sf::Keyboard::ScanNumpad8: return sf::Keyboard::Numpad9; - case sf::Keyboard::ScanNumpad9: return sf::Keyboard::Numpad0; + case sf::Keyboard::Scan::Numpad0: return sf::Keyboard::Numpad1; + case sf::Keyboard::Scan::Numpad1: return sf::Keyboard::Numpad2; + case sf::Keyboard::Scan::Numpad2: return sf::Keyboard::Numpad3; + case sf::Keyboard::Scan::Numpad3: return sf::Keyboard::Numpad4; + case sf::Keyboard::Scan::Numpad4: return sf::Keyboard::Numpad5; + case sf::Keyboard::Scan::Numpad5: return sf::Keyboard::Numpad6; + case sf::Keyboard::Scan::Numpad6: return sf::Keyboard::Numpad7; + case sf::Keyboard::Scan::Numpad7: return sf::Keyboard::Numpad8; + case sf::Keyboard::Scan::Numpad8: return sf::Keyboard::Numpad9; + case sf::Keyboard::Scan::Numpad9: return sf::Keyboard::Numpad0; - case sf::Keyboard::ScanLControl: return sf::Keyboard::LControl; - case sf::Keyboard::ScanLShift: return sf::Keyboard::LShift; - case sf::Keyboard::ScanLAlt: return sf::Keyboard::LAlt; - case sf::Keyboard::ScanLSystem: return sf::Keyboard::LSystem; - case sf::Keyboard::ScanRControl: return sf::Keyboard::RControl; - case sf::Keyboard::ScanRShift: return sf::Keyboard::RShift; - case sf::Keyboard::ScanRAlt: return sf::Keyboard::RAlt; - case sf::Keyboard::ScanRSystem: return sf::Keyboard::RSystem; + case sf::Keyboard::Scan::LControl: return sf::Keyboard::LControl; + case sf::Keyboard::Scan::LShift: return sf::Keyboard::LShift; + case sf::Keyboard::Scan::LAlt: return sf::Keyboard::LAlt; + case sf::Keyboard::Scan::LSystem: return sf::Keyboard::LSystem; + case sf::Keyboard::Scan::RControl: return sf::Keyboard::RControl; + case sf::Keyboard::Scan::RShift: return sf::Keyboard::RShift; + case sf::Keyboard::Scan::RAlt: return sf::Keyboard::RAlt; + case sf::Keyboard::Scan::RSystem: return sf::Keyboard::RSystem; default: return sf::Keyboard::Unknown; } diff --git a/src/SFML/Window/OSX/SFKeyboardModifiersHelper.mm b/src/SFML/Window/OSX/SFKeyboardModifiersHelper.mm index 8bf31ea8e..87b3c96dc 100644 --- a/src/SFML/Window/OSX/SFKeyboardModifiersHelper.mm +++ b/src/SFML/Window/OSX/SFKeyboardModifiersHelper.mm @@ -169,7 +169,7 @@ void handleModifiersChanged(NSUInteger modifiers, sf::priv::WindowImplCocoa& req NSLeftShiftKeyMask, NSRightShiftKeyMask, state.leftShiftWasDown, state.rightShiftWasDown, sf::Keyboard::LShift, sf::Keyboard::RShift, - sf::Keyboard::ScanLShift, sf::Keyboard::ScanRShift, + sf::Keyboard::Scan::LShift, sf::Keyboard::Scan::RShift, requester ); @@ -179,7 +179,7 @@ void handleModifiersChanged(NSUInteger modifiers, sf::priv::WindowImplCocoa& req NSLeftCommandKeyMask, NSRightCommandKeyMask, state.leftCommandWasDown, state.rightCommandWasDown, sf::Keyboard::LSystem, sf::Keyboard::RSystem, - sf::Keyboard::ScanLSystem, sf::Keyboard::ScanRSystem, + sf::Keyboard::Scan::LSystem, sf::Keyboard::Scan::RSystem, requester ); @@ -189,7 +189,7 @@ void handleModifiersChanged(NSUInteger modifiers, sf::priv::WindowImplCocoa& req NSLeftAlternateKeyMask, NSRightAlternateKeyMask, state.leftAlternateWasDown, state.rightAlternateWasDown, sf::Keyboard::LAlt, sf::Keyboard::RAlt, - sf::Keyboard::ScanLAlt, sf::Keyboard::ScanRAlt, + sf::Keyboard::Scan::LAlt, sf::Keyboard::Scan::RAlt, requester ); @@ -199,7 +199,7 @@ void handleModifiersChanged(NSUInteger modifiers, sf::priv::WindowImplCocoa& req NSLeftControlKeyMask, NSRightControlKeyMask, state.leftControlWasDown, state.rightControlWasDown, sf::Keyboard::LControl, sf::Keyboard::RControl, - sf::Keyboard::ScanLControl, sf::Keyboard::ScanRControl, + sf::Keyboard::Scan::LControl, sf::Keyboard::Scan::RControl, requester ); } diff --git a/src/SFML/Window/OSX/SFOpenGLView+keyboard.mm b/src/SFML/Window/OSX/SFOpenGLView+keyboard.mm index b686d614b..7cd901404 100644 --- a/src/SFML/Window/OSX/SFOpenGLView+keyboard.mm +++ b/src/SFML/Window/OSX/SFOpenGLView+keyboard.mm @@ -94,7 +94,7 @@ { sf::Event::KeyEvent key = [SFOpenGLView convertNSKeyEventToSFMLEvent:theEvent]; - if ((key.code != sf::Keyboard::Unknown) || (key.scancode != sf::Keyboard::ScanUnknown)) + if ((key.code != sf::Keyboard::Unknown) || (key.scancode != sf::Keyboard::Scan::Unknown)) m_requester->keyDown(key); } diff --git a/src/SFML/Window/Unix/KeyboardImpl.cpp b/src/SFML/Window/Unix/KeyboardImpl.cpp index f5e806ceb..5a4316871 100644 --- a/src/SFML/Window/Unix/KeyboardImpl.cpp +++ b/src/SFML/Window/Unix/KeyboardImpl.cpp @@ -44,7 +44,7 @@ namespace const KeyCode NullKeyCode = 0; const int MaxKeyCode = 256; -KeyCode scancodeToKeycode[sf::Keyboard::ScancodeCount]; ///< Mapping of SFML scancode to X11 KeyCode +KeyCode scancodeToKeycode[sf::Keyboard::Scan::ScancodeCount]; ///< Mapping of SFML scancode to X11 KeyCode sf::Keyboard::Scancode keycodeToScancode[MaxKeyCode]; ///< Mapping of X11 KeyCode to SFML scancode //////////////////////////////////////////////////////////// @@ -59,7 +59,7 @@ bool isValidKeycode(KeyCode keycode) sf::Keyboard::Scancode translateKeyCode(Display* display, KeyCode keycode) { if (!isValidKeycode(keycode)) - return sf::Keyboard::ScanUnknown; + return sf::Keyboard::Scan::Unknown; // Try secondary keysym, for numeric keypad keys // Note: This way we always force "NumLock = ON", which is intentional @@ -68,20 +68,20 @@ sf::Keyboard::Scancode translateKeyCode(Display* display, KeyCode keycode) switch (keySym) { - case XK_KP_0: return sf::Keyboard::ScanNumpad0; - case XK_KP_1: return sf::Keyboard::ScanNumpad1; - case XK_KP_2: return sf::Keyboard::ScanNumpad2; - case XK_KP_3: return sf::Keyboard::ScanNumpad3; - case XK_KP_4: return sf::Keyboard::ScanNumpad4; - case XK_KP_5: return sf::Keyboard::ScanNumpad5; - case XK_KP_6: return sf::Keyboard::ScanNumpad6; - case XK_KP_7: return sf::Keyboard::ScanNumpad7; - case XK_KP_8: return sf::Keyboard::ScanNumpad8; - case XK_KP_9: return sf::Keyboard::ScanNumpad9; - case XK_KP_Separator: return sf::Keyboard::ScanNumpadDecimal; - case XK_KP_Decimal: return sf::Keyboard::ScanNumpadDecimal; - case XK_KP_Equal: return sf::Keyboard::ScanNumpadEqual; - case XK_KP_Enter: return sf::Keyboard::ScanNumpadEnter; + case XK_KP_0: return sf::Keyboard::Scan::Numpad0; + case XK_KP_1: return sf::Keyboard::Scan::Numpad1; + case XK_KP_2: return sf::Keyboard::Scan::Numpad2; + case XK_KP_3: return sf::Keyboard::Scan::Numpad3; + case XK_KP_4: return sf::Keyboard::Scan::Numpad4; + case XK_KP_5: return sf::Keyboard::Scan::Numpad5; + case XK_KP_6: return sf::Keyboard::Scan::Numpad6; + case XK_KP_7: return sf::Keyboard::Scan::Numpad7; + case XK_KP_8: return sf::Keyboard::Scan::Numpad8; + case XK_KP_9: return sf::Keyboard::Scan::Numpad9; + case XK_KP_Separator: return sf::Keyboard::Scan::NumpadDecimal; + case XK_KP_Decimal: return sf::Keyboard::Scan::NumpadDecimal; + case XK_KP_Equal: return sf::Keyboard::Scan::NumpadEqual; + case XK_KP_Enter: return sf::Keyboard::Scan::NumpadEnter; default: break; } @@ -91,180 +91,180 @@ sf::Keyboard::Scancode translateKeyCode(Display* display, KeyCode keycode) switch (keySym) { - case XK_Return: return sf::Keyboard::ScanEnter; - case XK_Escape: return sf::Keyboard::ScanEscape; - case XK_BackSpace: return sf::Keyboard::ScanBackspace; - case XK_Tab: return sf::Keyboard::ScanTab; - case XK_Shift_L: return sf::Keyboard::ScanLShift; - case XK_Shift_R: return sf::Keyboard::ScanRShift; - case XK_Control_L: return sf::Keyboard::ScanLControl; - case XK_Control_R: return sf::Keyboard::ScanRControl; - case XK_Alt_L: return sf::Keyboard::ScanLAlt; + case XK_Return: return sf::Keyboard::Scan::Enter; + case XK_Escape: return sf::Keyboard::Scan::Escape; + case XK_BackSpace: return sf::Keyboard::Scan::Backspace; + case XK_Tab: return sf::Keyboard::Scan::Tab; + case XK_Shift_L: return sf::Keyboard::Scan::LShift; + case XK_Shift_R: return sf::Keyboard::Scan::RShift; + case XK_Control_L: return sf::Keyboard::Scan::LControl; + case XK_Control_R: return sf::Keyboard::Scan::RControl; + case XK_Alt_L: return sf::Keyboard::Scan::LAlt; case XK_ISO_Level3_Shift: // AltGr on at least some machines - case XK_Alt_R: return sf::Keyboard::ScanRAlt; + case XK_Alt_R: return sf::Keyboard::Scan::RAlt; case XK_Meta_L: - case XK_Super_L: return sf::Keyboard::ScanLSystem; + case XK_Super_L: return sf::Keyboard::Scan::LSystem; case XK_Meta_R: - case XK_Super_R: return sf::Keyboard::ScanRSystem; - case XK_Menu: return sf::Keyboard::ScanMenu; + case XK_Super_R: return sf::Keyboard::Scan::RSystem; + case XK_Menu: return sf::Keyboard::Scan::Menu; - case XK_Num_Lock: return sf::Keyboard::ScanNumLock; - case XK_Caps_Lock: return sf::Keyboard::ScanCapsLock; - case XK_Execute: return sf::Keyboard::ScanExecute; - case XK_Hyper_R: return sf::Keyboard::ScanApplication; - case XK_Select: return sf::Keyboard::ScanSelect; - case XK_Cancel: return sf::Keyboard::ScanStop; - case XK_Redo: return sf::Keyboard::ScanRedo; - case XK_Undo: return sf::Keyboard::ScanUndo; - case XK_Find: return sf::Keyboard::ScanSearch; - case XK_Mode_switch: return sf::Keyboard::ScanModeChange; + case XK_Num_Lock: return sf::Keyboard::Scan::NumLock; + case XK_Caps_Lock: return sf::Keyboard::Scan::CapsLock; + case XK_Execute: return sf::Keyboard::Scan::Execute; + case XK_Hyper_R: return sf::Keyboard::Scan::Application; + case XK_Select: return sf::Keyboard::Scan::Select; + case XK_Cancel: return sf::Keyboard::Scan::Stop; + case XK_Redo: return sf::Keyboard::Scan::Redo; + case XK_Undo: return sf::Keyboard::Scan::Undo; + case XK_Find: return sf::Keyboard::Scan::Search; + case XK_Mode_switch: return sf::Keyboard::Scan::ModeChange; - case XK_Print: return sf::Keyboard::ScanPrintScreen; - case XK_Scroll_Lock: return sf::Keyboard::ScanScrollLock; + case XK_Print: return sf::Keyboard::Scan::PrintScreen; + case XK_Scroll_Lock: return sf::Keyboard::Scan::ScrollLock; case XK_Pause: - case XK_Break: return sf::Keyboard::ScanPause; + case XK_Break: return sf::Keyboard::Scan::Pause; case XK_Delete: - case XK_Clear: return sf::Keyboard::ScanDelete; - case XK_Home: return sf::Keyboard::ScanHome; - case XK_End: return sf::Keyboard::ScanEnd; - case XK_Page_Up: return sf::Keyboard::ScanPageUp; - case XK_Page_Down: return sf::Keyboard::ScanPageDown; - case XK_Insert: return sf::Keyboard::ScanInsert; + case XK_Clear: return sf::Keyboard::Scan::Delete; + case XK_Home: return sf::Keyboard::Scan::Home; + case XK_End: return sf::Keyboard::Scan::End; + case XK_Page_Up: return sf::Keyboard::Scan::PageUp; + case XK_Page_Down: return sf::Keyboard::Scan::PageDown; + case XK_Insert: return sf::Keyboard::Scan::Insert; - case XK_Left: return sf::Keyboard::ScanLeft; - case XK_Right: return sf::Keyboard::ScanRight; - case XK_Down: return sf::Keyboard::ScanDown; - case XK_Up: return sf::Keyboard::ScanUp; + case XK_Left: return sf::Keyboard::Scan::Left; + case XK_Right: return sf::Keyboard::Scan::Right; + case XK_Down: return sf::Keyboard::Scan::Down; + case XK_Up: return sf::Keyboard::Scan::Up; - case XK_F1: return sf::Keyboard::ScanF1; - case XK_F2: return sf::Keyboard::ScanF2; - case XK_F3: return sf::Keyboard::ScanF3; - case XK_F4: return sf::Keyboard::ScanF4; - case XK_F5: return sf::Keyboard::ScanF5; - case XK_F6: return sf::Keyboard::ScanF6; - case XK_F7: return sf::Keyboard::ScanF7; - case XK_F8: return sf::Keyboard::ScanF8; - case XK_F9: return sf::Keyboard::ScanF9; - case XK_F10: return sf::Keyboard::ScanF10; - case XK_F11: return sf::Keyboard::ScanF11; - case XK_F12: return sf::Keyboard::ScanF12; - case XK_F13: return sf::Keyboard::ScanF13; - case XK_F14: return sf::Keyboard::ScanF14; - case XK_F15: return sf::Keyboard::ScanF15; - case XK_F16: return sf::Keyboard::ScanF16; - case XK_F17: return sf::Keyboard::ScanF17; - case XK_F18: return sf::Keyboard::ScanF18; - case XK_F19: return sf::Keyboard::ScanF19; - case XK_F20: return sf::Keyboard::ScanF20; - case XK_F21: return sf::Keyboard::ScanF21; - case XK_F22: return sf::Keyboard::ScanF22; - case XK_F23: return sf::Keyboard::ScanF23; - case XK_F24: return sf::Keyboard::ScanF24; + case XK_F1: return sf::Keyboard::Scan::F1; + case XK_F2: return sf::Keyboard::Scan::F2; + case XK_F3: return sf::Keyboard::Scan::F3; + case XK_F4: return sf::Keyboard::Scan::F4; + case XK_F5: return sf::Keyboard::Scan::F5; + case XK_F6: return sf::Keyboard::Scan::F6; + case XK_F7: return sf::Keyboard::Scan::F7; + case XK_F8: return sf::Keyboard::Scan::F8; + case XK_F9: return sf::Keyboard::Scan::F9; + case XK_F10: return sf::Keyboard::Scan::F10; + case XK_F11: return sf::Keyboard::Scan::F11; + case XK_F12: return sf::Keyboard::Scan::F12; + case XK_F13: return sf::Keyboard::Scan::F13; + case XK_F14: return sf::Keyboard::Scan::F14; + case XK_F15: return sf::Keyboard::Scan::F15; + case XK_F16: return sf::Keyboard::Scan::F16; + case XK_F17: return sf::Keyboard::Scan::F17; + case XK_F18: return sf::Keyboard::Scan::F18; + case XK_F19: return sf::Keyboard::Scan::F19; + case XK_F20: return sf::Keyboard::Scan::F20; + case XK_F21: return sf::Keyboard::Scan::F21; + case XK_F22: return sf::Keyboard::Scan::F22; + case XK_F23: return sf::Keyboard::Scan::F23; + case XK_F24: return sf::Keyboard::Scan::F24; // Numeric keypad - case XK_KP_Divide: return sf::Keyboard::ScanNumpadDivide; - case XK_KP_Multiply: return sf::Keyboard::ScanNumpadMultiply; - case XK_KP_Subtract: return sf::Keyboard::ScanNumpadMinus; - case XK_KP_Add: return sf::Keyboard::ScanNumpadPlus; + case XK_KP_Divide: return sf::Keyboard::Scan::NumpadDivide; + case XK_KP_Multiply: return sf::Keyboard::Scan::NumpadMultiply; + case XK_KP_Subtract: return sf::Keyboard::Scan::NumpadMinus; + case XK_KP_Add: return sf::Keyboard::Scan::NumpadPlus; // These should have been detected in secondary keysym test above! - case XK_KP_Insert: return sf::Keyboard::ScanNumpad0; - case XK_KP_End: return sf::Keyboard::ScanNumpad1; - case XK_KP_Down: return sf::Keyboard::ScanNumpad2; - case XK_KP_Page_Down: return sf::Keyboard::ScanNumpad3; - case XK_KP_Left: return sf::Keyboard::ScanNumpad4; - case XK_KP_Right: return sf::Keyboard::ScanNumpad6; - case XK_KP_Home: return sf::Keyboard::ScanNumpad7; - case XK_KP_Up: return sf::Keyboard::ScanNumpad8; - case XK_KP_Page_Up: return sf::Keyboard::ScanNumpad9; - case XK_KP_Delete: return sf::Keyboard::ScanNumpadDecimal; - case XK_KP_Equal: return sf::Keyboard::ScanNumpadEqual; - case XK_KP_Enter: return sf::Keyboard::ScanNumpadEnter; + case XK_KP_Insert: return sf::Keyboard::Scan::Numpad0; + case XK_KP_End: return sf::Keyboard::Scan::Numpad1; + case XK_KP_Down: return sf::Keyboard::Scan::Numpad2; + case XK_KP_Page_Down: return sf::Keyboard::Scan::Numpad3; + case XK_KP_Left: return sf::Keyboard::Scan::Numpad4; + case XK_KP_Right: return sf::Keyboard::Scan::Numpad6; + case XK_KP_Home: return sf::Keyboard::Scan::Numpad7; + case XK_KP_Up: return sf::Keyboard::Scan::Numpad8; + case XK_KP_Page_Up: return sf::Keyboard::Scan::Numpad9; + case XK_KP_Delete: return sf::Keyboard::Scan::NumpadDecimal; + case XK_KP_Equal: return sf::Keyboard::Scan::NumpadEqual; + case XK_KP_Enter: return sf::Keyboard::Scan::NumpadEnter; // Last resort: Check for printable keys (should not happen if the XKB // extension is available). This will give a layout dependent mapping // (which is wrong, and we may miss some keys, especially on non-US // keyboards), but it's better than nothing... case XK_a: - case XK_A: return sf::Keyboard::ScanA; + case XK_A: return sf::Keyboard::Scan::A; case XK_b: - case XK_B: return sf::Keyboard::ScanB; + case XK_B: return sf::Keyboard::Scan::B; case XK_c: - case XK_C: return sf::Keyboard::ScanC; + case XK_C: return sf::Keyboard::Scan::C; case XK_d: - case XK_D: return sf::Keyboard::ScanD; + case XK_D: return sf::Keyboard::Scan::D; case XK_e: - case XK_E: return sf::Keyboard::ScanE; + case XK_E: return sf::Keyboard::Scan::E; case XK_f: - case XK_F: return sf::Keyboard::ScanF; + case XK_F: return sf::Keyboard::Scan::F; case XK_g: - case XK_G: return sf::Keyboard::ScanG; + case XK_G: return sf::Keyboard::Scan::G; case XK_h: - case XK_H: return sf::Keyboard::ScanH; + case XK_H: return sf::Keyboard::Scan::H; case XK_i: - case XK_I: return sf::Keyboard::ScanI; + case XK_I: return sf::Keyboard::Scan::I; case XK_j: - case XK_J: return sf::Keyboard::ScanJ; + case XK_J: return sf::Keyboard::Scan::J; case XK_k: - case XK_K: return sf::Keyboard::ScanK; + case XK_K: return sf::Keyboard::Scan::K; case XK_l: - case XK_L: return sf::Keyboard::ScanL; + case XK_L: return sf::Keyboard::Scan::L; case XK_m: - case XK_M: return sf::Keyboard::ScanM; + case XK_M: return sf::Keyboard::Scan::M; case XK_n: - case XK_N: return sf::Keyboard::ScanN; + case XK_N: return sf::Keyboard::Scan::N; case XK_o: - case XK_O: return sf::Keyboard::ScanO; + case XK_O: return sf::Keyboard::Scan::O; case XK_p: - case XK_P: return sf::Keyboard::ScanP; + case XK_P: return sf::Keyboard::Scan::P; case XK_q: - case XK_Q: return sf::Keyboard::ScanQ; + case XK_Q: return sf::Keyboard::Scan::Q; case XK_r: - case XK_R: return sf::Keyboard::ScanR; + case XK_R: return sf::Keyboard::Scan::R; case XK_s: - case XK_S: return sf::Keyboard::ScanS; + case XK_S: return sf::Keyboard::Scan::S; case XK_t: - case XK_T: return sf::Keyboard::ScanT; + case XK_T: return sf::Keyboard::Scan::T; case XK_u: - case XK_U: return sf::Keyboard::ScanU; + case XK_U: return sf::Keyboard::Scan::U; case XK_v: - case XK_V: return sf::Keyboard::ScanV; + case XK_V: return sf::Keyboard::Scan::V; case XK_w: - case XK_W: return sf::Keyboard::ScanW; + case XK_W: return sf::Keyboard::Scan::W; case XK_x: - case XK_X: return sf::Keyboard::ScanX; + case XK_X: return sf::Keyboard::Scan::X; case XK_y: - case XK_Y: return sf::Keyboard::ScanY; + case XK_Y: return sf::Keyboard::Scan::Y; case XK_z: - case XK_Z: return sf::Keyboard::ScanZ; + case XK_Z: return sf::Keyboard::Scan::Z; - case XK_1: return sf::Keyboard::ScanNum1; - case XK_2: return sf::Keyboard::ScanNum2; - case XK_3: return sf::Keyboard::ScanNum3; - case XK_4: return sf::Keyboard::ScanNum4; - case XK_5: return sf::Keyboard::ScanNum5; - case XK_6: return sf::Keyboard::ScanNum6; - case XK_7: return sf::Keyboard::ScanNum7; - case XK_8: return sf::Keyboard::ScanNum8; - case XK_9: return sf::Keyboard::ScanNum9; - case XK_0: return sf::Keyboard::ScanNum0; + case XK_1: return sf::Keyboard::Scan::Num1; + case XK_2: return sf::Keyboard::Scan::Num2; + case XK_3: return sf::Keyboard::Scan::Num3; + case XK_4: return sf::Keyboard::Scan::Num4; + case XK_5: return sf::Keyboard::Scan::Num5; + case XK_6: return sf::Keyboard::Scan::Num6; + case XK_7: return sf::Keyboard::Scan::Num7; + case XK_8: return sf::Keyboard::Scan::Num8; + case XK_9: return sf::Keyboard::Scan::Num9; + case XK_0: return sf::Keyboard::Scan::Num0; - case XK_space: return sf::Keyboard::ScanSpace; - case XK_minus: return sf::Keyboard::ScanHyphen; - case XK_equal: return sf::Keyboard::ScanEqual; - case XK_bracketleft: return sf::Keyboard::ScanLBracket; - case XK_bracketright: return sf::Keyboard::ScanRBracket; - case XK_backslash: return sf::Keyboard::ScanBackslash; - case XK_semicolon: return sf::Keyboard::ScanSemicolon; - case XK_apostrophe: return sf::Keyboard::ScanApostrophe; - case XK_grave: return sf::Keyboard::ScanGrave; - case XK_comma: return sf::Keyboard::ScanComma; - case XK_period: return sf::Keyboard::ScanPeriod; - case XK_slash: return sf::Keyboard::ScanSlash; - case XK_less: return sf::Keyboard::ScanNonUsBackslash; + case XK_space: return sf::Keyboard::Scan::Space; + case XK_minus: return sf::Keyboard::Scan::Hyphen; + case XK_equal: return sf::Keyboard::Scan::Equal; + case XK_bracketleft: return sf::Keyboard::Scan::LBracket; + case XK_bracketright: return sf::Keyboard::Scan::RBracket; + case XK_backslash: return sf::Keyboard::Scan::Backslash; + case XK_semicolon: return sf::Keyboard::Scan::Semicolon; + case XK_apostrophe: return sf::Keyboard::Scan::Apostrophe; + case XK_grave: return sf::Keyboard::Scan::Grave; + case XK_comma: return sf::Keyboard::Scan::Comma; + case XK_period: return sf::Keyboard::Scan::Period; + case XK_slash: return sf::Keyboard::Scan::Slash; + case XK_less: return sf::Keyboard::Scan::NonUsBackslash; - default: return sf::Keyboard::ScanUnknown; + default: return sf::Keyboard::Scan::Unknown; } } @@ -273,172 +273,172 @@ std::map GetNameScancodeMap() { std::map mapping; - mapping.insert(std::make_pair("LSGT", sf::Keyboard::ScanNonUsBackslash)); + mapping.insert(std::make_pair("LSGT", sf::Keyboard::Scan::NonUsBackslash)); - mapping.insert(std::make_pair("TLDE", sf::Keyboard::ScanGrave)); - mapping.insert(std::make_pair("AE01", sf::Keyboard::ScanNum1)); - mapping.insert(std::make_pair("AE02", sf::Keyboard::ScanNum2)); - mapping.insert(std::make_pair("AE03", sf::Keyboard::ScanNum3)); - mapping.insert(std::make_pair("AE04", sf::Keyboard::ScanNum4)); - mapping.insert(std::make_pair("AE05", sf::Keyboard::ScanNum5)); - mapping.insert(std::make_pair("AE06", sf::Keyboard::ScanNum6)); - mapping.insert(std::make_pair("AE07", sf::Keyboard::ScanNum7)); - mapping.insert(std::make_pair("AE08", sf::Keyboard::ScanNum8)); - mapping.insert(std::make_pair("AE09", sf::Keyboard::ScanNum9)); - mapping.insert(std::make_pair("AE10", sf::Keyboard::ScanNum0)); - mapping.insert(std::make_pair("AE11", sf::Keyboard::ScanHyphen)); - mapping.insert(std::make_pair("AE12", sf::Keyboard::ScanEqual)); - mapping.insert(std::make_pair("BKSP", sf::Keyboard::ScanBackspace)); - mapping.insert(std::make_pair("TAB", sf::Keyboard::ScanTab)); - mapping.insert(std::make_pair("AD01", sf::Keyboard::ScanQ)); - mapping.insert(std::make_pair("AD02", sf::Keyboard::ScanW)); - mapping.insert(std::make_pair("AD03", sf::Keyboard::ScanE)); - mapping.insert(std::make_pair("AD04", sf::Keyboard::ScanR)); - mapping.insert(std::make_pair("AD05", sf::Keyboard::ScanT)); - mapping.insert(std::make_pair("AD06", sf::Keyboard::ScanY)); - mapping.insert(std::make_pair("AD07", sf::Keyboard::ScanU)); - mapping.insert(std::make_pair("AD08", sf::Keyboard::ScanI)); - mapping.insert(std::make_pair("AD09", sf::Keyboard::ScanO)); - mapping.insert(std::make_pair("AD10", sf::Keyboard::ScanP)); - mapping.insert(std::make_pair("AD11", sf::Keyboard::ScanLBracket)); - mapping.insert(std::make_pair("AD12", sf::Keyboard::ScanRBracket)); - mapping.insert(std::make_pair("BKSL", sf::Keyboard::ScanBackslash)); - mapping.insert(std::make_pair("RTRN", sf::Keyboard::ScanEnter)); + mapping.insert(std::make_pair("TLDE", sf::Keyboard::Scan::Grave)); + mapping.insert(std::make_pair("AE01", sf::Keyboard::Scan::Num1)); + mapping.insert(std::make_pair("AE02", sf::Keyboard::Scan::Num2)); + mapping.insert(std::make_pair("AE03", sf::Keyboard::Scan::Num3)); + mapping.insert(std::make_pair("AE04", sf::Keyboard::Scan::Num4)); + mapping.insert(std::make_pair("AE05", sf::Keyboard::Scan::Num5)); + mapping.insert(std::make_pair("AE06", sf::Keyboard::Scan::Num6)); + mapping.insert(std::make_pair("AE07", sf::Keyboard::Scan::Num7)); + mapping.insert(std::make_pair("AE08", sf::Keyboard::Scan::Num8)); + mapping.insert(std::make_pair("AE09", sf::Keyboard::Scan::Num9)); + mapping.insert(std::make_pair("AE10", sf::Keyboard::Scan::Num0)); + mapping.insert(std::make_pair("AE11", sf::Keyboard::Scan::Hyphen)); + mapping.insert(std::make_pair("AE12", sf::Keyboard::Scan::Equal)); + mapping.insert(std::make_pair("BKSP", sf::Keyboard::Scan::Backspace)); + mapping.insert(std::make_pair("TAB", sf::Keyboard::Scan::Tab)); + mapping.insert(std::make_pair("AD01", sf::Keyboard::Scan::Q)); + mapping.insert(std::make_pair("AD02", sf::Keyboard::Scan::W)); + mapping.insert(std::make_pair("AD03", sf::Keyboard::Scan::E)); + mapping.insert(std::make_pair("AD04", sf::Keyboard::Scan::R)); + mapping.insert(std::make_pair("AD05", sf::Keyboard::Scan::T)); + mapping.insert(std::make_pair("AD06", sf::Keyboard::Scan::Y)); + mapping.insert(std::make_pair("AD07", sf::Keyboard::Scan::U)); + mapping.insert(std::make_pair("AD08", sf::Keyboard::Scan::I)); + mapping.insert(std::make_pair("AD09", sf::Keyboard::Scan::O)); + mapping.insert(std::make_pair("AD10", sf::Keyboard::Scan::P)); + mapping.insert(std::make_pair("AD11", sf::Keyboard::Scan::LBracket)); + mapping.insert(std::make_pair("AD12", sf::Keyboard::Scan::RBracket)); + mapping.insert(std::make_pair("BKSL", sf::Keyboard::Scan::Backslash)); + mapping.insert(std::make_pair("RTRN", sf::Keyboard::Scan::Enter)); - mapping.insert(std::make_pair("CAPS", sf::Keyboard::ScanCapsLock)); - mapping.insert(std::make_pair("AC01", sf::Keyboard::ScanA)); - mapping.insert(std::make_pair("AC02", sf::Keyboard::ScanS)); - mapping.insert(std::make_pair("AC03", sf::Keyboard::ScanD)); - mapping.insert(std::make_pair("AC04", sf::Keyboard::ScanF)); - mapping.insert(std::make_pair("AC05", sf::Keyboard::ScanG)); - mapping.insert(std::make_pair("AC06", sf::Keyboard::ScanH)); - mapping.insert(std::make_pair("AC07", sf::Keyboard::ScanJ)); - mapping.insert(std::make_pair("AC08", sf::Keyboard::ScanK)); - mapping.insert(std::make_pair("AC09", sf::Keyboard::ScanL)); - mapping.insert(std::make_pair("AC10", sf::Keyboard::ScanSemicolon)); - mapping.insert(std::make_pair("AC11", sf::Keyboard::ScanApostrophe)); - mapping.insert(std::make_pair("AC12", sf::Keyboard::ScanBackslash)); + mapping.insert(std::make_pair("CAPS", sf::Keyboard::Scan::CapsLock)); + mapping.insert(std::make_pair("AC01", sf::Keyboard::Scan::A)); + mapping.insert(std::make_pair("AC02", sf::Keyboard::Scan::S)); + mapping.insert(std::make_pair("AC03", sf::Keyboard::Scan::D)); + mapping.insert(std::make_pair("AC04", sf::Keyboard::Scan::F)); + mapping.insert(std::make_pair("AC05", sf::Keyboard::Scan::G)); + mapping.insert(std::make_pair("AC06", sf::Keyboard::Scan::H)); + mapping.insert(std::make_pair("AC07", sf::Keyboard::Scan::J)); + mapping.insert(std::make_pair("AC08", sf::Keyboard::Scan::K)); + mapping.insert(std::make_pair("AC09", sf::Keyboard::Scan::L)); + mapping.insert(std::make_pair("AC10", sf::Keyboard::Scan::Semicolon)); + mapping.insert(std::make_pair("AC11", sf::Keyboard::Scan::Apostrophe)); + mapping.insert(std::make_pair("AC12", sf::Keyboard::Scan::Backslash)); - mapping.insert(std::make_pair("LFSH", sf::Keyboard::ScanLShift)); - mapping.insert(std::make_pair("AB01", sf::Keyboard::ScanZ)); - mapping.insert(std::make_pair("AB02", sf::Keyboard::ScanX)); - mapping.insert(std::make_pair("AB03", sf::Keyboard::ScanC)); - mapping.insert(std::make_pair("AB04", sf::Keyboard::ScanV)); - mapping.insert(std::make_pair("AB05", sf::Keyboard::ScanB)); - mapping.insert(std::make_pair("AB06", sf::Keyboard::ScanN)); - mapping.insert(std::make_pair("AB07", sf::Keyboard::ScanM)); - mapping.insert(std::make_pair("AB08", sf::Keyboard::ScanComma)); - mapping.insert(std::make_pair("AB09", sf::Keyboard::ScanPeriod)); - mapping.insert(std::make_pair("AB10", sf::Keyboard::ScanSlash)); - mapping.insert(std::make_pair("RTSH", sf::Keyboard::ScanRShift)); + mapping.insert(std::make_pair("LFSH", sf::Keyboard::Scan::LShift)); + mapping.insert(std::make_pair("AB01", sf::Keyboard::Scan::Z)); + mapping.insert(std::make_pair("AB02", sf::Keyboard::Scan::X)); + mapping.insert(std::make_pair("AB03", sf::Keyboard::Scan::C)); + mapping.insert(std::make_pair("AB04", sf::Keyboard::Scan::V)); + mapping.insert(std::make_pair("AB05", sf::Keyboard::Scan::B)); + mapping.insert(std::make_pair("AB06", sf::Keyboard::Scan::N)); + mapping.insert(std::make_pair("AB07", sf::Keyboard::Scan::M)); + mapping.insert(std::make_pair("AB08", sf::Keyboard::Scan::Comma)); + mapping.insert(std::make_pair("AB09", sf::Keyboard::Scan::Period)); + mapping.insert(std::make_pair("AB10", sf::Keyboard::Scan::Slash)); + mapping.insert(std::make_pair("RTSH", sf::Keyboard::Scan::RShift)); - mapping.insert(std::make_pair("LCTL", sf::Keyboard::ScanLControl)); - mapping.insert(std::make_pair("LALT", sf::Keyboard::ScanLAlt)); - mapping.insert(std::make_pair("SPCE", sf::Keyboard::ScanSpace)); - mapping.insert(std::make_pair("RCTL", sf::Keyboard::ScanRControl)); - mapping.insert(std::make_pair("RALT", sf::Keyboard::ScanRAlt)); - mapping.insert(std::make_pair("LVL3", sf::Keyboard::ScanRAlt)); - mapping.insert(std::make_pair("ALGR", sf::Keyboard::ScanRAlt)); - mapping.insert(std::make_pair("LWIN", sf::Keyboard::ScanLSystem)); - mapping.insert(std::make_pair("RWIN", sf::Keyboard::ScanRSystem)); + mapping.insert(std::make_pair("LCTL", sf::Keyboard::Scan::LControl)); + mapping.insert(std::make_pair("LALT", sf::Keyboard::Scan::LAlt)); + mapping.insert(std::make_pair("SPCE", sf::Keyboard::Scan::Space)); + mapping.insert(std::make_pair("RCTL", sf::Keyboard::Scan::RControl)); + mapping.insert(std::make_pair("RALT", sf::Keyboard::Scan::RAlt)); + mapping.insert(std::make_pair("LVL3", sf::Keyboard::Scan::RAlt)); + mapping.insert(std::make_pair("ALGR", sf::Keyboard::Scan::RAlt)); + mapping.insert(std::make_pair("LWIN", sf::Keyboard::Scan::LSystem)); + mapping.insert(std::make_pair("RWIN", sf::Keyboard::Scan::RSystem)); - mapping.insert(std::make_pair("HYPR", sf::Keyboard::ScanApplication)); - mapping.insert(std::make_pair("EXEC", sf::Keyboard::ScanExecute)); - mapping.insert(std::make_pair("MDSW", sf::Keyboard::ScanModeChange)); - mapping.insert(std::make_pair("MENU", sf::Keyboard::ScanMenu)); - mapping.insert(std::make_pair("COMP", sf::Keyboard::ScanMenu)); - mapping.insert(std::make_pair("SELE", sf::Keyboard::ScanSelect)); + mapping.insert(std::make_pair("HYPR", sf::Keyboard::Scan::Application)); + mapping.insert(std::make_pair("EXEC", sf::Keyboard::Scan::Execute)); + mapping.insert(std::make_pair("MDSW", sf::Keyboard::Scan::ModeChange)); + mapping.insert(std::make_pair("MENU", sf::Keyboard::Scan::Menu)); + mapping.insert(std::make_pair("COMP", sf::Keyboard::Scan::Menu)); + mapping.insert(std::make_pair("SELE", sf::Keyboard::Scan::Select)); - mapping.insert(std::make_pair("ESC", sf::Keyboard::ScanEscape)); - mapping.insert(std::make_pair("FK01", sf::Keyboard::ScanF1)); - mapping.insert(std::make_pair("FK02", sf::Keyboard::ScanF2)); - mapping.insert(std::make_pair("FK03", sf::Keyboard::ScanF3)); - mapping.insert(std::make_pair("FK04", sf::Keyboard::ScanF4)); - mapping.insert(std::make_pair("FK05", sf::Keyboard::ScanF5)); - mapping.insert(std::make_pair("FK06", sf::Keyboard::ScanF6)); - mapping.insert(std::make_pair("FK07", sf::Keyboard::ScanF7)); - mapping.insert(std::make_pair("FK08", sf::Keyboard::ScanF8)); - mapping.insert(std::make_pair("FK09", sf::Keyboard::ScanF9)); - mapping.insert(std::make_pair("FK10", sf::Keyboard::ScanF10)); - mapping.insert(std::make_pair("FK11", sf::Keyboard::ScanF11)); - mapping.insert(std::make_pair("FK12", sf::Keyboard::ScanF12)); + mapping.insert(std::make_pair("ESC", sf::Keyboard::Scan::Escape)); + mapping.insert(std::make_pair("FK01", sf::Keyboard::Scan::F1)); + mapping.insert(std::make_pair("FK02", sf::Keyboard::Scan::F2)); + mapping.insert(std::make_pair("FK03", sf::Keyboard::Scan::F3)); + mapping.insert(std::make_pair("FK04", sf::Keyboard::Scan::F4)); + mapping.insert(std::make_pair("FK05", sf::Keyboard::Scan::F5)); + mapping.insert(std::make_pair("FK06", sf::Keyboard::Scan::F6)); + mapping.insert(std::make_pair("FK07", sf::Keyboard::Scan::F7)); + mapping.insert(std::make_pair("FK08", sf::Keyboard::Scan::F8)); + mapping.insert(std::make_pair("FK09", sf::Keyboard::Scan::F9)); + mapping.insert(std::make_pair("FK10", sf::Keyboard::Scan::F10)); + mapping.insert(std::make_pair("FK11", sf::Keyboard::Scan::F11)); + mapping.insert(std::make_pair("FK12", sf::Keyboard::Scan::F12)); - mapping.insert(std::make_pair("PRSC", sf::Keyboard::ScanPrintScreen)); - mapping.insert(std::make_pair("SCLK", sf::Keyboard::ScanScrollLock)); - mapping.insert(std::make_pair("PAUS", sf::Keyboard::ScanPause)); + mapping.insert(std::make_pair("PRSC", sf::Keyboard::Scan::PrintScreen)); + mapping.insert(std::make_pair("SCLK", sf::Keyboard::Scan::ScrollLock)); + mapping.insert(std::make_pair("PAUS", sf::Keyboard::Scan::Pause)); - mapping.insert(std::make_pair("INS", sf::Keyboard::ScanInsert)); - mapping.insert(std::make_pair("HOME", sf::Keyboard::ScanHome)); - mapping.insert(std::make_pair("PGUP", sf::Keyboard::ScanPageUp)); - mapping.insert(std::make_pair("DELE", sf::Keyboard::ScanDelete)); - mapping.insert(std::make_pair("END", sf::Keyboard::ScanEnd)); - mapping.insert(std::make_pair("PGDN", sf::Keyboard::ScanPageDown)); + mapping.insert(std::make_pair("INS", sf::Keyboard::Scan::Insert)); + mapping.insert(std::make_pair("HOME", sf::Keyboard::Scan::Home)); + mapping.insert(std::make_pair("PGUP", sf::Keyboard::Scan::PageUp)); + mapping.insert(std::make_pair("DELE", sf::Keyboard::Scan::Delete)); + mapping.insert(std::make_pair("END", sf::Keyboard::Scan::End)); + mapping.insert(std::make_pair("PGDN", sf::Keyboard::Scan::PageDown)); - mapping.insert(std::make_pair("UP", sf::Keyboard::ScanUp)); - mapping.insert(std::make_pair("RGHT", sf::Keyboard::ScanRight)); - mapping.insert(std::make_pair("DOWN", sf::Keyboard::ScanDown)); - mapping.insert(std::make_pair("LEFT", sf::Keyboard::ScanLeft)); + mapping.insert(std::make_pair("UP", sf::Keyboard::Scan::Up)); + mapping.insert(std::make_pair("RGHT", sf::Keyboard::Scan::Right)); + mapping.insert(std::make_pair("DOWN", sf::Keyboard::Scan::Down)); + mapping.insert(std::make_pair("LEFT", sf::Keyboard::Scan::Left)); - mapping.insert(std::make_pair("NMLK", sf::Keyboard::ScanNumLock)); - mapping.insert(std::make_pair("KPDV", sf::Keyboard::ScanNumpadDivide)); - mapping.insert(std::make_pair("KPMU", sf::Keyboard::ScanNumpadMultiply)); - mapping.insert(std::make_pair("KPSU", sf::Keyboard::ScanNumpadMinus)); + mapping.insert(std::make_pair("NMLK", sf::Keyboard::Scan::NumLock)); + mapping.insert(std::make_pair("KPDV", sf::Keyboard::Scan::NumpadDivide)); + mapping.insert(std::make_pair("KPMU", sf::Keyboard::Scan::NumpadMultiply)); + mapping.insert(std::make_pair("KPSU", sf::Keyboard::Scan::NumpadMinus)); - mapping.insert(std::make_pair("KP7", sf::Keyboard::ScanNumpad7)); - mapping.insert(std::make_pair("KP8", sf::Keyboard::ScanNumpad8)); - mapping.insert(std::make_pair("KP9", sf::Keyboard::ScanNumpad9)); - mapping.insert(std::make_pair("KPAD", sf::Keyboard::ScanNumpadPlus)); - mapping.insert(std::make_pair("KP4", sf::Keyboard::ScanNumpad4)); - mapping.insert(std::make_pair("KP5", sf::Keyboard::ScanNumpad5)); - mapping.insert(std::make_pair("KP6", sf::Keyboard::ScanNumpad6)); - mapping.insert(std::make_pair("KP1", sf::Keyboard::ScanNumpad1)); - mapping.insert(std::make_pair("KP2", sf::Keyboard::ScanNumpad2)); - mapping.insert(std::make_pair("KP3", sf::Keyboard::ScanNumpad3)); - mapping.insert(std::make_pair("KPEN", sf::Keyboard::ScanNumpadEnter)); - mapping.insert(std::make_pair("KP0", sf::Keyboard::ScanNumpad0)); - mapping.insert(std::make_pair("KPDL", sf::Keyboard::ScanNumpadDecimal)); - mapping.insert(std::make_pair("KPEQ", sf::Keyboard::ScanNumpadEqual)); + mapping.insert(std::make_pair("KP7", sf::Keyboard::Scan::Numpad7)); + mapping.insert(std::make_pair("KP8", sf::Keyboard::Scan::Numpad8)); + mapping.insert(std::make_pair("KP9", sf::Keyboard::Scan::Numpad9)); + mapping.insert(std::make_pair("KPAD", sf::Keyboard::Scan::NumpadPlus)); + mapping.insert(std::make_pair("KP4", sf::Keyboard::Scan::Numpad4)); + mapping.insert(std::make_pair("KP5", sf::Keyboard::Scan::Numpad5)); + mapping.insert(std::make_pair("KP6", sf::Keyboard::Scan::Numpad6)); + mapping.insert(std::make_pair("KP1", sf::Keyboard::Scan::Numpad1)); + mapping.insert(std::make_pair("KP2", sf::Keyboard::Scan::Numpad2)); + mapping.insert(std::make_pair("KP3", sf::Keyboard::Scan::Numpad3)); + mapping.insert(std::make_pair("KPEN", sf::Keyboard::Scan::NumpadEnter)); + mapping.insert(std::make_pair("KP0", sf::Keyboard::Scan::Numpad0)); + mapping.insert(std::make_pair("KPDL", sf::Keyboard::Scan::NumpadDecimal)); + mapping.insert(std::make_pair("KPEQ", sf::Keyboard::Scan::NumpadEqual)); - mapping.insert(std::make_pair("FK13", sf::Keyboard::ScanF13)); - mapping.insert(std::make_pair("FK14", sf::Keyboard::ScanF14)); - mapping.insert(std::make_pair("FK15", sf::Keyboard::ScanF15)); - mapping.insert(std::make_pair("FK16", sf::Keyboard::ScanF16)); - mapping.insert(std::make_pair("FK17", sf::Keyboard::ScanF17)); - mapping.insert(std::make_pair("FK18", sf::Keyboard::ScanF18)); - mapping.insert(std::make_pair("FK19", sf::Keyboard::ScanF19)); - mapping.insert(std::make_pair("FK20", sf::Keyboard::ScanF20)); - mapping.insert(std::make_pair("FK21", sf::Keyboard::ScanF21)); - mapping.insert(std::make_pair("FK22", sf::Keyboard::ScanF22)); - mapping.insert(std::make_pair("FK23", sf::Keyboard::ScanF23)); - mapping.insert(std::make_pair("FK24", sf::Keyboard::ScanF24)); - mapping.insert(std::make_pair("LMTA", sf::Keyboard::ScanLSystem)); - mapping.insert(std::make_pair("RMTA", sf::Keyboard::ScanRSystem)); - mapping.insert(std::make_pair("MUTE", sf::Keyboard::ScanVolumeMute)); - mapping.insert(std::make_pair("VOL-", sf::Keyboard::ScanVolumeDown)); - mapping.insert(std::make_pair("VOL+", sf::Keyboard::ScanVolumeUp)); - mapping.insert(std::make_pair("STOP", sf::Keyboard::ScanStop)); - mapping.insert(std::make_pair("REDO", sf::Keyboard::ScanRedo)); - mapping.insert(std::make_pair("AGAI", sf::Keyboard::ScanRedo)); - mapping.insert(std::make_pair("UNDO", sf::Keyboard::ScanUndo)); - mapping.insert(std::make_pair("COPY", sf::Keyboard::ScanCopy)); - mapping.insert(std::make_pair("PAST", sf::Keyboard::ScanPaste)); - mapping.insert(std::make_pair("FIND", sf::Keyboard::ScanSearch)); - mapping.insert(std::make_pair("CUT", sf::Keyboard::ScanCut)); - mapping.insert(std::make_pair("HELP", sf::Keyboard::ScanHelp)); + mapping.insert(std::make_pair("FK13", sf::Keyboard::Scan::F13)); + mapping.insert(std::make_pair("FK14", sf::Keyboard::Scan::F14)); + mapping.insert(std::make_pair("FK15", sf::Keyboard::Scan::F15)); + mapping.insert(std::make_pair("FK16", sf::Keyboard::Scan::F16)); + mapping.insert(std::make_pair("FK17", sf::Keyboard::Scan::F17)); + mapping.insert(std::make_pair("FK18", sf::Keyboard::Scan::F18)); + mapping.insert(std::make_pair("FK19", sf::Keyboard::Scan::F19)); + mapping.insert(std::make_pair("FK20", sf::Keyboard::Scan::F20)); + mapping.insert(std::make_pair("FK21", sf::Keyboard::Scan::F21)); + mapping.insert(std::make_pair("FK22", sf::Keyboard::Scan::F22)); + mapping.insert(std::make_pair("FK23", sf::Keyboard::Scan::F23)); + mapping.insert(std::make_pair("FK24", sf::Keyboard::Scan::F24)); + mapping.insert(std::make_pair("LMTA", sf::Keyboard::Scan::LSystem)); + mapping.insert(std::make_pair("RMTA", sf::Keyboard::Scan::RSystem)); + mapping.insert(std::make_pair("MUTE", sf::Keyboard::Scan::VolumeMute)); + mapping.insert(std::make_pair("VOL-", sf::Keyboard::Scan::VolumeDown)); + mapping.insert(std::make_pair("VOL+", sf::Keyboard::Scan::VolumeUp)); + mapping.insert(std::make_pair("STOP", sf::Keyboard::Scan::Stop)); + mapping.insert(std::make_pair("REDO", sf::Keyboard::Scan::Redo)); + mapping.insert(std::make_pair("AGAI", sf::Keyboard::Scan::Redo)); + mapping.insert(std::make_pair("UNDO", sf::Keyboard::Scan::Undo)); + mapping.insert(std::make_pair("COPY", sf::Keyboard::Scan::Copy)); + mapping.insert(std::make_pair("PAST", sf::Keyboard::Scan::Paste)); + mapping.insert(std::make_pair("FIND", sf::Keyboard::Scan::Search)); + mapping.insert(std::make_pair("CUT", sf::Keyboard::Scan::Cut)); + mapping.insert(std::make_pair("HELP", sf::Keyboard::Scan::Help)); - mapping.insert(std::make_pair("I156", sf::Keyboard::ScanLaunchApplication1)); - mapping.insert(std::make_pair("I157", sf::Keyboard::ScanLaunchApplication2)); - mapping.insert(std::make_pair("I164", sf::Keyboard::ScanFavorites)); - mapping.insert(std::make_pair("I166", sf::Keyboard::ScanBack)); - mapping.insert(std::make_pair("I167", sf::Keyboard::ScanForward)); - mapping.insert(std::make_pair("I171", sf::Keyboard::ScanMediaNextTrack)); - mapping.insert(std::make_pair("I172", sf::Keyboard::ScanMediaPlayPause)); - mapping.insert(std::make_pair("I173", sf::Keyboard::ScanMediaPreviousTrack)); - mapping.insert(std::make_pair("I174", sf::Keyboard::ScanMediaStop)); - mapping.insert(std::make_pair("I180", sf::Keyboard::ScanHomePage)); - mapping.insert(std::make_pair("I181", sf::Keyboard::ScanRefresh)); - mapping.insert(std::make_pair("I223", sf::Keyboard::ScanLaunchMail)); - mapping.insert(std::make_pair("I234", sf::Keyboard::ScanLaunchMediaSelect)); + mapping.insert(std::make_pair("I156", sf::Keyboard::Scan::LaunchApplication1)); + mapping.insert(std::make_pair("I157", sf::Keyboard::Scan::LaunchApplication2)); + mapping.insert(std::make_pair("I164", sf::Keyboard::Scan::Favorites)); + mapping.insert(std::make_pair("I166", sf::Keyboard::Scan::Back)); + mapping.insert(std::make_pair("I167", sf::Keyboard::Scan::Forward)); + mapping.insert(std::make_pair("I171", sf::Keyboard::Scan::MediaNextTrack)); + mapping.insert(std::make_pair("I172", sf::Keyboard::Scan::MediaPlayPause)); + mapping.insert(std::make_pair("I173", sf::Keyboard::Scan::MediaPreviousTrack)); + mapping.insert(std::make_pair("I174", sf::Keyboard::Scan::MediaStop)); + mapping.insert(std::make_pair("I180", sf::Keyboard::Scan::HomePage)); + mapping.insert(std::make_pair("I181", sf::Keyboard::Scan::Refresh)); + mapping.insert(std::make_pair("I223", sf::Keyboard::Scan::LaunchMail)); + mapping.insert(std::make_pair("I234", sf::Keyboard::Scan::LaunchMediaSelect)); return mapping; } @@ -452,11 +452,11 @@ void ensureMapping() return; // Phase 1: Initialize mappings with default values - for (int i = 0; i < sf::Keyboard::ScancodeCount; ++i) + for (int i = 0; i < sf::Keyboard::Scan::ScancodeCount; ++i) scancodeToKeycode[i] = NullKeyCode; for (int i = 0; i < MaxKeyCode; ++i) - keycodeToScancode[i] = sf::Keyboard::ScanUnknown; + keycodeToScancode[i] = sf::Keyboard::Scan::Unknown; // Phase 2: Get XKB names with key code Display* display = sf::priv::OpenDisplay(); @@ -466,7 +466,7 @@ void ensureMapping() XkbGetNames(display, XkbKeyNamesMask, descriptor); std::map nameScancodeMap = GetNameScancodeMap(); - sf::Keyboard::Scancode scancode = sf::Keyboard::ScanUnknown; + sf::Keyboard::Scancode scancode = sf::Keyboard::Scan::Unknown; for (int keycode = descriptor->min_key_code; keycode <= descriptor->max_key_code; ++keycode) { @@ -479,12 +479,12 @@ void ensureMapping() name[XkbKeyNameLength] = '\0'; std::map::iterator mappedScancode = nameScancodeMap.find(std::string(name)); - scancode = sf::Keyboard::ScanUnknown; + scancode = sf::Keyboard::Scan::Unknown; if (mappedScancode != nameScancodeMap.end()) scancode = mappedScancode->second; - if (scancode != sf::Keyboard::ScanUnknown) + if (scancode != sf::Keyboard::Scan::Unknown) scancodeToKeycode[scancode] = static_cast(keycode); keycodeToScancode[keycode] = scancode; @@ -496,7 +496,7 @@ void ensureMapping() // Phase 3: Translate un-translated keycodes using traditional X11 KeySym lookups for (int keycode = 8; keycode < MaxKeyCode; ++keycode) { - if (keycodeToScancode[static_cast(keycode)] == sf::Keyboard::ScanUnknown) + if (keycodeToScancode[static_cast(keycode)] == sf::Keyboard::Scan::Unknown) { scancode = translateKeyCode(display, static_cast(keycode)); @@ -518,7 +518,7 @@ KeyCode scancodeToKeyCode(sf::Keyboard::Scancode code) { ensureMapping(); - if (code != sf::Keyboard::ScanUnknown) + if (code != sf::Keyboard::Scan::Unknown) return scancodeToKeycode[code]; return NullKeyCode; @@ -533,7 +533,7 @@ sf::Keyboard::Scancode keyCodeToScancode(KeyCode code) if (isValidKeycode(code)) return keycodeToScancode[code]; - return sf::Keyboard::ScanUnknown; + return sf::Keyboard::Scan::Unknown; } @@ -643,21 +643,21 @@ String KeyboardImpl::getDescription(Keyboard::Scancode code) // these scancodes actually correspond to keys with input // but we want to return their description, not their behaviour - if (code == Keyboard::ScanEnter || - code == Keyboard::ScanEscape || - code == Keyboard::ScanBackspace || - code == Keyboard::ScanTab || - code == Keyboard::ScanSpace || - code == Keyboard::ScanScrollLock || - code == Keyboard::ScanPause || - code == Keyboard::ScanDelete || - code == Keyboard::ScanNumpadDivide || - code == Keyboard::ScanNumpadMultiply || - code == Keyboard::ScanNumpadMinus || - code == Keyboard::ScanNumpadPlus || - code == Keyboard::ScanNumpadEqual || - code == Keyboard::ScanNumpadEnter || - code == Keyboard::ScanNumpadDecimal) + if (code == Keyboard::Scan::Enter || + code == Keyboard::Scan::Escape || + code == Keyboard::Scan::Backspace || + code == Keyboard::Scan::Tab || + code == Keyboard::Scan::Space || + code == Keyboard::Scan::ScrollLock || + code == Keyboard::Scan::Pause || + code == Keyboard::Scan::Delete || + code == Keyboard::Scan::NumpadDivide || + code == Keyboard::Scan::NumpadMultiply || + code == Keyboard::Scan::NumpadMinus || + code == Keyboard::Scan::NumpadPlus || + code == Keyboard::Scan::NumpadEqual || + code == Keyboard::Scan::NumpadEnter || + code == Keyboard::Scan::NumpadDecimal) { checkInput = false; } @@ -674,113 +674,113 @@ String KeyboardImpl::getDescription(Keyboard::Scancode code) // Fallback to our best guess for the keys that are known to be independent of the layout. switch (code) { - case Keyboard::ScanEnter: return "Enter"; - case Keyboard::ScanEscape: return "Escape"; - case Keyboard::ScanBackspace: return "Backspace"; - case Keyboard::ScanTab: return "Tab"; - case Keyboard::ScanSpace: return "Space"; + case Keyboard::Scan::Enter: return "Enter"; + case Keyboard::Scan::Escape: return "Escape"; + case Keyboard::Scan::Backspace: return "Backspace"; + case Keyboard::Scan::Tab: return "Tab"; + case Keyboard::Scan::Space: return "Space"; - case Keyboard::ScanF1: return "F1"; - case Keyboard::ScanF2: return "F2"; - case Keyboard::ScanF3: return "F3"; - case Keyboard::ScanF4: return "F4"; - case Keyboard::ScanF5: return "F5"; - case Keyboard::ScanF6: return "F6"; - case Keyboard::ScanF7: return "F7"; - case Keyboard::ScanF8: return "F8"; - case Keyboard::ScanF9: return "F9"; - case Keyboard::ScanF10: return "F10"; - case Keyboard::ScanF11: return "F11"; - case Keyboard::ScanF12: return "F12"; - case Keyboard::ScanF13: return "F13"; - case Keyboard::ScanF14: return "F14"; - case Keyboard::ScanF15: return "F15"; - case Keyboard::ScanF16: return "F16"; - case Keyboard::ScanF17: return "F17"; - case Keyboard::ScanF18: return "F18"; - case Keyboard::ScanF19: return "F19"; - case Keyboard::ScanF20: return "F20"; - case Keyboard::ScanF21: return "F21"; - case Keyboard::ScanF22: return "F22"; - case Keyboard::ScanF23: return "F23"; - case Keyboard::ScanF24: return "F24"; + case Keyboard::Scan::F1: return "F1"; + case Keyboard::Scan::F2: return "F2"; + case Keyboard::Scan::F3: return "F3"; + case Keyboard::Scan::F4: return "F4"; + case Keyboard::Scan::F5: return "F5"; + case Keyboard::Scan::F6: return "F6"; + case Keyboard::Scan::F7: return "F7"; + case Keyboard::Scan::F8: return "F8"; + case Keyboard::Scan::F9: return "F9"; + case Keyboard::Scan::F10: return "F10"; + case Keyboard::Scan::F11: return "F11"; + case Keyboard::Scan::F12: return "F12"; + case Keyboard::Scan::F13: return "F13"; + case Keyboard::Scan::F14: return "F14"; + case Keyboard::Scan::F15: return "F15"; + case Keyboard::Scan::F16: return "F16"; + case Keyboard::Scan::F17: return "F17"; + case Keyboard::Scan::F18: return "F18"; + case Keyboard::Scan::F19: return "F19"; + case Keyboard::Scan::F20: return "F20"; + case Keyboard::Scan::F21: return "F21"; + case Keyboard::Scan::F22: return "F22"; + case Keyboard::Scan::F23: return "F23"; + case Keyboard::Scan::F24: return "F24"; - case Keyboard::ScanCapsLock: return "Caps Lock"; - case Keyboard::ScanPrintScreen: return "Print Screen"; - case Keyboard::ScanScrollLock: return "Scroll Lock"; + case Keyboard::Scan::CapsLock: return "Caps Lock"; + case Keyboard::Scan::PrintScreen: return "Print Screen"; + case Keyboard::Scan::ScrollLock: return "Scroll Lock"; - case Keyboard::ScanPause: return "Pause"; - case Keyboard::ScanInsert: return "Insert"; - case Keyboard::ScanHome: return "Home"; - case Keyboard::ScanPageUp: return "Page Up"; - case Keyboard::ScanDelete: return "Delete"; - case Keyboard::ScanEnd: return "End"; - case Keyboard::ScanPageDown: return "Page Down"; + case Keyboard::Scan::Pause: return "Pause"; + case Keyboard::Scan::Insert: return "Insert"; + case Keyboard::Scan::Home: return "Home"; + case Keyboard::Scan::PageUp: return "Page Up"; + case Keyboard::Scan::Delete: return "Delete"; + case Keyboard::Scan::End: return "End"; + case Keyboard::Scan::PageDown: return "Page Down"; - case Keyboard::ScanLeft: return "Left Arrow"; - case Keyboard::ScanRight: return "Right Arrow"; - case Keyboard::ScanDown: return "Down Arrow"; - case Keyboard::ScanUp: return "Up Arrow"; + case Keyboard::Scan::Left: return "Left Arrow"; + case Keyboard::Scan::Right: return "Right Arrow"; + case Keyboard::Scan::Down: return "Down Arrow"; + case Keyboard::Scan::Up: return "Up Arrow"; - case Keyboard::ScanNumLock: return "Num Lock"; - case Keyboard::ScanNumpadDivide: return "Divide (Numpad)"; - case Keyboard::ScanNumpadMultiply: return "Multiply (Numpad)"; - case Keyboard::ScanNumpadMinus: return "Minus (Numpad)"; - case Keyboard::ScanNumpadPlus: return "Plus (Numpad)"; - case Keyboard::ScanNumpadEqual: return "Equal (Numpad)"; - case Keyboard::ScanNumpadEnter: return "Enter (Numpad)"; - case Keyboard::ScanNumpadDecimal: return "Decimal (Numpad)"; + case Keyboard::Scan::NumLock: return "Num Lock"; + case Keyboard::Scan::NumpadDivide: return "Divide (Numpad)"; + case Keyboard::Scan::NumpadMultiply: return "Multiply (Numpad)"; + case Keyboard::Scan::NumpadMinus: return "Minus (Numpad)"; + case Keyboard::Scan::NumpadPlus: return "Plus (Numpad)"; + case Keyboard::Scan::NumpadEqual: return "Equal (Numpad)"; + case Keyboard::Scan::NumpadEnter: return "Enter (Numpad)"; + case Keyboard::Scan::NumpadDecimal: return "Decimal (Numpad)"; - case Keyboard::ScanNumpad0: return "0 (Numpad)"; - case Keyboard::ScanNumpad1: return "1 (Numpad)"; - case Keyboard::ScanNumpad2: return "2 (Numpad)"; - case Keyboard::ScanNumpad3: return "3 (Numpad)"; - case Keyboard::ScanNumpad4: return "4 (Numpad)"; - case Keyboard::ScanNumpad5: return "5 (Numpad)"; - case Keyboard::ScanNumpad6: return "6 (Numpad)"; - case Keyboard::ScanNumpad7: return "7 (Numpad)"; - case Keyboard::ScanNumpad8: return "8 (Numpad)"; - case Keyboard::ScanNumpad9: return "9 (Numpad)"; + case Keyboard::Scan::Numpad0: return "0 (Numpad)"; + case Keyboard::Scan::Numpad1: return "1 (Numpad)"; + case Keyboard::Scan::Numpad2: return "2 (Numpad)"; + case Keyboard::Scan::Numpad3: return "3 (Numpad)"; + case Keyboard::Scan::Numpad4: return "4 (Numpad)"; + case Keyboard::Scan::Numpad5: return "5 (Numpad)"; + case Keyboard::Scan::Numpad6: return "6 (Numpad)"; + case Keyboard::Scan::Numpad7: return "7 (Numpad)"; + case Keyboard::Scan::Numpad8: return "8 (Numpad)"; + case Keyboard::Scan::Numpad9: return "9 (Numpad)"; - case Keyboard::ScanApplication: return "Application"; - case Keyboard::ScanExecute: return "Execute"; - case Keyboard::ScanHelp: return "Help"; - case Keyboard::ScanMenu: return "Menu"; - case Keyboard::ScanSelect: return "Select"; - case Keyboard::ScanStop: return "Stop"; - case Keyboard::ScanRedo: return "Redo"; - case Keyboard::ScanUndo: return "Undo"; - case Keyboard::ScanCut: return "Cut"; - case Keyboard::ScanCopy: return "Copy"; - case Keyboard::ScanPaste: return "Paste"; - case Keyboard::ScanSearch: return "Search"; + case Keyboard::Scan::Application: return "Application"; + case Keyboard::Scan::Execute: return "Execute"; + case Keyboard::Scan::Help: return "Help"; + case Keyboard::Scan::Menu: return "Menu"; + case Keyboard::Scan::Select: return "Select"; + case Keyboard::Scan::Stop: return "Stop"; + case Keyboard::Scan::Redo: return "Redo"; + case Keyboard::Scan::Undo: return "Undo"; + case Keyboard::Scan::Cut: return "Cut"; + case Keyboard::Scan::Copy: return "Copy"; + case Keyboard::Scan::Paste: return "Paste"; + case Keyboard::Scan::Search: return "Search"; - case Keyboard::ScanVolumeMute: return "Volume Mute"; - case Keyboard::ScanVolumeUp: return "Volume Up"; - case Keyboard::ScanVolumeDown: return "Volume Down"; + case Keyboard::Scan::VolumeMute: return "Volume Mute"; + case Keyboard::Scan::VolumeUp: return "Volume Up"; + case Keyboard::Scan::VolumeDown: return "Volume Down"; - case Keyboard::ScanLControl: return "Left Control"; - case Keyboard::ScanLShift: return "Left Shift"; - case Keyboard::ScanLAlt: return "Left Alt"; - case Keyboard::ScanLSystem: return "Left System"; - case Keyboard::ScanRControl: return "Right Control"; - case Keyboard::ScanRShift: return "Right Shift"; - case Keyboard::ScanRAlt: return "Right Alt"; - case Keyboard::ScanRSystem: return "Right System"; + case Keyboard::Scan::LControl: return "Left Control"; + case Keyboard::Scan::LShift: return "Left Shift"; + case Keyboard::Scan::LAlt: return "Left Alt"; + case Keyboard::Scan::LSystem: return "Left System"; + case Keyboard::Scan::RControl: return "Right Control"; + case Keyboard::Scan::RShift: return "Right Shift"; + case Keyboard::Scan::RAlt: return "Right Alt"; + case Keyboard::Scan::RSystem: return "Right System"; - case Keyboard::ScanLaunchApplication1: return "Launch Application 1"; - case Keyboard::ScanLaunchApplication2: return "Launch Application 2"; - case Keyboard::ScanFavorites: return "Favorites"; - case Keyboard::ScanBack: return "Back"; - case Keyboard::ScanForward: return "Forward"; - case Keyboard::ScanMediaNextTrack: return "Media Next Track"; - case Keyboard::ScanMediaPlayPause: return "Media Play Pause"; - case Keyboard::ScanMediaPreviousTrack: return "Media Previous Track"; - case Keyboard::ScanMediaStop: return "Media Stop"; - case Keyboard::ScanHomePage: return "Home Page"; - case Keyboard::ScanRefresh: return "Refresh"; - case Keyboard::ScanLaunchMail: return "Launch Mail"; - case Keyboard::ScanLaunchMediaSelect: return "Launch Media Select"; + case Keyboard::Scan::LaunchApplication1: return "Launch Application 1"; + case Keyboard::Scan::LaunchApplication2: return "Launch Application 2"; + case Keyboard::Scan::Favorites: return "Favorites"; + case Keyboard::Scan::Back: return "Back"; + case Keyboard::Scan::Forward: return "Forward"; + case Keyboard::Scan::MediaNextTrack: return "Media Next Track"; + case Keyboard::Scan::MediaPlayPause: return "Media Play Pause"; + case Keyboard::Scan::MediaPreviousTrack: return "Media Previous Track"; + case Keyboard::Scan::MediaStop: return "Media Stop"; + case Keyboard::Scan::HomePage: return "Home Page"; + case Keyboard::Scan::Refresh: return "Refresh"; + case Keyboard::Scan::LaunchMail: return "Launch Mail"; + case Keyboard::Scan::LaunchMediaSelect: return "Launch Media Select"; default: return "Unknown Scancode"; } diff --git a/src/SFML/Window/Win32/InputImpl.cpp b/src/SFML/Window/Win32/InputImpl.cpp index 7e529163c..fd02e10d6 100644 --- a/src/SFML/Window/Win32/InputImpl.cpp +++ b/src/SFML/Window/Win32/InputImpl.cpp @@ -42,8 +42,8 @@ namespace sf namespace priv { //////////////////////////////////////////////////////////// -Keyboard::Scancode InputImpl::m_keyToScancodeMapping[Keyboard::KeyCount]; ///< Mapping from Key to Scancode -Keyboard::Key InputImpl::m_scancodeToKeyMapping[Keyboard::ScancodeCount]; ///< Mapping from Scancode to Key +Keyboard::Scancode InputImpl::m_keyToScancodeMapping[Keyboard::KeyCount]; ///< Mapping from Key to Scancode +Keyboard::Key InputImpl::m_scancodeToKeyMapping[Keyboard::Scan::ScancodeCount]; ///< Mapping from Scancode to Key //////////////////////////////////////////////////////////// Keyboard::Key virtualKeyToSfKey(UINT virtualKey) @@ -276,163 +276,163 @@ WORD sfScanToWinScan(Keyboard::Scancode code) // Reference: https://msdn.microsoft.com/en-us/library/aa299374(v=vs.60).aspx switch (code) { - case Keyboard::ScanA: return 0x1E; - case Keyboard::ScanB: return 0x30; - case Keyboard::ScanC: return 0x2E; - case Keyboard::ScanD: return 0x20; - case Keyboard::ScanE: return 0x12; - case Keyboard::ScanF: return 0x21; - case Keyboard::ScanG: return 0x22; - case Keyboard::ScanH: return 0x23; - case Keyboard::ScanI: return 0x17; - case Keyboard::ScanJ: return 0x24; - case Keyboard::ScanK: return 0x25; - case Keyboard::ScanL: return 0x26; - case Keyboard::ScanM: return 0x32; - case Keyboard::ScanN: return 0x31; - case Keyboard::ScanO: return 0x18; - case Keyboard::ScanP: return 0x19; - case Keyboard::ScanQ: return 0x10; - case Keyboard::ScanR: return 0x13; - case Keyboard::ScanS: return 0x1F; - case Keyboard::ScanT: return 0x14; - case Keyboard::ScanU: return 0x16; - case Keyboard::ScanV: return 0x2F; - case Keyboard::ScanW: return 0x11; - case Keyboard::ScanX: return 0x2D; - case Keyboard::ScanY: return 0x15; - case Keyboard::ScanZ: return 0x2C; + case Keyboard::Scan::A: return 0x1E; + case Keyboard::Scan::B: return 0x30; + case Keyboard::Scan::C: return 0x2E; + case Keyboard::Scan::D: return 0x20; + case Keyboard::Scan::E: return 0x12; + case Keyboard::Scan::F: return 0x21; + case Keyboard::Scan::G: return 0x22; + case Keyboard::Scan::H: return 0x23; + case Keyboard::Scan::I: return 0x17; + case Keyboard::Scan::J: return 0x24; + case Keyboard::Scan::K: return 0x25; + case Keyboard::Scan::L: return 0x26; + case Keyboard::Scan::M: return 0x32; + case Keyboard::Scan::N: return 0x31; + case Keyboard::Scan::O: return 0x18; + case Keyboard::Scan::P: return 0x19; + case Keyboard::Scan::Q: return 0x10; + case Keyboard::Scan::R: return 0x13; + case Keyboard::Scan::S: return 0x1F; + case Keyboard::Scan::T: return 0x14; + case Keyboard::Scan::U: return 0x16; + case Keyboard::Scan::V: return 0x2F; + case Keyboard::Scan::W: return 0x11; + case Keyboard::Scan::X: return 0x2D; + case Keyboard::Scan::Y: return 0x15; + case Keyboard::Scan::Z: return 0x2C; - case Keyboard::ScanNum1: return 0x02; - case Keyboard::ScanNum2: return 0x03; - case Keyboard::ScanNum3: return 0x04; - case Keyboard::ScanNum4: return 0x05; - case Keyboard::ScanNum5: return 0x06; - case Keyboard::ScanNum6: return 0x07; - case Keyboard::ScanNum7: return 0x08; - case Keyboard::ScanNum8: return 0x09; - case Keyboard::ScanNum9: return 0x0A; - case Keyboard::ScanNum0: return 0x0B; + case Keyboard::Scan::Num1: return 0x02; + case Keyboard::Scan::Num2: return 0x03; + case Keyboard::Scan::Num3: return 0x04; + case Keyboard::Scan::Num4: return 0x05; + case Keyboard::Scan::Num5: return 0x06; + case Keyboard::Scan::Num6: return 0x07; + case Keyboard::Scan::Num7: return 0x08; + case Keyboard::Scan::Num8: return 0x09; + case Keyboard::Scan::Num9: return 0x0A; + case Keyboard::Scan::Num0: return 0x0B; - case Keyboard::ScanEnter: return 0x1C; - case Keyboard::ScanEscape: return 0x01; - case Keyboard::ScanBackspace: return 0x0E; - case Keyboard::ScanTab: return 0x0F; - case Keyboard::ScanSpace: return 0x39; - case Keyboard::ScanHyphen: return 0x0C; - case Keyboard::ScanEqual: return 0x0D; - case Keyboard::ScanLBracket: return 0x1A; - case Keyboard::ScanRBracket: return 0x1B; - case Keyboard::ScanBackslash: return 0x2B; - case Keyboard::ScanSemicolon: return 0x27; - case Keyboard::ScanApostrophe: return 0x28; - case Keyboard::ScanGrave: return 0x29; - case Keyboard::ScanComma: return 0x33; - case Keyboard::ScanPeriod: return 0x34; - case Keyboard::ScanSlash: return 0x35; + case Keyboard::Scan::Enter: return 0x1C; + case Keyboard::Scan::Escape: return 0x01; + case Keyboard::Scan::Backspace: return 0x0E; + case Keyboard::Scan::Tab: return 0x0F; + case Keyboard::Scan::Space: return 0x39; + case Keyboard::Scan::Hyphen: return 0x0C; + case Keyboard::Scan::Equal: return 0x0D; + case Keyboard::Scan::LBracket: return 0x1A; + case Keyboard::Scan::RBracket: return 0x1B; + case Keyboard::Scan::Backslash: return 0x2B; + case Keyboard::Scan::Semicolon: return 0x27; + case Keyboard::Scan::Apostrophe: return 0x28; + case Keyboard::Scan::Grave: return 0x29; + case Keyboard::Scan::Comma: return 0x33; + case Keyboard::Scan::Period: return 0x34; + case Keyboard::Scan::Slash: return 0x35; - case Keyboard::ScanF1: return 0x3B; - case Keyboard::ScanF2: return 0x3C; - case Keyboard::ScanF3: return 0x3D; - case Keyboard::ScanF4: return 0x3E; - case Keyboard::ScanF5: return 0x3F; - case Keyboard::ScanF6: return 0x40; - case Keyboard::ScanF7: return 0x41; - case Keyboard::ScanF8: return 0x42; - case Keyboard::ScanF9: return 0x43; - case Keyboard::ScanF10: return 0x44; - case Keyboard::ScanF11: return 0x57; - case Keyboard::ScanF12: return 0x58; - case Keyboard::ScanF13: return 0x64; - case Keyboard::ScanF14: return 0x65; - case Keyboard::ScanF15: return 0x66; - case Keyboard::ScanF16: return 0x67; - case Keyboard::ScanF17: return 0x68; - case Keyboard::ScanF18: return 0x69; - case Keyboard::ScanF19: return 0x6A; - case Keyboard::ScanF20: return 0x6B; - case Keyboard::ScanF21: return 0x6C; - case Keyboard::ScanF22: return 0x6D; - case Keyboard::ScanF23: return 0x6E; - case Keyboard::ScanF24: return 0x76; + case Keyboard::Scan::F1: return 0x3B; + case Keyboard::Scan::F2: return 0x3C; + case Keyboard::Scan::F3: return 0x3D; + case Keyboard::Scan::F4: return 0x3E; + case Keyboard::Scan::F5: return 0x3F; + case Keyboard::Scan::F6: return 0x40; + case Keyboard::Scan::F7: return 0x41; + case Keyboard::Scan::F8: return 0x42; + case Keyboard::Scan::F9: return 0x43; + case Keyboard::Scan::F10: return 0x44; + case Keyboard::Scan::F11: return 0x57; + case Keyboard::Scan::F12: return 0x58; + case Keyboard::Scan::F13: return 0x64; + case Keyboard::Scan::F14: return 0x65; + case Keyboard::Scan::F15: return 0x66; + case Keyboard::Scan::F16: return 0x67; + case Keyboard::Scan::F17: return 0x68; + case Keyboard::Scan::F18: return 0x69; + case Keyboard::Scan::F19: return 0x6A; + case Keyboard::Scan::F20: return 0x6B; + case Keyboard::Scan::F21: return 0x6C; + case Keyboard::Scan::F22: return 0x6D; + case Keyboard::Scan::F23: return 0x6E; + case Keyboard::Scan::F24: return 0x76; - case Keyboard::ScanCapsLock: return 0x3A; - case Keyboard::ScanPrintScreen: return 0xE037; - case Keyboard::ScanScrollLock: return 0x46; - case Keyboard::ScanPause: return 0x45; - case Keyboard::ScanInsert: return 0xE052; - case Keyboard::ScanHome: return 0xE047; - case Keyboard::ScanPageUp: return 0xE049; - case Keyboard::ScanDelete: return 0xE053; - case Keyboard::ScanEnd: return 0xE04F; - case Keyboard::ScanPageDown: return 0xE051; - case Keyboard::ScanRight: return 0xE04D; - case Keyboard::ScanLeft: return 0xE04B; - case Keyboard::ScanDown: return 0xE050; - case Keyboard::ScanUp: return 0xE048; - case Keyboard::ScanNumLock: return 0xE045; + case Keyboard::Scan::CapsLock: return 0x3A; + case Keyboard::Scan::PrintScreen: return 0xE037; + case Keyboard::Scan::ScrollLock: return 0x46; + case Keyboard::Scan::Pause: return 0x45; + case Keyboard::Scan::Insert: return 0xE052; + case Keyboard::Scan::Home: return 0xE047; + case Keyboard::Scan::PageUp: return 0xE049; + case Keyboard::Scan::Delete: return 0xE053; + case Keyboard::Scan::End: return 0xE04F; + case Keyboard::Scan::PageDown: return 0xE051; + case Keyboard::Scan::Right: return 0xE04D; + case Keyboard::Scan::Left: return 0xE04B; + case Keyboard::Scan::Down: return 0xE050; + case Keyboard::Scan::Up: return 0xE048; + case Keyboard::Scan::NumLock: return 0xE045; - case Keyboard::ScanNumpadDivide: return 0xE035; - case Keyboard::ScanNumpadMultiply: return 0x37; - case Keyboard::ScanNumpadMinus: return 0xA4; - case Keyboard::ScanNumpadPlus: return 0x4E; - case Keyboard::ScanNumpadEqual: return 0x7E; - case Keyboard::ScanNumpadEnter: return 0xE01C; - case Keyboard::ScanNumpadDecimal: return 0x53; + case Keyboard::Scan::NumpadDivide: return 0xE035; + case Keyboard::Scan::NumpadMultiply: return 0x37; + case Keyboard::Scan::NumpadMinus: return 0xA4; + case Keyboard::Scan::NumpadPlus: return 0x4E; + case Keyboard::Scan::NumpadEqual: return 0x7E; + case Keyboard::Scan::NumpadEnter: return 0xE01C; + case Keyboard::Scan::NumpadDecimal: return 0x53; - case Keyboard::ScanNumpad1: return 0x4F; - case Keyboard::ScanNumpad2: return 0x50; - case Keyboard::ScanNumpad3: return 0x51; - case Keyboard::ScanNumpad4: return 0x4B; - case Keyboard::ScanNumpad5: return 0x4C; - case Keyboard::ScanNumpad6: return 0x4D; - case Keyboard::ScanNumpad7: return 0x47; - case Keyboard::ScanNumpad8: return 0x48; - case Keyboard::ScanNumpad9: return 0x49; - case Keyboard::ScanNumpad0: return 0x52; + case Keyboard::Scan::Numpad1: return 0x4F; + case Keyboard::Scan::Numpad2: return 0x50; + case Keyboard::Scan::Numpad3: return 0x51; + case Keyboard::Scan::Numpad4: return 0x4B; + case Keyboard::Scan::Numpad5: return 0x4C; + case Keyboard::Scan::Numpad6: return 0x4D; + case Keyboard::Scan::Numpad7: return 0x47; + case Keyboard::Scan::Numpad8: return 0x48; + case Keyboard::Scan::Numpad9: return 0x49; + case Keyboard::Scan::Numpad0: return 0x52; - case Keyboard::ScanNonUsBackslash: return 0x56; - // No known scancode for Keyboard::ScanApplication - // No known scancode for Keyboard::ScanExecute - // No known scancode for Keyboard::ScanModeChange - case Keyboard::ScanHelp: return 0xE061; - case Keyboard::ScanMenu: return 0xE05D; - case Keyboard::ScanSelect: return 0xE01E; - // No known scancode for Keyboard::ScanRedo - // No known scancode for Keyboard::ScanUndo - // No known scancode for Keyboard::ScanCut - // No known scancode for Keyboard::ScanCopy - // No known scancode for Keyboard::ScanPaste + case Keyboard::Scan::NonUsBackslash: return 0x56; + // No known scancode for Keyboard::Scan::Application + // No known scancode for Keyboard::Scan::Execute + // No known scancode for Keyboard::Scan::ModeChange + case Keyboard::Scan::Help: return 0xE061; + case Keyboard::Scan::Menu: return 0xE05D; + case Keyboard::Scan::Select: return 0xE01E; + // No known scancode for Keyboard::Scan::Redo + // No known scancode for Keyboard::Scan::Undo + // No known scancode for Keyboard::Scan::Cut + // No known scancode for Keyboard::Scan::Copy + // No known scancode for Keyboard::Scan::Paste - case Keyboard::ScanVolumeMute: return 0xE020; - case Keyboard::ScanVolumeUp: return 0xE02E; - case Keyboard::ScanVolumeDown: return 0xE02C; - case Keyboard::ScanMediaPlayPause: return 0xE022; - case Keyboard::ScanMediaStop: return 0xE024; - case Keyboard::ScanMediaNextTrack: return 0xE019; - case Keyboard::ScanMediaPreviousTrack: return 0xE010; + case Keyboard::Scan::VolumeMute: return 0xE020; + case Keyboard::Scan::VolumeUp: return 0xE02E; + case Keyboard::Scan::VolumeDown: return 0xE02C; + case Keyboard::Scan::MediaPlayPause: return 0xE022; + case Keyboard::Scan::MediaStop: return 0xE024; + case Keyboard::Scan::MediaNextTrack: return 0xE019; + case Keyboard::Scan::MediaPreviousTrack: return 0xE010; - case Keyboard::ScanLControl: return 0x1D; - case Keyboard::ScanLShift: return 0x2A; - case Keyboard::ScanLAlt: return 0x38; - case Keyboard::ScanLSystem: return 0xE05B; - case Keyboard::ScanRControl: return 0xE01D; - case Keyboard::ScanRShift: return 0x36; - case Keyboard::ScanRAlt: return 0xE038; - case Keyboard::ScanRSystem: return 0xE05C; + case Keyboard::Scan::LControl: return 0x1D; + case Keyboard::Scan::LShift: return 0x2A; + case Keyboard::Scan::LAlt: return 0x38; + case Keyboard::Scan::LSystem: return 0xE05B; + case Keyboard::Scan::RControl: return 0xE01D; + case Keyboard::Scan::RShift: return 0x36; + case Keyboard::Scan::RAlt: return 0xE038; + case Keyboard::Scan::RSystem: return 0xE05C; - case Keyboard::ScanBack: return 0xE06A; - case Keyboard::ScanForward: return 0xE069; - case Keyboard::ScanRefresh: return 0xE067; - case Keyboard::ScanStop: return 0xE068; - case Keyboard::ScanSearch: return 0xE065; - case Keyboard::ScanFavorites: return 0xE066; - case Keyboard::ScanHomePage: return 0xE030; + case Keyboard::Scan::Back: return 0xE06A; + case Keyboard::Scan::Forward: return 0xE069; + case Keyboard::Scan::Refresh: return 0xE067; + case Keyboard::Scan::Stop: return 0xE068; + case Keyboard::Scan::Search: return 0xE065; + case Keyboard::Scan::Favorites: return 0xE066; + case Keyboard::Scan::HomePage: return 0xE030; - case Keyboard::ScanLaunchApplication1: return 0xE06B; - case Keyboard::ScanLaunchApplication2: return 0xE021; - case Keyboard::ScanLaunchMail: return 0xE06C; - case Keyboard::ScanLaunchMediaSelect: return 0xE06D; + case Keyboard::Scan::LaunchApplication1: return 0xE06B; + case Keyboard::Scan::LaunchApplication2: return 0xE021; + case Keyboard::Scan::LaunchMail: return 0xE06C; + case Keyboard::Scan::LaunchMediaSelect: return 0xE06D; // Unable to map to a scancode default: return 0x0; @@ -446,44 +446,44 @@ WORD sfScanToWinScanExtended(Keyboard::Scancode code) // Reference: https://msdn.microsoft.com/en-us/library/aa299374(v=vs.60).aspx switch (code) { - case Keyboard::ScanPrintScreen: return 55 | 0xE100; - case Keyboard::ScanInsert: return 82 | 0xE100; - case Keyboard::ScanHome: return 71 | 0xE100; - case Keyboard::ScanPageUp: return 73 | 0xE100; - case Keyboard::ScanDelete: return 83 | 0xE100; - case Keyboard::ScanEnd: return 79 | 0xE100; - case Keyboard::ScanPageDown: return 81 | 0xE100; - case Keyboard::ScanRight: return 77 | 0xE100; - case Keyboard::ScanLeft: return 75 | 0xE100; - case Keyboard::ScanDown: return 80 | 0xE100; - case Keyboard::ScanUp: return 72 | 0xE100; - case Keyboard::ScanNumLock: return 69 | 0xE100; - case Keyboard::ScanNumpadEnter: return 28 | 0xE100; - case Keyboard::ScanHelp: return 97 | 0xE100; - case Keyboard::ScanMenu: return 93 | 0xE100; - case Keyboard::ScanSelect: return 30 | 0xE100; - case Keyboard::ScanVolumeMute: return 32 | 0xE100; - case Keyboard::ScanVolumeUp: return 46 | 0xE100; - case Keyboard::ScanVolumeDown: return 44 | 0xE100; - case Keyboard::ScanMediaPlayPause: return 34 | 0xE100; - case Keyboard::ScanMediaStop: return 36 | 0xE100; - case Keyboard::ScanMediaNextTrack: return 25 | 0xE100; - case Keyboard::ScanMediaPreviousTrack: return 16 | 0xE100; - case Keyboard::ScanLSystem: return 91 | 0xE100; - case Keyboard::ScanRControl: return 29 | 0xE100; - case Keyboard::ScanRAlt: return 56 | 0xE100; - case Keyboard::ScanRSystem: return 92 | 0xE100; - case Keyboard::ScanBack: return 106 | 0xE100; - case Keyboard::ScanForward: return 105 | 0xE100; - case Keyboard::ScanRefresh: return 103 | 0xE100; - case Keyboard::ScanStop: return 104 | 0xE100; - case Keyboard::ScanSearch: return 101 | 0xE100; - case Keyboard::ScanFavorites: return 102 | 0xE100; - case Keyboard::ScanHomePage: return 48 | 0xE100; - case Keyboard::ScanLaunchApplication1: return 107 | 0xE100; - case Keyboard::ScanLaunchApplication2: return 33 | 0xE100; - case Keyboard::ScanLaunchMail: return 108 | 0xE100; - case Keyboard::ScanLaunchMediaSelect: return 109 | 0xE100; + case Keyboard::Scan::PrintScreen: return 55 | 0xE100; + case Keyboard::Scan::Insert: return 82 | 0xE100; + case Keyboard::Scan::Home: return 71 | 0xE100; + case Keyboard::Scan::PageUp: return 73 | 0xE100; + case Keyboard::Scan::Delete: return 83 | 0xE100; + case Keyboard::Scan::End: return 79 | 0xE100; + case Keyboard::Scan::PageDown: return 81 | 0xE100; + case Keyboard::Scan::Right: return 77 | 0xE100; + case Keyboard::Scan::Left: return 75 | 0xE100; + case Keyboard::Scan::Down: return 80 | 0xE100; + case Keyboard::Scan::Up: return 72 | 0xE100; + case Keyboard::Scan::NumLock: return 69 | 0xE100; + case Keyboard::Scan::NumpadEnter: return 28 | 0xE100; + case Keyboard::Scan::Help: return 97 | 0xE100; + case Keyboard::Scan::Menu: return 93 | 0xE100; + case Keyboard::Scan::Select: return 30 | 0xE100; + case Keyboard::Scan::VolumeMute: return 32 | 0xE100; + case Keyboard::Scan::VolumeUp: return 46 | 0xE100; + case Keyboard::Scan::VolumeDown: return 44 | 0xE100; + case Keyboard::Scan::MediaPlayPause: return 34 | 0xE100; + case Keyboard::Scan::MediaStop: return 36 | 0xE100; + case Keyboard::Scan::MediaNextTrack: return 25 | 0xE100; + case Keyboard::Scan::MediaPreviousTrack: return 16 | 0xE100; + case Keyboard::Scan::LSystem: return 91 | 0xE100; + case Keyboard::Scan::RControl: return 29 | 0xE100; + case Keyboard::Scan::RAlt: return 56 | 0xE100; + case Keyboard::Scan::RSystem: return 92 | 0xE100; + case Keyboard::Scan::Back: return 106 | 0xE100; + case Keyboard::Scan::Forward: return 105 | 0xE100; + case Keyboard::Scan::Refresh: return 103 | 0xE100; + case Keyboard::Scan::Stop: return 104 | 0xE100; + case Keyboard::Scan::Search: return 101 | 0xE100; + case Keyboard::Scan::Favorites: return 102 | 0xE100; + case Keyboard::Scan::HomePage: return 48 | 0xE100; + case Keyboard::Scan::LaunchApplication1: return 107 | 0xE100; + case Keyboard::Scan::LaunchApplication2: return 33 | 0xE100; + case Keyboard::Scan::LaunchMail: return 108 | 0xE100; + case Keyboard::Scan::LaunchMediaSelect: return 109 | 0xE100; // Use non-extended mapping default: return sfScanToWinScan(code); @@ -497,37 +497,37 @@ UINT sfScanToVirtualKey(Keyboard::Scancode code) // Manually map non-extended key codes switch (code) { - case Keyboard::ScanNumpad0: + case Keyboard::Scan::Numpad0: return VK_NUMPAD0; - case Keyboard::ScanNumpad1: + case Keyboard::Scan::Numpad1: return VK_NUMPAD1; - case Keyboard::ScanNumpad2: + case Keyboard::Scan::Numpad2: return VK_NUMPAD2; - case Keyboard::ScanNumpad3: + case Keyboard::Scan::Numpad3: return VK_NUMPAD3; - case Keyboard::ScanNumpad4: + case Keyboard::Scan::Numpad4: return VK_NUMPAD4; - case Keyboard::ScanNumpad5: + case Keyboard::Scan::Numpad5: return VK_NUMPAD5; - case Keyboard::ScanNumpad6: + case Keyboard::Scan::Numpad6: return VK_NUMPAD6; - case Keyboard::ScanNumpad7: + case Keyboard::Scan::Numpad7: return VK_NUMPAD7; - case Keyboard::ScanNumpad8: + case Keyboard::Scan::Numpad8: return VK_NUMPAD8; - case Keyboard::ScanNumpad9: + case Keyboard::Scan::Numpad9: return VK_NUMPAD9; - case Keyboard::ScanNumpadMinus: + case Keyboard::Scan::NumpadMinus: return VK_SUBTRACT; - case Keyboard::ScanNumpadDecimal: + case Keyboard::Scan::NumpadDecimal: return VK_DECIMAL; - case Keyboard::ScanNumpadDivide: + case Keyboard::Scan::NumpadDivide: return VK_DIVIDE; - case Keyboard::ScanPause: + case Keyboard::Scan::Pause: return VK_PAUSE; - case Keyboard::ScanRControl: + case Keyboard::Scan::RControl: return VK_RCONTROL; - case Keyboard::ScanRAlt: + case Keyboard::Scan::RAlt: return VK_RMENU; default: return MapVirtualKey(winScancode, MAPVK_VSC_TO_VK_EX); @@ -536,7 +536,7 @@ UINT sfScanToVirtualKey(Keyboard::Scancode code) bool isValidScancode(Keyboard::Scancode code) { - return code > Keyboard::ScanUnknown && code < Keyboard::ScancodeCount; + return code > Keyboard::Scan::Unknown && code < Keyboard::Scan::ScancodeCount; } bool isValidKey(Keyboard::Key key) @@ -554,13 +554,13 @@ void InputImpl::ensureMappings() // Phase 1: Initialize mappings with default values for (int i = 0; i < Keyboard::KeyCount; ++i) - m_keyToScancodeMapping[i] = Keyboard::ScanUnknown; + m_keyToScancodeMapping[i] = Keyboard::Scan::Unknown; - for (int i = 0; i < Keyboard::ScancodeCount; ++i) + for (int i = 0; i < Keyboard::Scan::ScancodeCount; ++i) m_scancodeToKeyMapping[i] = Keyboard::Unknown; // Phase 2: Translate scancode to virtual code to key names - for (int i = 0; i < Keyboard::ScancodeCount; ++i) + for (int i = 0; i < Keyboard::Scan::ScancodeCount; ++i) { Keyboard::Scancode scan = static_cast(i); UINT virtualKey = sfScanToVirtualKey(scan); @@ -601,7 +601,7 @@ Keyboard::Key InputImpl::localize(Keyboard::Scancode code) Keyboard::Scancode InputImpl::delocalize(Keyboard::Key key) { if (!isValidKey(key)) - return Keyboard::ScanUnknown; + return Keyboard::Scan::Unknown; ensureMappings(); diff --git a/src/SFML/Window/Win32/InputImpl.hpp b/src/SFML/Window/Win32/InputImpl.hpp index 55ae82cfb..45b6edba6 100644 --- a/src/SFML/Window/Win32/InputImpl.hpp +++ b/src/SFML/Window/Win32/InputImpl.hpp @@ -186,8 +186,8 @@ private: //////////////////////////////////////////////////////////// // Member data //////////////////////////////////////////////////////////// - static Keyboard::Scancode m_keyToScancodeMapping[Keyboard::KeyCount]; ///< Mapping from Key to Scancode - static Keyboard::Key m_scancodeToKeyMapping[Keyboard::ScancodeCount]; ///< Mapping from Scancode to Key + static Keyboard::Scancode m_keyToScancodeMapping[Keyboard::KeyCount]; ///< Mapping from Key to Scancode + static Keyboard::Key m_scancodeToKeyMapping[Keyboard::Scan::ScancodeCount]; ///< Mapping from Scancode to Key }; } // namespace priv diff --git a/src/SFML/Window/Win32/WindowImplWin32.cpp b/src/SFML/Window/Win32/WindowImplWin32.cpp index f610c3318..26d4f2846 100755 --- a/src/SFML/Window/Win32/WindowImplWin32.cpp +++ b/src/SFML/Window/Win32/WindowImplWin32.cpp @@ -582,114 +582,114 @@ Keyboard::Scancode WindowImplWin32::toScancode(WPARAM wParam, LPARAM lParam) // Reference: https://msdn.microsoft.com/en-us/library/aa299374(v=vs.60).aspx switch (code) { - case 1: return Keyboard::ScanEscape; - case 2: return Keyboard::ScanNum1; - case 3: return Keyboard::ScanNum2; - case 4: return Keyboard::ScanNum3; - case 5: return Keyboard::ScanNum4; - case 6: return Keyboard::ScanNum5; - case 7: return Keyboard::ScanNum6; - case 8: return Keyboard::ScanNum7; - case 9: return Keyboard::ScanNum8; - case 10: return Keyboard::ScanNum9; - case 11: return Keyboard::ScanNum0; - case 12: return Keyboard::ScanHyphen; - case 13: return Keyboard::ScanEqual; - case 14: return Keyboard::ScanBackspace; - case 15: return Keyboard::ScanTab; - case 16: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanMediaPreviousTrack : Keyboard::ScanQ; - case 17: return Keyboard::ScanW; - case 18: return Keyboard::ScanE; - case 19: return Keyboard::ScanR; - case 20: return Keyboard::ScanT; - case 21: return Keyboard::ScanY; - case 22: return Keyboard::ScanU; - case 23: return Keyboard::ScanI; - case 24: return Keyboard::ScanO; - case 25: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanMediaNextTrack : Keyboard::ScanP; - case 26: return Keyboard::ScanLBracket; - case 27: return Keyboard::ScanRBracket; - case 28: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanNumpadEnter : Keyboard::ScanEnter; - case 29: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanRControl : Keyboard::ScanLControl; - case 30: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanSelect : Keyboard::ScanA; - case 31: return Keyboard::ScanS; - case 32: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanVolumeMute : Keyboard::ScanD; - case 33: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanLaunchApplication1 : Keyboard::ScanF; - case 34: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanMediaPlayPause : Keyboard::ScanG; - case 35: return Keyboard::ScanH; - case 36: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanMediaStop : Keyboard::ScanJ; - case 37: return Keyboard::ScanK; - case 38: return Keyboard::ScanL; - case 39: return Keyboard::ScanSemicolon; - case 40: return Keyboard::ScanApostrophe; - case 41: return Keyboard::ScanGrave; - case 42: return Keyboard::ScanLShift; - case 43: return Keyboard::ScanBackslash; - case 44: return Keyboard::ScanZ; - case 45: return Keyboard::ScanX; - case 46: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanVolumeDown : Keyboard::ScanC; - case 47: return Keyboard::ScanV; - case 48: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanVolumeUp : Keyboard::ScanB; - case 49: return Keyboard::ScanN; - case 50: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanHomePage : Keyboard::ScanM; - case 51: return Keyboard::ScanComma; - case 52: return Keyboard::ScanPeriod; - case 53: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanNumpadDivide : Keyboard::ScanSlash; - case 54: return Keyboard::ScanRShift; - case 55: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanPrintScreen : Keyboard::ScanNumpadMultiply; - case 56: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanRAlt : Keyboard::ScanLAlt; - case 57: return Keyboard::ScanSpace; - case 58: return Keyboard::ScanCapsLock; - case 59: return Keyboard::ScanF1; - case 60: return Keyboard::ScanF2; - case 61: return Keyboard::ScanF3; - case 62: return Keyboard::ScanF4; - case 63: return Keyboard::ScanF5; - case 64: return Keyboard::ScanF6; - case 65: return Keyboard::ScanF7; - case 66: return Keyboard::ScanF8; - case 67: return Keyboard::ScanF9; - case 68: return Keyboard::ScanF10; - case 69: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanNumLock : Keyboard::ScanPause; - case 70: return Keyboard::ScanScrollLock; - case 71: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanHome : Keyboard::ScanNumpad7; - case 72: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanUp : Keyboard::ScanNumpad8; - case 73: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanPageUp : Keyboard::ScanNumpad9; - case 74: return Keyboard::ScanNumpadMinus; - case 75: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanLeft : Keyboard::ScanNumpad4; - case 76: return Keyboard::ScanNumpad5; - case 77: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanRight : Keyboard::ScanNumpad6; - case 78: return Keyboard::ScanNumpadPlus; - case 79: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanEnd : Keyboard::ScanNumpad1; - case 80: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanDown : Keyboard::ScanNumpad2; - case 81: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanPageDown : Keyboard::ScanNumpad3; - case 82: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanInsert : Keyboard::ScanNumpad0; - case 83: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanDelete : Keyboard::ScanNumpadDecimal; + case 1: return Keyboard::Scan::Escape; + case 2: return Keyboard::Scan::Num1; + case 3: return Keyboard::Scan::Num2; + case 4: return Keyboard::Scan::Num3; + case 5: return Keyboard::Scan::Num4; + case 6: return Keyboard::Scan::Num5; + case 7: return Keyboard::Scan::Num6; + case 8: return Keyboard::Scan::Num7; + case 9: return Keyboard::Scan::Num8; + case 10: return Keyboard::Scan::Num9; + case 11: return Keyboard::Scan::Num0; + case 12: return Keyboard::Scan::Hyphen; + case 13: return Keyboard::Scan::Equal; + case 14: return Keyboard::Scan::Backspace; + case 15: return Keyboard::Scan::Tab; + case 16: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::MediaPreviousTrack : Keyboard::Scan::Q; + case 17: return Keyboard::Scan::W; + case 18: return Keyboard::Scan::E; + case 19: return Keyboard::Scan::R; + case 20: return Keyboard::Scan::T; + case 21: return Keyboard::Scan::Y; + case 22: return Keyboard::Scan::U; + case 23: return Keyboard::Scan::I; + case 24: return Keyboard::Scan::O; + case 25: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::MediaNextTrack : Keyboard::Scan::P; + case 26: return Keyboard::Scan::LBracket; + case 27: return Keyboard::Scan::RBracket; + case 28: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::NumpadEnter : Keyboard::Scan::Enter; + case 29: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::RControl : Keyboard::Scan::LControl; + case 30: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Select : Keyboard::Scan::A; + case 31: return Keyboard::Scan::S; + case 32: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::VolumeMute : Keyboard::Scan::D; + case 33: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::LaunchApplication1 : Keyboard::Scan::F; + case 34: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::MediaPlayPause : Keyboard::Scan::G; + case 35: return Keyboard::Scan::H; + case 36: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::MediaStop : Keyboard::Scan::J; + case 37: return Keyboard::Scan::K; + case 38: return Keyboard::Scan::L; + case 39: return Keyboard::Scan::Semicolon; + case 40: return Keyboard::Scan::Apostrophe; + case 41: return Keyboard::Scan::Grave; + case 42: return Keyboard::Scan::LShift; + case 43: return Keyboard::Scan::Backslash; + case 44: return Keyboard::Scan::Z; + case 45: return Keyboard::Scan::X; + case 46: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::VolumeDown : Keyboard::Scan::C; + case 47: return Keyboard::Scan::V; + case 48: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::VolumeUp : Keyboard::Scan::B; + case 49: return Keyboard::Scan::N; + case 50: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::HomePage : Keyboard::Scan::M; + case 51: return Keyboard::Scan::Comma; + case 52: return Keyboard::Scan::Period; + case 53: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::NumpadDivide : Keyboard::Scan::Slash; + case 54: return Keyboard::Scan::RShift; + case 55: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::PrintScreen : Keyboard::Scan::NumpadMultiply; + case 56: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::RAlt : Keyboard::Scan::LAlt; + case 57: return Keyboard::Scan::Space; + case 58: return Keyboard::Scan::CapsLock; + case 59: return Keyboard::Scan::F1; + case 60: return Keyboard::Scan::F2; + case 61: return Keyboard::Scan::F3; + case 62: return Keyboard::Scan::F4; + case 63: return Keyboard::Scan::F5; + case 64: return Keyboard::Scan::F6; + case 65: return Keyboard::Scan::F7; + case 66: return Keyboard::Scan::F8; + case 67: return Keyboard::Scan::F9; + case 68: return Keyboard::Scan::F10; + case 69: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::NumLock : Keyboard::Scan::Pause; + case 70: return Keyboard::Scan::ScrollLock; + case 71: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Home : Keyboard::Scan::Numpad7; + case 72: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Up : Keyboard::Scan::Numpad8; + case 73: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::PageUp : Keyboard::Scan::Numpad9; + case 74: return Keyboard::Scan::NumpadMinus; + case 75: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Left : Keyboard::Scan::Numpad4; + case 76: return Keyboard::Scan::Numpad5; + case 77: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Right : Keyboard::Scan::Numpad6; + case 78: return Keyboard::Scan::NumpadPlus; + case 79: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::End : Keyboard::Scan::Numpad1; + case 80: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Down : Keyboard::Scan::Numpad2; + case 81: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::PageDown : Keyboard::Scan::Numpad3; + case 82: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Insert : Keyboard::Scan::Numpad0; + case 83: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Delete : Keyboard::Scan::NumpadDecimal; - case 86: return Keyboard::ScanNonUsBackslash; - case 87: return Keyboard::ScanF11; - case 88: return Keyboard::ScanF12; + case 86: return Keyboard::Scan::NonUsBackslash; + case 87: return Keyboard::Scan::F11; + case 88: return Keyboard::Scan::F12; - case 91: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanLSystem : Keyboard::ScanUnknown; - case 92: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanRSystem : Keyboard::ScanUnknown; - case 93: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanMenu : Keyboard::ScanUnknown; + case 91: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::LSystem : Keyboard::Scan::Unknown; + case 92: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::RSystem : Keyboard::Scan::Unknown; + case 93: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Menu : Keyboard::Scan::Unknown; - case 99: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanHelp : Keyboard::ScanUnknown; - case 100: return Keyboard::ScanF13; - case 101: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanSearch : Keyboard::ScanF14; - case 102: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanFavorites : Keyboard::ScanF15; - case 103: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanRefresh : Keyboard::ScanF16; - case 104: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanStop : Keyboard::ScanF17; - case 105: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanForward : Keyboard::ScanF18; - case 106: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanBack : Keyboard::ScanF19; - case 107: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanLaunchApplication1 : Keyboard::ScanF20; - case 108: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanLaunchMail : Keyboard::ScanF21; - case 109: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::ScanLaunchMediaSelect : Keyboard::ScanF22; - case 110: return Keyboard::ScanF23; + case 99: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Help : Keyboard::Scan::Unknown; + case 100: return Keyboard::Scan::F13; + case 101: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Search : Keyboard::Scan::F14; + case 102: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Favorites : Keyboard::Scan::F15; + case 103: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Refresh : Keyboard::Scan::F16; + case 104: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Stop : Keyboard::Scan::F17; + case 105: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Forward : Keyboard::Scan::F18; + case 106: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::Back : Keyboard::Scan::F19; + case 107: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::LaunchApplication1 : Keyboard::Scan::F20; + case 108: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::LaunchMail : Keyboard::Scan::F21; + case 109: return (HIWORD(lParam) & KF_EXTENDED) ? Keyboard::Scan::LaunchMediaSelect : Keyboard::Scan::F22; + case 110: return Keyboard::Scan::F23; - case 118: return Keyboard::ScanF24; + case 118: return Keyboard::Scan::F24; - default: return Keyboard::ScanUnknown; + default: return Keyboard::Scan::Unknown; } } diff --git a/src/SFML/Window/iOS/InputImpl.mm b/src/SFML/Window/iOS/InputImpl.mm index e47ce995e..d4f2d2070 100644 --- a/src/SFML/Window/iOS/InputImpl.mm +++ b/src/SFML/Window/iOS/InputImpl.mm @@ -58,7 +58,7 @@ Keyboard::Key InputImpl::localize(Keyboard::Scancode /* code */) Keyboard::Scancode InputImpl::delocalize(Keyboard::Key /* key */) { // Not applicable - return Keyboard::ScanUnknown; + return Keyboard::Scan::Unknown; } String InputImpl::getDescription(Keyboard::Scancode /* code */)