Show the names of mice and keyboards when they connect

main
Sam Lantinga 2024-03-23 15:50:16 -07:00
parent 7852a6c307
commit 208cd434b5
1 changed files with 2 additions and 2 deletions

View File

@ -103,13 +103,13 @@ int main(int argc, char *argv[])
keepGoing = SDL_FALSE; keepGoing = SDL_FALSE;
break; break;
case SDL_EVENT_KEYBOARD_ADDED: case SDL_EVENT_KEYBOARD_ADDED:
SDL_Log("Keyboard added : %" SDL_PRIu32 "\n", event.kdevice.which); SDL_Log("Keyboard '%s' added : %" SDL_PRIu32 "\n", SDL_GetKeyboardInstanceName(event.kdevice.which), event.kdevice.which);
break; break;
case SDL_EVENT_KEYBOARD_REMOVED: case SDL_EVENT_KEYBOARD_REMOVED:
SDL_Log("Keyboard removed: %" SDL_PRIu32 "\n", event.kdevice.which); SDL_Log("Keyboard removed: %" SDL_PRIu32 "\n", event.kdevice.which);
break; break;
case SDL_EVENT_MOUSE_ADDED: case SDL_EVENT_MOUSE_ADDED:
SDL_Log("Mouse added : %" SDL_PRIu32 "\n", event.mdevice.which); SDL_Log("Mouse '%s' added : %" SDL_PRIu32 "\n", SDL_GetMouseInstanceName(event.mdevice.which), event.mdevice.which);
break; break;
case SDL_EVENT_MOUSE_REMOVED: case SDL_EVENT_MOUSE_REMOVED:
SDL_Log("Mouse removed: %" SDL_PRIu32 "\n", event.mdevice.which); SDL_Log("Mouse removed: %" SDL_PRIu32 "\n", event.mdevice.which);