home *** CD-ROM | disk | FTP | other *** search
/ Game Audio Programming / GameAudioProgramming.iso / Extras / Sensaura / SDK1.0 / data1.cab / Example_Files / DS3DDemo / Source / dxworld.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-13  |  3.5 KB  |  115 lines

  1. /*
  2.     Company:            Sensaura
  3.     Copyright:          (C) 1999
  4.  
  5.     Software Project:    Sensaura DirectSound3D Demo
  6.     File Name:            dxworld.h
  7.     File Description:    Header file for definition of DirectXWorld class
  8.     Author:                Adam Philp
  9.     File Version:        1.02.000
  10.     Last Update:        11-FEB-99
  11.  
  12.     Target Compiler:    Microsoft Visual C++ Version 5.0
  13. */
  14.  
  15. #ifndef __dxworld_h                        // Sentry, use file only if it's not already included
  16. #define __dxworld_h
  17.  
  18. ///////////////////////    Included files ////////////////////////////////////////////////////////////
  19.  
  20. #include "cd3drm.h"                        // Direct3DRM support class
  21. #include "cdsnd3d.h"                    // DirectSound3D support class
  22. #include "cdinput.h"                    // DirectInput support class
  23.  
  24. ///////////////////////    Constants /////////////////////////////////////////////////////////////////
  25.  
  26. ///////////////////////    Class declarations ////////////////////////////////////////////////////////
  27.  
  28. /*
  29.     Class:                DirectXWorld
  30.     Description:        The main DirectX part of the application.  The DirectXWorld class itself
  31.                         implements the logic of the demo - when objects are created, how they move
  32.                         around etc, what happens when the user does something etc.  To support
  33.                         different bits of DirectX, use the appropriate DirectXXXXObject class as a
  34.                         base class
  35. */
  36.  
  37. class DirectXWorld :                    
  38.         public Direct3DRMObject,        // We want Direct3DRM support for the graphics 
  39.         public DirectSound3DObject,        // We want DirectSound3D support for the audio
  40.         public DirectInputObject        // We want DirectInput support for the keyboard
  41. {                                        
  42. public:                                    // Public constructor & destructor
  43.     DirectXWorld(HINSTANCE);                        
  44.     virtual ~DirectXWorld();    
  45.     
  46. public:                                    // Public member functions
  47.     bool Create(HWND);
  48.     bool Update();
  49.     bool Resize(int, int);
  50.     bool SetDirectSound(DIRECTSOUND3DTYPE);
  51.     bool SetSpeakerConfig(DWORD);
  52.     bool CreateObject(DWORD);
  53.     void DestroyObject(DWORD);
  54.  
  55. public:                                    // Public data members
  56.     LPDIRECT3DRMFRAME2        m_pCamera;
  57.     LPDIRECT3DRMVIEWPORT    m_pView;        
  58.     D3DRMObjectList            m_Objects;
  59.     D3DVALUE                m_FrameRate;
  60.     DWORD                    m_dwFlags;
  61.     D3DVALUE                m_XTurnVelocity;
  62.     D3DVALUE                m_YVelocity;
  63.     D3DVALUE                m_ZVelocity;
  64.  
  65. protected:                                // Protected data members
  66.     HINSTANCE                m_hInstance;                
  67.     DWORD                    m_dwTime;
  68.     bool                    m_bFirstUpdate;
  69.  
  70. private:                                // Private member functions
  71.     bool LoadDirectXObjects();
  72.     void ReleaseDirectXObjects();
  73.  
  74.     bool CreateViewer();
  75.     bool CreateLights();
  76.     bool CreateEnvironment();
  77.     bool CreateObjects();
  78.     bool Reset();
  79.     void DestroyObjects();
  80.  
  81.     bool CreateGlobe();
  82.     bool CreateSaucer();
  83.     bool CreateMeteor();
  84.     bool CreateExplosion(LPD3DVECTOR, DWORD);
  85.     void DestroyExplosion(DWORD);
  86.  
  87.     D3DVALUE UpdateTime();
  88.     bool UpdateScene(D3DVALUE);
  89.     bool UpdateInput();
  90.     bool UpdateObjects(D3DVALUE);
  91.     bool DestroyDeadObjects();
  92.     bool CheckCollisions(D3DVALUE);
  93.     bool MoveObjects(D3DVALUE);
  94.     bool UpdateViewer(D3DVALUE);
  95.  
  96.     void TurnX(D3DVALUE);
  97.     void MoveY(D3DVALUE);
  98.     void MoveZ(D3DVALUE);
  99.     bool Fire();
  100.     
  101.     bool HitCamera(LPD3DRMOBJECT, D3DVALUE);
  102.     LPD3DRMNODE HitObject(LPD3DRMOBJECT, D3DVALUE);
  103.  
  104. private:                                // Private data members
  105.     LPDIRECT3DRMMESHBUILDER2 m_pGlobeBuilder;    
  106.     LPDIRECT3DRMMESHBUILDER2 m_pSaucerBuilder;
  107.     LPDIRECT3DRMMESHBUILDER2 m_pMeteorBuilder;
  108.     LPDIRECT3DRMMESHBUILDER2 m_pBulletBuilder;
  109.     LPDIRECT3DRMMESHBUILDER2 m_pExplosionBuilder;
  110. };
  111.  
  112. typedef DirectXWorld* LPDIRECTXWORLD;
  113.  
  114. #endif                                    // End of sentry __dxworld_h
  115.