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