Pārlūkot izejas kodu

Fix GetKeyPressed and GetCharPressed for SDL (#3604)

pull/3609/head
ubkp pirms 1 gada
committed by GitHub
vecāks
revīzija
984e83c2d0
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
1 mainītis faili ar 19 papildinājumiem un 0 dzēšanām
  1. +19
    -0
      src/platforms/rcore_desktop_sdl.c

+ 19
- 0
src/platforms/rcore_desktop_sdl.c Parādīt failu

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

Notiek ielāde…
Atcelt
Saglabāt