aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2025-05-07 21:27:33 +0200
committerNicholas Rodrigues Lordello <[email protected]>2025-05-07 21:27:33 +0200
commitfd525a037e7a26ecf5a4dbd92075ef81187e038c (patch)
tree447411dd302ae53eca68a96cd8566c0cf3f1a837
parentad140e3926effe3d078e3095cafb977ebdbd8734 (diff)
Close Gamepads
Make sure to close gamepads on tear-down.
-rw-r--r--platform/sdl/main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/platform/sdl/main.c b/platform/sdl/main.c
index 4dd7a7b..23a0aa8 100644
--- a/platform/sdl/main.c
+++ b/platform/sdl/main.c
@@ -270,6 +270,9 @@ SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event) {
void SDL_AppQuit(void *appstate, SDL_AppResult result) {
struct appstate *state = appstate;
+ for (size_t i = 0; i < SDL_arraysize(state->gamepads); i++) {
+ SDL_CloseGamepad(state->gamepads[i]);
+ }
SDL_DestroyTexture(state->fb);
SDL_DestroyRenderer(state->renderer);
SDL_DestroyWindow(state->window);