dxf::GameState Class Reference

#include <dxf_statemanager.h>

Inheritance diagram for dxf::GameState:

dxf::GameStateGUI List of all members.

Public Member Functions

virtual HRESULT Load ()=0
virtual void Unload ()=0
virtual void Update (double fTime, float fElapsedTime)=0
virtual void RenderPre2D (double fTime, float fElapsedTime)
virtual void Render3D (double fTime, float fElapsedTime)
virtual void Render2D (double fTime, float fElapsedTime)=0
virtual void Resize (const D3DSURFACE_DESC *pBackBufferSurfaceDesc)
virtual bool MsgProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
virtual HRESULT OnResetDevice (IDirect3DDevice9 *pd3dDevice, const D3DSURFACE_DESC *pBackBufferSurfaceDesc)
virtual HRESULT OnFrameRender (float fElapsedTime)
virtual void OnGUIEvent (UINT nEvent, int nControlID, CDXUTControl *pControl, void *pUserContext)
virtual HRESULT OnCreateDevice (IDirect3DDevice9 *pd3dDevice, const D3DSURFACE_DESC *pBackBufferSurfaceDesc)
virtual void OnLostDevice ()
virtual void OnDestroyDevice ()

Detailed Description

A state node in the DXFramework state machine. A DXFramework state contains all of the data and logic relevant to whatever is going on at the time. Data and logic that persists throughout many states should either be in global structures or in parent state managers.

The base GameState is used unless use of the DXUT GUI facilities is necessary. In that case, use the derived GameStateGUI.

Definition at line 42 of file dxf_statemanager.h.


Member Function Documentation

virtual HRESULT dxf::GameState::Load (  )  [pure virtual]

Load is called after a change to this state is made, right after the previous state's Unload() function is called. Return S_OK on success.

Implemented in dxf::GameStateGUI.

virtual bool dxf::GameState::MsgProc ( HWND  hWnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
) [inline, virtual]

A client side intercept for the windows message pump. Use to take messages away from the engine, such as the engine's desire to use escape to exit the application, quitting to OS.

Return true if you handled the message, essentially telling the engine that you want it to ignore the message, that you dealt with it.

Return false (the default behavior) if you did not handle the message and you want the engine to do what it pleases with the message.

If you do nothing but return true here, you'll likely get a "Not Responding" tag in the task manager. Bad.

Reimplemented in dxf::GameStateGUI.

Definition at line 92 of file dxf_statemanager.h.

Referenced by dxf::Game::MsgProc().

virtual HRESULT dxf::GameState::OnCreateDevice ( IDirect3DDevice9 *  pd3dDevice,
const D3DSURFACE_DESC *  pBackBufferSurfaceDesc 
) [inline, virtual]

Called when the device is created, passes the call to the Dialog Resource Manager.

Non-GUI apps can ignore this call.

Reimplemented in dxf::GameStateGUI.

Definition at line 121 of file dxf_statemanager.h.

Referenced by dxf::View::OnCreateDevice().

virtual void dxf::GameState::OnDestroyDevice (  )  [inline, virtual]

Called when the device is destroyed, passes the call to the Dialog Resource Manager.

Non-GUI apps can ignore this call.

Reimplemented in dxf::GameStateGUI.

Definition at line 133 of file dxf_statemanager.h.

Referenced by dxf::View::OnDestroyDevice().

virtual HRESULT dxf::GameState::OnFrameRender ( float  fElapsedTime  )  [inline, virtual]

Called right after the Render2D phase, draw the GUI objects on the screen. Simply use to call OnRender on the dialog object.

Non-GUI apps can ignore this call.

Reimplemented in dxf::GameStateGUI.

Definition at line 106 of file dxf_statemanager.h.

virtual void dxf::GameState::OnGUIEvent ( UINT  nEvent,
int  nControlID,
CDXUTControl *  pControl,
void *  pUserContext 
) [inline, virtual]

Called when something happens to a GUI object. Varies with the object. The affected object is identified by the nControlID parameter and is pointed to by pControl which probably needs to be casted into something other than CDXUTControl to be useful in this function. See the GUI demo for an example on what to do here.

Non-GUI apps can ignore this call.

Definition at line 115 of file dxf_statemanager.h.

Referenced by dxf::OnGameStateGUIEvent().

virtual void dxf::GameState::OnLostDevice (  )  [inline, virtual]

Called when the device is lost, passes the call to the Dialog Resource Manager.

Non-GUI apps can ignore this call.

Reimplemented in dxf::GameStateGUI.

Definition at line 127 of file dxf_statemanager.h.

Referenced by dxf::View::OnLostDevice().

virtual HRESULT dxf::GameState::OnResetDevice ( IDirect3DDevice9 *  pd3dDevice,
const D3DSURFACE_DESC *  pBackBufferSurfaceDesc 
) [inline, virtual]

Called when the device is invalidated, the back buffer may be a different size. Reset screen locations and what not of GUI objects if applicable.

Non-GUI apps can ignore this call.

Reimplemented in dxf::GameStateGUI.

Definition at line 99 of file dxf_statemanager.h.

Referenced by dxf::View::OnResetDevice().

virtual void dxf::GameState::Render2D ( double  fTime,
float  fElapsedTime 
) [pure virtual]

The only render function used with 2D applications, used to render on top of any 3D scene that is going on in the background. This is the place to put your GUI in a 3D application.

Referenced by dxf::Model::Render2D().

virtual void dxf::GameState::Render3D ( double  fTime,
float  fElapsedTime 
) [inline, virtual]

Used to render the 3D scene. Not used with 2D applications.

Definition at line 65 of file dxf_statemanager.h.

Referenced by dxf::Model::Render3D().

virtual void dxf::GameState::RenderPre2D ( double  fTime,
float  fElapsedTime 
) [inline, virtual]

Used to render 2D stuff like a static background behind a 3D scene. Not used with 2D applications.

Definition at line 61 of file dxf_statemanager.h.

Referenced by dxf::Model::RenderPre2D().

virtual void dxf::GameState::Resize ( const D3DSURFACE_DESC *  pBackBufferSurfaceDesc  )  [inline, virtual]

Called when the user or the operating system issues a resize or change of the back buffer. Any assumptions made about the back buffer (anything in D3DSURFACE_DESC) are invalid at this point, so make new assumptions.

Definition at line 77 of file dxf_statemanager.h.

Referenced by dxf::StateManager::Resize().

virtual void dxf::GameState::Unload (  )  [pure virtual]

Unload is called when the state is changed from this state. Remove any claims on memory.

Implemented in dxf::GameStateGUI.

Referenced by dxf::StateManager::Unload().

virtual void dxf::GameState::Update ( double  fTime,
float  fElapsedTime 
) [pure virtual]

Update is called during the update phase. Use this time to update your world model, to read input, to perform as much logic as possible before the rendering phase.

Referenced by dxf::Model::OnFrameMove().


The documentation for this class was generated from the following file:
Generated on Fri Aug 18 12:01:29 2006 for DXFramework by  doxygen 1.4.7