Renamed a few key codes

Deprecated BackSlash, BackSpace, SemiColon, Dash and
introduced Backslash, Backspace, Semicolon, Hyphen in a
retrocompatible way.
This commit is contained in:
Marco Antognini 2018-03-21 07:16:13 +01:00 committed by Lukas Dürrenberger
parent 5c20c67469
commit b0f3611ab9
8 changed files with 47 additions and 39 deletions

View File

@ -175,7 +175,7 @@ int main()
}
// Return key: toggle mipmapping
if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Return))
if ((event.type == sf::Event::KeyPressed) && (event.key.code == sf::Keyboard::Enter))
{
if (mipmapEnabled)
{

View File

@ -96,18 +96,18 @@ public:
Menu, ///< The Menu key
LBracket, ///< The [ key
RBracket, ///< The ] key
SemiColon, ///< The ; key
Semicolon, ///< The ; key
Comma, ///< The , key
Period, ///< The . key
Quote, ///< The ' key
Slash, ///< The / key
BackSlash, ///< The \ key
Backslash, ///< The \ key
Tilde, ///< The ~ key
Equal, ///< The = key
Dash, ///< The - key
Hyphen, ///< The - key (hyphen)
Space, ///< The Space key
Return, ///< The Return key
BackSpace, ///< The Backspace key
Enter, ///< The Enter/Return keys
Backspace, ///< The Backspace key
Tab, ///< The Tabulation key
PageUp, ///< The Page up key
PageDown, ///< The Page down key
@ -116,7 +116,7 @@ public:
Insert, ///< The Insert key
Delete, ///< The Delete key
Add, ///< The + key
Subtract, ///< The - key
Subtract, ///< The - key (minus, usually from numpad)
Multiply, ///< The * key
Divide, ///< The / key
Left, ///< Left arrow
@ -150,7 +150,15 @@ public:
F15, ///< The F15 key
Pause, ///< The Pause key
KeyCount ///< Keep last -- the total number of keyboard keys
KeyCount, ///< Keep last -- the total number of keyboard keys
// Deprecated values:
Dash = Hyphen, ///< \deprecated Use Hyphen instead
BackSpace = Backspace, ///< \deprecated Use Backspace instead
BackSlash = Backslash, ///< \deprecated Use Backslash instead
SemiColon = Semicolon, ///< \deprecated Use Semicolon instead
Return = Enter ///< \deprecated Use Enter instead
};
////////////////////////////////////////////////////////////

View File

@ -619,16 +619,16 @@ Keyboard::Key WindowImplAndroid::androidKeyToSF(int32_t key)
case AKEYCODE_SYM:
case AKEYCODE_EXPLORER:
case AKEYCODE_ENVELOPE: return Keyboard::Unknown;
case AKEYCODE_ENTER: return Keyboard::Return;
case AKEYCODE_DEL: return Keyboard::BackSpace;
case AKEYCODE_ENTER: return Keyboard::Enter;
case AKEYCODE_DEL: return Keyboard::Backspace;
case AKEYCODE_FORWARD_DEL: return Keyboard::Delete;
case AKEYCODE_GRAVE: return Keyboard::Tilde;
case AKEYCODE_MINUS: return Keyboard::Subtract;
case AKEYCODE_EQUALS: return Keyboard::Equal;
case AKEYCODE_LEFT_BRACKET: return Keyboard::LBracket;
case AKEYCODE_RIGHT_BRACKET: return Keyboard::RBracket;
case AKEYCODE_BACKSLASH: return Keyboard::BackSlash;
case AKEYCODE_SEMICOLON: return Keyboard::SemiColon;
case AKEYCODE_BACKSLASH: return Keyboard::Backslash;
case AKEYCODE_SEMICOLON: return Keyboard::Semicolon;
case AKEYCODE_APOSTROPHE: return Keyboard::Quote;
case AKEYCODE_SLASH: return Keyboard::Slash;
case AKEYCODE_AT:

View File

@ -755,13 +755,13 @@ Keyboard::Key HIDInputManager::nonLocalizedKeys(UniChar virtualKeycode)
case 0x21: return sf::Keyboard::LBracket;
case 0x1e: return sf::Keyboard::RBracket;
case 0x29: return sf::Keyboard::SemiColon;
case 0x29: return sf::Keyboard::Semicolon;
case 0x2b: return sf::Keyboard::Comma;
case 0x41: /* keypad */ return sf::Keyboard::Period;
case 0x2f: /* keyboard */ return sf::Keyboard::Period;
case 0x27: return sf::Keyboard::Quote;
case 0x2c: return sf::Keyboard::Slash;
case 0x2a: return sf::Keyboard::BackSlash;
case 0x2a: return sf::Keyboard::Backslash;
// sf::Keyboard::Tilde might be in conflict with some other key.
// 0x0a is for "Non-US Backslash" according to HID Calibrator,
@ -770,11 +770,11 @@ Keyboard::Key HIDInputManager::nonLocalizedKeys(UniChar virtualKeycode)
case 0x51: /* keypad */ return sf::Keyboard::Equal;
case 0x18: /* keyboard */ return sf::Keyboard::Equal;
case 0x32: return sf::Keyboard::Dash;
case 0x32: return sf::Keyboard::Hyphen;
case 0x31: return sf::Keyboard::Space;
case 0x4c: /* keypad */ return sf::Keyboard::Return;
case 0x24: /* keyboard */ return sf::Keyboard::Return;
case 0x33: return sf::Keyboard::BackSpace;
case 0x4c: /* keypad */ return sf::Keyboard::Enter;
case 0x24: /* keyboard */ return sf::Keyboard::Enter;
case 0x33: return sf::Keyboard::Backspace;
case 0x30: return sf::Keyboard::Tab;
// Duplicates (see next section).

View File

@ -54,20 +54,20 @@ bool InputImpl::isKeyPressed(Keyboard::Key key)
case Keyboard::RSystem: keysym = XK_Super_R; break;
case Keyboard::Menu: keysym = XK_Menu; break;
case Keyboard::Escape: keysym = XK_Escape; break;
case Keyboard::SemiColon: keysym = XK_semicolon; break;
case Keyboard::Semicolon: keysym = XK_semicolon; break;
case Keyboard::Slash: keysym = XK_slash; break;
case Keyboard::Equal: keysym = XK_equal; break;
case Keyboard::Dash: keysym = XK_minus; break;
case Keyboard::Hyphen: keysym = XK_minus; break;
case Keyboard::LBracket: keysym = XK_bracketleft; break;
case Keyboard::RBracket: keysym = XK_bracketright; break;
case Keyboard::Comma: keysym = XK_comma; break;
case Keyboard::Period: keysym = XK_period; break;
case Keyboard::Quote: keysym = XK_apostrophe; break;
case Keyboard::BackSlash: keysym = XK_backslash; break;
case Keyboard::Backslash: keysym = XK_backslash; break;
case Keyboard::Tilde: keysym = XK_grave; break;
case Keyboard::Space: keysym = XK_space; break;
case Keyboard::Return: keysym = XK_Return; break;
case Keyboard::BackSpace: keysym = XK_BackSpace; break;
case Keyboard::Enter: keysym = XK_Return; break;
case Keyboard::Backspace: keysym = XK_BackSpace; break;
case Keyboard::Tab: keysym = XK_Tab; break;
case Keyboard::PageUp: keysym = XK_Prior; break;
case Keyboard::PageDown: keysym = XK_Next; break;

View File

@ -375,21 +375,21 @@ namespace
case XK_Super_R: return sf::Keyboard::RSystem;
case XK_Menu: return sf::Keyboard::Menu;
case XK_Escape: return sf::Keyboard::Escape;
case XK_semicolon: return sf::Keyboard::SemiColon;
case XK_semicolon: return sf::Keyboard::Semicolon;
case XK_slash: return sf::Keyboard::Slash;
case XK_equal: return sf::Keyboard::Equal;
case XK_minus: return sf::Keyboard::Dash;
case XK_minus: return sf::Keyboard::Hyphen;
case XK_bracketleft: return sf::Keyboard::LBracket;
case XK_bracketright: return sf::Keyboard::RBracket;
case XK_comma: return sf::Keyboard::Comma;
case XK_period: return sf::Keyboard::Period;
case XK_apostrophe: return sf::Keyboard::Quote;
case XK_backslash: return sf::Keyboard::BackSlash;
case XK_backslash: return sf::Keyboard::Backslash;
case XK_grave: return sf::Keyboard::Tilde;
case XK_space: return sf::Keyboard::Space;
case XK_Return: return sf::Keyboard::Return;
case XK_KP_Enter: return sf::Keyboard::Return;
case XK_BackSpace: return sf::Keyboard::BackSpace;
case XK_Return: return sf::Keyboard::Enter;
case XK_KP_Enter: return sf::Keyboard::Enter;
case XK_BackSpace: return sf::Keyboard::Backspace;
case XK_Tab: return sf::Keyboard::Tab;
case XK_Prior: return sf::Keyboard::PageUp;
case XK_Next: return sf::Keyboard::PageDown;

View File

@ -97,18 +97,18 @@ bool InputImpl::isKeyPressed(Keyboard::Key key)
case Keyboard::Menu: vkey = VK_APPS; break;
case Keyboard::LBracket: vkey = VK_OEM_4; break;
case Keyboard::RBracket: vkey = VK_OEM_6; break;
case Keyboard::SemiColon: vkey = VK_OEM_1; break;
case Keyboard::Semicolon: vkey = VK_OEM_1; break;
case Keyboard::Comma: vkey = VK_OEM_COMMA; break;
case Keyboard::Period: vkey = VK_OEM_PERIOD; break;
case Keyboard::Quote: vkey = VK_OEM_7; break;
case Keyboard::Slash: vkey = VK_OEM_2; break;
case Keyboard::BackSlash: vkey = VK_OEM_5; break;
case Keyboard::Backslash: vkey = VK_OEM_5; break;
case Keyboard::Tilde: vkey = VK_OEM_3; break;
case Keyboard::Equal: vkey = VK_OEM_PLUS; break;
case Keyboard::Dash: vkey = VK_OEM_MINUS; break;
case Keyboard::Hyphen: vkey = VK_OEM_MINUS; break;
case Keyboard::Space: vkey = VK_SPACE; break;
case Keyboard::Return: vkey = VK_RETURN; break;
case Keyboard::BackSpace: vkey = VK_BACK; break;
case Keyboard::Enter: vkey = VK_RETURN; break;
case Keyboard::Backspace: vkey = VK_BACK; break;
case Keyboard::Tab: vkey = VK_TAB; break;
case Keyboard::PageUp: vkey = VK_PRIOR; break;
case Keyboard::PageDown: vkey = VK_NEXT; break;

View File

@ -1024,21 +1024,21 @@ Keyboard::Key WindowImplWin32::virtualKeyCodeToSF(WPARAM key, LPARAM flags)
case VK_LWIN: return Keyboard::LSystem;
case VK_RWIN: return Keyboard::RSystem;
case VK_APPS: return Keyboard::Menu;
case VK_OEM_1: return Keyboard::SemiColon;
case VK_OEM_1: return Keyboard::Semicolon;
case VK_OEM_2: return Keyboard::Slash;
case VK_OEM_PLUS: return Keyboard::Equal;
case VK_OEM_MINUS: return Keyboard::Dash;
case VK_OEM_MINUS: return Keyboard::Hyphen;
case VK_OEM_4: return Keyboard::LBracket;
case VK_OEM_6: return Keyboard::RBracket;
case VK_OEM_COMMA: return Keyboard::Comma;
case VK_OEM_PERIOD: return Keyboard::Period;
case VK_OEM_7: return Keyboard::Quote;
case VK_OEM_5: return Keyboard::BackSlash;
case VK_OEM_5: return Keyboard::Backslash;
case VK_OEM_3: return Keyboard::Tilde;
case VK_ESCAPE: return Keyboard::Escape;
case VK_SPACE: return Keyboard::Space;
case VK_RETURN: return Keyboard::Return;
case VK_BACK: return Keyboard::BackSpace;
case VK_RETURN: return Keyboard::Enter;
case VK_BACK: return Keyboard::Backspace;
case VK_TAB: return Keyboard::Tab;
case VK_PRIOR: return Keyboard::PageUp;
case VK_NEXT: return Keyboard::PageDown;