summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.c17
1 files changed, 17 insertions, 0 deletions
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 <http://www.gnu.org/licenses/>.
*/
+#include <SDL.h>
+#include <SDL_ttf.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#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;
}