Introduce TTF library

master
Pradana AUMARS 1 year ago
parent ebdcba9afb
commit 4ac1d84ef6
  1. 3
      README
  2. 4
      src/Makefile.am
  3. 9
      src/main.c

@ -2,4 +2,5 @@ A game of Pong.
Requirements
===========
* sdl2
* sdl2
* sdl2-ttf

@ -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

@ -1,4 +1,5 @@
#include <SDL.h>
#include <SDL_ttf.h>
#include <stdio.h>
#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;

Loading…
Cancel
Save