Tactics: Western Philosophers Vs. Musicians  0.12
A turn-based tactical game combining rules and gameplay elements inspired by Final Fantasy Tactics and the Mayfair Exponential Game System. Unlike most games of this type, motion is in full, grid-less 3D.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CUpdateManager.h
Go to the documentation of this file.
1 // Copyright (C) 2004-2013 Dylan Blair
3 //
4 // email: dblair@alumni.cs.utexas.edu
5 //
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 //
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 
21 #ifndef CUPDATE_MANAGER_H
22 #define CUPDATE_MANAGER_H
23 
24 #include "CUpdater.h"
25 
26 #define UpdMan OpenSkyNet::Core::UpdateManager::getInstance()
27 #define GetUpd(updaterTypePtr_,updaterTypeEnum_) static_cast<updaterTypePtr_>(UpdMan->getUpdater(updaterTypeEnum_))
28 
29 namespace OpenSkyNet {
30  namespace Core {
35  struct UpdaterInfo {
38  UpdaterInfo(Updater::UPDATER_TYPE type_=Updater::BASE,
39  Updater::UPDATER_PRIORITY prio_=Updater::UPD_DISABLED) : _type(type_), _prio(prio_) {}
40  };
41 
42  static UpdateManager* _instance;
43 
44  std::list<Updater*> _updLists[Updater::UPD_NUM_PRIORITIES];
45  std::map<Updater*, UpdaterInfo> _updMap;
46 
47  Updater* _updArray[Updater::MAX];
48  bool _allObjsUpdated[Updater::MAX];
49 
50  std::map<const Object*, std::list<Updater*> > _objMap;
51 
52  UpdateManager();
53  public:
54  static inline void createInstance() { _instance = new UpdateManager(); }
55 
56  static inline UpdateManager*& getInstance() { return _instance; }
57 
58  static void shutDown();
59 
61  bool addUpdater(Updater* upd_);
62 
63  inline Updater* getUpdater(Updater::UPDATER_TYPE type_) { return _updArray[type_]; }
64 
65  bool setPriority(Updater::UPDATER_TYPE type_, Updater::UPDATER_PRIORITY prio_);
66 
68  bool addUpdater(Object* obj_, Updater::UPDATER_TYPE type_, Updater::OBJECT_PRIORITY prio_=Updater::OBJ_1, bool isOneShot_=false);
69 
71  bool removeUpdater(Object* obj_, Updater::UPDATER_TYPE type_);
72 
73  bool removeAllObjectsFromUpdater(Updater::UPDATER_TYPE type_);
74 
75  void removeAllUpdaters(Object* obj_);
76 
77  void getUpdaters(const Object* obj_, std::list<Updater*>& updaters_) const;
78 
79  void disableAllUpdates(Object* obj_);
80 
81  void enableAllUpdates(Object* obj_);
82 
83  bool find(Object* obj_, Updater::UPDATER_TYPE type_) const;
84 
85  void update(Updater::UPDATER_TYPE type_, float dt_);
86 
87  void updateAll(float dt_);
88 
89  inline bool haveAllObjectsBeenUpdated(Updater::UPDATER_TYPE type_) { return _allObjsUpdated[type_]; }
90  };
91  }
92 }
93 
94 #endif //CUPDATE_MANAGER_H
bool haveAllObjectsBeenUpdated(Updater::UPDATER_TYPE type_)
Definition: CUpdateManager.h:89
static void createInstance()
Definition: CUpdateManager.h:54
UPDATER_PRIORITY
Definition: CUpdater.h:46
Definition: CUpdater.h:49
UPDATER_TYPE
Definition: CUpdater.h:43
Definition: CUpdater.h:40
OBJECT_PRIORITY
Definition: CUpdater.h:49
#define CORE_DLL
Definition: CCoreDLL.h:57
Definition: IObject.h:36
Definition: CUpdater.h:43
Updater * getUpdater(Updater::UPDATER_TYPE type_)
Definition: CUpdateManager.h:63
Definition: CUpdater.h:43
static UpdateManager *& getInstance()
Definition: CUpdateManager.h:56
Definition: CUpdateManager.h:34