Skip to content

Commit 32ba4ca

Browse files
authored
Adds debug output for supported renderer drivers (#94)
Also introduces the "verbose" log function and moves some of the more noisey logs to that. There is no standard buildflag for the verbose logs yet.
1 parent eda890f commit 32ba4ca

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

src/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,13 @@ bool initSDL(void)
154154
window_icon = IMG_Load_IO(io_load_rwops("Extras/icon.png"), true);
155155
SDL_SetWindowIcon(gWindow, window_icon);
156156

157+
#ifdef DEBUG
158+
int num_render_drivers = SDL_GetNumRenderDrivers();
159+
for (int i = 0; i < num_render_drivers; i++) {
160+
debug("Available render driver: %s", SDL_GetRenderDriver(i));
161+
}
162+
#endif
163+
157164
gRenderer = SDL_CreateRenderer(gWindow, NULL);
158165
if (gRenderer == NULL)
159166
{

src/mixer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ load_song(char *path)
4747
static Mix_Chunk*
4848
load_effect(char *path)
4949
{
50-
debug("Loading effect: %s", path);
50+
verbose("Loading effect: %s", path);
5151
SDL_IOStream *io = io_load_rwops(path);
52-
debug("Loaded effect: %s", path);
52+
verbose("Loaded effect: %s", path);
5353
Mix_Chunk *effect = Mix_LoadWAV_IO(io, true);
5454
if (effect == NULL)
5555
fatal("Failed to load effect (%s): %s", path, SDL_GetError());

src/texturecache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ texturecache_add(const char *path)
4949
tc->texture = texture_create();
5050
texture_load_from_file(tc->texture, path, renderer);
5151
ht_set(textures, path, tc);
52-
debug("Cached texture: %s", path);
52+
verbose("Cached texture: %s", path);
5353
}
5454

5555
return tc->texture;

src/util.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
#define __FNAME__ __FILE__
2828
#endif // __FNAME__
2929

30+
#ifdef VERBOSE
31+
#define verbose(...) log_print(stdout, "VERBOSE", __FNAME__, __LINE__, __func__, __VA_ARGS__)
32+
#else
33+
#define verbose(...) do {} while(0)
34+
#endif
35+
3036
#ifdef DEBUG
3137
#define debug(...) log_print(stdout, "DEBUG", __FNAME__, __LINE__, __func__, __VA_ARGS__)
3238
#define info(...) log_print(stdout, "INFO", __FNAME__, __LINE__, __func__, __VA_ARGS__)

0 commit comments

Comments
 (0)