summaryrefslogtreecommitdiff
path: root/src/include/utils.h
blob: 11fdeee413ba6425c0b0fe9da0c09bff8c5ede55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#define MAX_PATH_LEN 255

/* Macro for error checking and logging */
#define MPL_CHECK(expr, fail_code, priority, ...) \
	if (! (expr)) { \
		SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION,priority,__VA_ARGS__); \
		SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION,priority, \
				"-> last SDL error : %s\n", SDL_GetError()); \
		fail_code; \
	}

/* Macro that check and set NULL texture pointer when destroying  */
#define DESTROYTEXTURE_SAFE(t) \
if (t != NULL) { \
	SDL_DestroyTexture(t); \
	t=NULL; \
}