commit ff3b538ecb563056e698a99667719358ecb36de7 Author: KikooDX Date: Mon Mar 8 15:16:46 2021 +0100 Base. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c4889d1 --- /dev/null +++ b/README.md @@ -0,0 +1,20 @@ +# raygint +Bindings to make "cross platform games", gint on calculator and raylib on +desktop. Work in progress. Following are the supported define and functions. + +## `raygint/display.h` +Macros: +* `C_WHITE` +* `DWIDTH` +* `DHEIGHT` + +Functions: +* `void rDisplayInit(void);` +* `void rDisplayDeinit(void);` +* `void dupdate(void);` + +## `raygint/keyboard.h` +Functions: +* `void clearevents(void);` +* `void dclear(color_t color);` +* `int keydown(int key);` diff --git a/include/raygint/display.h b/include/raygint/display.h new file mode 100644 index 0000000..d0e8576 --- /dev/null +++ b/include/raygint/display.h @@ -0,0 +1,24 @@ +#pragma once + +#ifdef GINT +#include +#endif /* GINT */ + +#ifdef RAYLIB +#include +/* Colors. */ +#define C_WHITE WHITE +/* Simple functions. */ +#define drect(x, y, w, h, c) DrawRectangle(x, y, (x) - (w), (y) - (h), c) +#endif /* RAYLIB */ + +#ifdef RAYLIB_CG +/* Display size. */ +#define DWIDTH 396 +#define DHEIGHT 224 +#endif + +/* Function prototypes. */ +void rInitDisplay(void); +void rDeinitDisplay(void); +void dupdate(void); diff --git a/include/raygint/keyboard.h b/include/raygint/keyboard.h new file mode 100644 index 0000000..9df13e8 --- /dev/null +++ b/include/raygint/keyboard.h @@ -0,0 +1,13 @@ +#pragma once + +#ifdef GINT +#include +#endif /* GINT */ + +#ifdef RAYLIB +/* Simple functions. */ +#define keydown(x) IsKeyDown(x) +#define dclear(x) ClearBackground(x) +/* Useless functions, do nothing. */ +void clearevents(void) {}; +#endif /* RAYLIB */ diff --git a/src/display.c b/src/display.c new file mode 100644 index 0000000..f96fa98 --- /dev/null +++ b/src/display.c @@ -0,0 +1,16 @@ +#include "raygint/display.h" + +#ifdef RAYLIB +void rInitDisplay(void) { + InitWindow(DWIDTH, DHEIGHT, "raygint"); +} + +void rDeinitDisplay(void) { + CloseWindow(); +} + +void dupdate(void) {} +#else +void rInitDisplay(void) {}; +void rDeinitDisplay(void) {}; +#endif