summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main-menu.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/main-menu.c b/src/main-menu.c
index 4a46380..243fcdd 100644
--- a/src/main-menu.c
+++ b/src/main-menu.c
@@ -153,8 +153,6 @@ db_main_menu(void)
}
buttons[0]->rect.x = 640 - 16 - buttons[0]->rect.w;
buttons[0]->rect.y = 16;
- SDL_RenderCopy(renderer, buttons[0]->texture_text, NULL,
- &buttons[0]->rect);
/* Render quit button */
buttons[1] = malloc(sizeof(**buttons));
@@ -174,8 +172,6 @@ db_main_menu(void)
}
buttons[1]->rect.x = 640 - 16 - buttons[1]->rect.w;
buttons[1]->rect.y = 48;
- SDL_RenderCopy(renderer, buttons[1]->texture_text, NULL,
- &buttons[1]->rect);
/* Render game buttons */
buttons[1]->n = buttons[0]; /* Quit button link (may change below) */
@@ -194,20 +190,18 @@ db_main_menu(void)
}
sprintf(name_desc, "%s\n%s", db_game_get_name(games[i]),
db_game_get_desc(games[i]));
+ buttons[i + 2]->rect.x = 16;
+ buttons[i + 2]->rect.y = 80 + 48 * i + 2;
buttons[i + 2]->texture_text = _db_main_menu_text(font,
name_desc, &text_color, 608, renderer,
- &dest_rect);
+ &buttons[i + 2]->rect);
if (buttons[i + 2]->texture_text == NULL) {
free(name_desc);
goto err;
}
- dest_rect.x = 16;
- dest_rect.y = 80 + 48 * i + 2;
- SDL_RenderCopy(renderer, buttons[i + 2]->texture_text, NULL,
- &dest_rect);
buttons[i + 2]->texture_over = _db_main_menu_text(font,
name_desc, &over_color, 608, renderer,
- &dest_rect);
+ &buttons[i + 2]->rect);
free(name_desc);
if (buttons[i + 2]->texture_over == NULL) {
goto err;
@@ -248,6 +242,11 @@ db_main_menu(void)
buttons[1]->r = NULL;
buttons[1]->p = buttons[0];
+ for (i = 0; i < n + 2; ++i) {
+ SDL_RenderCopy(renderer, buttons[i]->texture_text, NULL,
+ &buttons[i]->rect);
+ }
+
SDL_RenderPresent(renderer);
SDL_Delay(1000);