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 / Example1 / GameClass.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-30  |  2.2 KB  |  85 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.     CD3DFont*     m_pFont;
  48.     CD3DArcBall   m_ArcBall;
  49.  
  50.     CD3DMesh*     m_pAirplane;
  51.  
  52.     Plane *mPlayerConrolledPlane;
  53.     Camera *mPlayerConrolledCamera;
  54.  
  55.     CD3DMesh*     m_pTerrainObject;
  56.     ShadowVolume* m_pShadowVolume;
  57.  
  58.     D3DXMATRIX    m_matObjectMatrix;
  59.     D3DXMATRIX    m_matTerrainMatrix;
  60.  
  61.     LPDIRECT3DVERTEXBUFFER8 m_pBigSquareVB;
  62.     HRESULT DrawShadow();
  63.     HRESULT RenderShadow();
  64.  
  65.     HRESULT ConfirmDevice( D3DCAPS8*, DWORD, D3DFORMAT );
  66.  
  67. protected:
  68.     HRESULT OneTimeSceneInit();
  69.     HRESULT InitDeviceObjects();
  70.     HRESULT RestoreDeviceObjects();
  71.     HRESULT InvalidateDeviceObjects();
  72.     HRESULT DeleteDeviceObjects();
  73.     HRESULT Render();
  74.     HRESULT FrameMove();
  75.     HRESULT FinalCleanup();
  76.  
  77. public:
  78.     LRESULT MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  79.  
  80.     CMyD3DApplication();
  81.     void DoGameStuff(void);
  82. };
  83.  
  84. #endif
  85.