diff options
| author | Daijiro Fukuda <[email protected]> | 2022-11-29 06:35:44 +0900 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-11-28 22:35:44 +0100 |
| commit | 66a2cdee4026379e169faa9e45b62b7ec3025d01 (patch) | |
| tree | fd95be3baa6a872a1920a7bc270ea9994cdef427 /src | |
| parent | bbf9935828553dd38633a034a3c961a08b15a0a6 (diff) | |
| download | raylib-66a2cdee4026379e169faa9e45b62b7ec3025d01.tar.gz raylib-66a2cdee4026379e169faa9e45b62b7ec3025d01.zip | |
Fix array out of range (#2814)
This breaks other values of the struct.
Diffstat (limited to 'src')
| -rw-r--r-- | src/rcore.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/rcore.c b/src/rcore.c index 22ce9338..0f47420b 100644 --- a/src/rcore.c +++ b/src/rcore.c @@ -3516,7 +3516,7 @@ int GetKeyPressed(void) CORE.Input.Keyboard.keyPressedQueue[i] = CORE.Input.Keyboard.keyPressedQueue[i + 1]; // Reset last character in the queue - CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount] = 0; + CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount - 1] = 0; CORE.Input.Keyboard.keyPressedQueueCount--; } @@ -3538,7 +3538,7 @@ int GetCharPressed(void) CORE.Input.Keyboard.charPressedQueue[i] = CORE.Input.Keyboard.charPressedQueue[i + 1]; // Reset last character in the queue - CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = 0; + CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount - 1] = 0; CORE.Input.Keyboard.charPressedQueueCount--; } @@ -5372,7 +5372,7 @@ static void CharCallback(GLFWwindow *window, unsigned int key) // Ref: https://www.glfw.org/docs/latest/input_guide.html#input_char // Check if there is space available in the queue - if (CORE.Input.Keyboard.charPressedQueueCount < MAX_KEY_PRESSED_QUEUE) + if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE) { // Add character to the queue CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = key; |
