README: explain further musl-specific tweaks
[rofl0r-df-libgraphics.git] / g_src / g_basics.h
blobeca424c122ac748fe9f74c25216e1148ae0d548c
1 #ifndef G_BASICS_H
2 #define G_BASICS_H
4 #define MAX_GRID_X 256
5 #define MAX_GRID_Y 256
6 #define MIN_GRID_X 80
7 #define MIN_GRID_Y 25
9 #ifndef MAX
10 # define MAX(a, b) (((a) > (b)) ? (a) : (b))
11 #endif
12 #ifndef MIN
13 # define MIN(a, b) (((a) < (b)) ? (a) : (b))
14 #endif
15 #ifndef ARRSZ
16 # define ARRSZ(arr) (sizeof (arr) / sizeof ((arr)[0]))
17 #endif
18 #ifndef CLAMP
19 #define CLAMP(x,a,b) MIN(MAX((x),(a)),(b))
20 #endif
22 // GL error macro
23 extern int glerrorcount;
25 #ifdef DEBUG
26 # 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);
27 # define deputs(str) puts(str)
28 #else
29 # define printGLError()
30 # define deputs(str)
31 #endif
33 #endif