Settings deinitialization added

This commit is contained in:
Andreas Neumann 2018-01-18 15:59:24 +01:00
parent e69d2435ad
commit 168d70e873
3 changed files with 14 additions and 0 deletions

1
main.c
View File

@ -175,6 +175,7 @@ void INITIALIZE() {
void QUIT(){ void QUIT(){
printf("De-initializing started...\n"); printf("De-initializing started...\n");
Settings_Deinitialize();
HIGHSCORES_Deinitialize(); HIGHSCORES_Deinitialize();
BREAKOUT_DestroyObject(&scenery); BREAKOUT_DestroyObject(&scenery);
BREAKOUT_DEINITIALIZE(); BREAKOUT_DEINITIALIZE();

View File

@ -2,6 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <SDL2/SDL_image.h> #include <SDL2/SDL_image.h>
#include <stdbool.h>
SDL_Texture* Setting_Texture; SDL_Texture* Setting_Texture;
@ -12,6 +13,7 @@ SDL_Rect BS_Bar_rect;
SDL_Rect BT_Bar_rect; SDL_Rect BT_Bar_rect;
SDL_Rect BVController_rect; SDL_Rect BVController_rect;
bool Settings_IsInit=false;
void Settings_Initialize (SDL_Renderer* renderer) { void Settings_Initialize (SDL_Renderer* renderer) {
BV_Bar_rect = (SDL_Rect){.y = 300,.x = 400 , .w=400, .h=100}; 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}; BT_Bar_rect = (SDL_Rect){.y = 700,.x = 400, .w=400, .h=100};
Setting_Texture = IMG_LoadTexture(renderer, "assets/images/settings_title.png"); Setting_Texture = IMG_LoadTexture(renderer, "assets/images/settings_title.png");
Settings_rect = (SDL_Rect){.x = 800, .y = 180, .w=313, .h=100}; Settings_rect = (SDL_Rect){.x = 800, .y = 180, .w=313, .h=100};
Settings_IsInit = true;
} }
void Settings_Draw (SDL_Renderer* renderer) { void Settings_Draw (SDL_Renderer* renderer) {
@ -47,3 +50,10 @@ void Settings_Draw (SDL_Renderer* renderer) {
printf("%d,%d\n",x,y); printf("%d,%d\n",x,y);
} }
void Settings_Deinitialize(){
if(Settings_IsInit){
SDL_DestroyTexture(Setting_Texture);
Settings_IsInit=false;
}
}

View File

@ -6,10 +6,13 @@
#include <stdlib.h> #include <stdlib.h>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <SDL2/SDL_image.h> #include <SDL2/SDL_image.h>
#include <stdbool.h>
void Settings_Initialize (SDL_Renderer* renderer); void Settings_Initialize (SDL_Renderer* renderer);
void Settings_Draw (SDL_Renderer* renderer); void Settings_Draw (SDL_Renderer* renderer);
void Settings_Deinitialize();
#endif #endif