1 /* Public domain */ 2 3 #ifndef _AGAR_CORE_CORE_INIT_H_ 4 #define _AGAR_CORE_CORE_INIT_H_ 5 #include <agar/core/begin.h> 6 7 /* Flags for AG_InitCore() */ 8 #define AG_VERBOSE 0x01 /* Allow errors/warning output on console */ 9 #define AG_CREATE_DATADIR 0x02 /* Auto-create data directory on init */ 10 #define AG_SOFT_TIMERS 0x04 /* Do not use hardware timers. A custom event 11 loop will call AG_ProcessTimeouts(). */ 12 13 __BEGIN_DECLS 14 struct ag_event; 15 16 extern char *agProgName; /* User program name */ 17 extern int agVerbose; /* Verbose console output */ 18 extern int agSoftTimers; /* Disable hardware timers */ 19 20 int AG_InitCore(const char *, Uint); 21 void AG_AtExitFunc(void (*)(void)); 22 void AG_AtExitFuncEv(void (*)(struct ag_event *)); 23 void AG_Quit(void) NORETURN_ATTRIBUTE; 24 void AG_Destroy(void); 25 26 #ifdef AG_LEGACY 27 # define AG_InitInput(flags) 28 # define AG_CORE_VERBOSE AG_VERBOSE 29 # define AG_NO_CFG_AUTOLOAD 0x04 /* Former AG_InitCore() option */ 30 #endif /* AG_LEGACY */ 31 __END_DECLS 32 33 /* Utility macros */ 34 #define AG_SETFLAGS(var,flags,cond) \ 35 do { \ 36 if (cond) { \ 37 (var) |= (flags); \ 38 } else { \ 39 (var) &= ~(flags); \ 40 } \ 41 } while (0) 42 43 #define AG_INVFLAGS(var,flags) \ 44 do { \ 45 if ((var) & (flags)) { \ 46 (var) &= ~(flags); \ 47 } else { \ 48 (var) |= (flags); \ 49 } \ 50 } while (0) 51 52 #ifndef AG_MIN 53 #define AG_MIN(a,b) (((a)<(b))?(a):(b)) 54 #endif 55 #ifndef AG_MAX 56 #define AG_MAX(a,b) (((a)>(b))?(a):(b)) 57 #endif 58 #ifndef AG_MIN3 59 #define AG_MIN3(a,b,c) AG_MIN((a),AG_MIN((b),(c))) 60 #endif 61 #ifndef AG_MAX3 62 #define AG_MAX3(a,b,c) AG_MAX((a),AG_MAX((b),(c))) 63 #endif 64 65 #if defined(_WIN32) || defined(_XBOX) 66 # define AG_PATHSEP "\\" 67 # define AG_PATHSEPCHAR '\\' 68 # define AG_PATHSEPMULTI ";" 69 #else 70 # define AG_PATHSEP "/" 71 # define AG_PATHSEPCHAR '/' 72 # define AG_PATHSEPMULTI ":" 73 #endif 74 75 #include <agar/core/close.h> 76 #endif /* _AGAR_CORE_CORE_INIT_H_ */ 77