aboutsummaryrefslogtreecommitdiff
path: root/sources/TZR_Quit.c
blob: 0556c09b378fb7c61a0910d5b3416272d8b8f5e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "TZR.h"
#include "TZR_globals.h"
#include <SDL2/SDL.h>
#include <SDL2/SDL_render.h>
#include <SDL2/SDL_image.h>

void
TZR_Quit(void)
{
	for (size_t i = 0; i < ___tzr_resources_size; i++)
		TZR_DestroyResource(&___tzr_resources[i], 1);
	if (___tzr_resources != NULL)
		free(___tzr_resources);
	___tzr_resources = NULL;
	___tzr_resources_size = 0;
	___tzr_resources_capacity = 0;
	if (___tzr_target != NULL) {
		SDL_DestroyTexture(___tzr_target);
		___tzr_target = NULL;
	}
	if (___tzr_renderer != NULL) {
		SDL_DestroyRenderer(___tzr_renderer);
		___tzr_renderer = NULL;
	}
	if (___tzr_window != NULL) {
		SDL_DestroyWindow(___tzr_window);
		___tzr_window = NULL;
	}
	IMG_Quit();
	SDL_Quit();
}