summaryrefslogtreecommitdiff
path: root/g_src/g_basics.h
diff options
context:
space:
mode:
Diffstat (limited to 'g_src/g_basics.h')
-rwxr-xr-xg_src/g_basics.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/g_src/g_basics.h b/g_src/g_basics.h
new file mode 100755
index 0000000..eca424c
--- /dev/null
+++ b/g_src/g_basics.h
@@ -0,0 +1,33 @@
+#ifndef G_BASICS_H
+#define G_BASICS_H
+
+#define MAX_GRID_X 256
+#define MAX_GRID_Y 256
+#define MIN_GRID_X 80
+#define MIN_GRID_Y 25
+
+#ifndef MAX
+# define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#endif
+#ifndef MIN
+# define MIN(a, b) (((a) < (b)) ? (a) : (b))
+#endif
+#ifndef ARRSZ
+# define ARRSZ(arr) (sizeof (arr) / sizeof ((arr)[0]))
+#endif
+#ifndef CLAMP
+#define CLAMP(x,a,b) MIN(MAX((x),(a)),(b))
+#endif
+
+// GL error macro
+extern int glerrorcount;
+
+#ifdef DEBUG
+# define printGLError() do { GLenum err; do { err = glGetError(); if (err && glerrorcount < 40) { printf("GL error: 0x%x in %s:%d\n", err, __FILE__ , __LINE__); glerrorcount++; } } while(err); } while(0);
+# define deputs(str) puts(str)
+#else
+# define printGLError()
+# define deputs(str)
+#endif
+
+#endif