本文整理汇总了C++中gd::PlatformExtension::AddBehavior方法的典型用法代码示例。如果您正苦于以下问题:C++ PlatformExtension::AddBehavior方法的具体用法?C++ PlatformExtension::AddBehavior怎么用?C++ PlatformExtension::AddBehavior使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gd::PlatformExtension
的用法示例。
在下文中一共展示了PlatformExtension::AddBehavior方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeclareDestroyOutsideBehaviorExtension
void DeclareDestroyOutsideBehaviorExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("DestroyOutsideBehavior",
_("Destroy Outside Screen Behavior"),
_("Behavior destroying object when they go outside the screen"),
"Florian Rival",
"Open source (MIT License)");
gd::BehaviorMetadata & aut = extension.AddBehavior("DestroyOutside",
_("Destroy when outside the screen"),
_("DestroyOutside"),
_("Automatically destroy the object when it goes outside the screen"),
"",
"CppPlatform/Extensions/destroyoutsideicon.png",
"DestroyOutsideBehavior",
std::shared_ptr<gd::Behavior>(new DestroyOutsideBehavior),
std::shared_ptr<gd::BehaviorsSharedData>());
#if defined(GD_IDE_ONLY)
aut.SetIncludeFile("DestroyOutsideBehavior/DestroyOutsideBehavior.h");
aut.AddCondition("ExtraBorder",
_("Additional border"),
_("Compare the additional border that the object must cross before being deleted."),
_("The additional border of _PARAM0_ is _PARAM2__PARAM3_"),
_(""),
"CppPlatform/Extensions/destroyoutsideicon24.png",
"CppPlatform/Extensions/destroyoutsideicon16.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "DestroyOutside")
.AddParameter("relationalOperator", _("Sign of the test"))
.AddParameter("expression", _("Value to test"))
.MarkAsAdvanced()
.SetFunctionName("GetExtraBorder").SetManipulatedType("number")
.SetIncludeFile("DestroyOutsideBehavior/DestroyOutsideBehavior.h");
aut.AddAction("ExtraBorder",
_("Additional border"),
_("Change the additional border that the object must cross before being deleted."),
_("Do _PARAM2__PARAM3_ to the additional border of _PARAM0_"),
_(""),
"CppPlatform/Extensions/destroyoutsideicon24.png",
"CppPlatform/Extensions/destroyoutsideicon16.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "DestroyOutside")
.AddParameter("operator", _("Modification's sign"))
.AddParameter("expression", _("Value"))
.MarkAsAdvanced()
.SetFunctionName("SetExtraBorder").SetManipulatedType("number")
.SetGetter("GetExtraBorder").SetIncludeFile("DestroyOutsideBehavior/DestroyOutsideBehavior.h");
#endif
}
示例2: DeclarePlatformBehaviorExtension
void DeclarePlatformBehaviorExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("PlatformBehavior",
_("Platform Behavior"),
_("Allows to use controllable objects which can run and jump on platforms."),
"Florian Rival",
"Open source (MIT License)");
{
gd::BehaviorMetadata & aut = extension.AddBehavior("PlatformerObjectBehavior",
_("Platformer character"),
"PlatformerObject",
_("Controllable character which can jump and run on platforms."),
"",
"CppPlatform/Extensions/platformerobjecticon.png",
"PlatformerObjectBehavior",
std::shared_ptr<gd::Behavior>(new PlatformerObjectBehavior),
std::shared_ptr<gd::BehaviorsSharedData>(new gd::BehaviorsSharedData));
#if defined(GD_IDE_ONLY)
aut.SetIncludeFile("PlatformBehavior/PlatformerObjectBehavior.h");
aut.AddCondition("IsMoving",
_("Is moving"),
_("Check if the object is moving (whether it is on the floor or in the air)."),
_("_PARAM0_ is moving"),
_(""),
"CppPlatform/Extensions/platformerobjecticon24.png",
"CppPlatform/Extensions/platformerobjecticon16.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
.MarkAsSimple()
.SetFunctionName("IsMoving").SetIncludeFile("PlatformBehavior/PlatformerObjectBehavior.h");
aut.AddCondition("IsOnFloor",
_("Is on floor"),
_("Check if the object is on a platform."),
_("_PARAM0_ is on floor"),
_(""),
"CppPlatform/Extensions/platformerobjecticon24.png",
"CppPlatform/Extensions/platformerobjecticon16.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
.MarkAsSimple()
.SetFunctionName("IsOnFloor").SetIncludeFile("PlatformBehavior/PlatformerObjectBehavior.h");
aut.AddCondition("IsOnLadder",
_("Is on ladder"),
_("Check if the object is on a ladder."),
_("_PARAM0_ is on ladder"),
_(""),
"CppPlatform/Extensions/platformerobjecticon24.png",
"CppPlatform/Extensions/platformerobjecticon16.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
.MarkAsAdvanced()
.SetFunctionName("IsOnLadder").SetIncludeFile("PlatformBehavior/PlatformerObjectBehavior.h");
aut.AddCondition("IsJumping",
_("Is jumping"),
_("Check if the object is jumping."),
_("_PARAM0_ is jumping"),
_(""),
"CppPlatform/Extensions/platformerobjecticon24.png",
"CppPlatform/Extensions/platformerobjecticon16.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
.MarkAsSimple()
.SetFunctionName("IsJumping").SetIncludeFile("PlatformBehavior/PlatformerObjectBehavior.h");
aut.AddCondition("IsFalling",
_("Is falling"),
_("Check if the object is falling.\nNote that the object can be flagged as jumping and falling at the same time: at the end of a jump, the fall speed becomes higher that the jump speed."),
_("_PARAM0_ is falling"),
_(""),
"CppPlatform/Extensions/platformerobjecticon24.png",
"CppPlatform/Extensions/platformerobjecticon16.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
.SetFunctionName("IsFalling").SetIncludeFile("PlatformBehavior/PlatformerObjectBehavior.h");
aut.AddCondition("Gravity",
_("Gravity"),
_("Compare the gravity applied on the object (in pixels per second per second)."),
_("Gravity of _PARAM0_ is _PARAM2__PARAM3_"),
_("Options"),
"CppPlatform/Extensions/platformerobjecticon24.png",
"CppPlatform/Extensions/platformerobjecticon16.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
.AddParameter("relationalOperator", _("Comparison sign"))
.AddParameter("expression", _("Value to test"))
.MarkAsAdvanced()
.SetFunctionName("GetGravity").SetManipulatedType("number").SetIncludeFile("PlatformBehavior/PlatformerObjectBehavior.h");
aut.AddAction("Gravity",
_("Gravity"),
_("Change the gravity applied on an object (in pixels per second per second)."),
_("Do _PARAM2__PARAM3_ to the gravity applied on _PARAM0_"),
_("Options"),
//.........这里部分代码省略.........
示例3: DeclareTopDownMovementBehaviorExtension
void DeclareTopDownMovementBehaviorExtension(gd::PlatformExtension & extension)
{
extension.SetExtensionInformation("TopDownMovementBehavior",
_("Top-down movement"),
_("Move objects in 4 or 8 directions"),
"Florian Rival",
"Open source (MIT License)");
gd::BehaviorMetadata & aut = extension.AddBehavior("TopDownMovementBehavior",
_("Top-down movement (4 or 8 directions)"),
"TopDownMovement",
_("The object can be moved left, up, right, down and optionally diagonals."),
"",
"CppPlatform/Extensions/topdownmovementicon.png",
"TopDownMovementBehavior",
std::shared_ptr<gd::Behavior>(new TopDownMovementBehavior),
std::shared_ptr<gd::BehaviorsSharedData>(new gd::BehaviorsSharedData));
#if defined(GD_IDE_ONLY)
aut.SetIncludeFile("TopDownMovementBehavior/TopDownMovementBehavior.h");
aut.AddAction("SimulateLeftKey",
_("Simulate left key press"),
_("Simulate a pressing on left key."),
_("Simulate pressing Left for _PARAM0_"),
_("Controls"),
"res/conditions/keyboard24.png",
"res/conditions/keyboard.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "TopDownMovementBehavior")
.MarkAsAdvanced()
.SetFunctionName("SimulateLeftKey").SetIncludeFile("TopDownMovementBehavior/TopDownMovementBehavior.h");
aut.AddAction("SimulateRightKey",
_("Simulate right key press"),
_("Simulate a pressing on right key."),
_("Simulate pressing Right for _PARAM0_"),
_("Controls"),
"res/conditions/keyboard24.png",
"res/conditions/keyboard.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "TopDownMovementBehavior")
.MarkAsAdvanced()
.SetFunctionName("SimulateRightKey").SetIncludeFile("TopDownMovementBehavior/TopDownMovementBehavior.h");
aut.AddAction("SimulateUpKey",
_("Simulate up key press"),
_("Simulate a pressing on up key ( Used when on a ladder )."),
_("Simulate pressing Up for _PARAM0_"),
_("Controls"),
"res/conditions/keyboard24.png",
"res/conditions/keyboard.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "TopDownMovementBehavior")
.MarkAsAdvanced()
.SetFunctionName("SimulateUpKey").SetIncludeFile("TopDownMovementBehavior/TopDownMovementBehavior.h");
aut.AddAction("SimulateDownKey",
_("Simulate down key press"),
_("Simulate a pressing on down key ( Used when on a ladder )."),
_("Simulate pressing Down for _PARAM0_"),
_("Controls"),
"res/conditions/keyboard24.png",
"res/conditions/keyboard.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "TopDownMovementBehavior")
.MarkAsAdvanced()
.SetFunctionName("SimulateDownKey").SetIncludeFile("TopDownMovementBehavior/TopDownMovementBehavior.h");
aut.AddAction("SimulateControl",
_("Simulate control"),
_("Simulate a pressing on a key.\nValid keys are Left, Right, Up, Down."),
_("Simulate pressing _PARAM2_ key for _PARAM0_"),
_("Controls"),
"res/conditions/keyboard24.png",
"res/conditions/keyboard.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "TopDownMovementBehavior")
.AddParameter("string", _("Key"))
.MarkAsAdvanced()
.SetFunctionName("SimulateControl").SetIncludeFile("TopDownMovementBehavior/TopDownMovementBehavior.h");
aut.AddAction("IgnoreDefaultControls",
_("Ignore default controls"),
_("De/activate the use of default controls.\nIf deactivated, use the simulate actions to move the object."),
_("Ignore default controls for _PARAM0_: _PARAM2_"),
_("Controls"),
"res/conditions/keyboard24.png",
"res/conditions/keyboard.png")
.AddParameter("object", _("Object"))
.AddParameter("behavior", _("Behavior"), "TopDownMovementBehavior")
.AddParameter("yesorno", _("Ignore controls"))
.MarkAsAdvanced()
.SetFunctionName("IgnoreDefaultControls").SetIncludeFile("TopDownMovementBehavior/TopDownMovementBehavior.h");
aut.AddCondition("IsMoving",
_("Is moving"),
_("Check if the object is moving."),
_("_PARAM0_ is moving"),
//.........这里部分代码省略.........