00001
00007 #ifndef GLOBAL_H_KLR402
00008 #define GLOBAL_H_KLR402
00009
00010 #define WIN32_LEAN_AND_MEAN
00011 #define _WIN32_WINNT 0x0500
00012 #define _WIN32_WINDOWS 0x0410
00013 #define WINVER 0x0400
00014 #include <windows.h>
00015
00016 #define DIRECTINPUT_VERSION 0x0800
00017
00018 #ifdef _DEBUG
00019 #define TRACE(x) doTrace( __FILE__, __LINE__, x )
00020 #define TRACE1(x, y) doTrace( __FILE__, __LINE__, x, y )
00021 #define TRACE2(x, y, z) doTrace( __FILE__, __LINE__, x, y, z )
00022 #define TRACE3(x, y, z, a) doTrace( __FILE__, __LINE__, x, y, z, a )
00023 #define TRACE4(x, y, z, a, b) doTrace( __FILE__, __LINE__, x, y, z, a, b )
00024 #else
00025 #define TRACE(x) ((void)0)
00026 #define TRACE1(x, y) ((void)0)
00027 #define TRACE2(x, y, z) ((void)0)
00028 #define TRACE3(x, y, z, a) ((void)0)
00029 #define TRACE4(x, y, z, a, b) ((void)0)
00030 #endif
00031
00032 #define sq(x) ( (x) * (x) )
00033
00034 #define SAFERELEASE( x ) if (x) x->Release(); x=NULL;
00035
00036 #include <d3d8.h>
00037 #include <d3dx8.h>
00038 #include <dxfile.h>
00039 #include <rmxfguid.h>
00040 #include <Dxerr8.h>
00041 #include <dinput.h>
00042 #include <assert.h>
00043 #include <ctime>
00044 #include <cmath>
00045 #include <fstream>
00046 #include <sstream>
00047 #include <string>
00048 #include <vector>
00049 #include <list>
00050 #include <algorithm>
00051 #include <set>
00052 #include <map>
00053 #include <functional>
00054 #include <limits>
00055
00056 #ifndef M_PI
00057 #define M_PI 3.14159265358979323846
00058 #endif
00059
00060 #ifndef M_PI_F
00061 #define M_PI_F 3.14159265358979323846f
00062 #endif
00063
00064
00065 inline float degToRad( float degrees ) {
00066 return degrees / 180.0f * M_PI_F;
00067 }
00068
00072 template <class ObjectType>
00073 std::string toString( const ObjectType& x ) {
00074 ostringstream o;
00075 o << x;
00076 return o.str();
00077 }
00078
00082 void trimString( std::string& );
00083
00084
00085 typedef LPDIRECT3DTEXTURE8 Texture;
00086 typedef LPDIRECT3DDEVICE8 GraphicsDevice;
00087 typedef D3DXMATRIX Matrix;
00088 typedef D3DXQUATERNION Quaternion;
00089 typedef D3DXVECTOR3 Vector;
00090 typedef D3DXVECTOR3 Point;
00091 typedef std::set<std::string> BoneNameSet;
00092
00093
00094 #include "GameDX.h"
00095 #include "Window.h"
00096 #include "Timer.h"
00097 #include "GameDXInput.h"
00098 #include "GameException.h"
00099
00104 extern GameDX* g_dx;
00105
00110 extern GameDXInput* g_DI;
00111
00116 extern Window* g_win;
00117
00118 class ConfigFile;
00119
00123 extern ConfigFile* g_cfg;
00124
00129 LRESULT CALLBACK GlobalWndProc( HWND hWnd, UINT message,
00130 WPARAM wParam, LPARAM lParam );
00131
00137 void doTrace( const char* fn, int lineno, const char* msg, ... );
00138
00139 #endif