If you have time could you give me your opinion of my dx code / fixes
-
#define WIN32_LEAN_AND_MEAN // no to MFC /////////////////////////////////////////////////////////////////////////////////////////// // INCLUDE DIRECTIVES ///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// #include #include #pragma warning( disable : 4996 ) // disable deprecated warning #include #pragma warning( default : 4996 ) /////////////////////////////////////////////////////////////////////////////////////////// // DEFINES //////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// // for D3D objects that don't have an explicit release function #define SAFE_RELEASE(p) { if(p) { (p)->Release(); (p)=NULL; } } // free up anything allocated with "new" #define SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } } // anything allocated with new [] #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p); (p)=NULL; } } // The window caption. #define WINDOW_CAPTION L"D3D Tutorial 01: CreateDevice" // The window class. #define WINDOW_CLASS L"D3D Tutorial" /////////////////////////////////////////////////////////////////////////////////////////// // FUNCTION PROTOTYPES //////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// HRESULT InitD3D( HWND hWnd ); VOID Cleanup(); VOID Render(); /////////////////////////////////////////////////////////////////////////////////////////// // GLOBAL VARIABLES /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// LPDIRECT3D9 g_pD3D = NULL; // Used to create the D3DDevice LPDIRECT3DDEVICE9 g_pd3dDevice = NULL; // Our rendering device /////////////////////////////////////////////////////////////////////////////////////////// // FUNCTION DEFINITIONS /////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// HRESULT InitD3D( HWND hWnd ) { // Create the D3D object, which is needed to create the D3DDevice. if( ( g_pD3D = Direct3DCreate9( D3D_SDK_VERSION ) ) == NULL ) { return E_FAIL; } // Set up the structure used to create