diff --git a/README b/README index 26ea58a..b506b78 100644 --- a/README +++ b/README @@ -2,4 +2,5 @@ A game of Pong. Requirements =========== -* sdl2 \ No newline at end of file +* sdl2 +* sdl2-ttf \ No newline at end of file diff --git a/src/Makefile.am b/src/Makefile.am index 027165d..8cf198a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -8,5 +8,5 @@ pong_SOURCES = \ ball.h \ racket.c \ racket.h -pong_CFLAGS = $(SDL_CFLAGS) -pong_LDFLAGS = $(SDL_LIBS) -lm +pong_CFLAGS = $(SDL_CFLAGS) `pkg-config --cflags SDL2_ttf` +pong_LDFLAGS = $(SDL_LIBS) `pkg-config --libs SDL2_ttf` -lm diff --git a/src/main.c b/src/main.c index 24d3fd2..8f71346 100644 --- a/src/main.c +++ b/src/main.c @@ -1,4 +1,5 @@ #include +#include #include #include "pong.h" @@ -13,10 +14,17 @@ int main (int argc, char* args[]) printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() ); return 1; } + if (TTF_Init() < 0) + { + printf( "TTF could not initialize! TTF_Error: %s\n", TTF_GetError() ); + return 1; + } p = Pong_init(); if (p == NULL) { printf("Pong failed to initialise!\n"); + TTF_Quit(); + SDL_Quit(); return 1; } Pong_render(p); @@ -34,6 +42,7 @@ int main (int argc, char* args[]) Pong_run(p); Pong_free(p); + TTF_Quit(); SDL_Quit(); return 0;