From 168d70e8733b619304402e95ceadc089e3c0dc6b Mon Sep 17 00:00:00 2001 From: Andreas Neumann Date: Thu, 18 Jan 2018 15:59:24 +0100 Subject: [PATCH] Settings deinitialization added --- main.c | 1 + settings.c | 10 ++++++++++ settings.h | 3 +++ 3 files changed, 14 insertions(+) diff --git a/main.c b/main.c index aec050d..0be7558 100644 --- a/main.c +++ b/main.c @@ -175,6 +175,7 @@ void INITIALIZE() { void QUIT(){ printf("De-initializing started...\n"); + Settings_Deinitialize(); HIGHSCORES_Deinitialize(); BREAKOUT_DestroyObject(&scenery); BREAKOUT_DEINITIALIZE(); diff --git a/settings.c b/settings.c index 5996b0d..b937eca 100644 --- a/settings.c +++ b/settings.c @@ -2,6 +2,7 @@ #include #include #include +#include SDL_Texture* Setting_Texture; @@ -12,6 +13,7 @@ SDL_Rect BS_Bar_rect; SDL_Rect BT_Bar_rect; SDL_Rect BVController_rect; +bool Settings_IsInit=false; void Settings_Initialize (SDL_Renderer* renderer) { BV_Bar_rect = (SDL_Rect){.y = 300,.x = 400 , .w=400, .h=100}; @@ -20,6 +22,7 @@ void Settings_Initialize (SDL_Renderer* renderer) { BT_Bar_rect = (SDL_Rect){.y = 700,.x = 400, .w=400, .h=100}; Setting_Texture = IMG_LoadTexture(renderer, "assets/images/settings_title.png"); Settings_rect = (SDL_Rect){.x = 800, .y = 180, .w=313, .h=100}; + Settings_IsInit = true; } void Settings_Draw (SDL_Renderer* renderer) { @@ -47,3 +50,10 @@ void Settings_Draw (SDL_Renderer* renderer) { printf("%d,%d\n",x,y); } + +void Settings_Deinitialize(){ + if(Settings_IsInit){ + SDL_DestroyTexture(Setting_Texture); + Settings_IsInit=false; + } +} diff --git a/settings.h b/settings.h index e0def50..9234bf2 100644 --- a/settings.h +++ b/settings.h @@ -6,10 +6,13 @@ #include #include #include +#include void Settings_Initialize (SDL_Renderer* renderer); void Settings_Draw (SDL_Renderer* renderer); +void Settings_Deinitialize(); + #endif