From 29b5f32b2917befa2f866f56857db183be7effe8 Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Fri, 28 Jun 2024 15:10:24 +0900 Subject: Update cli to new display interface --- src/cli.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/cli.c b/src/cli.c index af8522b..19846c0 100644 --- a/src/cli.c +++ b/src/cli.c @@ -37,7 +37,13 @@ read_input(void) char *txt = readline(""); if ((!txt) || (*txt == '\0')) - return INT_MAX; + return DISP_QUIT; + if (*txt == 'q') + return DISP_QUIT; +#ifndef NDEBUG + if ((*txt == 'r') || (*txt == 'g')) + return DISP_RELOAD; +#endif return atoi(txt); } @@ -45,8 +51,12 @@ read_input(void) void display_res(bool ok, int ms) { - (void) ms; - printf("%s\n", ok ? "RIGHT" : "WRONG"); + printf("%s\t%dms\n", ok ? "RIGHT" : "WRONG", ms); } void destroy(void) {} + +#ifndef NDEBUG +void *pre_reload(void) {return NULL;} +void post_reload(void *) {} +#endif -- cgit v1.2.3