00001 #ifndef __DEFAULT_DEFINE_HPP
00002 #define __DEFAULT_DEFINE_HPP
00003
00004 #pragma comment(lib,"winmm.lib")
00005 #pragma comment(lib,"comctl32.lib")
00006 #pragma comment(lib,"dxerr9.lib")
00007 #pragma comment(lib,"d3d9.lib")
00008 #pragma comment(lib,"d3dx9.lib")
00009 #pragma comment(lib,"dinput8.lib")
00010 #pragma comment(lib,"dxguid.lib")
00011
00012
00013 #ifndef DIRECTINPUT_VERSION
00014 #define DIRECTINPUT_VERSION 0x0800
00015 #endif
00016
00017 #include <windows.h>
00018 #include <d3d9.h>
00019 #include <d3dx9.h>
00020 #include <dxerr9.h>
00021 #include <dinput.h>
00022
00023
00024 #ifndef SAFE_RELEASE
00025 #define SAFE_RELEASE(p) {if((p)){(p)->Release();(p) = NULL;}}
00026 #endif
00027
00028 #ifndef SAFE_DELETE
00029 #define SAFE_DELETE(p) {if((p)){delete (p); (p) = NULL;}}
00030 #endif
00031
00032 #ifndef SAFE_DELETE_ARRAY
00033 #define SAFE_DELETE_ARRAY(p) {if((p)){delete[] (p); (p) = NULL;}}
00034 #endif
00035
00036 #ifndef SHOW_DXERR_STRING
00037 #define SHOW_DXERR_STRING
00038 inline HRESULT ShowDXErrorString(HRESULT hr){char msg[256];return DXTrace(__FILE__,__LINE__,hr,msg,TRUE);}
00039 #endif
00040
00041
00042 #ifndef EPSILON
00043 #define EPSILON 0.0001f
00044 #endif
00045
00046
00047 #ifndef SHOW_WINERR_STRING
00048 #define SHOW_WINERR_STRING
00049 inline VOID ShowErrorString(DWORD error_code,char *title)
00050 {
00051 LPVOID lpMsgBuf;
00052
00053
00054
00055 SetLastError(NO_ERROR);
00056
00057 if(error_code != ERROR_SUCCESS)
00058 {
00059
00060 FormatMessage(
00061 FORMAT_MESSAGE_ALLOCATE_BUFFER |
00062 FORMAT_MESSAGE_FROM_SYSTEM |
00063 FORMAT_MESSAGE_IGNORE_INSERTS,
00064 NULL, error_code,
00065 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
00066 (LPTSTR) &lpMsgBuf, 0, NULL);
00067
00068 MessageBox(NULL, (const char*)lpMsgBuf, title, MB_OK);
00069 LocalFree(lpMsgBuf);
00070 }
00071 }
00072 #endif
00073
00074
00075 #define FVF_MYVERTEX (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_TEX1)
00076 typedef struct _tag_MYVERTEX {
00077 D3DXVECTOR3 vecPos;
00078 D3DCOLOR colColor;
00079 D3DXVECTOR2 vecTexPos;
00080 }MYVERTEX;
00081
00082 #endif