Orxonox  0.0.5 Codename: Arcturus
GameState.h
Go to the documentation of this file.
1 /*
2  * ORXONOX - the hottest 3D action shooter ever to exist
3  * > www.orxonox.net <
4  *
5  *
6  * License notice:
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Author:
23  * Reto Grieder
24  * Co-authors:
25  * ...
26  *
27  */
28 
36 #ifndef _GameState_H__
37 #define _GameState_H__
38 
39 #include "CorePrereqs.h"
40 
41 #include <map>
42 #include <string>
43 #include "util/UtilPrereqs.h"
44 
45 namespace orxonox
46 {
62  {
63  friend class Game;
64 
65  public:
70  struct State
71  {
72  unsigned active : 1;
73  unsigned activating : 1;
74  unsigned deactivating : 1;
75  unsigned updating : 1;
76  unsigned suspended : 1;
77  unsigned topState : 1;
78  };
79 
80  public:
82  virtual ~GameState();
83 
84  const std::string& getName() const;
85  State getActivity() const { return activity_; }
86  const GameStateInfo& getInfo() const { return info_; }
87 
88  protected:
89  virtual void activate() { }
90  virtual void deactivate() { }
91  virtual void update(const Clock& time) { }
92 
93  private:
94  void setActivity(State activity);
95  void activateInternal();
96  void deactivateInternal();
97  void updateInternal(const Clock& time);
98 
101  };
102 }
103 
104 #endif /* _GameState_H__ */
Shared library macros, enums, constants and forward declarations for the core library ...
::std::string string
Definition: gtest-port.h:756
State getActivity() const
Definition: GameState.h:85
Helper object required before GameStates are being constructed.
Definition: Game.h:66
virtual void activate()
Definition: GameState.h:89
virtual void deactivate()
Definition: GameState.h:90
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
#define _CoreExport
Definition: CorePrereqs.h:61
Shared library macros, enums, constants and forward declarations for the util library ...
virtual void update(const Clock &time)
Definition: GameState.h:91
State activity_
Definition: GameState.h:100
Main class responsible for running the game.
Definition: Game.h:81
An implementation of a tree to manage game states.
Definition: GameState.h:61
Gives information about what the GameState is currently doing.
Definition: GameState.h:70
Simple real time clock based on Ogre::Timer.
Definition: Clock.h:57
const GameStateInfo & info_
Definition: GameState.h:99
const GameStateInfo & getInfo() const
Definition: GameState.h:86