diff options
Diffstat (limited to 'src/ray.c')
| -rw-r--r-- | src/ray.c | 27 |
1 files changed, 8 insertions, 19 deletions
@@ -20,11 +20,7 @@ static int current_idx = 0; void ray_init(void) { -#ifndef NDEBUG - SetTraceLogLevel(LOG_DEBUG); -#else SetTraceLogLevel(LOG_ERROR); -#endif InitWindow(DEFAULT_WIDTH, DEFAULT_HEIGHT, "calculer"); @@ -218,15 +214,21 @@ ray_read_input(void) PollInputEvents(); if (IsWindowResized()) + { redraw(); + } if (IsKeyPressed(KEY_ENTER)) + { return calcs[current_idx].input; + } if (IsKeyPressed(KEY_Q) || IsKeyPressed(KEY_A)) + { return DISP_QUIT; -#ifndef NDEBUG + } if (IsKeyPressed(KEY_R) || IsKeyPressed(KEY_G)) + { return DISP_RELOAD; -#endif + } if (IsKeyPressed(KEY_BACKSPACE)) { calcs[current_idx].input = @@ -253,7 +255,6 @@ ray_destroy(void) CloseWindow(); } -#ifndef NDEBUG void * ray_pre_reload(void) { @@ -273,15 +274,3 @@ ray_post_reload(void *state) free(data); TraceLog(LOG_INFO, "post-reload actions done"); } -#endif - -#ifdef NDEBUG -static struct disp __ray_disp = { - .init = ray_init, - .display_calc = ray_display_calc, - .read_input = ray_read_input, - .display_res = ray_display_res, - .destroy = ray_destroy -}; -struct disp *ray_disp = &__ray_disp; -#endif |
