summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorubkp <[email protected]>2023-12-05 06:02:48 -0300
committerGitHub <[email protected]>2023-12-05 10:02:48 +0100
commit984e83c2d0c6f75053a1ab533e12aece80e24b32 (patch)
treed4862daa1b6a1f44bcacea1245ffb62f3dc088cb /src
parent731b210f51cb273161bb7a8ba9cced11e0c4b9d2 (diff)
downloadraylib-984e83c2d0c6f75053a1ab533e12aece80e24b32.tar.gz
raylib-984e83c2d0c6f75053a1ab533e12aece80e24b32.zip
Fix GetKeyPressed and GetCharPressed for SDL (#3604)
Diffstat (limited to 'src')
-rw-r--r--src/platforms/rcore_desktop_sdl.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/platforms/rcore_desktop_sdl.c b/src/platforms/rcore_desktop_sdl.c
index a274f25d..e684465c 100644
--- a/src/platforms/rcore_desktop_sdl.c
+++ b/src/platforms/rcore_desktop_sdl.c
@@ -1110,6 +1110,25 @@ void PollInputEvents(void)
if (key != KEY_NULL) CORE.Input.Keyboard.currentKeyState[key] = 0;
} break;
+ case SDL_TEXTINPUT:
+ {
+ // Check if there is space available in the key queue
+ if (CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE)
+ {
+ // Add character to the queue
+ CORE.Input.Keyboard.keyPressedQueue[CORE.Input.Keyboard.keyPressedQueueCount] = event.text.text[0];
+ CORE.Input.Keyboard.keyPressedQueueCount++;
+ }
+
+ // Check if there is space available in the queue
+ if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
+ {
+ // Add character to the queue
+ CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = event.text.text[0];
+ CORE.Input.Keyboard.charPressedQueueCount++;
+ }
+ } break;
+
// Check mouse events
case SDL_MOUSEBUTTONDOWN:
{