From d10a8424cbf8e529a1b36287d41f7fe6df353e2f Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Tue, 4 Aug 2026 23:38:19 +0200 Subject: Get rid of the non-reloadable version It creates two different versions of the code for no valid reason. dynamically loading the display is not that mystical in the end. --- src/ray.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) (limited to 'src/ray.c') diff --git a/src/ray.c b/src/ray.c index c99fc3b..5000599 100644 --- a/src/ray.c +++ b/src/ray.c @@ -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 -- cgit v1.2.3