#ifndef OF_CONSTANTS
#define OF_CONSTANTS


//-------------------------------
// 		pc or mac ?
// 		soon: pc, mac or linux...

#ifndef __APPLE_CC__
	#define TARGET_WIN32
#else
	#define TARGET_OSX
#endif

//-------------------------------


// then the the platform specific includes:
#ifdef TARGET_WIN32
	#include <windows.h>
	#include "GLee.h"
	#include "glut.h"
	#define __WINDOWS_DS__
	#define __WINDOWS_MM__
	#if (_MSC_VER)       // microsoft visual studio
		#pragma warning(disable : 4996)     // disable all deprecation warnings
		#pragma warning(disable : 4068)     // unknown pragmas
		#pragma warning(disable : 4101)     // unreferenced local variable
		#pragma	warning(disable : 4312)		// type cast conversion (in qt vp)
		#pragma warning(disable : 4311)		// type cast pointer truncation (qt vp)
	#endif

	#define TARGET_LITTLE_ENDIAN			// intel cpu

	// some gl.h files, like dev-c++, are old - this is pretty universal
	#ifndef GL_BGR_EXT
	#define GL_BGR_EXT 0x80E0
	#endif 

	// #define WIN32_HIGH_RES_TIMING

	// note: this is experimental!
	// uncomment to turn this on (only for windows machines)
	// if you want to try setting the timer to be high resolution
	// this could make camera grabbing and other low level
	// operations quicker, but you must quit the app normally,
	// ie, using "esc", rather than killing the process or closing
	// the console window in order to set the timer resolution back
	// to normal (since the high res timer might give the OS
	// problems)
	// info: http://www.geisswerks.com/ryan/FAQS/timing.html

#endif

#ifdef TARGET_OSX
	#define __MACOSX_CORE__
	#include <unistd.h>
	#include "GLee.h"
	#include <GLUT/glut.h>

	#if defined(__LITTLE_ENDIAN__)
		#define TARGET_LITTLE_ENDIAN		// intel cpu
	#endif
#endif

#ifndef __MWERKS__
#define OF_EXIT_APP(val)		exit(val);
#else
#define OF_EXIT_APP(val)		std::exit(val);
#endif


// comment out this line, if you'd like to use the
// quicktime capture interface on windows
// if not, we default to videoInput library for
// direct show capture, which is quite

#define OF_SWITCH_TO_DSHOW_FOR_WIN_VIDCAP

#ifdef OF_SWITCH_TO_DSHOW_FOR_WIN_VIDCAP
	#ifdef TARGET_OSX
		#define OF_VIDEO_CAPTURE_QUICKTIME
	#else
		#define OF_VIDEO_CAPTURE_DIRECTSHOW
	#endif
#else
	// all quicktime, all the time
	#define OF_VIDEO_CAPTURE_QUICKTIME
#endif




// core: ---------------------------
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>

#ifndef PI
	#define PI       3.14159265358979323846
#endif

#ifndef TWO_PI
	#define TWO_PI   6.28318530717958647693
#endif

#ifndef M_TWO_PI
	#define M_TWO_PI   6.28318530717958647693
#endif

#ifndef FOUR_PI
	#define FOUR_PI 12.56637061435917295385
#endif

#ifndef HALF_PI
	#define HALF_PI  1.57079632679489661923
#endif

#ifndef DEG_TO_RAD
	#define DEG_TO_RAD (PI/180.0)
#endif

#ifndef RAD_TO_DEG
	#define RAD_TO_DEG (180.0/PI)
#endif

#ifndef MIN
	#define MIN(x,y) (((x) < (y)) ? (x) : (y))
#endif

#ifndef MAX
	#define MAX(x,y) (((x) > (y)) ? (x) : (y))
#endif

#ifndef CLAMP
	#define CLAMP(x,y,z) (MIN(MAX(x,y),z))
#endif


#ifndef ABS
	#define ABS(x) (((x) < 0) ? -(x) : (x))
#endif

#define 	OF_FILLED				0x01
#define 	OF_OUTLINE				0x02
#define 	OF_WINDOW 				0
#define 	OF_FULLSCREEN 			1

#define 	OF_RECTMODE_CORNER				0
#define 	OF_RECTMODE_CENTER				1


//---------------------------------------------------------
// on mac machines, we will put files near the app (bundle), not using
// xcode anymore (because it mangles folders badly) 
// so we need to add ../../../ to traverse our way out of the 
// package, where the actuall binary is. 
// this will help make mac and pc distributions much cleaner. 
static char ofFilePath[1024];
inline char * 	ofGetFilePath(char * fileName){
	#ifdef TARGET_OSX
		sprintf(ofFilePath, "../../../%s", fileName);
	#endif
	#ifdef TARGET_WIN32
		sprintf(ofFilePath, "%s", fileName);
	#endif
	return ofFilePath;
}
//-----------------------------------------------------------

#endif
