瀏覽代碼

Fix GetKeyPressed and GetCharPressed for SDL (#3604)

pull/3609/head
ubkp 1 年之前
committed by GitHub
父節點
當前提交
984e83c2d0
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 1 個檔案被更改,包括 19 行新增0 行删除
  1. +19
    -0
      src/platforms/rcore_desktop_sdl.c

+ 19
- 0
src/platforms/rcore_desktop_sdl.c 查看文件

@ -1110,6 +1110,25 @@ void PollInputEvents(void)
if (key != KEY_NULL) CORE.Input.Keyboard.currentKeyState[key] = 0; if (key != KEY_NULL) CORE.Input.Keyboard.currentKeyState[key] = 0;
} break; } 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 // Check mouse events
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
{ {

Loading…
取消
儲存