20 #ifndef __SBG_DEFINES_H__ 21 #define __SBG_DEFINES_H__ 27 #define SBG_DISABLE (0) 31 #define SBG_ENABLE (1) 46 #ifndef SBG_INVALID_HANDLE 47 #define SBG_INVALID_HANDLE (0x00000000u) 51 #define SBG_NOT_FOUND (0xFFFFFFFFu) 55 #define SBG_UNDEFINED (0xFFFFFFFFu) 58 #ifndef SBG_ARRAY_SIZE 59 #define SBG_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) 67 #define __BASE_FILE__ __FILE__ 72 #define SBG_DELETE(p) if (p){delete (p); (p) = NULL;} 73 #define SBG_DELETE_ARRAY(p) if (p){delete[] (p); (p) = NULL;} 74 #define SBG_FREE(p) if (p){free(p); (p) = NULL;} 75 #define SBG_FREE_ARRAY(p) if (p){free(p); (p) = NULL;} 77 #define SBG_DELETE if (p){free(p); (p) = NULL;} 78 #define SBG_DELETE_ARRAY if (p){free(p); (p) = NULL;} 79 #define SBG_FREE(p) if (p){free(p); (p) = NULL;} 80 #define SBG_FREE_ARRAY(p) if (p){free(p); (p) = NULL;} 91 #if defined(_WIN32) || defined(WIN32) 92 #define SBG_INLINE __inline 94 #define SBG_INLINE static inline 101 #ifndef SBG_UNUSED_PARAMETER 102 #define SBG_UNUSED_PARAMETER(x) (void)(x) 114 #define SBG_BEGIN_PACKED() 115 #elif defined(_MSC_VER) 116 #define SBG_BEGIN_PACKED() __pragma(pack(push, 1)) 118 #error you must byte-align these structures with the appropriate compiler directives 125 #define SBG_PACKED __attribute__((packed)) 126 #elif defined(_MSC_VER) 129 #error you must byte-align these structures with the appropriate compiler directives 136 #define SBG_END_PACKED() 137 #elif defined(_MSC_VER) 138 #define SBG_END_PACKED() __pragma(pack(pop)) 140 #error you must byte-align these structures with the appropriate compiler directives 151 #define SBG_DEPRECATED(func) func __attribute__ ((deprecated)) 152 #elif defined(_MSC_VER) 153 #define SBG_DEPRECATED(func) __declspec(deprecated) func 156 #define SBG_DEPRECATED(func) func 163 #define SBG_DEPRECATED_MACRO(func) __pragma(deprecated(func)) 164 #elif defined(_MSC_VER) 165 #define SBG_DEPRECATED_MACRO(func) __pragma(deprecated(func)) 168 #define SBG_DEPRECATED_MACRO(func) func 175 #define SBG_PI 3.14159265358979323846 179 #define SBG_PI_F 3.14159265358979323846f 189 #define sbgMax(a,b) (((a) > (b)) ? (a) : (b)) 199 #define sbgMin(a,b) (((a) < (b)) ? (a) : (b)) 210 #define sbgClamp(value, minValue, maxValue) (((value) < (minValue))?(minValue): ((value) > (maxValue)?maxValue:value)) 220 return angle * 180.0 /
SBG_PI;
230 return angle *
SBG_PI / 180.0;
SBG_INLINE float sbgRadToDegF(float angle)
SBG_INLINE float sbgDegToRadF(float angle)
SBG_INLINE double sbgRadToDegD(double angle)
SBG_INLINE double sbgDegToRadD(double angle)