From c9a2ee83dc66ca18647e1664175924e0320c780c Mon Sep 17 00:00:00 2001 From: Lily Rose Date: Tue, 4 Mar 2025 21:01:10 +1100 Subject: [PATCH] Add SDL init call to initialize gamepad subsystem --- main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/main.c b/main.c index 15d3417..3e92518 100644 --- a/main.c +++ b/main.c @@ -45,12 +45,19 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]) { (void) argc; (void) argv; + if (!SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_EVENTS | SDL_INIT_GAMEPAD)) { + SDL_LogError(SDL_LOG_CATEGORY_ERROR, "Failed to initialize SDL: %s", SDL_GetError()); + return SDL_APP_FAILURE; + } + if (!TTF_Init()) { + SDL_LogError(SDL_LOG_CATEGORY_ERROR, "Failed to initialize SDL TTF: %s", SDL_GetError()); return SDL_APP_FAILURE; } AppState *state = SDL_calloc(1, sizeof(AppState)); if (!state) { + SDL_LogError(SDL_LOG_CATEGORY_ERROR, "Failed to allocate memory for application state: %s", SDL_GetError()); return SDL_APP_FAILURE; } *appstate = state;