Archived

This topic is now archived and is closed to further replies.

jimmynelson

Directx 9 proble referencing

Recommended Posts

I am having trouble getting a poitner working with the LPDIRECT3DDEVICE9. I use the appwizard and add the following code... GAMESTATCONTROLLER.H class GameStateController; //my the devices needed static LPDIRECT3DDEVICE9 GameDevice; static D3DSURFACE_DESC GameBackBuffer; static DirectInputDevices* InputDevices; class GameState { private: bool pause; public: virtual HRESULT Init() { return S_OK; } virtual HRESULT Cleanup() { return S_OK; } void Pause(bool pb) { pause = pb; } virtual HRESULT FrameMove() { return S_OK; } virtual HRESULT Render() { return S_OK; } }; class GameStateController { public: HRESULT Init(); HRESULT Cleanup(); void SetState(GameState *game); HRESULT FrameMove(); HRESULT Render(); private: // the stack of states GameState *states; }; void GameStateController::SetState(GameState *game) { states=game; } //game independent code //Development main state class Dx9DevMainState : public GameState { private: TCHAR StateName; static Dx9DevMainState m_DevMainState; public: static Dx9DevMainState* Instance() {return &m_DevMainState;} ViewingCamera m_pCameraControl; MeshController m_fMeshes; MeshAnimation m_fAnimations; DX9Mesh m_fTestMesh; ColDet ColDetEngine; // GameStateInfo *GameStates; bool pause; HRESULT Init(); HRESULT Cleanup(); void Pause(bool pb) { pause = pb; } HRESULT FrameMove(); HRESULT Render(); Dx9DevMainState(); //~Dx9DevMainState(); bool ColDetHit; }; Dx9DevMainState Dx9DevMainState::m_DevMainState; //here is just one of the functions inside Dx9DevMainState HRESULT Dx9DevMainState::Render() { GameDevice->Clear( 0L, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER, 0x00000000, 1.0f, 0L ); // Begin the scene if( SUCCEEDED( GameDevice->BeginScene() ) ) { m_fMeshes->drawMeshes(GameDevice); m_fAnimations->drawAnimationsMeshes(m_GameDevice); // RenderText(); GameDevice->EndScene(); } return S_OK; }; The gamedevice I was using in my functions were written earlier before I finshed setting up my framework. So that is the main code I have so in my program when I set GameDevice = m_pd3dDevice; (the main device used in the app) it should work right?

Share this post


Link to post
Share on other sites