GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
EventsBasedObject.h
1 /*
2  * GDevelop Core
3  * Copyright 2008-2016 Florian Rival ([email protected]). All rights
4  * reserved. This project is released under the MIT License.
5  */
6 #ifndef GDCORE_EVENTSBASEDOBJECT_H
7 #define GDCORE_EVENTSBASEDOBJECT_H
8 
9 #include <vector>
10 #include "GDCore/Project/AbstractEventsBasedEntity.h"
11 #include "GDCore/Project/ObjectsContainer.h"
12 #include "GDCore/String.h"
13 namespace gd {
14 class SerializerElement;
15 class Project;
16 } // namespace gd
17 
18 namespace gd {
19 // TODO EBO Add a way to mark some parts of children configuration as readonly.
30  public:
32  virtual ~EventsBasedObject();
33  EventsBasedObject(const gd::EventsBasedObject &_eventBasedObject);
34 
39  EventsBasedObject* Clone() const { return new EventsBasedObject(*this); };
40 
44  const gd::String& GetDefaultName() const { return defaultName; };
45 
50  defaultName = defaultName_;
51  return *this;
52  }
53 
54  EventsBasedObject& SetDescription(const gd::String& description_) override {
56  return *this;
57  }
58 
64  return *this;
65  }
66 
72  return *this;
73  }
74 
78  EventsBasedObject& MarkAsRenderedIn3D(bool isRenderedIn3D_) {
79  isRenderedIn3D = isRenderedIn3D_;
80  return *this;
81  }
82 
86  bool IsRenderedIn3D() const { return isRenderedIn3D; }
87 
91  EventsBasedObject& MarkAsAnimatable(bool isAnimatable_) {
92  isAnimatable = isAnimatable_;
93  return *this;
94  }
95 
99  bool IsAnimatable() const { return isAnimatable; }
100 
104  EventsBasedObject& MarkAsTextContainer(bool isTextContainer_) {
105  isTextContainer = isTextContainer_;
106  return *this;
107  }
108 
112  bool IsTextContainer() const { return isTextContainer; }
113 
114  void SerializeTo(SerializerElement& element) const override;
115 
116  void UnserializeFrom(gd::Project& project,
117  const SerializerElement& element) override;
118 
119  private:
120  gd::String defaultName;
121  bool isRenderedIn3D;
122  bool isAnimatable;
123  bool isTextContainer;
124 };
125 
126 } // namespace gd
127 
128 #endif // GDCORE_EVENTSBASEDOBJECT_H
Represents a behavior or an object that is implemented with events.
Definition: AbstractEventsBasedEntity.h:30
virtual AbstractEventsBasedEntity & SetDescription(const gd::String &description_)
Set the description of the behavior or object, to be displayed in the editor.
Definition: AbstractEventsBasedEntity.h:52
AbstractEventsBasedEntity & SetName(const gd::String &name_)
Set the internal name of the behavior or object.
Definition: AbstractEventsBasedEntity.h:65
AbstractEventsBasedEntity & SetFullName(const gd::String &fullName_)
Set the name of the behavior or object, to be displayed in the editor.
Definition: AbstractEventsBasedEntity.h:78
Represents an object that is implemented with events.
Definition: EventsBasedObject.h:29
EventsBasedObject * Clone() const
Return a pointer to a new EventsBasedObject constructed from this one.
Definition: EventsBasedObject.h:39
bool IsTextContainer() const
Return true if the object needs a TextContainer capability.
Definition: EventsBasedObject.h:112
EventsBasedObject & SetName(const gd::String &name_)
Set the internal name of the object.
Definition: EventsBasedObject.h:62
EventsBasedObject & SetDefaultName(const gd::String &defaultName_)
Set the default name for created objects.
Definition: EventsBasedObject.h:49
const gd::String & GetDefaultName() const
Get the default name for created objects.
Definition: EventsBasedObject.h:44
EventsBasedObject & SetFullName(const gd::String &fullName_)
Set the name of the object, to be displayed in the editor.
Definition: EventsBasedObject.h:70
bool IsRenderedIn3D() const
Return true if the object uses the 3D renderer.
Definition: EventsBasedObject.h:86
EventsBasedObject & MarkAsRenderedIn3D(bool isRenderedIn3D_)
Declare a usage of the 3D renderer.
Definition: EventsBasedObject.h:78
EventsBasedObject & SetDescription(const gd::String &description_) override
Set the description of the behavior or object, to be displayed in the editor.
Definition: EventsBasedObject.h:54
EventsBasedObject & MarkAsTextContainer(bool isTextContainer_)
Declare a TextContainer capability.
Definition: EventsBasedObject.h:104
bool IsAnimatable() const
Return true if the object needs an Animatable capability.
Definition: EventsBasedObject.h:99
EventsBasedObject & MarkAsAnimatable(bool isAnimatable_)
Declare an Animatable capability.
Definition: EventsBasedObject.h:91
Used as a base class for classes that will own objects (see gd::Object).
Definition: ObjectsContainer.h:36
Base class representing a project (game), including all resources, scenes, objects,...
Definition: Project.h:50
A generic container that can represent a value ( containing a string, double, bool or int),...
Definition: SerializerElement.h:37
String represents an UTF8 encoded string.
Definition: String.h:31
Definition: CommonTools.h:24