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 #pragma once
7 
8 #include "GDCore/Project/Behavior.h"
9 #include "GDCore/Project/EventsBasedBehavior.h"
10 #include "GDCore/Project/Project.h"
11 #include "GDCore/Project/PropertyDescriptor.h"
12 #include "GDCore/Serialization/Serializer.h"
13 #include "GDCore/Serialization/SerializerElement.h"
14 
15 using namespace gd;
16 
17 namespace gd {
21 class CustomBehavior : public gd::Behavior {
22 public:
23  CustomBehavior(const gd::String &name,
24  const Project &project_,
25  const gd::String &fullType)
26  : Behavior(name, fullType),
27  project(project_) {}
28  std::unique_ptr<gd::Behavior> Clone() const override;
29 
33 
34 protected:
35  std::map<gd::String, gd::PropertyDescriptor>
36  GetProperties(const gd::SerializerElement &behaviorContent) const override;
37  bool UpdateProperty(gd::SerializerElement &behaviorContent,
38  const gd::String &name, const gd::String &value) override;
39  void InitializeContent(gd::SerializerElement &behaviorContent) override;
40 
41 private:
42  const Project &project;
44 };
45 } // namespace gd
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:86
virtual void InitializeContent()
Called to initialize the content with the default properties for the behavior.
Definition: BehaviorConfigurationContainer.h:94
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:21
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:46
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:33
Definition: CommonTools.h:24