mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-29 14:38:29 +00:00
testhotplug+testmouse: exit when pressing ESC key
This commit is contained in:
@@ -96,6 +96,11 @@ int main(int argc, char *argv[])
|
|||||||
case SDL_EVENT_QUIT:
|
case SDL_EVENT_QUIT:
|
||||||
keepGoing = false;
|
keepGoing = false;
|
||||||
break;
|
break;
|
||||||
|
case SDL_EVENT_KEY_DOWN:
|
||||||
|
if (event.key.scancode == SDL_SCANCODE_ESCAPE) {
|
||||||
|
keepGoing = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SDL_EVENT_KEYBOARD_ADDED:
|
case SDL_EVENT_KEYBOARD_ADDED:
|
||||||
SDL_Log("Keyboard '%s' added : %" SDL_PRIu32, SDL_GetKeyboardNameForID(event.kdevice.which), event.kdevice.which);
|
SDL_Log("Keyboard '%s' added : %" SDL_PRIu32, SDL_GetKeyboardNameForID(event.kdevice.which), event.kdevice.which);
|
||||||
break;
|
break;
|
||||||
|
@@ -213,6 +213,10 @@ static void loop(void *arg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_EVENT_KEY_DOWN:
|
case SDL_EVENT_KEY_DOWN:
|
||||||
|
if (event.key.scancode == SDL_SCANCODE_ESCAPE) {
|
||||||
|
loop_data->done = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (event.key.key == SDLK_C) {
|
if (event.key.key == SDLK_C) {
|
||||||
int x, y, w, h;
|
int x, y, w, h;
|
||||||
SDL_GetWindowPosition(window, &x, &y);
|
SDL_GetWindowPosition(window, &x, &y);
|
||||||
|
Reference in New Issue
Block a user