Cafu Engine
MapPrimitive.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_MAP_PRIMITIVE_HPP_INCLUDED
8 #define CAFU_MAP_PRIMITIVE_HPP_INCLUDED
9 
10 #include "MapElement.hpp"
11 
12 
13 /// This class adds no functionality of its own, but only exists for proper type separation.
14 /// Especially MapBaseEntityT keeps a MapEntRepresT and an array of MapPrimitiveT%s, and the two
15 /// "sets" must not overlap (we don't want MapEntRepresT instances among the "regular" primitives,
16 /// and no regular primitive should ever be in place of the m_Repres member).
17 /// In many other regards, all derived classes are considered equivalent and treated the same;
18 /// then we use arrays of MapElementT%s.
19 /// The clear distinction between MapElementT%s and MapPrimitiveT%s (the former can also contain
20 /// MapEntRepresT%s, the latter cannot) is also a great help in documentation and communication.
21 class MapPrimitiveT : public MapElementT
22 {
23  public:
24 
25  /// The default constructor.
26  MapPrimitiveT(const wxColour& Color);
27 
28  /// The copy constructor for copying a primitive.
29  /// @param Prim The primitive to copy-construct this primitive from.
30  MapPrimitiveT(const MapPrimitiveT& Prim);
31 
32  /// The virtual copy constructor.
33  /// Creates a copy of this primitive that is of the *same* class as the original, even when
34  /// called via a base class pointer (the caller doesn't need to know the exact derived class).
35  virtual MapPrimitiveT* Clone() const = 0;
36 
37  // Implementations and overrides for base class methods.
38  wxColour GetColor(bool ConsiderGroup=true) const;
39 
40 
41  // The TypeSys related declarations for this class.
42  virtual const cf::TypeSys::TypeInfoT* GetType() const { return &TypeInfo; }
43  static void* CreateInstance(const cf::TypeSys::CreateParamsT& Params);
44  static const cf::TypeSys::TypeInfoT TypeInfo;
45 
46 
47  private:
48 
49  wxColour m_Color; ///< The inherent color of this map primitive.
50 };
51 
52 #endif
wxColour GetColor(bool ConsiderGroup=true) const
This method returns the "inherent" color of this map element.
Definition: MapPrimitive.cpp:40
virtual MapPrimitiveT * Clone() const =0
The virtual copy constructor.
This class adds no functionality of its own, but only exists for proper type separation.
Definition: MapPrimitive.hpp:21
MapPrimitiveT(const wxColour &Color)
The default constructor.
Definition: MapPrimitive.cpp:26
Definition: TypeSys.hpp:52
This class keeps type information (about an entity class that occurs in the game).
Definition: TypeSys.hpp:79
This is the base class for all elements ("objects") that can exist in a map.
Definition: MapElement.hpp:57