diff options
-rw-r--r-- | src/main-menu.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/src/main-menu.c b/src/main-menu.c index e4349d5..f6398e8 100644 --- a/src/main-menu.c +++ b/src/main-menu.c @@ -64,6 +64,10 @@ db_main_menu(void) SDL_Rect dest_rect; TTF_Font *font; SDL_Texture *texture_title; + SDL_Texture *texture_help_text; + SDL_Texture *texture_help_over; + SDL_Texture *texture_quit_text; + SDL_Texture *texture_quit_over; struct db_game **games; int n; char *name_desc; @@ -90,6 +94,12 @@ db_main_menu(void) over_color.b = 0xFF; over_color.a = 0xFF; + n = 0; + texture_help_text = NULL; + texture_help_over = NULL; + texture_quit_text = NULL; + texture_quit_over = NULL; + /* Render title text */ font = TTF_OpenFont(font_path, 48); if (font == NULL) { @@ -100,7 +110,6 @@ db_main_menu(void) texture_title = _db_main_menu_text(font, "Dodge Balls", &text_color, 0, renderer, &dest_rect); if (texture_title == NULL) { - n = 0; goto err; } dest_rect.x = 16; @@ -116,6 +125,34 @@ db_main_menu(void) return; } + texture_help_text = _db_main_menu_text(font, "How to Play", &text_color, + 0, renderer, &dest_rect); + if (texture_help_text == NULL) { + goto err; + } + texture_help_over = _db_main_menu_text(font, "How to Play", &over_color, + 0, renderer, &dest_rect); + if (texture_help_over == NULL) { + goto err; + } + dest_rect.x = 640 - 16 - dest_rect.w; + dest_rect.y = 16; + SDL_RenderCopy(renderer, texture_help_text, NULL, &dest_rect); + + texture_quit_text = _db_main_menu_text(font, "Quit", &text_color, + 0, renderer, &dest_rect); + if (texture_quit_text == NULL) { + goto err; + } + texture_quit_over = _db_main_menu_text(font, "Quit", &over_color, + 0, renderer, &dest_rect); + if (texture_quit_over == NULL) { + goto err; + } + dest_rect.x = 640 - 16 - dest_rect.w; + dest_rect.y = 48; + SDL_RenderCopy(renderer, texture_quit_text, NULL, &dest_rect); + /* Find games */ n = db_games_find(games_dir, &games); if (n > 0) { @@ -171,4 +208,8 @@ db_main_menu(void) } free(font_path); TTF_CloseFont(font); + SDL_DestroyTexture(texture_help_text); + SDL_DestroyTexture(texture_help_over); + SDL_DestroyTexture(texture_quit_text); + SDL_DestroyTexture(texture_quit_over); } |