From 82b1cce1bc5c91c0b56501f5dab912390206ace5 Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Thu, 20 Jun 2024 20:39:08 +0900 Subject: Use cli and gui as shared libraries --- src/ray.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/ray.c') diff --git a/src/ray.c b/src/ray.c index ad69902..81cc808 100644 --- a/src/ray.c +++ b/src/ray.c @@ -16,17 +16,29 @@ */ #include "config.h" +#include #include +#include +#include +#include #include "disp.h" #define DEFAULT_HEIGHT 200 -#define DEFAULT_WIDTH 16*9/DEFAULT_HEIGHT +#define DEFAULT_WIDTH 16*DEFAULT_HEIGHT/9 void init(void) { + printf("info: raylib interface initialized\n"); InitWindow(DEFAULT_WIDTH, DEFAULT_HEIGHT, "calculer"); + + if (!IsWindowReady()) + { + fprintf(stderr, "calculer: error initialiazing Raylib \ +window\n"); + exit(1); + } SetTargetFPS(24); } @@ -39,7 +51,15 @@ display_calc(int x, int y) int read_input(void) { - + if (!WindowShouldClose()) + { + sleep(1); + return 0; + } + else + { + return INT_MAX; + } } void -- cgit v1.2.3