This commit is contained in:
KikooDX 2021-03-08 15:16:46 +01:00
commit ff3b538ecb
4 changed files with 73 additions and 0 deletions

20
README.md Normal file
View File

@ -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);`

24
include/raygint/display.h Normal file
View File

@ -0,0 +1,24 @@
#pragma once
#ifdef GINT
#include <gint/display.h>
#endif /* GINT */
#ifdef RAYLIB
#include <raylib.h>
/* 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);

View File

@ -0,0 +1,13 @@
#pragma once
#ifdef GINT
#include <gint/keyboard.h>
#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 */

16
src/display.c Normal file
View File

@ -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