From d3432fcc288a53dff9eb219c8857ca48c5981323 Mon Sep 17 00:00:00 2001 From: KonAki Date: Tue, 13 Oct 2026 10:28:17 +0800 Subject: headers: extern C guards and C++ safe vector and rect constructors --- kon/konsofren.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'kon/konsofren.h') 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 -- cgit