ADDED: Support CAPS/NUM lock keys registering if locked
This commit is contained in:
parent
810a0330ab
commit
ea87491a82
1 changed files with 5 additions and 0 deletions
|
@ -4136,6 +4136,8 @@ static bool InitGraphicsDevice(int width, int height)
|
||||||
glfwSetScrollCallback(CORE.Window.handle, MouseScrollCallback);
|
glfwSetScrollCallback(CORE.Window.handle, MouseScrollCallback);
|
||||||
glfwSetCursorEnterCallback(CORE.Window.handle, CursorEnterCallback);
|
glfwSetCursorEnterCallback(CORE.Window.handle, CursorEnterCallback);
|
||||||
|
|
||||||
|
glfwSetInputMode(CORE.Window.handle, GLFW_LOCK_KEY_MODS, GLFW_TRUE); // Enable lock keys modifiers (CAPS, NUM)
|
||||||
|
|
||||||
glfwMakeContextCurrent(CORE.Window.handle);
|
glfwMakeContextCurrent(CORE.Window.handle);
|
||||||
|
|
||||||
#if !defined(PLATFORM_WEB)
|
#if !defined(PLATFORM_WEB)
|
||||||
|
@ -5267,6 +5269,9 @@ static void KeyCallback(GLFWwindow *window, int key, int scancode, int action, i
|
||||||
if (action == GLFW_RELEASE) CORE.Input.Keyboard.currentKeyState[key] = 0;
|
if (action == GLFW_RELEASE) CORE.Input.Keyboard.currentKeyState[key] = 0;
|
||||||
else CORE.Input.Keyboard.currentKeyState[key] = 1;
|
else CORE.Input.Keyboard.currentKeyState[key] = 1;
|
||||||
|
|
||||||
|
// WARNING: Check if CAPS/NUM key modifiers are enabled and force down state for those keys
|
||||||
|
if (((mods & GLFW_MOD_CAPS_LOCK) > 0) || ((mods & GLFW_MOD_NUM_LOCK) > 0)) CORE.Input.Keyboard.currentKeyState[key] = 1;
|
||||||
|
|
||||||
// Check if there is space available in the key queue
|
// Check if there is space available in the key queue
|
||||||
if ((CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE) && (action == GLFW_PRESS))
|
if ((CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE) && (action == GLFW_PRESS))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue