Пример #1
0
/**
 * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
 */
Extension::Extension()
{
    SetExtensionInformation("ParticleSystem",
                          _("Particle system"),
                          _("Extension allowing to display a large number of small particles."),
                          "Florian Rival",
                          "Open source (MIT License)");

    //Declaration of all objects available
    {
        gd::ObjectMetadata & obj = AddObject("ParticleEmitter",
                   _("Particles emitter"),
                   _("Displays a large number of small particles to create visual effects"),
                   "CppPlatform/Extensions/particleSystemicon.png",
                   &CreateParticleEmitterObject);

        AddRuntimeObject(obj, "RuntimeParticleEmitterObject", CreateRuntimeParticleEmitterObject);

        #if defined(GD_IDE_ONLY)
        obj.SetIncludeFile("ParticleSystem/ParticleEmitterObject.h");

        //Declaration is too big to be compiled by GCC in one file, unless you have 4GB+ ram. :/
        ExtensionSubDeclaration1(obj);
        ExtensionSubDeclaration2(obj);
        ExtensionSubDeclaration3(obj);
        #endif
    }

    GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
};
Пример #2
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        DeclareTextObjectExtension(*this);
        AddRuntimeObject(GetObjectMetadata("TextObject::Text"),
            "RuntimeTextObject", CreateRuntimeTextObject);

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #3
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        DeclarePanelSpriteObjectExtension(*this);
        AddRuntimeObject(GetObjectMetadata("PanelSpriteObject::PanelSprite"),
            "RuntimePanelSpriteObject", CreateRuntimePanelSpriteObject);

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #4
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    TileMapObjectCppExtension()
    {
        DeclareTileMapObjectExtension(*this);
        AddRuntimeObject<TileMapObject, RuntimeTileMapObject>(
            GetObjectMetadata("TileMapObject::TileMap"),
            "RuntimeTileMapObject");

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #5
0
    /**
     * \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();
    };
Пример #6
0
    /**
     * \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();
    };
Пример #7
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    AdMobObjectJsExtension()
    {
        DeclareAdMobObjectExtension(*this);

        GetObjectMetadata("AdMobObject::AdMob").SetIncludeFile("AdMobObject/admobruntimeobject.js");

        GetAllActionsForObject("AdMobObject::AdMob")["AdMobObject::ShowBanner"].SetFunctionName("showBanner");
        GetAllActionsForObject("AdMobObject::AdMob")["AdMobObject::HideBanner"].SetFunctionName("hideBanner");
        GetAllConditionsForObject("AdMobObject::AdMob")["AdMobObject::BannerDisplayed"].SetFunctionName("isBannerDisplayed");
        GetAllActionsForObject("AdMobObject::AdMob")["AdMobObject::PreloadInterstitial"].SetFunctionName("prepareInterstitial");
        GetAllActionsForObject("AdMobObject::AdMob")["AdMobObject::ShowInterstitial"].SetFunctionName("showInterstitial");
        GetAllConditionsForObject("AdMobObject::AdMob")["AdMobObject::InterstitialReady"].SetFunctionName("isInterstitialReady");

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #8
0
    /**
     * \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();
    };
Пример #9
0
    /**
     * \brief Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    TopDownMovementBehaviorJsExtension()
    {
        DeclareTopDownMovementBehaviorExtension(*this);

        GetBehaviorMetadata("TopDownMovementBehavior::TopDownMovementBehavior")
            .SetIncludeFile("TopDownMovementBehavior/topdownmovementruntimebehavior.js");

        std::map<gd::String, gd::InstructionMetadata > & autActions = GetAllActionsForBehavior("TopDownMovementBehavior::TopDownMovementBehavior");
        std::map<gd::String, gd::InstructionMetadata > & autConditions = GetAllConditionsForBehavior("TopDownMovementBehavior::TopDownMovementBehavior");
        std::map<gd::String, gd::ExpressionMetadata > & autExpressions = GetAllExpressionsForBehavior("TopDownMovementBehavior::TopDownMovementBehavior");

        autConditions["TopDownMovementBehavior::IsMoving"].SetFunctionName("isMoving");

        autActions["TopDownMovementBehavior::Acceleration"].SetFunctionName("setAcceleration").SetGetter("getAcceleration");
        autConditions["TopDownMovementBehavior::Acceleration"].SetFunctionName("getAcceleration");
        autActions["TopDownMovementBehavior::Deceleration"].SetFunctionName("setDeceleration").SetGetter("getDeceleration");
        autConditions["TopDownMovementBehavior::Deceleration"].SetFunctionName("getDeceleration");
        autActions["TopDownMovementBehavior::MaxSpeed"].SetFunctionName("setMaxSpeed").SetGetter("getMaxSpeed");
        autConditions["TopDownMovementBehavior::MaxSpeed"].SetFunctionName("getMaxSpeed");
        autConditions["TopDownMovementBehavior::Speed"].SetFunctionName("getSpeed");
        autActions["TopDownMovementBehavior::AngularMaxSpeed"].SetFunctionName("setAngularMaxSpeed").SetGetter("getAngularMaxSpeed");
        autConditions["TopDownMovementBehavior::AngularMaxSpeed"].SetFunctionName("getAngularMaxSpeed");
        autActions["TopDownMovementBehavior::AngleOffset"].SetFunctionName("setAngleOffset").SetGetter("getAngleOffset");
        autConditions["TopDownMovementBehavior::AngleOffset"].SetFunctionName("getAngleOffset");

        autActions["TopDownMovementBehavior::AllowDiagonals"].SetFunctionName("allowDiagonals");
        autConditions["TopDownMovementBehavior::DiagonalsAllowed"].SetFunctionName("diagonalsAllowed");
        autActions["TopDownMovementBehavior::RotateObject"].SetFunctionName("setRotateObject");
        autConditions["TopDownMovementBehavior::ObjectRotated"].SetFunctionName("isObjectRotated");

        autActions["TopDownMovementBehavior::SimulateLeftKey"].SetFunctionName("simulateLeftKey");
        autActions["TopDownMovementBehavior::SimulateRightKey"].SetFunctionName("simulateRightKey");
        autActions["TopDownMovementBehavior::SimulateUpKey"].SetFunctionName("simulateUpKey");
        autActions["TopDownMovementBehavior::SimulateDownKey"].SetFunctionName("simulateDownKey");
        autActions["TopDownMovementBehavior::SimulateControl"].SetFunctionName("simulateControl");
        autActions["TopDownMovementBehavior::IgnoreDefaultControls"].SetFunctionName("ignoreDefaultControls");

        autExpressions["Acceleration"].SetFunctionName("getAcceleration");
        autExpressions["Deceleration"].SetFunctionName("getDeceleration");
        autExpressions["MaxSpeed"].SetFunctionName("getMaxSpeed");
        autExpressions["Speed"].SetFunctionName("getSpeed");
        autExpressions["AngularMaxSpeed"].SetFunctionName("getAngularMaxSpeed");
        autExpressions["AngleOffset"].SetFunctionName("getAngleOffset");

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #10
0
    /**
     * \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",
                              "zlib/libpng License (Open Source)");
        DeclareDestroyOutsideAutomatismExtension(*this);

        GetAutomatismMetadata("DestroyOutsideAutomatism::DestroyOutside").SetIncludeFile("DestroyOutsideAutomatism/destroyoutsideruntimeautomatism.js");

        GetAllConditionsForAutomatism("DestroyOutsideAutomatism::DestroyOutside")["DestroyOutsideAutomatism::ExtraBorder"].codeExtraInformation
            .SetFunctionName("getExtraBorder").SetIncludeFile("DestroyOutsideAutomatism/destroyoutsideruntimeautomatism.js");
        GetAllActionsForAutomatism("DestroyOutsideAutomatism::DestroyOutside")["DestroyOutsideAutomatism::ExtraBorder"].codeExtraInformation
            .SetFunctionName("setExtraBorder").SetAssociatedGetter("getExtraBorder").SetIncludeFile("DestroyOutsideAutomatism/destroyoutsideruntimeautomatism.js");

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #11
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    TiledSpriteObjectJsExtension()
    {
        DeclareTiledSpriteObjectExtension(*this);

        GetObjectMetadata("TiledSpriteObject::TiledSprite").SetIncludeFile("TiledSpriteObject/tiledspriteruntimeobject.js");

        GetAllActionsForObject("TiledSpriteObject::TiledSprite")["TiledSpriteObject::Width"].SetFunctionName("setWidth").SetGetter("getWidth").SetIncludeFile("TiledSpriteObject/tiledspriteruntimeobject.js");
        GetAllConditionsForObject("TiledSpriteObject::TiledSprite")["TiledSpriteObject::Width"].SetFunctionName("getWidth").SetIncludeFile("TiledSpriteObject/tiledspriteruntimeobject.js");
        GetAllActionsForObject("TiledSpriteObject::TiledSprite")["TiledSpriteObject::Height"].SetFunctionName("setHeight").SetGetter("getHeight").SetIncludeFile("TiledSpriteObject/tiledspriteruntimeobject.js");
        GetAllConditionsForObject("TiledSpriteObject::TiledSprite")["TiledSpriteObject::Height"].SetFunctionName("getHeight").SetIncludeFile("TiledSpriteObject/tiledspriteruntimeobject.js");
        GetAllActionsForObject("TiledSpriteObject::TiledSprite")["TiledSpriteObject::Angle"].SetFunctionName("setAngle").SetGetter("getAngle").SetIncludeFile("TiledSpriteObject/tiledspriteruntimeobject.js");
        GetAllConditionsForObject("TiledSpriteObject::TiledSprite")["TiledSpriteObject::Angle"].SetFunctionName("getAngle").SetIncludeFile("TiledSpriteObject/tiledspriteruntimeobject.js");
        GetAllActionsForObject("TiledSpriteObject::TiledSprite")["TiledSpriteObject::XOffset"].SetFunctionName("setXOffset").SetGetter("getXOffset").SetIncludeFile("TiledSpriteObject/tiledspriteruntimeobject.js");
        GetAllConditionsForObject("TiledSpriteObject::TiledSprite")["TiledSpriteObject::XOffset"].SetFunctionName("getXOffset").SetIncludeFile("TiledSpriteObject/tiledspriteruntimeobject.js");
        GetAllActionsForObject("TiledSpriteObject::TiledSprite")["TiledSpriteObject::YOffset"].SetFunctionName("setYOffset").SetGetter("getYOffset").SetIncludeFile("TiledSpriteObject/tiledspriteruntimeobject.js");
        GetAllConditionsForObject("TiledSpriteObject::TiledSprite")["TiledSpriteObject::YOffset"].SetFunctionName("getYOffset").SetIncludeFile("TiledSpriteObject/tiledspriteruntimeobject.js");

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #12
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    TextObjectJsExtension()
    {
        DeclareTextObjectExtension(*this);

        GetObjectMetadata("TextObject::Text")
            .SetIncludeFile("TextObject/textruntimeobject.js")
            .AddIncludeFile("TextObject/textruntimeobject-pixi-renderer.js")
            .AddIncludeFile("TextObject/textruntimeobject-cocos-renderer.js");

        GetAllActionsForObject("TextObject::Text")["TextObject::String"].SetFunctionName("setString").SetGetter("getString").SetIncludeFile("TextObject/textruntimeobject.js");
        GetAllConditionsForObject("TextObject::Text")["TextObject::String"].SetFunctionName("getString").SetIncludeFile("TextObject/textruntimeobject.js");
        GetAllActionsForObject("TextObject::Text")["TextObject::Size"].SetFunctionName("setCharacterSize").SetGetter("getCharacterSize").SetIncludeFile("TextObject/textruntimeobject.js");
        GetAllConditionsForObject("TextObject::Text")["TextObject::Size"].SetFunctionName("getCharacterSize").SetIncludeFile("TextObject/textruntimeobject.js");
        GetAllActionsForObject("TextObject::Text")["TextObject::Angle"].SetFunctionName("setAngle").SetGetter("getAngle").SetIncludeFile("TextObject/textruntimeobject.js");
        GetAllConditionsForObject("TextObject::Text")["TextObject::Angle"].SetFunctionName("getAngle").SetIncludeFile("TextObject/textruntimeobject.js");
        GetAllActionsForObject("TextObject::Text")["TextObject::Opacity"].SetFunctionName("setOpacity").SetGetter("getOpacity").SetIncludeFile("TextObject/textruntimeobject.js");
        GetAllConditionsForObject("TextObject::Text")["TextObject::Opacity"].SetFunctionName("getOpacity").SetIncludeFile("TextObject/textruntimeobject.js");

        GetAllActionsForObject("TextObject::Text")["TextObject::SetBold"].SetFunctionName("setBold").SetIncludeFile("TextObject/textruntimeobject.js");
        GetAllConditionsForObject("TextObject::Text")["TextObject::IsBold"].SetFunctionName("isBold").SetIncludeFile("TextObject/textruntimeobject.js");

        GetAllActionsForObject("TextObject::Text")["TextObject::SetItalic"].SetFunctionName("setItalic").SetIncludeFile("TextObject/textruntimeobject.js");
        GetAllConditionsForObject("TextObject::Text")["TextObject::IsItalic"].SetFunctionName("isItalic").SetIncludeFile("TextObject/textruntimeobject.js");

        GetAllExpressionsForObject("TextObject::Text")["Opacity"].SetFunctionName("getOpacity").SetIncludeFile("TextObject/textruntimeobject.js");
        GetAllExpressionsForObject("TextObject::Text")["Angle"].SetFunctionName("getAngle").SetIncludeFile("TextObject/textruntimeobject.js");
        GetAllStrExpressionsForObject("TextObject::Text")["String"].SetFunctionName("getString").SetIncludeFile("TextObject/textruntimeobject.js");

        GetAllActionsForObject("TextObject::Text")["TextObject::ChangeColor"].SetFunctionName("setColor").SetIncludeFile("TextObject/textruntimeobject.js");

        //Unimplemented actions and conditions:
        GetAllActionsForObject("TextObject::Text")["TextObject::Font"].SetFunctionName("");
        GetAllActionsForObject("TextObject::Text")["TextObject::SetUnderlined"].SetFunctionName("");
        GetAllConditionsForObject("TextObject::Text")["TextObject::IsUnderlined"].SetFunctionName("");

        StripUnimplementedInstructionsAndExpressions();

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #13
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    SystemInfoCppExtension()
    {
        SetExtensionInformation("SystemInfo",
            _("System information"),
            _("Provides information about the system running the game"),
            "Florian Rival",
            "Open source (MIT License)");

        #if defined(GD_IDE_ONLY)
        AddCondition("IsMobile",
            _("Is a mobile device"),
            _("Check if the device running the game is a mobile device"),
            _("The device is a mobile device"),
            _("System information"),
            "CppPlatform/Extensions/systeminfoicon24.png",
            "CppPlatform/Extensions/systeminfoicon16.png")

            .SetFunctionName("SystemInfo::IsMobile").SetIncludeFile("SystemInfo/SystemInfoTools.h");
        #endif

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #14
0
 /**
  * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
  */
 Extension()
 {
     DeclarePlatformAutomatismExtension(*this);
     GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
 };
Пример #15
0
 /**
  * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
  */
 Extension()
 {
     DeclarePlatformBehaviorExtension(*this);
     GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
 };
Пример #16
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("PathBehavior",
                              _("Path Behavior"),
                              _("Behavior allowing to move objects on a predefined path"),
                              "Florian Rival",
                              "Open source (MIT License)");

            {
                gd::BehaviorMetadata & aut = AddBehavior("PathBehavior",
                      _("Path"),
                      _("Path"),
                      _("Make objects move on a predefined path."),
                      "",
                      "CppPlatform/Extensions/pathicon.png",
                      "PathBehavior",
                      std::shared_ptr<gd::Behavior>(new PathBehavior),
                      std::shared_ptr<gd::BehaviorsSharedData>(new ScenePathDatas));

                #if defined(GD_IDE_ONLY)

                aut.SetIncludeFile("PathBehavior/PathBehavior.h");

                aut.AddAction("SetReverseAtEnd",
                               _("De/activate rounding"),
                               _("Activate or desactivate rounding"),
                               _("Activate rounding for _PARAM0_: _PARAM2_"),
                               _("Options"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("yesorno", _("Activate"))
                    .SetFunctionName("SetReverseAtEnd").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddAction("SetStopAtEnd",
                               _("De/activate the stop at the end of the path"),
                               _("Activate or deactivate the stop at the end of the object"),
                               _("Stop _PARAM0_ when the end of the path is reached: _PARAM2_"),
                               _("Options"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("yesorno", _("Activate"))
                    .SetFunctionName("SetStopAtEnd").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddCondition("ReverseAtEnd",
                               _("Rounds"),
                               _("Return true if the object round"),
                               _("_PARAM0_ is rounding"),
                               _("Options"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .SetFunctionName("ReverseAtEnd").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddCondition("StopAtEnd",
                               _("Stop at the end of the path"),
                               _("Return true if the object stops at the end of its path."),
                               _("_PARAM0_ stops at the end of the path"),
                               _("Options"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .SetFunctionName("StopAtEnd").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddAction("Reverse",
                               _("Invert the movement on the path"),
                               _("Invert the movement on the path."),
                               _("Invert the sens of the movement of _PARAM0_ on its path"),
                               _("Movement"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .SetFunctionName("Reverse").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddCondition("GetSegment",
                               _("Number of the segment on the path"),
                               _("True if the number of the current segment on the path satisfies the test."),
                               _("The number of the current segment of the path of _PARAM0_ is _PARAM2__PARAM3_"),
                               _("Position"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("relationalOperator", _("Comparison sign"))
                    .AddParameter("expression", _("Value"))
                    .SetFunctionName("GetCurrentSegment").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddAction("EnterSegment",
                               _("Position on the segment of a path"),
                               _("Put the object directly on specific segment of the path"),
                               _("Do _PARAM2__PARAM3_ to number of the current segment of _PARAM0_"),
                               _("Position"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("operator", _("Modification sign"))
                    .AddParameter("expression", _("Value"))
                    .SetFunctionName("SetCurrentSegment").SetGetter("GetCurrentSegment").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h");

                aut.AddExpression("Segment", _("Current segment"), _("Number of the current segment"), _("Position"), "CppPlatform/Extensions/pathicon16.png")
                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .SetFunctionName("GetCurrentSegment").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddCondition("GetPosition",
                               _("Position of the object on the segment"),
                               _("Return true if the position on the path satisfy the test.\nPosition on a segment is a value between 0 and 1."),
                               _("The position of _PARAM0_ on the current segment is _PARAM2__PARAM3_"),
                               _("Position"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("relationalOperator", _("Comparison sign"))
                    .AddParameter("expression", _("Value"))
                    .SetFunctionName("GetPositionOnSegment").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddAction("SetPosition",
                               _("Put the object on a precise position of the current segment"),
                               _("Put the object on a precise position on the current segment."),
                               _("Put _PARAM0_ on _PARAM2__PARAM3_ on the current segment"),
                               _("Position"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("operator", _("Modification sign"))
                    .AddParameter("expression", _("Value"))
                    .SetFunctionName("SetPositionOnSegment").SetGetter("GetPositionOnSegment").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h");

                aut.AddExpression("Position", _("Position on the segment"), _("Position on the segment ( value between 0 and 1 )"), _("Position"), "CppPlatform/Extensions/pathicon16.png")
                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .SetFunctionName("GetPositionOnSegment").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddCondition("GetPathName",
                               _("Path name"),
                               _("Test the path name."),
                               _("The name of the current path of _PARAM0_ is _PARAM1__PARAM2_"),
                               _("Path"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("relationalOperator", _("Comparison sign"))
                    .AddParameter("string", _("Name"))
                    .SetFunctionName("GetCurrentPathName").SetManipulatedType("string").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddAction("SetPathName",
                               _("Change the path"),
                               _("Change the path used."),
                               _("Set _PARAM2_ as the current path of _PARAM0_"),
                               _("Path"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("string", _("Name"))
                    .SetFunctionName("ChangeCurrentPath").SetIncludeFile("PathBehavior/PathBehavior.h");

                aut.AddStrExpression("CurrentPathName", _("Current path name"), _("Current path name"), _("Path"), "CppPlatform/Extensions/pathicon16.png")
                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .SetFunctionName("GetCurrentPathName").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddCondition("GetOffsetX",
                               _("X position of the path"),
                               _("Return true if the X position satisfies the test."),
                               _("The X position of the path of _PARAM0_ is _PARAM2__PARAM3_"),
                               _("Path position"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("relationalOperator", _("Comparison sign"))
                    .AddParameter("expression", _("Value"))
                    .SetFunctionName("GetOffsetX").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddAction("SetOffsetX",
                               _("Modify the path X position"),
                               _("Change the path X position."),
                               _("Do _PARAM2__PARAM3_ to the X position of the path of _PARAM0_"),
                               _("Path position"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("operator", _("Modification sign"))
                    .AddParameter("expression", _("Value"))
                    .SetFunctionName("SetOffsetX").SetGetter("GetOffsetX").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h");

                aut.AddExpression("PathX", _("X position of the path"), _("X position of the path"), _("Path position"), "CppPlatform/Extensions/pathicon16.png")
                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .SetFunctionName("GetOffsetX").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddCondition("GetOffsetY",
                               _("Path Y position"),
                               _("Return true if the Y position satisfies the test."),
                               _("The Y position of the path of _PARAM0_ is _PARAM2__PARAM3_"),
                               _("Path position"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("relationalOperator", _("Comparison sign"))
                    .AddParameter("expression", _("Value"))
                    .SetFunctionName("GetOffsetY").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddAction("SetOffsetY",
                               _("Modify the path Y position"),
                               _("Change the path Y position."),
                               _("Do _PARAM2__PARAM3_ to the Y position of the path of _PARAM0_"),
                               _("Path position"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("operator", _("Modification sign"))
                    .AddParameter("expression", _("Value"))
                    .SetFunctionName("SetOffsetY").SetGetter("GetOffsetY").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h");

                aut.AddExpression("PathY", _("Path Y position"), _("Path Y position"), _("Path position"), "CppPlatform/Extensions/pathicon16.png")
                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .SetFunctionName("GetOffsetY").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddCondition("GetFollowAngle",
                               _("Automatic rotation"),
                               _("Return true if the object's angle is automatically updated."),
                               _("The angle of _PARAM0_ is automatically updated on the path"),
                               _("Options"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .SetFunctionName("FollowAngle").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddAction("SetFollowAngle",
                               _("De/activate automatic rotation"),
                               _("Activate or deactivate the automatic update of the angle of the object on the path."),
                               _("Activate automatic rotation of _PARAM0_: _PARAM2_"),
                               _("Options"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("yesorno", _("Activate \?"))
                    .SetFunctionName("SetFollowAngle").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddCondition("GetAngleOffset",
                               _("Angle offset"),
                               _("Return true if the angle offset satifies the condition."),
                               _("The angle offset of _PARAM0_ is _PARAM2__PARAM3_"),
                               _("Options"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("relationalOperator", _("Comparison sign"))
                    .AddParameter("expression", _("Value"))
                    .SetFunctionName("GetAngleOffset").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddAction("SetAngleOffset",
                               _("Change the angle offset"),
                               _("Change the angle offset"),
                               _("Do _PARAM2__PARAM3_ to angle offset of _PARAM0_"),
                               _("Options"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("operator", _("Modification sign"))
                    .AddParameter("expression", _("Value"))
                    .SetFunctionName("SetAngleOffset").SetGetter("GetAngleOffset").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h");

                aut.AddExpression("AngleOffset", _("Angle offset"), _("Add an offset to the angle of the object"), _("Options"), "CppPlatform/Extensions/pathicon16.png")
                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .SetFunctionName("GetAngleOffset").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddCondition("GetSpeed",
                               _("Speed"),
                               _("Return true if the speed satisfy the condition."),
                               _("The speed of _PARAM0_ on the path is _PARAM2__PARAM3_"),
                               _("Movement"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("relationalOperator", _("Comparison sign"))
                    .AddParameter("expression", _("Value"))
                    .SetFunctionName("GetSpeed").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h");


                aut.AddAction("SetSpeed",
                               _("Change the speed"),
                               _("Change the speed of the object on the path."),
                               _("Do _PARAM1__PARAM2_ to the speed of _PARAM0_ on the path"),
                               _("Movement"),
                               "CppPlatform/Extensions/pathicon24.png",
                               "CppPlatform/Extensions/pathicon16.png")

                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .AddParameter("operator", _("Modification sign"))
                    .AddParameter("expression", _("Value"))
                    .SetFunctionName("SetSpeed").SetGetter("GetSpeed").SetManipulatedType("number").SetIncludeFile("PathBehavior/PathBehavior.h");

                aut.AddExpression("Speed", _("Speed"), _("Moving speed on the path"), _("Movement"), "CppPlatform/Extensions/pathicon16.png")
                    .AddParameter("object", _("Object"))
                    .AddParameter("behavior", _("Behavior"), "PathBehavior")
                    .SetFunctionName("GetSpeed").SetIncludeFile("PathBehavior/PathBehavior.h");


                #endif

            };

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #17
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("Box3DObject",
                              _("3D Box Object"),
                              _("Extension allowing to use 3D Box objects."),
                              "Florian Rival",
                              "Open source (MIT License)");

        {
            gd::ObjectMetadata & obj = AddObject("Box3D",
                       _("3D Box"),
                       _("Displays a 3D Box"),
                       "CppPlatform/Extensions/Box3Dicon.png",
                       &CreateBox3DObject);

            AddRuntimeObject(obj, "RuntimeBox3DObject", &CreateRuntimeBox3DObject);

            #if defined(GD_IDE_ONLY)

            obj.SetIncludeFile("Box3DObject/Box3DObject.h");

            obj.AddAction("Width",
                           _("Width"),
                           _("Modify the width of a 3D Box."),
                           _("Do _PARAM1__PARAM2_ to the width of _PARAM0_"),
                           _("Size"),
                           "res/actions/scaleWidth24.png",
                           "res/actions/scaleWidth.png")

                .AddParameter("object", _("Object"), "Box3D")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))

                .SetFunctionName("SetWidth").SetManipulatedType("number").SetGetter("GetWidth").SetIncludeFile("Box3DObject/Box3DObject.h");

            obj.AddCondition("Width",
                           _("Width"),
                           _("Compare the width of a 3D Box."),
                           _("width of _PARAM0_ is _PARAM1__PARAM2_"),
                           _("Size"),
                           "res/conditions/scaleWidth24.png",
                           "res/conditions/scaleWidth.png")

                .AddParameter("object", _("Object"), "Box3D")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))

                .SetFunctionName("GetWidth").SetManipulatedType("number").SetIncludeFile("Box3DObject/Box3DObject.h");


            obj.AddAction("Height",
                           _("Height"),
                           _("Modify the height of a 3D Box."),
                           _("Do _PARAM1__PARAM2_ to the height of _PARAM0_"),
                           _("Size"),
                           "res/actions/scaleHeight24.png",
                           "res/actions/scaleHeight.png")

                .AddParameter("object", _("Object"), "Box3D")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))

                .SetFunctionName("SetHeight").SetManipulatedType("number").SetGetter("GetHeight").SetIncludeFile("Box3DObject/Box3DObject.h");


            obj.AddCondition("Height",
                           _("Height"),
                           _("Compare the height of a 3D Box."),
                           _("height of _PARAM0_ is _PARAM1__PARAM2_"),
                           _("Size"),
                           "res/conditions/scaleHeight24.png",
                           "res/conditions/scaleHeight.png")

                .AddParameter("object", _("Object"), "Box3D")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))

                .SetFunctionName("SetHeight").SetManipulatedType("number").SetGetter("GetHeight").SetIncludeFile("Box3DObject/Box3DObject.h");


            obj.AddAction("Depth",
                           _("Depth"),
                           _("Modify the depth of a 3D Box."),
                           _("Do _PARAM1__PARAM2_ to the depth of _PARAM0_"),
                           _("Size"),
                           "res/actions/depth24.png",
                           "res/actions/depth.png")

                .AddParameter("object", _("Object"), "Box3D")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))

                .SetFunctionName("SetDepth").SetManipulatedType("number").SetGetter("GetDepth").SetIncludeFile("Box3DObject/Box3DObject.h");


            obj.AddCondition("Depth",
                           _("Depth"),
                           _("Compare the depth of a 3D Box."),
                           _("depth of _PARAM0_ is _PARAM1__PARAM2_"),
                           _("Size"),
                           "res/conditions/depth24.png",
                           "res/conditions/depth.png")

                .AddParameter("object", _("Object"), "Box3D")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))

                .SetFunctionName("GetDepth").SetManipulatedType("number").SetIncludeFile("Box3DObject/Box3DObject.h");


            obj.AddAction("ZPosition",
                           _("Z Position"),
                           _("Modify the Z Position of a 3D Box."),
                           _("Do _PARAM1__PARAM2_ to the Z position of _PARAM0_"),
                           _(""),
                           "res/actions/position24.png",
                           "res/actions/position.png")

                .AddParameter("object", _("Object"), "Box3D")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))

                .SetFunctionName("SetZPosition").SetManipulatedType("number").SetGetter("GetZPosition").SetIncludeFile("Box3DObject/Box3DObject.h");


            obj.AddCondition("ZPosition",
                           _("Z Position"),
                           _("Compare Z position of a 3D Box."),
                           _("Z position of _PARAM0_ is _PARAM1__PARAM2_"),
                           _(""),
                           "res/conditions/position24.png",
                           "res/conditions/position.png")

                .AddParameter("object", _("Object"), "Box3D")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))

                .SetFunctionName("GetZPosition").SetManipulatedType("number").SetIncludeFile("Box3DObject/Box3DObject.h");


            obj.AddAction("Yaw",
                           _("Yaw"),
                           _("Modify Yaw of a 3D Box object."),
                           _("Do _PARAM1__PARAM2_ to yaw of _PARAM0_"),
                           _("Angle"),
                           "res/actions/rotate24.png",
                           "res/actions/rotate.png")

                .AddParameter("object", _("Object"), "Box3D")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))

                .SetFunctionName("SetAngle").SetManipulatedType("number").SetGetter("GetAngle").SetIncludeFile("Box3DObject/Box3DObject.h");


            obj.AddCondition("Yaw",
                           _("Yaw"),
                           _("Compare Yaw of a 3D Box object."),
                           _("Yaw of _PARAM0_ is _PARAM1__PARAM2_"),
                           _("Angle"),
                           "res/conditions/rotate24.png",
                           "res/conditions/rotate.png")

                .AddParameter("object", _("Object"), "Box3D")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))

                .SetFunctionName("GetAngle").SetManipulatedType("number").SetIncludeFile("Box3DObject/Box3DObject.h");


            obj.AddAction("Pitch",
                           _("Pitch"),
                           _("Modify Pitch of a 3D Box object."),
                           _("Do _PARAM1__PARAM2_ to pitch of _PARAM0_"),
                           _("Angle"),
                           "res/actions/rotate24.png",
                           "res/actions/rotate.png")

                .AddParameter("object", _("Object"), "Box3D")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))

                .SetFunctionName("SetPitch").SetManipulatedType("number").SetGetter("GetPitch").SetIncludeFile("Box3DObject/Box3DObject.h");


            obj.AddCondition("Pitch",
                           _("Pitch"),
                           _("Compare Pitch of a 3D Box object."),
                           _("Pitch of _PARAM0_ is _PARAM1__PARAM2_"),
                           _("Angle"),
                           "res/conditions/rotate24.png",
                           "res/conditions/rotate.png")

                .AddParameter("object", _("Object"), "Box3D")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))

                .SetFunctionName("GetPitch").SetManipulatedType("number").SetIncludeFile("Box3DObject/Box3DObject.h");


            obj.AddAction("Roll",
                           _("Roll"),
                           _("Modify Roll of a 3D Box object."),
                           _("Do _PARAM1__PARAM2_ to roll of _PARAM0_"),
                           _("Angle"),
                           "res/actions/rotate24.png",
                           "res/actions/rotate.png")
                .AddParameter("object", _("Object"), "Box3D")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))

                .SetFunctionName("SetRoll").SetManipulatedType("number").SetGetter("GetRoll").SetIncludeFile("Box3DObject/Box3DObject.h");


            obj.AddCondition("Roll",
                           _("Roll"),
                           _("Compare Roll of a 3D Box object."),
                           _("Roll of _PARAM0_ is _PARAM1__PARAM2_"),
                           _("Angle"),
                           "res/conditions/rotate24.png",
                           "res/conditions/rotate.png")

                .AddParameter("object", _("Object"), "Box3D")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))
                .SetFunctionName("GetRoll").SetManipulatedType("number").SetIncludeFile("Box3DObject/Box3DObject.h");

            obj.AddExpression("Depth", _("Depth of the 3D Box"), _("Depth of the 3D Box"), _("Size"), "res/actions/scaleHeight.png")
                .AddParameter("object", _("Object"), "Box3D")
                .codeExtraInformation.SetFunctionName("GetDepth").SetIncludeFile("Box3DObject/Box3DObject.h");

            obj.AddExpression("Z", _("Z Position"), _("Z Position"), _("Position"), "res/actions/scaleHeight.png")
                .AddParameter("object", _("Object"), "Box3D")
                .SetFunctionName("GetZPosition").SetIncludeFile("Box3DObject/Box3DObject.h");

            obj.AddExpression("Yaw", _("Yaw"), _("Yaw"), _("Angle"), "res/actions/scaleHeight.png")
                .AddParameter("object", _("Object"), "Box3D")
                .SetFunctionName("GetAngle").SetIncludeFile("Box3DObject/Box3DObject.h");

            obj.AddExpression("Pitch", _("Pitch"), _("Pitch"), _("Angle"), "res/actions/scaleHeight.png")
                .AddParameter("object", _("Object"), "Box3D")
                .SetFunctionName("GetPitch").SetIncludeFile("Box3DObject/Box3DObject.h");

            obj.AddExpression("Roll", _("Roll"), _("Roll"), _("Angle"), "res/actions/scaleHeight.png")
                .AddParameter("object", _("Object"), "Box3D")
                .SetFunctionName("GetRoll").SetIncludeFile("Box3DObject/Box3DObject.h");

            #endif

        }

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #18
0
    /**
     * \brief Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    PlatformBehaviorJsExtension()
    {
        SetExtensionInformation("PlatformBehavior",
                              _("Platform Behavior"),
                              _("Allows to use controllable objects which can run and jump on platforms."),
                              "Florian Rival",
                              "Open source (MIT License)");
        DeclarePlatformBehaviorExtension(*this);

        GetBehaviorMetadata("PlatformBehavior::PlatformBehavior")
            .SetIncludeFile("PlatformBehavior/platformruntimebehavior.js")
            .AddIncludeFile("PlatformBehavior/platformerobjectruntimebehavior.js");

        GetBehaviorMetadata("PlatformBehavior::PlatformerObjectBehavior")
            .SetIncludeFile("PlatformBehavior/platformruntimebehavior.js")
            .AddIncludeFile("PlatformBehavior/platformerobjectruntimebehavior.js");

        {

            std::map<gd::String, gd::InstructionMetadata > & autActions = GetAllActionsForBehavior("PlatformBehavior::PlatformerObjectBehavior");
            std::map<gd::String, gd::InstructionMetadata > & autConditions = GetAllConditionsForBehavior("PlatformBehavior::PlatformerObjectBehavior");
            std::map<gd::String, gd::ExpressionMetadata > & autExpressions = GetAllExpressionsForBehavior("PlatformBehavior::PlatformerObjectBehavior");

            autConditions["PlatformBehavior::IsMoving"].SetFunctionName("isMoving");
            autConditions["PlatformBehavior::IsOnFloor"].SetFunctionName("isOnFloor");
            autConditions["PlatformBehavior::IsOnLadder"].SetFunctionName("isOnLadder");
            autConditions["PlatformBehavior::IsJumping"].SetFunctionName("isJumping");
            autConditions["PlatformBehavior::IsFalling"].SetFunctionName("isFalling");
            autConditions["PlatformBehavior::IsGrabbingPlatform"].SetFunctionName("isGrabbingPlatform");

            autConditions["PlatformBehavior::Gravity"].SetFunctionName("getGravity");
            autActions["PlatformBehavior::Gravity"].SetFunctionName("setGravity").SetGetter("getGravity");
            autExpressions["Gravity"].SetFunctionName("getGravity");
            autConditions["PlatformBehavior::MaxFallingSpeed"].SetFunctionName("getMaxFallingSpeed");
            autActions["PlatformBehavior::MaxFallingSpeed"].SetFunctionName("setMaxFallingSpeed").SetGetter("getMaxFallingSpeed");
            autExpressions["MaxFallingSpeed"].SetFunctionName("getMaxFallingSpeed");
            autConditions["PlatformBehavior::Acceleration"].SetFunctionName("getAcceleration");
            autActions["PlatformBehavior::Acceleration"].SetFunctionName("setAcceleration").SetGetter("getAcceleration");
            autExpressions["Acceleration"].SetFunctionName("getAcceleration");
            autConditions["PlatformBehavior::Deceleration"].SetFunctionName("getDeceleration");
            autActions["PlatformBehavior::Deceleration"].SetFunctionName("setDeceleration").SetGetter("getDeceleration");
            autExpressions["Deceleration"].SetFunctionName("getDeceleration");
            autConditions["PlatformBehavior::MaxSpeed"].SetFunctionName("getMaxSpeed");
            autActions["PlatformBehavior::MaxSpeed"].SetFunctionName("setMaxSpeed").SetGetter("getMaxSpeed");
            autExpressions["MaxSpeed"].SetFunctionName("getMaxSpeed");
            autConditions["PlatformBehavior::JumpSpeed"].SetFunctionName("getJumpSpeed");
            autActions["PlatformBehavior::JumpSpeed"].SetFunctionName("setJumpSpeed").SetGetter("getJumpSpeed");
            autExpressions["JumpSpeed"].SetFunctionName("getJumpSpeed");

            autActions["PlatformBehavior::SetCanJump"].SetFunctionName("setCanJump");
            autActions["PlatformBehavior::SimulateLeftKey"].SetFunctionName("simulateLeftKey");
            autActions["PlatformBehavior::SimulateRightKey"].SetFunctionName("simulateRightKey");
            autActions["PlatformBehavior::SimulateUpKey"].SetFunctionName("simulateUpKey");
            autActions["PlatformBehavior::SimulateDownKey"].SetFunctionName("simulateDownKey");
            autActions["PlatformBehavior::SimulateLadderKey"].SetFunctionName("simulateLadderKey");
            autActions["PlatformBehavior::SimulateJumpKey"].SetFunctionName("simulateJumpKey");
            autActions["PlatformBehavior::SimulateReleaseKey"].SetFunctionName("simulateReleaseKey");
            autActions["PlatformBehavior::SimulateControl"].SetFunctionName("simulateControl");
            autActions["PlatformBehavior::IgnoreDefaultControls"].SetFunctionName("ignoreDefaultControls");
        }
        {
            std::map<gd::String, gd::InstructionMetadata > & autActions = GetAllActionsForBehavior("PlatformBehavior::PlatformBehavior");

            autActions["PlatformBehavior::ChangePlatformType"].SetFunctionName("changePlatformType");
        }
        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #19
0
  /**
   * \brief Constructor of an extension declares everything the extension
   * contains: objects, actions, conditions and expressions.
   */
  PhysicsBehaviorJsExtension() {
    DeclarePhysicsBehaviorExtension(*this);

    GetBehaviorMetadata("PhysicsBehavior::PhysicsBehavior")
        .SetIncludeFile("Extensions/PhysicsBehavior/box2djs/box2d.js")
        .AddIncludeFile("Extensions/PhysicsBehavior/physicsruntimebehavior.js");

    std::map<gd::String, gd::InstructionMetadata>& autActions =
        GetAllActionsForBehavior("PhysicsBehavior::PhysicsBehavior");
    std::map<gd::String, gd::InstructionMetadata>& autConditions =
        GetAllConditionsForBehavior("PhysicsBehavior::PhysicsBehavior");
    std::map<gd::String, gd::ExpressionMetadata>& autExpressions =
        GetAllExpressionsForBehavior("PhysicsBehavior::PhysicsBehavior");

    autActions["PhysicsBehavior::SetStatic"].SetFunctionName("setStatic");
    autActions["PhysicsBehavior::SetDynamic"].SetFunctionName("setDynamic");
    autConditions["PhysicsBehavior::SetDynamic"].SetFunctionName("isDynamic");
    autActions["PhysicsBehavior::SetFixedRotation"].SetFunctionName(
        "setFixedRotation");
    autActions["PhysicsBehavior::SetFreeRotation"].SetFunctionName(
        "setFreeRotation");
    autActions["PhysicsBehavior::AddRevoluteJoint"].SetFunctionName(
        "addRevoluteJoint");
    autActions["PhysicsBehavior::AddRevoluteJointBetweenObjects"]
        .SetFunctionName("addRevoluteJointBetweenObjects");
    autActions["PhysicsBehavior::ActAddGearJointBetweenObjects"]
        .SetFunctionName("addGearJointBetweenObjects");
    autConditions["PhysicsBehavior::IsFixedRotation"].SetFunctionName(
        "isFixedRotation");
    autActions["PhysicsBehavior::SetAsBullet"].SetFunctionName("setAsBullet");
    autActions["PhysicsBehavior::DontSetAsBullet"].SetFunctionName(
        "dontSetAsBullet");
    autConditions["PhysicsBehavior::IsBullet"].SetFunctionName("isBullet");
    autActions["PhysicsBehavior::ApplyImpulse"].SetFunctionName("applyImpulse");
    autActions["PhysicsBehavior::ApplyImpulseUsingPolarCoordinates"]
        .SetFunctionName("applyImpulseUsingPolarCoordinates");
    autActions["PhysicsBehavior::ApplyImpulseTowardPosition"].SetFunctionName(
        "applyImpulseTowardPosition");
    autActions["PhysicsBehavior::ApplyForce"].SetFunctionName("applyForce");
    autActions["PhysicsBehavior::ApplyForceUsingPolarCoordinates"]
        .SetFunctionName("applyForceUsingPolarCoordinates");
    autActions["PhysicsBehavior::ApplyForceTowardPosition"].SetFunctionName(
        "applyForceTowardPosition");
    autActions["PhysicsBehavior::ApplyTorque"].SetFunctionName("applyTorque");
    autActions["PhysicsBehavior::SetLinearVelocity"].SetFunctionName(
        "setLinearVelocity");
    autConditions["PhysicsBehavior::LinearVelocityX"].SetFunctionName(
        "getLinearVelocityX");
    autConditions["PhysicsBehavior::LinearVelocityY"].SetFunctionName(
        "getLinearVelocityY");
    autConditions["PhysicsBehavior::LinearVelocity"].SetFunctionName(
        "getLinearVelocity");
    autActions["PhysicsBehavior::SetAngularVelocity"].SetFunctionName(
        "setAngularVelocity");
    autConditions["PhysicsBehavior::AngularVelocity"].SetFunctionName(
        "getAngularVelocity");
    autConditions["PhysicsBehavior::CollisionWith"].SetFunctionName(
        "collisionWith");
    autConditions["PhysicsBehavior::LinearDamping"].SetFunctionName(
        "getLinearDamping");
    autActions["PhysicsBehavior::SetLinearDamping"].SetFunctionName(
        "setLinearDamping");
    autConditions["PhysicsBehavior::AngularDamping"].SetFunctionName(
        "getAngularDamping");
    autActions["PhysicsBehavior::SetAngularDamping"].SetFunctionName(
        "setAngularDamping");
    autActions["PhysicsBehavior::SetGravity"].SetFunctionName("setGravity");
    autExpressions["LinearVelocity"].SetFunctionName("getLinearVelocity");
    autExpressions["LinearVelocityX"].SetFunctionName("getLinearVelocityX");
    autExpressions["LinearVelocityY"].SetFunctionName("getLinearVelocityY");
    autExpressions["AngularVelocity"].SetFunctionName("getAngularVelocity");
    autExpressions["LinearDamping"].SetFunctionName("getLinearDamping");
    autExpressions["AngularDamping"].SetFunctionName("getAngularDamping");

    /*
        aut.AddAction("SetPolygonScaleX",
                       _("Change collision polygon X scale"),
                       _("Change the X scale of the polygon. Use a value greater
       than 1 to enlarge the polygon, less than 1 to reduce it."),
                       _("Change collision polygon of _PARAM0_ X scale to
       _PARAM2_"),
                       _("Collision polygon"),
                       "res/physics24.png",
                       "res/physics16.png")
            .AddParameter("object", _("Object"))
            .AddParameter("behavior", _("Behavior"), "PhysicsBehavior")
            .AddParameter("expression", _("Scale"))
            .AddCodeOnlyParameter("currentScene", "")
            .SetFunctionName("SetPolygonScaleX").SetIncludeFile("PhysicsBehavior/PhysicsBehavior.h");

        aut.AddAction("SetPolygonScaleY",
                       _("Change collision polygon Y scale"),
                       _("Change the Y scale of the polygon. Use a value greater
       than 1 to enlarge the polygon, less than 1 to reduce it."),
                       _("Change collision polygon of _PARAM0_ Y scale to
       _PARAM2_"),
                       _("Collision polygon"),
                       "res/physics24.png",
                       "res/physics16.png")
            .AddParameter("object", _("Object"))
            .AddParameter("behavior", _("Behavior"), "PhysicsBehavior")
            .AddParameter("expression", _("Scale"))
            .AddCodeOnlyParameter("currentScene", "")
            .SetFunctionName("SetPolygonScaleY").SetIncludeFile("PhysicsBehavior/PhysicsBehavior.h");

        aut.AddCondition("GetPolygonScaleX",
                       _("Collision polygon X scale"),
                       _("Test the value of the collision polygon X scale."),
                       _("Collision polygon of _PARAM0_ X scale is
       _PARAM2__PARAM3_"),
                       _("Collision polygon"),
                       "res/physics24.png",
                       "res/physics16.png")
            .AddParameter("object", _("Object"))
            .AddParameter("behavior", _("Behavior"), "PhysicsBehavior")
            .AddParameter("relationalOperator", _("Comparison sign"))
            .AddParameter("expression", _("Value to test"))
            .AddCodeOnlyParameter("currentScene", "")
            .SetFunctionName("GetPolygonScaleX").SetManipulatedType("number").SetIncludeFile("PhysicsBehavior/PhysicsBehavior.h");

        aut.AddCondition("GetPolygonScaleY",
                       _("Collision polygon Y scale"),
                       _("Test the value of the collision polygon Y scale."),
                       _("Collision polygon of _PARAM0_ Y scale is
       _PARAM2__PARAM3_"),
                       _("Collision polygon"),
                       "res/physics24.png",
                       "res/physics16.png")
            .AddParameter("object", _("Object"))
            .AddParameter("behavior", _("Behavior"), "PhysicsBehavior")
            .AddParameter("relationalOperator", _("Comparison sign"))
            .AddParameter("expression", _("Value to test"))
            .AddCodeOnlyParameter("currentScene", "")
            .SetFunctionName("GetPolygonScaleY").SetManipulatedType("number").SetIncludeFile("PhysicsBehavior/PhysicsBehavior.h");

        aut.AddExpression("PolygonScaleX", _("Collision polygon X scale"),
       _("Collision polygon X scale"), _("Collision polygon"),
       "res/physics16.png") .AddParameter("object", _("Object"))
            .AddParameter("behavior", _("Behavior"), "PhysicsBehavior")
            .AddCodeOnlyParameter("currentScene", "")
            .SetFunctionName("GetPolygonScaleX").SetIncludeFile("PhysicsBehavior/PhysicsBehavior.h");

        aut.AddExpression("PolygonScaleY", _("Collision polygon Y scale"),
       _("Collision polygon Y scale"), _("Collision polygon"),
       "res/physics16.png") .AddParameter("object", _("Object"))
            .AddParameter("behavior", _("Behavior"), "PhysicsBehavior")
            .AddCodeOnlyParameter("currentScene", "")
            .SetFunctionName("GetPolygonScaleY").SetIncludeFile("PhysicsBehavior/PhysicsBehavior.h");
*/

    StripUnimplementedInstructionsAndExpressions();
    GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
  };
Пример #20
0
    /**
     * Constructor of an extension declares everything the extension contains : Objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("Light",
                              _("Light"),
                              _("Allow to display lights and use light obstacles."),
                              "Florian Rival",
                              "zlib/libpng License (Open Source)");

            {
                gd::ObjectMetadata & obj = AddObject("Light",
                           _("Light"),
                           _("Emits light that can be stopped by objects"),
                           "CppPlatform/Extensions/lightIcon32.png",
                           &CreateLightObject,
                           &DestroyLightObject);

                AddRuntimeObject(obj, "RuntimeLightObject", CreateRuntimeLightObject,DestroyRuntimeLightObject);

                #if defined(GD_IDE_ONLY)
                LightObject::LoadEdittimeIcon();
                obj.SetIncludeFile("Light/LightObject.h");

                obj.AddAction("ChangeColor",
                               _("Color"),
                               _("Change light color."),
                               _("Change color of _PARAM0_ to _PARAM1_"),
                               _("Setup"),
                               "CppPlatform/Extensions/lightIcon24.png",
                               "CppPlatform/Extensions/lightIcon16.png")
                    .AddParameter("object", _("Object"), "Light", false)
                    .AddParameter("color", _("Color"))
                    .codeExtraInformation.SetFunctionName("SetColor").SetIncludeFile("Light/LightObject.h");


                obj.AddAction("Intensity",
                               _("Intensity"),
                               _("Modify the intensity of a light"),
                               _("Do _PARAM1__PARAM2_ to the intensity of _PARAM0_"),
                               _("Setup"),
                               "CppPlatform/Extensions/lightIcon24.png",
                               "CppPlatform/Extensions/lightIcon16.png")
                    .AddParameter("object", _("Object"), "Light", false)
                    .AddParameter("operator", _("Modification's sign"))
                    .AddParameter("expression", _("Value"))
                .codeExtraInformation.SetFunctionName("SetIntensity").SetManipulatedType("number").SetAssociatedGetter("GetIntensity").SetIncludeFile("Light/LightObject.h");


                obj.AddCondition("Intensity",
                               _("Intensity"),
                               _("Test the intensity of a light."),
                               _("Intensity of _PARAM0_ is _PARAM1__PARAM2_"),
                               _("Setup"),
                               "CppPlatform/Extensions/lightIcon24.png",
                               "CppPlatform/Extensions/lightIcon16.png")
                    .AddParameter("object", _("Object"), "Light", false)
                    .AddParameter("relationalOperator", _("Sign of the test"))
                    .AddParameter("expression", _("Value to test"))
                .codeExtraInformation.SetFunctionName("GetIntensity").SetManipulatedType("number").SetIncludeFile("Light/LightObject.h");


                obj.AddAction("Radius",
                               _("Radius"),
                               _("Modify the radius of a liht"),
                               _("Do _PARAM1__PARAM2_ to radius of _PARAM0_"),
                               _("Setup"),
                               "CppPlatform/Extensions/lightIcon24.png",
                               "CppPlatform/Extensions/lightIcon16.png")
                    .AddParameter("object", _("Object"), "Light", false)
                    .AddParameter("operator", _("Modification's sign"))
                    .AddParameter("expression", _("Value"))
                .codeExtraInformation.SetFunctionName("SetRadius").SetManipulatedType("number").SetAssociatedGetter("GetRadius").SetIncludeFile("Light/LightObject.h");


                obj.AddCondition("Radius",
                               _("Radius"),
                               _("Test the radius of a light."),
                               _("The radius of _PARAM0_ is _PARAM2_ _PARAM1_"),
                               _("Setup"),
                               "CppPlatform/Extensions/lightIcon24.png",
                               "CppPlatform/Extensions/lightIcon16.png")
                    .AddParameter("object", _("Object"), "Light", false)
                    .AddParameter("relationalOperator", _("Sign of the test"))
                    .AddParameter("expression", _("Value to test"))
                .codeExtraInformation.SetFunctionName("GetRadius").SetManipulatedType("number").SetIncludeFile("Light/LightObject.h");


                obj.AddAction("Quality",
                               _("Quality"),
                               _("Modify the quality of a light"),
                               _("Do _PARAM1__PARAM2_ to the quality of _PARAM0_"),
                               _("Setup"),
                               "CppPlatform/Extensions/lightIcon24.png",
                               "CppPlatform/Extensions/lightIcon16.png")
                    .AddParameter("object", _("Object"), "Light", false)
                    .AddParameter("operator", _("Modification's sign"))
                    .AddParameter("expression", _("Value"))
                .codeExtraInformation.SetFunctionName("SetQuality").SetManipulatedType("number").SetAssociatedGetter("GetQuality").SetIncludeFile("Light/LightObject.h");


                obj.AddCondition("Quality",
                               _("Quality"),
                               _("Test the quality of a light"),
                               _("The quality of _PARAM0_ is _PARAM1__PARAM2_"),
                               _("Setup"),
                               "CppPlatform/Extensions/lightIcon24.png",
                               "CppPlatform/Extensions/lightIcon16.png")
                    .AddParameter("object", _("Object"), "Light", false)
                    .AddParameter("relationalOperator", _("Sign of the test"))
                    .AddParameter("expression", _("Value to test"))
                .codeExtraInformation.SetFunctionName("GetQuality").SetManipulatedType("number").SetIncludeFile("Light/LightObject.h");


                obj.AddAction("ChangeGlobalColor",
                               _("Global color"),
                               _("Change scene color for a global light."),
                               _("Change scene global color of _PARAM0_ to _PARAM1_"),
                               _("Setup"),
                               "CppPlatform/Extensions/lightIcon24.png",
                               "CppPlatform/Extensions/lightIcon16.png")
                    .AddParameter("object", _("Object"), "Light", false)
                    .AddParameter("color", _("Color"))
                .codeExtraInformation.SetFunctionName("SetGlobalColor").SetIncludeFile("Light/LightObject.h");


                obj.AddAction("SetGlobalLight",
                               _("Make a light global"),
                               _("Make a light global or simple."),
                               _("Make _PARAM0_ global : _PARAM1_"),
                               _("Light type"),
                               "CppPlatform/Extensions/lightIcon24.png",
                               "CppPlatform/Extensions/lightIcon16.png")
                    .AddParameter("object", _("Object"), "Light", false)
                    .AddParameter("yesorno", _("Make light global"))
                .codeExtraInformation.SetFunctionName("SetGlobalLight").SetIncludeFile("Light/LightObject.h");


                obj.AddCondition("GlobalLight",
                               _("A light is global"),
                               _("Return true if light is global"),
                               _("_PARAM0_ is a global light"),
                               _("Light type"),
                               "CppPlatform/Extensions/lightIcon24.png",
                               "CppPlatform/Extensions/lightIcon16.png")
                    .AddParameter("object", _("Object"), "Light", false)
                .codeExtraInformation.SetFunctionName("IsGlobalLight").SetIncludeFile("Light/LightObject.h");


/*
                obj.AddAction("Angle",
                               _("Change the angle"),
                               _("Modify the angle of a Text object."),
                               _("Do _PARAM1__PARAM2_ to the angle of _PARAM0_"),
                               _("Rotation"),
                               "CppPlatform/Extensions/lightIcon24.png",
                               "CppPlatform/Extensions/lightIcon16.png",
                               &LightObject::ActAngle)
                    .AddParameter("object", _("Object"), "Light", false)
                    .AddParameter("operator", _("Modification's sign"))
                    .AddParameter("expression", _("Value"))



                obj.AddCondition("Angle",
                               _("Angle d'un objet texte"),
                               _("Test the value of the angle of a text object."),
                               _("The angle of _PARAM0_ is _PARAM1__PARAM2_"),
                               _("Rotation"),
                               "CppPlatform/Extensions/lightIcon24.png",
                               "CppPlatform/Extensions/lightIcon16.png",
                               &LightObject::CondAngle)
                    .AddParameter("object", _("Object"), "Light", false)
                    .AddParameter("relationalOperator", _("Sign of the test"))
                    .AddParameter("expression", _("Value to test"))

*/

                obj.AddExpression("Intensity", _("Intensity"), _("Intensity"), _("Setup"), "CppPlatform/Extensions/lightIcon16.png")
                    .AddParameter("object", _("Object"), "Light", false)
                    .codeExtraInformation.SetFunctionName("GetIntensity").SetIncludeFile("Light/LightObject.h");

                obj.AddExpression("Radius", _("Radius"), _("Radius"), _("Setup"), "CppPlatform/Extensions/lightIcon16.png")
                    .AddParameter("object", _("Object"), "Light", false)
                    .codeExtraInformation.SetFunctionName("GetRadius").SetIncludeFile("Light/LightObject.h");

                obj.AddExpression("Quality", _("Quality"), _("Quality"), _("Setup"), "CppPlatform/Extensions/lightIcon16.png")
                    .AddParameter("object", _("Object"), "Light", false)
                    .codeExtraInformation.SetFunctionName("GetQuality").SetIncludeFile("Light/LightObject.h");


                /*
                obj.AddExpression("Angle", _("Angle"), _("Angle"), _("Light"), "CppPlatform/Extensions/lightIcon16.png", &LightObject::ExpAngle)
                    .AddParameter("object", _("Object"), "Light", false)
*/

                #endif

            }

            {
                AddAutomatism("LightObstacleAutomatism",
                      _("Light obstacle"),
                      _("LightObstacle"),
                      _("Mark the objects as obstacles for Light objects."),
                      "",
                      "CppPlatform/Extensions/lightObstacleicon32.png",
                      "LightObstacleAutomatism",
                      boost::shared_ptr<gd::Automatism>(new LightObstacleAutomatism),
                      boost::shared_ptr<gd::AutomatismsSharedData>(new SceneLightObstacleDatas));

            };

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #21
0
 /**
  * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
  */
 Extension()
 {
     DeclareDestroyOutsideAutomatismExtension(*this);
     GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
 };
Пример #22
0
 /**
  * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
  */
 Extension()
 {
     DeclareTopDownMovementBehaviorExtension(*this);
     GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
 };
Пример #23
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("Inventory",
                              _("Inventory"),
                              _("Provides action and condition to store an inventory with items in memory."),
                              "Florian Rival",
                              "Open source (MIT License)");

        #if defined(GD_IDE_ONLY)
        AddAction("Add",
                       _("Add an item"),
                       _("Add an item in an inventory."),
                       _("Add a _PARAM2_ to inventory _PARAM1_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .SetFunctionName("InventoryTools::Add").SetIncludeFile("Inventory/InventoryTools.h");

        AddAction("Remove",
                       _("Remove an item"),
                       _("Remove an item from an inventory."),
                       _("Remove a _PARAM2_ from inventory _PARAM1_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .SetFunctionName("InventoryTools::Remove").SetIncludeFile("Inventory/InventoryTools.h");

        AddCondition("Count",
                       _("Item count"),
                       _("Compare the number of an item in an inventory."),
                       _("Count of _PARAM2_ in _PARAM1_ is _PARAM3__PARAM4_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Count"))
            .SetFunctionName("InventoryTools::Count").SetIncludeFile("Inventory/InventoryTools.h")
            .SetManipulatedType("number");

        AddCondition("Has",
                       _("Has an item"),
                       _("Check that there is at least one of the specified item in the inventory."),
                       _("Inventory _PARAM1_ contains a _PARAM2_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .SetFunctionName("InventoryTools::Has").SetIncludeFile("Inventory/InventoryTools.h");

        AddAction("SetMaximum",
                       _("Set a maximum count for an item"),
                       _("Set the maximum number that can be added in the inventory for the specified item. By default, there is an unlimited number allowed for each item."),
                       _("Set the maximum count for _PARAM2_ in inventory _PARAM1_ to _PARAM3_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .AddParameter("expression", _("Maximum count"))
            .SetFunctionName("InventoryTools::SetMaximum").SetIncludeFile("Inventory/InventoryTools.h");

        AddAction("SetUnlimited",
                       _("Set unlimited count for an item"),
                       _("Allow an unlimited amount of an object to be in an inventory. This is the case by default for each item."),
                       _("Allow an unlimited count of _PARAM2_ in inventory _PARAM1_: _PARAM3_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .AddParameter("yesorno", _("Allow an unlimited amount?"))
            .SetFunctionName("InventoryTools::SetUnlimited").SetIncludeFile("Inventory/InventoryTools.h");

        AddCondition("IsFull",
                       _("Item full"),
                       _("Check if an item has reached the maximum number allowed in the inventory."),
                       _("Inventory _PARAM1_ is full of _PARAM2_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .SetFunctionName("InventoryTools::Has").SetIncludeFile("Inventory/InventoryTools.h");

        AddAction("Equip",
                       _("Equip an item"),
                       _("Mark an item as being equiped. If the item count is 0 it won't be marked as equiped."),
                       _("Set _PARAM2_ as equiped in inventory _PARAM1_: _PARAM3_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .AddParameter("yesorno", _("Equip?"))
            .SetFunctionName("InventoryTools::Equip").SetIncludeFile("Inventory/InventoryTools.h");

        AddCondition("IsEquipped",
                       _("Item equiped"),
                       _("Check if an item is equiped."),
                       _("_PARAM2_ is equipped in inventory _PARAM1_"),
                       _("Inventories"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .SetFunctionName("InventoryTools::IsEquipped").SetIncludeFile("Inventory/InventoryTools.h");

        AddAction("SerializeToVariable",
                       _("Save an inventory in a variable"),
                       _("Save all the items of the inventory in a variable, so that it can be restored later."),
                       _("Save inventory _PARAM1_ in variable _PARAM2_"),
                       _("Inventories/Variables"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("scenevar", _("Scene variable"))
            .SetFunctionName("InventoryTools::SerializeToVariable").SetIncludeFile("Inventory/InventoryTools.h");

        AddAction("UnserializeFromVariable",
                       _("Load an inventory from a variable"),
                       _("Load the content of the inventory from a variable."),
                       _("Load inventory _PARAM1_ from variable _PARAM2_"),
                       _("Inventories/Variables"),
                       "CppPlatform/Extensions/Inventoryicon24.png",
                       "CppPlatform/Extensions/Inventoryicon16.png")

            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Inventory name"))
            .AddParameter("scenevar", _("Scene variable"))
            .SetFunctionName("InventoryTools::UnserializeFromVariable").SetIncludeFile("Inventory/InventoryTools.h");

        AddExpression("Count", _("Item count"), _("Get the number of an item in the inventory"), _("Inventory"), "CppPlatform/Extensions/Inventoryicon16.png")
            .AddCodeOnlyParameter("currentScene", _(""))
            .AddParameter("string", _("Inventory name"))
            .AddParameter("string", _("Item name"))
            .SetFunctionName("InventoryTools::Count").SetIncludeFile("Inventory/InventoryTools.h");

        #endif

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #24
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("AdvancedXML",
                              _("Advanced XML 1.0"),
                              _("Extension allowing to manipulate XML files."),
                              "Victor Levasseur",
                              "Open source (MIT License)");

        #if defined(GD_IDE_ONLY)

        AddAction("NewFile",
                       _("Create an XML document"),
                       _("Create an XML document"),
                       _("Create an XML document into reference _PARAM0_"),
                       _("Advanced XML : Documents"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference (allow to access later to the element)"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::CreateNewDocument").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("LoadFile",
                       _("Load an XML file"),
                       _("Load an XML file."),
                       _("Load XML File _PARAM0_ into reference _PARAM1_"),
                       _("Advanced XML : Documents"),
                       "res/AdvancedXML/AdvancedXMLOpen.png",
                       "res/AdvancedXML/AdvancedXMLOpen16.png")

            .AddParameter("file", _("Source file"))
            .AddParameter("string", _("Reference (allow to access later to the element)"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::LoadXmlFile").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("SaveFile",
                       _("Save an XML file"),
                       _("Save an XML file."),
                       _("Save XML file _PARAM1_ into _PARAM0_"),
                       _("Advanced XML : Documents"),
                       "res/AdvancedXML/AdvancedXMLSave.png",
                       "res/AdvancedXML/AdvancedXMLSave16.png")

            .AddParameter("file", _("File where to save the document"))
            .AddParameter("string", _("Reference to the XML document"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SaveXmlFile").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("BrowseTo",
                       _("Load an element into a reference"),
                       _("Load an element (relative to another) in a reference.\nNote: References allows to access to an element using the name of the reference pointing to it."),
                       _("Load path _PARAM2_ (relative to the element _PARAM0_) into reference _PARAM1_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXMLRef.png",
                       "res/AdvancedXML/AdvancedXMLRef16.png")

            .AddParameter("string", _("Reference of an existing element ( The path of the element will be relative to this element )"))
            .AddParameter("string", _("Name of the reference to the newly created element"))
            .AddParameter("string", _("Path ( tags can be browsed by separating them using /. Use * to go to the first child element without knowing the tag name )"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::BrowseTo").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("NextSibling",
                       _("Go to next element"),
                       _("Create a reference on the element following the specified element.\nNote: The reference will be invalid if there is no valid element following the specified one.Conditions are available to check if an element is valid."),
                       _("Load the element called _PARAM2_ following _PARAM1_ into reference _PARAM0_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXMLRef.png",
                       "res/AdvancedXML/AdvancedXMLRef16.png")

            .AddParameter("string", _("Reference to create"))
            .AddParameter("string", _("Reference to the element preceeding the element to be accessed"))
            .AddParameter("string", _("Tag name filter "), "", true)
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::NextSibling").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddCondition("IsRefValid",
                       _("The reference is valid"),
                       _("Is valid only when the reference is pointing to an existing and valid element."),
                       _("_PARAM0_ exists and is valid"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element to be tested"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::IsRefValid").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddCondition("GetElementType",
                       _("Element type"),
                       _("Test the type of the element.\n(0-> Tag, 1-> Text, 2-> Comment, 3-> XML Document, -1 -> Unknown )"),
                       _("Type of _PARAM0_ _PARAM1__PARAM2_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element to be tested"))
            .AddParameter("relationalOperator", _("Comparison sign"))
            .AddParameter("expression", _("Type"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetRefType").SetManipulatedType("number").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddExpression("GetElementType",
                       _("Element type"),
                       _("Return the type of the element.\n(0-> Tag, 1-> Text, 2-> Comment, 3-> XML Document, -1 -> Unknown )"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetRefType").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddAction("CreateNewElement",
                       _("Create a new element"),
                       _("Create a new element.\nNote: References allows to access to an element using the name of the reference pointing to it."),
                       _("Create a new element of type _PARAM1_ and attach to it the reference _PARAM0_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXMLAdd.png",
                       "res/AdvancedXML/AdvancedXMLAdd16.png")

            .AddParameter("string", _("Reference which will be used to access to the element"))
            .AddParameter("expression", _("Tye of the element to be created\n(0-> Tag, 1-> Text, 2-> Comment )"))
            .AddParameter("string", _("Text of the element\nIf the element is a tag, it will be the tag name,if the element is a text or a comment, it will be the content."))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::CreateNewElement").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("DeleteAnElement",
                       _("Delete an element"),
                       _("Delete an element (The element will be removed from its parent and will be destroyed)."),
                       _("Delete element _PARAM0_"),
                       _("Advanced XML: General"),
                       "res/AdvancedXML/AdvancedXMLRemove.png",
                       "res/AdvancedXML/AdvancedXMLRemove16.png")

            .AddParameter("string", _("Reference to the element to be deleted"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::DeleteAnElement").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("InsertElementIntoAnother",
                       _("Add an element inside another"),
                       _("Add an element into another: The element will be a \"child\" of its \"parent\"."),
                       _("Add _PARAM0_ as a child of _PARAM1_ (before _PARAM2_)"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element to be added"))
            .AddParameter("string", _("Reference to the parent element (must be a Tag element)"))
            .AddParameter("string", _("The element will be added before this element (if not defined, the element will be added at the end)"), "", true)
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::InsertElementIntoAnother").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        AddAction("SetTagName",
                       _("Change the tag name"),
                       _("Change the tag name"),
                       _("Do _PARAM1__PARAM2_ to the name of tag _PARAM0_"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the Tag element"))
            .AddParameter("operator", _("Modification sign"))
            .AddParameter("string", _("Tag name"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SetText").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h").SetAssociatedGetter("AdvancedXML::GetText").SetManipulatedType("string");

        AddStrExpression("GetTagName",
                       _("Tag name"),
                       _("Get the name of a tag"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetText").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddAction("SetContent",
                       _("Change the content of the element"),
                       _("Change the content (text) of the element ( For text and comments elements only )."),
                       _("Do _PARAM1__PARAM2_ to the content of _PARAM0_"),
                       _("Advanced XML : Text and comments"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element"))
            .AddParameter("operator", _("Modification sign"))
            .AddParameter("string", _("Contents"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SetText").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h").SetAssociatedGetter("AdvancedXML::GetText").SetManipulatedType("string");

        AddStrExpression("GetContent",
                       _("Contents"),
                       _("Get the content of a text or comment element"),
                       _("Advanced XML : Text and comments"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetText").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddExpression("GetAttributeNumber",
                       _("Value of an attribute of an element"),
                       _("Get the value of an attribute of an element"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddParameter("string", _("Name of the attribute"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetAttributeNumber").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddAction("SetAttributeNumber",
                       _("Change the value of an attribute"),
                       _("Change the value of an attribute of an element ( which must be a Tag element )."),
                       _("Do _PARAM2__PARAM3_ to the attribute _PARAM1_ of element _PARAM0_"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element"))
            .AddParameter("string", _("Name of the attribute"))
            .AddParameter("operator", _("Modification sign"))
            .AddParameter("expression", _("Value"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SetAttributeNumber").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h").SetAssociatedGetter("AdvancedXML::GetAttributeNumber").SetManipulatedType("number");

        AddStrExpression("GetAttributeString",
                       _("Text of an attribute of an element"),
                       _("Get the text of an attribute of an element"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Element reference"))
            .AddParameter("string", _("Name of the attribute"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::GetAttributeString").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");



        AddAction("SetAttributeString",
                       _("Change the text of an attribute"),
                       _("Change the text of an attribute of an element ( which must be a Tag element )."),
                       _("Do _PARAM2__PARAM3_ to the attribute _PARAM1_ of element _PARAM0_"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element"))
            .AddParameter("string", _("Name of the attribute"))
            .AddParameter("operator", _("Modification sign"))
            .AddParameter("string", _("Value"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::SetAttributeString").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h").SetAssociatedGetter("AdvancedXML::GetAttributeString").SetManipulatedType("string");

        AddAction("RemoveAttribute",
                       _("Delete an attribute"),
                       _("Delete an attribute from an element ( which must be a Tag element)."),
                       _("Delete attribute _PARAM1_ from the element _PARAM0_"),
                       _("Advanced XML: Tag"),
                       "res/AdvancedXML/AdvancedXML.png",
                       "res/AdvancedXML/AdvancedXML16.png")

            .AddParameter("string", _("Reference to the element"))
            .AddParameter("string", _("Name of the attribute"))
            .AddCodeOnlyParameter("currentScene", "")

            .codeExtraInformation.SetFunctionName("AdvancedXML::RemoveAttribute").SetIncludeFile("AdvancedXML/src/AdvancedXMLTools.h");

        #endif

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #25
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("SoundObject",
                              _("Sound object"),
                              _("Extension allowing to use spatialized sounds."),
                              "Thomas Flecy, Victor Levasseur et al.",
                              "Open source (MIT License)");


        //Declaration of all objects available
        {
            gd::ObjectMetadata & obj = AddObject("Sound",
                       _("Sound"),
                       _("Invisible object emitting a sound which can be moved in the space."),
                       "CppPlatform/Extensions/soundicon32.png",
                       &CreateSoundObject);

            AddRuntimeObject(obj, "RuntimeSoundObject", CreateRuntimeSoundObject);

            #if defined(GD_IDE_ONLY)
            SoundObject::LoadEdittimeIcon();
            obj.SetIncludeFile("SoundObject/SoundObject.h");

            obj.AddAction("Volume",
                           _("Sound level"),
                           _("Modify the sound level of a Sound object."),
                           _("Do _PARAM1__PARAM2_ to the sound level of _PARAM0_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))
                .codeExtraInformation.SetFunctionName("SetVolume").SetManipulatedType("number").SetAssociatedGetter("GetVolume").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("Pitch",
                           _("Pitch"),
                           _("Change the pitch of a sound object."),
                           _("Do _PARAM1__PARAM2_ to Pitch of _PARAM0_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))
                .codeExtraInformation.SetFunctionName("SetPitch").SetManipulatedType("number").SetAssociatedGetter("GetPitch").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("Attenuation",
                           _("Attenuation"),
                           _("Change the attenuation of a sound object."),
                           _("Do _PARAM1__PARAM2_ to the attenuation of _PARAM0_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))
                .codeExtraInformation.SetFunctionName("SetAttenuation").SetManipulatedType("number").SetAssociatedGetter("GetAttenuation").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("ZPos",
                           _("Z Position"),
                           _("Modify the sound level of a Sound object."),
                           _("Do _PARAM1__PARAM2_ to the sound level of _PARAM0_"),
                           _("Position"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))
                .codeExtraInformation.SetFunctionName("SetZPos").SetManipulatedType("number").SetAssociatedGetter("GetZPos").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("Loop",
                           _("Automatic restart"),
                           _("Activate or desactivate the looping of a sound."),
                           _("Activate looping for _PARAM0_: _PARAM1_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("yesorno", _("Loop"))
                .codeExtraInformation.SetFunctionName("SetLoop").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("RelativeToListener",
                           _("Listener relation"),
                           _("Activate or desactivate the sound spatialisation relative to the listener."),
                           _("Set _PARAM0_ as relative to the listener position: _PARAM1_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("yesorno", _("Relative to the listener"))
                .codeExtraInformation.SetFunctionName("SetRelativeToListener").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("Play",
                           _("Play"),
                           _("Play a sound."),
                           _("Play sound _PARAM0_"),
                           "",
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("Play").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("Stop",
                           _("Stop"),
                           _("Stop a sound."),
                           _("Stop _PARAM0_"),
                           "",
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("Stop").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddAction("Pause",
                           _("Pause"),
                           _("Pause a sound."),
                           _("Pause _PARAM0_"),
                           "",
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("Pause").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("Volume",
                           _("Sound level"),
                           _("Test the sound level of a Sound object."),
                           _("Th sound level of _PARAM0_ is _PARAM2_ _PARAM1_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))
                .codeExtraInformation.SetFunctionName("GetVolume").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("Pitch",
                           _("Pitch"),
                           _("Test the pitch value of a sound."),
                           _("Pitch of _PARAM0_ is _PARAM1__PARAM2_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))
                .codeExtraInformation.SetFunctionName("GetPitch").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("Attenuation",
                           _("Attenuation"),
                           _("Test the attenuation of a sound."),
                           _("The attenuation of _PARAM0_ is _PARAM1__PARAM2_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))
                .codeExtraInformation.SetFunctionName("GetAttenuation").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("MinDistance",
                           _("Minimal distance"),
                           _("Test the minimal distance of a sound"),
                           _("The minimal distance of _PARAM0_ is _PARAM1__PARAM2_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))
                .codeExtraInformation.SetFunctionName("GetMinDistance").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("ZPos",
                           _("Z Position"),
                           _("Test Z position of a sound."),
                           _("The Z position of _PARAM0_ is _PARAM1__PARAM2_"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value to test"))
                .codeExtraInformation.SetFunctionName("GetZPos").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("Loop",
                           _("Automatic restart"),
                           _("Test if an sound is looping."),
                           _("_PARAM0_ is looping"),
                           _("Parameters"),
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("GetLoop").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("Playing",
                           _("Being played"),
                           _("Test if a sound is being played."),
                           _("_PARAM0_ is being played"),
                           "",
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("IsPlaying").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("Paused",
                           _("Paused"),
                           _("A sound is paused"),
                           _("_PARAM0_ is paused"),
                           "",
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("IsPaused").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("Stopped",
                           _("Stopped"),
                           _("Test if a sound is stopped."),
                           _("_PARAM0_ is stopped"),
                           "",
                           "res/actions/son24.png",
                           "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("IsStopped").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddCondition("RelativeToListener",
                           _("Listener relation"),
                           _("Test if a sound is relative to the listener."),
                           _("_PARAM0_ is relative to the listener"),
                           _("Parameters"),
                           "res/conditions/son24.png",
                           "res/conditions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("IsRelativeToListener").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddExpression("Volume", _("Sound level"), _("Sound level"), _("Parameters"), "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("GetVolume").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddExpression("Pitch", _("Pitch"), _("Pitch"), _("Parameters"), "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("GetPitch").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddExpression("Attenuation", _("Attenuation"), _("Attenuation"), _("Parameters"), "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("GetAttenuation").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddExpression("MinDistance", _("Minimal distance"), _("Minimal distance"), _("Parameters"), "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("GetMinDistance").SetIncludeFile("SoundObject/SoundObject.h");


            obj.AddExpression("ZPos", _("Z Position"), _("Z Position"), _("Position"), "res/actions/son.png")
                .AddParameter("object", _("Object"), "Sound", false)
                .codeExtraInformation.SetFunctionName("GetZPos").SetIncludeFile("SoundObject/SoundObject.h");

        #endif
        }

        // Actions liées à l'écouteur
        #if defined(GD_IDE_ONLY)
        AddAction("ListenerX",
                       _("X position"),
                       _("Modify the X position of the listener."),
                       _("Do _PARAM0__PARAM1_ to the X position of the listener"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .codeExtraInformation.SetFunctionName("SetListenerX").SetManipulatedType("number").SetAssociatedGetter("GetListenerX").SetIncludeFile("SoundObject/SoundListener.h");


        AddAction("ListenerY",
                       _("Y position"),
                       _("Modify the Y position of the listener."),
                       _("Do _PARAM0__PARAM1_ to the Y position of the listener"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .codeExtraInformation.SetFunctionName("SetListenerY").SetManipulatedType("number").SetAssociatedGetter("GetListenerY").SetIncludeFile("SoundObject/SoundListener.h");


        AddAction("ListenerZ",
                       _("Z position"),
                       _("Modify the Z position of the listener."),
                       _("Do _PARAM0__PARAM1_ to the Z position of the listener"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .codeExtraInformation.SetFunctionName("SetListenerZ").SetManipulatedType("number").SetAssociatedGetter("GetListenerZ").SetIncludeFile("SoundObject/SoundListener.h");


        AddAction("ListenerDirectionX",
                       _("Direction on X axis"),
                       _("Change the direction of the listener on X axis."),
                       _("Do _PARAM1__PARAM2_ to the direction on X axis of the listener"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .codeExtraInformation.SetFunctionName("SetListenerDirectionX").SetManipulatedType("number").SetAssociatedGetter("GetListenerDirectionX").SetIncludeFile("SoundObject/SoundListener.h");


        AddAction("ListenerDirectionY",
                       _("Direction on Y axis"),
                       _("Change the direction of the listener on Y axis."),
                       _("Do _PARAM1__PARAM2_ to the direction on Y axis of the listener"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .codeExtraInformation.SetFunctionName("SetListenerDirectionY").SetManipulatedType("number").SetAssociatedGetter("GetListenerDirectionY").SetIncludeFile("SoundObject/SoundListener.h");


        AddAction("ListenerDirectionZ",
                       _("Direction on Z axis"),
                       _("Change the direction of the listener on Z axis."),
                       _("Do _PARAM1__PARAM2_ to the direction on Z axis of the listener"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .codeExtraInformation.SetFunctionName("SetListenerDirectionZ").SetManipulatedType("number").SetAssociatedGetter("GetListenerDirectionZ").SetIncludeFile("SoundObject/SoundListener.h");


        // Conditions liées à l'écouteur
        AddCondition("ListenerX",
                       _("X position"),
                       _("Test the position of the listener on X axis."),
                       _("The listener X position is _PARAM1__PARAM0_"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))
            .codeExtraInformation.SetFunctionName("GetListenerX").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundListener.h");

        AddCondition("ListenerY",
                       _("Y position"),
                       _("Test the position of the listener on Y axis."),
                       _("The listener Y position is _PARAM1__PARAM0_"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))
            .codeExtraInformation.SetFunctionName("GetListenerY").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundListener.h");

        AddCondition("ListenerZ",
                       _("Z position"),
                       _("Test the position of the listener on Z axis."),
                       _("The listener Z position is _PARAM1__PARAM0_"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))
            .codeExtraInformation.SetFunctionName("GetListenerZ").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundListener.h");

        AddCondition("ListenerDirectionX",
                       _("X direction"),
                       _("Test the direction of the listener on X axis."),
                       _("The listener X direction is _PARAM1__PARAM0_"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))
            .codeExtraInformation.SetFunctionName("GetListenerDirectionX").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundListener.h");

        AddCondition("ListenerDirectionY",
                       _("Y direction"),
                       _("Test the direction of the listener on Y axis."),
                       _("The listener Y direction is _PARAM1__PARAM0_"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))

            .codeExtraInformation.SetFunctionName("GetListenerDirectionY").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundListener.h");




        AddCondition("ListenerDirectionZ",
                       _("Z direction"),
                       _("Test the direction of the listener on Z axis."),
                       _("The listener Z direction is _PARAM1__PARAM0_"),
                       _("Listener"),
                       "res/actions/son24.png",
                       "res/actions/son.png")

            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))

            .codeExtraInformation.SetFunctionName("GetListenerDirectionZ").SetManipulatedType("number").SetIncludeFile("SoundObject/SoundListener.h");




        AddExpression("ListenerX", _("X position"), _("Listener X position"), _("Listener"), "res/actions/son.png")
            .codeExtraInformation.SetFunctionName("GetListenerX").SetIncludeFile("SoundObject/SoundListener.h");


        AddExpression("ListenerY", _("Y position"), _("Listener Y position"), _("Listener"), "res/actions/son.png")
            .codeExtraInformation.SetFunctionName("GetListenerY").SetIncludeFile("SoundObject/SoundListener.h");


        AddExpression("ListenerZ", _("Z position"), _("Listener Z position"), _("Listener"), "res/actions/son.png")
            .codeExtraInformation.SetFunctionName("GetListenerZ").SetIncludeFile("SoundObject/SoundListener.h");


        AddExpression("ListenerDirectionX", _("Direction on X axis"), _("Listener x direction"), _("Listener"), "res/actions/son.png")
            .codeExtraInformation.SetFunctionName("GetListenerDirectionX").SetIncludeFile("SoundObject/SoundListener.h");


        AddExpression("ListenerDirectionY", _("Direction on Y axis"), _("Listener y direction"), _("Listener"), "res/actions/son.png")
            .codeExtraInformation.SetFunctionName("GetListenerDirectionY").SetIncludeFile("SoundObject/SoundListener.h");


        AddExpression("ListenerDirectionZ", _("Direction on Z axis"), _("Listener z direction"), _("Listener"), "res/actions/son.png")
            .codeExtraInformation.SetFunctionName("GetListenerDirectionZ").SetIncludeFile("SoundObject/SoundListener.h");

        #endif

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #26
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("Light",
                              _("Light"),
                              _("Allow to display lights and use light obstacles."),
                              "Florian Rival",
                              "Open source (MIT License)");

        gd::ObjectMetadata & obj = AddObject<LightObject>(
                   "Light",
                   _("Light"),
                   _("Emits light that can be stopped by objects"),
                   "CppPlatform/Extensions/lightIcon32.png");

        AddRuntimeObject<LightObject, RuntimeLightObject>(
            obj, "RuntimeLightObject");

        #if defined(GD_IDE_ONLY)
        LightObject::LoadEdittimeIcon();
        obj.SetIncludeFile("Light/LightObject.h");

        obj.AddAction("ChangeColor",
                       _("Color"),
                       _("Change light color."),
                       _("Change color of _PARAM0_ to _PARAM1_"),
                       _("Setup"),
                       "CppPlatform/Extensions/lightIcon24.png",
                       "CppPlatform/Extensions/lightIcon16.png")
            .AddParameter("object", _("Object"), "Light")
            .AddParameter("color", _("Color"))

            .SetFunctionName("SetColor").SetIncludeFile("Light/LightObject.h");


        obj.AddAction("Intensity",
                       _("Intensity"),
                       _("Modify the intensity of a light"),
                       _("Do _PARAM1__PARAM2_ to the intensity of _PARAM0_"),
                       _("Setup"),
                       "CppPlatform/Extensions/lightIcon24.png",
                       "CppPlatform/Extensions/lightIcon16.png")
            .AddParameter("object", _("Object"), "Light")
            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .SetFunctionName("SetIntensity").SetManipulatedType("number").SetGetter("GetIntensity").SetIncludeFile("Light/LightObject.h");


        obj.AddCondition("Intensity",
                       _("Intensity"),
                       _("Test the intensity of a light."),
                       _("Intensity of _PARAM0_ is _PARAM1__PARAM2_"),
                       _("Setup"),
                       "CppPlatform/Extensions/lightIcon24.png",
                       "CppPlatform/Extensions/lightIcon16.png")
            .AddParameter("object", _("Object"), "Light")
            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))

            .SetFunctionName("GetIntensity").SetManipulatedType("number").SetIncludeFile("Light/LightObject.h");


        obj.AddAction("Radius",
                       _("Radius"),
                       _("Modify the radius of a light"),
                       _("Do _PARAM1__PARAM2_ to radius of _PARAM0_"),
                       _("Setup"),
                       "CppPlatform/Extensions/lightIcon24.png",
                       "CppPlatform/Extensions/lightIcon16.png")
            .AddParameter("object", _("Object"), "Light")
            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .SetFunctionName("SetRadius").SetManipulatedType("number").SetGetter("GetRadius").SetIncludeFile("Light/LightObject.h");


        obj.AddCondition("Radius",
                       _("Radius"),
                       _("Test the radius of a light."),
                       _("The radius of _PARAM0_ is _PARAM2_ _PARAM1_"),
                       _("Setup"),
                       "CppPlatform/Extensions/lightIcon24.png",
                       "CppPlatform/Extensions/lightIcon16.png")
            .AddParameter("object", _("Object"), "Light")
            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))

            .SetFunctionName("GetRadius").SetManipulatedType("number").SetIncludeFile("Light/LightObject.h");


        obj.AddAction("Quality",
                       _("Quality"),
                       _("Modify the quality of a light"),
                       _("Do _PARAM1__PARAM2_ to the quality of _PARAM0_"),
                       _("Setup"),
                       "CppPlatform/Extensions/lightIcon24.png",
                       "CppPlatform/Extensions/lightIcon16.png")
            .AddParameter("object", _("Object"), "Light")
            .AddParameter("operator", _("Modification's sign"))
            .AddParameter("expression", _("Value"))

            .SetFunctionName("SetQuality").SetManipulatedType("number").SetGetter("GetQuality").SetIncludeFile("Light/LightObject.h");


        obj.AddCondition("Quality",
                       _("Quality"),
                       _("Test the quality of a light"),
                       _("The quality of _PARAM0_ is _PARAM1__PARAM2_"),
                       _("Setup"),
                       "CppPlatform/Extensions/lightIcon24.png",
                       "CppPlatform/Extensions/lightIcon16.png")
            .AddParameter("object", _("Object"), "Light")
            .AddParameter("relationalOperator", _("Sign of the test"))
            .AddParameter("expression", _("Value to test"))

            .SetFunctionName("GetQuality").SetManipulatedType("number").SetIncludeFile("Light/LightObject.h");


        obj.AddAction("ChangeGlobalColor",
                       _("Global color"),
                       _("Change scene color for a global light."),
                       _("Change scene global color of _PARAM0_ to _PARAM1_"),
                       _("Setup"),
                       "CppPlatform/Extensions/lightIcon24.png",
                       "CppPlatform/Extensions/lightIcon16.png")
            .AddParameter("object", _("Object"), "Light")
            .AddParameter("color", _("Color"))

            .SetFunctionName("SetGlobalColor").SetIncludeFile("Light/LightObject.h");


        obj.AddAction("SetGlobalLight",
                       _("Make a light global"),
                       _("Make a light global or simple."),
                       _("Make _PARAM0_ global : _PARAM1_"),
                       _("Light type"),
                       "CppPlatform/Extensions/lightIcon24.png",
                       "CppPlatform/Extensions/lightIcon16.png")
            .AddParameter("object", _("Object"), "Light")
            .AddParameter("yesorno", _("Make light global"))

            .SetFunctionName("SetGlobalLight").SetIncludeFile("Light/LightObject.h");


        obj.AddCondition("GlobalLight",
                       _("A light is global"),
                       _("Return true if light is global"),
                       _("_PARAM0_ is a global light"),
                       _("Light type"),
                       "CppPlatform/Extensions/lightIcon24.png",
                       "CppPlatform/Extensions/lightIcon16.png")
            .AddParameter("object", _("Object"), "Light")

            .SetFunctionName("IsGlobalLight").SetIncludeFile("Light/LightObject.h");

        obj.AddExpression("Intensity", _("Intensity"), _("Intensity"), _("Setup"), "CppPlatform/Extensions/lightIcon16.png")
            .AddParameter("object", _("Object"), "Light")
            .SetFunctionName("GetIntensity").SetIncludeFile("Light/LightObject.h");

        obj.AddExpression("Radius", _("Radius"), _("Radius"), _("Setup"), "CppPlatform/Extensions/lightIcon16.png")
            .AddParameter("object", _("Object"), "Light")
            .SetFunctionName("GetRadius").SetIncludeFile("Light/LightObject.h");

        obj.AddExpression("Quality", _("Quality"), _("Quality"), _("Setup"), "CppPlatform/Extensions/lightIcon16.png")
            .AddParameter("object", _("Object"), "Light")
            .SetFunctionName("GetQuality").SetIncludeFile("Light/LightObject.h");
        #endif

        AddBehavior("LightObstacleBehavior",
              _("Light obstacle"),
              _("LightObstacle"),
              _("Mark the objects as obstacles for Light objects."),
              "",
              "CppPlatform/Extensions/lightObstacleIcon32.png",
              "LightObstacleBehavior",
              std::shared_ptr<gd::Behavior>(new LightObstacleBehavior),
              std::shared_ptr<gd::BehaviorsSharedData>(new SceneLightObstacleDatas));

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #27
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("Network",
                              _("Network features"),
                              _("Built-in extension allowing to exchange data on the network between games."),
                              "Florian Rival",
                              "Open source (MIT License)");

        #if defined(GD_IDE_ONLY)

        AddAction("AddRecipient",
                       _("Add a recipient"),
                       _("Add the computer with the corresponding IP Adress as a recipient of sent data."),
                       _("Add _PARAM0_ to recipients"),
                       _("Network: Sending"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("string", _("Recipient IP address."))
            .AddParameter("expression", _("Recipient port (Default : 50001)"), "", true)

            .SetFunctionName("GDpriv::NetworkExtension::AddRecipient").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("RemoveAllRecipients",
                       _("Delete all recipients"),
                       _("Clear the list of the recipients of sent data"),
                       _("Clear the list of recipients"),
                       _("Network: Sending"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::RemoveAllRecipients").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddAction("ListenToPort",
                       _("Initialize data reception"),
                       _("Initialize the network so as to be able te receive data from other computers."),
                       _("Initialize data reception"),
                       _("Network: Reception"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("expression", _("Listening port (Default : 50001)"), "", true).SetDefaultValue("50001")
            .SetFunctionName("GDpriv::NetworkExtension::ListenToPort").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("StopListening",
                       _("Stop data reception"),
                       _("Stop data reception."),
                       _("Stop data reception"),
                       _("Network: Reception"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::ActStopListening").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("SendValue",
                       _("Send a value"),
                       _("Send a value to recipients"),
                       _("Send value _PARAM1_ with title _PARAM0_ to recipients"),
                       _("Network: Sending"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("string", _("Group"))
            .AddParameter("expression", _("Value"))

            .SetFunctionName("GDpriv::NetworkExtension::SendValue").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("SendString",
                       _("Send a text"),
                       _("Send a text to recipients"),
                       _("Send text _PARAM1_ with title _PARAM0_ to recipients"),
                       _("Network: Sending"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("string", _("Group"))
            .AddParameter("string", _("Text"))

            .SetFunctionName("GDpriv::NetworkExtension::SendString").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("ReceivePackets",
                       _("Receive waiting data"),
                       _("Receive data sent by other computers.\nYou can then access to them with the appropriate expressions."),
                       _("Receive data"),
                       _("Network: Reception"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::ReceivePackets").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddAction("ResetReceivedData",
                       _("Delete all received data stored in memory"),
                       _("Delete every received data stored in memory"),
                       _("Delete every received data stored in memory"),
                       _("Network: Reception"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::ResetReceivedData").SetIncludeFile("Network/NetworkManagerFunctions.h");

        AddStrExpression("GetReceivedDataString", _("Get the text of a data"), _("Get the text contained in a data"), _("Network: Reception"), "CppPlatform/Extensions/networkicon.png")
            .AddParameter("string", _("Name of the data containing the text to get"))

            .SetFunctionName("GDpriv::NetworkExtension::GetReceivedDataString").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddExpression("GetReceivedDataValue", _("Get the value of a data"), _("Get the value contained in a data"), _("Network: Reception"), "CppPlatform/Extensions/networkicon.png")
            .AddParameter("string", _("Name of the data containing the text to get"))

            .SetFunctionName("GDpriv::NetworkExtension::GetReceivedDataValue").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddStrExpression("GetLastError", _("Last error occured"), _("Get the text describing the last error which occured."), _("Network: Errors"), "res/error.png")

            .SetFunctionName("GDpriv::NetworkExtension::GetLastError").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddStrExpression("GetPublicAddress", _("IP address"), _("Allow to get the public IP Address of the computer."), _("Network"), "CppPlatform/Extensions/networkicon.png")
            .AddParameter("expression", _("Maximum time to wait before getting the address ( in seconds ) ( 0 = no timeout )"), "", true)

            .SetFunctionName("GDpriv::NetworkExtension::GetPublicAddress").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddStrExpression("GetLocalAddress", _("Local IP address ( local/LAN )"), _("Allow to get the public IP Address of the computer."), _("Network"), "CppPlatform/Extensions/networkicon.png")

            .SetFunctionName("GDpriv::NetworkExtension::GetLocalAddress").SetIncludeFile("Network/NetworkManagerFunctions.h");


        AddAction("GenerateObjectNetworkId",
                       _("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 unique network identifiers for _PARAM0_"),
                       _("Automatism Automatic Network Updater"),
                       "CppPlatform/Extensions/networkicon24.png",
                       "CppPlatform/Extensions/networkicon.png")

            .AddParameter("objectList", _("Object"))
            .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
            .SetFunctionName("NetworkAutomatism::GenerateObjectNetworkIdentifier").SetIncludeFile("Network/NetworkAutomatism.h");

        #endif

        {
            gd::AutomatismMetadata & aut = AddAutomatism("NetworkAutomatism",
                  _("Automatic network update"),
                  _("NetworkUpdater"),
                  _("Allows to automatically synchronize the objects of a game on the network."),
                  "",
                  "CppPlatform/Extensions/networkicon32.png",
                  "NetworkAutomatism",
                  std::shared_ptr<gd::Automatism>(new NetworkAutomatism),
                  std::shared_ptr<gd::AutomatismsSharedData>(new SceneNetworkDatas));

            #if defined(GD_IDE_ONLY)
            aut.SetIncludeFile("Network/NetworkAutomatism.h");

            aut.AddAction("SetAsSender",
                           _("Set to send data"),
                           _("The automatism will send the data of the objects.\nBe sure to have generated identifiers for these objects before."),
                           _("Set _PARAM0_ to send data"),
                           _("Automatism Automatic Network Updater"),
                           "CppPlatform/Extensions/networkicon24.png",
                           "CppPlatform/Extensions/networkicon.png")
                .AddParameter("object", _("Object"))
                .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
                .SetFunctionName("SetAsSender").SetIncludeFile("Network/NetworkAutomatism.h");

            aut.AddAction("SetAsReceiver",
                           _("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."),
                           _("Set _PARAM0_ to receive data"),
                           _("Automatism Automatic Network Updater"),
                           "CppPlatform/Extensions/networkicon24.png",
                           "CppPlatform/Extensions/networkicon.png")
                .AddParameter("object", _("Object"))
                .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
                .SetFunctionName("SetAsReceiver").SetIncludeFile("Network/NetworkAutomatism.h");

            aut.AddAction("SetIdentifier",
                           _("Change object's identifier"),
                           _("Each object need a unique identifier, the same on all computers, so as to be identified and updated"),
                           _("Set identifier of _PARAM0_ to _PARAM2_"),
                           _("Automatism Automatic Network Updater"),
                           "CppPlatform/Extensions/networkicon24.png",
                           "CppPlatform/Extensions/networkicon.png")
                .AddParameter("object", _("Object"))
                .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
                .AddParameter("expression", _("Identifier"))
                .SetFunctionName("SetIdentifier").SetIncludeFile("Network/NetworkAutomatism.h");

            aut.AddExpression("GetIdentifier", _("Get the identifier of the object"), _("Get the identifier of the object"), _("Automatism Automatic Network Updater"), "res/texteicon.png")
                .AddParameter("object", _("Object"))
                .AddParameter("automatism", _("Automatism"), "NetworkAutomatism", false)
                .SetFunctionName("GetIdentifier").SetIncludeFile("Network/NetworkAutomatism.h");
            #endif
        }

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #28
0
    /**
     * Constructor of an extension declares everything the extension contains : Objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("TimedEvent",
                              _("Timed events"),
                              _("Event which launch its conditions and actions only after a amount of time is reached."),
                              "Florian Rival",
                              "zlib/libpng License (Open Source)");

        #if defined(GD_IDE_ONLY)

        {
            class CodeGen : public gd::EventMetadata::CodeGenerator
            {
                virtual std::string Generate(gd::BaseEvent & event_, gd::EventsCodeGenerator & codeGenerator,
                                             gd::EventsCodeGenerationContext & context)
                {
                    TimedEvent & event = dynamic_cast<TimedEvent&>(event_);
                    const gd::Layout & scene = codeGenerator.GetLayout();

                    codeGenerator.AddIncludeFile("TimedEvent/TimedEventTools.h");

                    //Notify parent timed event that they have a child
                    for (unsigned int i = 0;i<TimedEvent::codeGenerationCurrentParents.size();++i)
                        TimedEvent::codeGenerationCurrentParents[i]->codeGenerationChildren.push_back(&event);

                    //And register this event as potential parent
                    TimedEvent::codeGenerationCurrentParents.push_back(&event);
                    event.codeGenerationChildren.clear();

                    //Prepare code for computing timeout
                    std::string timeOutCode;
                    gd::CallbacksForGeneratingExpressionCode callbacks(timeOutCode, codeGenerator, context);
                    gd::ExpressionParser parser(event.GetTimeoutExpression());
                    if (!parser.ParseMathExpression(codeGenerator.GetPlatform(), codeGenerator.GetProject(), scene, callbacks) || timeOutCode.empty()) timeOutCode = "0";

                    //Prepare name
                    std::string codeName = !event.GetName().empty() ? "GDNamedTimedEvent_"+codeGenerator.ConvertToString(event.GetName()) : "GDTimedEvent_"+ToString(&event);

                    std::string outputCode;

                    outputCode += "if ( static_cast<double>(GDpriv::TimedEvents::UpdateAndGetTimeOf(*runtimeContext->scene, \""+codeName+"\"))/1000000.0 > "+timeOutCode+")";
                    outputCode += "{";

                    outputCode += codeGenerator.GenerateConditionsListCode(event.GetConditions(), context);

                    std::string ifPredicat;
                    for (unsigned int i = 0;i<event.GetConditions().size();++i)
                    {
                        if (i!=0) ifPredicat += " && ";
                        ifPredicat += "condition"+ToString(i)+"IsTrue";
                    }

                    if ( !ifPredicat.empty() ) outputCode += "if (" +ifPredicat+ ")\n";
                    outputCode += "{\n";
                    outputCode += codeGenerator.GenerateActionsListCode(event.GetActions(), context);
                    if ( event.HasSubEvents() ) //Sub events
                    {
                        outputCode += "\n{\n";
                        outputCode += codeGenerator.GenerateEventsListCode(event.GetSubEvents(), context);
                        outputCode += "}\n";
                    }

                    outputCode += "}\n";

                    outputCode += "}";

                    //This event cannot be a parent of other TimedEvent anymore
                    if (!TimedEvent::codeGenerationCurrentParents.empty())
                        TimedEvent::codeGenerationCurrentParents.pop_back();
                    else
                        std::cout << "Error! CodeGenerationCurrentParents cannot be empty!";

                    return outputCode;
                }
            };
            gd::EventMetadata::CodeGenerator * codeGen = new CodeGen;

            AddEvent("TimedEvent",
                          _("Timed event"),
                          _("Event which launch its conditions and actions only after a amount of time is reached."),
                          "",
                          "CppPlatform/Extensions/timedevent16.png",
                          boost::shared_ptr<gd::BaseEvent>(new TimedEvent))
                .SetCodeGenerator(boost::shared_ptr<gd::EventMetadata::CodeGenerator>(codeGen));
        }

        {
            class CodeGenerator : public gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator
            {
                virtual std::string GenerateCode(gd::Instruction & instruction, gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context)
                {
                    codeGenerator.AddIncludeFile("TimedEvent/TimedEventTools.h");

                    std::string codeName = "GDNamedTimedEvent_"+codeGenerator.ConvertToString(instruction.GetParameter(1).GetPlainString());
                    return "GDpriv::TimedEvents::Reset(*runtimeContext->scene, \""+codeName+"\");\n";

                    return "";
                };
            };
            gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator * codeGenerator = new CodeGenerator; //Need for code to compile

            AddAction("ResetTimedEvent",
                           _("Reset a timed event"),
                           _("Reset a timed event"),
                           _("Reset the timed event(s) called _PARAM1_"),
                           _("Timed events"),
                           "CppPlatform/Extensions/timedevent24.png",
                           "CppPlatform/Extensions/timedevent16.png")
                .AddCodeOnlyParameter("currentScene", "")
                .AddParameter("", _("Name"))
                .codeExtraInformation.SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>(codeGenerator));
        }

        {
            class CodeGenerator : public gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator
            {
                virtual std::string GenerateCode(gd::Instruction & instruction, gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context)
                {
                    codeGenerator.AddIncludeFile("TimedEvent/TimedEventTools.h");

                    for (unsigned int i = 0;i<TimedEvent::codeGenerationCurrentParents.size();++i)
                    {
                        if ( TimedEvent::codeGenerationCurrentParents[i] == NULL )
                        {
                            std::cout << "WARNING : NULL timed event in codeGenerationCurrentParents";
                            continue;
                        }

                        if (TimedEvent::codeGenerationCurrentParents[i]->GetName() == instruction.GetParameter(0).GetPlainString())
                        {
                            TimedEvent & timedEvent = *TimedEvent::codeGenerationCurrentParents[i];

                            std::string code;
                            {
                                std::string codeName = !timedEvent.GetName().empty() ? "GDNamedTimedEvent_"+codeGenerator.ConvertToString(timedEvent.GetName()) : "GDTimedEvent_"+ToString(&timedEvent);
                                code += "GDpriv::TimedEvents::Reset(*runtimeContext->scene, \""+codeName+"\");\n";
                            }
                            for (unsigned int j = 0;j<timedEvent.codeGenerationChildren.size();++j)
                            {
                                std::string codeName = !timedEvent.codeGenerationChildren[j]->GetName().empty() ? "GDNamedTimedEvent_"+codeGenerator.ConvertToString(timedEvent.codeGenerationChildren[j]->GetName()) : "GDTimedEvent_"+ToString(timedEvent.codeGenerationChildren[j]);
                                code += "GDpriv::TimedEvents::Reset(*runtimeContext->scene, \""+codeName+"\");\n";
                            }
                            return code;
                        }
                    }

                    return "";
                };
            };
            gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator * codeGenerator = new CodeGenerator; //Need for code to compile

            AddAction("ResetTimedEventAndSubs",
                           _("Reset a timed event and sub events"),
                           _("Reset a timed events, as well as all of its sub events."),
                           _("Reset timed events called _PARAM1_ and their sub events"),
                           _("Timed events"),
                           "CppPlatform/Extensions/timedevent24.png",
                           "CppPlatform/Extensions/timedevent16.png")

                .AddParameter("", _("Name"))
                .codeExtraInformation.SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>(codeGenerator))
                .SetIncludeFile("TimedEvent/TimedEventTools.h");
        }
        #endif

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #29
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("Function",
                              _("Function events"),
                              _("Extension allowing to use events behaving as functions."),
                              "Florian Rival",
                              "Open source (MIT License)");

        #if defined(GD_IDE_ONLY)

        AddAction("LaunchFunction",
            _("Launch a function"),
            _("Launch a function"),
            _("Launch _PARAM0_ (_PARAM1_, _PARAM2_, _PARAM3_, _PARAM4_, _PARAM5_, _PARAM6_, _PARAM7_)"),
            _("Functions"),
            "res/actions/function24.png",
            "res/actions/function.png")
            .AddParameter("", _("Name of the function"))
            .AddParameter("string", _("Parameter 1"), "", true)
            .AddParameter("string", _("Parameter 2"), "", true)
            .AddParameter("string", _("Parameter 3"), "", true)
            .AddParameter("string", _("Parameter 4"), "", true)
            .AddParameter("string", _("Parameter 5"), "", true)
            .AddParameter("string", _("Parameter 6"), "", true)
            .AddParameter("string", _("Parameter 7"), "", true)
            .codeExtraInformation.SetCustomCodeGenerator([](gd::Instruction & instruction, gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context) {
                gd::String functionName = instruction.GetParameter(0).GetPlainString();
                const gd::Project & project = codeGenerator.GetProject();
                const gd::Layout & layout = codeGenerator.GetLayout();

                const FunctionEvent * functionEvent = FunctionEvent::SearchForFunctionInEvents(project, layout.GetEvents(), functionName);
                if ( !functionEvent )
                {
                    std::cout << "Function \""+functionName+"\" not found!" << std::endl;
                    return "//Function \""+functionName+"\" not found.\n";
                }

                codeGenerator.AddGlobalDeclaration("void "+FunctionEvent::MangleFunctionName(layout, *functionEvent)+"(RuntimeContext *, std::map <gd::String, std::vector<RuntimeObject*> *>, std::vector<gd::String> &);\n");
                gd::String code;

                //Generate code for objects passed as arguments
                gd::String objectsAsArgumentCode;
                {
                    objectsAsArgumentCode += "runtimeContext->ClearObjectListsMap()";
                    std::vector<gd::String> realObjects = codeGenerator.ExpandObjectsName(functionEvent->GetObjectsPassedAsArgument(), context);
                    for (std::size_t i = 0;i<realObjects.size();++i)
                    {
                        context.EmptyObjectsListNeeded(realObjects[i]);
                        objectsAsArgumentCode += ".AddObjectListToMap(\""+codeGenerator.ConvertToString(realObjects[i])+"\", "+ManObjListName(realObjects[i])+")";
                    }
                    objectsAsArgumentCode += ".ReturnObjectListsMap()";
                }

                //Generate code for evaluating parameters
                code += "std::vector<gd::String> functionParameters;\n";
                for (std::size_t i = 1;i<8;++i)
                {
                    gd::String parameterCode;
                    gd::CallbacksForGeneratingExpressionCode callbacks(parameterCode, codeGenerator, context);
                    gd::ExpressionParser parser(instruction.GetParameter(i).GetPlainString());
                    parser.ParseStringExpression(CppPlatform::Get(), project, layout, callbacks);
                    if (parameterCode.empty()) parameterCode = "\"\"";

                    code += "functionParameters.push_back("+parameterCode+");\n";
                }

                code += FunctionEvent::MangleFunctionName(layout, *functionEvent)+"(runtimeContext, "+objectsAsArgumentCode+", functionParameters);\n";
                return code;
            });

        AddEvent("Function",
            _("Function"),
            _("Function event : An event which is launched only thanks to action \"Launch a function\""),
            "",
            "res/function.png",
            std::shared_ptr<gd::BaseEvent>(new FunctionEvent))
            .SetCodeGenerator([](gd::BaseEvent & event_, gd::EventsCodeGenerator & codeGenerator,
                gd::EventsCodeGenerationContext & /* The function has nothing to do with the current context */){
                FunctionEvent & event = dynamic_cast<FunctionEvent&>(event_);
                const gd::Layout & layout = codeGenerator.GetLayout();

                //Declaring function prototype.
                codeGenerator.AddGlobalDeclaration("void "+FunctionEvent::MangleFunctionName(layout, event)+"(RuntimeContext *, std::map <gd::String, std::vector<RuntimeObject*> *>, std::vector<gd::String> &);\n");

                //Generating function code:
                gd::String functionCode;
                functionCode += "\nvoid "+FunctionEvent::MangleFunctionName(layout, event)+"(RuntimeContext * runtimeContext, std::map <gd::String, std::vector<RuntimeObject*> *> objectsListsMap, std::vector<gd::String> & currentFunctionParameters)\n{\n";

                gd::EventsCodeGenerationContext callerContext;
                {
                    std::vector<gd::String> realObjects = codeGenerator.ExpandObjectsName(event.GetObjectsPassedAsArgument(), callerContext);
                    for (std::size_t i = 0;i<realObjects.size();++i)
                    {
                        callerContext.EmptyObjectsListNeeded(realObjects[i]);
                        functionCode += "std::vector<RuntimeObject*> "+ManObjListName(realObjects[i]) + ";\n";
                        functionCode += "if ( objectsListsMap[\""+realObjects[i]+"\"] != NULL ) "+ManObjListName(realObjects[i])+" = *objectsListsMap[\""+realObjects[i]+"\"];\n";
                    }
                }
                functionCode += "{";

                gd::EventsCodeGenerationContext context;
                context.InheritsFrom(callerContext);

                //Generating function body code
                gd::String conditionsCode = codeGenerator.GenerateConditionsListCode(event.GetConditions(), context);
                gd::String actionsCode = codeGenerator.GenerateActionsListCode(event.GetActions(), context);
                gd::String subeventsCode = codeGenerator.GenerateEventsListCode(event.GetSubEvents(), context);

                functionCode += codeGenerator.GenerateObjectsDeclarationCode(context);
                gd::String ifPredicat = "true";
                for (std::size_t i = 0;i<event.GetConditions().size();++i)
                    ifPredicat += " && condition"+gd::String::From(i)+"IsTrue";

                functionCode += conditionsCode;
                functionCode += "if (" +ifPredicat+ ")\n";
                functionCode += "{\n";
                functionCode += actionsCode;
                if ( event.HasSubEvents() ) //Sub events
                {
                    functionCode += "\n{\n";
                    functionCode += subeventsCode;
                    functionCode += "}\n";
                }
                functionCode += "}\n";

                functionCode += "}\n"; //Context end
                functionCode += "}\n"; //Function end
                codeGenerator.AddCustomCodeOutsideMain(functionCode);

                return "";
            });

        AddStrExpression("Parameter",
            _("Parameter of the current function"),
            _("Return the text contained in a parameter of the currently launched function"),
            _("Function"),
            "res/function.png")
            .AddParameter("expression", _("Index of the parameter (Parameters start at 0!)"))
            .codeExtraInformation.SetCustomCodeGenerator([](const std::vector<gd::Expression> & parameters, gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context) {
                codeGenerator.AddIncludeFile("Function/FunctionTools.h");
                const gd::Project & game = codeGenerator.GetProject();
                const gd::Layout & scene = codeGenerator.GetLayout();

                //Ensure currentFunctionParameters vector is always existing.
                gd::String mainFakeParameters = "std::vector<gd::String> currentFunctionParameters;\n";
                if (codeGenerator.GetCustomCodeInMain().find(mainFakeParameters) == gd::String::npos)
                    codeGenerator.AddCustomCodeInMain(mainFakeParameters);

                //Generate code for evaluating index
                gd::String expression;
                gd::CallbacksForGeneratingExpressionCode callbacks(expression, codeGenerator, context);
                gd::ExpressionParser parser(parameters[0].GetPlainString());
                if (!parser.ParseMathExpression(codeGenerator.GetPlatform(), game, scene, callbacks) || expression.empty()) expression = "0";

                gd::String code;

                code += "GDpriv::FunctionTools::GetSafelyStringFromVector(currentFunctionParameters, "+expression+")";

                return code;
            });
        #endif

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };
Пример #30
0
    /**
     * Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    Extension()
    {
        SetExtensionInformation("PathfindingBehavior",
                              _("Pathfinding behavior"),
                              _("Compute paths for objects avoiding obstacles."),
                              "Florian Rival",
                              "Open source (MIT License)");

        {
            gd::BehaviorMetadata & aut = AddBehavior("PathfindingBehavior",
                  _("Pathfinding"),
                  "Pathfinding",
                  _("Behavior which move objects and avoid objects flagged as obstacles."),
                  "",
                  "CppPlatform/Extensions/AStaricon.png",
                  "PathfindingBehavior",
                  std::shared_ptr<gd::Behavior>(new PathfindingBehavior),
                  std::shared_ptr<gd::BehaviorsSharedData>(new gd::BehaviorsSharedData));

            #if defined(GD_IDE_ONLY)

            aut.SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddAction("SetDestination",
                           _("Move to a position"),
                           _("Move the object to a position"),
                           _("Move _PARAM0_ to _PARAM3_;_PARAM4_"),
                           _(""),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddCodeOnlyParameter("currentScene", "")

                .AddParameter("expression", _("Destination X position"))
                .AddParameter("expression", _("Destination Y position"))
                .SetFunctionName("MoveTo").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddCondition("PathFound",
                           _("Path found"),
                           _("Return true if a path has been found."),
                           _("A path has been found for _PARAM0_"),
                           _(""),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("PathFound").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddCondition("DestinationReached",
                           _("Destination reached"),
                           _("Return true if destination was reached."),
                           _("_PARAM0_ reached its destination"),
                           _(""),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("DestinationReached").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddAction("CellWidth",
                           _("Width of the cells"),
                           _("Change the width of the cells of the virtual grid."),
                           _("Do _PARAM2__PARAM3_ to the width of the virtual cells of _PARAM0_"),
                           _("Virtual grid"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Width (pixels)"))
                .SetFunctionName("SetCellWidth").SetGetter("GetCellWidth").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddCondition("CellWidth",
                           _("Width of the virtual grid"),
                           _("Compare the width of the cells of the virtual grid."),
                           _("Width of the virtual cells of _PARAM0_ is _PARAM2__PARAM3_"),
                           _("Virtual grid"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Width (pixels)"))
                .SetFunctionName("GetCellWidth").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddAction("CellHeight",
                           _("Height of the cells"),
                           _("Change the height of the cells of the virtual grid."),
                           _("Do _PARAM2__PARAM3_ to the height of the virtual cells of _PARAM0_"),
                           _("Virtual grid"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Height (pixels)"))
                .SetFunctionName("SetCellHeight").SetGetter("GetCellHeight").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddCondition("CellHeight",
                           _("Height of the virtual grid"),
                           _("Compare the height of the cells of the virtual grid."),
                           _("Height of the virtual cells of _PARAM0_ is _PARAM2__PARAM3_"),
                           _("Virtual grid"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Height (pixels)"))
                .SetFunctionName("GetCellHeight").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddAction("Acceleration",
                           _("Acceleration"),
                           _("Change the acceleration when moving the object"),
                           _("Do _PARAM2__PARAM3_ to the acceleration of _PARAM0_ on the path"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))
                .SetFunctionName("SetAcceleration").SetGetter("GetAcceleration").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddCondition("Acceleration",
                           _("Acceleration"),
                           _("Compare the acceleration when moving the object"),
                           _("Acceleration of _PARAM0_ is _PARAM2__PARAM3_"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value"))
                .SetFunctionName("GetAcceleration").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddAction("MaxSpeed",
                           _("Maximum speed"),
                           _("Change the maximum speed when moving the object"),
                           _("Do _PARAM2__PARAM3_ to the max. speed of _PARAM0_ on the path"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))
                .SetFunctionName("SetMaxSpeed").SetGetter("GetMaxSpeed").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddCondition("MaxSpeed",
                           _("Maximum speed"),
                           _("Compare the maximum speed when moving the object"),
                           _("Max. speed of _PARAM0_ is _PARAM2__PARAM3_"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value"))
                .SetFunctionName("GetMaxSpeed").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddAction("Speed",
                           _("Speed"),
                           _("Change the speed of the object on the path"),
                           _("Do _PARAM2__PARAM3_ to the speed of _PARAM0_ on the path"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))
                .SetFunctionName("SetSpeed").SetGetter("GetSpeed").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddCondition("Speed",
                           _("Speed"),
                           _("Compare the speed of the object on the path"),
                           _("Speed of _PARAM0_ is _PARAM2__PARAM3_"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value"))
                .SetFunctionName("GetSpeed").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddAction("AngularMaxSpeed",
                           _("Angular maximum speed"),
                           _("Change the maximum angular speed when moving the object"),
                           _("Do _PARAM2__PARAM3_ to the max. angular speed of _PARAM0_ on the path"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))
                .SetFunctionName("SetAngularMaxSpeed").SetGetter("GetAngularMaxSpeed").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddCondition("AngularMaxSpeed",
                           _("Angular maximum speed"),
                           _("Compare the maximum angular speed when moving the object"),
                           _("Max. angular speed of _PARAM0_ is _PARAM2__PARAM3_"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value"))
                .SetFunctionName("GetAngularMaxSpeed").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddAction("AngleOffset",
                           _("Rotation offset"),
                           _("Change the rotation offset applied when moving the object"),
                           _("Do _PARAM2__PARAM3_ to the rotation offset of _PARAM0_ on the path"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value"))
                .SetFunctionName("SetAngleOffset").SetGetter("GetAngleOffset").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddCondition("AngleOffset",
                           _("Rotation offset"),
                           _("Compare the rotation offset when moving the object"),
                           _("Rotation offset of _PARAM0_ is _PARAM2__PARAM3_"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value"))
                .SetFunctionName("GetAngleOffset").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddAction("ExtraBorder",
                           _("Extra border"),
                           _("Change the size of the extra border applied to the object when planning a path"),
                           _("Do _PARAM2__PARAM3_ to the extra border of _PARAM0_ on the path"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Value (in pixels)"))
                .SetFunctionName("SetExtraBorder").SetGetter("GetExtraBorder").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddCondition("ExtraBorder",
                           _("Extra border"),
                           _("Compare the size of the extra border applied to the object when planning a path"),
                           _("Size of the extra border applied to _PARAM0_ is _PARAM2__PARAM3_"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Value (in pixels)"))
                .SetFunctionName("GetExtraBorder").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddAction("AllowDiagonals",
                           _("Diagonals moves"),
                           _("Allow or restrict diagonal moves on the path"),
                           _("Allow diagonal moves for _PARAM0_ on the path: _PARAM2_"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("yesorno", _("Allow?"))
                .SetFunctionName("SetAllowDiagonals").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddCondition("DiagonalsAllowed",
                           _("Diagonals moves"),
                           _("Return true if the object is allowed to do diagonal moves on the path"),
                           _("Diagonal moves allowed for _PARAM0_"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("DiagonalsAllowed").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddAction("RotateObject",
                           _("Rotate the object"),
                           _("Enable or disable rotation of the object on the path"),
                           _("Enable rotation of _PARAM0_ on the path: _PARAM2_"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("yesorno", _("Rotate object?"))
                .SetFunctionName("SetRotateObject").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");


            aut.AddCondition("ObjectRotated",
                           _("Object rotated"),
                           _("Return true if the object is rotated when traveling on its path."),
                           _("_PARAM0_ is rotated when traveling on its path"),
                           _("Path"),
                           "CppPlatform/Extensions/AStaricon24.png",
                           "CppPlatform/Extensions/AStaricon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("IsObjectRotated").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("GetNodeX", _("Get a waypoint X position"), _("Get next waypoint X position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("expression", _("Node index (start at 0!)"))
                .SetFunctionName("GetNodeX").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("GetNodeY", _("Get a waypoint Y position"), _("Get next waypoint Y position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .AddParameter("expression", _("Node index (start at 0!)"))
                .SetFunctionName("GetNodeY").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("NextNodeIndex", _("Index of the next waypoint"), _("Get the index of the next waypoint to reach"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetNextNodeIndex").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("NodeCount", _("Waypoint count"), _("Get the number of waypoints on the path"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetNodeCount").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("NextNodeX", _("Get next waypoint X position"), _("Get next waypoint X position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetNextNodeX").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("NextNodeY", _("Get next waypoint Y position"), _("Get next waypoint Y position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetNextNodeY").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("LastNodeX", _("Last waypoint X position"), _("Last waypoint X position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetLastNodeX").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("LastNodeY", _("Last waypoint Y position"), _("Last waypoint Y position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetLastNodeY").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("DestinationX", _("Destination X position"), _("Destination X position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetDestinationX").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("DestinationY", _("Destination Y position"), _("Destination Y position"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetDestinationY").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("Acceleration", _("Acceleration"), _("Acceleration of the object on the path"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetAcceleration").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("MaxSpeed", _("Maximum speed"), _("Maximum speed of the object on the path"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetMaxSpeed").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("Speed", _("Speed"), _("Speed of the object on the path"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetSpeed").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("AngularMaxSpeed", _("Angular maximum speed"), _("Angular maximum speed of the object on the path"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetAngularMaxSpeed").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("AngleOffset", _("Rotation offset"), _("Rotation offset applied the object on the path"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetAngleOffset").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("ExtraBorder", _("Extra border size"), _("Extra border applied the object on the path"), _("Path"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetExtraBorder").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("CellWidth", _("Width of a cell"), _("Width of the virtual grid"), _("Virtual grid"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetCellWidth").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            aut.AddExpression("CellHeight", _("Height of a cell"), _("Height of the virtual grid"), _("Virtual grid"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
                .SetFunctionName("GetCellHeight").SetIncludeFile("PathfindingBehavior/PathfindingBehavior.h");

            #endif

        }
        {
            gd::BehaviorMetadata & aut = AddBehavior("PathfindingObstacleBehavior",
                  _("Obstacle for pathfinding"),
                  "PathfindingObstacle",
                  _("Flag the object as being an obstacle for pathfinding."),
                  "",
                  "CppPlatform/Extensions/pathfindingobstacleicon.png",
                  "PathfindingObstacleBehavior",
                  std::shared_ptr<gd::Behavior>(new PathfindingObstacleBehavior),
                  std::shared_ptr<gd::BehaviorsSharedData>(new gd::BehaviorsSharedData));

            #if defined(GD_IDE_ONLY)
            aut.SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h");

            aut.AddAction("Cost",
                           _("Cost"),
                           _("Change the cost of going through the object."),
                           _("Do _PARAM2__PARAM3_ to the cost of _PARAM0_"),
                           _("Obstacles"),
                           "CppPlatform/Extensions/pathfindingobstacleicon24.png",
                           "CppPlatform/Extensions/pathfindingobstacleicon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior")
                .AddParameter("operator", _("Modification's sign"))
                .AddParameter("expression", _("Difficulty"))
                .SetFunctionName("SetCost").SetGetter("GetCost").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h");


            aut.AddCondition("Cost",
                           _("Cost"),
                           _("Compare the cost of going through the object"),
                           _("Cost of _PARAM0_ is _PARAM2__PARAM3_"),
                           _("Obstacles"),
                           "CppPlatform/Extensions/pathfindingobstacleicon24.png",
                           "CppPlatform/Extensions/pathfindingobstacleicon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior")
                .AddParameter("relationalOperator", _("Sign of the test"))
                .AddParameter("expression", _("Difficulty"))
                .SetFunctionName("GetCost").SetManipulatedType("number").SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h");


            aut.AddAction("SetImpassable",
                           _("Set impassable"),
                           _("Set the object as being an impassable obstacle or not"),
                           _("Set _PARAM0_ as an impassable obstacle: _PARAM2_"),
                           _("Obstacles"),
                           "CppPlatform/Extensions/pathfindingobstacleicon24.png",
                           "CppPlatform/Extensions/pathfindingobstacleicon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior")
                .AddParameter("yesorno", _("Impassable?"))
                .SetFunctionName("SetImpassable").SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h");


            aut.AddCondition("IsImpassable",
                           _("Is impassable"),
                           _("Return true if the obstacle is impassable"),
                           _("_PARAM0_ is impassable"),
                           _("Obstacles"),
                           "CppPlatform/Extensions/pathfindingobstacleicon24.png",
                           "CppPlatform/Extensions/pathfindingobstacleicon16.png")

                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior")
                .SetFunctionName("IsImpassable").SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h");

            aut.AddExpression("Cost", _("Cost"), _("Obstacle cost"), _("Obstacles"), "CppPlatform/Extensions/AStaricon16.png")
                .AddParameter("object", _("Object"))
                .AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior")
                .SetFunctionName("GetCost").SetIncludeFile("PathfindingBehavior/PathfindingObstacleBehavior.h");

            #endif
        }

        GD_COMPLETE_EXTENSION_COMPILATION_INFORMATION();
    };