diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main-menu.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main-menu.c b/src/main-menu.c index bfd4c3d..58f0a5d 100644 --- a/src/main-menu.c +++ b/src/main-menu.c @@ -27,7 +27,7 @@ #include "util.h" static void -_db_main_menu_title(const char *fonts_dir, SDL_Renderer *renderer) +_db_main_menu_title(const char *font_path, SDL_Renderer *renderer) { SDL_Color color; TTF_Font *font; @@ -40,8 +40,7 @@ _db_main_menu_title(const char *fonts_dir, SDL_Renderer *renderer) color.b = 0xFF; color.a = 0xFF; - font = TTF_OpenFont( - db_strcat(fonts_dir, "/UbuntuTitling-Bold.ttf"), 48); + font = TTF_OpenFont(font_path, 48); if (font == NULL) { db_err("Failed to open font (%s)", TTF_GetError()); return; @@ -73,14 +72,14 @@ void db_main_menu(void) { const char *games_dir; - const char *fonts_dir; + char *font_path; SDL_Renderer *renderer; struct db_game **games; int n; int i; games_dir = db_get_games_dir(); - fonts_dir = db_get_fonts_dir(); + font_path = db_strcat(db_get_fonts_dir(), "/UbuntuTitling-Bold.ttf"); renderer = db_get_renderer(); @@ -89,7 +88,7 @@ db_main_menu(void) SDL_RenderClear(renderer); /* Render title text */ - _db_main_menu_title(fonts_dir, renderer); + _db_main_menu_title(font_path, renderer); /* Find games */ n = db_games_find(games_dir, &games); @@ -105,4 +104,6 @@ db_main_menu(void) SDL_RenderPresent(renderer); SDL_Delay(1000); + + free(font_path); } |