From bec6ebfb92e1a5d73a23e369c8a9a8658694e863 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 18 Mar 2021 19:56:53 -0400 Subject: main-menu: Clear renderer on each event Fixes artifacts of old button renderings. --- (limited to 'src') 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); } -- cgit v0.9.1