home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / XenonSource.exe / xenon / source / xenon.cpp < prev   
Encoding:
C/C++ Source or Header  |  2000-09-11  |  1.2 KB  |  69 lines

  1. //-------------------------------------------------------------
  2. //
  3. // Module:    Xenon 2K
  4. //
  5. // Author:    John M Phillips
  6. //
  7. // Started:    05/05/00
  8. //
  9. //-------------------------------------------------------------
  10.  
  11. #include "game.h"
  12.  
  13. //-------------------------------------------------------------
  14.  
  15. bool CXenon::changeState(CGameState *new_game_state)
  16. {
  17.     if (m_game_state) {
  18.         if (!m_game_state->destroy())
  19.             return false;
  20.         }
  21.  
  22.     m_game_state = new_game_state;
  23.  
  24.     if (m_game_state)
  25.         return m_game_state->create();
  26.  
  27.     return true;
  28. }
  29.  
  30. //-------------------------------------------------------------
  31.  
  32. bool CXenon::initialize()
  33. {
  34.     if (!gsCApplication::initialize())
  35.         return false;
  36.  
  37.     if (!CGameState::initialize(this))
  38.         return false;
  39.  
  40.     return true;
  41. }
  42.  
  43. //-------------------------------------------------------------
  44.  
  45. bool CXenon::mainloop()
  46. {
  47.     if (m_game_state)
  48.         return m_game_state->update();
  49.  
  50.     return false;
  51. }
  52.  
  53. //-------------------------------------------------------------
  54.  
  55. bool CXenon::shutdown()
  56. {
  57.     changeState(0);
  58.  
  59.     if (!CGameState::shutdown())
  60.         return false;
  61.  
  62.     if (!gsCApplication::shutdown())
  63.         return false;
  64.  
  65.     return true;
  66. }
  67.  
  68. //-------------------------------------------------------------
  69.