13 #include "GDCore/Project/Project.h"
14 #include "GDCore/Project/EventsBasedBehavior.h"
17 class NamedPropertyDescriptor;
18 class EventsBasedBehavior;
38 const gd::EventsFunctionsExtension& eventsFunctionsExtension,
39 const gd::EventsBasedBehavior& eventsBasedBehavior,
40 const gd::String& codeNamespace,
41 const std::map<gd::String, gd::String>& behaviorMethodMangledNames,
42 std::set<gd::String>& includeFiles,
43 bool compilationForRuntime =
false);
50 const gd::String& propertyName) {
51 return "_get" + propertyName;
59 const gd::String& propertyName) {
60 return "_set" + propertyName;
68 const gd::String& propertyName) {
69 return "_toggle" + propertyName;
77 const gd::String& propertyName);
84 const gd::String& propertyName);
91 const gd::String& propertyName);
98 static gd::String GetBehaviorSharedPropertyGetterInternalName(
99 const gd::String& propertyName);
105 static gd::String GetBehaviorSharedPropertySetterInternalName(
106 const gd::String& propertyName);
112 static gd::String GetBehaviorSharedPropertyToggleFunctionInternalName(
113 const gd::String& propertyName);
115 gd::String GenerateRuntimeBehaviorTemplateCode(
116 const gd::String& extensionName,
117 const gd::EventsBasedBehavior& eventsBasedBehavior,
118 const gd::String& codeNamespace,
119 std::function<gd::String()> generateInitializePropertiesCode,
120 std::function<gd::String()> generatePropertiesCode,
121 std::function<gd::String()> generateInitializeSharedPropertiesCode,
122 std::function<gd::String()> generateSharedPropertiesCode,
123 std::function<gd::String()> generateMethodsCode,
124 std::function<gd::String()> generateUpdateFromBehaviorDataCode,
125 std::function<gd::String()> generateGetNetworkSyncDataCode,
126 std::function<gd::String()> generateUpdateFromNetworkSyncDataCode);
128 gd::String GenerateRuntimeBehaviorPropertyTemplateCode(
129 const gd::EventsBasedBehavior& eventsBasedBehavior,
130 const gd::NamedPropertyDescriptor& property);
132 gd::String GenerateToggleBooleanPropertyTemplateCode(
133 const gd::String& toggleName,
134 const gd::String& getterName,
135 const gd::String& setterName);
137 gd::String GenerateInitializePropertyFromDataCode(
138 const gd::NamedPropertyDescriptor& property);
140 gd::String GenerateInitializePropertyFromDefaultValueCode(
141 const gd::NamedPropertyDescriptor& property);
143 gd::String GenerateRuntimeBehaviorSharedPropertyTemplateCode(
144 const gd::EventsBasedBehavior& eventsBasedBehavior,
145 const gd::NamedPropertyDescriptor& property);
147 gd::String GenerateInitializeSharedPropertyFromDataCode(
148 const gd::NamedPropertyDescriptor& property);
150 gd::String GenerateInitializeSharedPropertyFromDefaultValueCode(
151 const gd::NamedPropertyDescriptor& property);
153 gd::String GeneratePropertyValueCode(
const gd::PropertyDescriptor& property);
155 gd::String GenerateUpdatePropertyFromBehaviorDataCode(
156 const gd::EventsBasedBehavior& eventsBasedBehavior,
157 const gd::NamedPropertyDescriptor& property);
159 gd::String GenerateGetPropertyNetworkSyncDataCode(
160 const gd::EventsBasedBehavior& eventsBasedBehavior,
161 const gd::NamedPropertyDescriptor& property);
163 gd::String GenerateUpdatePropertyFromNetworkSyncDataCode(
164 const gd::EventsBasedBehavior& eventsBasedBehavior,
165 const gd::NamedPropertyDescriptor& property);
167 gd::String GenerateBehaviorOnDestroyToDeprecatedOnOwnerRemovedFromScene(
168 const gd::EventsBasedBehavior& eventsBasedBehavior,
169 const gd::String& codeNamespace);
171 gd::String GenerateDefaultDoStepPreEventsFunctionCode(
172 const gd::EventsBasedBehavior& eventsBasedBehavior,
173 const gd::String& codeNamespace);
175 gd::String GenerateDoStepPreEventsPreludeCode();
177 gd::Project& project;
179 static gd::String doStepPreEventsFunctionName;
The class being responsible for generating JavaScript code for EventsBasedBehavior.
Definition: BehaviorCodeGenerator.h:29
static gd::String GetBehaviorPropertyToggleFunctionName(const gd::String &propertyName)
Generate the name of the method to toggle the value of the boolean property of a behavior.
Definition: BehaviorCodeGenerator.h:67
static gd::String GetBehaviorPropertySetterName(const gd::String &propertyName)
Generate the name of the method to set the value of the property of a behavior.
Definition: BehaviorCodeGenerator.h:58
gd::String GenerateRuntimeBehaviorCompleteCode(const gd::EventsFunctionsExtension &eventsFunctionsExtension, const gd::EventsBasedBehavior &eventsBasedBehavior, const gd::String &codeNamespace, const std::map< gd::String, gd::String > &behaviorMethodMangledNames, std::set< gd::String > &includeFiles, bool compilationForRuntime=false)
Generate the complete JS class (gdjs.RuntimeBehavior) for the behavior.
Definition: BehaviorCodeGenerator.cpp:17
static gd::String GetBehaviorSharedPropertyGetterName(const gd::String &propertyName)
Generate the name of the method to get the value of the shared property of a behavior.
Definition: BehaviorCodeGenerator.cpp:474
static gd::String GetBehaviorSharedPropertySetterName(const gd::String &propertyName)
Generate the name of the method to set the value of the shared property of a behavior.
Definition: BehaviorCodeGenerator.cpp:480
static gd::String GetBehaviorPropertyGetterName(const gd::String &propertyName)
Generate the name of the method to get the value of the property of a behavior.
Definition: BehaviorCodeGenerator.h:49
static gd::String GetBehaviorSharedPropertyToggleFunctionName(const gd::String &propertyName)
Generate the name of the method to toggle the value of the boolean shared property of a behavior.
Definition: BehaviorCodeGenerator.cpp:486