update char press

This commit is contained in:
CrackedPixel 2026-02-14 05:07:02 -06:00
parent 2f1c112640
commit 8541bb3306

View File

@ -738,6 +738,7 @@ void SetWindowFocused(void)
void *GetWindowHandle(void) void *GetWindowHandle(void)
{ {
if (platform.window == NULL) return NULL; if (platform.window == NULL) return NULL;
#ifdef RGFW_WASM #ifdef RGFW_WASM
return (void *)platform.window->src.ctx; return (void *)platform.window->src.ctx;
#else #else
@ -1177,17 +1178,6 @@ void PollInputEvents(void)
if (CORE.Input.Keyboard.currentKeyState[CORE.Input.Keyboard.exitKey]) RGFW_window_setShouldClose(platform.window, true); if (CORE.Input.Keyboard.currentKeyState[CORE.Input.Keyboard.exitKey]) RGFW_window_setShouldClose(platform.window, true);
} }
// TODO: RGFW_keyChar? new window event?
//
// NOTE: event.text.text data comes an UTF-8 text sequence but we register codepoints (int)
// Check if there is space available in the queue
// if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
// {
// // Add character (codepoint) to the queue
// CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = RGFW_rgfwToKeyChar(rgfw_event.key.value);
// CORE.Input.Keyboard.charPressedQueueCount++;
// }
} break; } break;
case RGFW_keyReleased: case RGFW_keyReleased:
{ {
@ -1195,6 +1185,18 @@ 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 RGFW_keyChar:
{
// NOTE: event.text.text data comes an UTF-8 text sequence but we register codepoints (int)
// Check if there is space available in the queue
if (CORE.Input.Keyboard.charPressedQueueCount < MAX_CHAR_PRESSED_QUEUE)
{
// Add character (codepoint) to the queue
CORE.Input.Keyboard.charPressedQueue[CORE.Input.Keyboard.charPressedQueueCount] = rgfw_event.keyChar.value;
CORE.Input.Keyboard.charPressedQueueCount++;
}
} break;
// Check mouse events // Check mouse events
case RGFW_mouseScroll: case RGFW_mouseScroll:
{ {