-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.h
37 lines (33 loc) · 809 Bytes
/
util.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef _UTIL_H_
#define _UTIL_H_
// returns a if a != NULL, else b
#define fallback(a,b) a ? a : b
// always handy
#define max(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a > _b ? _a : _b; })
#define min(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; })
#define clamp(a,b,c) { min(max(a,b),c); }
// configuration struct!
typedef struct {
int useFullscreen;
int noVSync;
int x_resolution;
int y_resolution;
int showHelp;
char* paletteFile;
int numFSAASamples;
double startOffsetRe;
double startOffsetIm;
double startZoom;
int startIterations;
int showFPS;
} cliArgs;
void parseArgs( int argc, char** argv, cliArgs* dest );
void outputHelpText(void);
void checkForGLError( const char* identifier );
#endif