mirror of
https://github.com/shadps4-emu/ext-SDL.git
synced 2024-12-13 22:08:48 +00:00
Check raw keyboard input in checkkeys
This commit is contained in:
parent
b53f6cf77a
commit
391a63f29f
@ -154,6 +154,19 @@ PrintText(const char *eventtype, const char *text)
|
||||
SDL_Log("%s Text (%s): \"%s%s\"\n", eventtype, expanded, *text == '"' ? "\\" : "", text);
|
||||
}
|
||||
|
||||
static void CountKeysDown(void)
|
||||
{
|
||||
int i, count = 0, max_keys = 0;
|
||||
const Uint8 *keystate = SDL_GetKeyboardState(&max_keys);
|
||||
|
||||
for (i = 0; i < max_keys; ++i) {
|
||||
if (keystate[i]) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
SDL_Log("Keys down: %d\n", count);
|
||||
}
|
||||
|
||||
static void loop(void)
|
||||
{
|
||||
SDL_Event event;
|
||||
@ -178,6 +191,7 @@ static void loop(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
CountKeysDown();
|
||||
break;
|
||||
case SDL_EVENT_TEXT_EDITING:
|
||||
PrintText("EDIT", event.edit.text);
|
||||
@ -239,6 +253,8 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int w, h;
|
||||
|
||||
SDL_SetHint(SDL_HINT_WINDOWS_RAW_KEYBOARD, "1");
|
||||
|
||||
/* Initialize test framework */
|
||||
state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO);
|
||||
if (!state) {
|
||||
|
Loading…
Reference in New Issue
Block a user