summaryrefslogtreecommitdiff
path: root/kon/konsofren.h
diff options
context:
space:
mode:
authorKonAki <konaki@anokonaki.org>2026-10-11 21:53:50 +0800
committerKonAki <konaki@anokonaki.org>2026-10-11 21:53:50 +0800
commit42630ebee76996a37f5104e6e11b860f31634dab (patch)
tree566e9dd1b51fa0ee68090036e02b957249e23ad3 /kon/konsofren.h
parent3ea9d25f9eb240b57e40434abade106add157a8d (diff)
konsofren: KONSOFREN_NO_3D, build.sh turns it on for 2D builds
Diffstat (limited to 'kon/konsofren.h')
-rw-r--r--kon/konsofren.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/kon/konsofren.h b/kon/konsofren.h
index 9b71a64..d7f3570 100644
--- a/kon/konsofren.h
+++ b/kon/konsofren.h
@@ -26,6 +26,9 @@
#ifndef KONSOFREN_H
#define KONSOFREN_H
+/* define KONSOFREN_NO_3D (in every file that includes this, and where the implementation is) for a 2D game, the cameras,
+ triangles, meshes and billboards are left out. 3D is on by default */
+
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -74,6 +77,8 @@ typedef struct kon_display {
kon_filter_t filter;
} kon_display_t;
+#ifndef KONSOFREN_NO_3D
+
typedef enum kon_projection {
KON_PROJECTION_PERSPECTIVE = 0,
KON_PROJECTION_ORTHOGRAPHIC
@@ -147,6 +152,8 @@ typedef struct kon_mesh {
int triangleCount;
} kon_mesh_t;
+#endif /* KONSOFREN_NO_3D */
+
/*** 2D declarations ***/
/*** framebuffer declarations ***/
@@ -201,6 +208,8 @@ void kon_presentDisplay(kon_display_t *display);
/* returns 0 if the window position is on a bar, outside the game image */
int kon_windowToGame(const kon_display_t *display, int windowX, int windowY, int *gameX, int *gameY);
+#ifndef KONSOFREN_NO_3D
+
/*** 3D declarations ***/
/*** camera declarations ***/
@@ -241,6 +250,8 @@ int kon_drawBillboard(kon_framebuffer_t *fb, kon_mat4_t viewProjection, kon_vec3
/* cube from -1 to 1 with every face mapped to the whole texture */
extern const kon_mesh_t kon_cubeMesh;
+#endif /* KONSOFREN_NO_3D */
+
/*** implementation ***/
#ifdef KONSOFREN_IMPLEMENTATION
@@ -985,6 +996,8 @@ int kon_windowToGame(const kon_display_t *display, int windowX, int windowY, int
return 1;
}
+#ifndef KONSOFREN_NO_3D
+
/*** 3D implementation ***/
@@ -1637,6 +1650,7 @@ int kon_drawBillboard(kon_framebuffer_t *fb, kon_mat4_t viewProjection, kon_vec3
return 1;
}
+#endif /* KONSOFREN_NO_3D */
#endif /* end of KONSOFREN_IMPLEMENTATION */
#endif