Browse Source

Synchronize keycode constants with SDL. This changes some constants, like NUMPAD -> KP_. Added SDL scancode constants. Added polling of keys by scancodes, and scancodes into key events. Added conversion functions from keycode to scancode and vice versa, and functions to get key names. Closes #254.

Lasse Öörni 11 years ago
parent
commit
1d9d0a5736

+ 4 - 4
Bin/Data/Scripts/Editor/EditorUI.as

@@ -1138,7 +1138,7 @@ void HandleKeyDown(StringHash eventType, VariantMap& eventData)
     else if (key == KEY_F4)
         ToggleOctreeDebug();
 
-    else if (key == KEY_NUMPAD1 && ui.focusElement is null) // Front view
+    else if (key == KEY_KP_1 && ui.focusElement is null) // Front view
     {
         Vector3 pos = cameraNode.position;
         pos.z = -pos.length * viewDirection;
@@ -1149,7 +1149,7 @@ void HandleKeyDown(StringHash eventType, VariantMap& eventData)
         ReacquireCameraYawPitch();
     }
 
-    else if (key == KEY_NUMPAD3 && ui.focusElement is null) // Side view
+    else if (key == KEY_KP_3 && ui.focusElement is null) // Side view
     {
         Vector3 pos = cameraNode.position;
         pos.x = pos.length * viewDirection;
@@ -1160,7 +1160,7 @@ void HandleKeyDown(StringHash eventType, VariantMap& eventData)
         ReacquireCameraYawPitch();
     }
 
-    else if (key == KEY_NUMPAD7 && ui.focusElement is null) // Top view
+    else if (key == KEY_KP_7 && ui.focusElement is null) // Top view
     {
         Vector3 pos = cameraNode.position;
         pos.y = pos.length * viewDirection;
@@ -1171,7 +1171,7 @@ void HandleKeyDown(StringHash eventType, VariantMap& eventData)
         ReacquireCameraYawPitch();
     }
 
-    else if (key == KEY_NUMPAD5 && ui.focusElement is null)
+    else if (key == KEY_KP_5 && ui.focusElement is null)
     {
         activeViewport.ToggleOrthographic();
     }

+ 4 - 4
Bin/Data/Scripts/Editor/EditorView.as

@@ -1187,9 +1187,9 @@ void UpdateView(float timeStep)
             adjust.y = -1;
         if (editMode == EDIT_SCALE)
         {
-            if (input.keyDown[KEY_ADD])
+            if (input.keyDown[KEY_KP_PLUS])
                 adjust = Vector3(1, 1, 1);
-            if (input.keyDown[KEY_SUBTRACT])
+            if (input.keyDown[KEY_KP_MINUS])
                 adjust = Vector3(-1, -1, -1);
         }
 
@@ -1262,9 +1262,9 @@ void SteppedObjectManipulation(int key)
         adjust.y = -1;
     if (editMode == EDIT_SCALE)
     {
-        if (key == KEY_ADD)
+        if (key == KEY_KP_PLUS)
             adjust = Vector3(1, 1, 1);
-        if (key == KEY_SUBTRACT)
+        if (key == KEY_KP_MINUS)
             adjust = Vector3(-1, -1, -1);
     }
 

+ 5 - 1
Docs/Reference.dox

@@ -1348,9 +1348,13 @@ The input events include:
 - E_CONTROLLERBUTTONUP: a joystick button on an SDL controller was released.
 - E_CONTROLLERAXISMOVE: a joystick axis on an SDL controller was moved.
 
+Key events include both the symbolic keycode ("Key") that depends on the keyboard layout, the layout- and operating system-independent SDL scancode ("Scancode"), and the true operating system-specific raw keycode ("Raw").
+
 The input polling API differentiates between the initiation of a key/mouse button press, and holding the key or button down. \ref Input::GetKeyPress "GetKeyPress()" and \ref Input::GetMouseButtonPress "GetMouseButtonPress()" return true only for one frame (the initiation) while \ref Input::GetKeyDown "GetKeyDown()" and \ref Input::GetMouseButtonDown "GetMouseButtonDown()" return true as long as the key or button is held down.
 
-In script, the polling API is accessed via properties: input.keyDown[], input.keyPress[], input.mouseButtonDown[], input.mouseButtonPress[], input.mouseMove.
+To check whether keys are down or pressed by scancode, use \ref Input::GetScancodeDown "GetScancodeDown()" and \ref Input::GetScancodePress "GetScancodePress()". Functions also exist for converting keycodes to scancodes or vice versa, or getting key names. See for example \ref Input::GetKeyName "GetKeyName()" and \ref Input::GetKeyFromScancode "GetKeyFromScancode()".
+
+In AngelScript, the polling API is accessed via properties: input.keyDown[], input.keyPress[], input.scancodeDown[], input.scancodePerss[], input.mouseButtonDown[], input.mouseButtonPress[], input.mouseMove.
 
 To get joystick input, the joystick(s) must first be explicitly opened using \ref Input::OpenJoystick "OpenJoystick()". Accessing the polled joystick state using \ref Input::GetJoystick "GetJoystick()" also automatically opens the joystick. The plugged in joysticks are detected on application start and must be manually redetected using \ref Input::DetectJoysticks "DetectJoysticks()" if they are plugged in or disconnected during runtime.
 

+ 56 - 6
Source/Engine/Input/Input.cpp

@@ -52,7 +52,7 @@ namespace Urho3D
 /// Convert SDL keycode if necessary
 int ConvertSDLKeyCode(int keySym, int scanCode)
 {
-    if (scanCode == SDL_SCANCODE_AC_BACK)
+    if (scanCode == SCANCODE_AC_BACK)
         return KEY_ESC;
     else
         return SDL_toupper(keySym);
@@ -90,6 +90,7 @@ void Input::Update()
 
     // Reset input accumulation for this frame
     keyPress_.Clear();
+    scancodePress_.Clear();
     mouseButtonPress_ = 0;
     mouseMove_ = IntVector2::ZERO;
     mouseMoveWheel_ = 0;
@@ -296,6 +297,36 @@ void Input::CloseJoystick(unsigned index)
     }
 }
 
+int Input::GetKeyFromName(const String& name) const
+{
+    return SDL_GetKeyFromName(name.CString());
+}
+
+int Input::GetKeyFromScancode(int scancode) const
+{
+    return SDL_GetKeyFromScancode((SDL_Scancode)scancode);
+}
+
+String Input::GetKeyName(int key) const
+{
+    return String(SDL_GetKeyName(key));
+}
+
+int Input::GetScancodeFromKey(int key) const
+{
+    return SDL_GetScancodeFromKey(key);
+}
+
+int Input::GetScancodeFromName(const String& name) const
+{
+    return SDL_GetScancodeFromName(name.CString());
+}
+
+String Input::GetScancodeName(int scancode) const
+{
+    return SDL_GetScancodeName((SDL_Scancode)scancode);
+}
+
 bool Input::GetKeyDown(int key) const
 {
     return keyDown_.Contains(key);
@@ -306,6 +337,16 @@ bool Input::GetKeyPress(int key) const
     return keyPress_.Contains(key);
 }
 
+bool Input::GetScancodeDown(int scancode) const
+{
+    return scancodeDown_.Contains(scancode);
+}
+
+bool Input::GetScancodePress(int scancode) const
+{
+    return scancodePress_.Contains(scancode);
+}
+
 bool Input::GetMouseButtonDown(int button) const
 {
     return (mouseButtonDown_ & button) != 0;
@@ -492,6 +533,8 @@ void Input::ResetState()
 {
     keyDown_.Clear();
     keyPress_.Clear();
+    scancodeDown_.Clear();
+    scancodePress_.Clear();
 
     /// \todo Check if this is necessary
     for (Vector<JoystickState>::Iterator i = joysticks_.Begin(); i != joysticks_.End(); ++i)
@@ -574,7 +617,7 @@ void Input::SetMouseButton(int button, bool newState)
     SendEvent(newState ? E_MOUSEBUTTONDOWN : E_MOUSEBUTTONUP, eventData);
 }
 
-void Input::SetKey(int key, bool newState, unsigned raw)
+void Input::SetKey(int key, int scancode, unsigned raw, bool newState)
 {
     // If we do not have focus yet, do not react to the key down
     if (!graphics_->GetExternalWindow() && newState && !inputFocus_)
@@ -584,6 +627,9 @@ void Input::SetKey(int key, bool newState, unsigned raw)
 
     if (newState)
     {
+        scancodeDown_.Insert(scancode);
+        scancodePress_.Insert(scancode);
+
         if (!keyDown_.Contains(key))
         {
             keyDown_.Insert(key);
@@ -594,6 +640,8 @@ void Input::SetKey(int key, bool newState, unsigned raw)
     }
     else
     {
+        scancodeDown_.Erase(scancode);
+        
         if (!keyDown_.Erase(key))
             return;
     }
@@ -602,14 +650,16 @@ void Input::SetKey(int key, bool newState, unsigned raw)
 
     VariantMap& eventData = GetEventDataMap();
     eventData[P_KEY] = key;
+    eventData[P_SCANCODE] = scancode;
+    eventData[P_RAW] = raw;
     eventData[P_BUTTONS] = mouseButtonDown_;
     eventData[P_QUALIFIERS] = GetQualifiers();
-    eventData[P_RAW] = raw;
     if (newState)
         eventData[P_REPEAT] = repeat;
     SendEvent(newState ? E_KEYDOWN : E_KEYUP, eventData);
 
-    if ((key == KEY_RETURN || key == KEY_RETURN2 || key == KEY_KP_ENTER) && newState && !repeat && toggleFullscreen_ && (GetKeyDown(KEY_LALT) || GetKeyDown(KEY_RALT)))
+    if ((key == KEY_RETURN || key == KEY_RETURN2 || key == KEY_KP_ENTER) && newState && !repeat && toggleFullscreen_ &&
+        (GetKeyDown(KEY_LALT) || GetKeyDown(KEY_RALT)))
         graphics_->ToggleFullscreen();
 }
 
@@ -649,11 +699,11 @@ void Input::HandleSDLEvent(void* sdlEvent)
     {
     case SDL_KEYDOWN:
         // Convert to uppercase to match Win32 virtual key codes
-        SetKey(ConvertSDLKeyCode(evt.key.keysym.sym, evt.key.keysym.scancode), true, evt.key.keysym.raw);
+        SetKey(ConvertSDLKeyCode(evt.key.keysym.sym, evt.key.keysym.scancode), evt.key.keysym.scancode, evt.key.keysym.raw, true);
         break;
 
     case SDL_KEYUP:
-        SetKey(ConvertSDLKeyCode(evt.key.keysym.sym, evt.key.keysym.scancode), false, evt.key.keysym.raw);
+        SetKey(ConvertSDLKeyCode(evt.key.keysym.sym, evt.key.keysym.scancode), evt.key.keysym.scancode, evt.key.keysym.raw, false);
         break;
 
     case SDL_TEXTINPUT:

+ 21 - 1
Source/Engine/Input/Input.h

@@ -141,10 +141,26 @@ public:
     /// Show or hide on-screen keyboard on platforms that support it. When shown, keypresses from it are delivered as key events.
     void SetScreenKeyboardVisible(bool enable);
     
+    /// Return keycode from key name.
+    int GetKeyFromName(const String& name) const;
+    /// Return keycode from scancode.
+    int GetKeyFromScancode(int scancode) const;
+    /// Return name of key from keycode.
+    String GetKeyName(int key) const;
+    /// Return scancode from keycode.
+    int GetScancodeFromKey(int key) const;
+    /// Return scancode from key name.
+    int GetScancodeFromName(const String& name) const;
+    /// Return name of key from scancode.
+    String GetScancodeName(int scancode) const;
     /// Check if a key is held down.
     bool GetKeyDown(int key) const;
     /// Check if a key has been pressed on this frame.
     bool GetKeyPress(int key) const;
+    /// Check if a key is held down by scancode.
+    bool GetScancodeDown(int scancode) const;
+    /// Check if a key has been pressed on this frame by scancode.
+    bool GetScancodePress(int scanode) const;
     /// Check if a mouse button is held down.
     bool GetMouseButtonDown(int button) const;
     /// Check if a mouse button has been pressed on this frame.
@@ -204,7 +220,7 @@ private:
     /// Handle a mouse button change.
     void SetMouseButton(int button, bool newState);
     /// Handle a key change.
-    void SetKey(int key, bool newState, unsigned raw);
+    void SetKey(int key, int scancode, unsigned raw, bool newState);
     /// Handle mousewheel change.
     void SetMouseWheel(int delta);
     /// Internal function to set the mouse cursor position.
@@ -222,6 +238,10 @@ private:
     HashSet<int> keyDown_;
     /// Key pressed state.
     HashSet<int> keyPress_;
+    /// Key down state by scancode.
+    HashSet<int> scancodeDown_;
+    /// Key pressed state by scancode.
+    HashSet<int> scancodePress_;
     /// Active finger touches.
     HashMap<int, TouchState> touches_;
     /// String for text input.

+ 306 - 21
Source/Engine/Input/InputEvents.h

@@ -70,19 +70,21 @@ EVENT(E_MOUSEWHEEL, MouseWheel)
 EVENT(E_KEYDOWN, KeyDown)
 {
     PARAM(P_KEY, Key);                      // int
+    PARAM(P_SCANCODE, Scancode);            // int
+    PARAM(P_RAW, Raw);                      // uint
     PARAM(P_BUTTONS, Buttons);              // int
     PARAM(P_QUALIFIERS, Qualifiers);        // int
     PARAM(P_REPEAT, Repeat);                // bool
-    PARAM(P_RAW, Raw);                      // uint
 }
 
 /// Key released.
 EVENT(E_KEYUP, KeyUp)
 {
     PARAM(P_KEY, Key);                      // int
+    PARAM(P_SCANCODE, Scancode);            // int
+    PARAM(P_RAW, Raw);                      // uint
     PARAM(P_BUTTONS, Buttons);              // int
     PARAM(P_QUALIFIERS, Qualifiers);        // int
-    PARAM(P_RAW, Raw);                      // uint
 }
 
 /// Character typed on the keyboard.
@@ -206,6 +208,42 @@ static const int QUAL_CTRL = 2;
 static const int QUAL_ALT = 4;
 static const int QUAL_ANY = 8;
 
+static const int KEY_A = 'A';
+static const int KEY_B = 'B';
+static const int KEY_C = 'C';
+static const int KEY_D = 'D';
+static const int KEY_E = 'E';
+static const int KEY_F = 'F';
+static const int KEY_G = 'G';
+static const int KEY_H = 'H';
+static const int KEY_I = 'I';
+static const int KEY_J = 'J';
+static const int KEY_K = 'K';
+static const int KEY_L = 'L';
+static const int KEY_M = 'M';
+static const int KEY_N = 'N';
+static const int KEY_O = 'O';
+static const int KEY_P = 'P';
+static const int KEY_Q = 'Q';
+static const int KEY_R = 'R';
+static const int KEY_S = 'S';
+static const int KEY_T = 'T';
+static const int KEY_U = 'U';
+static const int KEY_V = 'V';
+static const int KEY_W = 'W';
+static const int KEY_X = 'X';
+static const int KEY_Y = 'Y';
+static const int KEY_Z = 'Z';
+static const int KEY_0 = '0';
+static const int KEY_1 = '1';
+static const int KEY_2 = '2';
+static const int KEY_3 = '3';
+static const int KEY_4 = '4';
+static const int KEY_5 = '5';
+static const int KEY_6 = '6';
+static const int KEY_7 = '7';
+static const int KEY_8 = '8';
+static const int KEY_9 = '9';
 static const int KEY_BACKSPACE = SDLK_BACKSPACE;
 static const int KEY_TAB = SDLK_TAB;
 static const int KEY_RETURN = SDLK_RETURN;
@@ -214,6 +252,7 @@ static const int KEY_KP_ENTER = SDLK_KP_ENTER;
 static const int KEY_SHIFT = SDLK_LSHIFT;
 static const int KEY_CTRL = SDLK_LCTRL;
 static const int KEY_ALT = SDLK_LALT;
+static const int KEY_GUI = SDLK_LGUI;
 static const int KEY_PAUSE = SDLK_PAUSE;
 static const int KEY_CAPSLOCK = SDLK_CAPSLOCK;
 static const int KEY_ESC = SDLK_ESCAPE;
@@ -230,24 +269,24 @@ static const int KEY_SELECT = SDLK_SELECT;
 static const int KEY_PRINTSCREEN = SDLK_PRINTSCREEN;
 static const int KEY_INSERT = SDLK_INSERT;
 static const int KEY_DELETE = SDLK_DELETE;
-static const int KEY_LWIN = SDLK_LGUI;
-static const int KEY_RWIN = SDLK_RGUI;
-static const int KEY_APPS = SDLK_APPLICATION;
-static const int KEY_NUMPAD0 = SDLK_KP_0;
-static const int KEY_NUMPAD1 = SDLK_KP_1;
-static const int KEY_NUMPAD2 = SDLK_KP_2;
-static const int KEY_NUMPAD3 = SDLK_KP_3;
-static const int KEY_NUMPAD4 = SDLK_KP_4;
-static const int KEY_NUMPAD5 = SDLK_KP_5;
-static const int KEY_NUMPAD6 = SDLK_KP_6;
-static const int KEY_NUMPAD7 = SDLK_KP_7;
-static const int KEY_NUMPAD8 = SDLK_KP_8;
-static const int KEY_NUMPAD9 = SDLK_KP_9;
-static const int KEY_MULTIPLY = SDLK_KP_MULTIPLY;
-static const int KEY_ADD = SDLK_KP_PLUS;
-static const int KEY_SUBTRACT = SDLK_KP_MINUS;
-static const int KEY_DECIMAL = SDLK_KP_PERIOD;
-static const int KEY_DIVIDE = SDLK_KP_DIVIDE;
+static const int KEY_LGUI = SDLK_LGUI;
+static const int KEY_RGUI = SDLK_RGUI;
+static const int KEY_APPLICATION = SDLK_APPLICATION;
+static const int KEY_KP_0 = SDLK_KP_0;
+static const int KEY_KP_1 = SDLK_KP_1;
+static const int KEY_KP_2 = SDLK_KP_2;
+static const int KEY_KP_3 = SDLK_KP_3;
+static const int KEY_KP_4 = SDLK_KP_4;
+static const int KEY_KP_5 = SDLK_KP_5;
+static const int KEY_KP_6 = SDLK_KP_6;
+static const int KEY_KP_7 = SDLK_KP_7;
+static const int KEY_KP_8 = SDLK_KP_8;
+static const int KEY_KP_9 = SDLK_KP_9;
+static const int KEY_KP_MULTIPLY = SDLK_KP_MULTIPLY;
+static const int KEY_KP_PLUS = SDLK_KP_PLUS;
+static const int KEY_KP_MINUS = SDLK_KP_MINUS;
+static const int KEY_KP_PERIOD = SDLK_KP_PERIOD;
+static const int KEY_KP_DIVIDE = SDLK_KP_DIVIDE;
 static const int KEY_F1 = SDLK_F1;
 static const int KEY_F2 = SDLK_F2;
 static const int KEY_F3 = SDLK_F3;
@@ -272,7 +311,7 @@ static const int KEY_F21 = SDLK_F21;
 static const int KEY_F22 = SDLK_F22;
 static const int KEY_F23 = SDLK_F23;
 static const int KEY_F24 = SDLK_F24;
-static const int KEY_NUMLOCK = SDLK_NUMLOCKCLEAR;
+static const int KEY_NUMLOCKCLEAR = SDLK_NUMLOCKCLEAR;
 static const int KEY_SCROLLLOCK = SDLK_SCROLLLOCK;
 static const int KEY_LSHIFT = SDLK_LSHIFT;
 static const int KEY_RSHIFT = SDLK_RSHIFT;
@@ -281,6 +320,252 @@ static const int KEY_RCTRL = SDLK_RCTRL;
 static const int KEY_LALT = SDLK_LALT;
 static const int KEY_RALT = SDLK_RALT;
 
+static const int SCANCODE_UNKNOWN = SDL_SCANCODE_UNKNOWN;
+static const int SCANCODE_CTRL = SDL_SCANCODE_LCTRL;
+static const int SCANCODE_SHIFT = SDL_SCANCODE_LSHIFT;
+static const int SCANCODE_ALT = SDL_SCANCODE_LALT;
+static const int SCANCODE_GUI = SDL_SCANCODE_LGUI;
+static const int SCANCODE_A = SDL_SCANCODE_A;
+static const int SCANCODE_B = SDL_SCANCODE_B;
+static const int SCANCODE_C = SDL_SCANCODE_C;
+static const int SCANCODE_D = SDL_SCANCODE_D;
+static const int SCANCODE_E = SDL_SCANCODE_E;
+static const int SCANCODE_F = SDL_SCANCODE_F;
+static const int SCANCODE_G = SDL_SCANCODE_G;
+static const int SCANCODE_H = SDL_SCANCODE_H;
+static const int SCANCODE_I = SDL_SCANCODE_I;
+static const int SCANCODE_J = SDL_SCANCODE_J;
+static const int SCANCODE_K = SDL_SCANCODE_K;
+static const int SCANCODE_L = SDL_SCANCODE_L;
+static const int SCANCODE_M = SDL_SCANCODE_M;
+static const int SCANCODE_N = SDL_SCANCODE_N;
+static const int SCANCODE_O = SDL_SCANCODE_O;
+static const int SCANCODE_P = SDL_SCANCODE_P;
+static const int SCANCODE_Q = SDL_SCANCODE_Q;
+static const int SCANCODE_R = SDL_SCANCODE_R;
+static const int SCANCODE_S = SDL_SCANCODE_S;
+static const int SCANCODE_T = SDL_SCANCODE_T;
+static const int SCANCODE_U = SDL_SCANCODE_U;
+static const int SCANCODE_V = SDL_SCANCODE_V;
+static const int SCANCODE_W = SDL_SCANCODE_W;
+static const int SCANCODE_X = SDL_SCANCODE_X;
+static const int SCANCODE_Y = SDL_SCANCODE_Y;
+static const int SCANCODE_Z = SDL_SCANCODE_Z;
+static const int SCANCODE_1 = SDL_SCANCODE_1;
+static const int SCANCODE_2 = SDL_SCANCODE_2;
+static const int SCANCODE_3 = SDL_SCANCODE_3;
+static const int SCANCODE_4 = SDL_SCANCODE_4;
+static const int SCANCODE_5 = SDL_SCANCODE_5;
+static const int SCANCODE_6 = SDL_SCANCODE_6;
+static const int SCANCODE_7 = SDL_SCANCODE_7;
+static const int SCANCODE_8 = SDL_SCANCODE_8;
+static const int SCANCODE_9 = SDL_SCANCODE_9;
+static const int SCANCODE_0 = SDL_SCANCODE_0;
+static const int SCANCODE_RETURN = SDL_SCANCODE_RETURN;
+static const int SCANCODE_ESCAPE = SDL_SCANCODE_ESCAPE;
+static const int SCANCODE_BACKSPACE = SDL_SCANCODE_BACKSPACE;
+static const int SCANCODE_TAB = SDL_SCANCODE_TAB;
+static const int SCANCODE_SPACE = SDL_SCANCODE_SPACE;
+static const int SCANCODE_MINUS = SDL_SCANCODE_MINUS;
+static const int SCANCODE_EQUALS = SDL_SCANCODE_EQUALS;
+static const int SCANCODE_LEFTBRACKET = SDL_SCANCODE_LEFTBRACKET;
+static const int SCANCODE_RIGHTBRACKET = SDL_SCANCODE_RIGHTBRACKET;
+static const int SCANCODE_BACKSLASH = SDL_SCANCODE_BACKSLASH;
+static const int SCANCODE_NONUSHASH = SDL_SCANCODE_NONUSHASH;
+static const int SCANCODE_SEMICOLON = SDL_SCANCODE_SEMICOLON;
+static const int SCANCODE_APOSTROPHE = SDL_SCANCODE_APOSTROPHE;
+static const int SCANCODE_GRAVE = SDL_SCANCODE_GRAVE;
+static const int SCANCODE_COMMA = SDL_SCANCODE_COMMA;
+static const int SCANCODE_PERIOD = SDL_SCANCODE_PERIOD;
+static const int SCANCODE_SLASH = SDL_SCANCODE_SLASH;
+static const int SCANCODE_CAPSLOCK = SDL_SCANCODE_CAPSLOCK;
+static const int SCANCODE_F1 = SDL_SCANCODE_F1;
+static const int SCANCODE_F2 = SDL_SCANCODE_F2;
+static const int SCANCODE_F3 = SDL_SCANCODE_F3;
+static const int SCANCODE_F4 = SDL_SCANCODE_F4;
+static const int SCANCODE_F5 = SDL_SCANCODE_F5;
+static const int SCANCODE_F6 = SDL_SCANCODE_F6;
+static const int SCANCODE_F7 = SDL_SCANCODE_F7;
+static const int SCANCODE_F8 = SDL_SCANCODE_F8;
+static const int SCANCODE_F9 = SDL_SCANCODE_F9;
+static const int SCANCODE_F10 = SDL_SCANCODE_F10;
+static const int SCANCODE_F11 = SDL_SCANCODE_F11;
+static const int SCANCODE_F12 = SDL_SCANCODE_F12;
+static const int SCANCODE_PRINTSCREEN = SDL_SCANCODE_PRINTSCREEN;
+static const int SCANCODE_SCROLLLOCK = SDL_SCANCODE_SCROLLLOCK;
+static const int SCANCODE_PAUSE = SDL_SCANCODE_PAUSE;
+static const int SCANCODE_INSERT = SDL_SCANCODE_INSERT;
+static const int SCANCODE_HOME = SDL_SCANCODE_HOME;
+static const int SCANCODE_PAGEUP = SDL_SCANCODE_PAGEUP;
+static const int SCANCODE_DELETE = SDL_SCANCODE_DELETE;
+static const int SCANCODE_END = SDL_SCANCODE_END;
+static const int SCANCODE_PAGEDOWN = SDL_SCANCODE_PAGEDOWN;
+static const int SCANCODE_RIGHT = SDL_SCANCODE_RIGHT;
+static const int SCANCODE_LEFT = SDL_SCANCODE_LEFT;
+static const int SCANCODE_DOWN = SDL_SCANCODE_DOWN;
+static const int SCANCODE_UP = SDL_SCANCODE_UP;
+static const int SCANCODE_NUMLOCKCLEAR = SDL_SCANCODE_NUMLOCKCLEAR;
+static const int SCANCODE_KP_DIVIDE = SDL_SCANCODE_KP_DIVIDE;
+static const int SCANCODE_KP_MULTIPLY = SDL_SCANCODE_KP_MULTIPLY;
+static const int SCANCODE_KP_MINUS = SDL_SCANCODE_KP_MINUS;
+static const int SCANCODE_KP_PLUS = SDL_SCANCODE_KP_PLUS;
+static const int SCANCODE_KP_ENTER = SDL_SCANCODE_KP_ENTER;
+static const int SCANCODE_KP_1 = SDL_SCANCODE_KP_1;
+static const int SCANCODE_KP_2 = SDL_SCANCODE_KP_2;
+static const int SCANCODE_KP_3 = SDL_SCANCODE_KP_3;
+static const int SCANCODE_KP_4 = SDL_SCANCODE_KP_4;
+static const int SCANCODE_KP_5 = SDL_SCANCODE_KP_5;
+static const int SCANCODE_KP_6 = SDL_SCANCODE_KP_6;
+static const int SCANCODE_KP_7 = SDL_SCANCODE_KP_7;
+static const int SCANCODE_KP_8 = SDL_SCANCODE_KP_8;
+static const int SCANCODE_KP_9 = SDL_SCANCODE_KP_9;
+static const int SCANCODE_KP_0 = SDL_SCANCODE_KP_0;
+static const int SCANCODE_KP_PERIOD = SDL_SCANCODE_KP_PERIOD;
+static const int SCANCODE_NONUSBACKSLASH = SDL_SCANCODE_NONUSBACKSLASH;
+static const int SCANCODE_APPLICATION = SDL_SCANCODE_APPLICATION;
+static const int SCANCODE_POWER = SDL_SCANCODE_POWER;
+static const int SCANCODE_KP_EQUALS = SDL_SCANCODE_KP_EQUALS;
+static const int SCANCODE_F13 = SDL_SCANCODE_F13;
+static const int SCANCODE_F14 = SDL_SCANCODE_F14;
+static const int SCANCODE_F15 = SDL_SCANCODE_F15;
+static const int SCANCODE_F16 = SDL_SCANCODE_F16;
+static const int SCANCODE_F17 = SDL_SCANCODE_F17;
+static const int SCANCODE_F18 = SDL_SCANCODE_F18;
+static const int SCANCODE_F19 = SDL_SCANCODE_F19;
+static const int SCANCODE_F20 = SDL_SCANCODE_F20;
+static const int SCANCODE_F21 = SDL_SCANCODE_F21;
+static const int SCANCODE_F22 = SDL_SCANCODE_F22;
+static const int SCANCODE_F23 = SDL_SCANCODE_F23;
+static const int SCANCODE_F24 = SDL_SCANCODE_F24;
+static const int SCANCODE_EXECUTE = SDL_SCANCODE_EXECUTE;
+static const int SCANCODE_HELP = SDL_SCANCODE_HELP;
+static const int SCANCODE_MENU = SDL_SCANCODE_MENU;
+static const int SCANCODE_SELECT = SDL_SCANCODE_SELECT;
+static const int SCANCODE_STOP = SDL_SCANCODE_STOP;
+static const int SCANCODE_AGAIN = SDL_SCANCODE_AGAIN;
+static const int SCANCODE_UNDO = SDL_SCANCODE_UNDO;
+static const int SCANCODE_CUT = SDL_SCANCODE_CUT;
+static const int SCANCODE_COPY = SDL_SCANCODE_COPY;
+static const int SCANCODE_PASTE = SDL_SCANCODE_PASTE;
+static const int SCANCODE_FIND = SDL_SCANCODE_FIND;
+static const int SCANCODE_MUTE = SDL_SCANCODE_MUTE;
+static const int SCANCODE_VOLUMEUP = SDL_SCANCODE_VOLUMEUP;
+static const int SCANCODE_VOLUMEDOWN = SDL_SCANCODE_VOLUMEDOWN;
+static const int SCANCODE_KP_COMMA = SDL_SCANCODE_KP_COMMA;
+static const int SCANCODE_KP_EQUALSAS400 = SDL_SCANCODE_KP_EQUALSAS400;
+static const int SCANCODE_INTERNATIONAL1 = SDL_SCANCODE_INTERNATIONAL1;
+static const int SCANCODE_INTERNATIONAL2 = SDL_SCANCODE_INTERNATIONAL2;
+static const int SCANCODE_INTERNATIONAL3 = SDL_SCANCODE_INTERNATIONAL3;
+static const int SCANCODE_INTERNATIONAL4 = SDL_SCANCODE_INTERNATIONAL4;
+static const int SCANCODE_INTERNATIONAL5 = SDL_SCANCODE_INTERNATIONAL5;
+static const int SCANCODE_INTERNATIONAL6 = SDL_SCANCODE_INTERNATIONAL6;
+static const int SCANCODE_INTERNATIONAL7 = SDL_SCANCODE_INTERNATIONAL7;
+static const int SCANCODE_INTERNATIONAL8 = SDL_SCANCODE_INTERNATIONAL8;
+static const int SCANCODE_INTERNATIONAL9 = SDL_SCANCODE_INTERNATIONAL9;
+static const int SCANCODE_LANG1 = SDL_SCANCODE_LANG1;
+static const int SCANCODE_LANG2 = SDL_SCANCODE_LANG2;
+static const int SCANCODE_LANG3 = SDL_SCANCODE_LANG3;
+static const int SCANCODE_LANG4 = SDL_SCANCODE_LANG4;
+static const int SCANCODE_LANG5 = SDL_SCANCODE_LANG5;
+static const int SCANCODE_LANG6 = SDL_SCANCODE_LANG6;
+static const int SCANCODE_LANG7 = SDL_SCANCODE_LANG7;
+static const int SCANCODE_LANG8 = SDL_SCANCODE_LANG8;
+static const int SCANCODE_LANG9 = SDL_SCANCODE_LANG9;
+static const int SCANCODE_ALTERASE = SDL_SCANCODE_ALTERASE;
+static const int SCANCODE_SYSREQ = SDL_SCANCODE_SYSREQ;
+static const int SCANCODE_CANCEL = SDL_SCANCODE_CANCEL;
+static const int SCANCODE_CLEAR = SDL_SCANCODE_CLEAR;
+static const int SCANCODE_PRIOR = SDL_SCANCODE_PRIOR;
+static const int SCANCODE_RETURN2 = SDL_SCANCODE_RETURN2;
+static const int SCANCODE_SEPARATOR = SDL_SCANCODE_SEPARATOR;
+static const int SCANCODE_OUT = SDL_SCANCODE_OUT;
+static const int SCANCODE_OPER = SDL_SCANCODE_OPER;
+static const int SCANCODE_CLEARAGAIN = SDL_SCANCODE_CLEARAGAIN;
+static const int SCANCODE_CRSEL = SDL_SCANCODE_CRSEL;
+static const int SCANCODE_EXSEL = SDL_SCANCODE_EXSEL;
+static const int SCANCODE_KP_00 = SDL_SCANCODE_KP_00;
+static const int SCANCODE_KP_000 = SDL_SCANCODE_KP_000;
+static const int SCANCODE_THOUSANDSSEPARATOR = SDL_SCANCODE_THOUSANDSSEPARATOR;
+static const int SCANCODE_DECIMALSEPARATOR = SDL_SCANCODE_DECIMALSEPARATOR;
+static const int SCANCODE_CURRENCYUNIT = SDL_SCANCODE_CURRENCYUNIT;
+static const int SCANCODE_CURRENCYSUBUNIT = SDL_SCANCODE_CURRENCYSUBUNIT;
+static const int SCANCODE_KP_LEFTPAREN = SDL_SCANCODE_KP_LEFTPAREN;
+static const int SCANCODE_KP_RIGHTPAREN = SDL_SCANCODE_KP_RIGHTPAREN;
+static const int SCANCODE_KP_LEFTBRACE = SDL_SCANCODE_KP_LEFTBRACE;
+static const int SCANCODE_KP_RIGHTBRACE = SDL_SCANCODE_KP_RIGHTBRACE;
+static const int SCANCODE_KP_TAB = SDL_SCANCODE_KP_TAB;
+static const int SCANCODE_KP_BACKSPACE = SDL_SCANCODE_KP_BACKSPACE;
+static const int SCANCODE_KP_A = SDL_SCANCODE_KP_A;
+static const int SCANCODE_KP_B = SDL_SCANCODE_KP_B;
+static const int SCANCODE_KP_C = SDL_SCANCODE_KP_C;
+static const int SCANCODE_KP_D = SDL_SCANCODE_KP_D;
+static const int SCANCODE_KP_E = SDL_SCANCODE_KP_E;
+static const int SCANCODE_KP_F = SDL_SCANCODE_KP_F;
+static const int SCANCODE_KP_XOR = SDL_SCANCODE_KP_XOR;
+static const int SCANCODE_KP_POWER = SDL_SCANCODE_KP_POWER;
+static const int SCANCODE_KP_PERCENT = SDL_SCANCODE_KP_PERCENT;
+static const int SCANCODE_KP_LESS = SDL_SCANCODE_KP_LESS;
+static const int SCANCODE_KP_GREATER = SDL_SCANCODE_KP_GREATER;
+static const int SCANCODE_KP_AMPERSAND = SDL_SCANCODE_KP_AMPERSAND;
+static const int SCANCODE_KP_DBLAMPERSAND = SDL_SCANCODE_KP_DBLAMPERSAND;
+static const int SCANCODE_KP_VERTICALBAR = SDL_SCANCODE_KP_VERTICALBAR;
+static const int SCANCODE_KP_DBLVERTICALBAR = SDL_SCANCODE_KP_DBLVERTICALBAR;
+static const int SCANCODE_KP_COLON = SDL_SCANCODE_KP_COLON;
+static const int SCANCODE_KP_HASH = SDL_SCANCODE_KP_HASH;
+static const int SCANCODE_KP_SPACE = SDL_SCANCODE_KP_SPACE;
+static const int SCANCODE_KP_AT = SDL_SCANCODE_KP_AT;
+static const int SCANCODE_KP_EXCLAM = SDL_SCANCODE_KP_EXCLAM;
+static const int SCANCODE_KP_MEMSTORE = SDL_SCANCODE_KP_MEMSTORE;
+static const int SCANCODE_KP_MEMRECALL = SDL_SCANCODE_KP_MEMRECALL;
+static const int SCANCODE_KP_MEMCLEAR = SDL_SCANCODE_KP_MEMCLEAR;
+static const int SCANCODE_KP_MEMADD = SDL_SCANCODE_KP_MEMADD;
+static const int SCANCODE_KP_MEMSUBTRACT = SDL_SCANCODE_KP_MEMSUBTRACT;
+static const int SCANCODE_KP_MEMMULTIPLY = SDL_SCANCODE_KP_MEMMULTIPLY;
+static const int SCANCODE_KP_MEMDIVIDE = SDL_SCANCODE_KP_MEMDIVIDE;
+static const int SCANCODE_KP_PLUSMINUS = SDL_SCANCODE_KP_PLUSMINUS;
+static const int SCANCODE_KP_CLEAR = SDL_SCANCODE_KP_CLEAR;
+static const int SCANCODE_KP_CLEARENTRY = SDL_SCANCODE_KP_CLEARENTRY;
+static const int SCANCODE_KP_BINARY = SDL_SCANCODE_KP_BINARY;
+static const int SCANCODE_KP_OCTAL = SDL_SCANCODE_KP_OCTAL;
+static const int SCANCODE_KP_DECIMAL = SDL_SCANCODE_KP_DECIMAL;
+static const int SCANCODE_KP_HEXADECIMAL = SDL_SCANCODE_KP_HEXADECIMAL;
+static const int SCANCODE_LCTRL = SDL_SCANCODE_LCTRL;
+static const int SCANCODE_LSHIFT = SDL_SCANCODE_LSHIFT;
+static const int SCANCODE_LALT = SDL_SCANCODE_LALT;
+static const int SCANCODE_LGUI = SDL_SCANCODE_LGUI;
+static const int SCANCODE_RCTRL = SDL_SCANCODE_RCTRL;
+static const int SCANCODE_RSHIFT = SDL_SCANCODE_RSHIFT;
+static const int SCANCODE_RALT = SDL_SCANCODE_RALT;
+static const int SCANCODE_RGUI = SDL_SCANCODE_RGUI;
+static const int SCANCODE_MODE = SDL_SCANCODE_MODE;
+static const int SCANCODE_AUDIONEXT = SDL_SCANCODE_AUDIONEXT;
+static const int SCANCODE_AUDIOPREV = SDL_SCANCODE_AUDIOPREV;
+static const int SCANCODE_AUDIOSTOP = SDL_SCANCODE_AUDIOSTOP;
+static const int SCANCODE_AUDIOPLAY = SDL_SCANCODE_AUDIOPLAY;
+static const int SCANCODE_AUDIOMUTE = SDL_SCANCODE_AUDIOMUTE;
+static const int SCANCODE_MEDIASELECT = SDL_SCANCODE_MEDIASELECT;
+static const int SCANCODE_WWW = SDL_SCANCODE_WWW;
+static const int SCANCODE_MAIL = SDL_SCANCODE_MAIL;
+static const int SCANCODE_CALCULATOR = SDL_SCANCODE_CALCULATOR;
+static const int SCANCODE_COMPUTER = SDL_SCANCODE_COMPUTER;
+static const int SCANCODE_AC_SEARCH = SDL_SCANCODE_AC_SEARCH;
+static const int SCANCODE_AC_HOME = SDL_SCANCODE_AC_HOME;
+static const int SCANCODE_AC_BACK = SDL_SCANCODE_AC_BACK;
+static const int SCANCODE_AC_FORWARD = SDL_SCANCODE_AC_FORWARD;
+static const int SCANCODE_AC_STOP = SDL_SCANCODE_AC_STOP;
+static const int SCANCODE_AC_REFRESH = SDL_SCANCODE_AC_REFRESH;
+static const int SCANCODE_AC_BOOKMARKS = SDL_SCANCODE_AC_BOOKMARKS;
+static const int SCANCODE_BRIGHTNESSDOWN = SDL_SCANCODE_BRIGHTNESSDOWN;
+static const int SCANCODE_BRIGHTNESSUP = SDL_SCANCODE_BRIGHTNESSUP;
+static const int SCANCODE_DISPLAYSWITCH = SDL_SCANCODE_DISPLAYSWITCH;
+static const int SCANCODE_KBDILLUMTOGGLE = SDL_SCANCODE_KBDILLUMTOGGLE;
+static const int SCANCODE_KBDILLUMDOWN = SDL_SCANCODE_KBDILLUMDOWN;
+static const int SCANCODE_KBDILLUMUP = SDL_SCANCODE_KBDILLUMUP;
+static const int SCANCODE_EJECT = SDL_SCANCODE_EJECT;
+static const int SCANCODE_SLEEP = SDL_SCANCODE_SLEEP;
+static const int SCANCODE_APP1 = SDL_SCANCODE_APP1;
+static const int SCANCODE_APP2 = SDL_SCANCODE_APP2;
+
 static const int HAT_CENTER = SDL_HAT_CENTERED;
 static const int HAT_UP = SDL_HAT_UP;
 static const int HAT_RIGHT = SDL_HAT_RIGHT;

+ 8 - 0
Source/Engine/LuaScript/pkgs/Input/Input.pkg

@@ -34,8 +34,16 @@ class Input : public Object
     bool DetectJoysticks();
     void SetScreenKeyboardVisible(bool enable);
 
+    int GetKeyFromName(const String name) const;
+    int GetKeyFromScancode(int scancode) const;
+    String GetKeyName(int key) const;
+    int GetScancodeFromKey(int key) const;
+    int GetScancodeFromName(const String name) const;
+    String GetScancodeName(int scancode) const;
     bool GetKeyDown(int key) const;
     bool GetKeyPress(int key) const;
+    bool GetScancodeDown(int scancode) const;
+    bool GetScancodePress(int scancode) const;
     bool GetMouseButtonDown(int button) const;
     bool GetMouseButtonPress(int button) const;
     bool GetQualifierDown(int qualifier) const;

+ 276 - 69
Source/Engine/LuaScript/pkgs/Input/InputEvents.pkg

@@ -9,16 +9,6 @@ static const int QUAL_CTRL;
 static const int QUAL_ALT;
 static const int QUAL_ANY;
 
-static const int KEY_1;
-static const int KEY_2;
-static const int KEY_3;
-static const int KEY_4;
-static const int KEY_5;
-static const int KEY_6;
-static const int KEY_7;
-static const int KEY_8;
-static const int KEY_9;
-static const int KEY_0;
 static const int KEY_A;
 static const int KEY_B;
 static const int KEY_C;
@@ -45,7 +35,16 @@ static const int KEY_W;
 static const int KEY_X;
 static const int KEY_Y;
 static const int KEY_Z;
-
+static const int KEY_0;
+static const int KEY_1;
+static const int KEY_2;
+static const int KEY_3;
+static const int KEY_4;
+static const int KEY_5;
+static const int KEY_6;
+static const int KEY_7;
+static const int KEY_8;
+static const int KEY_9;
 static const int KEY_BACKSPACE;
 static const int KEY_TAB;
 static const int KEY_RETURN;
@@ -54,6 +53,7 @@ static const int KEY_KP_ENTER;
 static const int KEY_SHIFT;
 static const int KEY_CTRL;
 static const int KEY_ALT;
+static const int KEY_GUI;
 static const int KEY_PAUSE;
 static const int KEY_CAPSLOCK;
 static const int KEY_ESC;
@@ -70,24 +70,24 @@ static const int KEY_SELECT;
 static const int KEY_PRINTSCREEN;
 static const int KEY_INSERT;
 static const int KEY_DELETE;
-static const int KEY_LWIN;
-static const int KEY_RWIN;
-static const int KEY_APPS;
-static const int KEY_NUMPAD0;
-static const int KEY_NUMPAD1;
-static const int KEY_NUMPAD2;
-static const int KEY_NUMPAD3;
-static const int KEY_NUMPAD4;
-static const int KEY_NUMPAD5;
-static const int KEY_NUMPAD6;
-static const int KEY_NUMPAD7;
-static const int KEY_NUMPAD8;
-static const int KEY_NUMPAD9;
-static const int KEY_MULTIPLY;
-static const int KEY_ADD;
-static const int KEY_SUBTRACT;
-static const int KEY_DECIMAL;
-static const int KEY_DIVIDE;
+static const int KEY_LGUI;
+static const int KEY_RGUI;
+static const int KEY_APPLICATION;
+static const int KEY_KP_0;
+static const int KEY_KP_1;
+static const int KEY_KP_2;
+static const int KEY_KP_3;
+static const int KEY_KP_4;
+static const int KEY_KP_5;
+static const int KEY_KP_6;
+static const int KEY_KP_7;
+static const int KEY_KP_8;
+static const int KEY_KP_9;
+static const int KEY_KP_MULTIPLY;
+static const int KEY_KP_PLUS;
+static const int KEY_KP_MINUS;
+static const int KEY_KP_PERIOD;
+static const int KEY_KP_DIVIDE;
 static const int KEY_F1;
 static const int KEY_F2;
 static const int KEY_F3;
@@ -112,7 +112,7 @@ static const int KEY_F21;
 static const int KEY_F22;
 static const int KEY_F23;
 static const int KEY_F24;
-static const int KEY_NUMLOCK;
+static const int KEY_NUMLOCKCLEAR;
 static const int KEY_SCROLLLOCK;
 static const int KEY_LSHIFT;
 static const int KEY_RSHIFT;
@@ -121,6 +121,252 @@ static const int KEY_RCTRL;
 static const int KEY_LALT;
 static const int KEY_RALT;
 
+static const int SCANCODE_UNKNOWN;
+static const int SCANCODE_CTRL;
+static const int SCANCODE_SHIFT;
+static const int SCANCODE_ALT;
+static const int SCANCODE_GUI;
+static const int SCANCODE_A;
+static const int SCANCODE_B;
+static const int SCANCODE_C;
+static const int SCANCODE_D;
+static const int SCANCODE_E;
+static const int SCANCODE_F;
+static const int SCANCODE_G;
+static const int SCANCODE_H;
+static const int SCANCODE_I;
+static const int SCANCODE_J;
+static const int SCANCODE_K;
+static const int SCANCODE_L;
+static const int SCANCODE_M;
+static const int SCANCODE_N;
+static const int SCANCODE_O;
+static const int SCANCODE_P;
+static const int SCANCODE_Q;
+static const int SCANCODE_R;
+static const int SCANCODE_S;
+static const int SCANCODE_T;
+static const int SCANCODE_U;
+static const int SCANCODE_V;
+static const int SCANCODE_W;
+static const int SCANCODE_X;
+static const int SCANCODE_Y;
+static const int SCANCODE_Z;
+static const int SCANCODE_1;
+static const int SCANCODE_2;
+static const int SCANCODE_3;
+static const int SCANCODE_4;
+static const int SCANCODE_5;
+static const int SCANCODE_6;
+static const int SCANCODE_7;
+static const int SCANCODE_8;
+static const int SCANCODE_9;
+static const int SCANCODE_0;
+static const int SCANCODE_RETURN;
+static const int SCANCODE_ESCAPE;
+static const int SCANCODE_BACKSPACE;
+static const int SCANCODE_TAB;
+static const int SCANCODE_SPACE;
+static const int SCANCODE_MINUS;
+static const int SCANCODE_EQUALS;
+static const int SCANCODE_LEFTBRACKET;
+static const int SCANCODE_RIGHTBRACKET;
+static const int SCANCODE_BACKSLASH;
+static const int SCANCODE_NONUSHASH;
+static const int SCANCODE_SEMICOLON;
+static const int SCANCODE_APOSTROPHE;
+static const int SCANCODE_GRAVE;
+static const int SCANCODE_COMMA;
+static const int SCANCODE_PERIOD;
+static const int SCANCODE_SLASH;
+static const int SCANCODE_CAPSLOCK;
+static const int SCANCODE_F1;
+static const int SCANCODE_F2;
+static const int SCANCODE_F3;
+static const int SCANCODE_F4;
+static const int SCANCODE_F5;
+static const int SCANCODE_F6;
+static const int SCANCODE_F7;
+static const int SCANCODE_F8;
+static const int SCANCODE_F9;
+static const int SCANCODE_F10;
+static const int SCANCODE_F11;
+static const int SCANCODE_F12;
+static const int SCANCODE_PRINTSCREEN;
+static const int SCANCODE_SCROLLLOCK;
+static const int SCANCODE_PAUSE;
+static const int SCANCODE_INSERT;
+static const int SCANCODE_HOME;
+static const int SCANCODE_PAGEUP;
+static const int SCANCODE_DELETE;
+static const int SCANCODE_END;
+static const int SCANCODE_PAGEDOWN;
+static const int SCANCODE_RIGHT;
+static const int SCANCODE_LEFT;
+static const int SCANCODE_DOWN;
+static const int SCANCODE_UP;
+static const int SCANCODE_NUMLOCKCLEAR;
+static const int SCANCODE_KP_DIVIDE;
+static const int SCANCODE_KP_MULTIPLY;
+static const int SCANCODE_KP_MINUS;
+static const int SCANCODE_KP_PLUS;
+static const int SCANCODE_KP_ENTER;
+static const int SCANCODE_KP_1;
+static const int SCANCODE_KP_2;
+static const int SCANCODE_KP_3;
+static const int SCANCODE_KP_4;
+static const int SCANCODE_KP_5;
+static const int SCANCODE_KP_6;
+static const int SCANCODE_KP_7;
+static const int SCANCODE_KP_8;
+static const int SCANCODE_KP_9;
+static const int SCANCODE_KP_0;
+static const int SCANCODE_KP_PERIOD;
+static const int SCANCODE_NONUSBACKSLASH;
+static const int SCANCODE_APPLICATION;
+static const int SCANCODE_POWER;
+static const int SCANCODE_KP_EQUALS;
+static const int SCANCODE_F13;
+static const int SCANCODE_F14;
+static const int SCANCODE_F15;
+static const int SCANCODE_F16;
+static const int SCANCODE_F17;
+static const int SCANCODE_F18;
+static const int SCANCODE_F19;
+static const int SCANCODE_F20;
+static const int SCANCODE_F21;
+static const int SCANCODE_F22;
+static const int SCANCODE_F23;
+static const int SCANCODE_F24;
+static const int SCANCODE_EXECUTE;
+static const int SCANCODE_HELP;
+static const int SCANCODE_MENU;
+static const int SCANCODE_SELECT;
+static const int SCANCODE_STOP;
+static const int SCANCODE_AGAIN;
+static const int SCANCODE_UNDO;
+static const int SCANCODE_CUT;
+static const int SCANCODE_COPY;
+static const int SCANCODE_PASTE;
+static const int SCANCODE_FIND;
+static const int SCANCODE_MUTE;
+static const int SCANCODE_VOLUMEUP;
+static const int SCANCODE_VOLUMEDOWN;
+static const int SCANCODE_KP_COMMA;
+static const int SCANCODE_KP_EQUALSAS400;
+static const int SCANCODE_INTERNATIONAL1;
+static const int SCANCODE_INTERNATIONAL2;
+static const int SCANCODE_INTERNATIONAL3;
+static const int SCANCODE_INTERNATIONAL4;
+static const int SCANCODE_INTERNATIONAL5;
+static const int SCANCODE_INTERNATIONAL6;
+static const int SCANCODE_INTERNATIONAL7;
+static const int SCANCODE_INTERNATIONAL8;
+static const int SCANCODE_INTERNATIONAL9;
+static const int SCANCODE_LANG1;
+static const int SCANCODE_LANG2;
+static const int SCANCODE_LANG3;
+static const int SCANCODE_LANG4;
+static const int SCANCODE_LANG5;
+static const int SCANCODE_LANG6;
+static const int SCANCODE_LANG7;
+static const int SCANCODE_LANG8;
+static const int SCANCODE_LANG9;
+static const int SCANCODE_ALTERASE;
+static const int SCANCODE_SYSREQ;
+static const int SCANCODE_CANCEL;
+static const int SCANCODE_CLEAR;
+static const int SCANCODE_PRIOR;
+static const int SCANCODE_RETURN2;
+static const int SCANCODE_SEPARATOR;
+static const int SCANCODE_OUT;
+static const int SCANCODE_OPER;
+static const int SCANCODE_CLEARAGAIN;
+static const int SCANCODE_CRSEL;
+static const int SCANCODE_EXSEL;
+static const int SCANCODE_KP_00;
+static const int SCANCODE_KP_000;
+static const int SCANCODE_THOUSANDSSEPARATOR;
+static const int SCANCODE_DECIMALSEPARATOR;
+static const int SCANCODE_CURRENCYUNIT;
+static const int SCANCODE_CURRENCYSUBUNIT;
+static const int SCANCODE_KP_LEFTPAREN;
+static const int SCANCODE_KP_RIGHTPAREN;
+static const int SCANCODE_KP_LEFTBRACE;
+static const int SCANCODE_KP_RIGHTBRACE;
+static const int SCANCODE_KP_TAB;
+static const int SCANCODE_KP_BACKSPACE;
+static const int SCANCODE_KP_A;
+static const int SCANCODE_KP_B;
+static const int SCANCODE_KP_C;
+static const int SCANCODE_KP_D;
+static const int SCANCODE_KP_E;
+static const int SCANCODE_KP_F;
+static const int SCANCODE_KP_XOR;
+static const int SCANCODE_KP_POWER;
+static const int SCANCODE_KP_PERCENT;
+static const int SCANCODE_KP_LESS;
+static const int SCANCODE_KP_GREATER;
+static const int SCANCODE_KP_AMPERSAND;
+static const int SCANCODE_KP_DBLAMPERSAND;
+static const int SCANCODE_KP_VERTICALBAR;
+static const int SCANCODE_KP_DBLVERTICALBAR;
+static const int SCANCODE_KP_COLON;
+static const int SCANCODE_KP_HASH;
+static const int SCANCODE_KP_SPACE;
+static const int SCANCODE_KP_AT;
+static const int SCANCODE_KP_EXCLAM;
+static const int SCANCODE_KP_MEMSTORE;
+static const int SCANCODE_KP_MEMRECALL;
+static const int SCANCODE_KP_MEMCLEAR;
+static const int SCANCODE_KP_MEMADD;
+static const int SCANCODE_KP_MEMSUBTRACT;
+static const int SCANCODE_KP_MEMMULTIPLY;
+static const int SCANCODE_KP_MEMDIVIDE;
+static const int SCANCODE_KP_PLUSMINUS;
+static const int SCANCODE_KP_CLEAR;
+static const int SCANCODE_KP_CLEARENTRY;
+static const int SCANCODE_KP_BINARY;
+static const int SCANCODE_KP_OCTAL;
+static const int SCANCODE_KP_DECIMAL;
+static const int SCANCODE_KP_HEXADECIMAL;
+static const int SCANCODE_LCTRL;
+static const int SCANCODE_LSHIFT;
+static const int SCANCODE_LALT;
+static const int SCANCODE_LGUI;
+static const int SCANCODE_RCTRL;
+static const int SCANCODE_RSHIFT;
+static const int SCANCODE_RALT;
+static const int SCANCODE_RGUI;
+static const int SCANCODE_MODE;
+static const int SCANCODE_AUDIONEXT;
+static const int SCANCODE_AUDIOPREV;
+static const int SCANCODE_AUDIOSTOP;
+static const int SCANCODE_AUDIOPLAY;
+static const int SCANCODE_AUDIOMUTE;
+static const int SCANCODE_MEDIASELECT;
+static const int SCANCODE_WWW;
+static const int SCANCODE_MAIL;
+static const int SCANCODE_CALCULATOR;
+static const int SCANCODE_COMPUTER;
+static const int SCANCODE_AC_SEARCH;
+static const int SCANCODE_AC_HOME;
+static const int SCANCODE_AC_BACK;
+static const int SCANCODE_AC_FORWARD;
+static const int SCANCODE_AC_STOP;
+static const int SCANCODE_AC_REFRESH;
+static const int SCANCODE_AC_BOOKMARKS;
+static const int SCANCODE_BRIGHTNESSDOWN;
+static const int SCANCODE_BRIGHTNESSUP;
+static const int SCANCODE_DISPLAYSWITCH;
+static const int SCANCODE_KBDILLUMTOGGLE;
+static const int SCANCODE_KBDILLUMDOWN;
+static const int SCANCODE_KBDILLUMUP;
+static const int SCANCODE_EJECT;
+static const int SCANCODE_SLEEP;
+static const int SCANCODE_APP1;
+static const int SCANCODE_APP2;
+
 static const int HAT_CENTER;
 static const int HAT_UP;
 static const int HAT_RIGHT;
@@ -149,42 +395,3 @@ static const int CONTROLLER_AXIS_RIGHTX;
 static const int CONTROLLER_AXIS_RIGHTY;
 static const int CONTROLLER_AXIS_TRIGGERLEFT;
 static const int CONTROLLER_AXIS_TRIGGERRIGHT;
-
-${
-static const int KEY_1 = '1';
-static const int KEY_2 = '2';
-static const int KEY_3 = '3';
-static const int KEY_4 = '4';
-static const int KEY_5 = '5';
-static const int KEY_6 = '6';
-static const int KEY_7 = '7';
-static const int KEY_8 = '8';
-static const int KEY_9 = '9';
-static const int KEY_0 = '0';
-static const int KEY_A = 'A';
-static const int KEY_B = 'B';
-static const int KEY_C = 'C';
-static const int KEY_D = 'D';
-static const int KEY_E = 'E';
-static const int KEY_F = 'F';
-static const int KEY_G = 'G';
-static const int KEY_H = 'H';
-static const int KEY_I = 'I';
-static const int KEY_J = 'J';
-static const int KEY_K = 'K';
-static const int KEY_L = 'L';
-static const int KEY_M = 'M';
-static const int KEY_N = 'N';
-static const int KEY_O = 'O';
-static const int KEY_P = 'P';
-static const int KEY_Q = 'Q';
-static const int KEY_R = 'R';
-static const int KEY_S = 'S';
-static const int KEY_T = 'T';
-static const int KEY_U = 'U';
-static const int KEY_V = 'V';
-static const int KEY_W = 'W';
-static const int KEY_X = 'X';
-static const int KEY_Y = 'Y';
-static const int KEY_Z = 'Z';
-$}

+ 315 - 20
Source/Engine/Script/InputAPI.cpp

@@ -33,17 +33,57 @@ void FakeReleaseRef(void* ptr);
 static void RegisterInputConstants(asIScriptEngine* engine)
 {
     engine->RegisterGlobalProperty("const int MOUSEB_LEFT", (void*)&MOUSEB_LEFT);
-    engine->RegisterGlobalProperty("const int MOUSEB_RIGHT", (void*)&MOUSEB_RIGHT);
     engine->RegisterGlobalProperty("const int MOUSEB_MIDDLE", (void*)&MOUSEB_MIDDLE);
+    engine->RegisterGlobalProperty("const int MOUSEB_RIGHT", (void*)&MOUSEB_RIGHT);
     engine->RegisterGlobalProperty("const int QUAL_SHIFT", (void*)&QUAL_SHIFT);
     engine->RegisterGlobalProperty("const int QUAL_CTRL", (void*)&QUAL_CTRL);
     engine->RegisterGlobalProperty("const int QUAL_ALT", (void*)&QUAL_ALT);
     engine->RegisterGlobalProperty("const int QUAL_ANY", (void*)&QUAL_ANY);
+    engine->RegisterGlobalProperty("const int KEY_A", (void*)&KEY_A);
+    engine->RegisterGlobalProperty("const int KEY_B", (void*)&KEY_B);
+    engine->RegisterGlobalProperty("const int KEY_C", (void*)&KEY_C);
+    engine->RegisterGlobalProperty("const int KEY_D", (void*)&KEY_D);
+    engine->RegisterGlobalProperty("const int KEY_E", (void*)&KEY_E);
+    engine->RegisterGlobalProperty("const int KEY_F", (void*)&KEY_F);
+    engine->RegisterGlobalProperty("const int KEY_G", (void*)&KEY_G);
+    engine->RegisterGlobalProperty("const int KEY_H", (void*)&KEY_H);
+    engine->RegisterGlobalProperty("const int KEY_I", (void*)&KEY_I);
+    engine->RegisterGlobalProperty("const int KEY_J", (void*)&KEY_J);
+    engine->RegisterGlobalProperty("const int KEY_K", (void*)&KEY_K);
+    engine->RegisterGlobalProperty("const int KEY_L", (void*)&KEY_L);
+    engine->RegisterGlobalProperty("const int KEY_M", (void*)&KEY_M);
+    engine->RegisterGlobalProperty("const int KEY_N", (void*)&KEY_N);
+    engine->RegisterGlobalProperty("const int KEY_O", (void*)&KEY_O);
+    engine->RegisterGlobalProperty("const int KEY_P", (void*)&KEY_P);
+    engine->RegisterGlobalProperty("const int KEY_Q", (void*)&KEY_Q);
+    engine->RegisterGlobalProperty("const int KEY_R", (void*)&KEY_R);
+    engine->RegisterGlobalProperty("const int KEY_S", (void*)&KEY_S);
+    engine->RegisterGlobalProperty("const int KEY_T", (void*)&KEY_T);
+    engine->RegisterGlobalProperty("const int KEY_U", (void*)&KEY_U);
+    engine->RegisterGlobalProperty("const int KEY_V", (void*)&KEY_V);
+    engine->RegisterGlobalProperty("const int KEY_W", (void*)&KEY_W);
+    engine->RegisterGlobalProperty("const int KEY_X", (void*)&KEY_X);
+    engine->RegisterGlobalProperty("const int KEY_Y", (void*)&KEY_Y);
+    engine->RegisterGlobalProperty("const int KEY_Z", (void*)&KEY_Z);
+    engine->RegisterGlobalProperty("const int KEY_0", (void*)&KEY_0);
+    engine->RegisterGlobalProperty("const int KEY_1", (void*)&KEY_1);
+    engine->RegisterGlobalProperty("const int KEY_2", (void*)&KEY_2);
+    engine->RegisterGlobalProperty("const int KEY_3", (void*)&KEY_3);
+    engine->RegisterGlobalProperty("const int KEY_4", (void*)&KEY_4);
+    engine->RegisterGlobalProperty("const int KEY_5", (void*)&KEY_5);
+    engine->RegisterGlobalProperty("const int KEY_6", (void*)&KEY_6);
+    engine->RegisterGlobalProperty("const int KEY_7", (void*)&KEY_7);
+    engine->RegisterGlobalProperty("const int KEY_8", (void*)&KEY_8);
+    engine->RegisterGlobalProperty("const int KEY_9", (void*)&KEY_9);
     engine->RegisterGlobalProperty("const int KEY_BACKSPACE", (void*)&KEY_BACKSPACE);
     engine->RegisterGlobalProperty("const int KEY_TAB", (void*)&KEY_TAB);
     engine->RegisterGlobalProperty("const int KEY_RETURN", (void*)&KEY_RETURN);
     engine->RegisterGlobalProperty("const int KEY_RETURN2", (void*)&KEY_RETURN2);
     engine->RegisterGlobalProperty("const int KEY_KP_ENTER", (void*)&KEY_KP_ENTER);
+    engine->RegisterGlobalProperty("const int KEY_SHIFT", (void*)&KEY_SHIFT);
+    engine->RegisterGlobalProperty("const int KEY_CTRL", (void*)&KEY_CTRL);
+    engine->RegisterGlobalProperty("const int KEY_ALT", (void*)&KEY_ALT);
+    engine->RegisterGlobalProperty("const int KEY_GUI", (void*)&KEY_GUI);
     engine->RegisterGlobalProperty("const int KEY_PAUSE", (void*)&KEY_PAUSE);
     engine->RegisterGlobalProperty("const int KEY_CAPSLOCK", (void*)&KEY_CAPSLOCK);
     engine->RegisterGlobalProperty("const int KEY_ESC", (void*)&KEY_ESC);
@@ -56,26 +96,28 @@ static void RegisterInputConstants(asIScriptEngine* engine)
     engine->RegisterGlobalProperty("const int KEY_UP", (void*)&KEY_UP);
     engine->RegisterGlobalProperty("const int KEY_RIGHT", (void*)&KEY_RIGHT);
     engine->RegisterGlobalProperty("const int KEY_DOWN", (void*)&KEY_DOWN);
+    engine->RegisterGlobalProperty("const int KEY_SELECT", (void*)&KEY_SELECT);
+    engine->RegisterGlobalProperty("const int KEY_PRINTSCREEN", (void*)&KEY_PRINTSCREEN);
     engine->RegisterGlobalProperty("const int KEY_INSERT", (void*)&KEY_INSERT);
     engine->RegisterGlobalProperty("const int KEY_DELETE", (void*)&KEY_DELETE);
-    engine->RegisterGlobalProperty("const int KEY_LWIN", (void*)&KEY_LWIN);
-    engine->RegisterGlobalProperty("const int KEY_RWIN", (void*)&KEY_RWIN);
-    engine->RegisterGlobalProperty("const int KEY_APPS", (void*)&KEY_APPS);
-    engine->RegisterGlobalProperty("const int KEY_NUMPAD0", (void*)&KEY_NUMPAD0);
-    engine->RegisterGlobalProperty("const int KEY_NUMPAD1", (void*)&KEY_NUMPAD1);
-    engine->RegisterGlobalProperty("const int KEY_NUMPAD2", (void*)&KEY_NUMPAD2);
-    engine->RegisterGlobalProperty("const int KEY_NUMPAD3", (void*)&KEY_NUMPAD3);
-    engine->RegisterGlobalProperty("const int KEY_NUMPAD4", (void*)&KEY_NUMPAD4);
-    engine->RegisterGlobalProperty("const int KEY_NUMPAD5", (void*)&KEY_NUMPAD5);
-    engine->RegisterGlobalProperty("const int KEY_NUMPAD6", (void*)&KEY_NUMPAD6);
-    engine->RegisterGlobalProperty("const int KEY_NUMPAD7", (void*)&KEY_NUMPAD7);
-    engine->RegisterGlobalProperty("const int KEY_NUMPAD8", (void*)&KEY_NUMPAD8);
-    engine->RegisterGlobalProperty("const int KEY_NUMPAD9", (void*)&KEY_NUMPAD9);
-    engine->RegisterGlobalProperty("const int KEY_MULTIPLY", (void*)&KEY_MULTIPLY);
-    engine->RegisterGlobalProperty("const int KEY_ADD", (void*)&KEY_ADD);
-    engine->RegisterGlobalProperty("const int KEY_SUBTRACT", (void*)&KEY_SUBTRACT);
-    engine->RegisterGlobalProperty("const int KEY_DECIMAL", (void*)&KEY_DECIMAL);
-    engine->RegisterGlobalProperty("const int KEY_DIVIDE", (void*)&KEY_DIVIDE);
+    engine->RegisterGlobalProperty("const int KEY_LGUI", (void*)&KEY_LGUI);
+    engine->RegisterGlobalProperty("const int KEY_RGUI", (void*)&KEY_RGUI);
+    engine->RegisterGlobalProperty("const int KEY_APPLICATION", (void*)&KEY_APPLICATION);
+    engine->RegisterGlobalProperty("const int KEY_KP_0", (void*)&KEY_KP_0);
+    engine->RegisterGlobalProperty("const int KEY_KP_1", (void*)&KEY_KP_1);
+    engine->RegisterGlobalProperty("const int KEY_KP_2", (void*)&KEY_KP_2);
+    engine->RegisterGlobalProperty("const int KEY_KP_3", (void*)&KEY_KP_3);
+    engine->RegisterGlobalProperty("const int KEY_KP_4", (void*)&KEY_KP_4);
+    engine->RegisterGlobalProperty("const int KEY_KP_5", (void*)&KEY_KP_5);
+    engine->RegisterGlobalProperty("const int KEY_KP_6", (void*)&KEY_KP_6);
+    engine->RegisterGlobalProperty("const int KEY_KP_7", (void*)&KEY_KP_7);
+    engine->RegisterGlobalProperty("const int KEY_KP_8", (void*)&KEY_KP_8);
+    engine->RegisterGlobalProperty("const int KEY_KP_9", (void*)&KEY_KP_9);
+    engine->RegisterGlobalProperty("const int KEY_KP_MULTIPLY", (void*)&KEY_KP_MULTIPLY);
+    engine->RegisterGlobalProperty("const int KEY_KP_PLUS", (void*)&KEY_KP_PLUS);
+    engine->RegisterGlobalProperty("const int KEY_KP_MINUS", (void*)&KEY_KP_MINUS);
+    engine->RegisterGlobalProperty("const int KEY_KP_PERIOD", (void*)&KEY_KP_PERIOD);
+    engine->RegisterGlobalProperty("const int KEY_KP_DIVIDE", (void*)&KEY_KP_DIVIDE);
     engine->RegisterGlobalProperty("const int KEY_F1", (void*)&KEY_F1);
     engine->RegisterGlobalProperty("const int KEY_F2", (void*)&KEY_F2);
     engine->RegisterGlobalProperty("const int KEY_F3", (void*)&KEY_F3);
@@ -100,7 +142,7 @@ static void RegisterInputConstants(asIScriptEngine* engine)
     engine->RegisterGlobalProperty("const int KEY_F22", (void*)&KEY_F22);
     engine->RegisterGlobalProperty("const int KEY_F23", (void*)&KEY_F23);
     engine->RegisterGlobalProperty("const int KEY_F24", (void*)&KEY_F24);
-    engine->RegisterGlobalProperty("const int KEY_NUMLOCK", (void*)&KEY_NUMLOCK);
+    engine->RegisterGlobalProperty("const int KEY_NUMLOCKCLEAR", (void*)&KEY_NUMLOCKCLEAR);
     engine->RegisterGlobalProperty("const int KEY_SCROLLLOCK", (void*)&KEY_SCROLLLOCK);
     engine->RegisterGlobalProperty("const int KEY_LSHIFT", (void*)&KEY_LSHIFT);
     engine->RegisterGlobalProperty("const int KEY_RSHIFT", (void*)&KEY_RSHIFT);
@@ -108,6 +150,251 @@ static void RegisterInputConstants(asIScriptEngine* engine)
     engine->RegisterGlobalProperty("const int KEY_RCTRL", (void*)&KEY_RCTRL);
     engine->RegisterGlobalProperty("const int KEY_LALT", (void*)&KEY_LALT);
     engine->RegisterGlobalProperty("const int KEY_RALT", (void*)&KEY_RALT);
+    engine->RegisterGlobalProperty("const int SCANCODE_UNKNOWN", (void*)&SCANCODE_UNKNOWN);
+    engine->RegisterGlobalProperty("const int SCANCODE_CTRL", (void*)&SCANCODE_CTRL);
+    engine->RegisterGlobalProperty("const int SCANCODE_SHIFT", (void*)&SCANCODE_SHIFT);
+    engine->RegisterGlobalProperty("const int SCANCODE_ALT", (void*)&SCANCODE_ALT);
+    engine->RegisterGlobalProperty("const int SCANCODE_GUI", (void*)&SCANCODE_GUI);
+    engine->RegisterGlobalProperty("const int SCANCODE_A", (void*)&SCANCODE_A);
+    engine->RegisterGlobalProperty("const int SCANCODE_B", (void*)&SCANCODE_B);
+    engine->RegisterGlobalProperty("const int SCANCODE_C", (void*)&SCANCODE_C);
+    engine->RegisterGlobalProperty("const int SCANCODE_D", (void*)&SCANCODE_D);
+    engine->RegisterGlobalProperty("const int SCANCODE_E", (void*)&SCANCODE_E);
+    engine->RegisterGlobalProperty("const int SCANCODE_F", (void*)&SCANCODE_F);
+    engine->RegisterGlobalProperty("const int SCANCODE_G", (void*)&SCANCODE_G);
+    engine->RegisterGlobalProperty("const int SCANCODE_H", (void*)&SCANCODE_H);
+    engine->RegisterGlobalProperty("const int SCANCODE_I", (void*)&SCANCODE_I);
+    engine->RegisterGlobalProperty("const int SCANCODE_J", (void*)&SCANCODE_J);
+    engine->RegisterGlobalProperty("const int SCANCODE_K", (void*)&SCANCODE_K);
+    engine->RegisterGlobalProperty("const int SCANCODE_L", (void*)&SCANCODE_L);
+    engine->RegisterGlobalProperty("const int SCANCODE_M", (void*)&SCANCODE_M);
+    engine->RegisterGlobalProperty("const int SCANCODE_N", (void*)&SCANCODE_N);
+    engine->RegisterGlobalProperty("const int SCANCODE_O", (void*)&SCANCODE_O);
+    engine->RegisterGlobalProperty("const int SCANCODE_P", (void*)&SCANCODE_P);
+    engine->RegisterGlobalProperty("const int SCANCODE_Q", (void*)&SCANCODE_Q);
+    engine->RegisterGlobalProperty("const int SCANCODE_R", (void*)&SCANCODE_R);
+    engine->RegisterGlobalProperty("const int SCANCODE_S", (void*)&SCANCODE_S);
+    engine->RegisterGlobalProperty("const int SCANCODE_T", (void*)&SCANCODE_T);
+    engine->RegisterGlobalProperty("const int SCANCODE_U", (void*)&SCANCODE_U);
+    engine->RegisterGlobalProperty("const int SCANCODE_V", (void*)&SCANCODE_V);
+    engine->RegisterGlobalProperty("const int SCANCODE_W", (void*)&SCANCODE_W);
+    engine->RegisterGlobalProperty("const int SCANCODE_X", (void*)&SCANCODE_X);
+    engine->RegisterGlobalProperty("const int SCANCODE_Y", (void*)&SCANCODE_Y);
+    engine->RegisterGlobalProperty("const int SCANCODE_Z", (void*)&SCANCODE_Z);
+    engine->RegisterGlobalProperty("const int SCANCODE_1", (void*)&SCANCODE_1);
+    engine->RegisterGlobalProperty("const int SCANCODE_2", (void*)&SCANCODE_2);
+    engine->RegisterGlobalProperty("const int SCANCODE_3", (void*)&SCANCODE_3);
+    engine->RegisterGlobalProperty("const int SCANCODE_4", (void*)&SCANCODE_4);
+    engine->RegisterGlobalProperty("const int SCANCODE_5", (void*)&SCANCODE_5);
+    engine->RegisterGlobalProperty("const int SCANCODE_6", (void*)&SCANCODE_6);
+    engine->RegisterGlobalProperty("const int SCANCODE_7", (void*)&SCANCODE_7);
+    engine->RegisterGlobalProperty("const int SCANCODE_8", (void*)&SCANCODE_8);
+    engine->RegisterGlobalProperty("const int SCANCODE_9", (void*)&SCANCODE_9);
+    engine->RegisterGlobalProperty("const int SCANCODE_0", (void*)&SCANCODE_0);
+    engine->RegisterGlobalProperty("const int SCANCODE_RETURN", (void*)&SCANCODE_RETURN);
+    engine->RegisterGlobalProperty("const int SCANCODE_ESCAPE", (void*)&SCANCODE_ESCAPE);
+    engine->RegisterGlobalProperty("const int SCANCODE_BACKSPACE", (void*)&SCANCODE_BACKSPACE);
+    engine->RegisterGlobalProperty("const int SCANCODE_TAB", (void*)&SCANCODE_TAB);
+    engine->RegisterGlobalProperty("const int SCANCODE_SPACE", (void*)&SCANCODE_SPACE);
+    engine->RegisterGlobalProperty("const int SCANCODE_MINUS", (void*)&SCANCODE_MINUS);
+    engine->RegisterGlobalProperty("const int SCANCODE_EQUALS", (void*)&SCANCODE_EQUALS);
+    engine->RegisterGlobalProperty("const int SCANCODE_LEFTBRACKET", (void*)&SCANCODE_LEFTBRACKET);
+    engine->RegisterGlobalProperty("const int SCANCODE_RIGHTBRACKET", (void*)&SCANCODE_RIGHTBRACKET);
+    engine->RegisterGlobalProperty("const int SCANCODE_BACKSLASH", (void*)&SCANCODE_BACKSLASH);
+    engine->RegisterGlobalProperty("const int SCANCODE_NONUSHASH", (void*)&SCANCODE_NONUSHASH);
+    engine->RegisterGlobalProperty("const int SCANCODE_SEMICOLON", (void*)&SCANCODE_SEMICOLON);
+    engine->RegisterGlobalProperty("const int SCANCODE_APOSTROPHE", (void*)&SCANCODE_APOSTROPHE);
+    engine->RegisterGlobalProperty("const int SCANCODE_GRAVE", (void*)&SCANCODE_GRAVE);
+    engine->RegisterGlobalProperty("const int SCANCODE_COMMA", (void*)&SCANCODE_COMMA);
+    engine->RegisterGlobalProperty("const int SCANCODE_PERIOD", (void*)&SCANCODE_PERIOD);
+    engine->RegisterGlobalProperty("const int SCANCODE_SLASH", (void*)&SCANCODE_SLASH);
+    engine->RegisterGlobalProperty("const int SCANCODE_CAPSLOCK", (void*)&SCANCODE_CAPSLOCK);
+    engine->RegisterGlobalProperty("const int SCANCODE_F1", (void*)&SCANCODE_F1);
+    engine->RegisterGlobalProperty("const int SCANCODE_F2", (void*)&SCANCODE_F2);
+    engine->RegisterGlobalProperty("const int SCANCODE_F3", (void*)&SCANCODE_F3);
+    engine->RegisterGlobalProperty("const int SCANCODE_F4", (void*)&SCANCODE_F4);
+    engine->RegisterGlobalProperty("const int SCANCODE_F5", (void*)&SCANCODE_F5);
+    engine->RegisterGlobalProperty("const int SCANCODE_F6", (void*)&SCANCODE_F6);
+    engine->RegisterGlobalProperty("const int SCANCODE_F7", (void*)&SCANCODE_F7);
+    engine->RegisterGlobalProperty("const int SCANCODE_F8", (void*)&SCANCODE_F8);
+    engine->RegisterGlobalProperty("const int SCANCODE_F9", (void*)&SCANCODE_F9);
+    engine->RegisterGlobalProperty("const int SCANCODE_F10", (void*)&SCANCODE_F10);
+    engine->RegisterGlobalProperty("const int SCANCODE_F11", (void*)&SCANCODE_F11);
+    engine->RegisterGlobalProperty("const int SCANCODE_F12", (void*)&SCANCODE_F12);
+    engine->RegisterGlobalProperty("const int SCANCODE_PRINTSCREEN", (void*)&SCANCODE_PRINTSCREEN);
+    engine->RegisterGlobalProperty("const int SCANCODE_SCROLLLOCK", (void*)&SCANCODE_SCROLLLOCK);
+    engine->RegisterGlobalProperty("const int SCANCODE_PAUSE", (void*)&SCANCODE_PAUSE);
+    engine->RegisterGlobalProperty("const int SCANCODE_INSERT", (void*)&SCANCODE_INSERT);
+    engine->RegisterGlobalProperty("const int SCANCODE_HOME", (void*)&SCANCODE_HOME);
+    engine->RegisterGlobalProperty("const int SCANCODE_PAGEUP", (void*)&SCANCODE_PAGEUP);
+    engine->RegisterGlobalProperty("const int SCANCODE_DELETE", (void*)&SCANCODE_DELETE);
+    engine->RegisterGlobalProperty("const int SCANCODE_END", (void*)&SCANCODE_END);
+    engine->RegisterGlobalProperty("const int SCANCODE_PAGEDOWN", (void*)&SCANCODE_PAGEDOWN);
+    engine->RegisterGlobalProperty("const int SCANCODE_RIGHT", (void*)&SCANCODE_RIGHT);
+    engine->RegisterGlobalProperty("const int SCANCODE_LEFT", (void*)&SCANCODE_LEFT);
+    engine->RegisterGlobalProperty("const int SCANCODE_DOWN", (void*)&SCANCODE_DOWN);
+    engine->RegisterGlobalProperty("const int SCANCODE_UP", (void*)&SCANCODE_UP);
+    engine->RegisterGlobalProperty("const int SCANCODE_NUMLOCKCLEAR", (void*)&SCANCODE_NUMLOCKCLEAR);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_DIVIDE", (void*)&SCANCODE_KP_DIVIDE);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_MULTIPLY", (void*)&SCANCODE_KP_MULTIPLY);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_MINUS", (void*)&SCANCODE_KP_MINUS);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_PLUS", (void*)&SCANCODE_KP_PLUS);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_ENTER", (void*)&SCANCODE_KP_ENTER);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_1", (void*)&SCANCODE_KP_1);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_2", (void*)&SCANCODE_KP_2);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_3", (void*)&SCANCODE_KP_3);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_4", (void*)&SCANCODE_KP_4);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_5", (void*)&SCANCODE_KP_5);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_6", (void*)&SCANCODE_KP_6);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_7", (void*)&SCANCODE_KP_7);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_8", (void*)&SCANCODE_KP_8);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_9", (void*)&SCANCODE_KP_9);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_0", (void*)&SCANCODE_KP_0);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_PERIOD", (void*)&SCANCODE_KP_PERIOD);
+    engine->RegisterGlobalProperty("const int SCANCODE_NONUSBACKSLASH", (void*)&SCANCODE_NONUSBACKSLASH);
+    engine->RegisterGlobalProperty("const int SCANCODE_APPLICATION", (void*)&SCANCODE_APPLICATION);
+    engine->RegisterGlobalProperty("const int SCANCODE_POWER", (void*)&SCANCODE_POWER);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_EQUALS", (void*)&SCANCODE_KP_EQUALS);
+    engine->RegisterGlobalProperty("const int SCANCODE_F13", (void*)&SCANCODE_F13);
+    engine->RegisterGlobalProperty("const int SCANCODE_F14", (void*)&SCANCODE_F14);
+    engine->RegisterGlobalProperty("const int SCANCODE_F15", (void*)&SCANCODE_F15);
+    engine->RegisterGlobalProperty("const int SCANCODE_F16", (void*)&SCANCODE_F16);
+    engine->RegisterGlobalProperty("const int SCANCODE_F17", (void*)&SCANCODE_F17);
+    engine->RegisterGlobalProperty("const int SCANCODE_F18", (void*)&SCANCODE_F18);
+    engine->RegisterGlobalProperty("const int SCANCODE_F19", (void*)&SCANCODE_F19);
+    engine->RegisterGlobalProperty("const int SCANCODE_F20", (void*)&SCANCODE_F20);
+    engine->RegisterGlobalProperty("const int SCANCODE_F21", (void*)&SCANCODE_F21);
+    engine->RegisterGlobalProperty("const int SCANCODE_F22", (void*)&SCANCODE_F22);
+    engine->RegisterGlobalProperty("const int SCANCODE_F23", (void*)&SCANCODE_F23);
+    engine->RegisterGlobalProperty("const int SCANCODE_F24", (void*)&SCANCODE_F24);
+    engine->RegisterGlobalProperty("const int SCANCODE_EXECUTE", (void*)&SCANCODE_EXECUTE);
+    engine->RegisterGlobalProperty("const int SCANCODE_HELP", (void*)&SCANCODE_HELP);
+    engine->RegisterGlobalProperty("const int SCANCODE_MENU", (void*)&SCANCODE_MENU);
+    engine->RegisterGlobalProperty("const int SCANCODE_SELECT", (void*)&SCANCODE_SELECT);
+    engine->RegisterGlobalProperty("const int SCANCODE_STOP", (void*)&SCANCODE_STOP);
+    engine->RegisterGlobalProperty("const int SCANCODE_AGAIN", (void*)&SCANCODE_AGAIN);
+    engine->RegisterGlobalProperty("const int SCANCODE_UNDO", (void*)&SCANCODE_UNDO);
+    engine->RegisterGlobalProperty("const int SCANCODE_CUT", (void*)&SCANCODE_CUT);
+    engine->RegisterGlobalProperty("const int SCANCODE_COPY", (void*)&SCANCODE_COPY);
+    engine->RegisterGlobalProperty("const int SCANCODE_PASTE", (void*)&SCANCODE_PASTE);
+    engine->RegisterGlobalProperty("const int SCANCODE_FIND", (void*)&SCANCODE_FIND);
+    engine->RegisterGlobalProperty("const int SCANCODE_MUTE", (void*)&SCANCODE_MUTE);
+    engine->RegisterGlobalProperty("const int SCANCODE_VOLUMEUP", (void*)&SCANCODE_VOLUMEUP);
+    engine->RegisterGlobalProperty("const int SCANCODE_VOLUMEDOWN", (void*)&SCANCODE_VOLUMEDOWN);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_COMMA", (void*)&SCANCODE_KP_COMMA);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_EQUALSAS400", (void*)&SCANCODE_KP_EQUALSAS400);
+    engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL1", (void*)&SCANCODE_INTERNATIONAL1);
+    engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL2", (void*)&SCANCODE_INTERNATIONAL2);
+    engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL3", (void*)&SCANCODE_INTERNATIONAL3);
+    engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL4", (void*)&SCANCODE_INTERNATIONAL4);
+    engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL5", (void*)&SCANCODE_INTERNATIONAL5);
+    engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL6", (void*)&SCANCODE_INTERNATIONAL6);
+    engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL7", (void*)&SCANCODE_INTERNATIONAL7);
+    engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL8", (void*)&SCANCODE_INTERNATIONAL8);
+    engine->RegisterGlobalProperty("const int SCANCODE_INTERNATIONAL9", (void*)&SCANCODE_INTERNATIONAL9);
+    engine->RegisterGlobalProperty("const int SCANCODE_LANG1", (void*)&SCANCODE_LANG1);
+    engine->RegisterGlobalProperty("const int SCANCODE_LANG2", (void*)&SCANCODE_LANG2);
+    engine->RegisterGlobalProperty("const int SCANCODE_LANG3", (void*)&SCANCODE_LANG3);
+    engine->RegisterGlobalProperty("const int SCANCODE_LANG4", (void*)&SCANCODE_LANG4);
+    engine->RegisterGlobalProperty("const int SCANCODE_LANG5", (void*)&SCANCODE_LANG5);
+    engine->RegisterGlobalProperty("const int SCANCODE_LANG6", (void*)&SCANCODE_LANG6);
+    engine->RegisterGlobalProperty("const int SCANCODE_LANG7", (void*)&SCANCODE_LANG7);
+    engine->RegisterGlobalProperty("const int SCANCODE_LANG8", (void*)&SCANCODE_LANG8);
+    engine->RegisterGlobalProperty("const int SCANCODE_LANG9", (void*)&SCANCODE_LANG9);
+    engine->RegisterGlobalProperty("const int SCANCODE_ALTERASE", (void*)&SCANCODE_ALTERASE);
+    engine->RegisterGlobalProperty("const int SCANCODE_SYSREQ", (void*)&SCANCODE_SYSREQ);
+    engine->RegisterGlobalProperty("const int SCANCODE_CANCEL", (void*)&SCANCODE_CANCEL);
+    engine->RegisterGlobalProperty("const int SCANCODE_CLEAR", (void*)&SCANCODE_CLEAR);
+    engine->RegisterGlobalProperty("const int SCANCODE_PRIOR", (void*)&SCANCODE_PRIOR);
+    engine->RegisterGlobalProperty("const int SCANCODE_RETURN2", (void*)&SCANCODE_RETURN2);
+    engine->RegisterGlobalProperty("const int SCANCODE_SEPARATOR", (void*)&SCANCODE_SEPARATOR);
+    engine->RegisterGlobalProperty("const int SCANCODE_OUT", (void*)&SCANCODE_OUT);
+    engine->RegisterGlobalProperty("const int SCANCODE_OPER", (void*)&SCANCODE_OPER);
+    engine->RegisterGlobalProperty("const int SCANCODE_CLEARAGAIN", (void*)&SCANCODE_CLEARAGAIN);
+    engine->RegisterGlobalProperty("const int SCANCODE_CRSEL", (void*)&SCANCODE_CRSEL);
+    engine->RegisterGlobalProperty("const int SCANCODE_EXSEL", (void*)&SCANCODE_EXSEL);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_00", (void*)&SCANCODE_KP_00);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_000", (void*)&SCANCODE_KP_000);
+    engine->RegisterGlobalProperty("const int SCANCODE_THOUSANDSSEPARATOR", (void*)&SCANCODE_THOUSANDSSEPARATOR);
+    engine->RegisterGlobalProperty("const int SCANCODE_DECIMALSEPARATOR", (void*)&SCANCODE_DECIMALSEPARATOR);
+    engine->RegisterGlobalProperty("const int SCANCODE_CURRENCYUNIT", (void*)&SCANCODE_CURRENCYUNIT);
+    engine->RegisterGlobalProperty("const int SCANCODE_CURRENCYSUBUNIT", (void*)&SCANCODE_CURRENCYSUBUNIT);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_LEFTPAREN", (void*)&SCANCODE_KP_LEFTPAREN);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_RIGHTPAREN", (void*)&SCANCODE_KP_RIGHTPAREN);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_LEFTBRACE", (void*)&SCANCODE_KP_LEFTBRACE);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_RIGHTBRACE", (void*)&SCANCODE_KP_RIGHTBRACE);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_TAB", (void*)&SCANCODE_KP_TAB);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_BACKSPACE", (void*)&SCANCODE_KP_BACKSPACE);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_A", (void*)&SCANCODE_KP_A);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_B", (void*)&SCANCODE_KP_B);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_C", (void*)&SCANCODE_KP_C);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_D", (void*)&SCANCODE_KP_D);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_E", (void*)&SCANCODE_KP_E);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_F", (void*)&SCANCODE_KP_F);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_XOR", (void*)&SCANCODE_KP_XOR);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_POWER", (void*)&SCANCODE_KP_POWER);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_PERCENT", (void*)&SCANCODE_KP_PERCENT);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_LESS", (void*)&SCANCODE_KP_LESS);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_GREATER", (void*)&SCANCODE_KP_GREATER);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_AMPERSAND", (void*)&SCANCODE_KP_AMPERSAND);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_DBLAMPERSAND", (void*)&SCANCODE_KP_DBLAMPERSAND);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_VERTICALBAR", (void*)&SCANCODE_KP_VERTICALBAR);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_DBLVERTICALBAR", (void*)&SCANCODE_KP_DBLVERTICALBAR);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_COLON", (void*)&SCANCODE_KP_COLON);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_HASH", (void*)&SCANCODE_KP_HASH);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_SPACE", (void*)&SCANCODE_KP_SPACE);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_AT", (void*)&SCANCODE_KP_AT);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_EXCLAM", (void*)&SCANCODE_KP_EXCLAM);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_MEMSTORE", (void*)&SCANCODE_KP_MEMSTORE);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_MEMRECALL", (void*)&SCANCODE_KP_MEMRECALL);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_MEMCLEAR", (void*)&SCANCODE_KP_MEMCLEAR);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_MEMADD", (void*)&SCANCODE_KP_MEMADD);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_MEMSUBTRACT", (void*)&SCANCODE_KP_MEMSUBTRACT);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_MEMMULTIPLY", (void*)&SCANCODE_KP_MEMMULTIPLY);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_MEMDIVIDE", (void*)&SCANCODE_KP_MEMDIVIDE);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_PLUSMINUS", (void*)&SCANCODE_KP_PLUSMINUS);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_CLEAR", (void*)&SCANCODE_KP_CLEAR);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_CLEARENTRY", (void*)&SCANCODE_KP_CLEARENTRY);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_BINARY", (void*)&SCANCODE_KP_BINARY);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_OCTAL", (void*)&SCANCODE_KP_OCTAL);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_DECIMAL", (void*)&SCANCODE_KP_DECIMAL);
+    engine->RegisterGlobalProperty("const int SCANCODE_KP_HEXADECIMAL", (void*)&SCANCODE_KP_HEXADECIMAL);
+    engine->RegisterGlobalProperty("const int SCANCODE_LCTRL", (void*)&SCANCODE_LCTRL);
+    engine->RegisterGlobalProperty("const int SCANCODE_LSHIFT", (void*)&SCANCODE_LSHIFT);
+    engine->RegisterGlobalProperty("const int SCANCODE_LALT", (void*)&SCANCODE_LALT);
+    engine->RegisterGlobalProperty("const int SCANCODE_LGUI", (void*)&SCANCODE_LGUI);
+    engine->RegisterGlobalProperty("const int SCANCODE_RCTRL", (void*)&SCANCODE_RCTRL);
+    engine->RegisterGlobalProperty("const int SCANCODE_RSHIFT", (void*)&SCANCODE_RSHIFT);
+    engine->RegisterGlobalProperty("const int SCANCODE_RALT", (void*)&SCANCODE_RALT);
+    engine->RegisterGlobalProperty("const int SCANCODE_RGUI", (void*)&SCANCODE_RGUI);
+    engine->RegisterGlobalProperty("const int SCANCODE_MODE", (void*)&SCANCODE_MODE);
+    engine->RegisterGlobalProperty("const int SCANCODE_AUDIONEXT", (void*)&SCANCODE_AUDIONEXT);
+    engine->RegisterGlobalProperty("const int SCANCODE_AUDIOPREV", (void*)&SCANCODE_AUDIOPREV);
+    engine->RegisterGlobalProperty("const int SCANCODE_AUDIOSTOP", (void*)&SCANCODE_AUDIOSTOP);
+    engine->RegisterGlobalProperty("const int SCANCODE_AUDIOPLAY", (void*)&SCANCODE_AUDIOPLAY);
+    engine->RegisterGlobalProperty("const int SCANCODE_AUDIOMUTE", (void*)&SCANCODE_AUDIOMUTE);
+    engine->RegisterGlobalProperty("const int SCANCODE_MEDIASELECT", (void*)&SCANCODE_MEDIASELECT);
+    engine->RegisterGlobalProperty("const int SCANCODE_WWW", (void*)&SCANCODE_WWW);
+    engine->RegisterGlobalProperty("const int SCANCODE_MAIL", (void*)&SCANCODE_MAIL);
+    engine->RegisterGlobalProperty("const int SCANCODE_CALCULATOR", (void*)&SCANCODE_CALCULATOR);
+    engine->RegisterGlobalProperty("const int SCANCODE_COMPUTER", (void*)&SCANCODE_COMPUTER);
+    engine->RegisterGlobalProperty("const int SCANCODE_AC_SEARCH", (void*)&SCANCODE_AC_SEARCH);
+    engine->RegisterGlobalProperty("const int SCANCODE_AC_HOME", (void*)&SCANCODE_AC_HOME);
+    engine->RegisterGlobalProperty("const int SCANCODE_AC_BACK", (void*)&SCANCODE_AC_BACK);
+    engine->RegisterGlobalProperty("const int SCANCODE_AC_FORWARD", (void*)&SCANCODE_AC_FORWARD);
+    engine->RegisterGlobalProperty("const int SCANCODE_AC_STOP", (void*)&SCANCODE_AC_STOP);
+    engine->RegisterGlobalProperty("const int SCANCODE_AC_REFRESH", (void*)&SCANCODE_AC_REFRESH);
+    engine->RegisterGlobalProperty("const int SCANCODE_AC_BOOKMARKS", (void*)&SCANCODE_AC_BOOKMARKS);
+    engine->RegisterGlobalProperty("const int SCANCODE_BRIGHTNESSDOWN", (void*)&SCANCODE_BRIGHTNESSDOWN);
+    engine->RegisterGlobalProperty("const int SCANCODE_BRIGHTNESSUP", (void*)&SCANCODE_BRIGHTNESSUP);
+    engine->RegisterGlobalProperty("const int SCANCODE_DISPLAYSWITCH", (void*)&SCANCODE_DISPLAYSWITCH);
+    engine->RegisterGlobalProperty("const int SCANCODE_KBDILLUMTOGGLE", (void*)&SCANCODE_KBDILLUMTOGGLE);
+    engine->RegisterGlobalProperty("const int SCANCODE_KBDILLUMDOWN", (void*)&SCANCODE_KBDILLUMDOWN);
+    engine->RegisterGlobalProperty("const int SCANCODE_KBDILLUMUP", (void*)&SCANCODE_KBDILLUMUP);
+    engine->RegisterGlobalProperty("const int SCANCODE_EJECT", (void*)&SCANCODE_EJECT);
+    engine->RegisterGlobalProperty("const int SCANCODE_SLEEP", (void*)&SCANCODE_SLEEP);
+    engine->RegisterGlobalProperty("const int SCANCODE_APP1", (void*)&SCANCODE_APP1);
+    engine->RegisterGlobalProperty("const int SCANCODE_APP2", (void*)&SCANCODE_APP2);
     engine->RegisterGlobalProperty("const int HAT_CENTER", (void*)&HAT_CENTER);
     engine->RegisterGlobalProperty("const int HAT_UP", (void*)&HAT_UP);
     engine->RegisterGlobalProperty("const int HAT_RIGHT", (void*)&HAT_RIGHT);
@@ -168,6 +455,12 @@ static void RegisterInput(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Input", "bool OpenJoystick(uint)", asMETHOD(Input, OpenJoystick), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "void CloseJoystick(uint)", asMETHOD(Input, CloseJoystick), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "bool DetectJoysticks()", asMETHOD(Input, DetectJoysticks), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Input", "int GetKeyFromName(const String&in) const", asMETHOD(Input, GetKeyFromName), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Input", "int GetKeyFromScancode(int) const", asMETHOD(Input, GetKeyFromScancode), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Input", "String GetKeyName(int) const", asMETHOD(Input, GetKeyName), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Input", "int GetScancodeFromKey(int) const", asMETHOD(Input, GetScancodeFromKey), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Input", "int GetScancodeFromName(const String&in) const", asMETHOD(Input, GetScancodeFromName), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Input", "String GetScancodeName(int) const", asMETHOD(Input, GetScancodeName), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "void set_mouseVisible(bool)", asMETHOD(Input, SetMouseVisible), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "bool get_mouseVisible() const", asMETHOD(Input, IsMouseVisible), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "void set_screenKeyboardVisible(bool)", asMETHOD(Input, SetScreenKeyboardVisible), asCALL_THISCALL);
@@ -177,6 +470,8 @@ static void RegisterInput(asIScriptEngine* engine)
     engine->RegisterObjectMethod("Input", "bool get_toggleFullscreen() const", asMETHOD(Input, GetToggleFullscreen), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "bool get_keyDown(int) const", asMETHOD(Input, GetKeyDown), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "bool get_keyPress(int) const", asMETHOD(Input, GetKeyPress), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Input", "bool get_scancodeDown(int) const", asMETHOD(Input, GetScancodeDown), asCALL_THISCALL);
+    engine->RegisterObjectMethod("Input", "bool get_scancodePress(int) const", asMETHOD(Input, GetScancodePress), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "bool get_mouseButtonDown(int) const", asMETHOD(Input, GetMouseButtonDown), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "bool get_mouseButtonPress(int) const", asMETHOD(Input, GetMouseButtonPress), asCALL_THISCALL);
     engine->RegisterObjectMethod("Input", "bool get_qualifierDown(int) const", asMETHOD(Input, GetQualifierDown), asCALL_THISCALL);