Cafu Engine
CompPlayerStart.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_GAMESYS_COMPONENT_PLAYER_START_HPP_INCLUDED
8 #define CAFU_GAMESYS_COMPONENT_PLAYER_START_HPP_INCLUDED
9 
10 #include "CompBase.hpp"
11 
12 
13 namespace cf
14 {
15  namespace GameSys
16  {
17  /// This component marks its entity as possible spawn point for human players
18  /// that begin a single-player level or join a multi-player game.
20  {
21  public:
22 
23  /// The constructor.
25 
26  /// The copy constructor.
27  /// @param Comp The component to create a copy of.
29 
30  /// Returns whether players can be spawned here in single-player games.
31  bool IsSinglePlayerStart() const { return m_SinglePlayer.Get(); }
32 
33  /// Returns whether players can be spawned here in multi-player games.
34  bool IsMultiPlayerStart() const { return m_MultiPlayer.Get(); }
35 
36 
37  // Base class overrides.
39  const char* GetName() const { return "PlayerStart"; }
40  unsigned int GetEditorColor() const { return 0x00FF00; }
41  BoundingBox3fT GetEditorBB() const { return BoundingBox3fT(Vector3fT(-16, -16, -36), Vector3fT(16, 16, 36)); }
42 
43 
44  // The TypeSys related declarations for this class.
45  const cf::TypeSys::TypeInfoT* GetType() const { return &TypeInfo; }
46  static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params);
47  static const cf::TypeSys::TypeInfoT TypeInfo;
48 
49 
50  protected:
51 
52  // The Lua API methods of this class.
53  static int toString(lua_State* LuaState);
54 
55  static const luaL_Reg MethodsList[]; ///< The list of Lua methods for this class.
56  static const char* DocClass;
57  static const cf::TypeSys::MethsDocT DocMethods[];
58  static const cf::TypeSys::VarsDocT DocVars[];
59 
60 
61  private:
62 
63  TypeSys::VarT<bool> m_SinglePlayer; ///< If true, players can be spawned here in single-player games.
64  TypeSys::VarT<bool> m_MultiPlayer; ///< If true, players can be spawned here in multi-player games.
65  };
66  }
67 }
68 
69 #endif
ComponentPlayerStartT * Clone() const
The virtual copy constructor.
Definition: CompPlayerStart.cpp:53
ComponentPlayerStartT()
The constructor.
Definition: CompPlayerStart.cpp:33
This component marks its entity as possible spawn point for human players that begin a single-player ...
Definition: CompPlayerStart.hpp:19
BoundingBox3fT GetEditorBB() const
Returns a bounding-box that the Map Editor can use to render the representation of this component's e...
Definition: CompPlayerStart.hpp:41
bool IsSinglePlayerStart() const
Returns whether players can be spawned here in single-player games.
Definition: CompPlayerStart.hpp:31
unsigned int GetEditorColor() const
Returns a color that the Map Editor can use to render the representation of this component's entity...
Definition: CompPlayerStart.hpp:40
const char * GetName() const
Returns the name of this component.
Definition: CompPlayerStart.hpp:39
static const luaL_Reg MethodsList[]
The list of Lua methods for this class.
Definition: CompPlayerStart.hpp:55
bool IsMultiPlayerStart() const
Returns whether players can be spawned here in multi-player games.
Definition: CompPlayerStart.hpp:34
Definition: TypeSys.hpp:52
Definition: TypeSys.hpp:57
This class keeps type information (about an entity class that occurs in the game).
Definition: TypeSys.hpp:79
const T & Get() const
Returns the value of this variable.
Definition: Variables.hpp:182
Definition: TypeSys.hpp:68
This is the base class for the components that an entity is composed/aggregated of.
Definition: CompBase.hpp:54