polyadvent

A game engine from scratch in C
git clone git://jb55.com/polyadvent
Log | Files | Refs | README

commit aa897e884be1381494b31628512afecc2c39f821
parent 6c562ef99296e2bedb2494551402ab7fc58a1172
Author: William Casarin <jb55@jb55.com>
Date:   Tue,  2 Jul 2019 17:15:28 -0700

fixup debug issues

Diffstat:
Msrc/debug.h | 5+++++
Msrc/input.c | 3++-
Msrc/update.c | 2++
3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/debug.h b/src/debug.h @@ -7,7 +7,12 @@ void show_info_log(GLuint shader); #define unusual(...) fprintf(stderr, "UNUSUAL: " __VA_ARGS__) + +#ifdef DEBUG #define debug(...) fprintf(stderr, "debug: " __VA_ARGS__) +#else +#define debug(...) +#endif #endif /* POLYADVENT_DEBUG_H */ diff --git a/src/input.c b/src/input.c @@ -1,6 +1,7 @@ #include "input.h" #include "util.h" +#include "debug.h" #include "common.h" static void key_down(struct input *input, int scancode, u64 current_frame) { @@ -66,7 +67,7 @@ void process_events(struct input *input, u64 current_frame) { case SDL_WINDOWEVENT_RESIZED: if (!event.window.data1) continue; - printf("resizing %d %d\n", event.window.data1, event.window.data2); + debug("resizing %d %d\n", event.window.data1, event.window.data2); input->resized_width = event.window.data1; input->resized_height = event.window.data2; assert(input->resized_width); diff --git a/src/update.c b/src/update.c @@ -371,8 +371,10 @@ void update (struct game *game) { player_update(game, player); +#ifdef DEBUG if (was_key_pressed_this_frame(game, SDL_SCANCODE_R)) try_reload_shaders(res); +#endif if (was_key_pressed_this_frame(game, SDL_SCANCODE_C)) printf("light_dir %f %f %f\n", light[0], light[1], light[2]);