1
1
Fork 0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

44 lines
815 B

#include <stdlib.h>
#include <string.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <string.h>
#include "logger.h"
#include <stdbool.h>
#ifndef _DEFGARBO
#define _DEFGARBO
/* Type definition for object cleanups */
typedef enum {
NO, SURFACE, TEXTURE, RENDERER, WINDOW
} sdl_types;
typedef union {
SDL_Window * window;
SDL_Renderer * renderer;
SDL_Surface * surface;
SDL_Texture * texture;
void * generic;
} thing_for_cleanup ;
typedef struct {
sdl_types kind;
thing_for_cleanup thing;
} sdl_abstract;
static sdl_abstract cleanup_queue[100];
static int cleanup_queue_length = 0;
/* Function prototypes */
void queue_for_cleanup(void * SDL_thing, sdl_types kind);
void cleanup(void * thing, sdl_types thing_type);
void empty_cleanup_queue(void);
#endif