summaryrefslogtreecommitdiff
path: root/kon/konsofren.h
diff options
context:
space:
mode:
authorKonAki <konaki@anokonaki.org>2026-10-13 10:28:17 +0800
committerKonAki <konaki@anokonaki.org>2026-10-13 10:28:17 +0800
commitd3432fcc288a53dff9eb219c8857ca48c5981323 (patch)
treefba5cc730c91d2c674efe6d71dd20e9d6bf7d0d8 /kon/konsofren.h
parenta2dc5ca4c659e2d0a9527cd0910bc76b65e6d09f (diff)
headers: extern C guards and C++ safe vector and rect constructors
Diffstat (limited to 'kon/konsofren.h')
-rw-r--r--kon/konsofren.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/kon/konsofren.h b/kon/konsofren.h
index b03139d..3d68dd4 100644
--- a/kon/konsofren.h
+++ b/kon/konsofren.h
@@ -36,6 +36,10 @@
#include "konmath.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define KON_BACKGROUND_COLOR 0xFF05050A
typedef struct kon_framebuffer {
@@ -68,7 +72,12 @@ typedef enum kon_blend {
typedef struct kon_rect { int x, y, w, h; } kon_rect_t;
+#ifdef __cplusplus
+static inline kon_rect_t kon_makeRect_(int x, int y, int w, int h) { kon_rect_t r; r.x = x; r.y = y; r.w = w; r.h = h; return r; }
+#define KON_RECT(x, y, w, h) kon_makeRect_((int)(x), (int)(y), (int)(w), (int)(h))
+#else
#define KON_RECT(x, y, w, h) ((kon_rect_t){(int)(x), (int)(y), (int)(w), (int)(h)})
+#endif
@@ -291,6 +300,10 @@ extern const kon_mesh_t kon_cubeMesh;
/*** implementation ***/
+
+#ifdef __cplusplus
+}
+#endif
#ifdef KONSOFREN_IMPLEMENTATION