aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-06-22 14:54:59 +0900
committerTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-06-22 14:54:59 +0900
commit0a00398cb206809cc7770a26f8cf490db9e8bf5a (patch)
tree90d9af07a4b545d74b876f26642d1d2b7109a760 /src
parent06f6d9501f43af7a9b1c4f1e9e92a75ce15c1acf (diff)
Fix Raylib interface input management
Diffstat (limited to 'src')
-rw-r--r--src/ray.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/src/ray.c b/src/ray.c
index cf5d179..1a7d01c 100644
--- a/src/ray.c
+++ b/src/ray.c
@@ -30,6 +30,12 @@
void
init(void)
{
+#ifndef NDEBUG
+ SetTraceLogLevel(LOG_DEBUG);
+#else
+ SetTraceLogLevel(LOG_ERROR);
+#endif
+
InitWindow(DEFAULT_WIDTH, DEFAULT_HEIGHT, "calculer");
if (!IsWindowReady())
@@ -38,11 +44,14 @@ init(void)
window\n");
exit(1);
}
- SetTargetFPS(24);
+
+ SetTargetFPS(60);
BeginDrawing();
ClearBackground(RAYWHITE);
EndDrawing();
+
+ TraceLog(LOG_INFO, "window successfully initialized");
}
static int
@@ -79,22 +88,34 @@ display_calc(int x, int y)
BeginDrawing();
ClearBackground(RAYWHITE);
- DrawText(txt, (win_width-txt_width)/2, win_height/6, font_size, LIGHTGRAY);
+ DrawText(txt, (win_width-txt_width)/2, win_height/6, font_size, GRAY);
EndDrawing();
+
+ TraceLog(LOG_INFO, "calulation %d + %d successfully drawn", x, y);
}
int
read_input(void)
{
+ TraceLog(LOG_INFO, "waiting for user input");
while (!WindowShouldClose())
{
+ /* BeginDrawing(); */
+ PollInputEvents();
+ if (IsKeyPressed(KEY_ENTER))
+ {
+ TraceLog(LOG_INFO, "enter key pressed");
+ return INT_MAX;
+ }
+ /* EndDrawing(); */
}
+ return INT_MAX;
}
void
display_res(bool, int)
{
-
+
}
void