home *** CD-ROM | disk | FTP | other *** search
/ Programming a Multiplayer FPS in DirectX / Programming a Multiplayer FPS in DirectX (Companion CD).iso / Source / Chapter 9 / Engine / State.h < prev   
Encoding:
C/C++ Source or Header  |  2005-03-29  |  1.5 KB  |  50 lines

  1. //-----------------------------------------------------------------------------
  2. // Base state functionality. Applications must derive new states from this
  3. // class to add to the engine.
  4. //
  5. // Programming a Multiplayer First Person Shooter in DirectX
  6. // Copyright (c) 2004 Vaughan Young
  7. //-----------------------------------------------------------------------------
  8. #ifndef STATE_H
  9. #define STATE_H
  10.  
  11. //-----------------------------------------------------------------------------
  12. // Viewer Setup Structure
  13. //-----------------------------------------------------------------------------
  14. struct ViewerSetup
  15. {
  16.     SceneObject *viewer; // Current viewing object.
  17.     unsigned long viewClearFlags; // Flags used for clearing the view.
  18.  
  19.     //-------------------------------------------------------------------------
  20.     // The viewer setup structure constructor.
  21.     //-------------------------------------------------------------------------
  22.     ViewerSetup()
  23.     {
  24.         viewer = NULL;
  25.         viewClearFlags = 0;
  26.     };
  27. };
  28.  
  29. //-----------------------------------------------------------------------------
  30. // State Class
  31. //-----------------------------------------------------------------------------
  32. class State
  33. {
  34. public:
  35.     State( unsigned long id = 0 );
  36.  
  37.     virtual void Load();
  38.     virtual void Close();
  39.  
  40.     virtual void RequestViewer( ViewerSetup *viewer );
  41.     virtual void Update( float elapsed );
  42.     virtual void Render();
  43.  
  44.     unsigned long GetID();
  45.  
  46. private:
  47.     unsigned long m_id; // Application defined ID (must be unique for state switching).
  48. };
  49.  
  50. #endif