summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-03-18 19:56:53 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-03-18 19:56:53 (EDT)
commitbec6ebfb92e1a5d73a23e369c8a9a8658694e863 (patch)
tree459abb8d4337a0ec0a185b821d5ea4e1f44a1c23 /src
parent97eead3aaf900e15fb6925b14c2e391c73c923d2 (diff)
downloaddodge-balls-bec6ebfb92e1a5d73a23e369c8a9a8658694e863.zip
dodge-balls-bec6ebfb92e1a5d73a23e369c8a9a8658694e863.tar.gz
dodge-balls-bec6ebfb92e1a5d73a23e369c8a9a8658694e863.tar.bz2
main-menu: Clear renderer on each event
Fixes artifacts of old button renderings.
Diffstat (limited to 'src')
-rw-r--r--src/main-menu.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main-menu.c b/src/main-menu.c
index 5909e51..2a0ace8 100644
--- a/src/main-menu.c
+++ b/src/main-menu.c
@@ -116,7 +116,6 @@ db_main_menu(void)
/* Render background */
SDL_SetRenderDrawColor(renderer, 0x7F, 0x7F, 0x7F, 0xFF);
- SDL_RenderClear(renderer);
text_color.r = 0x00;
text_color.g = 0x00;
@@ -142,8 +141,6 @@ db_main_menu(void)
}
dest_rect.x = 16;
dest_rect.y = 16;
- SDL_RenderCopy(renderer, texture_title, NULL, &dest_rect);
- SDL_DestroyTexture(texture_title);
TTF_CloseFont(font);
font = TTF_OpenFont(font_path, 16);
@@ -336,6 +333,8 @@ db_main_menu(void)
default:
break;
}
+ SDL_RenderClear(renderer);
+ SDL_RenderCopy(renderer, texture_title, NULL, &dest_rect);
for (i = 0; i < n + 2; ++i) {
if (buttons[i] == active) {
SDL_RenderCopy(renderer,
@@ -356,4 +355,5 @@ db_main_menu(void)
err:
free(font_path);
TTF_CloseFont(font);
+ SDL_DestroyTexture(texture_title);
}