aboutsummaryrefslogtreecommitdiff
path: root/src/ray.c
diff options
context:
space:
mode:
authorTristan Riehs <tristan.riehs@inria.fr>2026-08-04 23:38:19 +0200
committerTristan Riehs <tristan.riehs@inria.fr>2026-08-04 23:38:19 +0200
commitd10a8424cbf8e529a1b36287d41f7fe6df353e2f (patch)
tree45a44dca1163eca25ccd9035187fba048e6653c8 /src/ray.c
parentca530eb3a2b65dbc7716e557752c87e36aa1879d (diff)
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.
Diffstat (limited to 'src/ray.c')
-rw-r--r--src/ray.c27
1 files changed, 8 insertions, 19 deletions
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