home *** CD-ROM | disk | FTP | other *** search
/ Game Programming in C++ - Start to Finish / GameProgrammingS.iso / developer_install / ReplicaNetFreewareV5_4.exe / data1.cab / Program_Executable_Files / Example4 / GameClass.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-30  |  2.5 KB  |  100 lines

  1. /* START_LICENSE_HEADER
  2.  
  3. Copyright (C) 2000 Martin Piper, original design and program code
  4. Copyright (C) 2001-2005 Replica Software
  5.  
  6. This program file is copyright (C) Replica Software and can only be used under license.
  7. For more information visit: http://www.replicanet.com/
  8. Or email: info@replicanet.com
  9.  
  10. END_LICENSE_HEADER */
  11. #ifndef __GAMECLASS_H__
  12. #define __GAMECLASS_H__
  13.  
  14. #include "Shadow.h"
  15.  
  16. //-----------------------------------------------------------------------------
  17. // External definitions and prototypes
  18. //-----------------------------------------------------------------------------
  19. inline DWORD FtoDW( FLOAT f ) { return *((DWORD*)&f); }
  20.  
  21. struct VERTEX
  22. {
  23.     D3DXVECTOR3 p;
  24.     D3DXVECTOR3 n;
  25.     FLOAT       tu, tv;
  26. };
  27.  
  28. struct SHADOWVERTEX
  29. {
  30.     D3DXVECTOR4 p;
  31.     D3DCOLOR    color;
  32. };
  33.  
  34. #define D3DFVF_VERTEX       (D3DFVF_XYZ|D3DFVF_NORMAL|D3DFVF_TEX1)
  35. #define D3DFVF_SHADOWVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)
  36.  
  37. extern char *gCommandLine;
  38.  
  39. //-----------------------------------------------------------------------------
  40. // Name: class CMyD3DApplication
  41. // Desc: Application class. The base class (CD3DApplication) provides the 
  42. //       generic functionality needed in all Direct3D samples. CMyD3DApplication 
  43. //       adds functionality specific to this sample program.
  44. //-----------------------------------------------------------------------------
  45. class CMyD3DApplication : public CD3DApplication
  46. {
  47. private:
  48.     CD3DFont*     m_pFont;
  49.     CD3DArcBall   m_ArcBall;
  50.  
  51.     CD3DMesh*     m_pAirplane;
  52.  
  53. public:
  54.     Plane *mPlayerConrolledPlane;
  55. private:
  56.     Camera *mPlayerConrolledCamera;
  57.  
  58.     CD3DMesh*     m_pTerrainObject;
  59.     ShadowVolume* m_pShadowVolume;
  60.  
  61.     D3DXMATRIX    m_matObjectMatrix;
  62.     D3DXMATRIX    m_matTerrainMatrix;
  63.  
  64.     LPDIRECT3DVERTEXBUFFER8 m_pBigSquareVB;
  65.     HRESULT DrawShadow();
  66.     HRESULT RenderShadow();
  67.  
  68.     HRESULT ConfirmDevice( D3DCAPS8*, DWORD, D3DFORMAT );
  69.  
  70. protected:
  71.     HRESULT OneTimeSceneInit();
  72.     HRESULT InitDeviceObjects();
  73.     HRESULT RestoreDeviceObjects();
  74.     HRESULT InvalidateDeviceObjects();
  75.     HRESULT DeleteDeviceObjects();
  76.     HRESULT Render();
  77.     HRESULT FrameMove();
  78.     HRESULT FinalCleanup();
  79.  
  80.  
  81.     HRESULT RenderModels();
  82.  
  83. public:
  84.     LRESULT MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  85.  
  86.     CMyD3DApplication();
  87.     void DoGameStuff(void);
  88.     static CMyD3DApplication *GetCMyD3DApplication(void);
  89.  
  90. private:
  91.     float mLastFrameTime;
  92.     static CMyD3DApplication *mSingleton;
  93. };
  94.  
  95. extern CD3DMesh*     gpAirplaneMesh;
  96. extern CD3DMesh*     gpProjectileMesh;
  97. extern CD3DMesh*     gpEnemyMesh;
  98.  
  99. #endif
  100.