From eb333cc30568a732942a62dcb953387acb0195f5 Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Thu, 20 Jun 2024 22:17:15 +0900 Subject: Start using Raylib drawing --- src/ray.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/ray.c b/src/ray.c index 81cc808..ad312f4 100644 --- a/src/ray.c +++ b/src/ray.c @@ -30,7 +30,6 @@ void init(void) { - printf("info: raylib interface initialized\n"); InitWindow(DEFAULT_WIDTH, DEFAULT_HEIGHT, "calculer"); if (!IsWindowReady()) @@ -40,25 +39,28 @@ window\n"); exit(1); } SetTargetFPS(24); + + BeginDrawing(); + ClearBackground(RAYWHITE); + EndDrawing(); } void display_calc(int x, int y) { - + char text[32] = {0}; + sprintf(text, "%d + %d", x, y); + BeginDrawing(); + ClearBackground(RAYWHITE); + DrawText(text, DEFAULT_WIDTH/2, DEFAULT_HEIGHT/2, 40, LIGHTGRAY); + EndDrawing(); } int read_input(void) { - if (!WindowShouldClose()) - { - sleep(1); - return 0; - } - else + while (!WindowShouldClose()) { - return INT_MAX; } } -- cgit v1.2.3