Fix GetKeyPressed and GetCharPressed for SDL (#3604)

This commit is contained in:
ubkp 2023-12-05 06:02:48 -03:00 committed by GitHub
parent 731b210f51
commit 984e83c2d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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:
{