Quote:
#ifndef _RENDERDEVICE_H #define _RENDERDEVICE_H class RenderDevice { private: static LPDIRECT3DDEVICE9 m_pd3dDevice; static HWND m_hWindow; static int m_width; static int m_height; public: static LPDIRECT3DDEVICE9 GetDevice(){return m_pd3dDevice;} static HWND GetWindow(){return m_hWindow;} static void Init(LPCWSTR name, int width, int height); static int Update(); static LRESULT CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); }; #endif
Quote:so you can see here that I am having to define a local d3d device so that I can pass it into the CreateDevice() method and then redefine my actual device as static and then pass my local render device back into my static render device. Does this seem right? Am I doing this right? Should I be instancing my RenderDevice? Thanks, Andy
/*static*/ void RenderDevice::Init(LPCWSTR name, int width, int height) { ***missing code*** LPDIRECT3DDEVICE9 pd3dDevice; if( FAILED( pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, m_hWindow, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &pd3dDevice ) ) ) HANDLE_MESSAGE(L" unable to create D3D device "); static LPDIRECT3DDEVICE9 m_pd3dDevice = pd3dDevice; ShowWindow( m_hWindow, SW_SHOWDEFAULT ); }