From 184c72b79e756a2eeefe56b74dfdb40300701cca Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 18 Mar 2021 06:54:03 -0400 Subject: main: Initialize and quit SDL and SDL_ttf --- (limited to 'src') diff --git a/src/main.c b/src/main.c index 6ea2d49..20f25af 100644 --- a/src/main.c +++ b/src/main.c @@ -17,11 +17,14 @@ * along with Dodge Balls. If not, see . */ +#include +#include #include #include #include #include #include "game.h" +#include "output.h" int main(int argc, char *argv[]) @@ -43,6 +46,16 @@ main(int argc, char *argv[]) } free(program_dir); + /* Initialize SDL libraries */ + if (SDL_Init(SDL_INIT_VIDEO) < 0) { + db_err("Failed to initialize SDL (%s)", SDL_GetError()); + return EXIT_FAILURE; + } + if (TTF_Init() < 0) { + db_err("Failed to initialize SDL_ttf (%s)", TTF_GetError()); + return EXIT_FAILURE; + } + /* Find games */ n = db_games_find(games_dir, &games); if (n > 0) { @@ -55,5 +68,9 @@ main(int argc, char *argv[]) free(games); } + /* Quit SDL libraries */ + TTF_Quit(); + SDL_Quit(); + return EXIT_SUCCESS; } -- cgit v0.9.1