mode_manager.h

Go to the documentation of this file.
00001 
00002 //            Copyright (C) 2004-2007 by The Allacrost Project
00003 //                         All Rights Reserved
00004 //
00005 // This code is licensed under the GNU GPL version 2. It is free software
00006 // and you may modify it and/or redistribute it under the terms of this license.
00007 // See http://www.gnu.org/copyleft/gpl.html for details.
00009 
00016 #ifndef __MODE_MANAGER_HEADER__
00017 #define __MODE_MANAGER_HEADER__
00018 
00019 #include "utils.h"
00020 #include "defs.h"
00021 
00023 namespace hoa_mode_manager {
00024 
00026 extern GameModeManager* ModeManager;
00027 
00029 extern bool MODE_MANAGER_DEBUG;
00030 
00032 
00033 
00034 const uint8 MODE_MANAGER_DUMMY_MODE  = 0;
00035 const uint8 MODE_MANAGER_BOOT_MODE   = 1;
00036 const uint8 MODE_MANAGER_MAP_MODE    = 2;
00037 const uint8 MODE_MANAGER_BATTLE_MODE = 3;
00038 const uint8 MODE_MANAGER_MENU_MODE   = 4;
00039 const uint8 MODE_MANAGER_SHOP_MODE   = 5;
00040 const uint8 MODE_MANAGER_PAUSE_MODE  = 6;
00041 const uint8 MODE_MANAGER_QUIT_MODE   = 7;
00042 const uint8 MODE_MANAGER_SCENE_MODE  = 8;
00043 const uint8 MODE_MANAGER_WORLD_MODE  = 9;
00045 
00046 
00061 class GameMode {
00062   friend class GameModeManager;
00063 
00064 protected:
00066   uint8 mode_type;
00067 
00068 private:
00070   GameMode(const GameMode& other);
00072   GameMode& operator=(const GameMode& other);
00073   // Note: Should I make the delete and delete[] operators private too?
00074 public:
00075   GameMode();
00077   GameMode(uint8 mt);
00079   virtual ~GameMode();
00080 
00082   virtual void Update() = 0;
00084   virtual void Draw() = 0;
00091   virtual void Reset() = 0;
00092 }; // class GameMode
00093 
00094 
00120 class GameModeManager : public hoa_utils::Singleton<GameModeManager> {
00121   friend class hoa_utils::Singleton<GameModeManager>;
00122 
00123 private:
00124   GameModeManager();
00125 
00129   std::vector<GameMode*> _game_stack;
00130 
00132   std::vector<GameMode*> _push_stack;
00133 
00135   bool _state_change;
00136 
00138   uint32 _pop_count;
00139 
00140 public:
00141   ~GameModeManager();
00142 
00143   bool SingletonInitialize ();
00144 
00146   void Pop();
00147 
00156   void PopAll();
00157 
00163   void Push(GameMode* gm);
00164 
00168   uint8 GetGameType();
00169 
00173   GameMode* GetTop();
00174 
00176   void Update();
00177 
00179   void Draw();
00180 
00182   void DEBUG_PrintStack();
00183 }; // class GameModeManager
00184 
00185 } // namespace hoa_mode_manager
00186 
00187 #endif

Generated on Fri Jul 6 23:11:19 2007 for Hero of Allacrost by  doxygen 1.5.1