Go to the documentation of this file.00001 #ifndef OF_CONSTANTS
00002 #define OF_CONSTANTS
00003
00004
00005 #define OF_VERSION 6
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #if defined( __WIN32__ ) || defined( _WIN32 )
00016 #define TARGET_WIN32
00017 #elif defined( __APPLE_CC__)
00018 #include <TargetConditionals.h>
00019
00020 #if (TARGET_OF_IPHONE_SIMULATOR) || (TARGET_OS_IPHONE) || (TARGET_IPHONE)
00021 #define TARGET_OF_IPHONE
00022 #define TARGET_OPENGLES
00023 #else
00024 #define TARGET_OSX
00025 #endif
00026 #else
00027 #define TARGET_LINUX
00028 #endif
00029
00030
00031
00032
00033 #ifdef TARGET_WIN32
00034
00035
00036 #ifndef _WIN32_WINNT
00037 # define _WIN32_WINNT 0x400
00038 #endif
00039 #define WIN32_LEAN_AND_MEAN
00040 #include <windows.h>
00041
00042
00043 #define __WINDOWS_DS__
00044 #define __WINDOWS_MM__
00045 #if (_MSC_VER) // microsoft visual studio
00046 #pragma warning(disable : 4996) // disable all deprecation warnings
00047 #pragma warning(disable : 4068) // unknown pragmas
00048 #pragma warning(disable : 4101) // unreferenced local variable
00049 #pragma warning(disable : 4312) // type cast conversion (in qt vp)
00050 #pragma warning(disable : 4311) // type cast pointer truncation (qt vp)
00051 #pragma warning(disable : 4018) // signed/unsigned mismatch (since vector.size() is a size_t)
00052 #pragma warning(disable : 4267) // conversion from size_t to Size warning... possible loss of data
00053 #pragma warning(disable : 4800) // 'Boolean' : forcing value to bool 'true' or 'false'
00054 #pragma warning(disable : 4099) // for debug, PDB 'vc80.pdb' was not found with...
00055 #endif
00056
00057 #define TARGET_LITTLE_ENDIAN // intel cpu
00058
00059
00060 #ifndef GL_BGR_EXT
00061 #define GL_BGR_EXT 0x80E0
00062 #endif
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077 #endif
00078
00079 #ifdef TARGET_OSX
00080 #ifndef __MACOSX_CORE__
00081 #define __MACOSX_CORE__
00082 #endif
00083 #include <unistd.h>
00084 #include "GLee.h"
00085 #include <OpenGL/glu.h>
00086 #include <ApplicationServices/ApplicationServices.h>
00087
00088 #if defined(__LITTLE_ENDIAN__)
00089 #define TARGET_LITTLE_ENDIAN // intel cpu
00090 #endif
00091 #endif
00092
00093 #ifdef TARGET_LINUX
00094 #include <unistd.h>
00095 #include "GLee.h"
00096 #include <GL/glu.h>
00097
00098
00099
00100
00101
00102
00103 #define TARGET_LITTLE_ENDIAN // intel cpu
00104
00105
00106
00107 #define B14400 14400
00108 #define B28800 28800
00109
00110
00111 #endif
00112
00113
00114 #ifdef TARGET_OF_IPHONE
00115 #import <OpenGLES/ES1/gl.h>
00116 #import <OpenGLES/ES1/glext.h>
00117 #endif
00118
00119
00120 #ifndef __MWERKS__
00121 #define OF_EXIT_APP(val) std::exit(val);
00122 #else
00123 #define OF_EXIT_APP(val) std::exit(val);
00124 #endif
00125
00126
00127
00128
00129
00130
00131
00132 #ifdef TARGET_LINUX
00133
00134
00135
00136
00137
00138
00139
00140
00141 #define OF_SWITCH_TO_UNICAP_FOR_LINUX_VIDCAP
00142
00143
00144
00145 #ifdef OF_SWITCH_TO_UNICAP_FOR_LINUX_VIDCAP
00146 #define OF_VIDEO_CAPTURE_UNICAP
00147 #else
00148 #define OF_VIDEO_CAPTURE_V4L
00149 #endif
00150
00151
00152
00153 #else
00154
00155
00156
00157
00158
00159
00160
00161
00162 #define OF_SWITCH_TO_DSHOW_FOR_WIN_VIDCAP
00163
00164 #ifdef OF_SWITCH_TO_DSHOW_FOR_WIN_VIDCAP
00165 #ifdef TARGET_OSX
00166 #define OF_VIDEO_CAPTURE_QUICKTIME
00167 #else
00168 #define OF_VIDEO_CAPTURE_DIRECTSHOW
00169 #endif
00170 #else
00171
00172 #define OF_VIDEO_CAPTURE_QUICKTIME
00173 #endif
00174 #endif
00175
00176
00177 #ifdef TARGET_LINUX
00178 #define OF_VIDEO_PLAYER_GSTREAMER
00179 #else
00180 #define OF_VIDEO_PLAYER_QUICKTIME
00181 #endif
00182
00183
00184 #ifndef TARGET_OF_IPHONE
00185 #define OF_USING_POCO
00186 #endif
00187
00188
00189
00190 class ofBaseApp;
00191 typedef ofBaseApp ofSimpleApp;
00192
00193 enum ofLogLevel{
00194 OF_LOG_VERBOSE,
00195 OF_LOG_NOTICE,
00196 OF_LOG_WARNING,
00197 OF_LOG_ERROR,
00198 OF_LOG_FATAL_ERROR,
00199 OF_LOG_SILENT
00200 };
00201
00202 #define OF_DEFAULT_LOG_LEVEL OF_LOG_WARNING;
00203
00204
00205 #define OF_SERIAL_NO_DATA -2
00206 #define OF_SERIAL_ERROR -1
00207
00208
00209 #include <stdio.h>
00210 #include <stdarg.h>
00211 #include <math.h>
00212 #include <time.h>
00213 #include <stdlib.h>
00214 #include <string.h>
00215 #include <iostream>
00216 #include <vector>
00217 #include <string>
00218 #include <sstream>
00219 #include <iomanip>
00220 using namespace std;
00221
00222 #ifndef PI
00223 #define PI 3.14159265358979323846
00224 #endif
00225
00226 #ifndef TWO_PI
00227 #define TWO_PI 6.28318530717958647693
00228 #endif
00229
00230 #ifndef M_TWO_PI
00231 #define M_TWO_PI 6.28318530717958647693
00232 #endif
00233
00234 #ifndef FOUR_PI
00235 #define FOUR_PI 12.56637061435917295385
00236 #endif
00237
00238 #ifndef HALF_PI
00239 #define HALF_PI 1.57079632679489661923
00240 #endif
00241
00242 #ifndef DEG_TO_RAD
00243 #define DEG_TO_RAD (PI/180.0)
00244 #endif
00245
00246 #ifndef RAD_TO_DEG
00247 #define RAD_TO_DEG (180.0/PI)
00248 #endif
00249
00250 #ifndef MIN
00251 #define MIN(x,y) (((x) < (y)) ? (x) : (y))
00252 #endif
00253
00254 #ifndef MAX
00255 #define MAX(x,y) (((x) > (y)) ? (x) : (y))
00256 #endif
00257
00258 #ifndef CLAMP
00259 #define CLAMP(val,min,max) (MAX(MIN(val,max),min))
00260 #endif
00261
00262 #ifndef ABS
00263 #define ABS(x) (((x) < 0) ? -(x) : (x))
00264 #endif
00265
00266 #define OF_FILLED 0x01
00267 #define OF_OUTLINE 0x02
00268 #define OF_WINDOW 0
00269 #define OF_FULLSCREEN 1
00270 #define OF_GAME_MODE 2
00271
00272 #define OF_RECTMODE_CORNER 0
00273 #define OF_RECTMODE_CENTER 1
00274
00275 #define OF_IMAGE_GRAYSCALE 0x00
00276 #define OF_IMAGE_COLOR 0x01
00277 #define OF_IMAGE_COLOR_ALPHA 0x02
00278 #define OF_IMAGE_UNDEFINED 0x03
00279
00280 #define OF_MAX_STYLE_HISTORY 32
00281 #define OF_MAX_CIRCLE_PTS 1024
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295 #define OF_POLY_WINDING_ODD 100130
00296 #define OF_POLY_WINDING_NONZERO 100131
00297 #define OF_POLY_WINDING_POSITIVE 100132
00298 #define OF_POLY_WINDING_NEGATIVE 100133
00299 #define OF_POLY_WINDING_ABS_GEQ_TWO 100134
00300
00301 #define OF_CLOSE (true)
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319 #define OF_KEY_MODIFIER 0x0100
00320 #define OF_KEY_RETURN 13
00321 #define OF_KEY_ESC 27
00322
00323
00324
00325
00326 #ifdef TARGET_OSX
00327 #define OF_KEY_BACKSPACE 127
00328 #define OF_KEY_DEL 8
00329 #else
00330 #define OF_KEY_BACKSPACE 8
00331 #define OF_KEY_DEL 127
00332 #endif
00333
00334
00335
00336
00337
00338 #define OF_KEY_F1 (1 | OF_KEY_MODIFIER)
00339 #define OF_KEY_F2 (2 | OF_KEY_MODIFIER)
00340 #define OF_KEY_F3 (3 | OF_KEY_MODIFIER)
00341 #define OF_KEY_F4 (4 | OF_KEY_MODIFIER)
00342 #define OF_KEY_F5 (5 | OF_KEY_MODIFIER)
00343 #define OF_KEY_F6 (6 | OF_KEY_MODIFIER)
00344 #define OF_KEY_F7 (7 | OF_KEY_MODIFIER)
00345 #define OF_KEY_F8 (8 | OF_KEY_MODIFIER)
00346 #define OF_KEY_F9 (9 | OF_KEY_MODIFIER)
00347 #define OF_KEY_F10 (10 | OF_KEY_MODIFIER)
00348 #define OF_KEY_F11 (11 | OF_KEY_MODIFIER)
00349 #define OF_KEY_F12 (12 | OF_KEY_MODIFIER)
00350 #define OF_KEY_LEFT (100 | OF_KEY_MODIFIER)
00351 #define OF_KEY_UP (101 | OF_KEY_MODIFIER)
00352 #define OF_KEY_RIGHT (102 | OF_KEY_MODIFIER)
00353 #define OF_KEY_DOWN (103 | OF_KEY_MODIFIER)
00354 #define OF_KEY_PAGE_UP (104 | OF_KEY_MODIFIER)
00355 #define OF_KEY_PAGE_DOWN (105 | OF_KEY_MODIFIER)
00356 #define OF_KEY_HOME (106 | OF_KEY_MODIFIER)
00357 #define OF_KEY_END (107 | OF_KEY_MODIFIER)
00358 #define OF_KEY_INSERT (108 | OF_KEY_MODIFIER)
00359
00360
00361
00362
00363
00364
00365
00366 #ifdef TARGET_WIN32
00367
00368 #define OF_CONSOLE_COLOR_RESTORE (0 | (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE) )
00369 #define OF_CONSOLE_COLOR_BLACK (0)
00370 #define OF_CONSOLE_COLOR_RED (FOREGROUND_RED)
00371 #define OF_CONSOLE_COLOR_GREEN (FOREGROUND_GREEN)
00372 #define OF_CONSOLE_COLOR_YELLOW (FOREGROUND_RED|FOREGROUND_GREEN)
00373 #define OF_CONSOLE_COLOR_BLUE (FOREGROUND_BLUE)
00374 #define OF_CONSOLE_COLOR_PURPLE (FOREGROUND_RED | FOREGROUND_BLUE )
00375 #define OF_CONSOLE_COLOR_CYAN (FOREGROUND_GREEN | FOREGROUND_BLUE)
00376 #define OF_CONSOLE_COLOR_WHITE (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE)
00377
00378 #else
00379
00380 #define OF_CONSOLE_COLOR_RESTORE (0)
00381 #define OF_CONSOLE_COLOR_BLACK (30)
00382 #define OF_CONSOLE_COLOR_RED (31)
00383 #define OF_CONSOLE_COLOR_GREEN (32)
00384 #define OF_CONSOLE_COLOR_YELLOW (33)
00385 #define OF_CONSOLE_COLOR_BLUE (34)
00386 #define OF_CONSOLE_COLOR_PURPLE (35)
00387 #define OF_CONSOLE_COLOR_CYAN (36)
00388 #define OF_CONSOLE_COLOR_WHITE (37)
00389
00390 #endif
00391
00392
00393
00394 #endif