From d82f0d5a7ea3b964118a0923e14b28128b081ecf Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Sat, 22 Jun 2024 16:23:22 +0900 Subject: Implement dynamic reload in shared library --- src/ray.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/ray.c b/src/ray.c index 1a7d01c..298be85 100644 --- a/src/ray.c +++ b/src/ray.c @@ -16,7 +16,6 @@ */ #include "config.h" -#include #include #include #include @@ -105,7 +104,15 @@ read_input(void) if (IsKeyPressed(KEY_ENTER)) { TraceLog(LOG_INFO, "enter key pressed"); - return INT_MAX; + return DISP_QUIT; + } + if (IsKeyPressed(KEY_Q)) + { + return DISP_QUIT; + } + if (IsKeyPressed(KEY_R) || IsKeyPressed(KEY_G)) + { + return DISP_RELOAD; } /* EndDrawing(); */ } @@ -123,3 +130,19 @@ destroy(void) { CloseWindow(); } + +#ifndef NDEBUG +void * +pre_reload(void) +{ + TraceLog(LOG_INFO, "pre-reload actions done"); + return NULL; +} + +void +post_reload(void *state) +{ + (void) state; + TraceLog(LOG_INFO, "post-reload actions done"); +} +#endif -- cgit v1.2.3