aboutsummaryrefslogtreecommitdiff
path: root/src/ray.c
diff options
context:
space:
mode:
authorTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-06-20 20:39:08 +0900
committerTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-06-20 20:39:08 +0900
commit82b1cce1bc5c91c0b56501f5dab912390206ace5 (patch)
treeccb0b9b293b6dccfdc95cbd657fb63227274dc41 /src/ray.c
parent685ec81e127c9409a91299a5ac8415bb94f55ad9 (diff)
Use cli and gui as shared libraries
Diffstat (limited to 'src/ray.c')
-rw-r--r--src/ray.c24
1 files changed, 22 insertions, 2 deletions
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 <limits.h>
#include <raylib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
#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