GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
CustomBehavior.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_CUSTOMBEHAVIOR_H
7 #define GDCORE_CUSTOMBEHAVIOR_H
8 
9 #include "GDCore/Project/Behavior.h"
10 #include "GDCore/Project/EventsBasedBehavior.h"
11 #include "GDCore/Project/Project.h"
12 #include "GDCore/Project/PropertyDescriptor.h"
13 #include "GDCore/Serialization/Serializer.h"
14 #include "GDCore/Serialization/SerializerElement.h"
15 
16 using namespace gd;
17 
18 namespace gd {
22 class CustomBehavior : public gd::Behavior {
23 public:
24  CustomBehavior(const gd::String &name,
25  const Project &project_,
26  const gd::String &fullType)
27  : Behavior(name, fullType),
28  project(project_) {}
29  CustomBehavior *Clone() const override;
30 
34 
35 protected:
36  std::map<gd::String, gd::PropertyDescriptor>
37  GetProperties(const gd::SerializerElement &behaviorContent) const override;
38  bool UpdateProperty(gd::SerializerElement &behaviorContent,
39  const gd::String &name, const gd::String &value) override;
40  void InitializeContent(gd::SerializerElement &behaviorContent) override;
41 
42 private:
43  const Project &project;
45 };
46 } // namespace gd
47 
48 #endif // GDCORE_CUSTOMBEHAVIOR_H
bool UpdateProperty(const gd::String &name, const gd::String &value)
Called when the IDE wants to update a custom property of the behavior.
Definition: BehaviorConfigurationContainer.h:89
virtual void InitializeContent()
Called to initialize the content with the default properties for the behavior.
Definition: BehaviorConfigurationContainer.h:97
std::map< gd::String, gd::PropertyDescriptor > GetProperties() const
Called when the IDE wants to know about the custom properties of the behavior.
Definition: BehaviorConfigurationContainer.cpp:16
Base class used to represents a behavior that can be applied to an object. It stores the content (i....
Definition: Behavior.h:23
A gd::Behavior that stores its content in JSON.
Definition: CustomBehavior.h:22
bool UpdateProperty(gd::SerializerElement &behaviorContent, const gd::String &name, const gd::String &value) override
Called when the IDE wants to update a custom property of the behavior.
Definition: CustomBehavior.cpp:47
Base class representing a project (game), including all resources, scenes, objects,...
Definition: Project.h:51
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:33
Definition: CommonTools.h:24