00001 #ifndef LOPER_STANDARD
00002 #define LOPER_STANDARD
00003
00014 #include <assert.h>
00015
00016
00017
00018
00019
00020 #include <math.h>
00021
00023 #ifndef ROUND
00024 #define ROUND(x) ((int)floor(x+0.5))
00025 #endif
00026
00027 #ifndef MAX
00028 #define MAX(a,b) ((a) > (b)?(a):(b))
00029 #endif
00030
00031 #ifndef MIN
00032 #define MIN(a,b) ((a) < (b)?(a):(b))
00033 #endif
00034
00035 #ifndef M_PI
00036 #define M_PI 3.14159265358979323846
00037 #endif
00038
00040 #define CLAMP_MINMAX(_val,_min,_max) (_val>_max)?(_val=_max):((_val<_min)?(_val=_min):(_val))
00041
00042
00043
00044
00045
00046
00047
00048 #ifdef _WIN32
00049 #define NOMINMAX
00050 #include <stdio.h>
00051 #include <stdarg.h>
00052 #include <windows.h>
00053
00054
00055 #pragma warning (disable : 4786)
00056
00057
00058
00059
00060
00061
00062
00063 static void _printDebugString(const char *format, ...)
00064 {
00065 va_list args;
00066 char buffer[512];
00067 va_start(args,format);
00068 _vsnprintf(buffer,sizeof(buffer)-1,format,args);
00069 va_end(args);
00070
00071
00072 ::OutputDebugString(buffer);
00073
00074
00075 printf(buffer);
00076 }
00077
00079 static void _Message(const char *format, ...)
00080 {
00081 va_list args;
00082 char buffer[512];
00083 va_start(args,format);
00084 _vsnprintf(buffer,sizeof(buffer)-1,format,args);
00085 va_end(args);
00086 MessageBox(0, buffer, "", MB_OK);
00087 }
00088
00089 #define printf _printDebugString
00090 #define printWarning _Message
00091
00092 #else // !_WIN32
00093
00094 #define printWarning printf
00095
00096 #endif // _WIN32
00097
00098 #include "Exceptions.hpp"
00099
00100 #endif // LOPER_STANDARD