[WIP] Rename Automatism to Behavior

This commit is contained in:
Florian Rival
2015-08-17 23:52:59 +02:00
parent 79bfa079aa
commit 428e72914d
1005 changed files with 5652 additions and 5710 deletions

View File

@@ -36,5 +36,5 @@ script:
# - export LD_LIBRARY_PATH=$PWD/Binaries/Output/Release_Linux:$PWD/.build-tests/ExtLibs/SFML/lib:$LD_LIBRARY_PATH # - export LD_LIBRARY_PATH=$PWD/Binaries/Output/Release_Linux:$PWD/.build-tests/ExtLibs/SFML/lib:$LD_LIBRARY_PATH
- Core/GDCore_tests - Core/GDCore_tests
- GDCpp/GDCpp_tests - GDCpp/GDCpp_tests
- Extensions/PathfindingAutomatism/PathfindingAutomatism_Runtime_tests - Extensions/PathfindingBehavior/PathfindingBehavior_Runtime_tests
- Extensions/LinkedObjects/LinkedObjects_Runtime_tests - Extensions/LinkedObjects/LinkedObjects_Runtime_tests

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -53,10 +53,10 @@ cd ../../..
#TODO: #TODO:
rm -rf GDevelop.app/Contents/Resources/CppPlatform/Extensions/include/CommonDialogs/dlib-18.16/ rm -rf GDevelop.app/Contents/Resources/CppPlatform/Extensions/include/CommonDialogs/dlib-18.16/
rm -rf GDevelop.app/Contents/Resources/CppPlatform/Extensions/include/PhysicsAutomatism/Box2D/Contributions rm -rf GDevelop.app/Contents/Resources/CppPlatform/Extensions/include/PhysicsBehavior/Box2D/Contributions
rm -rf GDevelop.app/Contents/Resources/CppPlatform/Extensions/Runtime/.xgd rm -rf GDevelop.app/Contents/Resources/CppPlatform/Extensions/Runtime/.xgd
rm -rf GDevelop.app/Contents/Resources/JsPlatform/Runtime/Extensions/CommonDialogs/dlib-18.16/ rm -rf GDevelop.app/Contents/Resources/JsPlatform/Runtime/Extensions/CommonDialogs/dlib-18.16/
rm -rf GDevelop.app/Contents/Resources/JsPlatform/Runtime/Extensions/PhysicsAutomatism/Box2D/Contributions rm -rf GDevelop.app/Contents/Resources/JsPlatform/Runtime/Extensions/PhysicsBehavior/Box2D/Contributions
rm GDevelop.app/Contents/Resources/7zS.sfx rm GDevelop.app/Contents/Resources/7zS.sfx
#Now sign the package: #Now sign the package:

View File

@@ -99,7 +99,7 @@ Type: files; Name: "{app}\GDEditor.exe"
;Prevent crashes with incompatible extensions: ;Prevent crashes with incompatible extensions:
Type: files; Name: "{app}\CppPlatform\Extensions\TextBoxObject.xgdwe" Type: files; Name: "{app}\CppPlatform\Extensions\TextBoxObject.xgdwe"
;Old extensions: ;Old extensions:
Type: files; Name: "{app}\CppPlatform\Extensions\AStarAutomatism.xgdwe" Type: files; Name: "{app}\CppPlatform\Extensions\AStarBehavior.xgdwe"
Type: filesandordirs; Name: "{app}\Extensions" Type: filesandordirs; Name: "{app}\Extensions"
Type: filesandordirs; Name: "{app}\include" Type: filesandordirs; Name: "{app}\include"

View File

@@ -160,7 +160,7 @@ The user interface allows you to preview your game and test it inside the editor
All the game logic is created using events, allowing to launch actions if some conditions are filled. An entire game can be created without using a single line of code as events are both easy to use and flexible, thanks to sub-events and custom events types like loop events or functions-like events. All the game logic is created using events, allowing to launch actions if some conditions are filled. An entire game can be created without using a single line of code as events are both easy to use and flexible, thanks to sub-events and custom events types like loop events or functions-like events.
Moreover, events are compiled by GDevelop to machine code, just like ordinary programming language used in commercial games: GDevelop is the only game development software which combine the simplicity of creation with the power of professional programming languages. Moreover, events are compiled by GDevelop to machine code, just like ordinary programming language used in commercial games: GDevelop is the only game development software which combine the simplicity of creation with the power of professional programming languages.
GDevelop provides you with many features for your project : Dynamic lights and particle systems are available trought dedicated objects, actions and conditions to create multiplayer games are available, 3D objects can be used to render buildings, realistic physics behaviour can be added to objects thanks to the Physics automatism. GDevelop provides you with many features for your project : Dynamic lights and particle systems are available trought dedicated objects, actions and conditions to create multiplayer games are available, 3D objects can be used to render buildings, realistic physics behaviour can be added to objects thanks to the Physics behavior.
Many of these features are provided thanks to official open source extensions, and external developers can also develop extensions to enhance GDevelop capabilities.</Char_Desc_2000> Many of these features are provided thanks to official open source extensions, and external developers can also develop extensions to enhance GDevelop capabilities.</Char_Desc_2000>
</English> </English>
</Program_Descriptions> </Program_Descriptions>

View File

@@ -246,8 +246,8 @@
<Unit filename="GDCore/CommonTools.cpp" /> <Unit filename="GDCore/CommonTools.cpp" />
<Unit filename="GDCore/CommonTools.h" /> <Unit filename="GDCore/CommonTools.h" />
<Unit filename="GDCore/DocMainPage.h" /> <Unit filename="GDCore/DocMainPage.h" />
<Unit filename="GDCore/Events/AutomatismMetadata.cpp" /> <Unit filename="GDCore/Events/BehaviorMetadata.cpp" />
<Unit filename="GDCore/Events/AutomatismMetadata.h" /> <Unit filename="GDCore/Events/BehaviorMetadata.h" />
<Unit filename="GDCore/Events/Builtin/CommentEvent.cpp" /> <Unit filename="GDCore/Events/Builtin/CommentEvent.cpp" />
<Unit filename="GDCore/Events/Builtin/CommentEvent.h" /> <Unit filename="GDCore/Events/Builtin/CommentEvent.h" />
<Unit filename="GDCore/Events/Builtin/ForEachEvent.cpp" /> <Unit filename="GDCore/Events/Builtin/ForEachEvent.cpp" />
@@ -297,10 +297,10 @@
<Unit filename="GDCore/IDE/ConditionSentenceFormatter.h" /> <Unit filename="GDCore/IDE/ConditionSentenceFormatter.h" />
<Unit filename="GDCore/IDE/Dialogs/AdvancedEntryDialog.cpp" /> <Unit filename="GDCore/IDE/Dialogs/AdvancedEntryDialog.cpp" />
<Unit filename="GDCore/IDE/Dialogs/AdvancedEntryDialog.h" /> <Unit filename="GDCore/IDE/Dialogs/AdvancedEntryDialog.h" />
<Unit filename="GDCore/IDE/Dialogs/ChooseAutomatismDialog.cpp" /> <Unit filename="GDCore/IDE/Dialogs/ChooseBehaviorDialog.cpp" />
<Unit filename="GDCore/IDE/Dialogs/ChooseAutomatismDialog.h" /> <Unit filename="GDCore/IDE/Dialogs/ChooseBehaviorDialog.h" />
<Unit filename="GDCore/IDE/Dialogs/ChooseAutomatismTypeDialog.cpp" /> <Unit filename="GDCore/IDE/Dialogs/ChooseBehaviorTypeDialog.cpp" />
<Unit filename="GDCore/IDE/Dialogs/ChooseAutomatismTypeDialog.h" /> <Unit filename="GDCore/IDE/Dialogs/ChooseBehaviorTypeDialog.h" />
<Unit filename="GDCore/IDE/Dialogs/ChooseLayerDialog.cpp" /> <Unit filename="GDCore/IDE/Dialogs/ChooseLayerDialog.cpp" />
<Unit filename="GDCore/IDE/Dialogs/ChooseLayerDialog.h" /> <Unit filename="GDCore/IDE/Dialogs/ChooseLayerDialog.h" />
<Unit filename="GDCore/IDE/Dialogs/ChooseObjectDialog.cpp" /> <Unit filename="GDCore/IDE/Dialogs/ChooseObjectDialog.cpp" />
@@ -400,10 +400,10 @@
<Unit filename="GDCore/IDE/wxTools/SkinHelper.cpp" /> <Unit filename="GDCore/IDE/wxTools/SkinHelper.cpp" />
<Unit filename="GDCore/IDE/wxTools/SkinHelper.h" /> <Unit filename="GDCore/IDE/wxTools/SkinHelper.h" />
<Unit filename="GDCore/IDE/wxTools/TreeItemStringData.h" /> <Unit filename="GDCore/IDE/wxTools/TreeItemStringData.h" />
<Unit filename="GDCore/PlatformDefinition/Automatism.cpp" /> <Unit filename="GDCore/PlatformDefinition/Behavior.cpp" />
<Unit filename="GDCore/PlatformDefinition/Automatism.h" /> <Unit filename="GDCore/PlatformDefinition/Behavior.h" />
<Unit filename="GDCore/PlatformDefinition/AutomatismsSharedData.cpp" /> <Unit filename="GDCore/PlatformDefinition/BehaviorsSharedData.cpp" />
<Unit filename="GDCore/PlatformDefinition/AutomatismsSharedData.h" /> <Unit filename="GDCore/PlatformDefinition/BehaviorsSharedData.h" />
<Unit filename="GDCore/PlatformDefinition/ChangesNotifier.cpp" /> <Unit filename="GDCore/PlatformDefinition/ChangesNotifier.cpp" />
<Unit filename="GDCore/PlatformDefinition/ChangesNotifier.h" /> <Unit filename="GDCore/PlatformDefinition/ChangesNotifier.h" />
<Unit filename="GDCore/PlatformDefinition/ClassWithObjects.cpp" /> <Unit filename="GDCore/PlatformDefinition/ClassWithObjects.cpp" />
@@ -460,8 +460,8 @@
<Unit filename="GDCore/Tools/VersionWrapper.cpp" /> <Unit filename="GDCore/Tools/VersionWrapper.cpp" />
<Unit filename="GDCore/Tools/VersionWrapper.h" /> <Unit filename="GDCore/Tools/VersionWrapper.h" />
<Unit filename="wxsmith/AdvancedEntryDialog.wxs" /> <Unit filename="wxsmith/AdvancedEntryDialog.wxs" />
<Unit filename="wxsmith/ChooseAutomatismDialog.wxs" /> <Unit filename="wxsmith/ChooseBehaviorDialog.wxs" />
<Unit filename="wxsmith/ChooseAutomatismTypeDialog.wxs" /> <Unit filename="wxsmith/ChooseBehaviorTypeDialog.wxs" />
<Unit filename="wxsmith/ChooseLayerDialog.wxs" /> <Unit filename="wxsmith/ChooseLayerDialog.wxs" />
<Unit filename="wxsmith/ChooseObjectDialog.wxs" /> <Unit filename="wxsmith/ChooseObjectDialog.wxs" />
<Unit filename="wxsmith/ChooseObjectTypeDialog.wxs" /> <Unit filename="wxsmith/ChooseObjectTypeDialog.wxs" />
@@ -493,7 +493,7 @@
<wxDialog wxs="wxsmith/ResourceLibraryDialog.wxs" src="GDCore\IDE\Dialogs\ResourceLibraryDialog.cpp" hdr="GDCore\IDE\Dialogs\ResourceLibraryDialog.h" fwddecl="0" i18n="1" name="ResourceLibraryDialog" language="CPP" /> <wxDialog wxs="wxsmith/ResourceLibraryDialog.wxs" src="GDCore\IDE\Dialogs\ResourceLibraryDialog.cpp" hdr="GDCore\IDE\Dialogs\ResourceLibraryDialog.h" fwddecl="0" i18n="1" name="ResourceLibraryDialog" language="CPP" />
<wxDialog wxs="wxsmith/ProjectExtensionsDialog.wxs" src="GDCore\IDE\Dialogs\ProjectExtensionsDialog.cpp" hdr="GDCore\IDE\Dialogs\ProjectExtensionsDialog.h" fwddecl="0" i18n="1" name="ProjectExtensionsDialog" language="CPP" /> <wxDialog wxs="wxsmith/ProjectExtensionsDialog.wxs" src="GDCore\IDE\Dialogs\ProjectExtensionsDialog.cpp" hdr="GDCore\IDE\Dialogs\ProjectExtensionsDialog.h" fwddecl="0" i18n="1" name="ProjectExtensionsDialog" language="CPP" />
<wxDialog wxs="wxsmith/ChooseObjectDialog.wxs" src="GDCore\IDE\Dialogs\ChooseObjectDialog.cpp" hdr="GDCore\IDE\Dialogs\ChooseObjectDialog.h" fwddecl="0" i18n="1" name="ChooseObjectDialog" language="CPP" /> <wxDialog wxs="wxsmith/ChooseObjectDialog.wxs" src="GDCore\IDE\Dialogs\ChooseObjectDialog.cpp" hdr="GDCore\IDE\Dialogs\ChooseObjectDialog.h" fwddecl="0" i18n="1" name="ChooseObjectDialog" language="CPP" />
<wxDialog wxs="wxsmith/ChooseAutomatismDialog.wxs" src="GDCore\IDE\Dialogs\ChooseAutomatismDialog.cpp" hdr="GDCore\IDE\Dialogs\ChooseAutomatismDialog.h" fwddecl="0" i18n="1" name="ChooseAutomatismDialog" language="CPP" /> <wxDialog wxs="wxsmith/ChooseBehaviorDialog.wxs" src="GDCore\IDE\Dialogs\ChooseBehaviorDialog.cpp" hdr="GDCore\IDE\Dialogs\ChooseBehaviorDialog.h" fwddecl="0" i18n="1" name="ChooseBehaviorDialog" language="CPP" />
<wxDialog wxs="wxsmith/ChooseLayerDialog.wxs" src="GDCore\IDE\Dialogs\ChooseLayerDialog.cpp" hdr="GDCore\IDE\Dialogs\ChooseLayerDialog.h" fwddecl="0" i18n="1" name="ChooseLayerDialog" language="CPP" /> <wxDialog wxs="wxsmith/ChooseLayerDialog.wxs" src="GDCore\IDE\Dialogs\ChooseLayerDialog.cpp" hdr="GDCore\IDE\Dialogs\ChooseLayerDialog.h" fwddecl="0" i18n="1" name="ChooseLayerDialog" language="CPP" />
<wxDialog wxs="wxsmith/EditExpressionDialog.wxs" src="GDCore\IDE\Dialogs\EditExpressionDialog.cpp" hdr="GDCore\IDE\Dialogs\EditExpressionDialog.h" fwddecl="0" i18n="1" name="EditExpressionDialog" language="CPP" /> <wxDialog wxs="wxsmith/EditExpressionDialog.wxs" src="GDCore\IDE\Dialogs\EditExpressionDialog.cpp" hdr="GDCore\IDE\Dialogs\EditExpressionDialog.h" fwddecl="0" i18n="1" name="EditExpressionDialog" language="CPP" />
<wxDialog wxs="wxsmith/EditStrExpressionDialog.wxs" src="GDCore\IDE\Dialogs\EditStrExpressionDialog.cpp" hdr="GDCore\IDE\Dialogs\EditStrExpressionDialog.h" fwddecl="0" i18n="1" name="EditStrExpressionDialog" language="CPP" /> <wxDialog wxs="wxsmith/EditStrExpressionDialog.wxs" src="GDCore\IDE\Dialogs\EditStrExpressionDialog.cpp" hdr="GDCore\IDE\Dialogs\EditStrExpressionDialog.h" fwddecl="0" i18n="1" name="EditStrExpressionDialog" language="CPP" />
@@ -503,7 +503,7 @@
<wxDialog wxs="wxsmith/GridSetupDialog.wxs" src="GDCore\IDE\Dialogs\GridSetupDialog.cpp" hdr="GDCore\IDE\Dialogs\GridSetupDialog.h" fwddecl="0" i18n="1" name="GridSetupDialog" language="CPP" /> <wxDialog wxs="wxsmith/GridSetupDialog.wxs" src="GDCore\IDE\Dialogs\GridSetupDialog.cpp" hdr="GDCore\IDE\Dialogs\GridSetupDialog.h" fwddecl="0" i18n="1" name="GridSetupDialog" language="CPP" />
<wxPanel wxs="wxsmith/LayersEditorPanel.wxs" src="GDCore\IDE\Dialogs\LayersEditorPanel.cpp" hdr="GDCore\IDE\Dialogs\LayersEditorPanel.h" fwddecl="0" i18n="1" name="LayersEditorPanel" language="CPP" /> <wxPanel wxs="wxsmith/LayersEditorPanel.wxs" src="GDCore\IDE\Dialogs\LayersEditorPanel.cpp" hdr="GDCore\IDE\Dialogs\LayersEditorPanel.h" fwddecl="0" i18n="1" name="LayersEditorPanel" language="CPP" />
<wxDialog wxs="wxsmith/InstancesAdvancedPasteDialog.wxs" src="GDCore\IDE\Dialogs\InstancesAdvancedPasteDialog.cpp" hdr="GDCore\IDE\Dialogs\InstancesAdvancedPasteDialog.h" fwddecl="0" i18n="1" name="InstancesAdvancedPasteDialog" language="CPP" /> <wxDialog wxs="wxsmith/InstancesAdvancedPasteDialog.wxs" src="GDCore\IDE\Dialogs\InstancesAdvancedPasteDialog.cpp" hdr="GDCore\IDE\Dialogs\InstancesAdvancedPasteDialog.h" fwddecl="0" i18n="1" name="InstancesAdvancedPasteDialog" language="CPP" />
<wxDialog wxs="wxsmith/ChooseAutomatismTypeDialog.wxs" src="GDCore\IDE\Dialogs\ChooseAutomatismTypeDialog.cpp" hdr="GDCore\IDE\Dialogs\ChooseAutomatismTypeDialog.h" fwddecl="0" i18n="1" name="ChooseAutomatismTypeDialog" language="CPP" /> <wxDialog wxs="wxsmith/ChooseBehaviorTypeDialog.wxs" src="GDCore\IDE\Dialogs\ChooseBehaviorTypeDialog.cpp" hdr="GDCore\IDE\Dialogs\ChooseBehaviorTypeDialog.h" fwddecl="0" i18n="1" name="ChooseBehaviorTypeDialog" language="CPP" />
<wxDialog wxs="wxsmith/EditLayerDialog.wxs" src="GDCore\IDE\Dialogs\EditLayerDialog.cpp" hdr="GDCore\IDE\Dialogs\EditLayerDialog.h" fwddecl="0" i18n="1" name="EditLayerDialog" language="CPP" /> <wxDialog wxs="wxsmith/EditLayerDialog.wxs" src="GDCore\IDE\Dialogs\EditLayerDialog.cpp" hdr="GDCore\IDE\Dialogs\EditLayerDialog.h" fwddecl="0" i18n="1" name="EditLayerDialog" language="CPP" />
<wxDialog wxs="wxsmith/EditLink.wxs" src="GDCore\IDE\Dialogs\EditLink.cpp" hdr="GDCore\IDE\Dialogs\EditLink.h" fwddecl="0" i18n="1" name="EditLink" language="CPP" /> <wxDialog wxs="wxsmith/EditLink.wxs" src="GDCore\IDE\Dialogs\EditLink.cpp" hdr="GDCore\IDE\Dialogs\EditLink.h" fwddecl="0" i18n="1" name="EditLink" language="CPP" />
<wxDialog wxs="wxsmith/EditComment.wxs" src="GDCore\IDE\Dialogs\EditComment.cpp" hdr="GDCore\IDE\Dialogs\EditComment.h" fwddecl="0" i18n="1" name="EditComment" language="CPP" /> <wxDialog wxs="wxsmith/EditComment.wxs" src="GDCore\IDE\Dialogs\EditComment.cpp" hdr="GDCore\IDE\Dialogs\EditComment.h" fwddecl="0" i18n="1" name="EditComment" language="CPP" />

View File

@@ -488,28 +488,28 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(gd:
.AddParameter("string", _("Variable")) .AddParameter("string", _("Variable"))
.SetHidden(); .SetHidden();
obj.AddCondition("AutomatismActivated", obj.AddCondition("BehaviorActivated",
_("Automatism activated"), _("Behavior activated"),
_("Return true if the automatism is activated for the object."), _("Return true if the behavior is activated for the object."),
_("Automatism _PARAM1_ of _PARAM0_ is activated"), _("Behavior _PARAM1_ of _PARAM0_ is activated"),
_("Automatisms"), _("Behaviors"),
"res/automatism24.png", "res/behavior24.png",
"res/automatism16.png") "res/behavior16.png")
.AddParameter("object", _("Object")) .AddParameter("object", _("Object"))
.AddParameter("automatism", _("Automatism")) .AddParameter("behavior", _("Behavior"))
.MarkAsAdvanced(); .MarkAsAdvanced();
obj.AddAction("ActivateAutomatism", obj.AddAction("ActivateBehavior",
_("De/activate an automatism"), _("De/activate an behavior"),
_("De/activate the automatism for the object."), _("De/activate the behavior for the object."),
_("Activate automatism _PARAM1_ of _PARAM0_: _PARAM2_"), _("Activate behavior _PARAM1_ of _PARAM0_: _PARAM2_"),
_("Automatisms"), _("Behaviors"),
"res/automatism24.png", "res/behavior24.png",
"res/automatism16.png") "res/behavior16.png")
.AddParameter("object", _("Object")) .AddParameter("object", _("Object"))
.AddParameter("automatism", _("Automatism")) .AddParameter("behavior", _("Behavior"))
.AddParameter("yesorno", _("Activate?")) .AddParameter("yesorno", _("Activate?"))
.MarkAsAdvanced(); .MarkAsAdvanced();

View File

@@ -369,11 +369,11 @@ make -j4
* *
* **Extensions** are seen by GDevelop Core as classes inheriting from gd::PlatformExtension.<br> * **Extensions** are seen by GDevelop Core as classes inheriting from gd::PlatformExtension.<br>
* They are stored inside the platform they belong to, and they are also loaded from a dynamic library file thanks to gd::ExtensionsLoader. The main * They are stored inside the platform they belong to, and they are also loaded from a dynamic library file thanks to gd::ExtensionsLoader. The main
* job of an extension is to <b>declare</b> everything it provides: objects, actions and conditions, automatisms, expressions.<br> * job of an extension is to <b>declare</b> everything it provides: objects, actions and conditions, behaviors, expressions.<br>
* This is done directly using the standard method provided by gd::PlatformExtension, notably: * This is done directly using the standard method provided by gd::PlatformExtension, notably:
* - gd::PlatformExtension::AddCondition and gd::PlatformExtension::AddAction, * - gd::PlatformExtension::AddCondition and gd::PlatformExtension::AddAction,
* - gd::PlatformExtension::AddExpression (and gd::PlatformExtension::AddStrExpression), * - gd::PlatformExtension::AddExpression (and gd::PlatformExtension::AddStrExpression),
* - gd::PlatformExtension::AddObject and gd::PlatformExtension::AddAutomatism * - gd::PlatformExtension::AddObject and gd::PlatformExtension::AddBehavior
* *
* *
* Some platforms (like the C++ Platform) offer another base class which must be used instead of gd::PlatformExtension when declaring a platorm: as this base class * Some platforms (like the C++ Platform) offer another base class which must be used instead of gd::PlatformExtension when declaring a platorm: as this base class
@@ -554,30 +554,30 @@ AddEvent("Standard",
.SetCodeGenerator(std::shared_ptr<gd::EventMetadata::CodeGenerator>(codeGen)); .SetCodeGenerator(std::shared_ptr<gd::EventMetadata::CodeGenerator>(codeGen));
* \endcode * \endcode
* \section automatismsDeclaration Declaring the automatisms * \section behaviorsDeclaration Declaring the behaviors
Automatisms are declared like objects: Behaviors are declared like objects:
* \code * \code
gd::AutomatismMetadata & aut = AddAutomatism("Name", gd::BehaviorMetadata & aut = AddBehavior("Name",
_("Name displayed to users"), _("Name displayed to users"),
_("DefaultNameUsedInEditor"), _("DefaultNameUsedInEditor"),
_("Description."), _("Description."),
"Group", "Group",
"path-to-a-32-by-32-icon.png", "path-to-a-32-by-32-icon.png",
"AutomatismClassName", "BehaviorClassName",
std::shared_ptr<gd::Automatism>(new AutomatismClassName), std::shared_ptr<gd::Behavior>(new BehaviorClassName),
std::shared_ptr<gd::AutomatismsSharedData>(new AutomatismSharedDataClassName)); std::shared_ptr<gd::BehaviorsSharedData>(new BehaviorSharedDataClassName));
* \endcode * \endcode
* The last line can be replaced by <code>std::shared_ptr<gd::AutomatismsSharedData>()</code> if no shared data are being used. * The last line can be replaced by <code>std::shared_ptr<gd::BehaviorsSharedData>()</code> if no shared data are being used.
* *
* You can then declare the actions, conditions, and expressions related to the automatism like objects:<br> * You can then declare the actions, conditions, and expressions related to the behavior like objects:<br>
* Call AddAction/AddCondition/AddExpression on the <i>aut</i> object. * Call AddAction/AddCondition/AddExpression on the <i>aut</i> object.
* \section excludingNonRuntimeDeclaration (C++ platform) Excluding elements declaration from runtime * \section excludingNonRuntimeDeclaration (C++ platform) Excluding elements declaration from runtime
* When your extension is compiled for the C++ platform Runtime, GDevelop does not known anything about action/condition or even events classes.<br> * When your extension is compiled for the C++ platform Runtime, GDevelop does not known anything about action/condition or even events classes.<br>
* You have then to exclude all actions/conditions/expressions/events declaration from extension at runtime (only Extension/Object/Automatisms declarations have to be kept). * You have then to exclude all actions/conditions/expressions/events declaration from extension at runtime (only Extension/Object/Behaviors declarations have to be kept).
* Use the *<code>GD_IDE_ONLY</code> define* to achieve this goal, as demonstrated in this skeleton of a complete extension declaration: * Use the *<code>GD_IDE_ONLY</code> define* to achieve this goal, as demonstrated in this skeleton of a complete extension declaration:
* \code * \code
@@ -619,18 +619,18 @@ public:
} }
{ {
gd::AutomatismMetadata & aut = AddAutomatism("AutomatismName", gd::BehaviorMetadata & aut = AddBehavior("BehaviorName",
_("Automatism name"), _("Behavior name"),
"defaultGDname", "defaultGDname",
_("Description"), _("Description"),
"", "",
"CppPlatform/Extensions/myicon.png", "CppPlatform/Extensions/myicon.png",
"PhysicsAutomatism", "PhysicsBehavior",
std::shared_ptr<gd::Automatism>(new AutomatismClassName), std::shared_ptr<gd::Behavior>(new BehaviorClassName),
std::shared_ptr<gd::AutomatismsSharedData>(new AutomatismSharedDataClassName)); std::shared_ptr<gd::BehaviorsSharedData>(new BehaviorSharedDataClassName));
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
automatismInfo.SetIncludeFile("MyExtension/MyIncludeFile.h"); behaviorInfo.SetIncludeFile("MyExtension/MyIncludeFile.h");
aut.AddAction(...); aut.AddAction(...);
aut.AddCondition(...); aut.AddCondition(...);

View File

@@ -3,11 +3,11 @@
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved. * Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License. * This project is released under the MIT License.
*/ */
#include "AutomatismMetadata.h" #include "BehaviorMetadata.h"
#include "GDCore/Events/InstructionMetadata.h" #include "GDCore/Events/InstructionMetadata.h"
#include "GDCore/Events/ExpressionMetadata.h" #include "GDCore/Events/ExpressionMetadata.h"
#include "GDCore/PlatformDefinition/Automatism.h" #include "GDCore/PlatformDefinition/Behavior.h"
#include "GDCore/PlatformDefinition/AutomatismsSharedData.h" #include "GDCore/PlatformDefinition/BehaviorsSharedData.h"
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
@@ -19,7 +19,7 @@
namespace gd namespace gd
{ {
AutomatismMetadata::AutomatismMetadata(const gd::String & extensionNamespace_, BehaviorMetadata::BehaviorMetadata(const gd::String & extensionNamespace_,
const gd::String & name_, const gd::String & name_,
const gd::String & fullname_, const gd::String & fullname_,
const gd::String & defaultName_, const gd::String & defaultName_,
@@ -27,8 +27,8 @@ AutomatismMetadata::AutomatismMetadata(const gd::String & extensionNamespace_,
const gd::String & group_, const gd::String & group_,
const gd::String & icon24x24, const gd::String & icon24x24,
const gd::String & className_, const gd::String & className_,
std::shared_ptr<gd::Automatism> instance_, std::shared_ptr<gd::Behavior> instance_,
std::shared_ptr<gd::AutomatismsSharedData> sharedDatasInstance_) : std::shared_ptr<gd::BehaviorsSharedData> sharedDatasInstance_) :
extensionNamespace(extensionNamespace_), extensionNamespace(extensionNamespace_),
instance(instance_), instance(instance_),
sharedDatasInstance(sharedDatasInstance_) sharedDatasInstance(sharedDatasInstance_)
@@ -46,7 +46,7 @@ AutomatismMetadata::AutomatismMetadata(const gd::String & extensionNamespace_,
else if ( wxFile::Exists(iconFilename) ) else if ( wxFile::Exists(iconFilename) )
SetBitmapIcon(wxBitmap(iconFilename, wxBITMAP_TYPE_ANY)); SetBitmapIcon(wxBitmap(iconFilename, wxBITMAP_TYPE_ANY));
else { else {
std::cout << "Warning: The icon file for automatism \"" << name_ std::cout << "Warning: The icon file for behavior \"" << name_
<< " was not found in the current skin icons" << " was not found in the current skin icons"
<< " and the specified name is not an existing filename."; << " and the specified name is not an existing filename.";
SetBitmapIcon(wxBitmap(24,24)); SetBitmapIcon(wxBitmap(24,24));
@@ -58,7 +58,7 @@ AutomatismMetadata::AutomatismMetadata(const gd::String & extensionNamespace_,
if ( sharedDatasInstance ) sharedDatasInstance->SetTypeName(name_); if ( sharedDatasInstance ) sharedDatasInstance->SetTypeName(name_);
} }
gd::InstructionMetadata & AutomatismMetadata::AddCondition(const gd::String & name, gd::InstructionMetadata & BehaviorMetadata::AddCondition(const gd::String & name,
const gd::String & fullname, const gd::String & fullname,
const gd::String & description, const gd::String & description,
const gd::String & sentence, const gd::String & sentence,
@@ -73,7 +73,7 @@ gd::InstructionMetadata & AutomatismMetadata::AddCondition(const gd::String & na
#endif #endif
} }
gd::InstructionMetadata & AutomatismMetadata::AddAction(const gd::String & name, gd::InstructionMetadata & BehaviorMetadata::AddAction(const gd::String & name,
const gd::String & fullname, const gd::String & fullname,
const gd::String & description, const gd::String & description,
const gd::String & sentence, const gd::String & sentence,
@@ -88,68 +88,68 @@ gd::InstructionMetadata & AutomatismMetadata::AddAction(const gd::String & name,
#endif #endif
} }
gd::ExpressionMetadata & AutomatismMetadata::AddExpression(const gd::String & name, gd::ExpressionMetadata & BehaviorMetadata::AddExpression(const gd::String & name,
const gd::String & fullname, const gd::String & fullname,
const gd::String & description, const gd::String & description,
const gd::String & group, const gd::String & group,
const gd::String & smallicon) const gd::String & smallicon)
{ {
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
//Be careful, automatisms expression do not have namespace ( not necessary as we refer to the auomatism name in the expression ) //Be careful, behaviors expression do not have namespace ( not necessary as we refer to the auomatism name in the expression )
expressionsInfos[name] = ExpressionMetadata(extensionNamespace, name, fullname, description, group, smallicon); expressionsInfos[name] = ExpressionMetadata(extensionNamespace, name, fullname, description, group, smallicon);
return expressionsInfos[name]; return expressionsInfos[name];
#endif #endif
} }
gd::ExpressionMetadata & AutomatismMetadata::AddStrExpression(const gd::String & name, gd::ExpressionMetadata & BehaviorMetadata::AddStrExpression(const gd::String & name,
const gd::String & fullname, const gd::String & fullname,
const gd::String & description, const gd::String & description,
const gd::String & group, const gd::String & group,
const gd::String & smallicon) const gd::String & smallicon)
{ {
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
//Be careful, automatisms expression do not have namespace ( not necessary as we refer to the auomatism name in the expression ) //Be careful, behaviors expression do not have namespace ( not necessary as we refer to the auomatism name in the expression )
strExpressionsInfos[name] = ExpressionMetadata(extensionNamespace, name, fullname, description, group, smallicon); strExpressionsInfos[name] = ExpressionMetadata(extensionNamespace, name, fullname, description, group, smallicon);
return strExpressionsInfos[name]; return strExpressionsInfos[name];
#endif #endif
} }
AutomatismMetadata & AutomatismMetadata::SetFullName(const gd::String & fullname_) BehaviorMetadata & BehaviorMetadata::SetFullName(const gd::String & fullname_)
{ {
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
fullname = fullname_; fullname = fullname_;
#endif #endif
return *this; return *this;
} }
AutomatismMetadata & AutomatismMetadata::SetDefaultName(const gd::String & defaultName_) BehaviorMetadata & BehaviorMetadata::SetDefaultName(const gd::String & defaultName_)
{ {
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
defaultName = defaultName_; defaultName = defaultName_;
#endif #endif
return *this; return *this;
} }
AutomatismMetadata & AutomatismMetadata::SetDescription(const gd::String & description_) BehaviorMetadata & BehaviorMetadata::SetDescription(const gd::String & description_)
{ {
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
description = description_; description = description_;
#endif #endif
return *this; return *this;
} }
AutomatismMetadata & AutomatismMetadata::SetGroup(const gd::String & group_) BehaviorMetadata & BehaviorMetadata::SetGroup(const gd::String & group_)
{ {
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
group = group_; group = group_;
#endif #endif
return *this; return *this;
} }
AutomatismMetadata & AutomatismMetadata::SetBitmapIcon(const wxBitmap & bitmap_) BehaviorMetadata & BehaviorMetadata::SetBitmapIcon(const wxBitmap & bitmap_)
{ {
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
icon = bitmap_; icon = bitmap_;
#endif #endif
return *this; return *this;
} }
AutomatismMetadata & AutomatismMetadata::SetIncludeFile(const gd::String & includeFile) BehaviorMetadata & BehaviorMetadata::SetIncludeFile(const gd::String & includeFile)
{ {
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
includeFiles.clear(); includeFiles.clear();
@@ -157,7 +157,7 @@ AutomatismMetadata & AutomatismMetadata::SetIncludeFile(const gd::String & inclu
#endif #endif
return *this; return *this;
} }
AutomatismMetadata & AutomatismMetadata::AddIncludeFile(const gd::String & includeFile) BehaviorMetadata & BehaviorMetadata::AddIncludeFile(const gd::String & includeFile)
{ {
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
if ( std::find(includeFiles.begin(), includeFiles.end(), includeFile) == includeFiles.end()) if ( std::find(includeFiles.begin(), includeFiles.end(), includeFile) == includeFiles.end())

View File

@@ -3,8 +3,8 @@
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved. * Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License. * This project is released under the MIT License.
*/ */
#ifndef AUTOMATISMMETADATA_H #ifndef BEHAVIORMETADATA_H
#define AUTOMATISMMETADATA_H #define BEHAVIORMETADATA_H
#include "GDCore/String.h" #include "GDCore/String.h"
#include <map> #include <map>
#include "GDCore/Events/InstructionMetadata.h" #include "GDCore/Events/InstructionMetadata.h"
@@ -12,8 +12,8 @@
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
#include <wx/bitmap.h> #include <wx/bitmap.h>
#endif #endif
namespace gd { class Automatism; } namespace gd { class Behavior; }
namespace gd { class AutomatismsSharedData; } namespace gd { class BehaviorsSharedData; }
namespace gd { class InstructionMetadata; } namespace gd { class InstructionMetadata; }
namespace gd { class ExpressionMetadata; } namespace gd { class ExpressionMetadata; }
class wxBitmap; class wxBitmap;
@@ -22,17 +22,17 @@ namespace gd
{ {
/** /**
* \brief Contains user-friendly information about an automatism type * \brief Contains user-friendly information about an behavior type
* *
* Implementations may derive from this class so as to provide more complete metadata if needed. * Implementations may derive from this class so as to provide more complete metadata if needed.
* ( For example, GDevelop C++ Platform is shared pointers to objects that will be cloned so as to create the automatisms... ) * ( For example, GDevelop C++ Platform is shared pointers to objects that will be cloned so as to create the behaviors... )
* *
* \ingroup Events * \ingroup Events
*/ */
class GD_CORE_API AutomatismMetadata class GD_CORE_API BehaviorMetadata
{ {
public: public:
AutomatismMetadata(const gd::String & extensionNamespace, BehaviorMetadata(const gd::String & extensionNamespace,
const gd::String & name_, const gd::String & name_,
const gd::String & fullname_, const gd::String & fullname_,
const gd::String & defaultName_, const gd::String & defaultName_,
@@ -40,10 +40,10 @@ public:
const gd::String & group_, const gd::String & group_,
const gd::String & icon24x24_, const gd::String & icon24x24_,
const gd::String & className_, const gd::String & className_,
std::shared_ptr<gd::Automatism> instance, std::shared_ptr<gd::Behavior> instance,
std::shared_ptr<gd::AutomatismsSharedData> sharedDatasInstance); std::shared_ptr<gd::BehaviorsSharedData> sharedDatasInstance);
AutomatismMetadata() {}; BehaviorMetadata() {};
virtual ~AutomatismMetadata() {}; virtual ~BehaviorMetadata() {};
/** /**
* Declare a new condition as being part of the extension. * Declare a new condition as being part of the extension.
@@ -84,23 +84,23 @@ public:
const gd::String & group_, const gd::String & group_,
const gd::String & smallicon_); const gd::String & smallicon_);
AutomatismMetadata & SetFullName(const gd::String & fullname_); BehaviorMetadata & SetFullName(const gd::String & fullname_);
AutomatismMetadata & SetDefaultName(const gd::String & defaultName_); BehaviorMetadata & SetDefaultName(const gd::String & defaultName_);
AutomatismMetadata & SetDescription(const gd::String & description_); BehaviorMetadata & SetDescription(const gd::String & description_);
AutomatismMetadata & SetGroup(const gd::String & group_); BehaviorMetadata & SetGroup(const gd::String & group_);
AutomatismMetadata & SetBitmapIcon(const wxBitmap & bitmap_); BehaviorMetadata & SetBitmapIcon(const wxBitmap & bitmap_);
/** /**
* \brief Erase any existing include file and add the specified include. * \brief Erase any existing include file and add the specified include.
* \note The requirement may vary depending on the platform: Most of the time, the include * \note The requirement may vary depending on the platform: Most of the time, the include
* file contains the declaration of the automatism. * file contains the declaration of the behavior.
*/ */
AutomatismMetadata & SetIncludeFile(const gd::String & includeFile); BehaviorMetadata & SetIncludeFile(const gd::String & includeFile);
/** /**
* \brief Add a file to the already existing include files. * \brief Add a file to the already existing include files.
*/ */
AutomatismMetadata & AddIncludeFile(const gd::String & includeFile); BehaviorMetadata & AddIncludeFile(const gd::String & includeFile);
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
const gd::String & GetFullName() const { return fullname; } const gd::String & GetFullName() const { return fullname; }
@@ -112,8 +112,8 @@ public:
const wxBitmap & GetBitmapIcon() const { return icon; } const wxBitmap & GetBitmapIcon() const { return icon; }
#endif #endif
#endif #endif
std::shared_ptr<gd::Automatism> Get() const { return instance; } std::shared_ptr<gd::Behavior> Get() const { return instance; }
std::shared_ptr<gd::AutomatismsSharedData> GetSharedDataInstance() const { return sharedDatasInstance; } std::shared_ptr<gd::BehaviorsSharedData> GetSharedDataInstance() const { return sharedDatasInstance; }
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
std::map<gd::String, gd::InstructionMetadata > conditionsInfos; std::map<gd::String, gd::InstructionMetadata > conditionsInfos;
@@ -137,10 +137,10 @@ private:
#endif #endif
#endif #endif
std::shared_ptr<gd::Automatism> instance; std::shared_ptr<gd::Behavior> instance;
std::shared_ptr<gd::AutomatismsSharedData> sharedDatasInstance; std::shared_ptr<gd::BehaviorsSharedData> sharedDatasInstance;
}; };
} }
#endif // AUTOMATISMMETADATA_H #endif // BEHAVIORMETADATA_H

View File

@@ -13,7 +13,7 @@
#include "GDCore/Events/ExpressionsCodeGeneration.h" #include "GDCore/Events/ExpressionsCodeGeneration.h"
#include "GDCore/Events/InstructionMetadata.h" #include "GDCore/Events/InstructionMetadata.h"
#include "GDCore/Events/ObjectMetadata.h" #include "GDCore/Events/ObjectMetadata.h"
#include "GDCore/Events/AutomatismMetadata.h" #include "GDCore/Events/BehaviorMetadata.h"
using namespace std; using namespace std;
@@ -269,22 +269,22 @@ gd::String EventsCodeGenerator::GenerateConditionCode(gd::Instruction & conditio
} }
} }
//Generate automatism condition if available //Generate behavior condition if available
gd::String automatismType = gd::GetTypeOfAutomatism(project, scene, condition.GetParameters().size() < 2 ? "" : condition.GetParameter(1).GetPlainString()); gd::String behaviorType = gd::GetTypeOfBehavior(project, scene, condition.GetParameters().size() < 2 ? "" : condition.GetParameter(1).GetPlainString());
if (MetadataProvider::HasAutomatismCondition(platform, automatismType, condition.GetType()) && instrInfos.parameters.size() >= 2) if (MetadataProvider::HasBehaviorCondition(platform, behaviorType, condition.GetType()) && instrInfos.parameters.size() >= 2)
{ {
std::vector<gd::String> realObjects = ExpandObjectsName(objectName, context); std::vector<gd::String> realObjects = ExpandObjectsName(objectName, context);
for (unsigned int i = 0;i<realObjects.size();++i) for (unsigned int i = 0;i<realObjects.size();++i)
{ {
//Setup context //Setup context
const AutomatismMetadata & autoInfo = MetadataProvider::GetAutomatismMetadata(platform, automatismType); const BehaviorMetadata & autoInfo = MetadataProvider::GetBehaviorMetadata(platform, behaviorType);
AddIncludeFiles(autoInfo.includeFiles); AddIncludeFiles(autoInfo.includeFiles);
context.SetCurrentObject(realObjects[i]); context.SetCurrentObject(realObjects[i]);
context.ObjectsListNeeded(realObjects[i]); context.ObjectsListNeeded(realObjects[i]);
//Prepare arguments and generate the whole condition code //Prepare arguments and generate the whole condition code
vector<gd::String> arguments = GenerateParametersCodes(condition.GetParameters(), instrInfos.parameters, context); vector<gd::String> arguments = GenerateParametersCodes(condition.GetParameters(), instrInfos.parameters, context);
conditionCode += GenerateAutomatismCondition(realObjects[i], condition.GetParameter(1).GetPlainString(), autoInfo, arguments, conditionCode += GenerateBehaviorCondition(realObjects[i], condition.GetParameter(1).GetPlainString(), autoInfo, arguments,
instrInfos, returnBoolean, condition.IsInverted(), context); instrInfos, returnBoolean, condition.IsInverted(), context);
context.SetNoCurrentObject(); context.SetNoCurrentObject();
@@ -410,22 +410,22 @@ gd::String EventsCodeGenerator::GenerateActionCode(gd::Instruction & action, Eve
} }
} }
//Affection to an automatism member function if found //Affection to an behavior member function if found
gd::String automatismType = gd::GetTypeOfAutomatism(project, scene, action.GetParameters().size() < 2 ? "" : action.GetParameter(1).GetPlainString()); gd::String behaviorType = gd::GetTypeOfBehavior(project, scene, action.GetParameters().size() < 2 ? "" : action.GetParameter(1).GetPlainString());
if (MetadataProvider::HasAutomatismAction(platform, automatismType, action.GetType()) && instrInfos.parameters.size() >= 2) if (MetadataProvider::HasBehaviorAction(platform, behaviorType, action.GetType()) && instrInfos.parameters.size() >= 2)
{ {
std::vector<gd::String> realObjects = ExpandObjectsName(objectName, context); std::vector<gd::String> realObjects = ExpandObjectsName(objectName, context);
for (unsigned int i = 0;i<realObjects.size();++i) for (unsigned int i = 0;i<realObjects.size();++i)
{ {
//Setup context //Setup context
const AutomatismMetadata & autoInfo = MetadataProvider::GetAutomatismMetadata(platform, automatismType); const BehaviorMetadata & autoInfo = MetadataProvider::GetBehaviorMetadata(platform, behaviorType);
AddIncludeFiles(autoInfo.includeFiles); AddIncludeFiles(autoInfo.includeFiles);
context.SetCurrentObject(realObjects[i]); context.SetCurrentObject(realObjects[i]);
context.ObjectsListNeeded(realObjects[i]); context.ObjectsListNeeded(realObjects[i]);
//Prepare arguments and generate the whole action code //Prepare arguments and generate the whole action code
vector<gd::String> arguments = GenerateParametersCodes(action.GetParameters(), instrInfos.parameters, context); vector<gd::String> arguments = GenerateParametersCodes(action.GetParameters(), instrInfos.parameters, context);
actionCode += GenerateAutomatismAction(realObjects[i], action.GetParameter(1).GetPlainString(), autoInfo, arguments, instrInfos, context); actionCode += GenerateBehaviorAction(realObjects[i], action.GetParameter(1).GetPlainString(), autoInfo, arguments, instrInfos, context);
context.SetNoCurrentObject(); context.SetNoCurrentObject();
} }
@@ -511,7 +511,7 @@ gd::String EventsCodeGenerator::GenerateParameterCodes(const gd::String & parame
argOutput = "\""+argOutput+"\""; argOutput = "\""+argOutput+"\"";
} }
else if ( metadata.type == "object" || metadata.type == "automatism" ) else if ( metadata.type == "object" || metadata.type == "behavior" )
{ {
argOutput = "\""+ConvertToString(parameter)+"\""; argOutput = "\""+ConvertToString(parameter)+"\"";
} }
@@ -759,15 +759,15 @@ gd::String EventsCodeGenerator::GenerateObjectFunctionCall(gd::String objectList
return "TODO (GenerateObjectFunctionCall)"; return "TODO (GenerateObjectFunctionCall)";
} }
gd::String EventsCodeGenerator::GenerateObjectAutomatismFunctionCall(gd::String objectListName, gd::String EventsCodeGenerator::GenerateObjectBehaviorFunctionCall(gd::String objectListName,
gd::String automatismName, gd::String behaviorName,
const gd::AutomatismMetadata & autoInfo, const gd::BehaviorMetadata & autoInfo,
const gd::ExpressionCodeGenerationInformation & codeInfo, const gd::ExpressionCodeGenerationInformation & codeInfo,
gd::String parametersStr, gd::String parametersStr,
gd::String defaultOutput, gd::String defaultOutput,
gd::EventsCodeGenerationContext & context) gd::EventsCodeGenerationContext & context)
{ {
return "TODO (GenerateObjectAutomatismFunctionCall)"; return "TODO (GenerateObjectBehaviorFunctionCall)";
} }
@@ -845,9 +845,9 @@ gd::String EventsCodeGenerator::GenerateObjectCondition(const gd::String & objec
return "For each picked object \""+objectName+"\", check "+predicat+".\n"; return "For each picked object \""+objectName+"\", check "+predicat+".\n";
} }
gd::String EventsCodeGenerator::GenerateAutomatismCondition(const gd::String & objectName, gd::String EventsCodeGenerator::GenerateBehaviorCondition(const gd::String & objectName,
const gd::String & automatismName, const gd::String & behaviorName,
const gd::AutomatismMetadata & autoInfo, const gd::BehaviorMetadata & autoInfo,
const std::vector<gd::String> & arguments, const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos, const gd::InstructionMetadata & instrInfos,
const gd::String & returnBoolean, const gd::String & returnBoolean,
@@ -873,7 +873,7 @@ gd::String EventsCodeGenerator::GenerateAutomatismCondition(const gd::String & o
} }
if ( conditionInverted ) predicat = GenerateNegatedPredicat(predicat); if ( conditionInverted ) predicat = GenerateNegatedPredicat(predicat);
return "For each picked object \""+objectName+"\", check "+predicat+" for automatism \""+automatismName+"\".\n"; return "For each picked object \""+objectName+"\", check "+predicat+" for behavior \""+behaviorName+"\".\n";
} }
gd::String EventsCodeGenerator::GenerateFreeAction(const std::vector<gd::String> & arguments, const gd::InstructionMetadata & instrInfos, gd::String EventsCodeGenerator::GenerateFreeAction(const std::vector<gd::String> & arguments, const gd::InstructionMetadata & instrInfos,
@@ -934,9 +934,9 @@ gd::String EventsCodeGenerator::GenerateObjectAction(const gd::String & objectNa
} }
gd::String EventsCodeGenerator::GenerateAutomatismAction(const gd::String & objectName, gd::String EventsCodeGenerator::GenerateBehaviorAction(const gd::String & objectName,
const gd::String & automatismName, const gd::String & behaviorName,
const gd::AutomatismMetadata & autoInfo, const gd::BehaviorMetadata & autoInfo,
const std::vector<gd::String> & arguments, const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos, const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context) gd::EventsCodeGenerationContext & context)
@@ -950,7 +950,7 @@ gd::String EventsCodeGenerator::GenerateAutomatismAction(const gd::String & obje
else else
call = GenerateCompoundOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName,2); call = GenerateCompoundOperatorCall(instrInfos, arguments, instrInfos.codeExtraInformation.functionCallName,2);
return "For each picked object \""+objectName+"\", call "+call return "For each picked object \""+objectName+"\", call "+call
+" for automatism \""+automatismName+"\".\n"; +" for behavior \""+behaviorName+"\".\n";
} }
else else
{ {
@@ -963,7 +963,7 @@ gd::String EventsCodeGenerator::GenerateAutomatismAction(const gd::String & obje
call = instrInfos.codeExtraInformation.functionCallName+"("+argumentsStr+")"; call = instrInfos.codeExtraInformation.functionCallName+"("+argumentsStr+")";
return "For each picked object \""+objectName+"\", call "+call+"("+argumentsStr+")" return "For each picked object \""+objectName+"\", call "+call+"("+argumentsStr+")"
+" for automatism \""+automatismName+"\".\n"; +" for behavior \""+behaviorName+"\".\n";
} }
} }

View File

@@ -14,7 +14,7 @@ namespace gd { class Layout; }
namespace gd { class ExternalEvents; } namespace gd { class ExternalEvents; }
namespace gd { class ParameterMetadata; } namespace gd { class ParameterMetadata; }
namespace gd { class ObjectMetadata; } namespace gd { class ObjectMetadata; }
namespace gd { class AutomatismMetadata; } namespace gd { class BehaviorMetadata; }
namespace gd { class InstructionMetadata; } namespace gd { class InstructionMetadata; }
namespace gd { class EventsCodeGenerationContext; } namespace gd { class EventsCodeGenerationContext; }
namespace gd { class ExpressionCodeGenerationInformation; } namespace gd { class ExpressionCodeGenerationInformation; }
@@ -107,7 +107,7 @@ public:
/** /**
* \brief Generate code for a single condition. * \brief Generate code for a single condition.
* *
* The generation is really done in GenerateFreeCondition/GenerateObjectCondition or GenerateAutomatismCondition. * The generation is really done in GenerateFreeCondition/GenerateObjectCondition or GenerateBehaviorCondition.
* *
* \param condition instruction to be done. * \param condition instruction to be done.
* \param returnBoolean The name of the boolean that must contains the condition result. * \param returnBoolean The name of the boolean that must contains the condition result.
@@ -119,7 +119,7 @@ public:
/** /**
* \brief Generate code for a single action * \brief Generate code for a single action
* *
* The generation is really done in GenerateFreeAction/GenerateObjectAction or GenerateAutomatismAction. * The generation is really done in GenerateFreeAction/GenerateObjectAction or GenerateBehaviorAction.
* *
* \param condition instruction to be done. * \param condition instruction to be done.
* \param context Context used for generation * \param context Context used for generation
@@ -351,19 +351,19 @@ protected:
gd::EventsCodeGenerationContext & context); gd::EventsCodeGenerationContext & context);
/** /**
* \brief Call a function of an automatism of the current object. * \brief Call a function of an behavior of the current object.
* \note The current object is the object being manipulated by a condition or an action. * \note The current object is the object being manipulated by a condition or an action.
* *
* \param objectListName The full name of the object list being used * \param objectListName The full name of the object list being used
* \param automatismName The full name of the automatism to be used * \param behaviorName The full name of the behavior to be used
* \param objMetadata Metadata about the automatism being used. * \param objMetadata Metadata about the behavior being used.
* \param functionCallName The function to be called on this object. * \param functionCallName The function to be called on this object.
* \param parametersStr The parameters of the function * \param parametersStr The parameters of the function
* \param context The context : May be used to get information about the current scope. * \param context The context : May be used to get information about the current scope.
*/ */
virtual gd::String GenerateObjectAutomatismFunctionCall(gd::String objectListName, virtual gd::String GenerateObjectBehaviorFunctionCall(gd::String objectListName,
gd::String automatismName, gd::String behaviorName,
const gd::AutomatismMetadata & autoInfo, const gd::BehaviorMetadata & autoInfo,
const gd::ExpressionCodeGenerationInformation & codeInfo, const gd::ExpressionCodeGenerationInformation & codeInfo,
gd::String parametersStr, gd::String parametersStr,
gd::String defaultOutput, gd::String defaultOutput,
@@ -413,9 +413,9 @@ protected:
bool conditionInverted, bool conditionInverted,
gd::EventsCodeGenerationContext & context); gd::EventsCodeGenerationContext & context);
virtual gd::String GenerateAutomatismCondition(const gd::String & objectName, virtual gd::String GenerateBehaviorCondition(const gd::String & objectName,
const gd::String & automatismName, const gd::String & behaviorName,
const gd::AutomatismMetadata & autoInfo, const gd::BehaviorMetadata & autoInfo,
const std::vector<gd::String> & arguments, const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos, const gd::InstructionMetadata & instrInfos,
const gd::String & returnBoolean, const gd::String & returnBoolean,
@@ -432,9 +432,9 @@ protected:
const gd::InstructionMetadata & instrInfos, const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context); gd::EventsCodeGenerationContext & context);
virtual gd::String GenerateAutomatismAction(const gd::String & objectName, virtual gd::String GenerateBehaviorAction(const gd::String & objectName,
const gd::String & automatismName, const gd::String & behaviorName,
const gd::AutomatismMetadata & autoInfo, const gd::BehaviorMetadata & autoInfo,
const std::vector<gd::String> & arguments, const std::vector<gd::String> & arguments,
const gd::InstructionMetadata & instrInfos, const gd::InstructionMetadata & instrInfos,
gd::EventsCodeGenerationContext & context); gd::EventsCodeGenerationContext & context);

View File

@@ -367,7 +367,7 @@ bool ExpressionParser::ParseMathExpression(const gd::Platform & platform, const
bool functionFound = false; bool functionFound = false;
bool staticFunctionFound = false; bool staticFunctionFound = false;
bool objectFunctionFound = false; bool objectFunctionFound = false;
bool automatismFunctionFound = false; bool behaviorFunctionFound = false;
//First try to bind to a static expression //First try to bind to a static expression
if ( nameIsFunction && MetadataProvider::HasExpression(platform, functionName) ) if ( nameIsFunction && MetadataProvider::HasExpression(platform, functionName) )
@@ -381,7 +381,7 @@ bool ExpressionParser::ParseMathExpression(const gd::Platform & platform, const
functionFound = true; objectFunctionFound = true; functionFound = true; objectFunctionFound = true;
instructionInfos = MetadataProvider::GetObjectExpressionMetadata(platform, gd::GetTypeOfObject(project, layout, objectName), functionName); instructionInfos = MetadataProvider::GetObjectExpressionMetadata(platform, gd::GetTypeOfObject(project, layout, objectName), functionName);
} }
//And in automatisms expressions //And in behaviors expressions
else if ( !nameIsFunction ) else if ( !nameIsFunction )
{ {
size_t firstDoublePoints = functionName.find("::"); size_t firstDoublePoints = functionName.find("::");
@@ -393,19 +393,19 @@ bool ExpressionParser::ParseMathExpression(const gd::Platform & platform, const
else else
functionName = ""; functionName = "";
if ( MetadataProvider::HasAutomatismExpression(platform, gd::GetTypeOfAutomatism(project, layout, autoName), functionName) ) if ( MetadataProvider::HasBehaviorExpression(platform, gd::GetTypeOfBehavior(project, layout, autoName), functionName) )
{ {
parameters.push_back(gd::Expression(autoName)); parameters.push_back(gd::Expression(autoName));
functionFound = true; automatismFunctionFound = true; functionFound = true; behaviorFunctionFound = true;
instructionInfos = MetadataProvider::GetAutomatismExpressionMetadata(platform, instructionInfos = MetadataProvider::GetBehaviorExpressionMetadata(platform,
gd::GetTypeOfAutomatism(project, layout, autoName), functionName); gd::GetTypeOfBehavior(project, layout, autoName), functionName);
//Verify that object has automatism. //Verify that object has behavior.
vector < gd::String > automatisms = gd::GetAutomatismsOfObject(project, layout, objectName); vector < gd::String > behaviors = gd::GetBehaviorsOfObject(project, layout, objectName);
if ( find(automatisms.begin(), automatisms.end(), autoName) == automatisms.end() ) if ( find(behaviors.begin(), behaviors.end(), autoName) == behaviors.end() )
{ {
cout << "Bad automatism requested" << endl; cout << "Bad behavior requested" << endl;
functionFound = false; functionFound = false;
} }
} }
@@ -492,10 +492,10 @@ bool ExpressionParser::ParseMathExpression(const gd::Platform & platform, const
nonFunctionTokenStartPos = gd::String::npos; nonFunctionTokenStartPos = gd::String::npos;
if ( objectFunctionFound ) callbacks.OnObjectFunction(functionName, parameters, instructionInfos); if ( objectFunctionFound ) callbacks.OnObjectFunction(functionName, parameters, instructionInfos);
else if ( automatismFunctionFound ) callbacks.OnObjectAutomatismFunction(functionName, parameters, instructionInfos); else if ( behaviorFunctionFound ) callbacks.OnObjectBehaviorFunction(functionName, parameters, instructionInfos);
else if ( staticFunctionFound ) callbacks.OnStaticFunction(functionName, parameters, instructionInfos); else if ( staticFunctionFound ) callbacks.OnStaticFunction(functionName, parameters, instructionInfos);
if ( objectFunctionFound || automatismFunctionFound || staticFunctionFound ) expressionWithoutFunctions += "0"; if ( objectFunctionFound || behaviorFunctionFound || staticFunctionFound ) expressionWithoutFunctions += "0";
parsePosition = parametersEnd+1; parsePosition = parametersEnd+1;
firstPointPos = expression.find(".", parametersEnd+1); firstPointPos = expression.find(".", parametersEnd+1);
@@ -712,7 +712,7 @@ bool ExpressionParser::ParseStringExpression(const gd::Platform & platform, cons
callbacks.OnObjectFunction(functionName, parameters, expressionInfo); callbacks.OnObjectFunction(functionName, parameters, expressionInfo);
} }
//And search automatisms expressions //And search behaviors expressions
else else
{ {
size_t firstDoublePoints = functionName.find("::"); size_t firstDoublePoints = functionName.find("::");
@@ -724,19 +724,19 @@ bool ExpressionParser::ParseStringExpression(const gd::Platform & platform, cons
else else
functionName = ""; functionName = "";
if ( MetadataProvider::HasAutomatismStrExpression(platform, gd::GetTypeOfAutomatism(project, layout, autoName), functionName) ) if ( MetadataProvider::HasBehaviorStrExpression(platform, gd::GetTypeOfBehavior(project, layout, autoName), functionName) )
{ {
parameters.push_back(gd::Expression(autoName)); parameters.push_back(gd::Expression(autoName));
functionFound = true; functionFound = true;
const gd::ExpressionMetadata & expressionInfo = MetadataProvider::GetAutomatismStrExpressionMetadata(platform, const gd::ExpressionMetadata & expressionInfo = MetadataProvider::GetBehaviorStrExpressionMetadata(platform,
gd::GetTypeOfAutomatism(project, layout, autoName), functionName); gd::GetTypeOfBehavior(project, layout, autoName), functionName);
//Verify that object has automatism. //Verify that object has behavior.
vector < gd::String > automatisms = gd::GetAutomatismsOfObject(project, layout, objectName); vector < gd::String > behaviors = gd::GetBehaviorsOfObject(project, layout, objectName);
if ( find(automatisms.begin(), automatisms.end(), autoName) == automatisms.end() ) if ( find(behaviors.begin(), behaviors.end(), autoName) == behaviors.end() )
{ {
cout << "Bad automatism requested" << endl; cout << "Bad behavior requested" << endl;
functionFound = false; functionFound = false;
} }
else else
@@ -758,7 +758,7 @@ bool ExpressionParser::ParseStringExpression(const gd::Platform & platform, cons
return false; return false;
} }
callbacks.OnObjectAutomatismFunction(functionName, parameters, expressionInfo); callbacks.OnObjectBehaviorFunction(functionName, parameters, expressionInfo);
} }
} }
} }

View File

@@ -98,7 +98,7 @@ public:
virtual void OnObjectFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) = 0; virtual void OnObjectFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) = 0;
virtual void OnObjectAutomatismFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) = 0; virtual void OnObjectBehaviorFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) = 0;
virtual bool OnSubMathExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression) = 0; virtual bool OnSubMathExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression) = 0;
virtual bool OnSubTextExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression) = 0; virtual bool OnSubTextExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression) = 0;

View File

@@ -15,7 +15,7 @@
#include "GDCore/Events/EventsCodeGenerationContext.h" #include "GDCore/Events/EventsCodeGenerationContext.h"
#include "GDCore/Events/ExpressionMetadata.h" #include "GDCore/Events/ExpressionMetadata.h"
#include "GDCore/Events/ObjectMetadata.h" #include "GDCore/Events/ObjectMetadata.h"
#include "GDCore/Events/AutomatismMetadata.h" #include "GDCore/Events/BehaviorMetadata.h"
#include "GDCore/CommonTools.h" #include "GDCore/CommonTools.h"
using namespace std; using namespace std;
@@ -114,7 +114,7 @@ void CallbacksForGeneratingExpressionCode::OnObjectFunction(gd::String functionN
plainExpression += output; plainExpression += output;
}; };
void CallbacksForGeneratingExpressionCode::OnObjectAutomatismFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) void CallbacksForGeneratingExpressionCode::OnObjectBehaviorFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo)
{ {
const gd::Project & project = codeGenerator.GetProject(); const gd::Project & project = codeGenerator.GetProject();
const gd::Layout & scene = codeGenerator.GetLayout(); const gd::Layout & scene = codeGenerator.GetLayout();
@@ -147,12 +147,12 @@ void CallbacksForGeneratingExpressionCode::OnObjectAutomatismFunction(gd::String
context.ObjectsListNeeded(realObjects[i]); context.ObjectsListNeeded(realObjects[i]);
//Cast the object if needed //Cast the object if needed
gd::String automatismType = gd::GetTypeOfAutomatism(project, scene, parameters[1].GetPlainString()); gd::String behaviorType = gd::GetTypeOfBehavior(project, scene, parameters[1].GetPlainString());
const AutomatismMetadata & autoInfo = MetadataProvider::GetAutomatismMetadata(codeGenerator.GetPlatform(), automatismType); const BehaviorMetadata & autoInfo = MetadataProvider::GetBehaviorMetadata(codeGenerator.GetPlatform(), behaviorType);
//Build gd::String to access the automatism //Build gd::String to access the behavior
codeGenerator.AddIncludeFiles(autoInfo.includeFiles); codeGenerator.AddIncludeFiles(autoInfo.includeFiles);
output = codeGenerator.GenerateObjectAutomatismFunctionCall(realObjects[i], parameters[1].GetPlainString(), autoInfo, expressionInfo.codeExtraInformation, parametersStr, output, context); output = codeGenerator.GenerateObjectBehaviorFunctionCall(realObjects[i], parameters[1].GetPlainString(), autoInfo, expressionInfo.codeExtraInformation, parametersStr, output, context);
} }

View File

@@ -44,7 +44,7 @@ public:
void OnConstantToken(gd::String text); void OnConstantToken(gd::String text);
void OnStaticFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo); void OnStaticFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo);
void OnObjectFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo); void OnObjectFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo);
void OnObjectAutomatismFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo); void OnObjectBehaviorFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo);
bool OnSubMathExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression); bool OnSubMathExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression);
bool OnSubTextExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression); bool OnSubTextExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression);

View File

@@ -78,7 +78,7 @@ void EventsListSerialization::UpdateInstructionsFromGD2x(gd::Project & project,
instr.SetParameter(1, instr.GetParameter(5)); instr.SetParameter(1, instr.GetParameter(5));
instr.SetParameter(2, instr.GetParameter(3)); instr.SetParameter(2, instr.GetParameter(3));
} }
else if (instr.GetType() == "PhysicsAutomatism::AddRevoluteJointBetweenObjects") else if (instr.GetType() == "PhysicsBehavior::AddRevoluteJointBetweenObjects")
{ {
instr.SetParameter(4, instr.GetParameter(5)); instr.SetParameter(4, instr.GetParameter(5));
instr.SetParameter(5, instr.GetParameter(6)); instr.SetParameter(5, instr.GetParameter(6));

View File

@@ -73,10 +73,10 @@ void LaunchResourceWorkerOnEvents(const gd::Project & project, gd::EventsList &
extensionHasAction = true; extensionHasAction = true;
} }
const vector < gd::String > & autos = allGameExtensions[e]->GetAutomatismsTypes(); const vector < gd::String > & autos = allGameExtensions[e]->GetBehaviorsTypes();
for (unsigned int a = 0;a<autos.size();++a) for (unsigned int a = 0;a<autos.size();++a)
{ {
const std::map<gd::String, gd::InstructionMetadata> & allAutosActions = allGameExtensions[e]->GetAllActionsForAutomatism(autos[a]); const std::map<gd::String, gd::InstructionMetadata> & allAutosActions = allGameExtensions[e]->GetAllActionsForBehavior(autos[a]);
if ( allAutosActions.find(type) != allAutosActions.end() ) if ( allAutosActions.find(type) != allAutosActions.end() )
extensionHasAction = true; extensionHasAction = true;
} }
@@ -113,10 +113,10 @@ void LaunchResourceWorkerOnEvents(const gd::Project & project, gd::EventsList &
extensionHasCondition = true; extensionHasCondition = true;
} }
const vector < gd::String > & autos = allGameExtensions[e]->GetAutomatismsTypes(); const vector < gd::String > & autos = allGameExtensions[e]->GetBehaviorsTypes();
for (unsigned int j = 0;j<autos.size();++j) for (unsigned int j = 0;j<autos.size();++j)
{ {
const std::map<gd::String, gd::InstructionMetadata> & allAutosConditions = allGameExtensions[e]->GetAllConditionsForAutomatism(autos[j]); const std::map<gd::String, gd::InstructionMetadata> & allAutosConditions = allGameExtensions[e]->GetAllConditionsForBehavior(autos[j]);
if ( allAutosConditions.find(type) != allAutosConditions.end() ) if ( allAutosConditions.find(type) != allAutosConditions.end() )
extensionHasCondition = true; extensionHasCondition = true;
} }

View File

@@ -23,7 +23,7 @@ CommonBitmapManager::CommonBitmapManager()
{ {
expressionBt.LoadFile("res/expressionicon.png", wxBITMAP_TYPE_ANY); expressionBt.LoadFile("res/expressionicon.png", wxBITMAP_TYPE_ANY);
objectBt = gd::SkinHelper::GetIcon("object", 16); objectBt = gd::SkinHelper::GetIcon("object", 16);
automatismBt.LoadFile("res/automatism16.png", wxBITMAP_TYPE_ANY); behaviorBt.LoadFile("res/behavior16.png", wxBITMAP_TYPE_ANY);
signeBt.LoadFile("res/signeicon.png", wxBITMAP_TYPE_ANY); signeBt.LoadFile("res/signeicon.png", wxBITMAP_TYPE_ANY);
fileBt.LoadFile("res/fileicon.png", wxBITMAP_TYPE_ANY); fileBt.LoadFile("res/fileicon.png", wxBITMAP_TYPE_ANY);
yesnoBt.LoadFile("res/yesnoicon.png", wxBITMAP_TYPE_ANY); yesnoBt.LoadFile("res/yesnoicon.png", wxBITMAP_TYPE_ANY);

View File

@@ -25,7 +25,7 @@ public:
wxBitmap expressionBt; wxBitmap expressionBt;
wxBitmap objectBt; wxBitmap objectBt;
wxBitmap automatismBt; wxBitmap behaviorBt;
wxBitmap signeBt; wxBitmap signeBt;
wxBitmap fileBt; wxBitmap fileBt;
wxBitmap yesnoBt; wxBitmap yesnoBt;

View File

@@ -5,9 +5,9 @@
*/ */
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
#include "ChooseAutomatismDialog.h" #include "ChooseBehaviorDialog.h"
//(*InternalHeaders(ChooseAutomatismDialog) //(*InternalHeaders(ChooseBehaviorDialog)
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/settings.h> #include <wx/settings.h>
#include "GDCore/Tools/Localization.h" #include "GDCore/Tools/Localization.h"
@@ -21,41 +21,41 @@
#include "GDCore/CommonTools.h" #include "GDCore/CommonTools.h"
#include "GDCore/PlatformDefinition/Project.h" #include "GDCore/PlatformDefinition/Project.h"
#include "GDCore/PlatformDefinition/Layout.h" #include "GDCore/PlatformDefinition/Layout.h"
#include "GDCore/Events/AutomatismMetadata.h" #include "GDCore/Events/BehaviorMetadata.h"
#include "GDCore/IDE/MetadataProvider.h" #include "GDCore/IDE/MetadataProvider.h"
namespace gd namespace gd
{ {
//(*IdInit(ChooseAutomatismDialog) //(*IdInit(ChooseBehaviorDialog)
const long ChooseAutomatismDialog::ID_STATICBITMAP3 = wxNewId(); const long ChooseBehaviorDialog::ID_STATICBITMAP3 = wxNewId();
const long ChooseAutomatismDialog::ID_STATICTEXT1 = wxNewId(); const long ChooseBehaviorDialog::ID_STATICTEXT1 = wxNewId();
const long ChooseAutomatismDialog::ID_PANEL1 = wxNewId(); const long ChooseBehaviorDialog::ID_PANEL1 = wxNewId();
const long ChooseAutomatismDialog::ID_STATICLINE2 = wxNewId(); const long ChooseBehaviorDialog::ID_STATICLINE2 = wxNewId();
const long ChooseAutomatismDialog::ID_LISTBOX1 = wxNewId(); const long ChooseBehaviorDialog::ID_LISTBOX1 = wxNewId();
const long ChooseAutomatismDialog::ID_TEXTCTRL1 = wxNewId(); const long ChooseBehaviorDialog::ID_TEXTCTRL1 = wxNewId();
const long ChooseAutomatismDialog::ID_BUTTON1 = wxNewId(); const long ChooseBehaviorDialog::ID_BUTTON1 = wxNewId();
const long ChooseAutomatismDialog::ID_BUTTON2 = wxNewId(); const long ChooseBehaviorDialog::ID_BUTTON2 = wxNewId();
//*) //*)
BEGIN_EVENT_TABLE(ChooseAutomatismDialog,wxDialog) BEGIN_EVENT_TABLE(ChooseBehaviorDialog,wxDialog)
//(*EventTable(ChooseAutomatismDialog) //(*EventTable(ChooseBehaviorDialog)
//*) //*)
END_EVENT_TABLE() END_EVENT_TABLE()
ChooseAutomatismDialog::ChooseAutomatismDialog(wxWindow* parent, Project & project_, gd::Layout & layout_, gd::String parentObject_, gd::String automatismTypeAllowed_) : ChooseBehaviorDialog::ChooseBehaviorDialog(wxWindow* parent, Project & project_, gd::Layout & layout_, gd::String parentObject_, gd::String behaviorTypeAllowed_) :
project(project_), project(project_),
layout(layout_), layout(layout_),
parentObject(parentObject_), parentObject(parentObject_),
automatismTypeAllowed(automatismTypeAllowed_) behaviorTypeAllowed(behaviorTypeAllowed_)
{ {
//(*Initialize(ChooseAutomatismDialog) //(*Initialize(ChooseBehaviorDialog)
wxFlexGridSizer* FlexGridSizer2; wxFlexGridSizer* FlexGridSizer2;
wxFlexGridSizer* FlexGridSizer6; wxFlexGridSizer* FlexGridSizer6;
wxFlexGridSizer* FlexGridSizer1; wxFlexGridSizer* FlexGridSizer1;
wxFlexGridSizer* FlexGridSizer17; wxFlexGridSizer* FlexGridSizer17;
Create(parent, wxID_ANY, _("Choose an automatism"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER, _T("wxID_ANY")); Create(parent, wxID_ANY, _("Choose an behavior"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER, _T("wxID_ANY"));
FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer1->AddGrowableCol(0); FlexGridSizer1->AddGrowableCol(0);
FlexGridSizer1->AddGrowableRow(1); FlexGridSizer1->AddGrowableRow(1);
@@ -64,9 +64,9 @@ automatismTypeAllowed(automatismTypeAllowed_)
Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1")); Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
Panel1->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); Panel1->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
FlexGridSizer6 = new wxFlexGridSizer(0, 3, 0, 0); FlexGridSizer6 = new wxFlexGridSizer(0, 3, 0, 0);
StaticBitmap3 = new wxStaticBitmap(Panel1, ID_STATICBITMAP3, wxBitmap(wxImage(_T("res/automatism64.png"))), wxDefaultPosition, wxDefaultSize, wxNO_BORDER, _T("ID_STATICBITMAP3")); StaticBitmap3 = new wxStaticBitmap(Panel1, ID_STATICBITMAP3, wxBitmap(wxImage(_T("res/behavior64.png"))), wxDefaultPosition, wxDefaultSize, wxNO_BORDER, _T("ID_STATICBITMAP3"));
FlexGridSizer6->Add(StaticBitmap3, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer6->Add(StaticBitmap3, 1, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
StaticText1 = new wxStaticText(Panel1, ID_STATICTEXT1, _("Choose an automatism of the object."), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE, _T("ID_STATICTEXT1")); StaticText1 = new wxStaticText(Panel1, ID_STATICTEXT1, _("Choose an behavior of the object."), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE, _T("ID_STATICTEXT1"));
FlexGridSizer6->Add(StaticText1, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer6->Add(StaticText1, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
Panel1->SetSizer(FlexGridSizer6); Panel1->SetSizer(FlexGridSizer6);
FlexGridSizer6->Fit(Panel1); FlexGridSizer6->Fit(Panel1);
@@ -75,8 +75,8 @@ automatismTypeAllowed(automatismTypeAllowed_)
StaticLine2 = new wxStaticLine(this, ID_STATICLINE2, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE2")); StaticLine2 = new wxStaticLine(this, ID_STATICLINE2, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE2"));
FlexGridSizer17->Add(StaticLine2, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); FlexGridSizer17->Add(StaticLine2, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
FlexGridSizer1->Add(FlexGridSizer17, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); FlexGridSizer1->Add(FlexGridSizer17, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
automatismsList = new wxListBox(this, ID_LISTBOX1, wxDefaultPosition, wxSize(255,128), 0, 0, 0, wxDefaultValidator, _T("ID_LISTBOX1")); behaviorsList = new wxListBox(this, ID_LISTBOX1, wxDefaultPosition, wxSize(255,128), 0, 0, 0, wxDefaultValidator, _T("ID_LISTBOX1"));
FlexGridSizer1->Add(automatismsList, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer1->Add(behaviorsList, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
searchCtrl = new wxSearchCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1")); searchCtrl = new wxSearchCtrl(this, ID_TEXTCTRL1, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
FlexGridSizer1->Add(searchCtrl, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer1->Add(searchCtrl, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer2 = new wxFlexGridSizer(0, 3, 0, 0); FlexGridSizer2 = new wxFlexGridSizer(0, 3, 0, 0);
@@ -89,10 +89,10 @@ automatismTypeAllowed(automatismTypeAllowed_)
FlexGridSizer1->Fit(this); FlexGridSizer1->Fit(this);
FlexGridSizer1->SetSizeHints(this); FlexGridSizer1->SetSizeHints(this);
Connect(ID_LISTBOX1,wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,(wxObjectEventFunction)&ChooseAutomatismDialog::OnChoisirBtClick); Connect(ID_LISTBOX1,wxEVT_COMMAND_LISTBOX_DOUBLECLICKED,(wxObjectEventFunction)&ChooseBehaviorDialog::OnChoisirBtClick);
Connect(ID_TEXTCTRL1,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&ChooseAutomatismDialog::OnsearchCtrlText); Connect(ID_TEXTCTRL1,wxEVT_COMMAND_TEXT_UPDATED,(wxObjectEventFunction)&ChooseBehaviorDialog::OnsearchCtrlText);
Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ChooseAutomatismDialog::OnChoisirBtClick); Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ChooseBehaviorDialog::OnChoisirBtClick);
Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ChooseAutomatismDialog::OnCancelBtClick); Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ChooseBehaviorDialog::OnCancelBtClick);
//*) //*)
searchCtrl->SetFocus(); searchCtrl->SetFocus();
@@ -100,30 +100,30 @@ automatismTypeAllowed(automatismTypeAllowed_)
RefreshList(); RefreshList();
} }
ChooseAutomatismDialog::~ChooseAutomatismDialog() ChooseBehaviorDialog::~ChooseBehaviorDialog()
{ {
//(*Destroy(ChooseAutomatismDialog) //(*Destroy(ChooseBehaviorDialog)
//*) //*)
} }
bool ChooseAutomatismDialog::DeduceAutomatism() bool ChooseBehaviorDialog::DeduceBehavior()
{ {
if (automatismsList->GetCount() == 1) if (behaviorsList->GetCount() == 1)
{ {
automatismChosen = automatismsList->GetString(0); behaviorChosen = behaviorsList->GetString(0);
return true; return true;
} }
else if (automatismsList->GetCount() == 0) else if (behaviorsList->GetCount() == 0)
{ {
const AutomatismMetadata & metadata = const BehaviorMetadata & metadata =
MetadataProvider::GetAutomatismMetadata(project.GetCurrentPlatform(), automatismTypeAllowed); MetadataProvider::GetBehaviorMetadata(project.GetCurrentPlatform(), behaviorTypeAllowed);
if (metadata.GetFullName().empty()) if (metadata.GetFullName().empty())
gd::LogMessage(_("This object doesn't have the appropriate automatism attached to it.\nCheck that you selected the right object or add the automatism in the object properties.")); gd::LogMessage(_("This object doesn't have the appropriate behavior attached to it.\nCheck that you selected the right object or add the behavior in the object properties."));
else else
{ {
gd::LogMessage( gd::LogMessage(
wxString::Format(wxString(_("This object doesn't have automatism \"%s\" attached to it.\nCheck that you selected the right object or add this automatism in the object properties.")), wxString::Format(wxString(_("This object doesn't have behavior \"%s\" attached to it.\nCheck that you selected the right object or add this behavior in the object properties.")),
metadata.GetFullName().c_str())); metadata.GetFullName().c_str()));
} }
@@ -133,39 +133,39 @@ bool ChooseAutomatismDialog::DeduceAutomatism()
return false; return false;
} }
void ChooseAutomatismDialog::RefreshList() void ChooseBehaviorDialog::RefreshList()
{ {
gd::String search = searchCtrl->GetValue(); gd::String search = searchCtrl->GetValue();
bool searching = search.empty() ? false : true; bool searching = search.empty() ? false : true;
std::vector <gd::String> automatisms = gd::GetAutomatismsOfObject(project, layout, parentObject); std::vector <gd::String> behaviors = gd::GetBehaviorsOfObject(project, layout, parentObject);
automatismsList->Clear(); behaviorsList->Clear();
for (unsigned int i = 0;i<automatisms.size();++i) for (unsigned int i = 0;i<behaviors.size();++i)
{ {
gd::String automatismName = automatisms[i]; gd::String behaviorName = behaviors[i];
if ( (automatismTypeAllowed.empty() || automatismTypeAllowed == gd::GetTypeOfAutomatism(project, layout, automatismName)) && if ( (behaviorTypeAllowed.empty() || behaviorTypeAllowed == gd::GetTypeOfBehavior(project, layout, behaviorName)) &&
(!searching || (searching && automatismName.CaseFold().find(search.CaseFold()) != gd::String::npos) )) (!searching || (searching && behaviorName.CaseFold().find(search.CaseFold()) != gd::String::npos) ))
automatismsList->Append(automatismName); behaviorsList->Append(behaviorName);
} }
if ( automatismsList->GetCount() == 1) if ( behaviorsList->GetCount() == 1)
automatismsList->SetSelection(0); behaviorsList->SetSelection(0);
} }
void ChooseAutomatismDialog::OnChoisirBtClick(wxCommandEvent& event) void ChooseBehaviorDialog::OnChoisirBtClick(wxCommandEvent& event)
{ {
automatismChosen = automatismsList->GetStringSelection(); behaviorChosen = behaviorsList->GetStringSelection();
EndModal(1); EndModal(1);
} }
void ChooseAutomatismDialog::OnCancelBtClick(wxCommandEvent& event) void ChooseBehaviorDialog::OnCancelBtClick(wxCommandEvent& event)
{ {
EndModal(0); EndModal(0);
} }
void ChooseAutomatismDialog::OnsearchCtrlText(wxCommandEvent& event) void ChooseBehaviorDialog::OnsearchCtrlText(wxCommandEvent& event)
{ {
RefreshList(); RefreshList();
} }

View File

@@ -5,10 +5,10 @@
*/ */
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
#ifndef ChooseAutomatismDialog_H #ifndef ChooseBehaviorDialog_H
#define ChooseAutomatismDialog_H #define ChooseBehaviorDialog_H
//(*Headers(ChooseAutomatismDialog) //(*Headers(ChooseBehaviorDialog)
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
@@ -28,11 +28,11 @@ namespace gd
{ {
/** /**
* \brief Dialog used to choose an automatism of an object. * \brief Dialog used to choose an behavior of an object.
* *
* \ingroup IDEDialogs * \ingroup IDEDialogs
*/ */
class GD_CORE_API ChooseAutomatismDialog: public wxDialog class GD_CORE_API ChooseBehaviorDialog: public wxDialog
{ {
public: public:
@@ -42,38 +42,38 @@ public:
* \param parent The wxWidgets parent window * \param parent The wxWidgets parent window
* \param project Project * \param project Project
* \param layout Layout * \param layout Layout
* \param parentObject The object from which an automatism must be chosen * \param parentObject The object from which an behavior must be chosen
* \param automatismTypeAllowed If not empty, only automatisms of this type will be shown * \param behaviorTypeAllowed If not empty, only behaviors of this type will be shown
*/ */
ChooseAutomatismDialog(wxWindow* parent, Project & project, gd::Layout & layout, gd::String parentObject_, gd::String automatismTypeAllowed_); ChooseBehaviorDialog(wxWindow* parent, Project & project, gd::Layout & layout, gd::String parentObject_, gd::String behaviorTypeAllowed_);
virtual ~ChooseAutomatismDialog(); virtual ~ChooseBehaviorDialog();
/** /**
* \brief Automatically choose the automatism if there is only * \brief Automatically choose the behavior if there is only
* a single automatism to be chosen. * a single behavior to be chosen.
* \return true if an automatism (or none) was chosen. false if there are two automatisms or more. * \return true if an behavior (or none) was chosen. false if there are two behaviors or more.
*/ */
bool DeduceAutomatism(); bool DeduceBehavior();
/** /**
* \brief Return the chosen automatism name * \brief Return the chosen behavior name
*/ */
const gd::String & GetChosenAutomatism() const { return automatismChosen; } const gd::String & GetChosenBehavior() const { return behaviorChosen; }
protected: protected:
//(*Declarations(ChooseAutomatismDialog) //(*Declarations(ChooseBehaviorDialog)
wxSearchCtrl* searchCtrl; wxSearchCtrl* searchCtrl;
wxButton* ChoisirBt; wxButton* ChoisirBt;
wxPanel* Panel1; wxPanel* Panel1;
wxStaticText* StaticText1; wxStaticText* StaticText1;
wxStaticLine* StaticLine2; wxStaticLine* StaticLine2;
wxButton* AnnulerBt; wxButton* AnnulerBt;
wxListBox* automatismsList; wxListBox* behaviorsList;
wxStaticBitmap* StaticBitmap3; wxStaticBitmap* StaticBitmap3;
//*) //*)
//(*Identifiers(ChooseAutomatismDialog) //(*Identifiers(ChooseBehaviorDialog)
static const long ID_STATICBITMAP3; static const long ID_STATICBITMAP3;
static const long ID_STATICTEXT1; static const long ID_STATICTEXT1;
static const long ID_PANEL1; static const long ID_PANEL1;
@@ -86,7 +86,7 @@ protected:
private: private:
//(*Handlers(ChooseAutomatismDialog) //(*Handlers(ChooseBehaviorDialog)
void OnChoisirBtClick(wxCommandEvent& event); void OnChoisirBtClick(wxCommandEvent& event);
void OnCancelBtClick(wxCommandEvent& event); void OnCancelBtClick(wxCommandEvent& event);
void OnsearchCtrlText(wxCommandEvent& event); void OnsearchCtrlText(wxCommandEvent& event);
@@ -97,8 +97,8 @@ private:
Project & project; Project & project;
gd::Layout & layout; gd::Layout & layout;
gd::String parentObject; gd::String parentObject;
gd::String automatismTypeAllowed; gd::String behaviorTypeAllowed;
gd::String automatismChosen; gd::String behaviorChosen;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -5,7 +5,7 @@
*/ */
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
//(*InternalHeaders(ChooseAutomatismTypeDialog) //(*InternalHeaders(ChooseBehaviorTypeDialog)
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include "GDCore/Tools/Localization.h" #include "GDCore/Tools/Localization.h"
#include <wx/image.h> #include <wx/image.h>
@@ -23,9 +23,9 @@
#include "GDCore/PlatformDefinition/Platform.h" #include "GDCore/PlatformDefinition/Platform.h"
#include "GDCore/PlatformDefinition/Object.h" #include "GDCore/PlatformDefinition/Object.h"
#include "GDCore/PlatformDefinition/Layout.h" #include "GDCore/PlatformDefinition/Layout.h"
#include "GDCore/PlatformDefinition/Automatism.h" #include "GDCore/PlatformDefinition/Behavior.h"
#include "GDCore/IDE/wxTools/TreeItemStringData.h" #include "GDCore/IDE/wxTools/TreeItemStringData.h"
#include "GDCore/IDE/Dialogs/ChooseAutomatismTypeDialog.h" #include "GDCore/IDE/Dialogs/ChooseBehaviorTypeDialog.h"
#include "GDCore/Tools/HelpFileAccess.h" #include "GDCore/Tools/HelpFileAccess.h"
#include "GDCore/CommonTools.h" #include "GDCore/CommonTools.h"
@@ -38,40 +38,40 @@ using namespace std;
namespace gd namespace gd
{ {
//(*IdInit(ChooseAutomatismTypeDialog) //(*IdInit(ChooseBehaviorTypeDialog)
const long ChooseAutomatismTypeDialog::ID_STATICTEXT1 = wxNewId(); const long ChooseBehaviorTypeDialog::ID_STATICTEXT1 = wxNewId();
const long ChooseAutomatismTypeDialog::ID_LISTCTRL1 = wxNewId(); const long ChooseBehaviorTypeDialog::ID_LISTCTRL1 = wxNewId();
const long ChooseAutomatismTypeDialog::ID_STATICTEXT2 = wxNewId(); const long ChooseBehaviorTypeDialog::ID_STATICTEXT2 = wxNewId();
const long ChooseAutomatismTypeDialog::ID_STATICLINE2 = wxNewId(); const long ChooseBehaviorTypeDialog::ID_STATICLINE2 = wxNewId();
const long ChooseAutomatismTypeDialog::ID_CHOICE1 = wxNewId(); const long ChooseBehaviorTypeDialog::ID_CHOICE1 = wxNewId();
const long ChooseAutomatismTypeDialog::ID_STATICBITMAP5 = wxNewId(); const long ChooseBehaviorTypeDialog::ID_STATICBITMAP5 = wxNewId();
const long ChooseAutomatismTypeDialog::ID_HYPERLINKCTRL2 = wxNewId(); const long ChooseBehaviorTypeDialog::ID_HYPERLINKCTRL2 = wxNewId();
const long ChooseAutomatismTypeDialog::ID_BUTTON1 = wxNewId(); const long ChooseBehaviorTypeDialog::ID_BUTTON1 = wxNewId();
const long ChooseAutomatismTypeDialog::ID_BUTTON2 = wxNewId(); const long ChooseBehaviorTypeDialog::ID_BUTTON2 = wxNewId();
//*) //*)
BEGIN_EVENT_TABLE(ChooseAutomatismTypeDialog,wxDialog) BEGIN_EVENT_TABLE(ChooseBehaviorTypeDialog,wxDialog)
//(*EventTable(ChooseAutomatismTypeDialog) //(*EventTable(ChooseBehaviorTypeDialog)
//*) //*)
END_EVENT_TABLE() END_EVENT_TABLE()
ChooseAutomatismTypeDialog::ChooseAutomatismTypeDialog(wxWindow* parent, gd::Project & project_) : ChooseBehaviorTypeDialog::ChooseBehaviorTypeDialog(wxWindow* parent, gd::Project & project_) :
project(project_) project(project_)
{ {
//(*Initialize(ChooseAutomatismTypeDialog) //(*Initialize(ChooseBehaviorTypeDialog)
wxFlexGridSizer* FlexGridSizer2; wxFlexGridSizer* FlexGridSizer2;
wxFlexGridSizer* FlexGridSizer1; wxFlexGridSizer* FlexGridSizer1;
wxFlexGridSizer* FlexGridSizer17; wxFlexGridSizer* FlexGridSizer17;
Create(parent, wxID_ANY, _("Choose an automatism"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER, _T("wxID_ANY")); Create(parent, wxID_ANY, _("Choose an behavior"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER, _T("wxID_ANY"));
FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer1->AddGrowableCol(0); FlexGridSizer1->AddGrowableCol(0);
FlexGridSizer1->AddGrowableRow(1); FlexGridSizer1->AddGrowableRow(1);
StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Automatisms can be used to add a specific behaviour\nto an object. Choose the automatism to add:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1")); StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Behaviors can be used to add a specific behaviour\nto an object. Choose the behavior to add:"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
FlexGridSizer1->Add(StaticText1, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer1->Add(StaticText1, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
automatismsList = new wxListCtrl(this, ID_LISTCTRL1, wxDefaultPosition, wxSize(277,175), wxLC_REPORT|wxLC_NO_HEADER|wxLC_SINGLE_SEL, wxDefaultValidator, _T("ID_LISTCTRL1")); behaviorsList = new wxListCtrl(this, ID_LISTCTRL1, wxDefaultPosition, wxSize(277,175), wxLC_REPORT|wxLC_NO_HEADER|wxLC_SINGLE_SEL, wxDefaultValidator, _T("ID_LISTCTRL1"));
FlexGridSizer1->Add(automatismsList, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer1->Add(behaviorsList, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("You can also use the grayed automatisms:\nTheir associated extension will be automatically enabled."), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2")); StaticText2 = new wxStaticText(this, ID_STATICTEXT2, _("You can also use the grayed behaviors:\nTheir associated extension will be automatically enabled."), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT2"));
FlexGridSizer1->Add(StaticText2, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer1->Add(StaticText2, 1, wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL, 5);
StaticLine2 = new wxStaticLine(this, ID_STATICLINE2, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE2")); StaticLine2 = new wxStaticLine(this, ID_STATICLINE2, wxDefaultPosition, wxSize(10,-1), wxLI_HORIZONTAL, _T("ID_STATICLINE2"));
FlexGridSizer1->Add(StaticLine2, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); FlexGridSizer1->Add(StaticLine2, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
@@ -97,18 +97,18 @@ project(project_)
FlexGridSizer1->Fit(this); FlexGridSizer1->Fit(this);
FlexGridSizer1->SetSizeHints(this); FlexGridSizer1->SetSizeHints(this);
Connect(ID_LISTCTRL1,wxEVT_COMMAND_LIST_ITEM_SELECTED,(wxObjectEventFunction)&ChooseAutomatismTypeDialog::OnautomatismsListItemSelect); Connect(ID_LISTCTRL1,wxEVT_COMMAND_LIST_ITEM_SELECTED,(wxObjectEventFunction)&ChooseBehaviorTypeDialog::OnbehaviorsListItemSelect);
Connect(ID_LISTCTRL1,wxEVT_COMMAND_LIST_ITEM_ACTIVATED,(wxObjectEventFunction)&ChooseAutomatismTypeDialog::OnautomatismsListItemActivated); Connect(ID_LISTCTRL1,wxEVT_COMMAND_LIST_ITEM_ACTIVATED,(wxObjectEventFunction)&ChooseBehaviorTypeDialog::OnbehaviorsListItemActivated);
Connect(ID_CHOICE1,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&ChooseAutomatismTypeDialog::OnplatformChoiceSelect); Connect(ID_CHOICE1,wxEVT_COMMAND_CHOICE_SELECTED,(wxObjectEventFunction)&ChooseBehaviorTypeDialog::OnplatformChoiceSelect);
Connect(ID_HYPERLINKCTRL2,wxEVT_COMMAND_HYPERLINK,(wxObjectEventFunction)&ChooseAutomatismTypeDialog::OnhelpBtClick); Connect(ID_HYPERLINKCTRL2,wxEVT_COMMAND_HYPERLINK,(wxObjectEventFunction)&ChooseBehaviorTypeDialog::OnhelpBtClick);
Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ChooseAutomatismTypeDialog::OnokBtClick); Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ChooseBehaviorTypeDialog::OnokBtClick);
Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ChooseAutomatismTypeDialog::OncancelBtClick); Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&ChooseBehaviorTypeDialog::OncancelBtClick);
Connect(wxEVT_SIZE,(wxObjectEventFunction)&ChooseAutomatismTypeDialog::OnResize); Connect(wxEVT_SIZE,(wxObjectEventFunction)&ChooseBehaviorTypeDialog::OnResize);
//*) //*)
#if defined(__WXMSW__) //Offer nice look to list #if defined(__WXMSW__) //Offer nice look to list
wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive(); wxUxThemeEngine* theme = wxUxThemeEngine::GetIfActive();
if(theme) theme->SetWindowTheme((HWND) automatismsList->GetHWND(), L"EXPLORER", NULL); if(theme) theme->SetWindowTheme((HWND) behaviorsList->GetHWND(), L"EXPLORER", NULL);
#endif #endif
for (unsigned int i = 0;i<project.GetUsedPlatforms().size();++i) for (unsigned int i = 0;i<project.GetUsedPlatforms().size();++i)
@@ -119,18 +119,18 @@ project(project_)
if ( project.GetUsedPlatforms().size() != 1 ) platformChoice->Show(); if ( project.GetUsedPlatforms().size() != 1 ) platformChoice->Show();
automatismsList->InsertColumn(0,_("Automatism"), wxLIST_FORMAT_LEFT, 320); behaviorsList->InsertColumn(0,_("Behavior"), wxLIST_FORMAT_LEFT, 320);
automatismsList->InsertColumn(1,_("Description"), wxLIST_FORMAT_LEFT, 320); behaviorsList->InsertColumn(1,_("Description"), wxLIST_FORMAT_LEFT, 320);
RefreshList(); RefreshList();
int x; int x;
int y; int y;
int width; int width;
int height; int height;
wxConfigBase::Get()->Read("ChooseAutomatismTypeDialog/x", &x, wxDefaultCoord); wxConfigBase::Get()->Read("ChooseBehaviorTypeDialog/x", &x, wxDefaultCoord);
wxConfigBase::Get()->Read("ChooseAutomatismTypeDialog/y", &y, wxDefaultCoord); wxConfigBase::Get()->Read("ChooseBehaviorTypeDialog/y", &y, wxDefaultCoord);
wxConfigBase::Get()->Read("ChooseAutomatismTypeDialog/Width", &width, wxDefaultCoord); wxConfigBase::Get()->Read("ChooseBehaviorTypeDialog/Width", &width, wxDefaultCoord);
wxConfigBase::Get()->Read("ChooseAutomatismTypeDialog/Height", &height, wxDefaultCoord); wxConfigBase::Get()->Read("ChooseBehaviorTypeDialog/Height", &height, wxDefaultCoord);
if ( x <= wxSystemSettings::GetMetric(wxSYS_SCREEN_X) && y <= wxSystemSettings::GetMetric(wxSYS_SCREEN_Y) ) if ( x <= wxSystemSettings::GetMetric(wxSYS_SCREEN_X) && y <= wxSystemSettings::GetMetric(wxSYS_SCREEN_Y) )
SetSize(x,y,width, height); SetSize(x,y,width, height);
@@ -140,23 +140,23 @@ project(project_)
UpdateListColumnsWidth(); UpdateListColumnsWidth();
} }
ChooseAutomatismTypeDialog::~ChooseAutomatismTypeDialog() ChooseBehaviorTypeDialog::~ChooseBehaviorTypeDialog()
{ {
//(*Destroy(ChooseAutomatismTypeDialog) //(*Destroy(ChooseBehaviorTypeDialog)
//*) //*)
wxConfigBase::Get()->Write("ChooseAutomatismTypeDialog/x", GetPosition().x); wxConfigBase::Get()->Write("ChooseBehaviorTypeDialog/x", GetPosition().x);
wxConfigBase::Get()->Write("ChooseAutomatismTypeDialog/y", GetPosition().y); wxConfigBase::Get()->Write("ChooseBehaviorTypeDialog/y", GetPosition().y);
wxConfigBase::Get()->Write("ChooseAutomatismTypeDialog/Width", GetSize().GetWidth()); wxConfigBase::Get()->Write("ChooseBehaviorTypeDialog/Width", GetSize().GetWidth());
wxConfigBase::Get()->Write("ChooseAutomatismTypeDialog/Height", GetSize().GetHeight()); wxConfigBase::Get()->Write("ChooseBehaviorTypeDialog/Height", GetSize().GetHeight());
} }
void ChooseAutomatismTypeDialog::RefreshList() void ChooseBehaviorTypeDialog::RefreshList()
{ {
automatismsList->DeleteAllItems(); behaviorsList->DeleteAllItems();
wxImageList * imageList = new wxImageList(32,32); wxImageList * imageList = new wxImageList(32,32);
imageList->Add(wxBitmap(wxImage(_T("res/unknown32.png")))); imageList->Add(wxBitmap(wxImage(_T("res/unknown32.png"))));
automatismsList->AssignImageList(imageList, wxIMAGE_LIST_SMALL); behaviorsList->AssignImageList(imageList, wxIMAGE_LIST_SMALL);
//Insert extension objects //Insert extension objects
const vector < std::shared_ptr<PlatformExtension> > extensions = project.GetCurrentPlatform().GetAllPlatformExtensions(); const vector < std::shared_ptr<PlatformExtension> > extensions = project.GetCurrentPlatform().GetAllPlatformExtensions();
@@ -169,53 +169,53 @@ void ChooseAutomatismTypeDialog::RefreshList()
project.GetUsedExtensions().end(), project.GetUsedExtensions().end(),
extensions[i]->GetName()) != project.GetUsedExtensions().end(); extensions[i]->GetName()) != project.GetUsedExtensions().end();
std::vector<gd::String> automatismsTypes = extensions[i]->GetAutomatismsTypes(); std::vector<gd::String> behaviorsTypes = extensions[i]->GetBehaviorsTypes();
for(unsigned int j = 0;j<automatismsTypes.size();++j) for(unsigned int j = 0;j<behaviorsTypes.size();++j)
{ {
if ( !automatismsTypes[j].empty() ) if ( !behaviorsTypes[j].empty() )
{ {
//Generate the icon //Generate the icon
wxBitmap objectIcon = extensions[i]->GetAutomatismMetadata(automatismsTypes[j]).GetBitmapIcon().IsOk() ? wxBitmap objectIcon = extensions[i]->GetBehaviorMetadata(behaviorsTypes[j]).GetBitmapIcon().IsOk() ?
extensions[i]->GetAutomatismMetadata(automatismsTypes[j]).GetBitmapIcon() : extensions[i]->GetBehaviorMetadata(behaviorsTypes[j]).GetBitmapIcon() :
wxBitmap(wxImage(_T("res/unknown32.png"))); wxBitmap(wxImage(_T("res/unknown32.png")));
imageList->Add(extensionEnabled ? objectIcon : objectIcon.ConvertToImage().ConvertToGreyscale().ConvertToDisabled(255)); imageList->Add(extensionEnabled ? objectIcon : objectIcon.ConvertToImage().ConvertToGreyscale().ConvertToDisabled(255));
//And add the object to the list //And add the object to the list
long index = extensionEnabled ? 0 : automatismsList->GetItemCount(); long index = extensionEnabled ? 0 : behaviorsList->GetItemCount();
gd::TreeItemStringData * associatedData = new gd::TreeItemStringData(automatismsTypes[j]); gd::TreeItemStringData * associatedData = new gd::TreeItemStringData(behaviorsTypes[j]);
automatismsList->InsertItem(index, extensions[i]->GetAutomatismMetadata(automatismsTypes[j]).GetFullName()); behaviorsList->InsertItem(index, extensions[i]->GetBehaviorMetadata(behaviorsTypes[j]).GetFullName());
automatismsList->SetItem(index, 1, extensions[i]->GetAutomatismMetadata(automatismsTypes[j]).GetDescription()); behaviorsList->SetItem(index, 1, extensions[i]->GetBehaviorMetadata(behaviorsTypes[j]).GetDescription());
automatismsList->SetItemImage(index ,imageList->GetImageCount()-1); behaviorsList->SetItemImage(index ,imageList->GetImageCount()-1);
automatismsList->SetItemData(index, wxPtrToUInt(associatedData)); behaviorsList->SetItemData(index, wxPtrToUInt(associatedData));
if ( !extensionEnabled ) automatismsList->SetItemTextColour(index, wxColor(128,128,128)); if ( !extensionEnabled ) behaviorsList->SetItemTextColour(index, wxColor(128,128,128));
} }
} }
} }
} }
void ChooseAutomatismTypeDialog::OnautomatismsListItemSelect(wxListEvent& event) void ChooseBehaviorTypeDialog::OnbehaviorsListItemSelect(wxListEvent& event)
{ {
//Get the automatism type associated with the item //Get the behavior type associated with the item
wxListItem item = event.GetItem(); wxListItem item = event.GetItem();
gd::TreeItemStringData * associatedData = reinterpret_cast<gd::TreeItemStringData*>(item.GetData()); //Why GetData return long ? gd::TreeItemStringData * associatedData = reinterpret_cast<gd::TreeItemStringData*>(item.GetData()); //Why GetData return long ?
if ( associatedData != NULL ) if ( associatedData != NULL )
{ {
selectedAutomatismType = associatedData->GetString(); selectedBehaviorType = associatedData->GetString();
} }
} }
void ChooseAutomatismTypeDialog::OnautomatismsListItemActivated(wxListEvent& event) void ChooseBehaviorTypeDialog::OnbehaviorsListItemActivated(wxListEvent& event)
{ {
OnautomatismsListItemSelect(event); OnbehaviorsListItemSelect(event);
wxCommandEvent useless; wxCommandEvent useless;
OnokBtClick(useless); OnokBtClick(useless);
} }
void ChooseAutomatismTypeDialog::OnokBtClick(wxCommandEvent& event) void ChooseBehaviorTypeDialog::OnokBtClick(wxCommandEvent& event)
{ {
if (selectedAutomatismType.empty()) return; if (selectedBehaviorType.empty()) return;
//We need to find the extension the selected object type belongs to so as to activate it if necessary //We need to find the extension the selected object type belongs to so as to activate it if necessary
const vector < std::shared_ptr<PlatformExtension> > extensions = project.GetCurrentPlatform().GetAllPlatformExtensions(); const vector < std::shared_ptr<PlatformExtension> > extensions = project.GetCurrentPlatform().GetAllPlatformExtensions();
@@ -223,8 +223,8 @@ void ChooseAutomatismTypeDialog::OnokBtClick(wxCommandEvent& event)
for (unsigned int i = 0;i<extensions.size();++i) for (unsigned int i = 0;i<extensions.size();++i)
{ {
std::vector<gd::String> automatismsTypes = extensions[i]->GetAutomatismsTypes(); std::vector<gd::String> behaviorsTypes = extensions[i]->GetBehaviorsTypes();
if ( find(automatismsTypes.begin(), automatismsTypes.end(), selectedAutomatismType) != automatismsTypes.end() ) if ( find(behaviorsTypes.begin(), behaviorsTypes.end(), selectedBehaviorType) != behaviorsTypes.end() )
{ {
extension = extensions[i]; break; extension = extensions[i]; break;
} }
@@ -253,32 +253,32 @@ void ChooseAutomatismTypeDialog::OnokBtClick(wxCommandEvent& event)
EndModal(1); EndModal(1);
} }
void ChooseAutomatismTypeDialog::OncancelBtClick(wxCommandEvent& event) void ChooseBehaviorTypeDialog::OncancelBtClick(wxCommandEvent& event)
{ {
selectedAutomatismType = ""; selectedBehaviorType = "";
EndModal(0); EndModal(0);
} }
void ChooseAutomatismTypeDialog::UpdateListColumnsWidth() void ChooseBehaviorTypeDialog::UpdateListColumnsWidth()
{ {
automatismsList->SetColumnWidth(0, automatismsList->GetSize().GetWidth()*2.0/5.0-5); behaviorsList->SetColumnWidth(0, behaviorsList->GetSize().GetWidth()*2.0/5.0-5);
automatismsList->SetColumnWidth(1, automatismsList->GetSize().GetWidth()*3.0/5.0-5); behaviorsList->SetColumnWidth(1, behaviorsList->GetSize().GetWidth()*3.0/5.0-5);
} }
void ChooseAutomatismTypeDialog::OnResize(wxSizeEvent& event) void ChooseBehaviorTypeDialog::OnResize(wxSizeEvent& event)
{ {
UpdateListColumnsWidth(); UpdateListColumnsWidth();
automatismsList->Refresh(); behaviorsList->Refresh();
automatismsList->Update(); behaviorsList->Update();
event.Skip(); event.Skip();
} }
void ChooseAutomatismTypeDialog::OnhelpBtClick(wxCommandEvent& event) void ChooseBehaviorTypeDialog::OnhelpBtClick(wxCommandEvent& event)
{ {
gd::HelpFileAccess::Get()->OpenURL(_("http://wiki.compilgames.net/doku.php/game_develop/documentation/manual/edit_object")); //TODO: Automatism help page gd::HelpFileAccess::Get()->OpenURL(_("http://wiki.compilgames.net/doku.php/game_develop/documentation/manual/edit_object")); //TODO: Behavior help page
} }
void ChooseAutomatismTypeDialog::OnplatformChoiceSelect(wxCommandEvent& event) void ChooseBehaviorTypeDialog::OnplatformChoiceSelect(wxCommandEvent& event)
{ {
if ( event.GetInt() >= project.GetUsedPlatforms().size() ) return; if ( event.GetInt() >= project.GetUsedPlatforms().size() ) return;
@@ -286,40 +286,40 @@ void ChooseAutomatismTypeDialog::OnplatformChoiceSelect(wxCommandEvent& event)
RefreshList(); RefreshList();
} }
bool ChooseAutomatismTypeDialog::ChooseAndAddAutomatismToObject(wxWindow * parent, gd::Project & project, gd::Object * object, gd::Layout * layout, bool isGlobalObject) bool ChooseBehaviorTypeDialog::ChooseAndAddBehaviorToObject(wxWindow * parent, gd::Project & project, gd::Object * object, gd::Layout * layout, bool isGlobalObject)
{ {
gd::ChooseAutomatismTypeDialog dialog(parent, project); gd::ChooseBehaviorTypeDialog dialog(parent, project);
if ( dialog.ShowModal() == 1) if ( dialog.ShowModal() == 1)
{ {
//Find automatism metadata //Find behavior metadata
std::shared_ptr<gd::PlatformExtension> extension = std::shared_ptr<gd::PlatformExtension> (); std::shared_ptr<gd::PlatformExtension> extension = std::shared_ptr<gd::PlatformExtension> ();
std::vector < std::shared_ptr<gd::PlatformExtension> > extensions = project.GetCurrentPlatform().GetAllPlatformExtensions(); std::vector < std::shared_ptr<gd::PlatformExtension> > extensions = project.GetCurrentPlatform().GetAllPlatformExtensions();
for (unsigned int i = 0;i<extensions.size();++i) for (unsigned int i = 0;i<extensions.size();++i)
{ {
std::vector<gd::String> automatismsTypes = extensions[i]->GetAutomatismsTypes(); std::vector<gd::String> behaviorsTypes = extensions[i]->GetBehaviorsTypes();
if ( find(automatismsTypes.begin(), automatismsTypes.end(), dialog.GetSelectedAutomatismType()) != automatismsTypes.end() ) if ( find(behaviorsTypes.begin(), behaviorsTypes.end(), dialog.GetSelectedBehaviorType()) != behaviorsTypes.end() )
extension = extensions[i]; extension = extensions[i];
} }
gd::AutomatismMetadata metadata = extension->GetAutomatismMetadata(dialog.GetSelectedAutomatismType()); gd::BehaviorMetadata metadata = extension->GetBehaviorMetadata(dialog.GetSelectedBehaviorType());
//Add automatism to object //Add behavior to object
gd::String autoName = metadata.GetDefaultName(); gd::String autoName = metadata.GetDefaultName();
for (unsigned int j = 2;object->HasAutomatismNamed(autoName);++j) for (unsigned int j = 2;object->HasBehaviorNamed(autoName);++j)
autoName = metadata.GetDefaultName()+gd::String::From(j); autoName = metadata.GetDefaultName()+gd::String::From(j);
object->AddNewAutomatism(project, dialog.GetSelectedAutomatismType(), autoName); object->AddNewBehavior(project, dialog.GetSelectedBehaviorType(), autoName);
//Let the scene know about the new automatism //Let the scene know about the new behavior
if ( isGlobalObject && layout ) if ( isGlobalObject && layout )
layout->UpdateAutomatismsSharedData(project); layout->UpdateBehaviorsSharedData(project);
else //Scene pointer is NULL: Update shared data of all layouts else //Scene pointer is NULL: Update shared data of all layouts
{ {
for (unsigned int i = 0;i<project.GetLayoutsCount();++i) for (unsigned int i = 0;i<project.GetLayoutsCount();++i)
project.GetLayout(i).UpdateAutomatismsSharedData(project); project.GetLayout(i).UpdateBehaviorsSharedData(project);
} }
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j) for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnAutomatismAdded(project, isGlobalObject ? NULL : layout, *object, object->GetAutomatism(autoName)); project.GetUsedPlatforms()[j]->GetChangesNotifier().OnBehaviorAdded(project, isGlobalObject ? NULL : layout, *object, object->GetBehavior(autoName));
return true; return true;
} }

View File

@@ -5,10 +5,10 @@
*/ */
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
#ifndef GDCORE_AUTOMATISMTYPECHOICE_H #ifndef GDCORE_BEHAVIORTYPECHOICE_H
#define GDCORE_AUTOMATISMTYPECHOICE_H #define GDCORE_BEHAVIORTYPECHOICE_H
//(*Headers(ChooseAutomatismTypeDialog) //(*Headers(ChooseBehaviorTypeDialog)
#include <wx/listctrl.h> #include <wx/listctrl.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/stattext.h> #include <wx/stattext.h>
@@ -24,10 +24,10 @@ namespace gd { class Project; }
namespace gd { namespace gd {
/** /**
* \brief Dialog displaying all the automatisms types available in a project, allowing the user to choose one. * \brief Dialog displaying all the behaviors types available in a project, allowing the user to choose one.
* \ingroup IDEDialogs * \ingroup IDEDialogs
*/ */
class GD_CORE_API ChooseAutomatismTypeDialog: public wxDialog class GD_CORE_API ChooseBehaviorTypeDialog: public wxDialog
{ {
public: public:
@@ -35,37 +35,37 @@ public:
* \brief Default constructor * \brief Default constructor
* *
* \param parent The parent wxWindow * \param parent The parent wxWindow
* \param project The project in which the automatism type must be selected * \param project The project in which the behavior type must be selected
*/ */
ChooseAutomatismTypeDialog(wxWindow* parent, gd::Project & project); ChooseBehaviorTypeDialog(wxWindow* parent, gd::Project & project);
virtual ~ChooseAutomatismTypeDialog(); virtual ~ChooseBehaviorTypeDialog();
/** /**
* \brief Returns the selected automatism type. * \brief Returns the selected behavior type.
*/ */
const gd::String & GetSelectedAutomatismType() const { return selectedAutomatismType; } const gd::String & GetSelectedBehaviorType() const { return selectedBehaviorType; }
/** /**
* \brief Display the dialog and add the selected automatism to the object. * \brief Display the dialog and add the selected behavior to the object.
*/ */
static bool ChooseAndAddAutomatismToObject(wxWindow * parent, gd::Project & project, gd::Object * object, static bool ChooseAndAddBehaviorToObject(wxWindow * parent, gd::Project & project, gd::Object * object,
gd::Layout * layout, bool isGlobalObject); gd::Layout * layout, bool isGlobalObject);
private: private:
//(*Declarations(ChooseAutomatismTypeDialog) //(*Declarations(ChooseBehaviorTypeDialog)
wxStaticBitmap* StaticBitmap2; wxStaticBitmap* StaticBitmap2;
wxChoice* platformChoice; wxChoice* platformChoice;
wxStaticText* StaticText2; wxStaticText* StaticText2;
wxStaticText* StaticText1; wxStaticText* StaticText1;
wxButton* cancelBt; wxButton* cancelBt;
wxStaticLine* StaticLine2; wxStaticLine* StaticLine2;
wxListCtrl* automatismsList; wxListCtrl* behaviorsList;
wxHyperlinkCtrl* helpBt; wxHyperlinkCtrl* helpBt;
wxButton* okBt; wxButton* okBt;
//*) //*)
//(*Identifiers(ChooseAutomatismTypeDialog) //(*Identifiers(ChooseBehaviorTypeDialog)
static const long ID_STATICTEXT1; static const long ID_STATICTEXT1;
static const long ID_LISTCTRL1; static const long ID_LISTCTRL1;
static const long ID_STATICTEXT2; static const long ID_STATICTEXT2;
@@ -77,12 +77,12 @@ private:
static const long ID_BUTTON2; static const long ID_BUTTON2;
//*) //*)
//(*Handlers(ChooseAutomatismTypeDialog) //(*Handlers(ChooseBehaviorTypeDialog)
void OnautomatismsListItemActivated(wxListEvent& event); void OnbehaviorsListItemActivated(wxListEvent& event);
void OnautomatismsListItemSelect(wxListEvent& event); void OnbehaviorsListItemSelect(wxListEvent& event);
void OnokBtClick(wxCommandEvent& event); void OnokBtClick(wxCommandEvent& event);
void OncancelBtClick(wxCommandEvent& event); void OncancelBtClick(wxCommandEvent& event);
void OnmoreAutomatismsBtClick(wxCommandEvent& event); void OnmoreBehaviorsBtClick(wxCommandEvent& event);
void OnResize(wxSizeEvent& event); void OnResize(wxSizeEvent& event);
void OnhelpBtClick(wxCommandEvent& event); void OnhelpBtClick(wxCommandEvent& event);
void OnplatformChoiceSelect(wxCommandEvent& event); void OnplatformChoiceSelect(wxCommandEvent& event);
@@ -91,7 +91,7 @@ private:
void RefreshList(); void RefreshList();
gd::Project & project; gd::Project & project;
gd::String selectedAutomatismType; gd::String selectedBehaviorType;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@@ -33,7 +33,7 @@
#include "GDCore/IDE/Dialogs/ChooseObjectDialog.h" #include "GDCore/IDE/Dialogs/ChooseObjectDialog.h"
#include "GDCore/IDE/Dialogs/ChooseLayerDialog.h" #include "GDCore/IDE/Dialogs/ChooseLayerDialog.h"
#include "GDCore/IDE/Dialogs/ChooseVariableDialog.h" #include "GDCore/IDE/Dialogs/ChooseVariableDialog.h"
#include "GDCore/IDE/Dialogs/ChooseAutomatismDialog.h" #include "GDCore/IDE/Dialogs/ChooseBehaviorDialog.h"
#include "GDCore/IDE/Dialogs/AdvancedEntryDialog.h" #include "GDCore/IDE/Dialogs/AdvancedEntryDialog.h"
#include "GDCore/IDE/wxTools/TreeItemExpressionMetadata.h" #include "GDCore/IDE/wxTools/TreeItemExpressionMetadata.h"
#include "GDCore/Events/ExpressionMetadata.h" #include "GDCore/Events/ExpressionMetadata.h"
@@ -404,15 +404,15 @@ lastErrorPos(gd::String::npos)
keywords += " "+it->first; keywords += " "+it->first;
} }
//Add keywords of automatisms expressions //Add keywords of behaviors expressions
std::vector<gd::String> automatismsTypes = extensions[i]->GetAutomatismsTypes(); std::vector<gd::String> behaviorsTypes = extensions[i]->GetBehaviorsTypes();
for (unsigned int j = 0;j<automatismsTypes.size();++j) for (unsigned int j = 0;j<behaviorsTypes.size();++j)
{ {
const std::map<gd::String, gd::ExpressionMetadata > & allExprs = extensions[i]->GetAllExpressionsForAutomatism(automatismsTypes[j]); const std::map<gd::String, gd::ExpressionMetadata > & allExprs = extensions[i]->GetAllExpressionsForBehavior(behaviorsTypes[j]);
for(std::map<gd::String, gd::ExpressionMetadata >::const_iterator it = allExprs.begin(); it != allExprs.end(); ++it) for(std::map<gd::String, gd::ExpressionMetadata >::const_iterator it = allExprs.begin(); it != allExprs.end(); ++it)
keywords += " "+it->first; keywords += " "+it->first;
const std::map<gd::String, gd::ExpressionMetadata > & allStrExprs = extensions[i]->GetAllStrExpressionsForAutomatism(automatismsTypes[j]); const std::map<gd::String, gd::ExpressionMetadata > & allStrExprs = extensions[i]->GetAllStrExpressionsForBehavior(behaviorsTypes[j]);
for(std::map<gd::String, gd::ExpressionMetadata >::const_iterator it = allStrExprs.begin(); it != allStrExprs.end(); ++it) for(std::map<gd::String, gd::ExpressionMetadata >::const_iterator it = allStrExprs.begin(); it != allStrExprs.end(); ++it)
keywords += " "+it->first; keywords += " "+it->first;
} }
@@ -523,7 +523,7 @@ void EditExpressionDialog::RefreshLists()
continue; continue;
std::vector<gd::String> objectsTypes = extensions[i]->GetExtensionObjectsTypes(); std::vector<gd::String> objectsTypes = extensions[i]->GetExtensionObjectsTypes();
std::vector<gd::String> automatismsTypes = extensions[i]->GetAutomatismsTypes(); std::vector<gd::String> behaviorsTypes = extensions[i]->GetBehaviorsTypes();
wxTreeItemId extensionItem = ObjList->GetRootItem(); wxTreeItemId extensionItem = ObjList->GetRootItem();
@@ -562,26 +562,26 @@ void EditExpressionDialog::RefreshLists()
} }
} }
for(unsigned int j = 0;j<automatismsTypes.size();++j) for(unsigned int j = 0;j<behaviorsTypes.size();++j)
{ {
wxTreeItemId automatismTypeItem = automatismsTypes[j] == "" ? wxTreeItemId behaviorTypeItem = behaviorsTypes[j] == "" ?
ObjList->AppendItem(extensionItem, _("All objects"), 0) : ObjList->AppendItem(extensionItem, _("All objects"), 0) :
ObjList->AppendItem(extensionItem, _("Automatism") + wxString(" ") + extensions[i]->GetAutomatismMetadata(automatismsTypes[j]).GetFullName(),0) ; ObjList->AppendItem(extensionItem, _("Behavior") + wxString(" ") + extensions[i]->GetBehaviorMetadata(behaviorsTypes[j]).GetFullName(),0) ;
//Add each automatism expression //Add each behavior expression
std::map<gd::String, gd::ExpressionMetadata > allAutoExpr = extensions[i]->GetAllExpressionsForAutomatism(automatismsTypes[j]); std::map<gd::String, gd::ExpressionMetadata > allAutoExpr = extensions[i]->GetAllExpressionsForBehavior(behaviorsTypes[j]);
for(std::map<gd::String, gd::ExpressionMetadata>::const_iterator it = allAutoExpr.begin(); it != allAutoExpr.end(); ++it) for(std::map<gd::String, gd::ExpressionMetadata>::const_iterator it = allAutoExpr.begin(); it != allAutoExpr.end(); ++it)
{ {
if ( it->second.IsShown() ) if ( it->second.IsShown() )
{ {
//Search and/or add group item //Search and/or add group item
wxTreeItemIdValue cookie; wxTreeItemIdValue cookie;
wxTreeItemId groupItem = ObjList->GetFirstChild(automatismTypeItem, cookie); wxTreeItemId groupItem = ObjList->GetFirstChild(behaviorTypeItem, cookie);
while ( groupItem.IsOk() && ObjList->GetItemText(groupItem) != it->second.GetGroup()) while ( groupItem.IsOk() && ObjList->GetItemText(groupItem) != it->second.GetGroup())
{ {
groupItem = ObjList->GetNextSibling(groupItem); groupItem = ObjList->GetNextSibling(groupItem);
} }
if ( !groupItem.IsOk() ) groupItem = ObjList->AppendItem(automatismTypeItem, it->second.GetGroup(), 0); if ( !groupItem.IsOk() ) groupItem = ObjList->AppendItem(behaviorTypeItem, it->second.GetGroup(), 0);
//Add expression item //Add expression item
int IDimage = 0; int IDimage = 0;
@@ -769,16 +769,16 @@ void EditExpressionDialog::OnAddPropBtClick(wxCommandEvent& event)
if ( cancelled ) return; if ( cancelled ) return;
//Add parameters //Add parameters
gd::String parametersStr, automatismStr; gd::String parametersStr, behaviorStr;
for (unsigned int i = 1;i<infos->GetExpressionMetadata().parameters.size();++i) for (unsigned int i = 1;i<infos->GetExpressionMetadata().parameters.size();++i)
{ {
if ( infos->GetExpressionMetadata().parameters[i].codeOnly ) continue; if ( infos->GetExpressionMetadata().parameters[i].codeOnly ) continue;
if ( i == 1 && infos->GetExpressionMetadata().parameters[i].type == "automatism" ) if ( i == 1 && infos->GetExpressionMetadata().parameters[i].type == "behavior" )
{ {
gd::ChooseAutomatismDialog dialog(this, project, layout, object, infos->GetExpressionMetadata().parameters[i].supplementaryInformation); gd::ChooseBehaviorDialog dialog(this, project, layout, object, infos->GetExpressionMetadata().parameters[i].supplementaryInformation);
if ( dialog.DeduceAutomatism() || dialog.ShowModal() == 1 ) if ( dialog.DeduceBehavior() || dialog.ShowModal() == 1 )
automatismStr = dialog.GetChosenAutomatism()+"::"; behaviorStr = dialog.GetChosenBehavior()+"::";
} }
else else
{ {
@@ -789,7 +789,7 @@ void EditExpressionDialog::OnAddPropBtClick(wxCommandEvent& event)
} }
if ( ExpressionEdit->GetText() == "0" ) ExpressionEdit->SetText(""); if ( ExpressionEdit->GetText() == "0" ) ExpressionEdit->SetText("");
ExpressionEdit->AddText(object+"."+automatismStr+infos->GetName()+"("+parametersStr+")"); ExpressionEdit->AddText(object+"."+behaviorStr+infos->GetName()+"("+parametersStr+")");
return; return;
} }
} }

View File

@@ -23,7 +23,7 @@
#include "GDCore/IDE/Dialogs/ChooseObjectDialog.h" #include "GDCore/IDE/Dialogs/ChooseObjectDialog.h"
#include "GDCore/IDE/Dialogs/ChooseLayerDialog.h" #include "GDCore/IDE/Dialogs/ChooseLayerDialog.h"
#include "GDCore/IDE/Dialogs/ChooseVariableDialog.h" #include "GDCore/IDE/Dialogs/ChooseVariableDialog.h"
#include "GDCore/IDE/Dialogs/ChooseAutomatismDialog.h" #include "GDCore/IDE/Dialogs/ChooseBehaviorDialog.h"
#include "GDCore/IDE/ExpressionsCorrectnessTesting.h" #include "GDCore/IDE/ExpressionsCorrectnessTesting.h"
#include "GDCore/IDE/EventsRenderingHelper.h" #include "GDCore/IDE/EventsRenderingHelper.h"
#include "GDCore/IDE/Dialogs/AdvancedEntryDialog.h" #include "GDCore/IDE/Dialogs/AdvancedEntryDialog.h"
@@ -177,7 +177,7 @@ EditStrExpressionDialog::EditStrExpressionDialog(wxWindow* parent, gd::String ex
continue; continue;
std::vector<gd::String> objectsTypes = extensions[i]->GetExtensionObjectsTypes(); std::vector<gd::String> objectsTypes = extensions[i]->GetExtensionObjectsTypes();
std::vector<gd::String> automatismsTypes = extensions[i]->GetAutomatismsTypes(); std::vector<gd::String> behaviorsTypes = extensions[i]->GetBehaviorsTypes();
wxTreeItemId extensionItem = ObjList->GetRootItem(); wxTreeItemId extensionItem = ObjList->GetRootItem();
@@ -216,26 +216,26 @@ EditStrExpressionDialog::EditStrExpressionDialog(wxWindow* parent, gd::String ex
} }
} }
for(unsigned int j = 0;j<automatismsTypes.size();++j) for(unsigned int j = 0;j<behaviorsTypes.size();++j)
{ {
wxTreeItemId automatismTypeItem = automatismsTypes[j] == "" ? wxTreeItemId behaviorTypeItem = behaviorsTypes[j] == "" ?
ObjList->AppendItem(extensionItem, _("All objects"), 0) : ObjList->AppendItem(extensionItem, _("All objects"), 0) :
ObjList->AppendItem(extensionItem, _("Automatism") + wxString(" ") + extensions[i]->GetAutomatismMetadata(automatismsTypes[j]).GetFullName(), 0) ; ObjList->AppendItem(extensionItem, _("Behavior") + wxString(" ") + extensions[i]->GetBehaviorMetadata(behaviorsTypes[j]).GetFullName(), 0) ;
//Add each automatism expression //Add each behavior expression
std::map<gd::String, gd::ExpressionMetadata > allAutoExpr = extensions[i]->GetAllStrExpressionsForAutomatism(automatismsTypes[j]); std::map<gd::String, gd::ExpressionMetadata > allAutoExpr = extensions[i]->GetAllStrExpressionsForBehavior(behaviorsTypes[j]);
for(std::map<gd::String, gd::ExpressionMetadata>::const_iterator it = allAutoExpr.begin(); it != allAutoExpr.end(); ++it) for(std::map<gd::String, gd::ExpressionMetadata>::const_iterator it = allAutoExpr.begin(); it != allAutoExpr.end(); ++it)
{ {
if ( it->second.IsShown() ) if ( it->second.IsShown() )
{ {
//Search and/or add group item //Search and/or add group item
wxTreeItemIdValue cookie; wxTreeItemIdValue cookie;
wxTreeItemId groupItem = ObjList->GetFirstChild(automatismTypeItem, cookie); wxTreeItemId groupItem = ObjList->GetFirstChild(behaviorTypeItem, cookie);
while ( groupItem.IsOk() && ObjList->GetItemText(groupItem) != it->second.GetGroup()) while ( groupItem.IsOk() && ObjList->GetItemText(groupItem) != it->second.GetGroup())
{ {
groupItem = ObjList->GetNextSibling(groupItem); groupItem = ObjList->GetNextSibling(groupItem);
} }
if ( !groupItem.IsOk() ) groupItem = ObjList->AppendItem(automatismTypeItem, it->second.GetGroup(), 0); if ( !groupItem.IsOk() ) groupItem = ObjList->AppendItem(behaviorTypeItem, it->second.GetGroup(), 0);
//Add expression item //Add expression item
int IDimage = 0; int IDimage = 0;
@@ -328,15 +328,15 @@ EditStrExpressionDialog::EditStrExpressionDialog(wxWindow* parent, gd::String ex
keywords += " "+it->first; keywords += " "+it->first;
} }
//Add keywords of automatisms expressions //Add keywords of behaviors expressions
std::vector<gd::String> automatismsTypes = extensions[i]->GetAutomatismsTypes(); std::vector<gd::String> behaviorsTypes = extensions[i]->GetBehaviorsTypes();
for (unsigned int j = 0;j<automatismsTypes.size();++j) for (unsigned int j = 0;j<behaviorsTypes.size();++j)
{ {
const std::map<gd::String, gd::ExpressionMetadata > & allExprs = extensions[i]->GetAllExpressionsForAutomatism(automatismsTypes[j]); const std::map<gd::String, gd::ExpressionMetadata > & allExprs = extensions[i]->GetAllExpressionsForBehavior(behaviorsTypes[j]);
for(std::map<gd::String, gd::ExpressionMetadata >::const_iterator it = allExprs.begin(); it != allExprs.end(); ++it) for(std::map<gd::String, gd::ExpressionMetadata >::const_iterator it = allExprs.begin(); it != allExprs.end(); ++it)
keywords += " "+it->first; keywords += " "+it->first;
const std::map<gd::String, gd::ExpressionMetadata > & allStrExprs = extensions[i]->GetAllStrExpressionsForAutomatism(automatismsTypes[j]); const std::map<gd::String, gd::ExpressionMetadata > & allStrExprs = extensions[i]->GetAllStrExpressionsForBehavior(behaviorsTypes[j]);
for(std::map<gd::String, gd::ExpressionMetadata >::const_iterator it = allStrExprs.begin(); it != allStrExprs.end(); ++it) for(std::map<gd::String, gd::ExpressionMetadata >::const_iterator it = allStrExprs.begin(); it != allStrExprs.end(); ++it)
keywords += " "+it->first; keywords += " "+it->first;
} }
@@ -542,14 +542,14 @@ void EditStrExpressionDialog::OnAddPropBtClick(wxCommandEvent& event)
gd::String object = ShowParameterDialog(infos->GetExpressionMetadata().parameters[0], cancelled); gd::String object = ShowParameterDialog(infos->GetExpressionMetadata().parameters[0], cancelled);
if ( cancelled ) return; if ( cancelled ) return;
gd::String parametersStr, automatismStr; gd::String parametersStr, behaviorStr;
for (unsigned int i = 1;i<infos->GetExpressionMetadata().parameters.size();++i) for (unsigned int i = 1;i<infos->GetExpressionMetadata().parameters.size();++i)
{ {
if ( i == 1 && infos->GetExpressionMetadata().parameters[i].type == "automatism") if ( i == 1 && infos->GetExpressionMetadata().parameters[i].type == "behavior")
{ {
gd::ChooseAutomatismDialog dialog(this, project, layout, object, infos->GetExpressionMetadata().parameters[i].supplementaryInformation); gd::ChooseBehaviorDialog dialog(this, project, layout, object, infos->GetExpressionMetadata().parameters[i].supplementaryInformation);
if ( dialog.DeduceAutomatism() || dialog.ShowModal() == 1 ) if ( dialog.DeduceBehavior() || dialog.ShowModal() == 1 )
automatismStr = dialog.GetChosenAutomatism()+"::"; behaviorStr = dialog.GetChosenBehavior()+"::";
} }
else else
{ {
@@ -560,7 +560,7 @@ void EditStrExpressionDialog::OnAddPropBtClick(wxCommandEvent& event)
} }
if ( TexteEdit->GetText() == "\"\"" ) TexteEdit->SetText(""); if ( TexteEdit->GetText() == "\"\"" ) TexteEdit->SetText("");
TexteEdit->AddText(object+"."+automatismStr+infos->GetName()+"("+parametersStr+")"); TexteEdit->AddText(object+"."+behaviorStr+infos->GetName()+"("+parametersStr+")");
return; return;
} }
} }

View File

@@ -21,7 +21,7 @@
#include "GDCore/PlatformDefinition/Object.h" #include "GDCore/PlatformDefinition/Object.h"
#include "GDCore/PlatformDefinition/InitialInstance.h" #include "GDCore/PlatformDefinition/InitialInstance.h"
#include "GDCore/PlatformDefinition/InitialInstancesContainer.h" #include "GDCore/PlatformDefinition/InitialInstancesContainer.h"
#include "GDCore/IDE/Dialogs/ChooseAutomatismTypeDialog.h" #include "GDCore/IDE/Dialogs/ChooseBehaviorTypeDialog.h"
#include "GDCore/IDE/Dialogs/LayoutEditorCanvas/LayoutEditorCanvasAssociatedEditor.h" #include "GDCore/IDE/Dialogs/LayoutEditorCanvas/LayoutEditorCanvasAssociatedEditor.h"
#include "GDCore/IDE/Dialogs/LayoutEditorCanvas/LayoutEditorCanvasTextDnd.h" #include "GDCore/IDE/Dialogs/LayoutEditorCanvas/LayoutEditorCanvasTextDnd.h"
#include "GDCore/IDE/Dialogs/LayoutEditorCanvas/LayoutEditorCanvasOptions.h" #include "GDCore/IDE/Dialogs/LayoutEditorCanvas/LayoutEditorCanvasOptions.h"
@@ -229,7 +229,7 @@ LayoutEditorCanvas::LayoutEditorCanvas(wxWindow* parent, gd::Project & project_,
deleteItem->SetBitmap(gd::SkinHelper::GetIcon("delete", 16)); deleteItem->SetBitmap(gd::SkinHelper::GetIcon("delete", 16));
contextMenu.Append(ID_PROPMENU, _("Properties")); contextMenu.Append(ID_PROPMENU, _("Properties"));
contextMenu.Append(ID_AUTOMENU, _("Add an automatism to the object")); contextMenu.Append(ID_AUTOMENU, _("Add an behavior to the object"));
contextMenu.AppendSeparator(); contextMenu.AppendSeparator();
contextMenu.Append(ID_CREATEOBJECTMENU, _("Insert a new object")); contextMenu.Append(ID_CREATEOBJECTMENU, _("Insert a new object"));
contextMenu.AppendSeparator(); contextMenu.AppendSeparator();
@@ -666,7 +666,7 @@ void LayoutEditorCanvas::OnAddAutoObjSelected(wxCommandEvent & event)
} }
} }
gd::ChooseAutomatismTypeDialog::ChooseAndAddAutomatismToObject(this, project, gd::ChooseBehaviorTypeDialog::ChooseAndAddBehaviorToObject(this, project,
object, &layout, globalObject); object, &layout, globalObject);
//Show the properties panel and ensure other editors are refreshed: //Show the properties panel and ensure other editors are refreshed:

View File

@@ -7,13 +7,13 @@
#include "ObjectsPropgridHelper.h" #include "ObjectsPropgridHelper.h"
#include "GDCore/IDE/Dialogs/ChooseVariableDialog.h" #include "GDCore/IDE/Dialogs/ChooseVariableDialog.h"
#include "GDCore/IDE/Dialogs/PropertyDescriptor.h" #include "GDCore/IDE/Dialogs/PropertyDescriptor.h"
#include "GDCore/IDE/Dialogs/ChooseAutomatismTypeDialog.h" #include "GDCore/IDE/Dialogs/ChooseBehaviorTypeDialog.h"
#include "GDCore/IDE/EventsRefactorer.h" #include "GDCore/IDE/EventsRefactorer.h"
#include "GDCore/PlatformDefinition/Object.h" #include "GDCore/PlatformDefinition/Object.h"
#include "GDCore/PlatformDefinition/Project.h" #include "GDCore/PlatformDefinition/Project.h"
#include "GDCore/PlatformDefinition/Layout.h" #include "GDCore/PlatformDefinition/Layout.h"
#include "GDCore/PlatformDefinition/Platform.h" #include "GDCore/PlatformDefinition/Platform.h"
#include "GDCore/PlatformDefinition/Automatism.h" #include "GDCore/PlatformDefinition/Behavior.h"
#include "GDCore/PlatformDefinition/PlatformExtension.h" #include "GDCore/PlatformDefinition/PlatformExtension.h"
#include "GDCore/CommonTools.h" #include "GDCore/CommonTools.h"
#include <wx/propgrid/propgrid.h> #include <wx/propgrid/propgrid.h>
@@ -51,36 +51,36 @@ void ObjectsPropgridHelper::RefreshFrom(const gd::Object * object, bool displaye
grid->SetPropertyReadOnly(_("Variables")); grid->SetPropertyReadOnly(_("Variables"));
} }
grid->Append( new wxPropertyCategory(_("Automatisms") + " (" + gd::String::From(object->GetAllAutomatisms().size()) + ")" , "AUTO") ); grid->Append( new wxPropertyCategory(_("Behaviors") + " (" + gd::String::From(object->GetAllBehaviors().size()) + ")" , "AUTO") );
grid->Append( new wxStringProperty(_("Add automatism"), "AUTO_ADD", _("Add...")) ); grid->Append( new wxStringProperty(_("Add behavior"), "AUTO_ADD", _("Add...")) );
grid->SetPropertyCell("AUTO_ADD", 1, _("Add..."), wxNullBitmap, wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT)); grid->SetPropertyCell("AUTO_ADD", 1, _("Add..."), wxNullBitmap, wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT));
grid->SetPropertyReadOnly("AUTO_ADD"); grid->SetPropertyReadOnly("AUTO_ADD");
std::vector<gd::String> automatisms = object->GetAllAutomatismNames(); std::vector<gd::String> behaviors = object->GetAllBehaviorNames();
if ( !automatisms.empty() ) { if ( !behaviors.empty() ) {
grid->AppendIn("AUTO", new wxStringProperty("", "AUTO_REMOVE", _("Remove...")) ); grid->AppendIn("AUTO", new wxStringProperty("", "AUTO_REMOVE", _("Remove...")) );
grid->SetPropertyCell("AUTO_REMOVE", 1, _("Remove..."), wxNullBitmap, wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT)); grid->SetPropertyCell("AUTO_REMOVE", 1, _("Remove..."), wxNullBitmap, wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT));
grid->SetPropertyReadOnly("AUTO_REMOVE"); grid->SetPropertyReadOnly("AUTO_REMOVE");
} }
for (unsigned int i = 0;i<automatisms.size();++i) for (unsigned int i = 0;i<behaviors.size();++i)
{ {
const gd::Automatism & automatism = object->GetAutomatism(automatisms[i]); const gd::Behavior & behavior = object->GetBehavior(behaviors[i]);
std::map<gd::String, gd::PropertyDescriptor> properties = automatism.GetProperties(project); std::map<gd::String, gd::PropertyDescriptor> properties = behavior.GetProperties(project);
grid->AppendIn( "AUTO", new wxPropertyCategory(automatism.GetName()) ); grid->AppendIn( "AUTO", new wxPropertyCategory(behavior.GetName()) );
if ( properties.empty() || properties.find("PLEASE_ALSO_SHOW_EDIT_BUTTON_THANKS") != properties.end() ) if ( properties.empty() || properties.find("PLEASE_ALSO_SHOW_EDIT_BUTTON_THANKS") != properties.end() )
{ {
//"Click to edit" is not shown if properties are not empty, except if the magic property is set. //"Click to edit" is not shown if properties are not empty, except if the magic property is set.
grid->Append( new wxStringProperty(_("Edit"), wxString("AUTO:"+automatisms[i]), _("Click to edit...")) ); grid->Append( new wxStringProperty(_("Edit"), wxString("AUTO:"+behaviors[i]), _("Click to edit...")) );
grid->SetPropertyCell(wxString("AUTO:"+automatisms[i]), 1, _("Click to edit..."), wxNullBitmap, wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT)); grid->SetPropertyCell(wxString("AUTO:"+behaviors[i]), 1, _("Click to edit..."), wxNullBitmap, wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT));
grid->SetPropertyReadOnly(wxString("AUTO:"+automatisms[i])); grid->SetPropertyReadOnly(wxString("AUTO:"+behaviors[i]));
} }
grid->Append( new wxStringProperty("", "AUTO_RENAME:"+automatisms[i], _("Rename...")) ); grid->Append( new wxStringProperty("", "AUTO_RENAME:"+behaviors[i], _("Rename...")) );
grid->SetPropertyCell(wxString("AUTO_RENAME:"+automatisms[i]), 1, _("Rename..."), wxNullBitmap, wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT)); grid->SetPropertyCell(wxString("AUTO_RENAME:"+behaviors[i]), 1, _("Rename..."), wxNullBitmap, wxSystemSettings::GetColour(wxSYS_COLOUR_HOTLIGHT));
grid->SetPropertyReadOnly(wxString("AUTO_RENAME:"+automatisms[i])); grid->SetPropertyReadOnly(wxString("AUTO_RENAME:"+behaviors[i]));
//Add automatism custom properties //Add behavior custom properties
for (std::map<gd::String, gd::PropertyDescriptor>::iterator it = properties.begin(); for (std::map<gd::String, gd::PropertyDescriptor>::iterator it = properties.begin();
it != properties.end();++it) it != properties.end();++it)
{ {
@@ -96,16 +96,16 @@ void ObjectsPropgridHelper::RefreshFrom(const gd::Object * object, bool displaye
for (unsigned int j = 0; j < choices.size(); ++j) for (unsigned int j = 0; j < choices.size(); ++j)
choicesArray.push_back(choices[j]); choicesArray.push_back(choices[j]);
wxEnumProperty * prop = new wxEnumProperty(name, "AUTO_PROP:"+automatisms[i], choicesArray); wxEnumProperty * prop = new wxEnumProperty(name, "AUTO_PROP:"+behaviors[i], choicesArray);
prop->SetChoiceSelection(choicesArray.Index(value)); prop->SetChoiceSelection(choicesArray.Index(value));
grid->Append(prop); grid->Append(prop);
} }
else if ( type == "Boolean" ) else if ( type == "Boolean" )
{ {
grid->Append(new wxBoolProperty(name, "AUTO_PROP:"+automatisms[i], value == "true")); grid->Append(new wxBoolProperty(name, "AUTO_PROP:"+behaviors[i], value == "true"));
} }
else else
grid->Append(new wxStringProperty(name, "AUTO_PROP:"+automatisms[i], value)); grid->Append(new wxStringProperty(name, "AUTO_PROP:"+behaviors[i], value));
} }
} }
@@ -163,27 +163,27 @@ bool ObjectsPropgridHelper::OnPropertySelected(gd::Object * object, gd::Layout *
} }
else if ( event.GetPropertyName() == "AUTO_ADD" ) else if ( event.GetPropertyName() == "AUTO_ADD" )
{ {
return gd::ChooseAutomatismTypeDialog::ChooseAndAddAutomatismToObject(grid, project, return gd::ChooseBehaviorTypeDialog::ChooseAndAddBehaviorToObject(grid, project,
object, layout, globalObject); object, layout, globalObject);
} }
else if ( event.GetPropertyName() == "AUTO_REMOVE" ) else if ( event.GetPropertyName() == "AUTO_REMOVE" )
{ {
//Create automatism array //Create behavior array
wxArrayString automatismsStr; wxArrayString behaviorsStr;
//Fill array //Fill array
std::vector <gd::String> automatisms = object->GetAllAutomatismNames(); std::vector <gd::String> behaviors = object->GetAllBehaviorNames();
for (unsigned int i = 0;i<automatisms.size();++i) for (unsigned int i = 0;i<behaviors.size();++i)
automatismsStr.Add(object->GetAutomatism(automatisms[i]).GetName()); behaviorsStr.Add(object->GetBehavior(behaviors[i]).GetName());
int selection = wxGetSingleChoiceIndex(_("Choose the automatism to delete"), _("Choose the automatism to delete"), automatismsStr); int selection = wxGetSingleChoiceIndex(_("Choose the behavior to delete"), _("Choose the behavior to delete"), behaviorsStr);
if ( selection == -1 ) return false; if ( selection == -1 ) return false;
object->RemoveAutomatism(automatisms[selection]); object->RemoveBehavior(behaviors[selection]);
UpdateAutomatismsSharedData(project, globalObject ? NULL : layout); UpdateBehaviorsSharedData(project, globalObject ? NULL : layout);
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j) for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnAutomatismDeleted(project, globalObject ? NULL : layout, *object, automatisms[selection]); project.GetUsedPlatforms()[j]->GetChangesNotifier().OnBehaviorDeleted(project, globalObject ? NULL : layout, *object, behaviors[selection]);
return true; return true;
} }
@@ -191,18 +191,18 @@ bool ObjectsPropgridHelper::OnPropertySelected(gd::Object * object, gd::Layout *
{ {
event.Veto(); event.Veto();
gd::String oldName = event.GetPropertyName().substr(12); gd::String oldName = event.GetPropertyName().substr(12);
if ( !object->HasAutomatismNamed(oldName)) return true; if ( !object->HasBehaviorNamed(oldName)) return true;
gd::Automatism & automatism = object->GetAutomatism(oldName); gd::Behavior & behavior = object->GetBehavior(oldName);
gd::String newName = wxGetTextFromUser(_("Enter a new name for the automatism"), _("Rename an automatism"), automatism.GetName()); gd::String newName = wxGetTextFromUser(_("Enter a new name for the behavior"), _("Rename an behavior"), behavior.GetName());
if ( newName == automatism.GetName() || object->HasAutomatismNamed(newName) || newName.empty() ) return false; if ( newName == behavior.GetName() || object->HasBehaviorNamed(newName) || newName.empty() ) return false;
object->RenameAutomatism(oldName, newName); object->RenameBehavior(oldName, newName);
UpdateAutomatismsSharedData(project, globalObject ? NULL : layout); UpdateBehaviorsSharedData(project, globalObject ? NULL : layout);
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j) for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnAutomatismRenamed(project, globalObject ? NULL : layout, *object, automatism, oldName); project.GetUsedPlatforms()[j]->GetChangesNotifier().OnBehaviorRenamed(project, globalObject ? NULL : layout, *object, behavior, oldName);
return true; return true;
} }
@@ -210,13 +210,13 @@ bool ObjectsPropgridHelper::OnPropertySelected(gd::Object * object, gd::Layout *
{ {
event.Veto(); event.Veto();
gd::String autoName = event.GetPropertyName().substr(5); gd::String autoName = event.GetPropertyName().substr(5);
if ( !object->HasAutomatismNamed(autoName)) return true; if ( !object->HasBehaviorNamed(autoName)) return true;
gd::Automatism & automatism = object->GetAutomatism(autoName); gd::Behavior & behavior = object->GetBehavior(autoName);
automatism.EditAutomatism(grid, project, layout, mainFrameWrapper); //EditAutomatism always need a valid layout! behavior.EditBehavior(grid, project, layout, mainFrameWrapper); //EditBehavior always need a valid layout!
for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j) for ( unsigned int j = 0; j < project.GetUsedPlatforms().size();++j)
project.GetUsedPlatforms()[j]->GetChangesNotifier().OnAutomatismEdited(project, globalObject ? NULL : layout, *object, automatism); project.GetUsedPlatforms()[j]->GetChangesNotifier().OnBehaviorEdited(project, globalObject ? NULL : layout, *object, behavior);
} }
} }
@@ -310,18 +310,18 @@ bool ObjectsPropgridHelper::OnPropertyChanged(gd::Object * object, gd::Layout *
else if ( event.GetPropertyName().substr(0,10) == "AUTO_PROP:" ) else if ( event.GetPropertyName().substr(0,10) == "AUTO_PROP:" )
{ {
gd::String autoName = event.GetPropertyName().substr(10); gd::String autoName = event.GetPropertyName().substr(10);
if ( !object->HasAutomatismNamed(autoName)) if ( !object->HasBehaviorNamed(autoName))
{ {
event.Veto(); event.Veto();
return false; return false;
} }
gd::Automatism & automatism = object->GetAutomatism(autoName); gd::Behavior & behavior = object->GetBehavior(autoName);
gd::String value = event.GetPropertyValue().GetString(); gd::String value = event.GetPropertyValue().GetString();
//Special case for enums. //Special case for enums.
if ( wxEnumProperty * enumProperty = dynamic_cast<wxEnumProperty*>(event.GetProperty()) ) { if ( wxEnumProperty * enumProperty = dynamic_cast<wxEnumProperty*>(event.GetProperty()) ) {
std::map<gd::String, gd::PropertyDescriptor> properties = automatism.GetProperties(project); std::map<gd::String, gd::PropertyDescriptor> properties = behavior.GetProperties(project);
const std::vector<gd::String> & choices = properties[event.GetProperty()->GetLabel()].GetExtraInfo(); const std::vector<gd::String> & choices = properties[event.GetProperty()->GetLabel()].GetExtraInfo();
unsigned int id = event.GetPropertyValue().GetLong(); unsigned int id = event.GetPropertyValue().GetLong();
@@ -334,7 +334,7 @@ bool ObjectsPropgridHelper::OnPropertyChanged(gd::Object * object, gd::Layout *
std::cout << "VALUE" << value; std::cout << "VALUE" << value;
if ( !automatism.UpdateProperty(event.GetProperty()->GetLabel(), value, project) ) if ( !behavior.UpdateProperty(event.GetProperty()->GetLabel(), value, project) )
{ {
event.Veto(); event.Veto();
return false; return false;
@@ -344,14 +344,14 @@ bool ObjectsPropgridHelper::OnPropertyChanged(gd::Object * object, gd::Layout *
return false; return false;
} }
void ObjectsPropgridHelper::UpdateAutomatismsSharedData(gd::Project & project, gd::Layout * scene) const void ObjectsPropgridHelper::UpdateBehaviorsSharedData(gd::Project & project, gd::Layout * scene) const
{ {
if ( scene ) if ( scene )
scene->UpdateAutomatismsSharedData(project); scene->UpdateBehaviorsSharedData(project);
else //Scene pointer is NULL: Update shared data of all scenes else //Scene pointer is NULL: Update shared data of all scenes
{ {
for (unsigned int i = 0;i<project.GetLayoutsCount();++i) for (unsigned int i = 0;i<project.GetLayoutsCount();++i)
project.GetLayout(i).UpdateAutomatismsSharedData(project); project.GetLayout(i).UpdateBehaviorsSharedData(project);
} }
} }

View File

@@ -70,10 +70,10 @@ public:
private: private:
/** /**
* \brief A common task when a changes have been made is to update the shared data of automatisms, * \brief A common task when a changes have been made is to update the shared data of behaviors,
* which are stored in layouts. * which are stored in layouts.
*/ */
void UpdateAutomatismsSharedData(gd::Project & project, gd::Layout * layout) const; void UpdateBehaviorsSharedData(gd::Project & project, gd::Layout * layout) const;
wxPropertyGrid * grid; ///< The grid used for diplaying and editing properties. wxPropertyGrid * grid; ///< The grid used for diplaying and editing properties.
gd::Project & project; gd::Project & project;

View File

@@ -76,7 +76,7 @@ class CallbacksForRenamingObject : public gd::ParserCallbacks
+"."+functionName+"("+parametersStr+")"; +"."+functionName+"("+parametersStr+")";
}; };
virtual void OnObjectAutomatismFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) virtual void OnObjectBehaviorFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo)
{ {
if ( parameters.size() < 2 ) return; if ( parameters.size() < 2 ) return;
@@ -153,7 +153,7 @@ class CallbacksForRemovingObject : public gd::ParserCallbacks
if ( parameters[0].GetPlainString() == name ) objectPresent = true; if ( parameters[0].GetPlainString() == name ) objectPresent = true;
}; };
virtual void OnObjectAutomatismFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) virtual void OnObjectBehaviorFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo)
{ {
if ( parameters.empty() ) return; if ( parameters.empty() ) return;

View File

@@ -36,7 +36,7 @@ public:
virtual void OnStaticFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) { SearchInParameters(parameters, expressionInfo); } virtual void OnStaticFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) { SearchInParameters(parameters, expressionInfo); }
virtual void OnObjectFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) { SearchInParameters(parameters, expressionInfo); } virtual void OnObjectFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) { SearchInParameters(parameters, expressionInfo); }
virtual void OnObjectAutomatismFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) { SearchInParameters(parameters, expressionInfo); } virtual void OnObjectBehaviorFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) { SearchInParameters(parameters, expressionInfo); }
virtual bool OnSubMathExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression) virtual bool OnSubMathExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression)
{ {

View File

@@ -46,7 +46,7 @@ public:
void OnConstantToken(gd::String text) {}; void OnConstantToken(gd::String text) {};
void OnStaticFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) {}; void OnStaticFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) {};
void OnObjectFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) {}; void OnObjectFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) {};
void OnObjectAutomatismFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) {}; void OnObjectBehaviorFunction(gd::String functionName, const std::vector<gd::Expression> & parameters, const gd::ExpressionMetadata & expressionInfo) {};
bool OnSubMathExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression); bool OnSubMathExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression);
bool OnSubTextExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression); bool OnSubTextExpression(const gd::Platform & platform, const gd::Project & project, const gd::Layout & layout, gd::Expression & expression);

View File

@@ -60,7 +60,10 @@ void ExtensionsLoader::LoadAllExtensions(const gd::String & directory, gd::Platf
while ( (lecture = readdir( rep )) ) while ( (lecture = readdir( rep )) )
{ {
gd::String lec = lecture->d_name; gd::String lec = lecture->d_name;
if ( lec != "." && lec != ".." && lec.find(".xgd"+suffix, lec.length()-4-suffix.length()) != string::npos) //Load all extensions, except the legacy ones finishing by *Automatism.xgd* from GD3.x
if ( lec != "." && lec != ".." &&
lec.find(".xgd"+suffix, lec.length()-4-suffix.length()) != string::npos &&
lec.find("Automatism.xgd"+suffix) == string::npos)
{ {
//Use a log file, in IDE only //Use a log file, in IDE only
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)

View File

@@ -120,7 +120,7 @@ gd::String InstructionSentenceFormatter::LabelFromType(const gd::String & type)
if ( type.empty() ) return ""; if ( type.empty() ) return "";
else if ( type == "expression" ) return _("Expression"); else if ( type == "expression" ) return _("Expression");
else if ( gd::ParameterMetadata::IsObject(type) ) return _("Object"); else if ( gd::ParameterMetadata::IsObject(type) ) return _("Object");
else if ( type == "automatism" ) return _("Automatism"); else if ( type == "behavior" ) return _("Behavior");
else if ( type == "operator" ) return _("Operator"); else if ( type == "operator" ) return _("Operator");
else if ( type == "relationalOperator" ) return _( "Relational operator" ); else if ( type == "relationalOperator" ) return _( "Relational operator" );
else if ( type == "file" ) return _("File"); else if ( type == "file" ) return _("File");
@@ -149,7 +149,7 @@ void InstructionSentenceFormatter::LoadTypesFormattingFromConfig()
typesFormatting.clear(); typesFormatting.clear();
typesFormatting["expression"].SetColor(99, 0, 0).SetBold(); typesFormatting["expression"].SetColor(99, 0, 0).SetBold();
typesFormatting["object"].SetColor(19, 81, 0).SetBold(); typesFormatting["object"].SetColor(19, 81, 0).SetBold();
typesFormatting["automatism"].SetColor(19, 81, 0).SetBold(); typesFormatting["behavior"].SetColor(19, 81, 0).SetBold();
typesFormatting["operator"].SetColor(64, 81, 79).SetBold(); typesFormatting["operator"].SetColor(64, 81, 79).SetBold();
typesFormatting["objectvar"].SetColor(44, 69, 99).SetBold(); typesFormatting["objectvar"].SetColor(44, 69, 99).SetBold();
typesFormatting["scenevar"].SetColor(44, 69, 99).SetBold(); typesFormatting["scenevar"].SetColor(44, 69, 99).SetBold();
@@ -188,7 +188,7 @@ wxBitmap InstructionSentenceFormatter::BitmapFromType(const gd::String & type)
if ( type == "" ) return CommonBitmapManager->unknownBt; if ( type == "" ) return CommonBitmapManager->unknownBt;
else if ( type == "expression" ) return CommonBitmapManager->expressionBt; else if ( type == "expression" ) return CommonBitmapManager->expressionBt;
else if ( gd::ParameterMetadata::IsObject(type) ) return CommonBitmapManager->objectBt; else if ( gd::ParameterMetadata::IsObject(type) ) return CommonBitmapManager->objectBt;
else if ( type == "automatism" ) return CommonBitmapManager->automatismBt; else if ( type == "behavior" ) return CommonBitmapManager->behaviorBt;
else if ( type == "operator" ) return CommonBitmapManager->signeBt; else if ( type == "operator" ) return CommonBitmapManager->signeBt;
else if ( type == "relationalOperator" ) return CommonBitmapManager->signeBt; else if ( type == "relationalOperator" ) return CommonBitmapManager->signeBt;
else if ( type == "file" ) return CommonBitmapManager->fileBt; else if ( type == "file" ) return CommonBitmapManager->fileBt;

View File

@@ -7,7 +7,7 @@
#include "GDCore/PlatformDefinition/Platform.h" #include "GDCore/PlatformDefinition/Platform.h"
#include "GDCore/PlatformDefinition/PlatformExtension.h" #include "GDCore/PlatformDefinition/PlatformExtension.h"
#include "GDCore/Events/InstructionMetadata.h" #include "GDCore/Events/InstructionMetadata.h"
#include "GDCore/Events/AutomatismMetadata.h" #include "GDCore/Events/BehaviorMetadata.h"
#include "GDCore/Events/ObjectMetadata.h" #include "GDCore/Events/ObjectMetadata.h"
#include <algorithm> #include <algorithm>
#include "GDCore/String.h" #include "GDCore/String.h"
@@ -17,7 +17,7 @@ using namespace std;
namespace gd namespace gd
{ {
gd::AutomatismMetadata MetadataProvider::badAutomatismInfo; gd::BehaviorMetadata MetadataProvider::badBehaviorInfo;
gd::ObjectMetadata MetadataProvider::badObjectInfo; gd::ObjectMetadata MetadataProvider::badObjectInfo;
gd::InstructionMetadata MetadataProvider::badInstructionMetadata; gd::InstructionMetadata MetadataProvider::badInstructionMetadata;
gd::ExpressionMetadata MetadataProvider::badExpressionMetadata; gd::ExpressionMetadata MetadataProvider::badExpressionMetadata;
@@ -25,21 +25,21 @@ gd::ExpressionMetadata MetadataProvider::badStrExpressionMetadata;
/** /**
* Get the metadata about an automatism in a platform * Get the metadata about an behavior in a platform
*/ */
const AutomatismMetadata & MetadataProvider::GetAutomatismMetadata(const gd::Platform & platform, gd::String automatismType) const BehaviorMetadata & MetadataProvider::GetBehaviorMetadata(const gd::Platform & platform, gd::String behaviorType)
{ {
for (unsigned int i = 0;i<platform.GetAllPlatformExtensions().size();++i) for (unsigned int i = 0;i<platform.GetAllPlatformExtensions().size();++i)
{ {
std::vector<gd::String> autosTypes = platform.GetAllPlatformExtensions()[i]->GetAutomatismsTypes(); std::vector<gd::String> autosTypes = platform.GetAllPlatformExtensions()[i]->GetBehaviorsTypes();
for(unsigned int j = 0;j<autosTypes.size();++j) for(unsigned int j = 0;j<autosTypes.size();++j)
{ {
if ( autosTypes[j] == automatismType ) if ( autosTypes[j] == behaviorType )
return platform.GetAllPlatformExtensions()[i]->GetAutomatismMetadata(automatismType); return platform.GetAllPlatformExtensions()[i]->GetBehaviorMetadata(behaviorType);
} }
} }
return badAutomatismInfo; return badBehaviorInfo;
} }
/** /**
@@ -77,10 +77,10 @@ const gd::InstructionMetadata & MetadataProvider::GetActionMetadata(const gd::Pl
return allObjectsActions.find(actionType)->second; return allObjectsActions.find(actionType)->second;
} }
const vector < gd::String > & autos = extensions[i]->GetAutomatismsTypes(); const vector < gd::String > & autos = extensions[i]->GetBehaviorsTypes();
for (unsigned int j = 0;j<autos.size();++j) for (unsigned int j = 0;j<autos.size();++j)
{ {
const std::map<gd::String, gd::InstructionMetadata> & allAutosActions = extensions[i]->GetAllActionsForAutomatism(autos[j]); const std::map<gd::String, gd::InstructionMetadata> & allAutosActions = extensions[i]->GetAllActionsForBehavior(autos[j]);
if ( allAutosActions.find(actionType) != allAutosActions.end() ) if ( allAutosActions.find(actionType) != allAutosActions.end() )
return allAutosActions.find(actionType)->second; return allAutosActions.find(actionType)->second;
} }
@@ -106,10 +106,10 @@ const gd::InstructionMetadata & MetadataProvider::GetConditionMetadata(const gd:
return allObjetsConditions.find(conditionType)->second; return allObjetsConditions.find(conditionType)->second;
} }
const vector < gd::String > & autos = extensions[i]->GetAutomatismsTypes(); const vector < gd::String > & autos = extensions[i]->GetBehaviorsTypes();
for (unsigned int j = 0;j<autos.size();++j) for (unsigned int j = 0;j<autos.size();++j)
{ {
const std::map<gd::String, gd::InstructionMetadata> & allAutosConditions = extensions[i]->GetAllConditionsForAutomatism(autos[j]); const std::map<gd::String, gd::InstructionMetadata> & allAutosConditions = extensions[i]->GetAllConditionsForBehavior(autos[j]);
if ( allAutosConditions.find(conditionType) != allAutosConditions.end() ) if ( allAutosConditions.find(conditionType) != allAutosConditions.end() )
return allAutosConditions.find(conditionType)->second; return allAutosConditions.find(conditionType)->second;
} }
@@ -143,15 +143,15 @@ const gd::ExpressionMetadata & MetadataProvider::GetObjectExpressionMetadata(con
return badExpressionMetadata; return badExpressionMetadata;
} }
const gd::ExpressionMetadata & MetadataProvider::GetAutomatismExpressionMetadata(const gd::Platform & platform, gd::String autoType, gd::String exprType) const gd::ExpressionMetadata & MetadataProvider::GetBehaviorExpressionMetadata(const gd::Platform & platform, gd::String autoType, gd::String exprType)
{ {
std::vector < std::shared_ptr<PlatformExtension> > extensions = platform.GetAllPlatformExtensions(); std::vector < std::shared_ptr<PlatformExtension> > extensions = platform.GetAllPlatformExtensions();
for (unsigned int i =0;i<extensions.size();++i) for (unsigned int i =0;i<extensions.size();++i)
{ {
const vector < gd::String > & autos = extensions[i]->GetAutomatismsTypes(); const vector < gd::String > & autos = extensions[i]->GetBehaviorsTypes();
if ( find(autos.begin(), autos.end(), autoType) != autos.end()) if ( find(autos.begin(), autos.end(), autoType) != autos.end())
{ {
const std::map<gd::String, gd::ExpressionMetadata> & allAutoExpressions = extensions[i]->GetAllExpressionsForAutomatism(autoType); const std::map<gd::String, gd::ExpressionMetadata> & allAutoExpressions = extensions[i]->GetAllExpressionsForBehavior(autoType);
if ( allAutoExpressions.find(exprType) != allAutoExpressions.end() ) if ( allAutoExpressions.find(exprType) != allAutoExpressions.end() )
return allAutoExpressions.find(exprType)->second; return allAutoExpressions.find(exprType)->second;
} }
@@ -160,7 +160,7 @@ const gd::ExpressionMetadata & MetadataProvider::GetAutomatismExpressionMetadata
//Then check base //Then check base
for (unsigned int i =0;i<extensions.size();++i) for (unsigned int i =0;i<extensions.size();++i)
{ {
const std::map<gd::String, gd::ExpressionMetadata> & allAutoExpressions = extensions[i]->GetAllExpressionsForAutomatism(""); const std::map<gd::String, gd::ExpressionMetadata> & allAutoExpressions = extensions[i]->GetAllExpressionsForBehavior("");
if ( allAutoExpressions.find(exprType) != allAutoExpressions.end() ) if ( allAutoExpressions.find(exprType) != allAutoExpressions.end() )
return allAutoExpressions.find(exprType)->second; return allAutoExpressions.find(exprType)->second;
} }
@@ -206,26 +206,26 @@ const gd::ExpressionMetadata & MetadataProvider::GetObjectStrExpressionMetadata(
return badStrExpressionMetadata; return badStrExpressionMetadata;
} }
const gd::ExpressionMetadata & MetadataProvider::GetAutomatismStrExpressionMetadata(const gd::Platform & platform, gd::String autoType, gd::String exprType) const gd::ExpressionMetadata & MetadataProvider::GetBehaviorStrExpressionMetadata(const gd::Platform & platform, gd::String autoType, gd::String exprType)
{ {
std::vector < std::shared_ptr<PlatformExtension> > extensions = platform.GetAllPlatformExtensions(); std::vector < std::shared_ptr<PlatformExtension> > extensions = platform.GetAllPlatformExtensions();
for (unsigned int i =0;i<extensions.size();++i) for (unsigned int i =0;i<extensions.size();++i)
{ {
const vector < gd::String > & autos = extensions[i]->GetAutomatismsTypes(); const vector < gd::String > & autos = extensions[i]->GetBehaviorsTypes();
if ( find(autos.begin(), autos.end(), autoType) != autos.end()) if ( find(autos.begin(), autos.end(), autoType) != autos.end())
{ {
const std::map<gd::String, gd::ExpressionMetadata> & allAutomatismStrExpressions = extensions[i]->GetAllStrExpressionsForAutomatism(autoType); const std::map<gd::String, gd::ExpressionMetadata> & allBehaviorStrExpressions = extensions[i]->GetAllStrExpressionsForBehavior(autoType);
if ( allAutomatismStrExpressions.find(exprType) != allAutomatismStrExpressions.end() ) if ( allBehaviorStrExpressions.find(exprType) != allBehaviorStrExpressions.end() )
return allAutomatismStrExpressions.find(exprType)->second; return allBehaviorStrExpressions.find(exprType)->second;
} }
} }
//Then check in functions of "Base object". //Then check in functions of "Base object".
for (unsigned int i =0;i<extensions.size();++i) for (unsigned int i =0;i<extensions.size();++i)
{ {
const std::map<gd::String, gd::ExpressionMetadata> & allAutomatismStrExpressions = extensions[i]->GetAllStrExpressionsForAutomatism(""); const std::map<gd::String, gd::ExpressionMetadata> & allBehaviorStrExpressions = extensions[i]->GetAllStrExpressionsForBehavior("");
if ( allAutomatismStrExpressions.find(exprType) != allAutomatismStrExpressions.end() ) if ( allBehaviorStrExpressions.find(exprType) != allBehaviorStrExpressions.end() )
return allAutomatismStrExpressions.find(exprType)->second; return allBehaviorStrExpressions.find(exprType)->second;
} }
return badStrExpressionMetadata; return badStrExpressionMetadata;
@@ -279,12 +279,12 @@ bool MetadataProvider::HasObjectAction(const gd::Platform & platform, gd::String
return false; return false;
} }
bool MetadataProvider::HasAutomatismAction(const gd::Platform & platform, gd::String automatismType, gd::String name) bool MetadataProvider::HasBehaviorAction(const gd::Platform & platform, gd::String behaviorType, gd::String name)
{ {
std::vector < std::shared_ptr<PlatformExtension> > extensions = platform.GetAllPlatformExtensions(); std::vector < std::shared_ptr<PlatformExtension> > extensions = platform.GetAllPlatformExtensions();
for (unsigned int i =0;i<extensions.size();++i) for (unsigned int i =0;i<extensions.size();++i)
{ {
const std::map<gd::String, gd::InstructionMetadata > & actions = extensions[i]->GetAllActionsForAutomatism(automatismType); const std::map<gd::String, gd::InstructionMetadata > & actions = extensions[i]->GetAllActionsForBehavior(behaviorType);
if ( actions.find(name) != actions.end() ) if ( actions.find(name) != actions.end() )
return true; return true;
} }
@@ -292,7 +292,7 @@ bool MetadataProvider::HasAutomatismAction(const gd::Platform & platform, gd::St
//Then check in functions of "Base object". //Then check in functions of "Base object".
for (unsigned int i =0;i<extensions.size();++i) for (unsigned int i =0;i<extensions.size();++i)
{ {
const std::map<gd::String, gd::InstructionMetadata > & actions = extensions[i]->GetAllActionsForAutomatism(""); const std::map<gd::String, gd::InstructionMetadata > & actions = extensions[i]->GetAllActionsForBehavior("");
if ( actions.find(name) != actions.end() ) if ( actions.find(name) != actions.end() )
return true; return true;
} }
@@ -335,12 +335,12 @@ bool MetadataProvider::HasObjectCondition(const gd::Platform & platform, gd::Str
return false; return false;
} }
bool MetadataProvider::HasAutomatismCondition(const gd::Platform & platform, gd::String automatismType, gd::String name) bool MetadataProvider::HasBehaviorCondition(const gd::Platform & platform, gd::String behaviorType, gd::String name)
{ {
std::vector < std::shared_ptr<PlatformExtension> > extensions = platform.GetAllPlatformExtensions(); std::vector < std::shared_ptr<PlatformExtension> > extensions = platform.GetAllPlatformExtensions();
for (unsigned int i =0;i<extensions.size();++i) for (unsigned int i =0;i<extensions.size();++i)
{ {
const std::map<gd::String, gd::InstructionMetadata > & conditions = extensions[i]->GetAllConditionsForAutomatism(automatismType); const std::map<gd::String, gd::InstructionMetadata > & conditions = extensions[i]->GetAllConditionsForBehavior(behaviorType);
if ( conditions.find(name) != conditions.end() ) if ( conditions.find(name) != conditions.end() )
return true; return true;
} }
@@ -348,7 +348,7 @@ bool MetadataProvider::HasAutomatismCondition(const gd::Platform & platform, gd:
//Then check in functions of "Base object". //Then check in functions of "Base object".
for (unsigned int i =0;i<extensions.size();++i) for (unsigned int i =0;i<extensions.size();++i)
{ {
const std::map<gd::String, gd::InstructionMetadata > & conditions = extensions[i]->GetAllConditionsForAutomatism(""); const std::map<gd::String, gd::InstructionMetadata > & conditions = extensions[i]->GetAllConditionsForBehavior("");
if ( conditions.find(name) != conditions.end() ) if ( conditions.find(name) != conditions.end() )
return true; return true;
} }
@@ -390,12 +390,12 @@ bool MetadataProvider::HasObjectExpression(const gd::Platform & platform, gd::St
return false; return false;
} }
bool MetadataProvider::HasAutomatismExpression(const gd::Platform & platform, gd::String automatismType, gd::String name) bool MetadataProvider::HasBehaviorExpression(const gd::Platform & platform, gd::String behaviorType, gd::String name)
{ {
std::vector < std::shared_ptr<PlatformExtension> > extensions = platform.GetAllPlatformExtensions(); std::vector < std::shared_ptr<PlatformExtension> > extensions = platform.GetAllPlatformExtensions();
for (unsigned int i =0;i<extensions.size();++i) for (unsigned int i =0;i<extensions.size();++i)
{ {
const std::map<gd::String, gd::ExpressionMetadata > & expressions = extensions[i]->GetAllExpressionsForAutomatism(automatismType); const std::map<gd::String, gd::ExpressionMetadata > & expressions = extensions[i]->GetAllExpressionsForBehavior(behaviorType);
if ( expressions.find(name) != expressions.end() ) if ( expressions.find(name) != expressions.end() )
return true; return true;
} }
@@ -403,7 +403,7 @@ bool MetadataProvider::HasAutomatismExpression(const gd::Platform & platform, gd
//Then check in functions of "Base object". //Then check in functions of "Base object".
for (unsigned int i =0;i<extensions.size();++i) for (unsigned int i =0;i<extensions.size();++i)
{ {
const std::map<gd::String, gd::ExpressionMetadata > & expressions = extensions[i]->GetAllExpressionsForAutomatism(""); const std::map<gd::String, gd::ExpressionMetadata > & expressions = extensions[i]->GetAllExpressionsForBehavior("");
if ( expressions.find(name) != expressions.end() ) if ( expressions.find(name) != expressions.end() )
return true; return true;
} }
@@ -446,12 +446,12 @@ bool MetadataProvider::HasObjectStrExpression(const gd::Platform & platform, gd:
return false; return false;
} }
bool MetadataProvider::HasAutomatismStrExpression(const gd::Platform & platform, gd::String automatismType, gd::String name) bool MetadataProvider::HasBehaviorStrExpression(const gd::Platform & platform, gd::String behaviorType, gd::String name)
{ {
std::vector < std::shared_ptr<PlatformExtension> > extensions = platform.GetAllPlatformExtensions(); std::vector < std::shared_ptr<PlatformExtension> > extensions = platform.GetAllPlatformExtensions();
for (unsigned int i =0;i<extensions.size();++i) for (unsigned int i =0;i<extensions.size();++i)
{ {
const std::map<gd::String, gd::ExpressionMetadata > & expressions = extensions[i]->GetAllStrExpressionsForAutomatism(automatismType); const std::map<gd::String, gd::ExpressionMetadata > & expressions = extensions[i]->GetAllStrExpressionsForBehavior(behaviorType);
if ( expressions.find(name) != expressions.end() ) if ( expressions.find(name) != expressions.end() )
return true; return true;
} }
@@ -459,7 +459,7 @@ bool MetadataProvider::HasAutomatismStrExpression(const gd::Platform & platform,
//Then check in functions of "Base object". //Then check in functions of "Base object".
for (unsigned int i =0;i<extensions.size();++i) for (unsigned int i =0;i<extensions.size();++i)
{ {
const std::map<gd::String, gd::ExpressionMetadata > & expressions = extensions[i]->GetAllStrExpressionsForAutomatism(""); const std::map<gd::String, gd::ExpressionMetadata > & expressions = extensions[i]->GetAllStrExpressionsForBehavior("");
if ( expressions.find(name) != expressions.end() ) if ( expressions.find(name) != expressions.end() )
return true; return true;
} }

View File

@@ -7,7 +7,7 @@
#define METADATAPROVIDER_H #define METADATAPROVIDER_H
#include "GDCore/String.h" #include "GDCore/String.h"
#include "GDCore/Events/InstructionMetadata.h" #include "GDCore/Events/InstructionMetadata.h"
namespace gd { class AutomatismMetadata; } namespace gd { class BehaviorMetadata; }
namespace gd { class ObjectMetadata; } namespace gd { class ObjectMetadata; }
namespace gd { class ExpressionMetadata; } namespace gd { class ExpressionMetadata; }
namespace gd { class ExpressionMetadata; } namespace gd { class ExpressionMetadata; }
@@ -26,9 +26,9 @@ class GD_CORE_API MetadataProvider
public: public:
/** /**
* Get the metadata about an automatism in a project using a platform * Get the metadata about an behavior in a project using a platform
*/ */
static const AutomatismMetadata & GetAutomatismMetadata(const gd::Platform & platform, gd::String automatismType); static const BehaviorMetadata & GetBehaviorMetadata(const gd::Platform & platform, gd::String behaviorType);
/** /**
* Get the metadata about an object in a project using a platform * Get the metadata about an object in a project using a platform
@@ -37,13 +37,13 @@ public:
/** /**
* Get the metadata of an action. * Get the metadata of an action.
* Must work for object, automatisms and static actions. * Must work for object, behaviors and static actions.
*/ */
static const gd::InstructionMetadata & GetActionMetadata(const gd::Platform & platform, gd::String actionType); static const gd::InstructionMetadata & GetActionMetadata(const gd::Platform & platform, gd::String actionType);
/** /**
* Get the metadata of a condition. * Get the metadata of a condition.
* Must Work for object, automatisms and static conditions. * Must Work for object, behaviors and static conditions.
*/ */
static const gd::InstructionMetadata & GetConditionMetadata(const gd::Platform & platform, gd::String conditionType); static const gd::InstructionMetadata & GetConditionMetadata(const gd::Platform & platform, gd::String conditionType);
@@ -61,9 +61,9 @@ public:
/** /**
* Get information about an expression from its type * Get information about an expression from its type
* Works for automatism expressions. * Works for behavior expressions.
*/ */
static const gd::ExpressionMetadata & GetAutomatismExpressionMetadata(const gd::Platform & platform, gd::String autoType, gd::String exprType); static const gd::ExpressionMetadata & GetBehaviorExpressionMetadata(const gd::Platform & platform, gd::String autoType, gd::String exprType);
/** /**
* Get information about a gd::String expression from its type * Get information about a gd::String expression from its type
@@ -79,9 +79,9 @@ public:
/** /**
* Get information about a gd::String expression from its type * Get information about a gd::String expression from its type
* Works for automatism expressions. * Works for behavior expressions.
*/ */
static const gd::ExpressionMetadata & GetAutomatismStrExpressionMetadata(const gd::Platform & platform, gd::String autoType, gd::String exprType); static const gd::ExpressionMetadata & GetBehaviorStrExpressionMetadata(const gd::Platform & platform, gd::String autoType, gd::String exprType);
/** /**
* Verifying if a ( static ) condition exists * Verifying if a ( static ) condition exists
@@ -108,16 +108,16 @@ public:
static bool HasObjectCondition(const gd::Platform & platform, gd::String objectType, gd::String name); static bool HasObjectCondition(const gd::Platform & platform, gd::String objectType, gd::String name);
/** /**
* Verifying if a ( Automatism ) action exists * Verifying if a ( Behavior ) action exists
* @return true if the ( Automatism ) action exists * @return true if the ( Behavior ) action exists
*/ */
static bool HasAutomatismAction(const gd::Platform & platform, gd::String automatismType, gd::String name); static bool HasBehaviorAction(const gd::Platform & platform, gd::String behaviorType, gd::String name);
/** /**
* Verifying if a ( Automatism ) condition exists * Verifying if a ( Behavior ) condition exists
* @return true if the ( Automatism ) condition exists * @return true if the ( Behavior ) condition exists
*/ */
static bool HasAutomatismCondition(const gd::Platform & platform, gd::String automatismType, gd::String name); static bool HasBehaviorCondition(const gd::Platform & platform, gd::String behaviorType, gd::String name);
/** /**
* Verifying if a ( static ) expression exists * Verifying if a ( static ) expression exists
@@ -132,10 +132,10 @@ public:
static bool HasObjectExpression(const gd::Platform & platform, gd::String objectType, gd::String name); static bool HasObjectExpression(const gd::Platform & platform, gd::String objectType, gd::String name);
/** /**
* Verifying if a ( automatism ) expression exists * Verifying if a ( behavior ) expression exists
* @return true if the ( automatism ) expression exists * @return true if the ( behavior ) expression exists
*/ */
static bool HasAutomatismExpression(const gd::Platform & platform, gd::String automatismType, gd::String name); static bool HasBehaviorExpression(const gd::Platform & platform, gd::String behaviorType, gd::String name);
/** /**
* Verifying if a ( static ) gd::String expression exists * Verifying if a ( static ) gd::String expression exists
@@ -153,13 +153,13 @@ public:
* Verifying if a ( object ) gd::String expression exists * Verifying if a ( object ) gd::String expression exists
* @return true if the ( object ) gd::String expression exists * @return true if the ( object ) gd::String expression exists
*/ */
static bool HasAutomatismStrExpression(const gd::Platform & platform, gd::String automatismType, gd::String name); static bool HasBehaviorStrExpression(const gd::Platform & platform, gd::String behaviorType, gd::String name);
virtual ~MetadataProvider(); virtual ~MetadataProvider();
private: private:
MetadataProvider(); MetadataProvider();
static AutomatismMetadata badAutomatismInfo; static BehaviorMetadata badBehaviorInfo;
static ObjectMetadata badObjectInfo; static ObjectMetadata badObjectInfo;
static gd::InstructionMetadata badInstructionMetadata; static gd::InstructionMetadata badInstructionMetadata;
static gd::ExpressionMetadata badExpressionMetadata; static gd::ExpressionMetadata badExpressionMetadata;

View File

@@ -1,84 +0,0 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#ifndef AUTOMATISMSSHAREDDATA_H
#define AUTOMATISMSSHAREDDATA_H
#include <memory>
#include "GDCore/String.h"
class AutomatismsRuntimeSharedData;
namespace gd { class SerializerElement; }
namespace gd
{
/**
* \brief Base class for defining data shared by automatisms having the same type and name.
*
* Automatisms can use shared data, as if they were extending the gd::Layout class.
*
* \note GD C++ Platform extensions writers : Inherit from this class, and redefine Clone and CreateRuntimeSharedDatas.
*
* \ingroup GameEngine
*/
class GD_CORE_API AutomatismsSharedData
{
public:
AutomatismsSharedData() {};
virtual ~AutomatismsSharedData();
virtual std::shared_ptr<gd::AutomatismsSharedData> Clone() const { return std::shared_ptr<gd::AutomatismsSharedData>(new AutomatismsSharedData(*this));}
/**
* \brief Change the name identifying the automatism.
*/
void SetName(gd::String name_) { name = name_; };
/**
* \brief Return the name identifying the automatism
*/
gd::String GetName() { return name; }
/**
* \brief Return the name identifying the type of the automatism
*/
gd::String GetTypeName() { return type; }
/**
* \brief Change name identifying the type of the automatism.
*/
virtual void SetTypeName(const gd::String & type_) { type = type_; };
#if defined(GD_IDE_ONLY)
/**
* \brief Serialize automatisms shared data.
*/
virtual void SerializeTo(SerializerElement & element) const {};
#endif
/**
* \brief Unserialize the automatisms shared data.
*/
virtual void UnserializeFrom(const SerializerElement & element) {};
//TODO : GD C++ Platform specific code :
/**
* Create Runtime equivalent of the shared datas.
* Derived class have to redefine this so as to create an appropriate
* object containing runtime shared datas.
*/
virtual std::shared_ptr<AutomatismsRuntimeSharedData> CreateRuntimeSharedDatas()
{
return std::shared_ptr<AutomatismsRuntimeSharedData>();
}
private:
gd::String name; ///< A layout can have some automatisms with the same type, but with different names.
gd::String type; ///< The type indicate of which type is the automatism.
};
}
#endif // AUTOMATISMSSHAREDDATA_H

View File

@@ -4,18 +4,18 @@
* This project is released under the MIT License. * This project is released under the MIT License.
*/ */
#include <iostream> #include <iostream>
#include "GDCore/PlatformDefinition/Automatism.h" #include "GDCore/PlatformDefinition/Behavior.h"
#include "GDCore/IDE/Dialogs/PropertyDescriptor.h" #include "GDCore/IDE/Dialogs/PropertyDescriptor.h"
namespace gd namespace gd
{ {
Automatism::~Automatism() Behavior::~Behavior()
{ {
}; };
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
std::map<gd::String, gd::PropertyDescriptor> Automatism::GetProperties(gd::Project & project) const std::map<gd::String, gd::PropertyDescriptor> Behavior::GetProperties(gd::Project & project) const
{ {
std::map<gd::String, gd::PropertyDescriptor> nothing; std::map<gd::String, gd::PropertyDescriptor> nothing;
return nothing; return nothing;

View File

@@ -3,8 +3,8 @@
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved. * Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License. * This project is released under the MIT License.
*/ */
#ifndef GDCORE_AUTOMATISM_H #ifndef GDCORE_BEHAVIOR_H
#define GDCORE_AUTOMATISM_H #define GDCORE_BEHAVIOR_H
#include "GDCore/String.h" #include "GDCore/String.h"
#include <map> #include <map>
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
@@ -22,48 +22,48 @@ namespace gd
{ {
/** /**
* \brief Base class used to represents an automatism that can be applied to an object * \brief Base class used to represents an behavior that can be applied to an object
* *
* \ingroup PlatformDefinition * \ingroup PlatformDefinition
*/ */
class GD_CORE_API Automatism class GD_CORE_API Behavior
{ {
public: public:
Automatism() : activated(true) {}; Behavior() : activated(true) {};
virtual ~Automatism(); virtual ~Behavior();
virtual Automatism* Clone() const { return new Automatism(*this);} virtual Behavior* Clone() const { return new Behavior(*this);}
/** /**
* \brief Change the name identifying the automatism. * \brief Change the name identifying the behavior.
*/ */
virtual void SetName(const gd::String & name_) { name = name_; }; virtual void SetName(const gd::String & name_) { name = name_; };
/** /**
* \brief Return the name identifying the automatism * \brief Return the name identifying the behavior
*/ */
virtual const gd::String & GetName() const { return name; } virtual const gd::String & GetName() const { return name; }
/** /**
* \brief Return the name identifying the type of the automatism * \brief Return the name identifying the type of the behavior
*/ */
virtual const gd::String & GetTypeName() const { return type; } virtual const gd::String & GetTypeName() const { return type; }
/** /**
* \brief Change name identifying the type of the automatism. * \brief Change name identifying the type of the behavior.
* *
* You should not need to use this method: The type is set by the IDE when the automatism is created * You should not need to use this method: The type is set by the IDE when the behavior is created
* or when the automatism is loaded from xml. * or when the behavior is loaded from xml.
*/ */
virtual void SetTypeName(const gd::String & type_) { type = type_; }; virtual void SetTypeName(const gd::String & type_) { type = type_; };
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
/** /**
* \brief Called when user wants to edit the automatism. * \brief Called when user wants to edit the behavior.
*/ */
virtual void EditAutomatism( wxWindow* parent, gd::Project & project, gd::Layout * optionalLayout, gd::MainFrameWrapper & mainFrameWrapper_ ) {}; virtual void EditBehavior( wxWindow* parent, gd::Project & project, gd::Layout * optionalLayout, gd::MainFrameWrapper & mainFrameWrapper_ ) {};
/** /**
* \brief Called when the IDE wants to know about the custom properties of the automatism. * \brief Called when the IDE wants to know about the custom properties of the behavior.
* *
* Usage example: * Usage example:
\code \code
@@ -79,7 +79,7 @@ public:
virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties(gd::Project & project) const; virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties(gd::Project & project) const;
/** /**
* \brief Called when the IDE wants to update a custom property of the automatism * \brief Called when the IDE wants to update a custom property of the behavior
* *
* \return false if the new value cannot be set * \return false if the new value cannot be set
* \see gd::InitialInstance * \see gd::InitialInstance
@@ -87,24 +87,24 @@ public:
virtual bool UpdateProperty(const gd::String & name, const gd::String & value, gd::Project & project) {return false;}; virtual bool UpdateProperty(const gd::String & name, const gd::String & value, gd::Project & project) {return false;};
/** /**
* \brief Serialize the automatism. * \brief Serialize the behavior.
*/ */
virtual void SerializeTo(gd::SerializerElement & element) const {}; virtual void SerializeTo(gd::SerializerElement & element) const {};
#endif #endif
/** /**
* \brief Unserialize the automatism. * \brief Unserialize the behavior.
*/ */
virtual void UnserializeFrom(const gd::SerializerElement & element) {}; virtual void UnserializeFrom(const gd::SerializerElement & element) {};
/** \name C++ Platform specific /** \name C++ Platform specific
* Members functions related to automatisms of GD C++ Platform. * Members functions related to behaviors of GD C++ Platform.
* Should be moved to a separate RuntimeAutomatism class in GDCpp. * Should be moved to a separate RuntimeBehavior class in GDCpp.
*/ */
///@{ ///@{
/** /**
* Set the object owning this automatism * Set the object owning this behavior
*/ */
void SetOwner(RuntimeObject* owner_) { object = owner_; OnOwnerChanged(); }; void SetOwner(RuntimeObject* owner_) { object = owner_; OnOwnerChanged(); };
@@ -119,21 +119,21 @@ public:
inline void StepPostEvents(RuntimeScene & scene) { if (activated) DoStepPostEvents(scene); }; inline void StepPostEvents(RuntimeScene & scene) { if (activated) DoStepPostEvents(scene); };
/** /**
* De/Activate the automatism * De/Activate the behavior
*/ */
inline void Activate(bool enable = true) { if ( !activated && enable ) { activated = true; OnActivate(); } else if ( activated && !enable ) { activated = false; OnDeActivate(); } }; inline void Activate(bool enable = true) { if ( !activated && enable ) { activated = true; OnActivate(); } else if ( activated && !enable ) { activated = false; OnDeActivate(); } };
/** /**
* Return true if the automatism is activated * Return true if the behavior is activated
*/ */
inline bool Activated() const { return activated; }; inline bool Activated() const { return activated; };
/** /**
* Reimplement this method to do extra work when the automatism is activated * Reimplement this method to do extra work when the behavior is activated
*/ */
virtual void OnActivate() {}; virtual void OnActivate() {};
/** /**
* Reimplement this method to do extra work when the automatism is deactivated * Reimplement this method to do extra work when the behavior is deactivated
*/ */
virtual void OnDeActivate() {}; virtual void OnDeActivate() {};
@@ -141,11 +141,11 @@ public:
protected: protected:
gd::String name; ///< Name of the automatism gd::String name; ///< Name of the behavior
gd::String type; ///< The type indicate of which type is the automatism. ( To test if we can do something, like actions, reserved to specific automatism with it ) gd::String type; ///< The type indicate of which type is the behavior. ( To test if we can do something, like actions, reserved to specific behavior with it )
////// //////
//TODO : C++ Platform specific code below : To be put in a RuntimeAutomatism class //TODO : C++ Platform specific code below : To be put in a RuntimeBehavior class
/** /**
* Called at each frame before events * Called at each frame before events
@@ -162,10 +162,10 @@ protected:
*/ */
virtual void OnOwnerChanged() {}; virtual void OnOwnerChanged() {};
RuntimeObject* object; ///< Object owning the automatism RuntimeObject* object; ///< Object owning the behavior
bool activated; ///< True if automatism is running bool activated; ///< True if behavior is running
}; };
} }
#endif // GDCORE_AUTOMATISM_H #endif // GDCORE_BEHAVIOR_H

View File

@@ -4,12 +4,12 @@
* This project is released under the MIT License. * This project is released under the MIT License.
*/ */
#include "GDCore/PlatformDefinition/AutomatismsSharedData.h" #include "GDCore/PlatformDefinition/BehaviorsSharedData.h"
namespace gd namespace gd
{ {
AutomatismsSharedData::~AutomatismsSharedData() BehaviorsSharedData::~BehaviorsSharedData()
{ {
}; };

View File

@@ -0,0 +1,84 @@
/*
* GDevelop Core
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
* This project is released under the MIT License.
*/
#ifndef BEHAVIORSSHAREDDATA_H
#define BEHAVIORSSHAREDDATA_H
#include <memory>
#include "GDCore/String.h"
class BehaviorsRuntimeSharedData;
namespace gd { class SerializerElement; }
namespace gd
{
/**
* \brief Base class for defining data shared by behaviors having the same type and name.
*
* Behaviors can use shared data, as if they were extending the gd::Layout class.
*
* \note GD C++ Platform extensions writers : Inherit from this class, and redefine Clone and CreateRuntimeSharedDatas.
*
* \ingroup GameEngine
*/
class GD_CORE_API BehaviorsSharedData
{
public:
BehaviorsSharedData() {};
virtual ~BehaviorsSharedData();
virtual std::shared_ptr<gd::BehaviorsSharedData> Clone() const { return std::shared_ptr<gd::BehaviorsSharedData>(new BehaviorsSharedData(*this));}
/**
* \brief Change the name identifying the behavior.
*/
void SetName(gd::String name_) { name = name_; };
/**
* \brief Return the name identifying the behavior
*/
gd::String GetName() { return name; }
/**
* \brief Return the name identifying the type of the behavior
*/
gd::String GetTypeName() { return type; }
/**
* \brief Change name identifying the type of the behavior.
*/
virtual void SetTypeName(const gd::String & type_) { type = type_; };
#if defined(GD_IDE_ONLY)
/**
* \brief Serialize behaviors shared data.
*/
virtual void SerializeTo(SerializerElement & element) const {};
#endif
/**
* \brief Unserialize the behaviors shared data.
*/
virtual void UnserializeFrom(const SerializerElement & element) {};
//TODO : GD C++ Platform specific code :
/**
* Create Runtime equivalent of the shared datas.
* Derived class have to redefine this so as to create an appropriate
* object containing runtime shared datas.
*/
virtual std::shared_ptr<BehaviorsRuntimeSharedData> CreateRuntimeSharedDatas()
{
return std::shared_ptr<BehaviorsRuntimeSharedData>();
}
private:
gd::String name; ///< A layout can have some behaviors with the same type, but with different names.
gd::String type; ///< The type indicate of which type is the behavior.
};
}
#endif // BEHAVIORSSHAREDDATA_H

View File

@@ -12,7 +12,7 @@ namespace gd { class Project; }
namespace gd { class Layout; } namespace gd { class Layout; }
namespace gd { class ExternalLayout; } namespace gd { class ExternalLayout; }
namespace gd { class Object; } namespace gd { class Object; }
namespace gd { class Automatism; } namespace gd { class Behavior; }
namespace gd { class ExternalEvents; } namespace gd { class ExternalEvents; }
namespace gd namespace gd
@@ -149,7 +149,7 @@ public:
virtual void OnEventsModified(gd::Project & project, gd::ExternalEvents & events, bool indirectChange = false, gd::String sourceOfTheIndirectChange = "") const {}; virtual void OnEventsModified(gd::Project & project, gd::ExternalEvents & events, bool indirectChange = false, gd::String sourceOfTheIndirectChange = "") const {};
///@} ///@}
/** \name Objects and automatisms notifications /** \name Objects and behaviors notifications
* Members functions called by the IDE so as to notify changes have been made * Members functions called by the IDE so as to notify changes have been made
*/ */
///@{ ///@{
@@ -196,41 +196,41 @@ public:
virtual void OnObjectVariablesChanged(gd::Project & project, gd::Layout * layout, gd::Object & object) const {}; virtual void OnObjectVariablesChanged(gd::Project & project, gd::Layout * layout, gd::Object & object) const {};
/** /**
* \brief Called when an automatism have been edited * \brief Called when an behavior have been edited
* \param project Related project * \param project Related project
* \param layout Related layout ( can be NULL ) * \param layout Related layout ( can be NULL )
* \param object Related object * \param object Related object
* \param automatism Automatism * \param behavior Behavior
*/ */
virtual void OnAutomatismEdited(gd::Project & project, gd::Layout * layout, gd::Object & object, gd::Automatism & automatism) const {}; virtual void OnBehaviorEdited(gd::Project & project, gd::Layout * layout, gd::Object & object, gd::Behavior & behavior) const {};
/** /**
* \brief Called when an automatism have been added * \brief Called when an behavior have been added
* \param project Related project * \param project Related project
* \param layout Related layout ( can be NULL ) * \param layout Related layout ( can be NULL )
* \param object Related object * \param object Related object
* \param automatism Automatism * \param behavior Behavior
*/ */
virtual void OnAutomatismAdded(gd::Project & project, gd::Layout * layout, gd::Object & object, gd::Automatism & automatism) const {}; virtual void OnBehaviorAdded(gd::Project & project, gd::Layout * layout, gd::Object & object, gd::Behavior & behavior) const {};
/** /**
* \brief Called when an automatism have been renamed * \brief Called when an behavior have been renamed
* \param project Related project * \param project Related project
* \param layout Related layout ( can be NULL ) * \param layout Related layout ( can be NULL )
* \param object Related object * \param object Related object
* \param automatism Automatism * \param behavior Behavior
* \param oldName Automatism old name * \param oldName Behavior old name
*/ */
virtual void OnAutomatismRenamed(gd::Project & project, gd::Layout * layout, gd::Object & object, gd::Automatism & automatism, const gd::String & oldName) const {}; virtual void OnBehaviorRenamed(gd::Project & project, gd::Layout * layout, gd::Object & object, gd::Behavior & behavior, const gd::String & oldName) const {};
/** /**
* \brief Called when an automatism have been deleted * \brief Called when an behavior have been deleted
* \param project Related project * \param project Related project
* \param layout Related layout ( can be NULL ) * \param layout Related layout ( can be NULL )
* \param object Related object * \param object Related object
* \param automatismName The name of the automatism removed * \param behaviorName The name of the behavior removed
*/ */
virtual void OnAutomatismDeleted(gd::Project & project, gd::Layout * layout, gd::Object & object, const gd::String & automatismName) const {}; virtual void OnBehaviorDeleted(gd::Project & project, gd::Layout * layout, gd::Object & object, const gd::String & behaviorName) const {};
/** /**
* \brief Called when a group have been added * \brief Called when a group have been added
@@ -268,7 +268,7 @@ public:
/** /**
* \brief Called when a resource have been added/removed/modified * \brief Called when a resource have been added/removed/modified
* \param project Related project * \param project Related project
* \param automatismName The name of the resource which have been modified * \param behaviorName The name of the resource which have been modified
*/ */
virtual void OnResourceModified(gd::Project & project, const gd::String & resourceName) const {}; virtual void OnResourceModified(gd::Project & project, const gd::String & resourceName) const {};

View File

@@ -12,10 +12,10 @@
#include "GDCore/PlatformDefinition/Project.h" #include "GDCore/PlatformDefinition/Project.h"
#include "GDCore/PlatformDefinition/Object.h" #include "GDCore/PlatformDefinition/Object.h"
#include "GDCore/PlatformDefinition/Layer.h" #include "GDCore/PlatformDefinition/Layer.h"
#include "GDCore/PlatformDefinition/Automatism.h" #include "GDCore/PlatformDefinition/Behavior.h"
#include "GDCore/PlatformDefinition/ObjectGroup.h" #include "GDCore/PlatformDefinition/ObjectGroup.h"
#include "GDCore/PlatformDefinition/InitialInstance.h" #include "GDCore/PlatformDefinition/InitialInstance.h"
#include "GDCore/PlatformDefinition/AutomatismsSharedData.h" #include "GDCore/PlatformDefinition/BehaviorsSharedData.h"
#include "GDCore/IDE/SceneNameMangler.h" #include "GDCore/IDE/SceneNameMangler.h"
#include "GDCore/Events/Serialization.h" #include "GDCore/Events/Serialization.h"
#include "GDCore/Serialization/SerializerElement.h" #include "GDCore/Serialization/SerializerElement.h"
@@ -153,43 +153,43 @@ void Layout::SwapLayers(unsigned int firstLayerIndex, unsigned int secondLayerIn
initialLayers[secondLayerIndex] = temp; initialLayers[secondLayerIndex] = temp;
} }
void Layout::UpdateAutomatismsSharedData(gd::Project & project) void Layout::UpdateBehaviorsSharedData(gd::Project & project)
{ {
std::vector < gd::String > allAutomatismsTypes; std::vector < gd::String > allBehaviorsTypes;
std::vector < gd::String > allAutomatismsNames; std::vector < gd::String > allBehaviorsNames;
//Search in objects for the type and the name of every automatisms. //Search in objects for the type and the name of every behaviors.
for (unsigned int i = 0;i<initialObjects.size();++i) for (unsigned int i = 0;i<initialObjects.size();++i)
{ {
std::vector < gd::String > objectAutomatisms = initialObjects[i]->GetAllAutomatismNames(); std::vector < gd::String > objectBehaviors = initialObjects[i]->GetAllBehaviorNames();
for (unsigned int j = 0;j<objectAutomatisms.size();++j) for (unsigned int j = 0;j<objectBehaviors.size();++j)
{ {
gd::Automatism & automatism = initialObjects[i]->GetAutomatism(objectAutomatisms[j]); gd::Behavior & behavior = initialObjects[i]->GetBehavior(objectBehaviors[j]);
allAutomatismsTypes.push_back(automatism.GetTypeName()); allBehaviorsTypes.push_back(behavior.GetTypeName());
allAutomatismsNames.push_back(automatism.GetName()); allBehaviorsNames.push_back(behavior.GetName());
} }
} }
for (unsigned int i = 0;i<project.GetObjectsCount();++i) for (unsigned int i = 0;i<project.GetObjectsCount();++i)
{ {
std::vector < gd::String > objectAutomatisms = project.GetObject(i).GetAllAutomatismNames(); std::vector < gd::String > objectBehaviors = project.GetObject(i).GetAllBehaviorNames();
for (unsigned int j = 0;j<objectAutomatisms.size();++j) for (unsigned int j = 0;j<objectBehaviors.size();++j)
{ {
gd::Automatism & automatism = project.GetObject(i).GetAutomatism(objectAutomatisms[j]); gd::Behavior & behavior = project.GetObject(i).GetBehavior(objectBehaviors[j]);
allAutomatismsTypes.push_back(automatism.GetTypeName()); allBehaviorsTypes.push_back(behavior.GetTypeName());
allAutomatismsNames.push_back(automatism.GetName()); allBehaviorsNames.push_back(behavior.GetName());
} }
} }
//Create non existing shared data //Create non existing shared data
for (unsigned int i = 0;i<allAutomatismsTypes.size() && i < allAutomatismsNames.size();++i) for (unsigned int i = 0;i<allBehaviorsTypes.size() && i < allBehaviorsNames.size();++i)
{ {
if ( automatismsInitialSharedDatas.find(allAutomatismsNames[i]) == automatismsInitialSharedDatas.end() ) if ( behaviorsInitialSharedDatas.find(allBehaviorsNames[i]) == behaviorsInitialSharedDatas.end() )
{ {
std::shared_ptr<gd::AutomatismsSharedData> automatismsSharedDatas = project.CreateAutomatismSharedDatas(allAutomatismsTypes[i]); std::shared_ptr<gd::BehaviorsSharedData> behaviorsSharedDatas = project.CreateBehaviorSharedDatas(allBehaviorsTypes[i]);
if ( automatismsSharedDatas ) if ( behaviorsSharedDatas )
{ {
automatismsSharedDatas->SetName(allAutomatismsNames[i]); behaviorsSharedDatas->SetName(allBehaviorsNames[i]);
automatismsInitialSharedDatas[automatismsSharedDatas->GetName()] = automatismsSharedDatas; behaviorsInitialSharedDatas[behaviorsSharedDatas->GetName()] = behaviorsSharedDatas;
} }
} }
} }
@@ -197,17 +197,17 @@ void Layout::UpdateAutomatismsSharedData(gd::Project & project)
//Remove useless shared data: //Remove useless shared data:
//First construct the list of existing shared data. //First construct the list of existing shared data.
std::vector < gd::String > allSharedData; std::vector < gd::String > allSharedData;
for (std::map < gd::String, std::shared_ptr<gd::AutomatismsSharedData> >::const_iterator it = automatismsInitialSharedDatas.begin(); for (std::map < gd::String, std::shared_ptr<gd::BehaviorsSharedData> >::const_iterator it = behaviorsInitialSharedDatas.begin();
it != automatismsInitialSharedDatas.end();++it) it != behaviorsInitialSharedDatas.end();++it)
{ {
allSharedData.push_back(it->first); allSharedData.push_back(it->first);
} }
//Then delete shared data not linked to an automatism //Then delete shared data not linked to an behavior
for (unsigned int i = 0;i<allSharedData.size();++i) for (unsigned int i = 0;i<allSharedData.size();++i)
{ {
if ( std::find(allAutomatismsNames.begin(), allAutomatismsNames.end(), allSharedData[i]) == allAutomatismsNames.end() ) if ( std::find(allBehaviorsNames.begin(), allBehaviorsNames.end(), allSharedData[i]) == allBehaviorsNames.end() )
automatismsInitialSharedDatas.erase(allSharedData[i]); behaviorsInitialSharedDatas.erase(allSharedData[i]);
} }
} }
@@ -241,12 +241,12 @@ void Layout::SerializeTo(SerializerElement & element) const
for ( unsigned int j = 0;j < GetLayersCount();++j ) for ( unsigned int j = 0;j < GetLayersCount();++j )
GetLayer(j).SerializeTo(layersElement.AddChild("layer")); GetLayer(j).SerializeTo(layersElement.AddChild("layer"));
SerializerElement & automatismDatasElement = element.AddChild("automatismsSharedData"); SerializerElement & behaviorDatasElement = element.AddChild("behaviorsSharedData");
automatismDatasElement.ConsiderAsArrayOf("automatismSharedData"); behaviorDatasElement.ConsiderAsArrayOf("behaviorSharedData");
for (std::map<gd::String, std::shared_ptr<gd::AutomatismsSharedData> >::const_iterator it = automatismsInitialSharedDatas.begin(); for (std::map<gd::String, std::shared_ptr<gd::BehaviorsSharedData> >::const_iterator it = behaviorsInitialSharedDatas.begin();
it != automatismsInitialSharedDatas.end();++it) it != behaviorsInitialSharedDatas.end();++it)
{ {
SerializerElement & dataElement = automatismDatasElement.AddChild("automatismSharedData"); SerializerElement & dataElement = behaviorDatasElement.AddChild("behaviorSharedData");
dataElement.SetAttribute("type", it->second->GetTypeName()); dataElement.SetAttribute("type", it->second->GetTypeName());
dataElement.SetAttribute("name", it->second->GetName()); dataElement.SetAttribute("name", it->second->GetName());
@@ -290,20 +290,20 @@ void Layout::UnserializeFrom(gd::Project & project, const SerializerElement & el
initialLayers.push_back(layer); initialLayers.push_back(layer);
} }
SerializerElement & automatismsDataElement = element.GetChild("automatismsSharedData", 0, "AutomatismsSharedDatas"); SerializerElement & behaviorsDataElement = element.GetChild("behaviorsSharedData", 0, "BehaviorsSharedDatas");
automatismsDataElement.ConsiderAsArrayOf("automatismSharedData", "AutomatismSharedDatas"); behaviorsDataElement.ConsiderAsArrayOf("behaviorSharedData", "BehaviorSharedDatas");
for (unsigned int i = 0; i < automatismsDataElement.GetChildrenCount(); ++i) for (unsigned int i = 0; i < behaviorsDataElement.GetChildrenCount(); ++i)
{ {
SerializerElement & automatismDataElement = automatismsDataElement.GetChild(i); SerializerElement & behaviorDataElement = behaviorsDataElement.GetChild(i);
gd::String type = automatismDataElement.GetStringAttribute("type", "", "Type"); gd::String type = behaviorDataElement.GetStringAttribute("type", "", "Type");
std::shared_ptr<gd::AutomatismsSharedData> sharedData = project.CreateAutomatismSharedDatas(type); std::shared_ptr<gd::BehaviorsSharedData> sharedData = project.CreateBehaviorSharedDatas(type);
if ( sharedData != std::shared_ptr<gd::AutomatismsSharedData>() ) if ( sharedData != std::shared_ptr<gd::BehaviorsSharedData>() )
{ {
sharedData->SetName( automatismDataElement.GetStringAttribute("name", "", "Name") ); sharedData->SetName( behaviorDataElement.GetStringAttribute("name", "", "Name") );
sharedData->UnserializeFrom(automatismDataElement); sharedData->UnserializeFrom(behaviorDataElement);
automatismsInitialSharedDatas[sharedData->GetName()] = sharedData; behaviorsInitialSharedDatas[sharedData->GetName()] = sharedData;
} }
} }
@@ -330,11 +330,11 @@ void Layout::Init(const Layout & other)
for (unsigned int i =0;i<other.initialObjects.size();++i) for (unsigned int i =0;i<other.initialObjects.size();++i)
initialObjects.push_back( std::shared_ptr<gd::Object>(other.initialObjects[i]->Clone()) ); initialObjects.push_back( std::shared_ptr<gd::Object>(other.initialObjects[i]->Clone()) );
automatismsInitialSharedDatas.clear(); behaviorsInitialSharedDatas.clear();
for (std::map< gd::String, std::shared_ptr<gd::AutomatismsSharedData> >::const_iterator it = other.automatismsInitialSharedDatas.begin(); for (std::map< gd::String, std::shared_ptr<gd::BehaviorsSharedData> >::const_iterator it = other.behaviorsInitialSharedDatas.begin();
it != other.automatismsInitialSharedDatas.end();++it) it != other.behaviorsInitialSharedDatas.end();++it)
{ {
automatismsInitialSharedDatas[it->first] = it->second->Clone(); behaviorsInitialSharedDatas[it->first] = it->second->Clone();
} }
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
@@ -425,48 +425,48 @@ gd::String GD_CORE_API GetTypeOfObject(const gd::Project & project, const gd::La
return type; return type;
} }
gd::String GD_CORE_API GetTypeOfAutomatism(const gd::Project & project, const gd::Layout & layout, gd::String name, bool searchInGroups) gd::String GD_CORE_API GetTypeOfBehavior(const gd::Project & project, const gd::Layout & layout, gd::String name, bool searchInGroups)
{ {
for (unsigned int i = 0;i<layout.GetObjectsCount();++i) for (unsigned int i = 0;i<layout.GetObjectsCount();++i)
{ {
vector < gd::String > automatisms = layout.GetObject(i).GetAllAutomatismNames(); vector < gd::String > behaviors = layout.GetObject(i).GetAllBehaviorNames();
for (unsigned int j = 0;j<automatisms.size();++j) for (unsigned int j = 0;j<behaviors.size();++j)
{ {
if ( layout.GetObject(i).GetAutomatism(automatisms[j]).GetName() == name ) if ( layout.GetObject(i).GetBehavior(behaviors[j]).GetName() == name )
return layout.GetObject(i).GetAutomatism(automatisms[j]).GetTypeName(); return layout.GetObject(i).GetBehavior(behaviors[j]).GetTypeName();
} }
} }
for (unsigned int i = 0;i<project.GetObjectsCount();++i) for (unsigned int i = 0;i<project.GetObjectsCount();++i)
{ {
vector < gd::String > automatisms = project.GetObject(i).GetAllAutomatismNames(); vector < gd::String > behaviors = project.GetObject(i).GetAllBehaviorNames();
for (unsigned int j = 0;j<automatisms.size();++j) for (unsigned int j = 0;j<behaviors.size();++j)
{ {
if ( project.GetObject(i).GetAutomatism(automatisms[j]).GetName() == name ) if ( project.GetObject(i).GetBehavior(behaviors[j]).GetName() == name )
return project.GetObject(i).GetAutomatism(automatisms[j]).GetTypeName(); return project.GetObject(i).GetBehavior(behaviors[j]).GetTypeName();
} }
} }
return ""; return "";
} }
vector < gd::String > GD_CORE_API GetAutomatismsOfObject(const gd::Project & project, const gd::Layout & layout, gd::String name, bool searchInGroups) vector < gd::String > GD_CORE_API GetBehaviorsOfObject(const gd::Project & project, const gd::Layout & layout, gd::String name, bool searchInGroups)
{ {
bool automatismsAlreadyInserted = false; bool behaviorsAlreadyInserted = false;
vector < gd::String > automatisms; vector < gd::String > behaviors;
//Search in objects //Search in objects
if ( layout.HasObjectNamed(name) ) //We check first layout's objects' list. if ( layout.HasObjectNamed(name) ) //We check first layout's objects' list.
{ {
std::vector < gd::String > objectAutomatisms = layout.GetObject(name).GetAllAutomatismNames(); std::vector < gd::String > objectBehaviors = layout.GetObject(name).GetAllBehaviorNames();
std::copy(objectAutomatisms.begin(), objectAutomatisms.end(), back_inserter(automatisms)); std::copy(objectBehaviors.begin(), objectBehaviors.end(), back_inserter(behaviors));
automatismsAlreadyInserted = true; behaviorsAlreadyInserted = true;
} }
else if ( project.HasObjectNamed(name) ) //Then the global object list else if ( project.HasObjectNamed(name) ) //Then the global object list
{ {
vector < gd::String > objectAutomatisms = project.GetObject(name).GetAllAutomatismNames(); vector < gd::String > objectBehaviors = project.GetObject(name).GetAllBehaviorNames();
std::copy(objectAutomatisms.begin(), objectAutomatisms.end(), back_inserter(automatisms)); std::copy(objectBehaviors.begin(), objectBehaviors.end(), back_inserter(behaviors));
automatismsAlreadyInserted = true; behaviorsAlreadyInserted = true;
} }
//Search in groups //Search in groups
@@ -477,25 +477,25 @@ vector < gd::String > GD_CORE_API GetAutomatismsOfObject(const gd::Project & pro
if ( layout.GetObjectGroups()[i].GetName() == name ) if ( layout.GetObjectGroups()[i].GetName() == name )
{ {
//A group has the name searched //A group has the name searched
//Verifying now that all objects have common automatisms. //Verifying now that all objects have common behaviors.
vector < gd::String > groupsObjects = layout.GetObjectGroups()[i].GetAllObjectsNames(); vector < gd::String > groupsObjects = layout.GetObjectGroups()[i].GetAllObjectsNames();
for (unsigned int j = 0;j<groupsObjects.size();++j) for (unsigned int j = 0;j<groupsObjects.size();++j)
{ {
//Get automatisms of the object of the group and delete automatism which are not in commons. //Get behaviors of the object of the group and delete behavior which are not in commons.
vector < gd::String > objectAutomatisms = GetAutomatismsOfObject(project, layout, groupsObjects[j], false); vector < gd::String > objectBehaviors = GetBehaviorsOfObject(project, layout, groupsObjects[j], false);
if (!automatismsAlreadyInserted) if (!behaviorsAlreadyInserted)
{ {
automatismsAlreadyInserted = true; behaviorsAlreadyInserted = true;
automatisms = objectAutomatisms; behaviors = objectBehaviors;
} }
else else
{ {
for (unsigned int a = 0 ;a<automatisms.size();++a) for (unsigned int a = 0 ;a<behaviors.size();++a)
{ {
if ( find(objectAutomatisms.begin(), objectAutomatisms.end(), automatisms[a]) == objectAutomatisms.end() ) if ( find(objectBehaviors.begin(), objectBehaviors.end(), behaviors[a]) == objectBehaviors.end() )
{ {
automatisms.erase(automatisms.begin() + a); behaviors.erase(behaviors.begin() + a);
--a; --a;
} }
} }
@@ -508,25 +508,25 @@ vector < gd::String > GD_CORE_API GetAutomatismsOfObject(const gd::Project & pro
if ( project.GetObjectGroups()[i].GetName() == name ) if ( project.GetObjectGroups()[i].GetName() == name )
{ {
//A group has the name searched //A group has the name searched
//Verifying now that all objects have common automatisms. //Verifying now that all objects have common behaviors.
vector < gd::String > groupsObjects = project.GetObjectGroups()[i].GetAllObjectsNames(); vector < gd::String > groupsObjects = project.GetObjectGroups()[i].GetAllObjectsNames();
for (unsigned int j = 0;j<groupsObjects.size();++j) for (unsigned int j = 0;j<groupsObjects.size();++j)
{ {
//Get automatisms of the object of the group and delete automatism which are not in commons. //Get behaviors of the object of the group and delete behavior which are not in commons.
vector < gd::String > objectAutomatisms = GetAutomatismsOfObject(project, layout, groupsObjects[j], false); vector < gd::String > objectBehaviors = GetBehaviorsOfObject(project, layout, groupsObjects[j], false);
if (!automatismsAlreadyInserted) if (!behaviorsAlreadyInserted)
{ {
automatismsAlreadyInserted = true; behaviorsAlreadyInserted = true;
automatisms = objectAutomatisms; behaviors = objectBehaviors;
} }
else else
{ {
for (unsigned int a = 0 ;a<automatisms.size();++a) for (unsigned int a = 0 ;a<behaviors.size();++a)
{ {
if ( find(objectAutomatisms.begin(), objectAutomatisms.end(), automatisms[a]) == objectAutomatisms.end() ) if ( find(objectBehaviors.begin(), objectBehaviors.end(), behaviors[a]) == objectBehaviors.end() )
{ {
automatisms.erase(automatisms.begin() + a); behaviors.erase(behaviors.begin() + a);
--a; --a;
} }
} }
@@ -536,7 +536,7 @@ vector < gd::String > GD_CORE_API GetAutomatismsOfObject(const gd::Project & pro
} }
} }
return automatisms; return behaviors;
} }
#endif #endif

View File

@@ -13,7 +13,7 @@
#include "GDCore/Events/EventsList.h" #include "GDCore/Events/EventsList.h"
#include "GDCore/PlatformDefinition/ObjectGroup.h" #include "GDCore/PlatformDefinition/ObjectGroup.h"
#include "GDCore/PlatformDefinition/ClassWithObjects.h" #include "GDCore/PlatformDefinition/ClassWithObjects.h"
#include "GDCore/PlatformDefinition/AutomatismsSharedData.h" #include "GDCore/PlatformDefinition/BehaviorsSharedData.h"
#include "GDCore/PlatformDefinition/VariablesContainer.h" #include "GDCore/PlatformDefinition/VariablesContainer.h"
#include "GDCore/PlatformDefinition/InitialInstancesContainer.h" #include "GDCore/PlatformDefinition/InitialInstancesContainer.h"
#include "GDCore/PlatformDefinition/Layer.h" #include "GDCore/PlatformDefinition/Layer.h"
@@ -236,13 +236,13 @@ public:
/** /**
* Make sure that the scene had an instance of shared data for * Make sure that the scene had an instance of shared data for
* every automatism of every object that can be used on the scene * every behavior of every object that can be used on the scene
* ( i.e. the objects of the scene and the global objects ) * ( i.e. the objects of the scene and the global objects )
* *
* Must be called when an automatism have been added/deleted * Must be called when an behavior have been added/deleted
* or when a scene have been added to a project. * or when a scene have been added to a project.
*/ */
void UpdateAutomatismsSharedData(gd::Project & project); void UpdateBehaviorsSharedData(gd::Project & project);
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
/** /**
@@ -340,7 +340,7 @@ public:
///@} ///@}
//TODO: Send this to private part. //TODO: Send this to private part.
std::map < gd::String, std::shared_ptr<gd::AutomatismsSharedData> > automatismsInitialSharedDatas; ///< Initial shared datas of automatisms std::map < gd::String, std::shared_ptr<gd::BehaviorsSharedData> > behaviorsInitialSharedDatas; ///< Initial shared datas of behaviors
//TODO: GD C++ Platform specific code below //TODO: GD C++ Platform specific code below
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
@@ -477,18 +477,18 @@ std::vector<gd::String> GetHiddenLayers(const Layout & layout);
gd::String GD_CORE_API GetTypeOfObject(const Project & game, const Layout & layout, gd::String objectName, bool searchInGroups = true); gd::String GD_CORE_API GetTypeOfObject(const Project & game, const Layout & layout, gd::String objectName, bool searchInGroups = true);
/** /**
* \brief Get a type from an automatism name * \brief Get a type from an behavior name
* @return Type of the automatism. * @return Type of the behavior.
*/ */
gd::String GD_CORE_API GetTypeOfAutomatism(const Project & game, const Layout & layout, gd::String automatismName, bool searchInGroups = true); gd::String GD_CORE_API GetTypeOfBehavior(const Project & game, const Layout & layout, gd::String behaviorName, bool searchInGroups = true);
/** /**
* \brief Get automatisms of an object/group * \brief Get behaviors of an object/group
* \note The automatisms of a group are the automatisms which are found in common when looking all the objects of the group. * \note The behaviors of a group are the behaviors which are found in common when looking all the objects of the group.
* *
* @return Vector containing names of automatisms * @return Vector containing names of behaviors
*/ */
std::vector < gd::String > GD_CORE_API GetAutomatismsOfObject(const Project & game, const Layout & layout, gd::String objectName, bool searchInGroups = true); std::vector < gd::String > GD_CORE_API GetBehaviorsOfObject(const Project & game, const Layout & layout, gd::String objectName, bool searchInGroups = true);
} }

View File

@@ -4,7 +4,7 @@
* This project is released under the MIT License. * This project is released under the MIT License.
*/ */
#include "GDCore/PlatformDefinition/Object.h" #include "GDCore/PlatformDefinition/Object.h"
#include "GDCore/PlatformDefinition/Automatism.h" #include "GDCore/PlatformDefinition/Behavior.h"
#include "GDCore/PlatformDefinition/Platform.h" #include "GDCore/PlatformDefinition/Platform.h"
#include "GDCore/PlatformDefinition/Project.h" #include "GDCore/PlatformDefinition/Project.h"
#include "GDCore/PlatformDefinition/Layout.h" #include "GDCore/PlatformDefinition/Layout.h"
@@ -21,8 +21,8 @@ namespace gd
Object::~Object() Object::~Object()
{ {
//Do not forget to delete automatisms which are managed using raw pointers. //Do not forget to delete behaviors which are managed using raw pointers.
for (std::map<gd::String, Automatism* >::const_iterator it = automatisms.begin() ; it != automatisms.end(); ++it ) for (std::map<gd::String, Behavior* >::const_iterator it = behaviors.begin() ; it != behaviors.end(); ++it )
delete it->second; delete it->second;
} }
@@ -37,66 +37,66 @@ void Object::Init(const gd::Object & object)
type = object.type; type = object.type;
objectVariables = object.objectVariables; objectVariables = object.objectVariables;
//Do not forget to delete automatisms which are managed using raw pointers. //Do not forget to delete behaviors which are managed using raw pointers.
for (std::map<gd::String, Automatism* >::const_iterator it = automatisms.begin() ; it != automatisms.end(); ++it ) for (std::map<gd::String, Behavior* >::const_iterator it = behaviors.begin() ; it != behaviors.end(); ++it )
delete it->second; delete it->second;
automatisms.clear(); behaviors.clear();
for (std::map<gd::String, Automatism* >::const_iterator it = object.automatisms.begin() ; it != object.automatisms.end(); ++it ) for (std::map<gd::String, Behavior* >::const_iterator it = object.behaviors.begin() ; it != object.behaviors.end(); ++it )
automatisms[it->first] = it->second->Clone(); behaviors[it->first] = it->second->Clone();
} }
std::vector < gd::String > Object::GetAllAutomatismNames() const std::vector < gd::String > Object::GetAllBehaviorNames() const
{ {
std::vector < gd::String > allNameIdentifiers; std::vector < gd::String > allNameIdentifiers;
for (std::map<gd::String, Automatism* >::const_iterator it = automatisms.begin() ; it != automatisms.end(); ++it ) for (std::map<gd::String, Behavior* >::const_iterator it = behaviors.begin() ; it != behaviors.end(); ++it )
allNameIdentifiers.push_back(it->first); allNameIdentifiers.push_back(it->first);
return allNameIdentifiers; return allNameIdentifiers;
} }
void Object::RemoveAutomatism(const gd::String & name) void Object::RemoveBehavior(const gd::String & name)
{ {
//Do not forget to delete automatisms which are managed using raw pointers. //Do not forget to delete behaviors which are managed using raw pointers.
delete(automatisms[name]); delete(behaviors[name]);
automatisms.erase(name); behaviors.erase(name);
} }
bool Object::RenameAutomatism(const gd::String & name, const gd::String & newName) bool Object::RenameBehavior(const gd::String & name, const gd::String & newName)
{ {
if ( automatisms.find(name) == automatisms.end() if ( behaviors.find(name) == behaviors.end()
|| automatisms.find(newName) != automatisms.end() ) return false; || behaviors.find(newName) != behaviors.end() ) return false;
Automatism * aut = automatisms.find(name)->second; Behavior * aut = behaviors.find(name)->second;
automatisms.erase(name); behaviors.erase(name);
automatisms[newName] = aut; behaviors[newName] = aut;
aut->SetName(newName); aut->SetName(newName);
return true; return true;
} }
gd::Automatism & Object::GetAutomatism(const gd::String & name) gd::Behavior & Object::GetBehavior(const gd::String & name)
{ {
return *automatisms.find(name)->second; return *behaviors.find(name)->second;
} }
const gd::Automatism & Object::GetAutomatism(const gd::String & name) const const gd::Behavior & Object::GetBehavior(const gd::String & name) const
{ {
return *automatisms.find(name)->second; return *behaviors.find(name)->second;
} }
bool Object::HasAutomatismNamed(const gd::String & name) const bool Object::HasBehaviorNamed(const gd::String & name) const
{ {
return automatisms.find(name) != automatisms.end(); return behaviors.find(name) != behaviors.end();
} }
bool Object::AddAutomatism(Automatism * automatism) bool Object::AddBehavior(Behavior * behavior)
{ {
if (automatism && !HasAutomatismNamed(automatism->GetName())) { if (behavior && !HasBehaviorNamed(behavior->GetName())) {
automatisms[automatism->GetName()] = automatism; behaviors[behavior->GetName()] = behavior;
return true; return true;
} }
@@ -104,16 +104,16 @@ bool Object::AddAutomatism(Automatism * automatism)
} }
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
gd::Automatism * Object::AddNewAutomatism(gd::Project & project, const gd::String & type, const gd::String & name) gd::Behavior * Object::AddNewBehavior(gd::Project & project, const gd::String & type, const gd::String & name)
{ {
Automatism * automatism = project.GetCurrentPlatform().CreateAutomatism(type); Behavior * behavior = project.GetCurrentPlatform().CreateBehavior(type);
if ( automatism != NULL ) { if ( behavior != NULL ) {
automatism->SetName(name); behavior->SetName(name);
automatisms[automatism->GetName()] = automatism; behaviors[behavior->GetName()] = behavior;
} }
return automatism; return behavior;
} }
sf::Vector2f Object::GetInitialInstanceDefaultSize(gd::InitialInstance & instance, gd::Project & project, gd::Layout & layout) const sf::Vector2f Object::GetInitialInstanceDefaultSize(gd::InitialInstance & instance, gd::Project & project, gd::Layout & layout) const
@@ -154,47 +154,47 @@ void Object::UnserializeFrom(gd::Project & project, const SerializerElement & el
objectVariables.UnserializeFrom(element.GetChild("variables", 0, "Variables")); objectVariables.UnserializeFrom(element.GetChild("variables", 0, "Variables"));
//Compatibility with GD <= 3.3 //Compatibility with GD <= 3.3
if (element.HasChild("Automatism")) if (element.HasChild("Behavior"))
{ {
for (unsigned int i = 0; i < element.GetChildrenCount("Automatism"); ++i) for (unsigned int i = 0; i < element.GetChildrenCount("Behavior"); ++i)
{ {
SerializerElement & automatismElement = element.GetChild("Automatism", i); SerializerElement & behaviorElement = element.GetChild("Behavior", i);
gd::String autoType = automatismElement.GetStringAttribute("type", "", "Type"); gd::String autoType = behaviorElement.GetStringAttribute("type", "", "Type");
gd::String autoName = automatismElement.GetStringAttribute("name", "", "Name"); gd::String autoName = behaviorElement.GetStringAttribute("name", "", "Name");
Automatism* automatism = project.CreateAutomatism(autoType); Behavior* behavior = project.CreateBehavior(autoType);
if ( automatism != NULL ) if ( behavior != NULL )
{ {
automatism->SetName(autoName); behavior->SetName(autoName);
automatism->UnserializeFrom(automatismElement); behavior->UnserializeFrom(behaviorElement);
automatisms[automatism->GetName()] = automatism; behaviors[behavior->GetName()] = behavior;
} }
else else
std::cout << "WARNING: Unknown automatism " << automatismElement.GetStringAttribute("type") << std::endl; std::cout << "WARNING: Unknown behavior " << behaviorElement.GetStringAttribute("type") << std::endl;
} }
} }
//End of compatibility code //End of compatibility code
else else
{ {
SerializerElement & automatismsElement = element.GetChild("automatisms"); SerializerElement & behaviorsElement = element.GetChild("behaviors");
automatismsElement.ConsiderAsArrayOf("automatism"); behaviorsElement.ConsiderAsArrayOf("behavior");
for (unsigned int i = 0; i < automatismsElement.GetChildrenCount(); ++i) for (unsigned int i = 0; i < behaviorsElement.GetChildrenCount(); ++i)
{ {
SerializerElement & automatismElement = automatismsElement.GetChild(i); SerializerElement & behaviorElement = behaviorsElement.GetChild(i);
gd::String autoType = automatismElement.GetStringAttribute("type"); gd::String autoType = behaviorElement.GetStringAttribute("type");
gd::String autoName = automatismElement.GetStringAttribute("name"); gd::String autoName = behaviorElement.GetStringAttribute("name");
Automatism* automatism = project.CreateAutomatism(autoType); Behavior* behavior = project.CreateBehavior(autoType);
if ( automatism != NULL ) if ( behavior != NULL )
{ {
automatism->SetName(autoName); behavior->SetName(autoName);
automatism->UnserializeFrom(automatismElement); behavior->UnserializeFrom(behaviorElement);
automatisms[automatism->GetName()] = automatism; behaviors[behavior->GetName()] = behavior;
} }
else else
std::cout << "WARNING: Unknown automatism " << automatismElement.GetStringAttribute("type") << std::endl; std::cout << "WARNING: Unknown behavior " << behaviorElement.GetStringAttribute("type") << std::endl;
} }
} }
@@ -208,16 +208,16 @@ void Object::SerializeTo(SerializerElement & element) const
element.SetAttribute( "type", GetType() ); element.SetAttribute( "type", GetType() );
objectVariables.SerializeTo(element.AddChild("variables")); objectVariables.SerializeTo(element.AddChild("variables"));
SerializerElement & automatismsElement = element.AddChild("automatisms"); SerializerElement & behaviorsElement = element.AddChild("behaviors");
automatismsElement.ConsiderAsArrayOf("automatism"); behaviorsElement.ConsiderAsArrayOf("behavior");
std::vector < gd::String > allAutomatisms = GetAllAutomatismNames(); std::vector < gd::String > allBehaviors = GetAllBehaviorNames();
for (unsigned int i = 0;i<allAutomatisms.size();++i) for (unsigned int i = 0;i<allBehaviors.size();++i)
{ {
SerializerElement & automatismElement = automatismsElement.AddChild("automatism"); SerializerElement & behaviorElement = behaviorsElement.AddChild("behavior");
automatismElement.SetAttribute( "type", GetAutomatism(allAutomatisms[i]).GetTypeName() ); behaviorElement.SetAttribute( "type", GetBehavior(allBehaviors[i]).GetTypeName() );
automatismElement.SetAttribute( "name", GetAutomatism(allAutomatisms[i]).GetName() ); behaviorElement.SetAttribute( "name", GetBehavior(allBehaviors[i]).GetName() );
GetAutomatism(allAutomatisms[i]).SerializeTo(automatismElement); GetBehavior(allBehaviors[i]).SerializeTo(behaviorElement);
} }
DoSerializeTo(element); DoSerializeTo(element);

View File

@@ -12,7 +12,7 @@
#include "GDCore/PlatformDefinition/VariablesContainer.h" #include "GDCore/PlatformDefinition/VariablesContainer.h"
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
namespace gd { class PropertyDescriptor; } namespace gd { class PropertyDescriptor; }
namespace gd { class Automatism; } namespace gd { class Behavior; }
namespace gd { class Project; } namespace gd { class Project; }
namespace gd { class Layout; } namespace gd { class Layout; }
namespace gd { class MainFrameWrapper; } namespace gd { class MainFrameWrapper; }
@@ -177,64 +177,64 @@ public:
///@} ///@}
#endif #endif
/** \name Automatisms management /** \name Behaviors management
* Members functions related to automatisms management. * Members functions related to behaviors management.
*/ */
///@{ ///@{
/** /**
* \brief Return a vector containing the names of all the automatisms used by the object * \brief Return a vector containing the names of all the behaviors used by the object
*/ */
std::vector < gd::String > GetAllAutomatismNames() const; std::vector < gd::String > GetAllBehaviorNames() const;
/** /**
* \brief Return a reference to the automatism called \a name. * \brief Return a reference to the behavior called \a name.
*/ */
Automatism & GetAutomatism(const gd::String & name); Behavior & GetBehavior(const gd::String & name);
/** /**
* \brief Return a reference to the automatism called \a name. * \brief Return a reference to the behavior called \a name.
*/ */
const Automatism & GetAutomatism(const gd::String & name) const; const Behavior & GetBehavior(const gd::String & name) const;
/** /**
* \brief Return true if object has an automatism called \a name. * \brief Return true if object has an behavior called \a name.
*/ */
bool HasAutomatismNamed(const gd::String & name) const; bool HasBehaviorNamed(const gd::String & name) const;
/** /**
* \brief Remove automatism called \a name * \brief Remove behavior called \a name
*/ */
void RemoveAutomatism(const gd::String & name); void RemoveBehavior(const gd::String & name);
/** /**
* \brief Change the name of automatism called name to newName. * \brief Change the name of behavior called name to newName.
* \return true if name was successfully changed * \return true if name was successfully changed
*/ */
bool RenameAutomatism(const gd::String & name, const gd::String & newName); bool RenameBehavior(const gd::String & name, const gd::String & newName);
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
/** /**
* \brief Add the automatism of the specified \a type with the specified \a name. * \brief Add the behavior of the specified \a type with the specified \a name.
* *
* The project's current platform is used to create the automatism. * The project's current platform is used to create the behavior.
* *
* \return A pointer to the newly added automatism. NULL if the creation failed. * \return A pointer to the newly added behavior. NULL if the creation failed.
*/ */
gd::Automatism * AddNewAutomatism(gd::Project & project, const gd::String & type, const gd::String & name); gd::Behavior * AddNewBehavior(gd::Project & project, const gd::String & type, const gd::String & name);
#endif #endif
/** /**
* \brief Add the specified automatism to the object * \brief Add the specified behavior to the object
* \note The object takes ownership of the automatism. * \note The object takes ownership of the behavior.
* \return true if the automatism was added, false otherwise (automatism with the same name already in the object) * \return true if the behavior was added, false otherwise (behavior with the same name already in the object)
*/ */
bool AddAutomatism(gd::Automatism * automatism); bool AddBehavior(gd::Behavior * behavior);
/** /**
* \brief Get a read-only access to the map containing the automatisms. * \brief Get a read-only access to the map containing the behaviors.
*/ */
const std::map<gd::String, gd::Automatism* > & GetAllAutomatisms() const {return automatisms;}; const std::map<gd::String, gd::Behavior* > & GetAllBehaviors() const {return behaviors;};
///@} ///@}
/** \name Variable management /** \name Variable management
@@ -274,7 +274,7 @@ public:
protected: protected:
gd::String name; ///< The full name of the object gd::String name; ///< The full name of the object
gd::String type; ///< Which type is the object. ( To test if we can do something reserved to some objects with it ) gd::String type; ///< Which type is the object. ( To test if we can do something reserved to some objects with it )
std::map<gd::String, gd::Automatism* > automatisms; ///<Contains all automatisms of the object. Automatisms are the ownership of the object std::map<gd::String, gd::Behavior* > behaviors; ///<Contains all behaviors of the object. Behaviors are the ownership of the object
gd::VariablesContainer objectVariables; ///<List of the variables of the object gd::VariablesContainer objectVariables; ///<List of the variables of the object
/** /**

View File

@@ -95,28 +95,28 @@ std::shared_ptr<gd::Object> Platform::CreateObject(gd::String type, const gd::St
return std::shared_ptr<gd::Object> (object); return std::shared_ptr<gd::Object> (object);
} }
gd::Automatism* Platform::CreateAutomatism(const gd::String & automatismType) const gd::Behavior* Platform::CreateBehavior(const gd::String & behaviorType) const
{ {
for (unsigned int i =0;i<extensionsLoaded.size();++i) for (unsigned int i =0;i<extensionsLoaded.size();++i)
{ {
Automatism* automatism = extensionsLoaded[i]->CreateAutomatism(automatismType); Behavior* behavior = extensionsLoaded[i]->CreateBehavior(behaviorType);
if ( automatism != NULL ) if ( behavior != NULL )
return automatism; return behavior;
} }
return NULL; return NULL;
} }
std::shared_ptr<gd::AutomatismsSharedData> Platform::CreateAutomatismSharedDatas(const gd::String & automatismType) const std::shared_ptr<gd::BehaviorsSharedData> Platform::CreateBehaviorSharedDatas(const gd::String & behaviorType) const
{ {
for (unsigned int i =0;i<extensionsLoaded.size();++i) for (unsigned int i =0;i<extensionsLoaded.size();++i)
{ {
std::shared_ptr<gd::AutomatismsSharedData> automatism = extensionsLoaded[i]->CreateAutomatismSharedDatas(automatismType); std::shared_ptr<gd::BehaviorsSharedData> behavior = extensionsLoaded[i]->CreateBehaviorSharedDatas(behaviorType);
if ( automatism != std::shared_ptr<gd::AutomatismsSharedData>() ) if ( behavior != std::shared_ptr<gd::BehaviorsSharedData>() )
return automatism; return behavior;
} }
return std::shared_ptr<gd::AutomatismsSharedData>(); return std::shared_ptr<gd::BehaviorsSharedData>();
} }
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)

View File

@@ -15,11 +15,11 @@
namespace gd { class InstructionsMetadataHolder; } namespace gd { class InstructionsMetadataHolder; }
namespace gd { class Project; } namespace gd { class Project; }
namespace gd { class Object; } namespace gd { class Object; }
namespace gd { class Automatism; } namespace gd { class Behavior; }
namespace gd { class AutomatismMetadata; } namespace gd { class BehaviorMetadata; }
namespace gd { class ObjectMetadata; } namespace gd { class ObjectMetadata; }
namespace gd { class BaseEvent; } namespace gd { class BaseEvent; }
namespace gd { class AutomatismsSharedData; } namespace gd { class BehaviorsSharedData; }
namespace gd { class PlatformExtension; } namespace gd { class PlatformExtension; }
namespace gd { class LayoutEditorCanvas; } namespace gd { class LayoutEditorCanvas; }
namespace gd { class ProjectExporter; } namespace gd { class ProjectExporter; }
@@ -121,14 +121,14 @@ public:
std::shared_ptr<gd::Object> CreateObject(gd::String type, const gd::String & name) const; std::shared_ptr<gd::Object> CreateObject(gd::String type, const gd::String & name) const;
/** /**
* \brief Create an automatism * \brief Create an behavior
*/ */
gd::Automatism* CreateAutomatism(const gd::String & type) const; gd::Behavior* CreateBehavior(const gd::String & type) const;
/** /**
* \brief Create an automatism shared data object. * \brief Create an behavior shared data object.
*/ */
std::shared_ptr<gd::AutomatismsSharedData> CreateAutomatismSharedDatas(const gd::String & type) const; std::shared_ptr<gd::BehaviorsSharedData> CreateBehaviorSharedDatas(const gd::String & type) const;
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
/** /**

View File

@@ -7,12 +7,12 @@
#include "GDCore/PlatformDefinition/PlatformExtension.h" #include "GDCore/PlatformDefinition/PlatformExtension.h"
#include "GDCore/PlatformDefinition/Platform.h" #include "GDCore/PlatformDefinition/Platform.h"
#include "GDCore/IDE/PlatformManager.h" #include "GDCore/IDE/PlatformManager.h"
#include "GDCore/PlatformDefinition/Automatism.h" #include "GDCore/PlatformDefinition/Behavior.h"
#include "GDCore/PlatformDefinition/AutomatismsSharedData.h" #include "GDCore/PlatformDefinition/BehaviorsSharedData.h"
#include "GDCore/Events/InstructionMetadata.h" #include "GDCore/Events/InstructionMetadata.h"
#include "GDCore/Events/ExpressionMetadata.h" #include "GDCore/Events/ExpressionMetadata.h"
#include "GDCore/Events/ObjectMetadata.h" #include "GDCore/Events/ObjectMetadata.h"
#include "GDCore/Events/AutomatismMetadata.h" #include "GDCore/Events/BehaviorMetadata.h"
#include "GDCore/Events/EventMetadata.h" #include "GDCore/Events/EventMetadata.h"
#include "GDCore/Events/Event.h" #include "GDCore/Events/Event.h"
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
@@ -96,19 +96,19 @@ gd::ObjectMetadata & PlatformExtension::AddObject(const gd::String & name,
return objectsInfos[nameWithNamespace]; return objectsInfos[nameWithNamespace];
} }
gd::AutomatismMetadata & PlatformExtension::AddAutomatism(const gd::String & name, gd::BehaviorMetadata & PlatformExtension::AddBehavior(const gd::String & name,
const gd::String & fullname, const gd::String & fullname,
const gd::String & defaultName, const gd::String & defaultName,
const gd::String & description, const gd::String & description,
const gd::String & group, const gd::String & group,
const gd::String & icon24x24, const gd::String & icon24x24,
const gd::String & className, const gd::String & className,
std::shared_ptr<gd::Automatism> instance, std::shared_ptr<gd::Behavior> instance,
std::shared_ptr<gd::AutomatismsSharedData> sharedDatasInstance) std::shared_ptr<gd::BehaviorsSharedData> sharedDatasInstance)
{ {
gd::String nameWithNamespace = GetNameSpace().empty() ? name : GetNameSpace()+name; gd::String nameWithNamespace = GetNameSpace().empty() ? name : GetNameSpace()+name;
automatismsInfo[nameWithNamespace] = AutomatismMetadata(GetNameSpace(), nameWithNamespace, fullname, defaultName, description, group, icon24x24, className, instance, sharedDatasInstance); behaviorsInfo[nameWithNamespace] = BehaviorMetadata(GetNameSpace(), nameWithNamespace, fullname, defaultName, description, group, icon24x24, className, instance, sharedDatasInstance);
return automatismsInfo[nameWithNamespace]; return behaviorsInfo[nameWithNamespace];
} }
gd::EventMetadata & PlatformExtension::AddEvent(const gd::String & name_, gd::EventMetadata & PlatformExtension::AddEvent(const gd::String & name_,
@@ -159,25 +159,25 @@ gd::ObjectMetadata & PlatformExtension::GetObjectMetadata(const gd::String & obj
return badObjectMetadata; return badObjectMetadata;
} }
gd::AutomatismMetadata & PlatformExtension::GetAutomatismMetadata(const gd::String & automatismType) gd::BehaviorMetadata & PlatformExtension::GetBehaviorMetadata(const gd::String & behaviorType)
{ {
if ( automatismsInfo.find(automatismType) != automatismsInfo.end()) if ( behaviorsInfo.find(behaviorType) != behaviorsInfo.end())
return automatismsInfo.find(automatismType)->second; return behaviorsInfo.find(behaviorType)->second;
std::cout << "Warning: Automatism type \"" << automatismType << "\" not found in an extension!" << std::endl; std::cout << "Warning: Behavior type \"" << behaviorType << "\" not found in an extension!" << std::endl;
return badAutomatismMetadata; return badBehaviorMetadata;
} }
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
std::vector < gd::String > PlatformExtension::GetAutomatismsTypes() const std::vector < gd::String > PlatformExtension::GetBehaviorsTypes() const
{ {
std::vector < gd::String > automatisms; std::vector < gd::String > behaviors;
std::map<gd::String, gd::AutomatismMetadata>::const_iterator it; std::map<gd::String, gd::BehaviorMetadata>::const_iterator it;
for(it = automatismsInfo.begin(); it != automatismsInfo.end(); ++it) for(it = behaviorsInfo.begin(); it != behaviorsInfo.end(); ++it)
automatisms.push_back(it->first); behaviors.push_back(it->first);
return automatisms; return behaviors;
} }
std::map<gd::String, gd::InstructionMetadata > & PlatformExtension::GetAllActions() std::map<gd::String, gd::InstructionMetadata > & PlatformExtension::GetAllActions()
@@ -236,34 +236,34 @@ std::map<gd::String, gd::ExpressionMetadata > & PlatformExtension::GetAllStrExpr
return badStrExpressionsMetadata; return badStrExpressionsMetadata;
} }
std::map<gd::String, gd::InstructionMetadata > & PlatformExtension::GetAllActionsForAutomatism(gd::String autoType) std::map<gd::String, gd::InstructionMetadata > & PlatformExtension::GetAllActionsForBehavior(gd::String autoType)
{ {
if ( automatismsInfo.find(autoType) != automatismsInfo.end()) if ( behaviorsInfo.find(autoType) != behaviorsInfo.end())
return automatismsInfo.find(autoType)->second.actionsInfos; return behaviorsInfo.find(autoType)->second.actionsInfos;
return badActionsMetadata; return badActionsMetadata;
} }
std::map<gd::String, gd::InstructionMetadata > & PlatformExtension::GetAllConditionsForAutomatism(gd::String autoType) std::map<gd::String, gd::InstructionMetadata > & PlatformExtension::GetAllConditionsForBehavior(gd::String autoType)
{ {
if ( automatismsInfo.find(autoType) != automatismsInfo.end()) if ( behaviorsInfo.find(autoType) != behaviorsInfo.end())
return automatismsInfo.find(autoType)->second.conditionsInfos; return behaviorsInfo.find(autoType)->second.conditionsInfos;
return badConditionsMetadata; return badConditionsMetadata;
} }
std::map<gd::String, gd::ExpressionMetadata > & PlatformExtension::GetAllExpressionsForAutomatism(gd::String autoType) std::map<gd::String, gd::ExpressionMetadata > & PlatformExtension::GetAllExpressionsForBehavior(gd::String autoType)
{ {
if ( automatismsInfo.find(autoType) != automatismsInfo.end()) if ( behaviorsInfo.find(autoType) != behaviorsInfo.end())
return automatismsInfo.find(autoType)->second.expressionsInfos; return behaviorsInfo.find(autoType)->second.expressionsInfos;
return badExpressionsMetadata; return badExpressionsMetadata;
} }
std::map<gd::String, gd::ExpressionMetadata > & PlatformExtension::GetAllStrExpressionsForAutomatism(gd::String autoType) std::map<gd::String, gd::ExpressionMetadata > & PlatformExtension::GetAllStrExpressionsForBehavior(gd::String autoType)
{ {
if ( automatismsInfo.find(autoType) != automatismsInfo.end()) if ( behaviorsInfo.find(autoType) != behaviorsInfo.end())
return automatismsInfo.find(autoType)->second.strExpressionsInfos; return behaviorsInfo.find(autoType)->second.strExpressionsInfos;
return badStrExpressionsMetadata; return badStrExpressionsMetadata;
} }
@@ -294,21 +294,21 @@ CreateFunPtr PlatformExtension::GetObjectCreationFunctionPtr(gd::String objectTy
return NULL; return NULL;
} }
Automatism* PlatformExtension::CreateAutomatism(gd::String type) const Behavior* PlatformExtension::CreateBehavior(gd::String type) const
{ {
if ( automatismsInfo.find(type) != automatismsInfo.end()) if ( behaviorsInfo.find(type) != behaviorsInfo.end())
return automatismsInfo.find(type)->second.Get()->Clone(); return behaviorsInfo.find(type)->second.Get()->Clone();
return NULL; return NULL;
} }
std::shared_ptr<gd::AutomatismsSharedData> PlatformExtension::CreateAutomatismSharedDatas(gd::String type) const std::shared_ptr<gd::BehaviorsSharedData> PlatformExtension::CreateBehaviorSharedDatas(gd::String type) const
{ {
if ( automatismsInfo.find(type) != automatismsInfo.end() && automatismsInfo.find(type)->second.GetSharedDataInstance()) if ( behaviorsInfo.find(type) != behaviorsInfo.end() && behaviorsInfo.find(type)->second.GetSharedDataInstance())
return automatismsInfo.find(type)->second.GetSharedDataInstance()->Clone(); return behaviorsInfo.find(type)->second.GetSharedDataInstance()->Clone();
return std::shared_ptr<gd::AutomatismsSharedData>(); return std::shared_ptr<gd::BehaviorsSharedData>();
} }
@@ -423,9 +423,9 @@ void PlatformExtension::CloneExtension(const gd::String & platformName, const gd
it->second.SetFunctionName("").RemoveCustomCodeGenerator(); it->second.SetFunctionName("").RemoveCustomCodeGenerator();
} }
for(std::map<gd::String, gd::AutomatismMetadata >::iterator objIt = automatismsInfo.begin();objIt!=automatismsInfo.end();++objIt) for(std::map<gd::String, gd::BehaviorMetadata >::iterator objIt = behaviorsInfo.begin();objIt!=behaviorsInfo.end();++objIt)
{ {
gd::AutomatismMetadata & obj = objIt->second; gd::BehaviorMetadata & obj = objIt->second;
for (std::map<gd::String, gd::InstructionMetadata >::iterator it = obj.actionsInfos.begin();it != obj.actionsInfos.end();++it) for (std::map<gd::String, gd::InstructionMetadata >::iterator it = obj.actionsInfos.begin();it != obj.actionsInfos.end();++it)
it->second.SetFunctionName("").SetGetter("").RemoveCustomCodeGenerator(); it->second.SetFunctionName("").SetGetter("").RemoveCustomCodeGenerator();
@@ -532,9 +532,9 @@ void PlatformExtension::StripUnimplementedInstructionsAndExpressions()
} }
} }
for(std::map<gd::String, gd::AutomatismMetadata >::iterator objIt = automatismsInfo.begin();objIt!=automatismsInfo.end();++objIt) for(std::map<gd::String, gd::BehaviorMetadata >::iterator objIt = behaviorsInfo.begin();objIt!=behaviorsInfo.end();++objIt)
{ {
gd::AutomatismMetadata & obj = objIt->second; gd::BehaviorMetadata & obj = objIt->second;
for (std::map<gd::String, gd::InstructionMetadata >::iterator it = obj.actionsInfos.begin();it != obj.actionsInfos.end();) for (std::map<gd::String, gd::InstructionMetadata >::iterator it = obj.actionsInfos.begin();it != obj.actionsInfos.end();)
{ {

View File

@@ -11,20 +11,20 @@
#include <vector> #include <vector>
#include <memory> #include <memory>
#include "GDCore/Events/ObjectMetadata.h" #include "GDCore/Events/ObjectMetadata.h"
#include "GDCore/Events/AutomatismMetadata.h" #include "GDCore/Events/BehaviorMetadata.h"
#include "GDCore/Events/EventMetadata.h" #include "GDCore/Events/EventMetadata.h"
#include "GDCore/String.h" #include "GDCore/String.h"
namespace gd { class Instruction; } namespace gd { class Instruction; }
namespace gd { class InstructionMetadata; } namespace gd { class InstructionMetadata; }
namespace gd { class ExpressionMetadata; } namespace gd { class ExpressionMetadata; }
namespace gd { class ObjectMetadata; } namespace gd { class ObjectMetadata; }
namespace gd { class AutomatismMetadata; } namespace gd { class BehaviorMetadata; }
namespace gd { class BaseEvent; } namespace gd { class BaseEvent; }
namespace gd { class EventMetadata; } namespace gd { class EventMetadata; }
namespace gd { class EventCodeGenerator; } namespace gd { class EventCodeGenerator; }
namespace gd { class ArbitraryResourceWorker; } namespace gd { class ArbitraryResourceWorker; }
namespace gd { class AutomatismsSharedData; } namespace gd { class BehaviorsSharedData; }
namespace gd { class Automatism; } namespace gd { class Behavior; }
namespace gd { class Object; } namespace gd { class Object; }
typedef void (*DestroyFunPtr)(gd::Object*); typedef void (*DestroyFunPtr)(gd::Object*);
@@ -161,26 +161,26 @@ public:
CreateFunPtr createFunPtrP); CreateFunPtr createFunPtrP);
/** /**
* \brief Declare a new automatism as being part of the extension. * \brief Declare a new behavior as being part of the extension.
* \note This method does nothing when used for GD C++ runtime. * \note This method does nothing when used for GD C++ runtime.
* *
* \param name The name of the automatism * \param name The name of the behavior
* \param fullname The user friendly name of the automatism * \param fullname The user friendly name of the behavior
* \param description The user friendly description of the automatism * \param description The user friendly description of the behavior
* \param icon The 24x24 icon of the automatism: res/icons_[SkinName]/[iconName]24.png will be first tried, * \param icon The 24x24 icon of the behavior: res/icons_[SkinName]/[iconName]24.png will be first tried,
* and then if it does not exists, it is assumed that the icon name is the filename that must be used to open the icon. * and then if it does not exists, it is assumed that the icon name is the filename that must be used to open the icon.
* \param instance An instance of the automatism that will be used to create the automatism * \param instance An instance of the behavior that will be used to create the behavior
* \param sharedDatasInstance Optional instance of the data shared by the automatisms having the same name. * \param sharedDatasInstance Optional instance of the data shared by the behaviors having the same name.
*/ */
gd::AutomatismMetadata & AddAutomatism(const gd::String & name_, gd::BehaviorMetadata & AddBehavior(const gd::String & name_,
const gd::String & fullname_, const gd::String & fullname_,
const gd::String & defaultName_, const gd::String & defaultName_,
const gd::String & description_, const gd::String & description_,
const gd::String & group_, const gd::String & group_,
const gd::String & icon24x24_, const gd::String & icon24x24_,
const gd::String & className_, const gd::String & className_,
std::shared_ptr<gd::Automatism> instance, std::shared_ptr<gd::Behavior> instance,
std::shared_ptr<gd::AutomatismsSharedData> sharedDatasInstance); std::shared_ptr<gd::BehaviorsSharedData> sharedDatasInstance);
/** /**
* \brief Declare a new event as being part of the extension. * \brief Declare a new event as being part of the extension.
@@ -240,9 +240,9 @@ public:
std::vector < gd::String > GetExtensionObjectsTypes() const; std::vector < gd::String > GetExtensionObjectsTypes() const;
/** /**
* \brief Return a vector containing all the automatism types provided by the extension * \brief Return a vector containing all the behavior types provided by the extension
*/ */
std::vector < gd::String > GetAutomatismsTypes() const; std::vector < gd::String > GetBehaviorsTypes() const;
/** /**
* \brief Return a function to create the object if the type is handled by the extension * \brief Return a function to create the object if the type is handled by the extension
@@ -256,18 +256,18 @@ public:
*/ */
std::shared_ptr<gd::BaseEvent> CreateEvent(gd::String eventType) const; std::shared_ptr<gd::BaseEvent> CreateEvent(gd::String eventType) const;
/** /**
* \brief Create an automatism * \brief Create an behavior
* *
* Return NULL if \a automatismType is not provided by the extension. * Return NULL if \a behaviorType is not provided by the extension.
*/ */
gd::Automatism* CreateAutomatism(gd::String automatismType) const; gd::Behavior* CreateBehavior(gd::String behaviorType) const;
/** /**
* \brief Create shared data for an automatism * \brief Create shared data for an behavior
* *
* Return NULL if \a automatismType is not provided by the extension. * Return NULL if \a behaviorType is not provided by the extension.
*/ */
std::shared_ptr<gd::AutomatismsSharedData> CreateAutomatismSharedDatas(gd::String automatismType) const; std::shared_ptr<gd::BehaviorsSharedData> CreateBehaviorSharedDatas(gd::String behaviorType) const;
/** /**
* \brief Return a reference to the ObjectMetadata object associated to \a objectType * \brief Return a reference to the ObjectMetadata object associated to \a objectType
@@ -275,9 +275,9 @@ public:
ObjectMetadata & GetObjectMetadata(const gd::String & objectType); ObjectMetadata & GetObjectMetadata(const gd::String & objectType);
/** /**
* \brief Return a reference to the AutomatismMetadata object associated to \a automatismType * \brief Return a reference to the BehaviorMetadata object associated to \a behaviorType
*/ */
AutomatismMetadata & GetAutomatismMetadata(const gd::String & automatismType); BehaviorMetadata & GetBehaviorMetadata(const gd::String & behaviorType);
/** /**
* \brief Return a map containing all the events provided by the extension * \brief Return a map containing all the events provided by the extension
@@ -328,22 +328,22 @@ public:
/** /**
* \see gd::PlatformExtension::GetAllActionsForObject * \see gd::PlatformExtension::GetAllActionsForObject
*/ */
std::map<gd::String, gd::InstructionMetadata > & GetAllActionsForAutomatism(gd::String autoType); std::map<gd::String, gd::InstructionMetadata > & GetAllActionsForBehavior(gd::String autoType);
/** /**
* \see gd::PlatformExtension::GetAllActionsForObject * \see gd::PlatformExtension::GetAllActionsForObject
*/ */
std::map<gd::String, gd::InstructionMetadata > & GetAllConditionsForAutomatism(gd::String autoType); std::map<gd::String, gd::InstructionMetadata > & GetAllConditionsForBehavior(gd::String autoType);
/** /**
* \see gd::PlatformExtension::GetAllActionsForObject * \see gd::PlatformExtension::GetAllActionsForObject
*/ */
std::map<gd::String, gd::ExpressionMetadata > & GetAllExpressionsForAutomatism(gd::String autoType); std::map<gd::String, gd::ExpressionMetadata > & GetAllExpressionsForBehavior(gd::String autoType);
/** /**
* \see gd::PlatformExtension::GetAllActionsForObject * \see gd::PlatformExtension::GetAllActionsForObject
*/ */
std::map<gd::String, gd::ExpressionMetadata > & GetAllStrExpressionsForAutomatism(gd::String autoType); std::map<gd::String, gd::ExpressionMetadata > & GetAllStrExpressionsForBehavior(gd::String autoType);
/** /**
* Called ( e.g. during compilation ) so as to inventory resources used by conditions and update their filename * Called ( e.g. during compilation ) so as to inventory resources used by conditions and update their filename
@@ -392,7 +392,7 @@ private:
void SetNameSpace(gd::String nameSpace_); void SetNameSpace(gd::String nameSpace_);
gd::String name; ///<Name identifying the extension gd::String name; ///<Name identifying the extension
gd::String nameSpace; ///<Automatically set from the name of the extension, and added to every actions/conditions/expressions/objects/automatism/event. gd::String nameSpace; ///<Automatically set from the name of the extension, and added to every actions/conditions/expressions/objects/behavior/event.
gd::String fullname; ///<Name displayed to users at edittime gd::String fullname; ///<Name displayed to users at edittime
gd::String informations; ///<Description displayed to users at edittime gd::String informations; ///<Description displayed to users at edittime
gd::String author; ///<Author displayed to users at edittime gd::String author; ///<Author displayed to users at edittime
@@ -400,7 +400,7 @@ private:
bool deprecated; bool deprecated;
std::map<gd::String, gd::ObjectMetadata > objectsInfos; std::map<gd::String, gd::ObjectMetadata > objectsInfos;
std::map<gd::String, gd::AutomatismMetadata > automatismsInfo; std::map<gd::String, gd::BehaviorMetadata > behaviorsInfo;
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
std::map<gd::String, gd::InstructionMetadata > conditionsInfos; std::map<gd::String, gd::InstructionMetadata > conditionsInfos;
std::map<gd::String, gd::InstructionMetadata > actionsInfos; std::map<gd::String, gd::InstructionMetadata > actionsInfos;
@@ -410,7 +410,7 @@ private:
#endif #endif
ObjectMetadata badObjectMetadata; ObjectMetadata badObjectMetadata;
AutomatismMetadata badAutomatismMetadata; BehaviorMetadata badBehaviorMetadata;
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
static std::map<gd::String, gd::InstructionMetadata > badConditionsMetadata; ///< Used when a condition is not found in the extension static std::map<gd::String, gd::InstructionMetadata > badConditionsMetadata; ///< Used when a condition is not found in the extension
static std::map<gd::String, gd::InstructionMetadata > badActionsMetadata; ///< Used when an action is not found in the extension static std::map<gd::String, gd::InstructionMetadata > badActionsMetadata; ///< Used when an action is not found in the extension

View File

@@ -121,30 +121,30 @@ std::shared_ptr<gd::Object> Project::CreateObject(const gd::String & type, const
return std::shared_ptr<gd::Object>(); return std::shared_ptr<gd::Object>();
} }
gd::Automatism* Project::CreateAutomatism(const gd::String & type, const gd::String & platformName) gd::Behavior* Project::CreateBehavior(const gd::String & type, const gd::String & platformName)
{ {
for (unsigned int i = 0;i<platforms.size();++i) for (unsigned int i = 0;i<platforms.size();++i)
{ {
if ( !platformName.empty() && platforms[i]->GetName() != platformName ) continue; if ( !platformName.empty() && platforms[i]->GetName() != platformName ) continue;
gd::Automatism* automatism = platforms[i]->CreateAutomatism(type); gd::Behavior* behavior = platforms[i]->CreateBehavior(type);
if ( automatism ) return automatism; if ( behavior ) return behavior;
} }
return NULL; return NULL;
} }
std::shared_ptr<gd::AutomatismsSharedData> Project::CreateAutomatismSharedDatas(const gd::String & type, const gd::String & platformName) std::shared_ptr<gd::BehaviorsSharedData> Project::CreateBehaviorSharedDatas(const gd::String & type, const gd::String & platformName)
{ {
for (unsigned int i = 0;i<platforms.size();++i) for (unsigned int i = 0;i<platforms.size();++i)
{ {
if ( !platformName.empty() && platforms[i]->GetName() != platformName ) continue; if ( !platformName.empty() && platforms[i]->GetName() != platformName ) continue;
std::shared_ptr<gd::AutomatismsSharedData> automatism = platforms[i]->CreateAutomatismSharedDatas(type); std::shared_ptr<gd::BehaviorsSharedData> behavior = platforms[i]->CreateBehaviorSharedDatas(type);
if ( automatism ) return automatism; if ( behavior ) return behavior;
} }
return std::shared_ptr<gd::AutomatismsSharedData>(); return std::shared_ptr<gd::BehaviorsSharedData>();
} }
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
@@ -271,7 +271,7 @@ gd::Layout & Project::InsertNewLayout(const gd::String & name, unsigned int posi
newScene->SetName(name); newScene->SetName(name);
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
newScene->UpdateAutomatismsSharedData(*this); newScene->UpdateBehaviorsSharedData(*this);
#endif #endif
return *newScene; return *newScene;
@@ -286,7 +286,7 @@ gd::Layout & Project::InsertLayout(const gd::Layout & layout, unsigned int posit
scenes.push_back(newScene); scenes.push_back(newScene);
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
newScene->UpdateAutomatismsSharedData(*this); newScene->UpdateBehaviorsSharedData(*this);
#endif #endif
return *newScene; return *newScene;
@@ -610,7 +610,7 @@ void Project::UnserializeFrom(const SerializerElement & element)
//Compatibility code //Compatibility code
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
if ( VersionWrapper::IsOlderOrEqual(GDMajorVersion, GDMajorVersion, GDMinorVersion, build, 2,2,1,10822) ) if ( VersionWrapper::IsOlderOrEqual(GDMajorVersion, GDMinorVersion, revision, build, 2,2,1,10822) )
{ {
if ( std::find(GetUsedExtensions().begin(), GetUsedExtensions().end(), "BuiltinExternalLayouts") == GetUsedExtensions().end() ) if ( std::find(GetUsedExtensions().begin(), GetUsedExtensions().end(), "BuiltinExternalLayouts") == GetUsedExtensions().end() )
GetUsedExtensions().push_back("BuiltinExternalLayouts"); GetUsedExtensions().push_back("BuiltinExternalLayouts");
@@ -619,14 +619,30 @@ void Project::UnserializeFrom(const SerializerElement & element)
//Compatibility code //Compatibility code
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
if ( VersionWrapper::IsOlderOrEqual(GDMajorVersion, GDMajorVersion, GDMinorVersion, build, 3,3,3,0) ) if ( VersionWrapper::IsOlderOrEqual(GDMajorVersion, GDMinorVersion, revision, build, 3,3,3,0) )
{ {
if ( std::find(GetUsedExtensions().begin(), GetUsedExtensions().end(), "AStarAutomatism") != GetUsedExtensions().end() ) if ( std::find(GetUsedExtensions().begin(), GetUsedExtensions().end(), "AStarBehavior") != GetUsedExtensions().end() )
{ {
GetUsedExtensions().erase( std::remove( GetUsedExtensions().begin(), GetUsedExtensions().end(), "AStarAutomatism" ), GetUsedExtensions().end() ); GetUsedExtensions().erase( std::remove( GetUsedExtensions().begin(), GetUsedExtensions().end(), "AStarBehavior" ), GetUsedExtensions().end() );
GetUsedExtensions().push_back("PathfindingAutomatism"); GetUsedExtensions().push_back("PathfindingBehavior");
updateText += _("The project is using the pathfinding automatism. This automatism has been replaced by a new one:\n"); updateText += _("The project is using the pathfinding behavior. This behavior has been replaced by a new one:\n");
updateText += _("You must add the new 'Pathfinding' automatism to the objects that need to be moved, and add the 'Pathfinding Obstacle' to the objects that must act as obstacles."); updateText += _("You must add the new 'Pathfinding' behavior to the objects that need to be moved, and add the 'Pathfinding Obstacle' to the objects that must act as obstacles.");
}
}
#endif
//Compatibility code
#if defined(GD_IDE_ONLY)
if ( VersionWrapper::IsOlderOrEqual(GDMajorVersion, GDMinorVersion, revision, build, 4,0,85,0) )
{
for(unsigned int i = 0;i < extensionsUsed.size();++i)
{
gd::String oldWord = "Automatism";
size_t pos = extensionsUsed[i].find(oldWord);
if (pos != gd::String::npos)
extensionsUsed[i] = extensionsUsed[i].replace(pos, oldWord.size(), "Behavior");
std::cout << extensionsUsed[i] << std::endl;
} }
} }
#endif #endif

View File

@@ -26,8 +26,8 @@ namespace gd { class VariablesContainer; }
namespace gd { class ArbitraryResourceWorker; } namespace gd { class ArbitraryResourceWorker; }
namespace gd { class SourceFile; } namespace gd { class SourceFile; }
namespace gd { class ImageManager; } namespace gd { class ImageManager; }
namespace gd { class Automatism; } namespace gd { class Behavior; }
namespace gd { class AutomatismsSharedData; } namespace gd { class BehaviorsSharedData; }
namespace gd { class BaseEvent; } namespace gd { class BaseEvent; }
namespace gd { class SerializerElement; } namespace gd { class SerializerElement; }
#undef GetObject //Disable an annoying macro #undef GetObject //Disable an annoying macro
@@ -211,30 +211,30 @@ public:
std::shared_ptr<gd::Object> CreateObject(const gd::String & type, const gd::String & name, const gd::String & platformName = ""); std::shared_ptr<gd::Object> CreateObject(const gd::String & type, const gd::String & name, const gd::String & platformName = "");
/** /**
* Create an automatism of the given type. * Create an behavior of the given type.
* *
* \note A project can use more than one platform. In this case, the first platform supporting the automatism is used, * \note A project can use more than one platform. In this case, the first platform supporting the behavior is used,
* unless \a platformName argument is not empty.<br> * unless \a platformName argument is not empty.<br>
* It is assumed that each platform provides an equivalent automatism. * It is assumed that each platform provides an equivalent behavior.
* *
* \param project The project for which the object must be created. * \param project The project for which the object must be created.
* \param type The type of the automatism * \param type The type of the behavior
* \param platformName The name of the platform to be used. If empty, the first platform supporting the object is used. * \param platformName The name of the platform to be used. If empty, the first platform supporting the object is used.
*/ */
gd::Automatism* CreateAutomatism(const gd::String & type, const gd::String & platformName = ""); gd::Behavior* CreateBehavior(const gd::String & type, const gd::String & platformName = "");
/** /**
* Create automatism shared data of the given type. * Create behavior shared data of the given type.
* *
* \note A project can use more than one platform. In this case, the first platform supporting the automatism shared data is used, * \note A project can use more than one platform. In this case, the first platform supporting the behavior shared data is used,
* unless \a platformName argument is not empty.<br> * unless \a platformName argument is not empty.<br>
* It is assumed that each platform provides equivalent automatism shared data. * It is assumed that each platform provides equivalent behavior shared data.
* *
* \param project The project for which the automatism shared data must be created. * \param project The project for which the behavior shared data must be created.
* \param type The type of automatism shared data * \param type The type of behavior shared data
* \param platformName The name of the platform to be used. If empty, the first platform supporting the object is used. * \param platformName The name of the platform to be used. If empty, the first platform supporting the object is used.
*/ */
std::shared_ptr<gd::AutomatismsSharedData> CreateAutomatismSharedDatas(const gd::String & type, const gd::String & platformName = ""); std::shared_ptr<gd::BehaviorsSharedData> CreateBehaviorSharedDatas(const gd::String & type, const gd::String & platformName = "");
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
/** /**

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<wxsmith> <wxsmith>
<object class="wxDialog" name="ChooseAutomatismDialog"> <object class="wxDialog" name="ChooseBehaviorDialog">
<title>Choose an automatism</title> <title>Choose an behavior</title>
<id_arg>0</id_arg> <id_arg>0</id_arg>
<style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style> <style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style>
<object class="wxFlexGridSizer" variable="FlexGridSizer1" member="no"> <object class="wxFlexGridSizer" variable="FlexGridSizer1" member="no">
@@ -19,7 +19,7 @@
<cols>3</cols> <cols>3</cols>
<object class="sizeritem"> <object class="sizeritem">
<object class="wxStaticBitmap" name="ID_STATICBITMAP3" variable="StaticBitmap3" member="yes"> <object class="wxStaticBitmap" name="ID_STATICBITMAP3" variable="StaticBitmap3" member="yes">
<bitmap>res/automatism64.png</bitmap> <bitmap>res/behavior64.png</bitmap>
<style>wxNO_BORDER</style> <style>wxNO_BORDER</style>
</object> </object>
<flag>wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL</flag> <flag>wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL</flag>
@@ -28,7 +28,7 @@
</object> </object>
<object class="sizeritem"> <object class="sizeritem">
<object class="wxStaticText" name="ID_STATICTEXT1" variable="StaticText1" member="yes"> <object class="wxStaticText" name="ID_STATICTEXT1" variable="StaticText1" member="yes">
<label>Choose an automatism of the object.</label> <label>Choose an behavior of the object.</label>
<style>wxALIGN_CENTRE</style> <style>wxALIGN_CENTRE</style>
</object> </object>
<flag>wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag> <flag>wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
@@ -52,7 +52,7 @@
<option>1</option> <option>1</option>
</object> </object>
<object class="sizeritem"> <object class="sizeritem">
<object class="wxListBox" name="ID_LISTBOX1" variable="automatismsList" member="yes"> <object class="wxListBox" name="ID_LISTBOX1" variable="behaviorsList" member="yes">
<default>-1</default> <default>-1</default>
<size>255,128</size> <size>255,128</size>
<handler function="OnChoisirBtClick" entry="EVT_LISTBOX_DCLICK" /> <handler function="OnChoisirBtClick" entry="EVT_LISTBOX_DCLICK" />

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<wxsmith> <wxsmith>
<object class="wxDialog" name="ChooseAutomatismTypeDialog"> <object class="wxDialog" name="ChooseBehaviorTypeDialog">
<title>Choose an automatism</title> <title>Choose an behavior</title>
<id_arg>0</id_arg> <id_arg>0</id_arg>
<style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style> <style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style>
<handler function="OnResize" entry="EVT_SIZE" /> <handler function="OnResize" entry="EVT_SIZE" />
@@ -11,18 +11,18 @@
<growablerows>1</growablerows> <growablerows>1</growablerows>
<object class="sizeritem"> <object class="sizeritem">
<object class="wxStaticText" name="ID_STATICTEXT1" variable="StaticText1" member="yes"> <object class="wxStaticText" name="ID_STATICTEXT1" variable="StaticText1" member="yes">
<label>Automatisms can be used to add a specific behaviour&#x0A;to an object. Choose the automatism to add:</label> <label>Behaviors can be used to add a specific behaviour&#x0A;to an object. Choose the behavior to add:</label>
</object> </object>
<flag>wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag> <flag>wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
<border>5</border> <border>5</border>
<option>1</option> <option>1</option>
</object> </object>
<object class="sizeritem"> <object class="sizeritem">
<object class="wxListCtrl" name="ID_LISTCTRL1" variable="automatismsList" member="yes"> <object class="wxListCtrl" name="ID_LISTCTRL1" variable="behaviorsList" member="yes">
<size>277,175</size> <size>277,175</size>
<style>wxLC_REPORT|wxLC_NO_HEADER|wxLC_SINGLE_SEL</style> <style>wxLC_REPORT|wxLC_NO_HEADER|wxLC_SINGLE_SEL</style>
<handler function="OnautomatismsListItemSelect" entry="EVT_LIST_ITEM_SELECTED" /> <handler function="OnbehaviorsListItemSelect" entry="EVT_LIST_ITEM_SELECTED" />
<handler function="OnautomatismsListItemActivated" entry="EVT_LIST_ITEM_ACTIVATED" /> <handler function="OnbehaviorsListItemActivated" entry="EVT_LIST_ITEM_ACTIVATED" />
</object> </object>
<flag>wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag> <flag>wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL</flag>
<border>5</border> <border>5</border>
@@ -30,7 +30,7 @@
</object> </object>
<object class="sizeritem"> <object class="sizeritem">
<object class="wxStaticText" name="ID_STATICTEXT2" variable="StaticText2" member="yes"> <object class="wxStaticText" name="ID_STATICTEXT2" variable="StaticText2" member="yes">
<label>You can also use the grayed automatisms:&#x0A;Their associated extension will be automatically enabled.</label> <label>You can also use the grayed behaviors:&#x0A;Their associated extension will be automatically enabled.</label>
</object> </object>
<flag>wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag> <flag>wxALL|wxALIGN_LEFT|wxALIGN_CENTER_VERTICAL</flag>
<border>5</border> <border>5</border>

20
Extensions/.gitignore vendored
View File

@@ -1,16 +1,16 @@
*.depend *.depend
/AES/obj /AES/obj
/AES/AES.depend /AES/AES.depend
/AStarAutomatism/obj /AStarBehavior/obj
/AStarAutomatism/AStarAutomatism.depend /AStarBehavior/AStarBehavior.depend
/Box3DObject/obj /Box3DObject/obj
/Box3DObject/Box3DObject.depend /Box3DObject/Box3DObject.depend
/Common Dialogs/obj /Common Dialogs/obj
/Common Dialogs/CommonDialogs.depend /Common Dialogs/CommonDialogs.depend
/DestroyOutsideAutomatism/obj /DestroyOutsideBehavior/obj
/DestroyOutsideAutomatism/DestroyOutsideAutomatism.depend /DestroyOutsideBehavior/DestroyOutsideBehavior.depend
/DraggableAutomatism/obj /DraggableBehavior/obj
/DraggableAutomatism/DraggableAutomatism.depend /DraggableBehavior/DraggableBehavior.depend
/Function/obj /Function/obj
/Function/Function.depend /Function/Function.depend
/Light/obj /Light/obj
@@ -23,10 +23,10 @@
/PanelSpriteObject/PanelSpriteObject.depend /PanelSpriteObject/PanelSpriteObject.depend
/ParticleSystem/obj /ParticleSystem/obj
/ParticleSystem/ParticleSystem.depend /ParticleSystem/ParticleSystem.depend
/PathAutomatism/obj /PathBehavior/obj
/PathAutomatism/PathAutomatism.depend /PathBehavior/PathBehavior.depend
/PhysicsAutomatism/obj /PhysicsBehavior/obj
/PhysicsAutomatism/PhysicsAutomatism.depend /PhysicsBehavior/PhysicsBehavior.depend
/PrimitiveDrawing/obj /PrimitiveDrawing/obj
/PrimitiveDrawing/PrimitiveDrawing.depend /PrimitiveDrawing/PrimitiveDrawing.depend
/TextEntryObject/obj /TextEntryObject/obj

View File

@@ -75,7 +75,7 @@
</Layer> </Layer>
</Layers> </Layers>
<Variables /> <Variables />
<AutomatismsSharedDatas /> <BehaviorsSharedDatas />
<Dependencies /> <Dependencies />
<Events> <Events>
<Event disabled="false" folded="false"> <Event disabled="false" folded="false">

View File

@@ -16,8 +16,8 @@ IF (NOT EMSCRIPTEN) #Only add some extensions when compiling with emscripten.
ADD_SUBDIRECTORY(CommonDialogs) ADD_SUBDIRECTORY(CommonDialogs)
ENDIF() ENDIF()
ENDIF() ENDIF()
ADD_SUBDIRECTORY(DestroyOutsideAutomatism) ADD_SUBDIRECTORY(DestroyOutsideBehavior)
ADD_SUBDIRECTORY(DraggableAutomatism) ADD_SUBDIRECTORY(DraggableBehavior)
IF (NOT EMSCRIPTEN) IF (NOT EMSCRIPTEN)
ADD_SUBDIRECTORY(Function) ADD_SUBDIRECTORY(Function)
ADD_SUBDIRECTORY(Light) ADD_SUBDIRECTORY(Light)
@@ -25,11 +25,11 @@ IF (NOT EMSCRIPTEN)
ADD_SUBDIRECTORY(Network) ADD_SUBDIRECTORY(Network)
ADD_SUBDIRECTORY(ParticleSystem) ADD_SUBDIRECTORY(ParticleSystem)
ADD_SUBDIRECTORY(PanelSpriteObject) ADD_SUBDIRECTORY(PanelSpriteObject)
ADD_SUBDIRECTORY(PathAutomatism) ADD_SUBDIRECTORY(PathBehavior)
ADD_SUBDIRECTORY(PathfindingAutomatism) ADD_SUBDIRECTORY(PathfindingBehavior)
ADD_SUBDIRECTORY(PhysicsAutomatism) ADD_SUBDIRECTORY(PhysicsBehavior)
ENDIF() ENDIF()
ADD_SUBDIRECTORY(PlatformAutomatism) ADD_SUBDIRECTORY(PlatformBehavior)
IF (NOT EMSCRIPTEN) IF (NOT EMSCRIPTEN)
ADD_SUBDIRECTORY(PrimitiveDrawing) ADD_SUBDIRECTORY(PrimitiveDrawing)
ADD_SUBDIRECTORY(SoundObject) ADD_SUBDIRECTORY(SoundObject)
@@ -43,4 +43,4 @@ ADD_SUBDIRECTORY(TiledSpriteObject)
IF (NOT EMSCRIPTEN) IF (NOT EMSCRIPTEN)
ADD_SUBDIRECTORY(TimedEvent) ADD_SUBDIRECTORY(TimedEvent)
ENDIF() ENDIF()
ADD_SUBDIRECTORY(TopDownMovementAutomatism) ADD_SUBDIRECTORY(TopDownMovementBehavior)

View File

@@ -1,25 +0,0 @@
cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0015 NEW)
project(DestroyOutsideAutomatism)
gd_add_extension_includes()
#Defines
###
gd_add_extension_definitions(DestroyOutsideAutomatism)
#The targets
###
include_directories(.)
file(GLOB source_files *)
gd_add_extension_target(DestroyOutsideAutomatism "${source_files}")
gdcpp_add_runtime_extension_target(DestroyOutsideAutomatism_Runtime "${source_files}")
#Linker files for the IDE extension
###
gd_extension_link_libraries(DestroyOutsideAutomatism GDCore)
#Linker files for the GD C++ Runtime extension
###
gdcpp_runtime_extension_link_libraries(DestroyOutsideAutomatism_Runtime)

View File

@@ -1,58 +0,0 @@
/**
GDevelop - DestroyOutside Extension
Copyright (c) 2014-2015 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License.
*/
#if defined(GD_IDE_ONLY)
#include "GDCore/PlatformDefinition/PlatformExtension.h"
#include "GDCore/Tools/Localization.h"
#include "GDCore/Tools/Version.h"
#include <iostream>
void DeclareDestroyOutsideAutomatismExtension(gd::PlatformExtension & extension);
/**
* \brief This class declares information about the JS extension.
*/
class DestroyOutsideAutomatismJsExtension : public gd::PlatformExtension
{
public:
/**
* \brief Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
*/
DestroyOutsideAutomatismJsExtension()
{
SetExtensionInformation("DestroyOutsideAutomatism",
_("Destroy Outside Screen Automatism"),
_("Automatism destroying object when they go outside the screen"),
"Florian Rival",
"Open source (MIT License)");
DeclareDestroyOutsideAutomatismExtension(*this);
GetAutomatismMetadata("DestroyOutsideAutomatism::DestroyOutside").SetIncludeFile("DestroyOutsideAutomatism/destroyoutsideruntimeautomatism.js");
GetAllConditionsForAutomatism("DestroyOutsideAutomatism::DestroyOutside")["DestroyOutsideAutomatism::ExtraBorder"].SetFunctionName("getExtraBorder").SetIncludeFile("DestroyOutsideAutomatism/destroyoutsideruntimeautomatism.js");
GetAllActionsForAutomatism("DestroyOutsideAutomatism::DestroyOutside")["DestroyOutsideAutomatism::ExtraBorder"].SetFunctionName("setExtraBorder").SetGetter("getExtraBorder").SetIncludeFile("DestroyOutsideAutomatism/destroyoutsideruntimeautomatism.js");
GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
};
};
//We need a specific function to create the extension with emscripten.
#if defined(EMSCRIPTEN)
extern "C" gd::PlatformExtension * CreateGDJSDestroyOutsideAutomatismExtension() {
return new DestroyOutsideAutomatismJsExtension;
}
#else
/**
* Used by GDevelop to create the extension class
* -- Do not need to be modified. --
*/
extern "C" gd::PlatformExtension * GD_EXTENSION_API CreateGDJSExtension() {
return new DestroyOutsideAutomatismJsExtension;
}
#endif
#endif

View File

@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0015 NEW)
project(DestroyOutsideBehavior)
gd_add_extension_includes()
#Defines
###
gd_add_extension_definitions(DestroyOutsideBehavior)
#The targets
###
include_directories(.)
file(GLOB source_files *)
gd_add_extension_target(DestroyOutsideBehavior "${source_files}")
gdcpp_add_runtime_extension_target(DestroyOutsideBehavior_Runtime "${source_files}")
#Linker files for the IDE extension
###
gd_extension_link_libraries(DestroyOutsideBehavior GDCore)
#Linker files for the GD C++ Runtime extension
###
gdcpp_runtime_extension_link_libraries(DestroyOutsideBehavior_Runtime)

View File

@@ -2,12 +2,12 @@
<CodeBlocks_project_file> <CodeBlocks_project_file>
<FileVersion major="1" minor="6" /> <FileVersion major="1" minor="6" />
<Project> <Project>
<Option title="DestroyOutsideAutomatism" /> <Option title="DestroyOutsideBehavior" />
<Option pch_mode="2" /> <Option pch_mode="2" />
<Option compiler="gcc" /> <Option compiler="gcc" />
<Build> <Build>
<Target title="Debug"> <Target title="Debug">
<Option output="../../Runtime/bin/debug/DestroyOutsideAutomatism.xgdw" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" /> <Option output="../../Runtime/bin/debug/DestroyOutsideBehavior.xgdw" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" />
<Option object_output="obj/Debug/" /> <Option object_output="obj/Debug/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
@@ -38,7 +38,7 @@
</Linker> </Linker>
</Target> </Target>
<Target title="Debug - Edittime"> <Target title="Debug - Edittime">
<Option output="../../IDE/bin/debug/CppPlatform/Extensions/DestroyOutsideAutomatism.xgdwe" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" /> <Option output="../../IDE/bin/debug/CppPlatform/Extensions/DestroyOutsideBehavior.xgdwe" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" />
<Option object_output="obj/Debug Edittime/" /> <Option object_output="obj/Debug Edittime/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
@@ -109,7 +109,7 @@
</Linker> </Linker>
</Target> </Target>
<Target title="Release"> <Target title="Release">
<Option output="../../Runtime/bin/release/DestroyOutsideAutomatism.xgdw" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" /> <Option output="../../Runtime/bin/release/DestroyOutsideBehavior.xgdw" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" />
<Option object_output="obj/Release/" /> <Option object_output="obj/Release/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
@@ -140,7 +140,7 @@
</Linker> </Linker>
</Target> </Target>
<Target title="Release - Edittime"> <Target title="Release - Edittime">
<Option output="../../IDE/bin/release/CppPlatform/Extensions/DestroyOutsideAutomatism.xgdwe" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" /> <Option output="../../IDE/bin/release/CppPlatform/Extensions/DestroyOutsideBehavior.xgdwe" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" />
<Option object_output="obj/Release Edittime/" /> <Option object_output="obj/Release Edittime/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
@@ -210,7 +210,7 @@
</Linker> </Linker>
</Target> </Target>
<Target title="Development"> <Target title="Development">
<Option output="../../Runtime/bin/dev/DestroyOutsideAutomatism.xgdw" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" /> <Option output="../../Runtime/bin/dev/DestroyOutsideBehavior.xgdw" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" />
<Option object_output="obj/Dev/" /> <Option object_output="obj/Dev/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
@@ -241,7 +241,7 @@
</Linker> </Linker>
</Target> </Target>
<Target title="Development - Edittime"> <Target title="Development - Edittime">
<Option output="../../IDE/bin/dev/CppPlatform/Extensions/DestroyOutsideAutomatism.xgdwe" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" /> <Option output="../../IDE/bin/dev/CppPlatform/Extensions/DestroyOutsideBehavior.xgdwe" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" />
<Option object_output="obj/Dev Edittime/" /> <Option object_output="obj/Dev Edittime/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
@@ -311,7 +311,7 @@
</Linker> </Linker>
</Target> </Target>
<Target title="Linux - Release"> <Target title="Linux - Release">
<Option output="../../Runtime/bin/release/DestroyOutsideAutomatism.xgdl" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" /> <Option output="../../Runtime/bin/release/DestroyOutsideBehavior.xgdl" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" />
<Option object_output="obj/Release/" /> <Option object_output="obj/Release/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
@@ -349,7 +349,7 @@
</Linker> </Linker>
</Target> </Target>
<Target title="Linux - Release - Edittime"> <Target title="Linux - Release - Edittime">
<Option output="../../IDE/bin/release/CppPlatform/Extensions/DestroyOutsideAutomatism.xgdle" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" /> <Option output="../../IDE/bin/release/CppPlatform/Extensions/DestroyOutsideBehavior.xgdle" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" />
<Option object_output="obj/Release Edittime/" /> <Option object_output="obj/Release Edittime/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
@@ -392,7 +392,7 @@
</Linker> </Linker>
</Target> </Target>
<Target title="Linux - Debug - Edittime"> <Target title="Linux - Debug - Edittime">
<Option output="../../IDE/bin/debug/CppPlatform/Extensions/DestroyOutsideAutomatism.xgdle" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" /> <Option output="../../IDE/bin/debug/CppPlatform/Extensions/DestroyOutsideBehavior.xgdle" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" />
<Option object_output="obj/Debug Edittime/" /> <Option object_output="obj/Debug Edittime/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
@@ -433,7 +433,7 @@
</Linker> </Linker>
</Target> </Target>
<Target title="Linux - Debug"> <Target title="Linux - Debug">
<Option output="../../Runtime/bin/debug/DestroyOutsideAutomatism.xgdl" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" /> <Option output="../../Runtime/bin/debug/DestroyOutsideBehavior.xgdl" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" />
<Option object_output="obj/Debug/" /> <Option object_output="obj/Debug/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
@@ -471,7 +471,7 @@
</Linker> </Linker>
</Target> </Target>
<Target title="Mac - Release"> <Target title="Mac - Release">
<Option output="../../Runtime/bin/release/DestroyOutsideAutomatism" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" /> <Option output="../../Runtime/bin/release/DestroyOutsideBehavior" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" />
<Option object_output="obj/Release/" /> <Option object_output="obj/Release/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
@@ -506,12 +506,12 @@
<Add directory="../../ExtLibs/SFML/build-mac/lib" /> <Add directory="../../ExtLibs/SFML/build-mac/lib" />
</Linker> </Linker>
<ExtraCommands> <ExtraCommands>
<Add after="install_name_tool -change ../Runtime/bin/release/libGDCpp.dylib libGDCpp.dylib ../../Runtime/bin/release/DestroyOutsideAutomatism.xgdm" /> <Add after="install_name_tool -change ../Runtime/bin/release/libGDCpp.dylib libGDCpp.dylib ../../Runtime/bin/release/DestroyOutsideBehavior.xgdm" />
<Add after="install_name_tool -change @executable_path/../Frameworks/sndfile.framework/Versions/A/sndfile sndfile ../../Runtime/bin/release/DestroyOutsideAutomatism.xgdm" /> <Add after="install_name_tool -change @executable_path/../Frameworks/sndfile.framework/Versions/A/sndfile sndfile ../../Runtime/bin/release/DestroyOutsideBehavior.xgdm" />
</ExtraCommands> </ExtraCommands>
</Target> </Target>
<Target title="Mac - Debug"> <Target title="Mac - Debug">
<Option output="../../Runtime/bin/debug/DestroyOutsideAutomatism" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" /> <Option output="../../Runtime/bin/debug/DestroyOutsideBehavior" imp_lib="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME).a" def_file="$(TARGET_OUTPUT_DIR)$(TARGET_OUTPUT_BASENAME)" prefix_auto="1" extension_auto="0" />
<Option object_output="obj/Debug/" /> <Option object_output="obj/Debug/" />
<Option type="3" /> <Option type="3" />
<Option compiler="gcc" /> <Option compiler="gcc" />
@@ -547,8 +547,8 @@
<Add directory="../../ExtLibs/SFML/build-mac/lib" /> <Add directory="../../ExtLibs/SFML/build-mac/lib" />
</Linker> </Linker>
<ExtraCommands> <ExtraCommands>
<Add after="install_name_tool -change ../Runtime/bin/release/libGDCpp.dylib libGDCpp.dylib ../../Runtime/bin/debug/DestroyOutsideAutomatism.xgdm" /> <Add after="install_name_tool -change ../Runtime/bin/release/libGDCpp.dylib libGDCpp.dylib ../../Runtime/bin/debug/DestroyOutsideBehavior.xgdm" />
<Add after="install_name_tool -change @executable_path/../Frameworks/sndfile.framework/Versions/A/sndfile sndfile ../../Runtime/bin/debug/DestroyOutsideAutomatism.xgdm" /> <Add after="install_name_tool -change @executable_path/../Frameworks/sndfile.framework/Versions/A/sndfile sndfile ../../Runtime/bin/debug/DestroyOutsideBehavior.xgdm" />
</ExtraCommands> </ExtraCommands>
</Target> </Target>
</Build> </Build>
@@ -562,8 +562,8 @@
<Add directory="../../ExtLibs/SFML/build-mingw-debug/lib" /> <Add directory="../../ExtLibs/SFML/build-mingw-debug/lib" />
<Add directory="../../ExtLibs/SFML/build-mingw-release/lib" /> <Add directory="../../ExtLibs/SFML/build-mingw-release/lib" />
</Linker> </Linker>
<Unit filename="DestroyOutsideAutomatism.cpp" /> <Unit filename="DestroyOutsideBehavior.cpp" />
<Unit filename="DestroyOutsideAutomatism.h" /> <Unit filename="DestroyOutsideBehavior.h" />
<Unit filename="Extension.cpp" /> <Unit filename="Extension.cpp" />
<Unit filename="JsExtension.cpp" /> <Unit filename="JsExtension.cpp" />
<Extensions> <Extensions>
@@ -574,7 +574,7 @@
<wxsmith version="1"> <wxsmith version="1">
<gui name="wxWidgets" src="" main="" init_handlers="necessary" language="CPP" /> <gui name="wxWidgets" src="" main="" init_handlers="necessary" language="CPP" />
<resources> <resources>
<wxDialog wxs="wxsmith/DestroyOutsideAutomatismEditor.wxs" src="DestroyOutsideAutomatismEditor.cpp" hdr="DestroyOutsideAutomatismEditor.h" fwddecl="0" i18n="1" name="DestroyOutsideAutomatismEditor" language="CPP" /> <wxDialog wxs="wxsmith/DestroyOutsideBehaviorEditor.wxs" src="DestroyOutsideBehaviorEditor.cpp" hdr="DestroyOutsideBehaviorEditor.h" fwddecl="0" i18n="1" name="DestroyOutsideBehaviorEditor" language="CPP" />
</resources> </resources>
</wxsmith> </wxsmith>
</Extensions> </Extensions>

View File

@@ -1,6 +1,6 @@
/** /**
GDevelop - DestroyOutside Automatism Extension GDevelop - DestroyOutside Behavior Extension
Copyright (c) 2014-2015 Florian Rival (Florian.Rival@gmail.com) Copyright (c) 2014-2015 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License. This project is released under the MIT License.
*/ */
@@ -8,7 +8,7 @@ This project is released under the MIT License.
#include <memory> #include <memory>
#include <iostream> #include <iostream>
#include <SFML/Graphics.hpp> #include <SFML/Graphics.hpp>
#include "DestroyOutsideAutomatism.h" #include "DestroyOutsideBehavior.h"
#include "GDCpp/Scene.h" #include "GDCpp/Scene.h"
#include "GDCpp/RuntimeLayer.h" #include "GDCpp/RuntimeLayer.h"
#include "GDCpp/Serialization/SerializerElement.h" #include "GDCpp/Serialization/SerializerElement.h"
@@ -16,12 +16,12 @@ This project is released under the MIT License.
#include "GDCpp/RuntimeObject.h" #include "GDCpp/RuntimeObject.h"
#include "GDCpp/CommonTools.h" #include "GDCpp/CommonTools.h"
DestroyOutsideAutomatism::DestroyOutsideAutomatism() : DestroyOutsideBehavior::DestroyOutsideBehavior() :
extraBorder(0) extraBorder(0)
{ {
} }
void DestroyOutsideAutomatism::DoStepPostEvents(RuntimeScene & scene) void DestroyOutsideBehavior::DoStepPostEvents(RuntimeScene & scene)
{ {
bool erase = true; bool erase = true;
const RuntimeLayer & theLayer = scene.GetRuntimeLayer(object->GetLayer()); const RuntimeLayer & theLayer = scene.GetRuntimeLayer(object->GetLayer());
@@ -51,13 +51,13 @@ void DestroyOutsideAutomatism::DoStepPostEvents(RuntimeScene & scene)
} }
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
void DestroyOutsideAutomatism::SerializeTo(gd::SerializerElement & element) const void DestroyOutsideBehavior::SerializeTo(gd::SerializerElement & element) const
{ {
element.SetAttribute("extraBorder", extraBorder); element.SetAttribute("extraBorder", extraBorder);
} }
#endif #endif
void DestroyOutsideAutomatism::UnserializeFrom(const gd::SerializerElement & element) void DestroyOutsideBehavior::UnserializeFrom(const gd::SerializerElement & element)
{ {
extraBorder = element.GetDoubleAttribute("extraBorder"); extraBorder = element.GetDoubleAttribute("extraBorder");
} }

View File

@@ -1,13 +1,13 @@
/** /**
GDevelop - DestroyOutside Automatism Extension GDevelop - DestroyOutside Behavior Extension
Copyright (c) 2013-2015 Florian Rival (Florian.Rival@gmail.com) Copyright (c) 2013-2015 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License. This project is released under the MIT License.
*/ */
#ifndef DRAGGABLEAUTOMATISM_H #ifndef DRAGGABLEBEHAVIOR_H
#define DRAGGABLEAUTOMATISM_H #define DRAGGABLEBEHAVIOR_H
#include "GDCpp/Automatism.h" #include "GDCpp/Behavior.h"
#include "GDCpp/Object.h" #include "GDCpp/Object.h"
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
#include <map> #include <map>
@@ -16,24 +16,24 @@ namespace gd { class SerializerElement; }
namespace gd { class Layout; } namespace gd { class Layout; }
/** /**
* \brief Automatism that allows objects to be dragged with the mouse * \brief Behavior that allows objects to be dragged with the mouse
*/ */
class GD_EXTENSION_API DestroyOutsideAutomatism : public Automatism class GD_EXTENSION_API DestroyOutsideBehavior : public Behavior
{ {
public: public:
DestroyOutsideAutomatism(); DestroyOutsideBehavior();
virtual ~DestroyOutsideAutomatism() {}; virtual ~DestroyOutsideBehavior() {};
virtual Automatism* Clone() const { return new DestroyOutsideAutomatism(*this); } virtual Behavior* Clone() const { return new DestroyOutsideBehavior(*this); }
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
/** /**
* \brief Serialize the automatism. * \brief Serialize the behavior.
*/ */
virtual void SerializeTo(gd::SerializerElement & element) const; virtual void SerializeTo(gd::SerializerElement & element) const;
#endif #endif
/** /**
* \brief Unserialize the automatism. * \brief Unserialize the behavior.
*/ */
virtual void UnserializeFrom(const gd::SerializerElement & element); virtual void UnserializeFrom(const gd::SerializerElement & element);
@@ -55,5 +55,5 @@ private:
float extraBorder; ///< The supplementary margin outside the screen that the object must cross before being deleted. float extraBorder; ///< The supplementary margin outside the screen that the object must cross before being deleted.
}; };
#endif // DRAGGABLEAUTOMATISM_H #endif // DRAGGABLEBEHAVIOR_H

View File

@@ -1,35 +1,35 @@
/** /**
GDevelop - DestroyOutside Automatism Extension GDevelop - DestroyOutside Behavior Extension
Copyright (c) 2014-2015 Florian Rival (Florian.Rival@gmail.com) Copyright (c) 2014-2015 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License. This project is released under the MIT License.
*/ */
#include "GDCpp/ExtensionBase.h" #include "GDCpp/ExtensionBase.h"
#include "GDCore/Tools/Version.h" #include "GDCore/Tools/Version.h"
#include "DestroyOutsideAutomatism.h" #include "DestroyOutsideBehavior.h"
void DeclareDestroyOutsideAutomatismExtension(gd::PlatformExtension & extension) void DeclareDestroyOutsideBehaviorExtension(gd::PlatformExtension & extension)
{ {
extension.SetExtensionInformation("DestroyOutsideAutomatism", extension.SetExtensionInformation("DestroyOutsideBehavior",
_("Destroy Outside Screen Automatism"), _("Destroy Outside Screen Behavior"),
_("Automatism destroying object when they go outside the screen"), _("Behavior destroying object when they go outside the screen"),
"Florian Rival", "Florian Rival",
"Open source (MIT License)"); "Open source (MIT License)");
gd::AutomatismMetadata & aut = extension.AddAutomatism("DestroyOutside", gd::BehaviorMetadata & aut = extension.AddBehavior("DestroyOutside",
_("Destroy when outside the screen"), _("Destroy when outside the screen"),
_("DestroyOutside"), _("DestroyOutside"),
_("Automatically destroy the object when it goes outside the screen"), _("Automatically destroy the object when it goes outside the screen"),
"", "",
"CppPlatform/Extensions/destroyoutsideicon.png", "CppPlatform/Extensions/destroyoutsideicon.png",
"DestroyOutsideAutomatism", "DestroyOutsideBehavior",
std::shared_ptr<gd::Automatism>(new DestroyOutsideAutomatism), std::shared_ptr<gd::Behavior>(new DestroyOutsideBehavior),
std::shared_ptr<gd::AutomatismsSharedData>()); std::shared_ptr<gd::BehaviorsSharedData>());
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
aut.SetIncludeFile("DestroyOutsideAutomatism/DestroyOutsideAutomatism.h"); aut.SetIncludeFile("DestroyOutsideBehavior/DestroyOutsideBehavior.h");
aut.AddCondition("ExtraBorder", aut.AddCondition("ExtraBorder",
_("Additional border"), _("Additional border"),
@@ -39,12 +39,12 @@ void DeclareDestroyOutsideAutomatismExtension(gd::PlatformExtension & extension)
"CppPlatform/Extensions/destroyoutsideicon24.png", "CppPlatform/Extensions/destroyoutsideicon24.png",
"CppPlatform/Extensions/destroyoutsideicon16.png") "CppPlatform/Extensions/destroyoutsideicon16.png")
.AddParameter("object", _("Object")) .AddParameter("object", _("Object"))
.AddParameter("automatism", _("Automatism"), "DestroyOutside") .AddParameter("behavior", _("Behavior"), "DestroyOutside")
.AddParameter("relationalOperator", _("Sign of the test")) .AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test")) .AddParameter("expression", _("Value to test"))
.MarkAsAdvanced() .MarkAsAdvanced()
.SetFunctionName("GetExtraBorder").SetManipulatedType("number") .SetFunctionName("GetExtraBorder").SetManipulatedType("number")
.SetIncludeFile("DestroyOutsideAutomatism/DestroyOutsideAutomatism.h"); .SetIncludeFile("DestroyOutsideBehavior/DestroyOutsideBehavior.h");
aut.AddAction("ExtraBorder", aut.AddAction("ExtraBorder",
_("Additional border"), _("Additional border"),
@@ -54,12 +54,12 @@ void DeclareDestroyOutsideAutomatismExtension(gd::PlatformExtension & extension)
"CppPlatform/Extensions/destroyoutsideicon24.png", "CppPlatform/Extensions/destroyoutsideicon24.png",
"CppPlatform/Extensions/destroyoutsideicon16.png") "CppPlatform/Extensions/destroyoutsideicon16.png")
.AddParameter("object", _("Object")) .AddParameter("object", _("Object"))
.AddParameter("automatism", _("Automatism"), "DestroyOutside") .AddParameter("behavior", _("Behavior"), "DestroyOutside")
.AddParameter("operator", _("Modification's sign")) .AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value")) .AddParameter("expression", _("Value"))
.MarkAsAdvanced() .MarkAsAdvanced()
.SetFunctionName("SetExtraBorder").SetManipulatedType("number") .SetFunctionName("SetExtraBorder").SetManipulatedType("number")
.SetGetter("GetExtraBorder").SetIncludeFile("DestroyOutsideAutomatism/DestroyOutsideAutomatism.h"); .SetGetter("GetExtraBorder").SetIncludeFile("DestroyOutsideBehavior/DestroyOutsideBehavior.h");
#endif #endif
} }
@@ -76,7 +76,7 @@ public:
*/ */
Extension() Extension()
{ {
DeclareDestroyOutsideAutomatismExtension(*this); DeclareDestroyOutsideBehaviorExtension(*this);
GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION(); GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
}; };
}; };

View File

@@ -0,0 +1,58 @@
/**
GDevelop - DestroyOutside Extension
Copyright (c) 2014-2015 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License.
*/
#if defined(GD_IDE_ONLY)
#include "GDCore/PlatformDefinition/PlatformExtension.h"
#include "GDCore/Tools/Localization.h"
#include "GDCore/Tools/Version.h"
#include <iostream>
void DeclareDestroyOutsideBehaviorExtension(gd::PlatformExtension & extension);
/**
* \brief This class declares information about the JS extension.
*/
class DestroyOutsideBehaviorJsExtension : public gd::PlatformExtension
{
public:
/**
* \brief Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
*/
DestroyOutsideBehaviorJsExtension()
{
SetExtensionInformation("DestroyOutsideBehavior",
_("Destroy Outside Screen Behavior"),
_("Behavior destroying object when they go outside the screen"),
"Florian Rival",
"Open source (MIT License)");
DeclareDestroyOutsideBehaviorExtension(*this);
GetBehaviorMetadata("DestroyOutsideBehavior::DestroyOutside").SetIncludeFile("DestroyOutsideBehavior/destroyoutsideruntimebehavior.js");
GetAllConditionsForBehavior("DestroyOutsideBehavior::DestroyOutside")["DestroyOutsideBehavior::ExtraBorder"].SetFunctionName("getExtraBorder").SetIncludeFile("DestroyOutsideBehavior/destroyoutsideruntimebehavior.js");
GetAllActionsForBehavior("DestroyOutsideBehavior::DestroyOutside")["DestroyOutsideBehavior::ExtraBorder"].SetFunctionName("setExtraBorder").SetGetter("getExtraBorder").SetIncludeFile("DestroyOutsideBehavior/destroyoutsideruntimebehavior.js");
GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
};
};
//We need a specific function to create the extension with emscripten.
#if defined(EMSCRIPTEN)
extern "C" gd::PlatformExtension * CreateGDJSDestroyOutsideBehaviorExtension() {
return new DestroyOutsideBehaviorJsExtension;
}
#else
/**
* Used by GDevelop to create the extension class
* -- Do not need to be modified. --
*/
extern "C" gd::PlatformExtension * GD_EXTENSION_API CreateGDJSExtension() {
return new DestroyOutsideBehaviorJsExtension;
}
#endif
#endif

View File

@@ -1,26 +1,26 @@
/** /**
GDevelop - DestroyOutside Automatism Extension GDevelop - DestroyOutside Behavior Extension
Copyright (c) 2013-2015 Florian Rival (Florian.Rival@gmail.com) Copyright (c) 2013-2015 Florian Rival (Florian.Rival@gmail.com)
*/ */
/** /**
* The destroyOutsideRuntimeAutomatism represents an automatism allowing objects to be * The destroyOutsideRuntimeBehavior represents an behavior allowing objects to be
* moved using the mouse. * moved using the mouse.
* *
* @class DestroyOutsideRuntimeAutomatism * @class DestroyOutsideRuntimeBehavior
* @constructor * @constructor
*/ */
gdjs.DestroyOutsideRuntimeAutomatism = function(runtimeScene, automatismData, owner) gdjs.DestroyOutsideRuntimeBehavior = function(runtimeScene, behaviorData, owner)
{ {
gdjs.RuntimeAutomatism.call(this, runtimeScene, automatismData, owner); gdjs.RuntimeBehavior.call(this, runtimeScene, behaviorData, owner);
this._extraBorder = automatismData.extraBorder; this._extraBorder = behaviorData.extraBorder;
}; };
gdjs.DestroyOutsideRuntimeAutomatism.prototype = Object.create( gdjs.RuntimeAutomatism.prototype ); gdjs.DestroyOutsideRuntimeBehavior.prototype = Object.create( gdjs.RuntimeBehavior.prototype );
gdjs.DestroyOutsideRuntimeAutomatism.thisIsARuntimeAutomatismConstructor = "DestroyOutsideAutomatism::DestroyOutside"; gdjs.DestroyOutsideRuntimeBehavior.thisIsARuntimeBehaviorConstructor = "DestroyOutsideBehavior::DestroyOutside";
gdjs.DestroyOutsideRuntimeAutomatism.prototype.doStepPostEvents = function(runtimeScene) { gdjs.DestroyOutsideRuntimeBehavior.prototype.doStepPostEvents = function(runtimeScene) {
var ow = this.owner.getWidth(); var ow = this.owner.getWidth();
var oh = this.owner.getWidth(); var oh = this.owner.getWidth();
@@ -38,10 +38,10 @@ gdjs.DestroyOutsideRuntimeAutomatism.prototype.doStepPostEvents = function(runti
} }
}; };
gdjs.DestroyOutsideRuntimeAutomatism.prototype.setExtraBorder = function(val) { gdjs.DestroyOutsideRuntimeBehavior.prototype.setExtraBorder = function(val) {
this._extraBorder = val; this._extraBorder = val;
}; };
gdjs.DestroyOutsideRuntimeAutomatism.prototype.getExtraBorder = function() { gdjs.DestroyOutsideRuntimeBehavior.prototype.getExtraBorder = function() {
return this._extraBorder; return this._extraBorder;
}; };

View File

@@ -1,25 +0,0 @@
cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0015 NEW)
project(DraggableAutomatism)
gd_add_extension_includes()
#Defines
###
gd_add_extension_definitions(DraggableAutomatism)
#The targets
###
include_directories(.)
file(GLOB source_files *)
gd_add_extension_target(DraggableAutomatism "${source_files}")
gdcpp_add_runtime_extension_target(DraggableAutomatism_Runtime "${source_files}")
#Linker files for the IDE extension
###
gd_extension_link_libraries(DraggableAutomatism)
#Linker files for the GD C++ Runtime extension
###
gdcpp_runtime_extension_link_libraries(DraggableAutomatism_Runtime)

View File

@@ -1,55 +0,0 @@
/**
GDevelop - Draggable Automatism Extension
Copyright (c) 2014-2015 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License.
*/
#if defined(GD_IDE_ONLY)
#include "GDCore/PlatformDefinition/PlatformExtension.h"
#include "GDCore/Tools/Localization.h"
#include "GDCore/Tools/Version.h"
#include <iostream>
void DeclareDraggableAutomatismExtension(gd::PlatformExtension & extension);
/**
* \brief This class declares information about the JS extension.
*/
class DraggableAutomatismJsExtension : public gd::PlatformExtension
{
public:
/**
* \brief Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
*/
DraggableAutomatismJsExtension()
{
SetExtensionInformation("DraggableAutomatism",
_("Draggable Automatism"),
_("Automatism allowing to move objects with the mouse"),
"Florian Rival",
"Open source (MIT License)");
DeclareDraggableAutomatismExtension(*this);
GetAutomatismMetadata("DraggableAutomatism::Draggable").SetIncludeFile("DraggableAutomatism/draggableruntimeautomatism.js");
GetAllConditionsForAutomatism("DraggableAutomatism::Draggable")["DraggableAutomatism::Dragged"].SetFunctionName("isDragged").SetIncludeFile("DraggableAutomatism/draggableruntimeautomatism.js");
GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
};
};
#if defined(EMSCRIPTEN)
extern "C" gd::PlatformExtension * CreateGDJSDraggableAutomatismExtension() {
return new DraggableAutomatismJsExtension;
}
#else
/**
* Used by GDevelop to create the extension class
* -- Do not need to be modified. --
*/
extern "C" gd::PlatformExtension * GD_EXTENSION_API CreateGDJSExtension() {
return new DraggableAutomatismJsExtension;
}
#endif
#endif

View File

@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0015 NEW)
project(DraggableBehavior)
gd_add_extension_includes()
#Defines
###
gd_add_extension_definitions(DraggableBehavior)
#The targets
###
include_directories(.)
file(GLOB source_files *)
gd_add_extension_target(DraggableBehavior "${source_files}")
gdcpp_add_runtime_extension_target(DraggableBehavior_Runtime "${source_files}")
#Linker files for the IDE extension
###
gd_extension_link_libraries(DraggableBehavior)
#Linker files for the GD C++ Runtime extension
###
gdcpp_runtime_extension_link_libraries(DraggableBehavior_Runtime)

View File

@@ -1,6 +1,6 @@
/** /**
GDevelop - Draggable Automatism Extension GDevelop - Draggable Behavior Extension
Copyright (c) 2014-2015 Florian Rival (Florian.Rival@gmail.com) Copyright (c) 2014-2015 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License. This project is released under the MIT License.
*/ */
@@ -8,7 +8,7 @@ This project is released under the MIT License.
#include <memory> #include <memory>
#include <iostream> #include <iostream>
#include <SFML/Graphics.hpp> #include <SFML/Graphics.hpp>
#include "DraggableAutomatism.h" #include "DraggableBehavior.h"
#include "GDCpp/Scene.h" #include "GDCpp/Scene.h"
#include "GDCpp/RuntimeLayer.h" #include "GDCpp/RuntimeLayer.h"
#include "GDCpp/Serialization/SerializerElement.h" #include "GDCpp/Serialization/SerializerElement.h"
@@ -16,15 +16,15 @@ This project is released under the MIT License.
#include "GDCpp/RuntimeObject.h" #include "GDCpp/RuntimeObject.h"
#include "GDCpp/CommonTools.h" #include "GDCpp/CommonTools.h"
bool DraggableAutomatism::somethingDragged = false; bool DraggableBehavior::somethingDragged = false;
bool DraggableAutomatism::leftPressedLastFrame = false; bool DraggableBehavior::leftPressedLastFrame = false;
DraggableAutomatism::DraggableAutomatism() : DraggableBehavior::DraggableBehavior() :
dragged(false) dragged(false)
{ {
} }
void DraggableAutomatism::DoStepPreEvents(RuntimeScene & scene) void DraggableBehavior::DoStepPreEvents(RuntimeScene & scene)
{ {
//Begin drag ? //Begin drag ?
if ( !dragged && scene.GetInputManager().IsMouseButtonPressed("Left") && if ( !dragged && scene.GetInputManager().IsMouseButtonPressed("Left") &&
@@ -68,12 +68,12 @@ void DraggableAutomatism::DoStepPreEvents(RuntimeScene & scene)
} }
void DraggableAutomatism::DoStepPostEvents(RuntimeScene & scene) void DraggableBehavior::DoStepPostEvents(RuntimeScene & scene)
{ {
leftPressedLastFrame = scene.GetInputManager().IsMouseButtonPressed("Left"); leftPressedLastFrame = scene.GetInputManager().IsMouseButtonPressed("Left");
} }
void DraggableAutomatism::OnDeActivate() void DraggableBehavior::OnDeActivate()
{ {
if (dragged) somethingDragged = false; if (dragged) somethingDragged = false;
dragged = false; dragged = false;

View File

@@ -1,13 +1,13 @@
/** /**
GDevelop - Draggable Automatism Extension GDevelop - Draggable Behavior Extension
Copyright (c) 2013-2015 Florian Rival (Florian.Rival@gmail.com) Copyright (c) 2013-2015 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License. This project is released under the MIT License.
*/ */
#ifndef DRAGGABLEAUTOMATISM_H #ifndef DRAGGABLEBEHAVIOR_H
#define DRAGGABLEAUTOMATISM_H #define DRAGGABLEBEHAVIOR_H
#include "GDCpp/Automatism.h" #include "GDCpp/Behavior.h"
#include "GDCpp/Object.h" #include "GDCpp/Object.h"
#include <SFML/System/Vector2.hpp> #include <SFML/System/Vector2.hpp>
#include <map> #include <map>
@@ -16,14 +16,14 @@ namespace gd { class SerializerElement; }
namespace gd { class Layout; } namespace gd { class Layout; }
/** /**
* \brief Automatism that allows objects to be dragged with the mouse * \brief Behavior that allows objects to be dragged with the mouse
*/ */
class GD_EXTENSION_API DraggableAutomatism : public Automatism class GD_EXTENSION_API DraggableBehavior : public Behavior
{ {
public: public:
DraggableAutomatism(); DraggableBehavior();
virtual ~DraggableAutomatism() {}; virtual ~DraggableBehavior() {};
virtual Automatism* Clone() const { return new DraggableAutomatism(*this); } virtual Behavior* Clone() const { return new DraggableBehavior(*this); }
/** /**
* \brief Return true if the object is being dragged. * \brief Return true if the object is being dragged.
@@ -44,5 +44,5 @@ private:
static bool leftPressedLastFrame; ///< Used to only start dragging when clicking. static bool leftPressedLastFrame; ///< Used to only start dragging when clicking.
}; };
#endif // DRAGGABLEAUTOMATISM_H #endif // DRAGGABLEBEHAVIOR_H

View File

@@ -1,35 +1,35 @@
/** /**
GDevelop - Draggable Automatism Extension GDevelop - Draggable Behavior Extension
Copyright (c) 2014-2015 Florian Rival (Florian.Rival@gmail.com) Copyright (c) 2014-2015 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License. This project is released under the MIT License.
*/ */
#include "GDCpp/ExtensionBase.h" #include "GDCpp/ExtensionBase.h"
#include "GDCore/Tools/Version.h" #include "GDCore/Tools/Version.h"
#include "DraggableAutomatism.h" #include "DraggableBehavior.h"
void DeclareDraggableAutomatismExtension(gd::PlatformExtension & extension) void DeclareDraggableBehaviorExtension(gd::PlatformExtension & extension)
{ {
extension.SetExtensionInformation("DraggableAutomatism", extension.SetExtensionInformation("DraggableBehavior",
_("Draggable Automatism"), _("Draggable Behavior"),
_("Automatism allowing to move objects with the mouse"), _("Behavior allowing to move objects with the mouse"),
"Florian Rival", "Florian Rival",
"Open source (MIT License)"); "Open source (MIT License)");
gd::AutomatismMetadata & aut = extension.AddAutomatism("Draggable", gd::BehaviorMetadata & aut = extension.AddBehavior("Draggable",
_("Draggable object"), _("Draggable object"),
_("Draggable"), _("Draggable"),
_("Allows objects to be moved using the mouse."), _("Allows objects to be moved using the mouse."),
"", "",
"CppPlatform/Extensions/draggableicon.png", "CppPlatform/Extensions/draggableicon.png",
"DraggableAutomatism", "DraggableBehavior",
std::shared_ptr<gd::Automatism>(new DraggableAutomatism), std::shared_ptr<gd::Behavior>(new DraggableBehavior),
std::shared_ptr<gd::AutomatismsSharedData>()); std::shared_ptr<gd::BehaviorsSharedData>());
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
aut.SetIncludeFile("DraggableAutomatism/DraggableAutomatism.h"); aut.SetIncludeFile("DraggableBehavior/DraggableBehavior.h");
aut.AddCondition("Dragged", aut.AddCondition("Dragged",
_("Being dragged"), _("Being dragged"),
@@ -40,9 +40,9 @@ void DeclareDraggableAutomatismExtension(gd::PlatformExtension & extension)
"CppPlatform/Extensions/draggableicon16.png") "CppPlatform/Extensions/draggableicon16.png")
.AddParameter("object", _("Object")) .AddParameter("object", _("Object"))
.AddParameter("automatism", _("Automatism"), "Draggable") .AddParameter("behavior", _("Behavior"), "Draggable")
.SetFunctionName("IsDragged").SetIncludeFile("DraggableAutomatism/DraggableAutomatism.h"); .SetFunctionName("IsDragged").SetIncludeFile("DraggableBehavior/DraggableBehavior.h");
#endif #endif
} }
@@ -59,7 +59,7 @@ public:
*/ */
Extension() Extension()
{ {
DeclareDraggableAutomatismExtension(*this); DeclareDraggableBehaviorExtension(*this);
GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION(); GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
}; };
}; };

View File

@@ -0,0 +1,55 @@
/**
GDevelop - Draggable Behavior Extension
Copyright (c) 2014-2015 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License.
*/
#if defined(GD_IDE_ONLY)
#include "GDCore/PlatformDefinition/PlatformExtension.h"
#include "GDCore/Tools/Localization.h"
#include "GDCore/Tools/Version.h"
#include <iostream>
void DeclareDraggableBehaviorExtension(gd::PlatformExtension & extension);
/**
* \brief This class declares information about the JS extension.
*/
class DraggableBehaviorJsExtension : public gd::PlatformExtension
{
public:
/**
* \brief Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
*/
DraggableBehaviorJsExtension()
{
SetExtensionInformation("DraggableBehavior",
_("Draggable Behavior"),
_("Behavior allowing to move objects with the mouse"),
"Florian Rival",
"Open source (MIT License)");
DeclareDraggableBehaviorExtension(*this);
GetBehaviorMetadata("DraggableBehavior::Draggable").SetIncludeFile("DraggableBehavior/draggableruntimebehavior.js");
GetAllConditionsForBehavior("DraggableBehavior::Draggable")["DraggableBehavior::Dragged"].SetFunctionName("isDragged").SetIncludeFile("DraggableBehavior/draggableruntimebehavior.js");
GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
};
};
#if defined(EMSCRIPTEN)
extern "C" gd::PlatformExtension * CreateGDJSDraggableBehaviorExtension() {
return new DraggableBehaviorJsExtension;
}
#else
/**
* Used by GDevelop to create the extension class
* -- Do not need to be modified. --
*/
extern "C" gd::PlatformExtension * GD_EXTENSION_API CreateGDJSExtension() {
return new DraggableBehaviorJsExtension;
}
#endif
#endif

View File

@@ -1,18 +1,18 @@
/** /**
GDevelop - Draggable Automatism Extension GDevelop - Draggable Behavior Extension
Copyright (c) 2013-2015 Florian Rival (Florian.Rival@gmail.com) Copyright (c) 2013-2015 Florian Rival (Florian.Rival@gmail.com)
*/ */
/** /**
* The draggableRuntimeAutomatism represents an automatism allowing objects to be * The draggableRuntimeBehavior represents an behavior allowing objects to be
* moved using the mouse. * moved using the mouse.
* *
* @class DraggableRuntimeAutomatism * @class DraggableRuntimeBehavior
* @constructor * @constructor
*/ */
gdjs.DraggableRuntimeAutomatism = function(runtimeScene, automatismData, owner) gdjs.DraggableRuntimeBehavior = function(runtimeScene, behaviorData, owner)
{ {
gdjs.RuntimeAutomatism.call(this, runtimeScene, automatismData, owner); gdjs.RuntimeBehavior.call(this, runtimeScene, behaviorData, owner);
this._dragged = false; this._dragged = false;
this._touchId = null; this._touchId = null;
@@ -22,31 +22,31 @@ gdjs.DraggableRuntimeAutomatism = function(runtimeScene, automatismData, owner)
this._yOffset = 0; this._yOffset = 0;
}; };
gdjs.DraggableRuntimeAutomatism.prototype = Object.create( gdjs.RuntimeAutomatism.prototype ); gdjs.DraggableRuntimeBehavior.prototype = Object.create( gdjs.RuntimeBehavior.prototype );
gdjs.DraggableRuntimeAutomatism.thisIsARuntimeAutomatismConstructor = "DraggableAutomatism::Draggable"; gdjs.DraggableRuntimeBehavior.thisIsARuntimeBehaviorConstructor = "DraggableBehavior::Draggable";
gdjs.DraggableRuntimeAutomatism.prototype.onDeActivate = function() { gdjs.DraggableRuntimeBehavior.prototype.onDeActivate = function() {
this._endDrag(); this._endDrag();
}; };
gdjs.DraggableRuntimeAutomatism.prototype._endDrag = function() { gdjs.DraggableRuntimeBehavior.prototype._endDrag = function() {
if ( this._dragged && this._mouse ) gdjs.DraggableRuntimeAutomatism.mouseDraggingSomething = false; if ( this._dragged && this._mouse ) gdjs.DraggableRuntimeBehavior.mouseDraggingSomething = false;
if ( this._dragged && this._touchId !== null ) gdjs.DraggableRuntimeAutomatism.touchDraggingSomething[this._touchId] = false; if ( this._dragged && this._touchId !== null ) gdjs.DraggableRuntimeBehavior.touchDraggingSomething[this._touchId] = false;
this._dragged = false; this._dragged = false;
this._mouse = false; this._mouse = false;
this._touchId = null; this._touchId = null;
} }
gdjs.DraggableRuntimeAutomatism.prototype._tryBeginDrag = function(runtimeScene) { gdjs.DraggableRuntimeBehavior.prototype._tryBeginDrag = function(runtimeScene) {
if (this._dragged) return false; if (this._dragged) return false;
var inputManager = runtimeScene.getGame().getInputManager(); var inputManager = runtimeScene.getGame().getInputManager();
//Try mouse //Try mouse
if (inputManager.isMouseButtonPressed(0) && if (inputManager.isMouseButtonPressed(0) &&
!gdjs.DraggableRuntimeAutomatism.leftPressedLastFrame && !gdjs.DraggableRuntimeBehavior.leftPressedLastFrame &&
!gdjs.DraggableRuntimeAutomatism.mouseDraggingSomething) { !gdjs.DraggableRuntimeBehavior.mouseDraggingSomething) {
mousePos = runtimeScene.getLayer(this.owner.getLayer()).convertCoords( mousePos = runtimeScene.getLayer(this.owner.getLayer()).convertCoords(
inputManager.getMouseX(), inputManager.getMouseX(),
@@ -57,14 +57,14 @@ gdjs.DraggableRuntimeAutomatism.prototype._tryBeginDrag = function(runtimeScene)
this._mouse = true; this._mouse = true;
this._xOffset = mousePos[0] - this.owner.getX(); this._xOffset = mousePos[0] - this.owner.getX();
this._yOffset = mousePos[1] - this.owner.getY(); this._yOffset = mousePos[1] - this.owner.getY();
gdjs.DraggableRuntimeAutomatism.mouseDraggingSomething = true; gdjs.DraggableRuntimeBehavior.mouseDraggingSomething = true;
return true; return true;
} }
} else { //Try touches } else { //Try touches
var touchIds = inputManager.getStartedTouchIdentifiers(); var touchIds = inputManager.getStartedTouchIdentifiers();
for(var i = 0;i<touchIds.length;++i) { for(var i = 0;i<touchIds.length;++i) {
if (gdjs.DraggableRuntimeAutomatism.touchDraggingSomething[touchIds[i]]) if (gdjs.DraggableRuntimeBehavior.touchDraggingSomething[touchIds[i]])
continue; continue;
touchPos = runtimeScene.getLayer(this.owner.getLayer()).convertCoords( touchPos = runtimeScene.getLayer(this.owner.getLayer()).convertCoords(
@@ -76,7 +76,7 @@ gdjs.DraggableRuntimeAutomatism.prototype._tryBeginDrag = function(runtimeScene)
this._touchId = touchIds[i]; this._touchId = touchIds[i];
this._xOffset = touchPos[0] - this.owner.getX(); this._xOffset = touchPos[0] - this.owner.getX();
this._yOffset = touchPos[1] - this.owner.getY(); this._yOffset = touchPos[1] - this.owner.getY();
gdjs.DraggableRuntimeAutomatism.touchDraggingSomething[touchIds[i]] = true; gdjs.DraggableRuntimeBehavior.touchDraggingSomething[touchIds[i]] = true;
return true; return true;
} }
@@ -86,7 +86,7 @@ gdjs.DraggableRuntimeAutomatism.prototype._tryBeginDrag = function(runtimeScene)
return false; return false;
} }
gdjs.DraggableRuntimeAutomatism.prototype._shouldEndDrag = function(runtimeScene) { gdjs.DraggableRuntimeBehavior.prototype._shouldEndDrag = function(runtimeScene) {
if (!this._dragged) return false; if (!this._dragged) return false;
var inputManager = runtimeScene.getGame().getInputManager(); var inputManager = runtimeScene.getGame().getInputManager();
@@ -99,7 +99,7 @@ gdjs.DraggableRuntimeAutomatism.prototype._shouldEndDrag = function(runtimeScene
return false; return false;
} }
gdjs.DraggableRuntimeAutomatism.prototype._updateObjectPosition = function(runtimeScene) { gdjs.DraggableRuntimeBehavior.prototype._updateObjectPosition = function(runtimeScene) {
if (!this._dragged) return false; if (!this._dragged) return false;
var inputManager = runtimeScene.getGame().getInputManager(); var inputManager = runtimeScene.getGame().getInputManager();
@@ -123,7 +123,7 @@ gdjs.DraggableRuntimeAutomatism.prototype._updateObjectPosition = function(runti
return true; return true;
} }
gdjs.DraggableRuntimeAutomatism.prototype.doStepPreEvents = function(runtimeScene) { gdjs.DraggableRuntimeBehavior.prototype.doStepPreEvents = function(runtimeScene) {
this._tryBeginDrag(runtimeScene); this._tryBeginDrag(runtimeScene);
if (this._shouldEndDrag(runtimeScene)) { if (this._shouldEndDrag(runtimeScene)) {
@@ -133,20 +133,20 @@ gdjs.DraggableRuntimeAutomatism.prototype.doStepPreEvents = function(runtimeScen
this._updateObjectPosition(runtimeScene); this._updateObjectPosition(runtimeScene);
}; };
gdjs.DraggableRuntimeAutomatism.prototype.doStepPostEvents = function(runtimeScene) { gdjs.DraggableRuntimeBehavior.prototype.doStepPostEvents = function(runtimeScene) {
gdjs.DraggableRuntimeAutomatism.leftPressedLastFrame = gdjs.DraggableRuntimeBehavior.leftPressedLastFrame =
runtimeScene.getGame().getInputManager().isMouseButtonPressed(0); runtimeScene.getGame().getInputManager().isMouseButtonPressed(0);
}; };
gdjs.DraggableRuntimeAutomatism.prototype.isDragged = function(runtimeScene) { gdjs.DraggableRuntimeBehavior.prototype.isDragged = function(runtimeScene) {
return this._dragged; return this._dragged;
}; };
//Static property used to avoid start dragging an object while another is dragged. //Static property used to avoid start dragging an object while another is dragged.
gdjs.DraggableRuntimeAutomatism.mouseDraggingSomething = false; gdjs.DraggableRuntimeBehavior.mouseDraggingSomething = false;
//Static property used to avoid start dragging an object while another is dragged by the same touch. //Static property used to avoid start dragging an object while another is dragged by the same touch.
gdjs.DraggableRuntimeAutomatism.touchDraggingSomething = []; gdjs.DraggableRuntimeBehavior.touchDraggingSomething = [];
//Static property used to only start dragging when clicking. //Static property used to only start dragging when clicking.
gdjs.DraggableRuntimeAutomatism.leftPressedLastFrame = false; gdjs.DraggableRuntimeBehavior.leftPressedLastFrame = false;

View File

@@ -1,17 +1,17 @@
describe('gdjs.DraggableRuntimeAutomatism', function() { describe('gdjs.DraggableRuntimeBehavior', function() {
var runtimeGame = new gdjs.RuntimeGame({variables: [], properties: {windowWidth: 800, windowHeight: 600}}); var runtimeGame = new gdjs.RuntimeGame({variables: [], properties: {windowWidth: 800, windowHeight: 600}});
var runtimeScene = new gdjs.RuntimeScene(runtimeGame, null); var runtimeScene = new gdjs.RuntimeScene(runtimeGame, null);
runtimeScene.loadFromScene({ runtimeScene.loadFromScene({
layers:[{name:"", visibility: true}], layers:[{name:"", visibility: true}],
variables: [], variables: [],
automatismsSharedData: [], behaviorsSharedData: [],
objects: [], objects: [],
instances: [] instances: []
}); });
var object = new gdjs.RuntimeObject(runtimeScene, {name: "obj1", type: "", automatisms: [{type: "DraggableAutomatism::Draggable"}]}); var object = new gdjs.RuntimeObject(runtimeScene, {name: "obj1", type: "", behaviors: [{type: "DraggableBehavior::Draggable"}]});
var object2 = new gdjs.RuntimeObject(runtimeScene, {name: "obj1", type: "", automatisms: [{type: "DraggableAutomatism::Draggable"}]}); var object2 = new gdjs.RuntimeObject(runtimeScene, {name: "obj1", type: "", behaviors: [{type: "DraggableBehavior::Draggable"}]});
runtimeScene.addObject(object); runtimeScene.addObject(object);
runtimeScene.addObject(object2); runtimeScene.addObject(object2);

View File

@@ -7,7 +7,7 @@ This project is released under the MIT License.
#include "GDCpp/ExtensionBase.h" #include "GDCpp/ExtensionBase.h"
#include "GDCore/Tools/Version.h" #include "GDCore/Tools/Version.h"
#include "LightObstacleAutomatism.h" #include "LightObstacleBehavior.h"
#include "LightObject.h" #include "LightObject.h"
#include "SceneLightObstacleDatas.h" #include "SceneLightObstacleDatas.h"
@@ -189,15 +189,15 @@ public:
.SetFunctionName("GetQuality").SetIncludeFile("Light/LightObject.h"); .SetFunctionName("GetQuality").SetIncludeFile("Light/LightObject.h");
#endif #endif
AddAutomatism("LightObstacleAutomatism", AddBehavior("LightObstacleBehavior",
_("Light obstacle"), _("Light obstacle"),
_("LightObstacle"), _("LightObstacle"),
_("Mark the objects as obstacles for Light objects."), _("Mark the objects as obstacles for Light objects."),
"", "",
"CppPlatform/Extensions/lightObstacleIcon32.png", "CppPlatform/Extensions/lightObstacleIcon32.png",
"LightObstacleAutomatism", "LightObstacleBehavior",
std::shared_ptr<gd::Automatism>(new LightObstacleAutomatism), std::shared_ptr<gd::Behavior>(new LightObstacleBehavior),
std::shared_ptr<gd::AutomatismsSharedData>(new SceneLightObstacleDatas)); std::shared_ptr<gd::BehaviorsSharedData>(new SceneLightObstacleDatas));
GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION(); GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
}; };

View File

@@ -571,10 +571,10 @@
<Unit filename="LightObject.h" /> <Unit filename="LightObject.h" />
<Unit filename="LightObjectEditor.cpp" /> <Unit filename="LightObjectEditor.cpp" />
<Unit filename="LightObjectEditor.h" /> <Unit filename="LightObjectEditor.h" />
<Unit filename="LightObstacleAutomatism.cpp" /> <Unit filename="LightObstacleBehavior.cpp" />
<Unit filename="LightObstacleAutomatism.h" /> <Unit filename="LightObstacleBehavior.h" />
<Unit filename="LightObstacleAutomatismEditor.cpp" /> <Unit filename="LightObstacleBehaviorEditor.cpp" />
<Unit filename="LightObstacleAutomatismEditor.h" /> <Unit filename="LightObstacleBehaviorEditor.h" />
<Unit filename="RuntimeSceneLightObstacleDatas.cpp" /> <Unit filename="RuntimeSceneLightObstacleDatas.cpp" />
<Unit filename="RuntimeSceneLightObstacleDatas.h" /> <Unit filename="RuntimeSceneLightObstacleDatas.h" />
<Unit filename="SceneLightObstacleDatas.cpp" /> <Unit filename="SceneLightObstacleDatas.cpp" />
@@ -588,7 +588,7 @@
<gui name="wxWidgets" src="" main="" init_handlers="necessary" language="CPP" /> <gui name="wxWidgets" src="" main="" init_handlers="necessary" language="CPP" />
<resources> <resources>
<wxDialog wxs="wxsmith/LightObjectEditor.wxs" src="LightObjectEditor.cpp" hdr="LightObjectEditor.h" fwddecl="0" i18n="1" name="LightObjectEditor" language="CPP" /> <wxDialog wxs="wxsmith/LightObjectEditor.wxs" src="LightObjectEditor.cpp" hdr="LightObjectEditor.h" fwddecl="0" i18n="1" name="LightObjectEditor" language="CPP" />
<wxDialog wxs="wxsmith/LightObstacleAutomatismEditor.wxs" src="LightObstacleAutomatismEditor.cpp" hdr="LightObstacleAutomatismEditor.h" fwddecl="0" i18n="1" name="LightObstacleAutomatismEditor" language="CPP" /> <wxDialog wxs="wxsmith/LightObstacleBehaviorEditor.wxs" src="LightObstacleBehaviorEditor.cpp" hdr="LightObstacleBehaviorEditor.h" fwddecl="0" i18n="1" name="LightObstacleBehaviorEditor" language="CPP" />
</resources> </resources>
</wxsmith> </wxsmith>
</Extensions> </Extensions>

View File

@@ -7,7 +7,7 @@ class Wall;
class Light_Manager class Light_Manager
{ {
public : public :
std::vector <Wall*> walls; ///< Objects with light obstacle automatism have to insert their into this vector std::vector <Wall*> walls; ///< Objects with light obstacle behavior have to insert their into this vector
bool commonBlurEffectLoaded; bool commonBlurEffectLoaded;
sf::Shader commonBlurEffect; sf::Shader commonBlurEffect;

View File

@@ -5,8 +5,8 @@ Copyright (c) 2010-2015 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License. This project is released under the MIT License.
*/ */
#include "LightObstacleAutomatism.h" #include "LightObstacleBehavior.h"
#include "LightObstacleAutomatismEditor.h" #include "LightObstacleBehaviorEditor.h"
#include "LightObject.h" #include "LightObject.h"
#include "GDCpp/Scene.h" #include "GDCpp/Scene.h"
#include "GDCpp/Serialization/SerializerElement.h" #include "GDCpp/Serialization/SerializerElement.h"
@@ -14,12 +14,12 @@ This project is released under the MIT License.
#include <iostream> #include <iostream>
#include <cmath> #include <cmath>
LightObstacleAutomatism::LightObstacleAutomatism() : LightObstacleBehavior::LightObstacleBehavior() :
Automatism(), Behavior(),
disabled(false) disabled(false)
{ {
} }
LightObstacleAutomatism::~LightObstacleAutomatism() LightObstacleBehavior::~LightObstacleBehavior()
{ {
if ( manager ) if ( manager )
{ {
@@ -33,14 +33,14 @@ LightObstacleAutomatism::~LightObstacleAutomatism()
} }
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
void LightObstacleAutomatism::EditAutomatism( wxWindow* parent, gd::Project & game_, gd::Layout * scene, gd::MainFrameWrapper & mainFrameWrapper_ ) void LightObstacleBehavior::EditBehavior( wxWindow* parent, gd::Project & game_, gd::Layout * scene, gd::MainFrameWrapper & mainFrameWrapper_ )
{ {
/*LightObstacleAutomatismEditor editor(parent, game_, scene, *this, gd::MainFrameWrapper_); /*LightObstacleBehaviorEditor editor(parent, game_, scene, *this, gd::MainFrameWrapper_);
editor.ShowModal();*/ editor.ShowModal();*/
} }
#endif #endif
sf::Vector2f LightObstacleAutomatism::RotatePoint( const sf::Vector2f& Point, float Angle ) sf::Vector2f LightObstacleBehavior::RotatePoint( const sf::Vector2f& Point, float Angle )
{ {
Angle = Angle * 3.14159265358979323846f/180.0f; Angle = Angle * 3.14159265358979323846f/180.0f;
sf::Vector2f RotatedPoint; sf::Vector2f RotatedPoint;
@@ -53,7 +53,7 @@ sf::Vector2f LightObstacleAutomatism::RotatePoint( const sf::Vector2f& Point, fl
* Called at each frame before events : * Called at each frame before events :
* Position the object on the path * Position the object on the path
*/ */
void LightObstacleAutomatism::DoStepPostEvents(RuntimeScene & scene) void LightObstacleBehavior::DoStepPostEvents(RuntimeScene & scene)
{ {
//Get a manager for the scene //Get a manager for the scene
if ( RuntimeLightObject::lightManagersList[&scene].expired() ) if ( RuntimeLightObject::lightManagersList[&scene].expired() )
@@ -106,7 +106,7 @@ void LightObstacleAutomatism::DoStepPostEvents(RuntimeScene & scene)
objectOldHeight = object->GetHeight(); objectOldHeight = object->GetHeight();
} }
void LightObstacleAutomatism::OnDeActivate() void LightObstacleBehavior::OnDeActivate()
{ {
if ( manager ) if ( manager )
{ {
@@ -119,7 +119,7 @@ void LightObstacleAutomatism::OnDeActivate()
} }
} }
void LightObstacleAutomatism::OnActivate() void LightObstacleBehavior::OnActivate()
{ {
if ( object ) if ( object )
objectOldX = object->GetX()-42; //Force refreshing walls. objectOldX = object->GetX()-42; //Force refreshing walls.

View File

@@ -24,10 +24,10 @@ freely, subject to the following restrictions:
*/ */
#ifndef LIGHTOBSTACLEAUTOMATISM_H #ifndef LIGHTOBSTACLEBEHAVIOR_H
#define LIGHTOBSTACLEAUTOMATISM_H #define LIGHTOBSTACLEBEHAVIOR_H
#include "GDCpp/Automatism.h" #include "GDCpp/Behavior.h"
#include "GDCpp/RuntimeObject.h" #include "GDCpp/RuntimeObject.h"
#include "Light.h" #include "Light.h"
#include "LightManager.h" #include "LightManager.h"
@@ -36,27 +36,27 @@ freely, subject to the following restrictions:
#include "GDCpp/RuntimeScene.h" #include "GDCpp/RuntimeScene.h"
namespace gd { class SerializerElement; } namespace gd { class SerializerElement; }
namespace gd { class Layout; } namespace gd { class Layout; }
class LightObstacleAutomatismEditor; class LightObstacleBehaviorEditor;
/** /**
* Automatism that set an object as an obstacle for light objects * Behavior that set an object as an obstacle for light objects
*/ */
class GD_EXTENSION_API LightObstacleAutomatism : public Automatism class GD_EXTENSION_API LightObstacleBehavior : public Behavior
{ {
friend class LightObstacleAutomatismEditor; friend class LightObstacleBehaviorEditor;
public: public:
LightObstacleAutomatism(); LightObstacleBehavior();
virtual ~LightObstacleAutomatism(); virtual ~LightObstacleBehavior();
virtual Automatism* Clone() const { return new LightObstacleAutomatism(*this);} virtual Behavior* Clone() const { return new LightObstacleBehavior(*this);}
/** /**
* Access to the object owning the automatism * Access to the object owning the behavior
*/ */
inline RuntimeObject * GetObject() {return object;}; inline RuntimeObject * GetObject() {return object;};
/** /**
* Access to the object owning the automatism * Access to the object owning the behavior
*/ */
inline const RuntimeObject * GetObject() const {return object;}; inline const RuntimeObject * GetObject() const {return object;};
@@ -67,9 +67,9 @@ private:
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
/** /**
* Called when user wants to edit the automatism. * Called when user wants to edit the behavior.
*/ */
virtual void EditAutomatism( wxWindow* parent, gd::Project & game_, gd::Layout * scene, gd::MainFrameWrapper & mainFrameWrapper_ ); virtual void EditBehavior( wxWindow* parent, gd::Project & game_, gd::Layout * scene, gd::MainFrameWrapper & mainFrameWrapper_ );
#endif #endif
virtual void DoStepPostEvents(RuntimeScene & scene); virtual void DoStepPostEvents(RuntimeScene & scene);
@@ -91,5 +91,5 @@ private:
std::shared_ptr<Light_Manager> manager; std::shared_ptr<Light_Manager> manager;
}; };
#endif // LIGHTOBSTACLEAUTOMATISM_H #endif // LIGHTOBSTACLEBEHAVIOR_H

View File

@@ -6,32 +6,32 @@ This project is released under the MIT License.
*/ */
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
#include "LightObstacleAutomatismEditor.h" #include "LightObstacleBehaviorEditor.h"
//(*InternalHeaders(LightObstacleAutomatismEditor) //(*InternalHeaders(LightObstacleBehaviorEditor)
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
//*) //*)
#include "GDCpp/Project.h" #include "GDCpp/Project.h"
#include "LightObstacleAutomatism.h" #include "LightObstacleBehavior.h"
#include "GDCore/IDE/Dialogs/MainFrameWrapper.h" #include "GDCore/IDE/Dialogs/MainFrameWrapper.h"
#include "GDCpp/CommonTools.h" #include "GDCpp/CommonTools.h"
#include "GDCpp/Scene.h" #include "GDCpp/Scene.h"
//(*IdInit(LightObstacleAutomatismEditor) //(*IdInit(LightObstacleBehaviorEditor)
//*) //*)
BEGIN_EVENT_TABLE(LightObstacleAutomatismEditor,wxDialog) BEGIN_EVENT_TABLE(LightObstacleBehaviorEditor,wxDialog)
//(*EventTable(LightObstacleAutomatismEditor) //(*EventTable(LightObstacleBehaviorEditor)
//*) //*)
END_EVENT_TABLE() END_EVENT_TABLE()
LightObstacleAutomatismEditor::LightObstacleAutomatismEditor(wxWindow* parent, gd::Project & game_, gd::Layout * scene_, LightObstacleAutomatism & automatism_ ) : LightObstacleBehaviorEditor::LightObstacleBehaviorEditor(wxWindow* parent, gd::Project & game_, gd::Layout * scene_, LightObstacleBehavior & behavior_ ) :
automatism(automatism_), behavior(behavior_),
game(game_), game(game_),
scene(scene_) scene(scene_)
{ {
//(*Initialize(LightObstacleAutomatismEditor) //(*Initialize(LightObstacleBehaviorEditor)
wxFlexGridSizer* FlexGridSizer1; wxFlexGridSizer* FlexGridSizer1;
Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY")); Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
@@ -43,18 +43,18 @@ scene(scene_)
} }
LightObstacleAutomatismEditor::~LightObstacleAutomatismEditor() LightObstacleBehaviorEditor::~LightObstacleBehaviorEditor()
{ {
//(*Destroy(LightObstacleAutomatismEditor) //(*Destroy(LightObstacleBehaviorEditor)
//*) //*)
} }
void LightObstacleAutomatismEditor::OncancelBtClick(wxCommandEvent& event) void LightObstacleBehaviorEditor::OncancelBtClick(wxCommandEvent& event)
{ {
EndModal(0); EndModal(0);
} }
void LightObstacleAutomatismEditor::OnokBtClick(wxCommandEvent& event) void LightObstacleBehaviorEditor::OnokBtClick(wxCommandEvent& event)
{ {
} }
#endif #endif

View File

@@ -6,43 +6,43 @@ This project is released under the MIT License.
*/ */
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
#ifndef PHYSICSAUTOMATISMEDITOR_H #ifndef PHYSICSBEHAVIOREDITOR_H
#define PHYSICSAUTOMATISMEDITOR_H #define PHYSICSBEHAVIOREDITOR_H
#ifdef __WXMSW__ #ifdef __WXMSW__
#include <wx/msw/winundef.h> #include <wx/msw/winundef.h>
#endif #endif
//(*Headers(LightObstacleAutomatismEditor) //(*Headers(LightObstacleBehaviorEditor)
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/dialog.h> #include <wx/dialog.h>
//*) //*)
#include <memory> #include <memory>
namespace gd { class Project; } namespace gd { class Project; }
namespace gd { class MainFrameWrapper; } namespace gd { class MainFrameWrapper; }
class LightObstacleAutomatism; class LightObstacleBehavior;
namespace gd { class Layout; } namespace gd { class Layout; }
class SceneLightObstacleDatas; class SceneLightObstacleDatas;
class LightObstacleAutomatismEditor: public wxDialog class LightObstacleBehaviorEditor: public wxDialog
{ {
public: public:
LightObstacleAutomatismEditor(wxWindow* parent, gd::Project & game_, gd::Layout * scene, LightObstacleAutomatism & automatism_ ); LightObstacleBehaviorEditor(wxWindow* parent, gd::Project & game_, gd::Layout * scene, LightObstacleBehavior & behavior_ );
virtual ~LightObstacleAutomatismEditor(); virtual ~LightObstacleBehaviorEditor();
//(*Declarations(LightObstacleAutomatismEditor) //(*Declarations(LightObstacleBehaviorEditor)
//*) //*)
LightObstacleAutomatism & automatism; LightObstacleBehavior & behavior;
protected: protected:
//(*Identifiers(LightObstacleAutomatismEditor) //(*Identifiers(LightObstacleBehaviorEditor)
//*) //*)
private: private:
//(*Handlers(LightObstacleAutomatismEditor) //(*Handlers(LightObstacleBehaviorEditor)
void OncancelBtClick(wxCommandEvent& event); void OncancelBtClick(wxCommandEvent& event);
void OnokBtClick(wxCommandEvent& event); void OnokBtClick(wxCommandEvent& event);
//*) //*)

View File

@@ -9,7 +9,7 @@ This project is released under the MIT License.
#include "SceneLightObstacleDatas.h" #include "SceneLightObstacleDatas.h"
#include <iostream> #include <iostream>
RuntimeSceneLightObstacleDatas::RuntimeSceneLightObstacleDatas(const SceneLightObstacleDatas & automatismSharedDatas) RuntimeSceneLightObstacleDatas::RuntimeSceneLightObstacleDatas(const SceneLightObstacleDatas & behaviorSharedDatas)
{ {
} }

View File

@@ -8,19 +8,19 @@ This project is released under the MIT License.
#ifndef RUNTIMESCENELIGHTOBSTACLEDATAS_H #ifndef RUNTIMESCENELIGHTOBSTACLEDATAS_H
#define RUNTIMESCENELIGHTOBSTACLEDATAS_H #define RUNTIMESCENELIGHTOBSTACLEDATAS_H
#include <vector> #include <vector>
#include "GDCpp/AutomatismsRuntimeSharedData.h" #include "GDCpp/BehaviorsRuntimeSharedData.h"
class SceneLightObstacleDatas; class SceneLightObstacleDatas;
class LightObstacleAutomatism; class LightObstacleBehavior;
/** /**
* Datas shared by A Star Automatism at runtime * Datas shared by A Star Behavior at runtime
*/ */
class GD_EXTENSION_API RuntimeSceneLightObstacleDatas : public AutomatismsRuntimeSharedData class GD_EXTENSION_API RuntimeSceneLightObstacleDatas : public BehaviorsRuntimeSharedData
{ {
public: public:
RuntimeSceneLightObstacleDatas(const SceneLightObstacleDatas & automatismSharedDatas); RuntimeSceneLightObstacleDatas(const SceneLightObstacleDatas & behaviorSharedDatas);
virtual ~RuntimeSceneLightObstacleDatas(); virtual ~RuntimeSceneLightObstacleDatas();
virtual std::shared_ptr<AutomatismsRuntimeSharedData> Clone() const { return std::shared_ptr<AutomatismsRuntimeSharedData>(new RuntimeSceneLightObstacleDatas(*this));} virtual std::shared_ptr<BehaviorsRuntimeSharedData> Clone() const { return std::shared_ptr<BehaviorsRuntimeSharedData>(new RuntimeSceneLightObstacleDatas(*this));}
float gridWidth; float gridWidth;
float gridHeight; float gridHeight;

View File

@@ -8,22 +8,22 @@ This project is released under the MIT License.
#ifndef SCENELIGHTOBSTACLEPHYSICSDATAS_H #ifndef SCENELIGHTOBSTACLEPHYSICSDATAS_H
#define SCENELIGHTOBSTACLEPHYSICSDATAS_H #define SCENELIGHTOBSTACLEPHYSICSDATAS_H
#include "GDCpp/AutomatismsSharedData.h" #include "GDCpp/BehaviorsSharedData.h"
#include "RuntimeSceneLightObstacleDatas.h" #include "RuntimeSceneLightObstacleDatas.h"
/** /**
* \brief Data common to all light obstacles automatisms of a scene. * \brief Data common to all light obstacles behaviors of a scene.
*/ */
class GD_EXTENSION_API SceneLightObstacleDatas : public gd::AutomatismsSharedData class GD_EXTENSION_API SceneLightObstacleDatas : public gd::BehaviorsSharedData
{ {
public: public:
SceneLightObstacleDatas() {}; SceneLightObstacleDatas() {};
virtual ~SceneLightObstacleDatas() {}; virtual ~SceneLightObstacleDatas() {};
virtual std::shared_ptr<gd::AutomatismsSharedData> Clone() const { return std::shared_ptr<gd::AutomatismsSharedData>(new SceneLightObstacleDatas(*this));} virtual std::shared_ptr<gd::BehaviorsSharedData> Clone() const { return std::shared_ptr<gd::BehaviorsSharedData>(new SceneLightObstacleDatas(*this));}
virtual std::shared_ptr<AutomatismsRuntimeSharedData> CreateRuntimeSharedDatas() virtual std::shared_ptr<BehaviorsRuntimeSharedData> CreateRuntimeSharedDatas()
{ {
return std::shared_ptr<AutomatismsRuntimeSharedData>(new RuntimeSceneLightObstacleDatas(*this)); return std::shared_ptr<BehaviorsRuntimeSharedData>(new RuntimeSceneLightObstacleDatas(*this));
} }
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<wxsmith> <wxsmith>
<object class="wxDialog" name="AStarAutomatismEditor"> <object class="wxDialog" name="AStarBehaviorEditor">
<title>Automatism setup</title> <title>Behavior setup</title>
<centered>1</centered> <centered>1</centered>
<id_arg>0</id_arg> <id_arg>0</id_arg>
<object class="wxFlexGridSizer" variable="FlexGridSizer1" member="no"> <object class="wxFlexGridSizer" variable="FlexGridSizer1" member="no">
@@ -140,7 +140,7 @@
</object> </object>
<object class="sizeritem"> <object class="sizeritem">
<object class="wxStaticBoxSizer" variable="StaticBoxSizer2" member="no"> <object class="wxStaticBoxSizer" variable="StaticBoxSizer2" member="no">
<label>Automatism global parameters</label> <label>Behavior global parameters</label>
<object class="sizeritem"> <object class="sizeritem">
<object class="wxFlexGridSizer" variable="FlexGridSizer4" member="no"> <object class="wxFlexGridSizer" variable="FlexGridSizer4" member="no">
<cols>1</cols> <cols>1</cols>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<wxsmith> <wxsmith>
<object class="wxDialog" name="LightObstacleAutomatismEditor"> <object class="wxDialog" name="LightObstacleBehaviorEditor">
<id_arg>0</id_arg> <id_arg>0</id_arg>
<object class="wxFlexGridSizer" variable="FlexGridSizer1" member="no"> <object class="wxFlexGridSizer" variable="FlexGridSizer1" member="no">
<cols>3</cols> <cols>3</cols>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<wxsmith> <wxsmith>
<object class="wxDialog" name="PhysicsAutomatismEditor"> <object class="wxDialog" name="PhysicsBehaviorEditor">
<title>Edit the automatism</title> <title>Edit the behavior</title>
<id_arg>0</id_arg> <id_arg>0</id_arg>
<object class="wxFlexGridSizer" variable="FlexGridSizer1" member="no"> <object class="wxFlexGridSizer" variable="FlexGridSizer1" member="no">
<cols>1</cols> <cols>1</cols>

View File

@@ -5,7 +5,7 @@ describe('gdjs.LinksManager', function() {
runtimeScene.loadFromScene({ runtimeScene.loadFromScene({
layers:[{name:"", visibility: true}], layers:[{name:"", visibility: true}],
variables: [], variables: [],
automatismsSharedData: [], behaviorsSharedData: [],
objects: [], objects: [],
instances: [] instances: []
}); });

View File

@@ -8,7 +8,7 @@ This project is released under the MIT License.
#include "GDCpp/ExtensionBase.h" #include "GDCpp/ExtensionBase.h"
#include "GDCore/Tools/Version.h" #include "GDCore/Tools/Version.h"
#include "GDCpp/CommonTools.h" #include "GDCpp/CommonTools.h"
#include "NetworkAutomatism.h" #include "NetworkBehavior.h"
#include "NetworkManager.h" #include "NetworkManager.h"
#include <SFML/Network.hpp> #include <SFML/Network.hpp>
@@ -158,71 +158,71 @@ public:
_("Generate objects' identifiers"), _("Generate objects' identifiers"),
_("Generate automatically identifiers for these objects.\nNote that this action must be preferably used at the start of the scene for example, so as to be sure objects\nhave the same unique identifiers on the different computers."), _("Generate automatically identifiers for these objects.\nNote that this action must be preferably used at the start of the scene for example, so as to be sure objects\nhave the same unique identifiers on the different computers."),
_("Generate unique network identifiers for _PARAM0_"), _("Generate unique network identifiers for _PARAM0_"),
_("Automatism Automatic Network Updater"), _("Behavior Automatic Network Updater"),
"CppPlatform/Extensions/networkicon24.png", "CppPlatform/Extensions/networkicon24.png",
"CppPlatform/Extensions/networkicon.png") "CppPlatform/Extensions/networkicon.png")
.AddParameter("objectList", _("Object")) .AddParameter("objectList", _("Object"))
.AddParameter("automatism", _("Automatism"), "NetworkAutomatism") .AddParameter("behavior", _("Behavior"), "NetworkBehavior")
.SetFunctionName("NetworkAutomatism::GenerateObjectNetworkIdentifier").SetIncludeFile("Network/NetworkAutomatism.h"); .SetFunctionName("NetworkBehavior::GenerateObjectNetworkIdentifier").SetIncludeFile("Network/NetworkBehavior.h");
#endif #endif
{ {
gd::AutomatismMetadata & aut = AddAutomatism("NetworkAutomatism", gd::BehaviorMetadata & aut = AddBehavior("NetworkBehavior",
_("Automatic network update"), _("Automatic network update"),
_("NetworkUpdater"), _("NetworkUpdater"),
_("Allows to automatically synchronize the objects of a game on the network."), _("Allows to automatically synchronize the objects of a game on the network."),
"", "",
"CppPlatform/Extensions/networkicon32.png", "CppPlatform/Extensions/networkicon32.png",
"NetworkAutomatism", "NetworkBehavior",
std::shared_ptr<gd::Automatism>(new NetworkAutomatism), std::shared_ptr<gd::Behavior>(new NetworkBehavior),
std::shared_ptr<gd::AutomatismsSharedData>(new SceneNetworkDatas)); std::shared_ptr<gd::BehaviorsSharedData>(new SceneNetworkDatas));
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
aut.SetIncludeFile("Network/NetworkAutomatism.h"); aut.SetIncludeFile("Network/NetworkBehavior.h");
aut.AddAction("SetAsSender", aut.AddAction("SetAsSender",
_("Set to send data"), _("Set to send data"),
_("The automatism will send the data of the objects.\nBe sure to have generated identifiers for these objects before."), _("The behavior will send the data of the objects.\nBe sure to have generated identifiers for these objects before."),
_("Set _PARAM0_ to send data"), _("Set _PARAM0_ to send data"),
_("Automatism Automatic Network Updater"), _("Behavior Automatic Network Updater"),
"CppPlatform/Extensions/networkicon24.png", "CppPlatform/Extensions/networkicon24.png",
"CppPlatform/Extensions/networkicon.png") "CppPlatform/Extensions/networkicon.png")
.AddParameter("object", _("Object")) .AddParameter("object", _("Object"))
.AddParameter("automatism", _("Automatism"), "NetworkAutomatism") .AddParameter("behavior", _("Behavior"), "NetworkBehavior")
.SetFunctionName("SetAsSender").SetIncludeFile("Network/NetworkAutomatism.h"); .SetFunctionName("SetAsSender").SetIncludeFile("Network/NetworkBehavior.h");
aut.AddAction("SetAsReceiver", aut.AddAction("SetAsReceiver",
_("Set to receive data"), _("Set to receive data"),
_("The automatism will receive the data and will update the objects.\nBe sure to have generated identifiers for these objects before."), _("The behavior will receive the data and will update the objects.\nBe sure to have generated identifiers for these objects before."),
_("Set _PARAM0_ to receive data"), _("Set _PARAM0_ to receive data"),
_("Automatism Automatic Network Updater"), _("Behavior Automatic Network Updater"),
"CppPlatform/Extensions/networkicon24.png", "CppPlatform/Extensions/networkicon24.png",
"CppPlatform/Extensions/networkicon.png") "CppPlatform/Extensions/networkicon.png")
.AddParameter("object", _("Object")) .AddParameter("object", _("Object"))
.AddParameter("automatism", _("Automatism"), "NetworkAutomatism") .AddParameter("behavior", _("Behavior"), "NetworkBehavior")
.SetFunctionName("SetAsReceiver").SetIncludeFile("Network/NetworkAutomatism.h"); .SetFunctionName("SetAsReceiver").SetIncludeFile("Network/NetworkBehavior.h");
aut.AddAction("SetIdentifier", aut.AddAction("SetIdentifier",
_("Change object's identifier"), _("Change object's identifier"),
_("Each object need a unique identifier, the same on all computers, so as to be identified and updated"), _("Each object need a unique identifier, the same on all computers, so as to be identified and updated"),
_("Set identifier of _PARAM0_ to _PARAM2_"), _("Set identifier of _PARAM0_ to _PARAM2_"),
_("Automatism Automatic Network Updater"), _("Behavior Automatic Network Updater"),
"CppPlatform/Extensions/networkicon24.png", "CppPlatform/Extensions/networkicon24.png",
"CppPlatform/Extensions/networkicon.png") "CppPlatform/Extensions/networkicon.png")
.AddParameter("object", _("Object")) .AddParameter("object", _("Object"))
.AddParameter("automatism", _("Automatism"), "NetworkAutomatism") .AddParameter("behavior", _("Behavior"), "NetworkBehavior")
.AddParameter("expression", _("Identifier")) .AddParameter("expression", _("Identifier"))
.SetFunctionName("SetIdentifier").SetIncludeFile("Network/NetworkAutomatism.h"); .SetFunctionName("SetIdentifier").SetIncludeFile("Network/NetworkBehavior.h");
aut.AddExpression("GetIdentifier", _("Get the identifier of the object"), _("Get the identifier of the object"), _("Automatism Automatic Network Updater"), "res/texteicon.png") aut.AddExpression("GetIdentifier", _("Get the identifier of the object"), _("Get the identifier of the object"), _("Behavior Automatic Network Updater"), "res/texteicon.png")
.AddParameter("object", _("Object")) .AddParameter("object", _("Object"))
.AddParameter("automatism", _("Automatism"), "NetworkAutomatism") .AddParameter("behavior", _("Behavior"), "NetworkBehavior")
.SetFunctionName("GetIdentifier").SetIncludeFile("Network/NetworkAutomatism.h"); .SetFunctionName("GetIdentifier").SetIncludeFile("Network/NetworkBehavior.h");
#endif #endif
} }

View File

@@ -581,10 +581,10 @@
<Unit filename="ErrorManager.cpp" /> <Unit filename="ErrorManager.cpp" />
<Unit filename="ErrorManager.h" /> <Unit filename="ErrorManager.h" />
<Unit filename="Extension.cpp" /> <Unit filename="Extension.cpp" />
<Unit filename="NetworkAutomatism.cpp" /> <Unit filename="NetworkBehavior.cpp" />
<Unit filename="NetworkAutomatism.h" /> <Unit filename="NetworkBehavior.h" />
<Unit filename="NetworkAutomatismEditor.cpp" /> <Unit filename="NetworkBehaviorEditor.cpp" />
<Unit filename="NetworkAutomatismEditor.h" /> <Unit filename="NetworkBehaviorEditor.h" />
<Unit filename="NetworkManager.cpp" /> <Unit filename="NetworkManager.cpp" />
<Unit filename="NetworkManager.h" /> <Unit filename="NetworkManager.h" />
<Unit filename="NetworkManagerFunctions.cpp" /> <Unit filename="NetworkManagerFunctions.cpp" />
@@ -611,7 +611,7 @@
</DoxyBlocks> </DoxyBlocks>
<wxsmith version="1"> <wxsmith version="1">
<resources> <resources>
<wxDialog wxs="wxsmith/NetworkAutomatismEditor.wxs" src="NetworkAutomatismEditor.cpp" hdr="NetworkAutomatismEditor.h" fwddecl="0" i18n="1" name="NetworkAutomatismEditor" language="CPP" /> <wxDialog wxs="wxsmith/NetworkBehaviorEditor.wxs" src="NetworkBehaviorEditor.cpp" hdr="NetworkBehaviorEditor.h" fwddecl="0" i18n="1" name="NetworkBehaviorEditor" language="CPP" />
</resources> </resources>
</wxsmith> </wxsmith>
</Extensions> </Extensions>

View File

@@ -13,11 +13,11 @@ This project is released under the MIT License.
#include "GDCpp/Serialization/SerializerElement.h" #include "GDCpp/Serialization/SerializerElement.h"
#include "GDCpp/CommonTools.h" #include "GDCpp/CommonTools.h"
#include "ReceivedDataManager.h" #include "ReceivedDataManager.h"
#include "NetworkAutomatismEditor.h" #include "NetworkBehaviorEditor.h"
#include "NetworkAutomatism.h" #include "NetworkBehavior.h"
#include "NetworkManager.h" #include "NetworkManager.h"
NetworkAutomatism::NetworkAutomatism() : NetworkBehavior::NetworkBehavior() :
dataPrefix("Object"), dataPrefix("Object"),
xPosition(true), xPosition(true),
yPosition(true), yPosition(true),
@@ -29,15 +29,15 @@ NetworkAutomatism::NetworkAutomatism() :
{ {
} }
NetworkAutomatism::~NetworkAutomatism() NetworkBehavior::~NetworkBehavior()
{ {
} }
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
void NetworkAutomatism::EditAutomatism( wxWindow* parent, gd::Project & game_, gd::Layout * scene, gd::MainFrameWrapper & mainFrameWrapper_ ) void NetworkBehavior::EditBehavior( wxWindow* parent, gd::Project & game_, gd::Layout * scene, gd::MainFrameWrapper & mainFrameWrapper_ )
{ {
#if !defined(GD_NO_WX_GUI) #if !defined(GD_NO_WX_GUI)
NetworkAutomatismEditor editor(parent, game_, scene, *this); NetworkBehaviorEditor editor(parent, game_, scene, *this);
editor.ShowModal(); editor.ShowModal();
#endif #endif
} }
@@ -46,7 +46,7 @@ void NetworkAutomatism::EditAutomatism( wxWindow* parent, gd::Project & game_, g
/** /**
* Called at each frame before events * Called at each frame before events
*/ */
void NetworkAutomatism::DoStepPreEvents(RuntimeScene & scene) void NetworkBehavior::DoStepPreEvents(RuntimeScene & scene)
{ {
if ( !sending ) if ( !sending )
{ {
@@ -61,7 +61,7 @@ void NetworkAutomatism::DoStepPreEvents(RuntimeScene & scene)
/** /**
* Called at each frame after events * Called at each frame after events
*/ */
void NetworkAutomatism::DoStepPostEvents(RuntimeScene & scene) void NetworkBehavior::DoStepPostEvents(RuntimeScene & scene)
{ {
if ( !sending ) return; if ( !sending ) return;
@@ -115,7 +115,7 @@ void NetworkAutomatism::DoStepPostEvents(RuntimeScene & scene)
/** /**
* Generate an object network identifier, unique for each object. * Generate an object network identifier, unique for each object.
*/ */
void NetworkAutomatism::GenerateObjectNetworkIdentifier( std::map <gd::String, std::vector<RuntimeObject*> *> objectsLists1, const gd::String & automatismName) void NetworkBehavior::GenerateObjectNetworkIdentifier( std::map <gd::String, std::vector<RuntimeObject*> *> objectsLists1, const gd::String & behaviorName)
{ {
std::vector<RuntimeObject*> objects1; std::vector<RuntimeObject*> objects1;
for (std::map <gd::String, std::vector<RuntimeObject*> *>::const_iterator it = objectsLists1.begin();it!=objectsLists1.end();++it) for (std::map <gd::String, std::vector<RuntimeObject*> *>::const_iterator it = objectsLists1.begin();it!=objectsLists1.end();++it)
@@ -130,14 +130,14 @@ void NetworkAutomatism::GenerateObjectNetworkIdentifier( std::map <gd::String, s
for ( unsigned int i = 0; i<objects1.size(); ++i ) for ( unsigned int i = 0; i<objects1.size(); ++i )
{ {
//We can afford a dynamic_cast in this action //We can afford a dynamic_cast in this action
NetworkAutomatism* automatism = dynamic_cast<NetworkAutomatism*>(objects1[i]->GetAutomatismRawPointer(automatismName)); NetworkBehavior* behavior = dynamic_cast<NetworkBehavior*>(objects1[i]->GetBehaviorRawPointer(behaviorName));
if ( automatism != NULL ) automatism->objectNetworkId = i; if ( behavior != NULL ) behavior->objectNetworkId = i;
} }
} }
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
void NetworkAutomatism::SerializeTo(gd::SerializerElement & element) const void NetworkBehavior::SerializeTo(gd::SerializerElement & element) const
{ {
element.SetAttribute("sending", sending); element.SetAttribute("sending", sending);
element.SetAttribute("xPosition", xPosition); element.SetAttribute("xPosition", xPosition);
@@ -149,7 +149,7 @@ void NetworkAutomatism::SerializeTo(gd::SerializerElement & element) const
} }
#endif #endif
void NetworkAutomatism::UnserializeFrom(const gd::SerializerElement & element) void NetworkBehavior::UnserializeFrom(const gd::SerializerElement & element)
{ {
sending = element.GetBoolAttribute("sending"); sending = element.GetBoolAttribute("sending");
xPosition = element.GetBoolAttribute("xPosition"); xPosition = element.GetBoolAttribute("xPosition");

View File

@@ -5,43 +5,43 @@ Copyright (c) 2010-2015 Florian Rival (Florian.Rival@gmail.com)
This project is released under the MIT License. This project is released under the MIT License.
*/ */
#ifndef NETWORKAUTOMATISM_H #ifndef NETWORKBEHAVIOR_H
#define NETWORKAUTOMATISM_H #define NETWORKBEHAVIOR_H
#include "GDCpp/Automatism.h" #include "GDCpp/Behavior.h"
#include "GDCpp/Object.h" #include "GDCpp/Object.h"
#include "SceneNetworkDatas.h" #include "SceneNetworkDatas.h"
#include <map> #include <map>
namespace gd { class SerializerElement; } namespace gd { class SerializerElement; }
namespace gd { class Layout; } namespace gd { class Layout; }
class NetworkAutomatismEditor; class NetworkBehaviorEditor;
class GD_EXTENSION_API NetworkAutomatism : public Automatism class GD_EXTENSION_API NetworkBehavior : public Behavior
{ {
friend class NetworkAutomatismEditor; friend class NetworkBehaviorEditor;
public: public:
NetworkAutomatism(); NetworkBehavior();
virtual ~NetworkAutomatism(); virtual ~NetworkBehavior();
virtual Automatism * Clone() const { return (new NetworkAutomatism(*this));} virtual Behavior * Clone() const { return (new NetworkBehavior(*this));}
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
/** /**
* Serialize the automatism * Serialize the behavior
*/ */
virtual void SerializeTo(gd::SerializerElement & element) const; virtual void SerializeTo(gd::SerializerElement & element) const;
#endif #endif
/** /**
* Unserialize the automatism * Unserialize the behavior
*/ */
virtual void UnserializeFrom(const gd::SerializerElement & element); virtual void UnserializeFrom(const gd::SerializerElement & element);
#if defined(GD_IDE_ONLY) #if defined(GD_IDE_ONLY)
/** /**
* Called when user wants to edit the automatism. * Called when user wants to edit the behavior.
*/ */
virtual void EditAutomatism( wxWindow* parent, gd::Project & game_, gd::Layout * scene, gd::MainFrameWrapper & mainFrameWrapper_ ); virtual void EditBehavior( wxWindow* parent, gd::Project & game_, gd::Layout * scene, gd::MainFrameWrapper & mainFrameWrapper_ );
#endif #endif
static std::map < const gd::Layout* , SceneNetworkDatas > scenesNetworkDatas; ///< Static map associating scene to datas static std::map < const gd::Layout* , SceneNetworkDatas > scenesNetworkDatas; ///< Static map associating scene to datas
@@ -59,9 +59,9 @@ public:
unsigned int GetIdentifier() const { return objectNetworkId; } unsigned int GetIdentifier() const { return objectNetworkId; }
/** /**
* Generate a unique identifier for all objects of list, using automatism named automatismName. * Generate a unique identifier for all objects of list, using behavior named behaviorName.
*/ */
static void GenerateObjectNetworkIdentifier(std::map <gd::String, std::vector<RuntimeObject*> *> objectsLists, const gd::String & automatismName); static void GenerateObjectNetworkIdentifier(std::map <gd::String, std::vector<RuntimeObject*> *> objectsLists, const gd::String & behaviorName);
private: private:
@@ -74,5 +74,5 @@ private:
std::shared_ptr<RuntimeSceneNetworkDatas> runtimeScenesNetworkDatas; std::shared_ptr<RuntimeSceneNetworkDatas> runtimeScenesNetworkDatas;
}; };
#endif // NETWORKAUTOMATISM_H #endif // NETWORKBEHAVIOR_H

View File

@@ -6,44 +6,44 @@ This project is released under the MIT License.
*/ */
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
#include "NetworkAutomatismEditor.h" #include "NetworkBehaviorEditor.h"
//(*InternalHeaders(NetworkAutomatismEditor) //(*InternalHeaders(NetworkBehaviorEditor)
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
//*) //*)
#include "GDCpp/Project.h" #include "GDCpp/Project.h"
#include "NetworkAutomatism.h" #include "NetworkBehavior.h"
#include "GDCore/IDE/Dialogs/MainFrameWrapper.h" #include "GDCore/IDE/Dialogs/MainFrameWrapper.h"
#include "GDCpp/CommonTools.h" #include "GDCpp/CommonTools.h"
#include "GDCpp/Scene.h" #include "GDCpp/Scene.h"
//(*IdInit(NetworkAutomatismEditor) //(*IdInit(NetworkBehaviorEditor)
const long NetworkAutomatismEditor::ID_RADIOBOX1 = wxNewId(); const long NetworkBehaviorEditor::ID_RADIOBOX1 = wxNewId();
const long NetworkAutomatismEditor::ID_STATICTEXT1 = wxNewId(); const long NetworkBehaviorEditor::ID_STATICTEXT1 = wxNewId();
const long NetworkAutomatismEditor::ID_CHECKBOX1 = wxNewId(); const long NetworkBehaviorEditor::ID_CHECKBOX1 = wxNewId();
const long NetworkAutomatismEditor::ID_CHECKBOX2 = wxNewId(); const long NetworkBehaviorEditor::ID_CHECKBOX2 = wxNewId();
const long NetworkAutomatismEditor::ID_CHECKBOX3 = wxNewId(); const long NetworkBehaviorEditor::ID_CHECKBOX3 = wxNewId();
const long NetworkAutomatismEditor::ID_CHECKBOX4 = wxNewId(); const long NetworkBehaviorEditor::ID_CHECKBOX4 = wxNewId();
const long NetworkAutomatismEditor::ID_CHECKBOX5 = wxNewId(); const long NetworkBehaviorEditor::ID_CHECKBOX5 = wxNewId();
const long NetworkAutomatismEditor::ID_TEXTCTRL1 = wxNewId(); const long NetworkBehaviorEditor::ID_TEXTCTRL1 = wxNewId();
const long NetworkAutomatismEditor::ID_STATICTEXT2 = wxNewId(); const long NetworkBehaviorEditor::ID_STATICTEXT2 = wxNewId();
const long NetworkAutomatismEditor::ID_STATICTEXT3 = wxNewId(); const long NetworkBehaviorEditor::ID_STATICTEXT3 = wxNewId();
const long NetworkAutomatismEditor::ID_BUTTON1 = wxNewId(); const long NetworkBehaviorEditor::ID_BUTTON1 = wxNewId();
const long NetworkAutomatismEditor::ID_BUTTON2 = wxNewId(); const long NetworkBehaviorEditor::ID_BUTTON2 = wxNewId();
//*) //*)
BEGIN_EVENT_TABLE(NetworkAutomatismEditor,wxDialog) BEGIN_EVENT_TABLE(NetworkBehaviorEditor,wxDialog)
//(*EventTable(NetworkAutomatismEditor) //(*EventTable(NetworkBehaviorEditor)
//*) //*)
END_EVENT_TABLE() END_EVENT_TABLE()
NetworkAutomatismEditor::NetworkAutomatismEditor(wxWindow* parent, gd::Project & game_, gd::Layout * scene_, NetworkAutomatism & automatism_ ) : NetworkBehaviorEditor::NetworkBehaviorEditor(wxWindow* parent, gd::Project & game_, gd::Layout * scene_, NetworkBehavior & behavior_ ) :
automatism(automatism_), behavior(behavior_),
game(game_), game(game_),
scene(scene_) scene(scene_)
{ {
//(*Initialize(NetworkAutomatismEditor) //(*Initialize(NetworkBehaviorEditor)
wxStaticBoxSizer* StaticBoxSizer2; wxStaticBoxSizer* StaticBoxSizer2;
wxFlexGridSizer* FlexGridSizer4; wxFlexGridSizer* FlexGridSizer4;
wxFlexGridSizer* FlexGridSizer3; wxFlexGridSizer* FlexGridSizer3;
@@ -55,7 +55,7 @@ scene(scene_)
wxStaticBoxSizer* StaticBoxSizer1; wxStaticBoxSizer* StaticBoxSizer1;
wxFlexGridSizer* FlexGridSizer1; wxFlexGridSizer* FlexGridSizer1;
Create(parent, wxID_ANY, _("Edit the automatism"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY")); Create(parent, wxID_ANY, _("Edit the behavior"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("wxID_ANY"));
FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer1 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer4 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer4 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer3 = new wxFlexGridSizer(0, 1, 0, 0); FlexGridSizer3 = new wxFlexGridSizer(0, 1, 0, 0);
@@ -66,7 +66,7 @@ scene(scene_)
}; };
initialBehaviourList = new wxRadioBox(this, ID_RADIOBOX1, _("Initial behaviour"), wxDefaultPosition, wxDefaultSize, 2, __wxRadioBoxChoices_1, 1, 0, wxDefaultValidator, _T("ID_RADIOBOX1")); initialBehaviourList = new wxRadioBox(this, ID_RADIOBOX1, _("Initial behaviour"), wxDefaultPosition, wxDefaultSize, 2, __wxRadioBoxChoices_1, 1, 0, wxDefaultValidator, _T("ID_RADIOBOX1"));
FlexGridSizer3->Add(initialBehaviourList, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer3->Add(initialBehaviourList, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Depending on whether the game is \"hosting\" or joining, you wish change this behaviour\nof the automatism. You can use actions in the sub category \"Network > Automatism Automatic Network Updater\""), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1")); StaticText1 = new wxStaticText(this, ID_STATICTEXT1, _("Depending on whether the game is \"hosting\" or joining, you wish change this behaviour\nof the behavior. You can use actions in the sub category \"Network > Behavior Automatic Network Updater\""), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
FlexGridSizer3->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5); FlexGridSizer3->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer4->Add(FlexGridSizer3, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0); FlexGridSizer4->Add(FlexGridSizer3, 1, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 0);
FlexGridSizer5 = new wxFlexGridSizer(0, 2, 0, 0); FlexGridSizer5 = new wxFlexGridSizer(0, 2, 0, 0);
@@ -116,42 +116,42 @@ scene(scene_)
FlexGridSizer1->Fit(this); FlexGridSizer1->Fit(this);
FlexGridSizer1->SetSizeHints(this); FlexGridSizer1->SetSizeHints(this);
Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&NetworkAutomatismEditor::OnokBtClick); Connect(ID_BUTTON1,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&NetworkBehaviorEditor::OnokBtClick);
Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&NetworkAutomatismEditor::OncancelBtClick); Connect(ID_BUTTON2,wxEVT_COMMAND_BUTTON_CLICKED,(wxObjectEventFunction)&NetworkBehaviorEditor::OncancelBtClick);
//*) //*)
initialBehaviourList->SetSelection(automatism.sending ? 0 : 1); initialBehaviourList->SetSelection(behavior.sending ? 0 : 1);
xPosCheck->SetValue(automatism.xPosition); xPosCheck->SetValue(behavior.xPosition);
yPosCheck->SetValue(automatism.yPosition); yPosCheck->SetValue(behavior.yPosition);
angleCheck->SetValue(automatism.angle); angleCheck->SetValue(behavior.angle);
widthCheck->SetValue(automatism.width); widthCheck->SetValue(behavior.width);
heightCheck->SetValue(automatism.height); heightCheck->SetValue(behavior.height);
dataPrefixEdit->SetValue(automatism.dataPrefix); dataPrefixEdit->SetValue(behavior.dataPrefix);
} }
NetworkAutomatismEditor::~NetworkAutomatismEditor() NetworkBehaviorEditor::~NetworkBehaviorEditor()
{ {
//(*Destroy(NetworkAutomatismEditor) //(*Destroy(NetworkBehaviorEditor)
//*) //*)
} }
void NetworkAutomatismEditor::OncancelBtClick(wxCommandEvent& event) void NetworkBehaviorEditor::OncancelBtClick(wxCommandEvent& event)
{ {
EndModal(0); EndModal(0);
} }
void NetworkAutomatismEditor::OnokBtClick(wxCommandEvent& event) void NetworkBehaviorEditor::OnokBtClick(wxCommandEvent& event)
{ {
automatism.sending = (initialBehaviourList->GetSelection() == 0); behavior.sending = (initialBehaviourList->GetSelection() == 0);
automatism.xPosition = xPosCheck->GetValue(); behavior.xPosition = xPosCheck->GetValue();
automatism.yPosition = yPosCheck->GetValue(); behavior.yPosition = yPosCheck->GetValue();
automatism.angle = angleCheck->GetValue(); behavior.angle = angleCheck->GetValue();
automatism.width = widthCheck->GetValue(); behavior.width = widthCheck->GetValue();
automatism.height = heightCheck->GetValue(); behavior.height = heightCheck->GetValue();
automatism.dataPrefix = dataPrefixEdit->GetValue(); behavior.dataPrefix = dataPrefixEdit->GetValue();
EndModal(1); EndModal(1);
} }

View File

@@ -6,10 +6,10 @@ This project is released under the MIT License.
*/ */
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI) #if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
#ifndef PHYSICSAUTOMATISMEDITOR_H #ifndef PHYSICSBEHAVIOREDITOR_H
#define PHYSICSAUTOMATISMEDITOR_H #define PHYSICSBEHAVIOREDITOR_H
//(*Headers(NetworkAutomatismEditor) //(*Headers(NetworkBehaviorEditor)
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
@@ -21,18 +21,18 @@ This project is released under the MIT License.
#include <memory> #include <memory>
namespace gd { class Project; } namespace gd { class Project; }
namespace gd { class MainFrameWrapper; } namespace gd { class MainFrameWrapper; }
class NetworkAutomatism; class NetworkBehavior;
namespace gd { class Layout; } namespace gd { class Layout; }
class ScenePhysicsDatas; class ScenePhysicsDatas;
class NetworkAutomatismEditor: public wxDialog class NetworkBehaviorEditor: public wxDialog
{ {
public: public:
NetworkAutomatismEditor(wxWindow* parent, gd::Project & game_, gd::Layout * scene, NetworkAutomatism & automatism_ ); NetworkBehaviorEditor(wxWindow* parent, gd::Project & game_, gd::Layout * scene, NetworkBehavior & behavior_ );
virtual ~NetworkAutomatismEditor(); virtual ~NetworkBehaviorEditor();
//(*Declarations(NetworkAutomatismEditor) //(*Declarations(NetworkBehaviorEditor)
wxTextCtrl* dataPrefixEdit; wxTextCtrl* dataPrefixEdit;
wxStaticText* StaticText2; wxStaticText* StaticText2;
wxCheckBox* widthCheck; wxCheckBox* widthCheck;
@@ -47,11 +47,11 @@ class NetworkAutomatismEditor: public wxDialog
wxCheckBox* heightCheck; wxCheckBox* heightCheck;
//*) //*)
NetworkAutomatism & automatism; NetworkBehavior & behavior;
protected: protected:
//(*Identifiers(NetworkAutomatismEditor) //(*Identifiers(NetworkBehaviorEditor)
static const long ID_RADIOBOX1; static const long ID_RADIOBOX1;
static const long ID_STATICTEXT1; static const long ID_STATICTEXT1;
static const long ID_CHECKBOX1; static const long ID_CHECKBOX1;
@@ -68,7 +68,7 @@ class NetworkAutomatismEditor: public wxDialog
private: private:
//(*Handlers(NetworkAutomatismEditor) //(*Handlers(NetworkBehaviorEditor)
void OncancelBtClick(wxCommandEvent& event); void OncancelBtClick(wxCommandEvent& event);
void OnokBtClick(wxCommandEvent& event); void OnokBtClick(wxCommandEvent& event);
//*) //*)

View File

@@ -9,7 +9,7 @@ This project is released under the MIT License.
#include "SceneNetworkDatas.h" #include "SceneNetworkDatas.h"
#include <iostream> #include <iostream>
RuntimeSceneNetworkDatas::RuntimeSceneNetworkDatas(const SceneNetworkDatas & automatismSharedDatas) RuntimeSceneNetworkDatas::RuntimeSceneNetworkDatas(const SceneNetworkDatas & behaviorSharedDatas)
{ {
} }

Some files were not shown because too many files have changed in this diff Show More