Exemplo n.º 1
0
MouseExtension::MouseExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsMouseExtension(*this);

    #if defined(GD_IDE_ONLY)
    GetAllActions()["CentreSourisX"].SetFunctionName("CenterCursorHorizontally").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");
    GetAllActions()["CentreSourisY"].SetFunctionName("CenterCursorVertically").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");
    GetAllActions()["CacheSouris"].SetFunctionName("HideCursor").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");
    GetAllActions()["MontreSouris"].SetFunctionName("ShowCursor").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");
    GetAllActions()["SetSourisXY"].SetFunctionName("SetCursorPosition").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");
    GetAllActions()["CentreSouris"].SetFunctionName("CenterCursor").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");

    GetAllConditions()["SourisX"].SetFunctionName("GetCursorXPosition").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");
    GetAllConditions()["SourisY"].SetFunctionName("GetCursorYPosition").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");
    GetAllConditions()["SourisBouton"].SetFunctionName("MouseButtonPressed").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");
    GetAllConditions()["MouseButtonReleased"].SetFunctionName("MouseButtonReleased").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");

    GetAllConditions()["SourisSurObjet"].SetFunctionName("CursorOnObject").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");

    GetAllExpressions()["MouseX"].SetFunctionName("GetCursorXPosition").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");
    GetAllExpressions()["SourisX"].SetFunctionName("GetCursorXPosition").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");
    GetAllExpressions()["MouseY"].SetFunctionName("GetCursorYPosition").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");
    GetAllExpressions()["SourisY"].SetFunctionName("GetCursorYPosition").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");
    GetAllExpressions()["MouseWheelDelta"].SetFunctionName("GetMouseWheelDelta").SetIncludeFile("GDCpp/Extensions/Builtin/MouseTools.h");

    StripUnimplementedInstructionsAndExpressions(); //Touch support is not implemented
    #endif
}
Exemplo n.º 2
0
SceneExtension::SceneExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsSceneExtension(*this);

    #if defined(GD_IDE_ONLY)
    GetAllExpressions()["Random"].SetFunctionName("GDpriv::CommonInstructions::Random").SetIncludeFile("GDCpp/BuiltinExtensions/CommonInstructionsTools.h");
    GetAllStrExpressions()["CurrentSceneName"].SetFunctionName("GetSceneName").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");
    GetAllConditions()["DepartScene"].SetFunctionName("SceneJustBegins").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");
    GetAllActions()["Scene"].SetFunctionName("ChangeScene").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");
    GetAllActions()["Quit"].SetFunctionName("StopGame").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");
    GetAllActions()["SceneBackground"].SetFunctionName("ChangeSceneBackground").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");
    GetAllActions()["DisableInputWhenFocusIsLost"].SetFunctionName("DisableInputWhenFocusIsLost").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");

    {
        class CodeGenerator : public gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator
        {
            virtual std::string GenerateCode(gd::Instruction & instruction, gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context)
            {
                std::string value1Code;
                {
                    gd::CallbacksForGeneratingExpressionCode callbacks(value1Code, codeGenerator, context);
                    gd::ExpressionParser parser(instruction.GetParameters()[0].GetPlainString());
                    if (!parser.ParseMathExpression(codeGenerator.GetPlatform(), codeGenerator.GetProject(), codeGenerator.GetLayout(), callbacks) || value1Code.empty()) value1Code = "0";
                }

                std::string value2Code;
                {
                    gd::CallbacksForGeneratingExpressionCode callbacks(value2Code, codeGenerator, context);
                    gd::ExpressionParser parser(instruction.GetParameters()[2].GetPlainString());
                    if (!parser.ParseMathExpression(codeGenerator.GetPlatform(), codeGenerator.GetProject(), codeGenerator.GetLayout(), callbacks) || value2Code.empty()) value2Code = "0";
                }

                if ( instruction.GetParameters()[1].GetPlainString() == "=" || instruction.GetParameters()[1].GetPlainString().empty() )
                    return "conditionTrue = ("+value1Code+" == "+value2Code+");\n";
                else if ( instruction.GetParameters()[1].GetPlainString() == ">")
                    return "conditionTrue = ("+value1Code+" > "+value2Code+");\n";
                else if ( instruction.GetParameters()[1].GetPlainString() == "<")
                    return "conditionTrue = ("+value1Code+" < "+value2Code+");\n";
                else if ( instruction.GetParameters()[1].GetPlainString() == "<=")
                    return "conditionTrue = ("+value1Code+" <= "+value2Code+");\n";
                else if ( instruction.GetParameters()[1].GetPlainString() == ">=")
                    return "conditionTrue = ("+value1Code+" >= "+value2Code+");\n";
                else if ( instruction.GetParameters()[1].GetPlainString() == "!=")
                    return "conditionTrue = ("+value1Code+" != "+value2Code+");\n";

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

        GetAllConditions()["Egal"].codeExtraInformation.SetCustomCodeGenerator(std::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>(codeGenerator));
    }
    #endif
}
Exemplo n.º 3
0
KeyboardExtension::KeyboardExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsKeyboardExtension(*this);

    #if defined(GD_IDE_ONLY)
    GetAllConditions()["KeyPressed"].SetFunctionName("IsKeyPressed").SetIncludeFile("GDCpp/BuiltinExtensions/KeyboardTools.h");
    GetAllConditions()["KeyReleased"].SetFunctionName("WasKeyReleased").SetIncludeFile("GDCpp/BuiltinExtensions/KeyboardTools.h");
    GetAllConditions()["KeyFromTextPressed"].SetFunctionName("IsKeyPressed").SetIncludeFile("GDCpp/BuiltinExtensions/KeyboardTools.h");
    GetAllConditions()["KeyFromTextReleased"].SetFunctionName("WasKeyReleased").SetIncludeFile("GDCpp/BuiltinExtensions/KeyboardTools.h");
    GetAllConditions()["AnyKeyPressed"].SetFunctionName("AnyKeyIsPressed").SetIncludeFile("GDCpp/BuiltinExtensions/KeyboardTools.h");
    GetAllStrExpressions()["LastPressedKey"].SetFunctionName("LastPressedKey").SetIncludeFile("GDCpp/BuiltinExtensions/KeyboardTools.h");
    #endif
}
Exemplo n.º 4
0
VariablesExtension::VariablesExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsVariablesExtension(*this);

    #if defined(GD_IDE_ONLY)
    GetAllConditions()["VarScene"].SetFunctionName("ReturnVariable").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");
    GetAllConditions()["VarSceneTxt"].SetFunctionName("ReturnVariable").SetManipulatedType("string").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");

    GetAllConditions()["VariableChildExists"].SetFunctionName("VariableChildExists").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");
    GetAllConditions()["GlobalVariableChildExists"].SetFunctionName("VariableChildExists").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");

    GetAllConditions()["VarSceneDef"].SetFunctionName("VariableExists").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");
    GetAllConditions()["VarGlobalDef"].SetFunctionName("VariableExists").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");

    GetAllConditions()["VarGlobal"].SetFunctionName("ReturnVariable").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");
    GetAllConditions()["VarGlobalTxt"].SetFunctionName("ReturnVariable").SetManipulatedType("string").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");

    GetAllActions()["ModVarScene"].SetFunctionName("ReturnVariable").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");
    GetAllActions()["ModVarSceneTxt"].SetFunctionName("ReturnVariable").SetManipulatedType("string").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");

    GetAllActions()["ModVarGlobal"].SetFunctionName("ReturnVariable").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");
    GetAllActions()["ModVarGlobalTxt"].SetFunctionName("ReturnVariable").SetManipulatedType("string").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");

    GetAllActions()["VariableRemoveChild"].SetFunctionName("VariableRemoveChild").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");
    GetAllActions()["GlobalVariableRemoveChild"].SetFunctionName("VariableRemoveChild").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");

    GetAllExpressions()["Variable"].SetFunctionName("GetVariableValue").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");
    GetAllStrExpressions()["VariableString"].SetFunctionName("GetVariableString").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");

    GetAllExpressions()["GlobalVariable"].SetFunctionName("GetVariableValue").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");
    GetAllStrExpressions()["GlobalVariableString"].SetFunctionName("GetVariableString").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");
    #endif
}
Exemplo n.º 5
0
JoystickExtension::JoystickExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsJoystickExtension(*this);


    #if defined(GD_IDE_ONLY)
    GetAllConditions()["JoystickButtonDown"].SetFunctionName("JoystickButtonDown").SetIncludeFile("GDCpp/Extensions/Builtin/JoystickTools.h");
    GetAllConditions()["JoystickAxis"].SetFunctionName("GetJoystickAxisValue").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/JoystickTools.h");

    GetAllActions()["GetJoystickAxis"].SetFunctionName("JoystickAxisValueToVariable").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/JoystickTools.h");

    GetAllExpressions()["GetJoystickAxis"].SetFunctionName("GetJoystickAxisValue").SetIncludeFile("GDCpp/Extensions/Builtin/JoystickTools.h");
    #endif
}
Exemplo n.º 6
0
KeyboardExtension::KeyboardExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsKeyboardExtension(*this);

    SetExtensionInformation("BuiltinKeyboard",
                          _("Keyboard features"),
                          _("Built-in extensions allowing to use keyboard"),
                          "Florian Rival",
                          "Open source (LGPL)");

    GetAllConditions()["KeyPressed"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.input.isKeyPressed").SetIncludeFile("inputtools.js");
    GetAllConditions()["KeyFromTextPressed"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.input.isKeyPressed").SetIncludeFile("inputtools.js");
    GetAllConditions()["AnyKeyPressed"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.input.anyKeyPressed").SetIncludeFile("inputtools.js");
}
Exemplo n.º 7
0
FileExtension::FileExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsFileExtension(*this);

    #if defined(GD_IDE_ONLY)
    GetAllConditions()["GroupExists"].SetFunctionName("GroupExists").SetIncludeFile("GDCpp/Extensions/Builtin/FileTools.h");
    GetAllActions()["LoadFile"].SetFunctionName("LoadFileInMemory").SetIncludeFile("GDCpp/Extensions/Builtin/FileTools.h");
    GetAllActions()["UnloadFile"].SetFunctionName("UnloadFileFromMemory").SetIncludeFile("GDCpp/Extensions/Builtin/FileTools.h");
    GetAllActions()["EcrireFichierExp"].SetFunctionName("WriteValueInFile").SetIncludeFile("GDCpp/Extensions/Builtin/FileTools.h");
    GetAllActions()["EcrireFichierTxt"].SetFunctionName("WriteStringInFile").SetIncludeFile("GDCpp/Extensions/Builtin/FileTools.h");
    GetAllActions()["LireFichierExp"].SetFunctionName("ReadValueFromFile").SetIncludeFile("GDCpp/Extensions/Builtin/FileTools.h");
    GetAllActions()["LireFichierTxt"].SetFunctionName("ReadStringFromFile").SetIncludeFile("GDCpp/Extensions/Builtin/FileTools.h");
    GetAllActions()["DeleteGroupFichier"].SetFunctionName("DeleteGroupFromFile").SetIncludeFile("GDCpp/Extensions/Builtin/FileTools.h");
    GetAllActions()["DeleteFichier"].SetFunctionName("GDDeleteFile").SetIncludeFile("GDCpp/Extensions/Builtin/FileTools.h");
    GetAllConditions()["FileExists"].SetFunctionName("FileExists").SetIncludeFile("GDCpp/Extensions/Builtin/FileTools.h");
    GetAllActions()["LaunchFile"].SetFunctionName("LaunchFile").SetIncludeFile("GDCpp/Extensions/Builtin/FileTools.h");
    GetAllActions()["ExecuteCmd"].SetFunctionName("ExecuteCmd").SetIncludeFile("GDCpp/Extensions/Builtin/FileTools.h");
    #endif
}
Exemplo n.º 8
0
AdvancedExtension::AdvancedExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsAdvancedExtension(*this);

    SetExtensionInformation("BuiltinAdvanced",
                          _("Advanced control features"),
                          _("Built-in extension providing advanced control features."),
                          "Florian Rival",
                          "Open source (MIT License)");

    GetAllConditions()["Toujours"].SetFunctionName("gdjs.evtTools.common.logicalNegation").SetIncludeFile("commontools.js");
}
Exemplo n.º 9
0
    /**
     * \brief Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    JsExtension()
    {
        SetExtensionInformation("SystemInfo",
            _("System information"),
            _("Provides information about the system running the game"),
            "Florian Rival",
            "Open source (MIT License)");

        CloneExtension("GDevelop C++ platform", "SystemInfo");

        GetAllConditions()["SystemInfo::IsMobile"].codeExtraInformation.SetIncludeFile("SystemInfo/systeminfotools.js")
            .SetFunctionName("gdjs.evtTools.systemInfo.isMobile");

        StripUnimplementedInstructionsAndExpressions();
    };
Exemplo n.º 10
0
CameraExtension::CameraExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsCameraExtension(*this);

    #if defined(GD_IDE_ONLY)

    GetAllConditions()["CameraX"].SetFunctionName("GetCameraX").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllConditions()["CameraY"].SetFunctionName("GetCameraY").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");

    GetAllActions()["CameraX"].SetFunctionName("SetCameraX").SetManipulatedType("number").SetGetter("GetCameraX").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllActions()["CameraY"].SetFunctionName("SetCameraY").SetManipulatedType("number").SetGetter("GetCameraY").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");

    GetAllConditions()["CameraWidth"].SetFunctionName("GetCameraWidth").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllConditions()["CameraHeight"].SetFunctionName("GetCameraHeight").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllConditions()["CameraAngle"].SetFunctionName("GetCameraAngle").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");

    GetAllActions()["RotateCamera"].SetFunctionName("SetCameraAngle").SetGetter("GetCameraAngle").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");

    GetAllActions()["AddCamera"].SetFunctionName("AddCamera").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");

    GetAllActions()["DeleteCamera"].SetFunctionName("DeleteCamera").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");

    GetAllActions()["CameraSize"].SetFunctionName("SetCameraSize").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");

    GetAllActions()["CameraViewport"].SetFunctionName("SetCameraViewport").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");

    GetAllActions()["ZoomCamera"].SetFunctionName("SetCameraZoom").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");

    GetAllActions()["FixCamera"].SetFunctionName("CenterCameraOnObjectWithLimits").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");

    GetAllActions()["CentreCamera"].SetFunctionName("CenterCameraOnObject").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");

    GetAllActions()["ShowLayer"].SetFunctionName("ShowLayer").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");

    GetAllActions()["HideLayer"].SetFunctionName("HideLayer").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");;

    GetAllConditions()["LayerVisible"].SetFunctionName("LayerVisible").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneTools.h");

    GetAllExpressions()["CameraWidth"].SetFunctionName("GetCameraWidth").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllExpressions()["CameraHeight"].SetFunctionName("GetCameraHeight").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllExpressions()["CameraViewportLeft"].SetFunctionName("GetCameraViewportLeft").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllExpressions()["CameraViewportTop"].SetFunctionName("GetCameraViewportTop").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllExpressions()["CameraViewportRight"].SetFunctionName("GetCameraViewportRight").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllExpressions()["CameraViewportBottom"].SetFunctionName("GetCameraViewportBottom").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllExpressions()["CameraX"].SetFunctionName("GetCameraX").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllExpressions()["VueX"].SetFunctionName("GetCameraX").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllExpressions()["CameraY"].SetFunctionName("GetCameraY").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllExpressions()["VueY"].SetFunctionName("GetCameraY").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllExpressions()["CameraRotation"].SetFunctionName("GetCameraRotation").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");
    GetAllExpressions()["VueRotation"].SetFunctionName("GetCameraRotation").SetIncludeFile("GDCpp/Extensions/Builtin/RuntimeSceneCameraTools.h");

    #endif
}
Exemplo n.º 11
0
    /**
     * \brief Constructor of an extension declares everything the extension contains: objects, actions, conditions and expressions.
     */
    JsExtension()
    {
        SetExtensionInformation("LinkedObjects",
                              _("Linked objects"),
                              _("Extension allowing to virtually link two objects."),
                              "Florian Rival",
                              "Open source (MIT License)");

        CloneExtension("GDevelop C++ platform", "LinkedObjects");

        GetAllActions()["LinkedObjects::LinkObjects"].codeExtraInformation.SetIncludeFile("LinkedObjects/linkedobjects.js")
            .SetFunctionName("gdjs.evtTools.linkedObjects.linkObjects");
        GetAllActions()["LinkedObjects::RemoveLinkBetween"].codeExtraInformation.SetIncludeFile("LinkedObjects/linkedobjects.js")
            .SetFunctionName("gdjs.evtTools.linkedObjects.removeLinkBetween");
        GetAllActions()["LinkedObjects::RemoveAllLinksOf"].codeExtraInformation.SetIncludeFile("LinkedObjects/linkedobjects.js")
            .SetFunctionName("gdjs.evtTools.linkedObjects.removeAllLinksOf");
        GetAllActions()["LinkedObjects::PickObjectsLinkedTo"].codeExtraInformation.SetIncludeFile("LinkedObjects/linkedobjects.js")
            .SetFunctionName("gdjs.evtTools.linkedObjects.pickObjectsLinkedTo");
        GetAllConditions()["LinkedObjects::PickObjectsLinkedTo"].codeExtraInformation.SetIncludeFile("LinkedObjects/linkedobjects.js")
            .SetFunctionName("gdjs.evtTools.linkedObjects.pickObjectsLinkedTo");

        StripUnimplementedInstructionsAndExpressions();
    };
Exemplo n.º 12
0
BaseObjectExtension::BaseObjectExtension()
{
    SetExtensionInformation("BuiltinObject",
                          _("Base object"),
                          _("Base object"),
                          "Florian Rival",
                          "Open source ( LGPL )");
    CloneExtension("Game Develop C++ platform", "BuiltinObject");

    std::map<std::string, gd::InstructionMetadata > & objectActions = GetAllActionsForObject("");
    std::map<std::string, gd::InstructionMetadata > & objectConditions = GetAllConditionsForObject("");
    std::map<std::string, gd::ExpressionMetadata > & objectExpressions = GetAllExpressionsForObject("");
    std::map<std::string, gd::StrExpressionMetadata > & objectStrExpressions = GetAllStrExpressionsForObject("");

    objectActions["MettreX"].codeExtraInformation
        .SetFunctionName("setX").SetAssociatedGetter("getX").SetIncludeFile("runtimeobject.js");
    objectActions["MettreY"].codeExtraInformation
        .SetFunctionName("setY").SetAssociatedGetter("getY").SetIncludeFile("runtimeobject.js");
    objectConditions["PosX"].codeExtraInformation
        .SetFunctionName("getX").SetIncludeFile("runtimeobject.js");
    objectConditions["PosY"].codeExtraInformation
        .SetFunctionName("getY").SetIncludeFile("runtimeobject.js");
    objectActions["ChangeLayer"].codeExtraInformation
        .SetFunctionName("setLayer").SetIncludeFile("runtimeobject.js");
    objectConditions["Layer"].codeExtraInformation
        .SetFunctionName("isOnLayer").SetIncludeFile("runtimeobject.js");
    objectActions["ChangePlan"].codeExtraInformation
        .SetFunctionName("setZOrder").SetAssociatedGetter("getZOrder").SetIncludeFile("runtimeobject.js");
    objectConditions["Plan"].codeExtraInformation
        .SetFunctionName("getZOrder").SetIncludeFile("runtimeobject.js");
    objectActions["Cache"].codeExtraInformation
        .SetFunctionName("hide").SetIncludeFile("runtimeobject.js");
    objectActions["Montre"].codeExtraInformation
        .SetFunctionName("hide").SetIncludeFile("runtimeobject.js");
    objectConditions["Visible"].codeExtraInformation
        .SetFunctionName("isVisible").SetIncludeFile("runtimeobject.js");
    objectConditions["Invisible"].codeExtraInformation
        .SetFunctionName("isHidden").SetIncludeFile("runtimeobject.js");
    objectActions["Delete"].codeExtraInformation
        .SetFunctionName("deleteFromScene");
    objectActions["MettreAutourPos"].codeExtraInformation
        .SetFunctionName("putAround");
    objectActions["MettreAutour"].codeExtraInformation
        .SetFunctionName("putAroundObject").SetIncludeFile("runtimeobject.js");
    objectConditions["VarObjet"].codeExtraInformation
        .SetFunctionName("getVariableNumber").SetIncludeFile("runtimeobject.js");
    objectConditions["VarObjetTxt"].codeExtraInformation
        .SetFunctionName("getVariableString").SetIncludeFile("runtimeobject.js");
    objectConditions["VarObjetDef"].codeExtraInformation
        .SetFunctionName("hasVariable").SetIncludeFile("runtimeobject.js");
    objectActions["ModVarObjet"].codeExtraInformation
        .SetFunctionName("setVariableNumber").SetAssociatedGetter("getVariableNumber").SetIncludeFile("runtimeobject.js");
    objectActions["ModVarObjetTxt"].codeExtraInformation
        .SetFunctionName("setVariableString").SetAssociatedGetter("getVariableString").SetIncludeFile("runtimeobject.js");
    objectActions["AddForceXY"].codeExtraInformation
        .SetFunctionName("addForce").SetIncludeFile("runtimeobject.js");
    objectActions["AddForceAL"].codeExtraInformation
        .SetFunctionName("addPolarForce").SetIncludeFile("runtimeobject.js");
    objectActions["AddForceVersPos"].codeExtraInformation
        .SetFunctionName("addForceTowardPosition").SetIncludeFile("runtimeobject.js");
    objectActions["AddForceVers"].codeExtraInformation
        .SetFunctionName("addForceTowardObject").SetIncludeFile("runtimeobject.js");
    objectActions["Arreter"].codeExtraInformation
        .SetFunctionName("clearForces").SetIncludeFile("runtimeobject.js");
    objectConditions["Arret"].codeExtraInformation
        .SetFunctionName("hasNoForces").SetIncludeFile("runtimeobject.js");
    objectConditions["Vitesse"].codeExtraInformation
        .SetFunctionName("getAverageForce().getLength").SetIncludeFile("runtimeobject.js");
    objectConditions["AngleOfDisplacement"].codeExtraInformation
        .SetFunctionName("averageForceAngleIs").SetIncludeFile("runtimeobject.js");
    objectActions["SeparateFromObjects"].codeExtraInformation
        .SetFunctionName("separateFromObjects").SetIncludeFile("runtimeobject.js");
    objectActions["Ecarter"].codeExtraInformation //Deprecated
        .SetFunctionName("separateObjectsWithoutForces").SetIncludeFile("runtimeobject.js");
    objectActions["Rebondir"].codeExtraInformation //Deprecated
        .SetFunctionName("separateObjectsWithForces").SetIncludeFile("runtimeobject.js");
    objectConditions["AutomatismActivated"].codeExtraInformation
        .SetFunctionName("automatismActivated").SetIncludeFile("runtimeobject.js");
    objectActions["ActivateAutomatism"].codeExtraInformation
        .SetFunctionName("activateAutomatism").SetIncludeFile("runtimeobject.js");
    objectConditions["ObjectVariableChildExists"].codeExtraInformation
        .SetFunctionName("variableChildExists").SetIncludeFile("runtimeobject.js");
    objectActions["ObjectVariableRemoveChild"].codeExtraInformation
        .SetFunctionName("variableRemoveChild").SetIncludeFile("runtimeobject.js");

    objectExpressions["X"].codeExtraInformation.SetFunctionName("getX");
    objectExpressions["Y"].codeExtraInformation.SetFunctionName("getY");
    objectExpressions["ZOrder"].codeExtraInformation.SetFunctionName("getZOrder");
    objectExpressions["Plan"].codeExtraInformation.SetFunctionName("getZOrder");
    objectExpressions["Width"].codeExtraInformation.SetFunctionName("getWidth");
    objectExpressions["Height"].codeExtraInformation.SetFunctionName("getHeight");
    objectExpressions["Largeur"].codeExtraInformation.SetFunctionName("getWidth"); //Deprecated
    objectExpressions["Hauteur"].codeExtraInformation.SetFunctionName("getHeight"); //Deprecated
    objectExpressions["Variable"].codeExtraInformation.SetFunctionName("gdjs.RuntimeObject.getVariableNumber").SetStatic();
    objectStrExpressions["VariableString"].codeExtraInformation.SetFunctionName("gdjs.RuntimeObject.getVariableString").SetStatic();
    objectExpressions["ForceX"].codeExtraInformation.SetFunctionName("getAverageForce().getX");
    objectExpressions["ForceY"].codeExtraInformation.SetFunctionName("getAverageForce().getY");
    objectExpressions["ForceAngle"].codeExtraInformation.SetFunctionName("getAverageForce().getAngle");
    objectExpressions["Angle"].codeExtraInformation.SetFunctionName("getAverageForce().getAngle"); //Deprecated
    objectExpressions["ForceLength"].codeExtraInformation.SetFunctionName("getAverageForce().getLength");
    objectExpressions["Longueur"].codeExtraInformation.SetFunctionName("getAverageForce().getLength"); //Deprecated
    objectExpressions["Distance"].codeExtraInformation.SetFunctionName("getDistanceFrom");
    objectExpressions["SqDistance"].codeExtraInformation.SetFunctionName("getSqDistanceFrom");


    GetAllActions()["Create"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.object.createObjectOnScene");
    GetAllActions()["CreateByName"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.object.createObjectFromGroupOnScene");
    GetAllExpressions()["Count"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.object.pickedObjectsCount");
    GetAllConditions()["NbObjet"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.object.pickedObjectsCount");
    GetAllConditions()["CollisionNP"]
        .AddCodeOnlyParameter("currentScene", "") //We need an extra parameter pointing to the scene.
        .codeExtraInformation
        .SetFunctionName("gdjs.evtTools.object.hitBoxesCollisionTest");
    GetAllConditions()["Distance"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.object.distanceTest");
    GetAllConditions()["SeDirige"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.object.movesTowardTest");
    GetAllConditions()["EstTourne"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.object.turnedTowardTest");

    GetAllActions()["AjoutObjConcern"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.object.pickAllObjects");
    GetAllConditions()["AjoutObjConcern"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.object.pickAllObjects");
    GetAllActions()["AjoutHasard"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.object.pickRandomObject");
    GetAllConditions()["AjoutHasard"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.object.pickRandomObject");


    {
        class CodeGenerator : public gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator
        {
        public:
            virtual std::string GenerateCode(gd::Instruction &, gd::EventsCodeGenerator &, gd::EventsCodeGenerationContext &)
            {
                return "runtimeScene.updateObjectsForces();";
            };
        };
        gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator * codeGen = new CodeGenerator;

        GetAllActions()["MoveObjects"].codeExtraInformation
            .SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>(codeGen));
    }

    {
        class CodeGenerator : public gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator
        {
        public:
            virtual std::string GenerateCode(gd::Instruction & instruction, gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context)
            {
                std::string outputCode;

                std::vector<std::string> realObjects = codeGenerator.ExpandObjectsName(instruction.GetParameter(0).GetPlainString(), context);
                for (unsigned int i = 0;i<realObjects.size();++i)
                {
                    context.SetCurrentObject(realObjects[i]);
                    context.ObjectsListNeeded(realObjects[i]);

                    std::string newX, newY;

                    std::string expression1Code;
                    {
                        gd::CallbacksForGeneratingExpressionCode callbacks(expression1Code, codeGenerator, context);
                        gd::ExpressionParser parser(instruction.GetParameters()[2].GetPlainString());
                        if (!parser.ParseMathExpression(codeGenerator.GetPlatform(), codeGenerator.GetProject(), codeGenerator.GetLayout(), callbacks) || expression1Code.empty())
                            expression1Code = "0";
                    }

                    std::string expression2Code;
                    {
                        gd::CallbacksForGeneratingExpressionCode callbacks(expression2Code, codeGenerator, context);
                        gd::ExpressionParser parser(instruction.GetParameters()[4].GetPlainString());
                        if (!parser.ParseMathExpression(codeGenerator.GetPlatform(), codeGenerator.GetProject(), codeGenerator.GetLayout(), callbacks) || expression2Code.empty())
                            expression2Code = "0";
                    }

                    std::string op1 = instruction.GetParameter(1).GetPlainString();
                    if ( op1 == "=" || op1.empty() )
                        newX = expression1Code;
                    else if ( op1 == "/" || op1 == "*" || op1 == "-" || op1 == "+" )
                        newX = codeGenerator.GetObjectListName(realObjects[i], context)+"[i].getX() "+op1 + expression1Code;
                    else
                        return "";
                    std::string op2 = instruction.GetParameter(3).GetPlainString();
                    if ( op2 == "=" || op2.empty() )
                        newY = expression2Code;
                    else if ( op2 == "/" || op2 == "*" || op2 == "-" || op2 == "+" )
                        newY = codeGenerator.GetObjectListName(realObjects[i], context)+"[i].getY() "+op2 + expression2Code;
                    else
                        return "";

                    std::string call = codeGenerator.GetObjectListName(realObjects[i], context)+"[i].setPosition("+newX+","+newY+")";

                    outputCode += "for(var i = 0, len = "+codeGenerator.GetObjectListName(realObjects[i], context)+".length ;i < len;++i) {\n";
                    outputCode += "    "+call+";\n";
                    outputCode += "}\n";

                    context.SetNoCurrentObject();
                }

                return outputCode;
            };
        };
        gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator * codeGen = new CodeGenerator;

        objectActions["MettreXY"].codeExtraInformation
            .SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>(codeGen));
    }

    StripUnimplementedInstructionsAndExpressions(); //Unimplemented things are listed here:
/*
        obj.AddAction("AddForceTournePos",
                       _("Add a force so as to move around a position"),
                       _("Add a force to an object so as it rotates toward a position.\nNote that the moving is not precise, especially if the speed is high.\nTo position an object around a position more precisly, use the actions in the category  \"Position\"."),
                       _("Rotate _PARAM0_ around _PARAM1_;_PARAM2_ with _PARAM3_�/sec and _PARAM4_ pixels away"),
                       _("Displacement"),
                       "res/actions/forceTourne24.png",
                       "res/actions/forceTourne.png")

            .AddParameter("object", _("Object"))
            .AddParameter("expression", _("X position of the center"))
            .AddParameter("expression", _("Y position of the center"))
            .AddParameter("expression", _("Speed ( in Degrees per seconds )"))
            .AddParameter("expression", _("Distance ( in pixels )"))
            .AddParameter("expression", _("Damping ( Default : 0 )"))
            .codeExtraInformation.SetFunctionName("AddForceToMoveAround");

        obj.AddAction("AddForceTourne",
                       _("Add a force so as to move around an object"),
                       _("Add a force to an object so as it rotates around another.\nNote that the moving is not precise, especially if the speed is high.\nTo position an object around a position more precisly, use the actions in the category  \"Position\"."),
                       _("Rotate _PARAM0_ around _PARAM1_ with _PARAM2_�/sec and _PARAM3_ pixels away"),
                       _("Displacement"),
                       "res/actions/forceTourne24.png",
                       "res/actions/forceTourne.png")

            .AddParameter("object", _("Object"))
            .AddParameter("objectPtr", _("Rotate around this object"))
            .AddParameter("expression", _("Speed ( Degrees per second )"))
            .AddParameter("expression", _("Distance ( in pixel )"))
            .AddParameter("expression", _("Damping ( Default : 0 )"))
            .codeExtraInformation.SetFunctionName("AddForceToMoveAroundObject").SetIncludeFile("GDCpp/BuiltinExtensions/ObjectTools.h");
*/
}
Exemplo n.º 13
0
CameraExtension::CameraExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsCameraExtension(*this);

    SetExtensionInformation("BuiltinCamera",
                          _("Cameras and layers features"),
                          _("Builtin camera extension"),
                          "Florian Rival",
                          "Open source (LGPL)");

    GetAllActions()["CameraX"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.setCameraX").SetAssociatedGetter("gdjs.evtTools.camera.getCameraX");
    GetAllActions()["CameraY"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.setCameraY").SetAssociatedGetter("gdjs.evtTools.camera.getCameraY");
    GetAllConditions()["CameraX"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.getCameraX");
    GetAllConditions()["CameraY"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.getCameraY");
    GetAllConditions()["CameraWidth"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.getCameraWidth");
    GetAllConditions()["CameraHeight"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.getCameraHeight");
    GetAllActions()["ShowLayer"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.showLayer");
    GetAllActions()["HideLayer"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.hideLayer");
    GetAllConditions()["LayerVisible"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.layerIsVisible");
    GetAllConditions()["CameraAngle"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.getCameraRotation");
    GetAllActions()["RotateCamera"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.setCameraRotation").SetAssociatedGetter("gdjs.evtTools.camera.getCameraRotation");
    GetAllActions()["ZoomCamera"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.setCameraZoom");

    GetAllExpressions()["CameraX"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.getCameraX");
    GetAllExpressions()["VueX"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.getCameraX");
    GetAllExpressions()["CameraY"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.getCameraY");
    GetAllExpressions()["VueY"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.getCameraY");
    GetAllExpressions()["CameraRotation"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.getCameraRotation");
    GetAllExpressions()["VueRotation"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.getCameraRotation");
    GetAllExpressions()["CameraWidth"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.getCameraWidth");
    GetAllExpressions()["CameraHeight"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.getCameraHeight");

    GetAllActions()["FixCamera"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.centerCameraWithinLimits");
    GetAllActions()["CentreCamera"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.camera.centerCamera");

    StripUnimplementedInstructionsAndExpressions(); //Unimplemented things are listed here:
/*
    AddAction("AddCamera",
                   _("Add a camera to a layer"),
                   _("This action add a camera to a layer"),
                   _("Add a camera to layer _PARAM1_"),
                   _("Layers and cameras"),
                   "res/actions/camera24.png",
                   "res/actions/camera.png")
        .AddCodeOnlyParameter("currentScene", "")
        .AddParameter("layer", _("Layer ( Base layer if empty )"), "",false).SetDefaultValue("\"\"")
        .AddParameter("expression", _("Width"), "",true)
        .AddParameter("expression", _("Height"), "",true)
        .AddParameter("expression", _("Render zone: Top left side: X Position ( Between 0 and 1 )"), "",true)
        .AddParameter("expression", _("Render zone: Top left side: Y Position ( Between 0 and 1 )"), "",true)
        .AddParameter("expression", _("Render zone: Bottom right side: X Position ( Between 0 and 1 )"), "",true)
        .AddParameter("expression", _("Render zone: Bottom right side: Y Position ( Between 0 and 1 )"), "",true)
        .codeExtraInformation.SetFunctionName("AddCamera").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneCameraTools.h");

    AddAction("DeleteCamera",
                   _("Delete a camera of a layer"),
                   _("Remove the specified camera from a layer"),
                   _("Delete camera _PARAM2_ from layer _PARAM1_"),
                   _("Layers and cameras"),
                   "res/actions/camera24.png",
                   "res/actions/camera.png")
        .AddCodeOnlyParameter("currentScene", "")
        .AddParameter("layer", _("Layer ( Base layer if empty )"), "",false).SetDefaultValue("\"\"")
        .AddParameter("expression", _("Camera number"), "",false)
        .codeExtraInformation.SetFunctionName("DeleteCamera").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneCameraTools.h");

    AddAction("CameraSize",
                   _("Modify the size of a camera"),
                   _("This action modify the size of a camera of the specified layer. The zoom will be reset."),
                   _("Change the size of camera _PARAM2_ of _PARAM1_ to _PARAM3_*_PARAM4_"),
                   _("Layers and cameras"),
                   "res/actions/camera24.png",
                   "res/actions/camera.png")
        .AddCodeOnlyParameter("currentScene", "")
        .AddParameter("layer", _("Layer ( Base layer if empty )"), "",false).SetDefaultValue("\"\"")
        .AddParameter("expression", _("Camera number"), "",false)
        .AddParameter("expression", _("Width"), "",false)
        .AddParameter("expression", _("Height"), "",false)
        .codeExtraInformation.SetFunctionName("SetCameraSize").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneCameraTools.h");

    AddAction("CameraViewport",
                   _("Modify the render zone of a camera"),
                   _("This action modify the render zone of a camera of the specified layer."),
                   _("Set the render zone of camera _PARAM2_ from layer _PARAM1_ to PARAM3_;_PARAM4_ _PARAM5_;_PARAM6_"),
                   _("Layers and cameras"),
                   "res/actions/camera24.png",
                   "res/actions/camera.png")
        .AddCodeOnlyParameter("currentScene", "")
        .AddParameter("layer", _("Layer ( Base layer if empty )"), "",false).SetDefaultValue("\"\"")
        .AddParameter("expression", _("Camera number"), "",false)
        .AddParameter("expression", _("Render zone: Top left side: X Position ( Between 0 and 1 )"), "",false)
        .AddParameter("expression", _("Render zone: Top left side: X Position ( Between 0 and 1 )"), "",false)
        .AddParameter("expression", _("Render zone: Bottom right side: X Position ( Between 0 and 1 )"), "",false)
        .AddParameter("expression", _("Render zone: Bottom right side: X Position ( Between 0 and 1 )"), "",false)
        .codeExtraInformation.SetFunctionName("SetCameraViewport").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneCameraTools.h");

    AddExpression("CameraViewportLeft", _("X position of the top left side point of a render zone"), _("X position of the top left side point of a render zone"), _("Camera"), "res/actions/camera.png")
        .AddCodeOnlyParameter("currentScene", "")
        .AddParameter("layer", _("Layer"), "",false)
        .AddParameter("expression", _("Camera number ( default : 0 )"), "",false).SetDefaultValue("0")
        .codeExtraInformation.SetFunctionName("GetCameraViewportLeft").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneCameraTools.h");


    AddExpression("CameraViewportTop", _("Y position of the top left side point of a render zone"), _("Y position of the top left side point of a render zone"), _("Camera"), "res/actions/camera.png")
        .AddCodeOnlyParameter("currentScene", "")
        .AddParameter("layer", _("Layer"), "",false)
        .AddParameter("expression", _("Camera number ( default : 0 )"), "",false).SetDefaultValue("0")
        .codeExtraInformation.SetFunctionName("GetCameraViewportTop").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneCameraTools.h");


    AddExpression("CameraViewportRight", _("X position of the bottom right side point of a render zone"), _("X position of the bottom right side point of a render zone"), _("Camera"), "res/actions/camera.png")
        .AddCodeOnlyParameter("currentScene", "")
        .AddParameter("layer", _("Layer"), "",false)
        .AddParameter("expression", _("Camera number ( default : 0 )"), "",false).SetDefaultValue("0")
        .codeExtraInformation.SetFunctionName("GetCameraViewportRight").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneCameraTools.h");


    AddExpression("CameraViewportBottom", _("Y position of the bottom right side point of a render zone"), _("Y position of the bottom right side point of a render zone"), _("Camera"), "res/actions/camera.png")
        .AddCodeOnlyParameter("currentScene", "")
        .AddParameter("layer", _("Layer"), "",false)
        .AddParameter("expression", _("Camera number ( default : 0 )"), "",false).SetDefaultValue("0")
        .codeExtraInformation.SetFunctionName("GetCameraViewportBottom").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneCameraTools.h");


*/
}
Exemplo n.º 14
0
AudioExtension::AudioExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsAudioExtension(*this);

    #if defined(GD_IDE_ONLY)
    GetAllActions()["PlaySoundCanal"].SetFunctionName("PlaySoundOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["StopSoundCanal"].SetFunctionName("StopSoundOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["PauseSoundCanal"].SetFunctionName("PauseSoundOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["RePlaySoundCanal"].SetFunctionName("RePlaySoundOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["PlayMusicCanal"].SetFunctionName("PlayMusicOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["StopMusicCanal"].SetFunctionName("StopMusicOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["PauseMusicCanal"].SetFunctionName("PauseMusicOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["RePlayMusicCanal"].SetFunctionName("RePlayMusicOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["ModVolumeSoundCanal"].SetFunctionName("SetSoundVolumeOnChannel").SetManipulatedType("number").SetGetter("GetSoundVolumeOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["ModVolumeMusicCanal"].SetFunctionName("SetMusicVolumeOnChannel").SetManipulatedType("number").SetGetter("GetMusicVolumeOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["ModGlobalVolume"].SetFunctionName("SetGlobalVolume").SetGetter("GetGlobalVolume").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["ModPitchSoundChannel"].SetFunctionName("SetSoundPitchOnChannel").SetGetter("GetSoundPitchOnChannel").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["ModPitchMusicChannel"].SetFunctionName("SetMusicPitchOnChannel").SetGetter("GetMusicPitchOnChannel").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["ModPlayingOffsetSoundChannel"].SetFunctionName("SetSoundPlayingOffsetOnChannel").SetGetter("GetSoundPlayingOffsetOnChannel").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["ModPlayingOffsetMusicChannel"].SetFunctionName("SetMusicPlayingOffsetOnChannel").SetGetter("GetMusicPlayingOffsetOnChannel").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["PlaySound"].SetFunctionName("PlaySound").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllActions()["PlayMusic"].SetFunctionName("PlayMusic").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");

    GetAllConditions()["MusicPlaying"].SetFunctionName("MusicPlaying").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllConditions()["MusicPaused"].SetFunctionName("MusicPaused").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllConditions()["MusicStopped"].SetFunctionName("MusicStopped").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllConditions()["SoundPlaying"].SetFunctionName("SoundPlaying").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllConditions()["SoundPaused"].SetFunctionName("SoundPaused").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllConditions()["SoundStopped"].SetFunctionName("SoundStopped").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllConditions()["SoundCanalVolume"].SetFunctionName("GetSoundVolumeOnChannel").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllConditions()["MusicCanalVolume"].SetFunctionName("GetMusicVolumeOnChannel").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllConditions()["GlobalVolume"].SetFunctionName("GetGlobalVolume").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllConditions()["SoundChannelPitch"].SetFunctionName("GetSoundPitchOnChannel").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllConditions()["MusicChannelPitch"].SetFunctionName("GetMusicPitchOnChannel").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllConditions()["SoundChannelPlayingOffset"].SetFunctionName("GetSoundPlayingOffsetOnChannel").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllConditions()["MusicChannelPlayingOffset"].SetFunctionName("GetMusicPlayingOffsetOnChannel").SetManipulatedType("number").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");

    GetAllExpressions()["SoundChannelPlayingOffset"].SetFunctionName("GetSoundPlayingOffsetOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllExpressions()["MusicChannelPlayingOffset"].SetFunctionName("GetMusicPlayingOffsetOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllExpressions()["SoundChannelVolume"].SetFunctionName("GetSoundVolumeOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllExpressions()["MusicChannelVolume"].SetFunctionName("GetMusicVolumeOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllExpressions()["SoundChannelPitch"].SetFunctionName("GetSoundPitchOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllExpressions()["MusicChannelPitch"].SetFunctionName("GetMusicPitchOnChannel").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    GetAllExpressions()["GlobalVolume"].SetFunctionName("GetGlobalVolume").SetIncludeFile("GDCpp/Extensions/Builtin/AudioTools.h");
    #endif
}
Exemplo n.º 15
0
void PlatformExtension::StripUnimplementedInstructionsAndExpressions()
{
    for (std::map<gd::String, gd::InstructionMetadata >::iterator it = GetAllActions().begin();it != GetAllActions().end();)
    {
        if ( it->second.codeExtraInformation.functionCallName.empty() &&
             !it->second.codeExtraInformation.HasCustomCodeGenerator())
        {
            GetAllActions().erase(it++);
        }
        else ++it;
    }

    for (std::map<gd::String, gd::InstructionMetadata >::iterator it = GetAllConditions().begin();it != GetAllConditions().end();)
    {
        if ( it->second.codeExtraInformation.functionCallName.empty() &&
             !it->second.codeExtraInformation.HasCustomCodeGenerator())
        {
            GetAllConditions().erase(it++);
        }
        else ++it;
    }

    for (std::map<gd::String, gd::ExpressionMetadata >::iterator it = GetAllExpressions().begin();it != GetAllExpressions().end();)
    {
        if ( it->second.codeExtraInformation.functionCallName.empty() &&
             !it->second.codeExtraInformation.HasCustomCodeGenerator())
        {
            GetAllExpressions().erase(it++);
        }
        else ++it;
    }

    for (std::map<gd::String, gd::ExpressionMetadata >::iterator it = GetAllStrExpressions().begin();it != GetAllStrExpressions().end();)
    {
        if ( it->second.codeExtraInformation.functionCallName.empty() &&
             !it->second.codeExtraInformation.HasCustomCodeGenerator())
        {
            GetAllStrExpressions().erase(it++);
        }
        else ++it;
    }

    for(std::map<gd::String, gd::ObjectMetadata >::iterator objIt = objectsInfos.begin();objIt!=objectsInfos.end();++objIt)
    {
        gd::ObjectMetadata & obj = objIt->second;

        for (std::map<gd::String, gd::InstructionMetadata >::iterator it = obj.actionsInfos.begin();it != obj.actionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                 !it->second.codeExtraInformation.HasCustomCodeGenerator())
            {
                obj.actionsInfos.erase(it++);
            }
            else ++it;
        }

        for (std::map<gd::String, gd::InstructionMetadata >::iterator it = obj.conditionsInfos.begin();it != obj.conditionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                 !it->second.codeExtraInformation.HasCustomCodeGenerator())
            {
                obj.conditionsInfos.erase(it++);
            }
            else ++it;
        }

        for (std::map<gd::String, gd::ExpressionMetadata >::iterator it = obj.expressionsInfos.begin();it != obj.expressionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                 !it->second.codeExtraInformation.HasCustomCodeGenerator())
            {
                obj.expressionsInfos.erase(it++);
            }
            else ++it;
        }

        for (std::map<gd::String, gd::ExpressionMetadata >::iterator it = obj.strExpressionsInfos.begin();it != obj.strExpressionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                 !it->second.codeExtraInformation.HasCustomCodeGenerator())
            {
                obj.strExpressionsInfos.erase(it++);
            }
            else ++it;
        }
    }

    for(std::map<gd::String, gd::BehaviorMetadata >::iterator objIt = behaviorsInfo.begin();objIt!=behaviorsInfo.end();++objIt)
    {
        gd::BehaviorMetadata & obj = objIt->second;

        for (std::map<gd::String, gd::InstructionMetadata >::iterator it = obj.actionsInfos.begin();it != obj.actionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                 !it->second.codeExtraInformation.HasCustomCodeGenerator())
            {
                obj.actionsInfos.erase(it++);
            }
            else ++it;
        }

        for (std::map<gd::String, gd::InstructionMetadata >::iterator it = obj.conditionsInfos.begin();it != obj.conditionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                 !it->second.codeExtraInformation.HasCustomCodeGenerator())
            {
                obj.conditionsInfos.erase(it++);
            }
            else ++it;
        }

        for (std::map<gd::String, gd::ExpressionMetadata >::iterator it = obj.expressionsInfos.begin();it != obj.expressionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                 !it->second.codeExtraInformation.HasCustomCodeGenerator())
            {
                obj.expressionsInfos.erase(it++);
            }
            else ++it;
        }

        for (std::map<gd::String, gd::ExpressionMetadata >::iterator it = obj.strExpressionsInfos.begin();it != obj.strExpressionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                 !it->second.codeExtraInformation.HasCustomCodeGenerator())
            {
                obj.strExpressionsInfos.erase(it++);
            }
            else ++it;
        }
    }

    for(std::map<gd::String, gd::EventMetadata >::iterator it = eventsInfos.begin();it!=eventsInfos.end();)
    {
        if (!it->second.HasCustomCodeGenerator())
            eventsInfos.erase(it++);
        else ++it;
    }
}
Exemplo n.º 16
0
void PlatformExtension::CloneExtension(const gd::String & platformName, const gd::String & extensionName, bool stripFunctionsNameAndCodeGeneration)
{
    gd::Platform* platform = gd::PlatformManager::Get()->GetPlatform(platformName);
    if ( !platform ) {
        std::cout << "Unable to clone extension \""<< extensionName << "\" from " << platformName << ": This platform doesn't exist.";
        return;
    }

    std::shared_ptr<gd::PlatformExtension> extension = platform->GetExtension(extensionName);
    if ( !extension ) {
        std::cout << "Unable to clone extension \""<< extensionName << "\" from " << platformName << ": This extension doesn't exist.";
        return;
    }

    *this = *extension;

    if ( stripFunctionsNameAndCodeGeneration )
    {
        for (std::map<gd::String, gd::InstructionMetadata >::iterator it = GetAllActions().begin();it != GetAllActions().end();++it)
            it->second.SetFunctionName("").SetGetter("").RemoveCustomCodeGenerator();

        for (std::map<gd::String, gd::InstructionMetadata >::iterator it = GetAllConditions().begin();it != GetAllConditions().end();++it)
            it->second.SetFunctionName("").SetGetter("").RemoveCustomCodeGenerator();

        for (std::map<gd::String, gd::ExpressionMetadata >::iterator it = GetAllExpressions().begin();it != GetAllExpressions().end();++it)
            it->second.SetFunctionName("").RemoveCustomCodeGenerator();

        for (std::map<gd::String, gd::ExpressionMetadata >::iterator it = GetAllStrExpressions().begin();it != GetAllStrExpressions().end();++it)
            it->second.SetFunctionName("").RemoveCustomCodeGenerator();

        for(std::map<gd::String, gd::ObjectMetadata >::iterator objIt = objectsInfos.begin();objIt!=objectsInfos.end();++objIt)
        {
            gd::ObjectMetadata & obj = objIt->second;

            for (std::map<gd::String, gd::InstructionMetadata >::iterator it = obj.actionsInfos.begin();it != obj.actionsInfos.end();++it)
                it->second.SetFunctionName("").SetGetter("").RemoveCustomCodeGenerator();

            for (std::map<gd::String, gd::InstructionMetadata >::iterator it = obj.conditionsInfos.begin();it != obj.conditionsInfos.end();++it)
                it->second.SetFunctionName("").SetGetter("").RemoveCustomCodeGenerator();

            for (std::map<gd::String, gd::ExpressionMetadata >::iterator it = obj.expressionsInfos.begin();it != obj.expressionsInfos.end();++it)
                it->second.SetFunctionName("").RemoveCustomCodeGenerator();

            for (std::map<gd::String, gd::ExpressionMetadata >::iterator it = obj.strExpressionsInfos.begin();it != obj.strExpressionsInfos.end();++it)
                it->second.SetFunctionName("").RemoveCustomCodeGenerator();
        }

        for(std::map<gd::String, gd::BehaviorMetadata >::iterator objIt = behaviorsInfo.begin();objIt!=behaviorsInfo.end();++objIt)
        {
            gd::BehaviorMetadata & obj = objIt->second;

            for (std::map<gd::String, gd::InstructionMetadata >::iterator it = obj.actionsInfos.begin();it != obj.actionsInfos.end();++it)
                it->second.SetFunctionName("").SetGetter("").RemoveCustomCodeGenerator();

            for (std::map<gd::String, gd::InstructionMetadata >::iterator it = obj.conditionsInfos.begin();it != obj.conditionsInfos.end();++it)
                it->second.SetFunctionName("").SetGetter("").RemoveCustomCodeGenerator();

            for (std::map<gd::String, gd::ExpressionMetadata >::iterator it = obj.expressionsInfos.begin();it != obj.expressionsInfos.end();++it)
                it->second.SetFunctionName("").RemoveCustomCodeGenerator();

            for (std::map<gd::String, gd::ExpressionMetadata >::iterator it = obj.strExpressionsInfos.begin();it != obj.strExpressionsInfos.end();++it)
                it->second.SetFunctionName("").RemoveCustomCodeGenerator();
        }

        for(std::map<gd::String, gd::EventMetadata >::iterator it = eventsInfos.begin();it!=eventsInfos.end();++it)
            it->second.ClearCodeGenerationAndPreprocessing();
    }
}
Exemplo n.º 17
0
void PlatformExtension::StripUnimplementedInstructionsAndExpressions()
{
    for (std::map<std::string, gd::InstructionMetadata >::iterator it = GetAllActions().begin(); it != GetAllActions().end();)
    {
        if ( it->second.codeExtraInformation.functionCallName.empty() &&
                it->second.codeExtraInformation.optionalCustomCodeGenerator == boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>())
        {
            GetAllActions().erase(it++);
        }
        else ++it;
    }

    for (std::map<std::string, gd::InstructionMetadata >::iterator it = GetAllConditions().begin(); it != GetAllConditions().end();)
    {
        if ( it->second.codeExtraInformation.functionCallName.empty() &&
                it->second.codeExtraInformation.optionalCustomCodeGenerator == boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>())
        {
            GetAllConditions().erase(it++);
        }
        else ++it;
    }

    for (std::map<std::string, gd::ExpressionMetadata >::iterator it = GetAllExpressions().begin(); it != GetAllExpressions().end();)
    {
        if ( it->second.codeExtraInformation.functionCallName.empty() &&
                it->second.codeExtraInformation.optionalCustomCodeGenerator == boost::shared_ptr<gd::ExpressionCodeGenerationInformation::CustomCodeGenerator>())
        {
            GetAllExpressions().erase(it++);
        }
        else ++it;
    }

    for (std::map<std::string, gd::StrExpressionMetadata >::iterator it = GetAllStrExpressions().begin(); it != GetAllStrExpressions().end();)
    {
        if ( it->second.codeExtraInformation.functionCallName.empty() &&
                it->second.codeExtraInformation.optionalCustomCodeGenerator == boost::shared_ptr<gd::ExpressionCodeGenerationInformation::CustomCodeGenerator>())
        {
            GetAllStrExpressions().erase(it++);
        }
        else ++it;
    }

    for(std::map<std::string, gd::ObjectMetadata >::iterator objIt = objectsInfos.begin(); objIt!=objectsInfos.end(); ++objIt)
    {
        gd::ObjectMetadata & obj = objIt->second;

        for (std::map<std::string, gd::InstructionMetadata >::iterator it = obj.actionsInfos.begin(); it != obj.actionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                    it->second.codeExtraInformation.optionalCustomCodeGenerator == boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>())
            {
                obj.actionsInfos.erase(it++);
            }
            else ++it;
        }

        for (std::map<std::string, gd::InstructionMetadata >::iterator it = obj.conditionsInfos.begin(); it != obj.conditionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                    it->second.codeExtraInformation.optionalCustomCodeGenerator == boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>())
            {
                obj.conditionsInfos.erase(it++);
            }
            else ++it;
        }

        for (std::map<std::string, gd::ExpressionMetadata >::iterator it = obj.expressionsInfos.begin(); it != obj.expressionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                    it->second.codeExtraInformation.optionalCustomCodeGenerator == boost::shared_ptr<gd::ExpressionCodeGenerationInformation::CustomCodeGenerator>())
            {
                obj.expressionsInfos.erase(it++);
            }
            else ++it;
        }

        for (std::map<std::string, gd::StrExpressionMetadata >::iterator it = obj.strExpressionsInfos.begin(); it != obj.strExpressionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                    it->second.codeExtraInformation.optionalCustomCodeGenerator == boost::shared_ptr<gd::ExpressionCodeGenerationInformation::CustomCodeGenerator>())
            {
                obj.strExpressionsInfos.erase(it++);
            }
            else ++it;
        }
    }

    for(std::map<std::string, gd::AutomatismMetadata >::iterator objIt = automatismsInfo.begin(); objIt!=automatismsInfo.end(); ++objIt)
    {
        gd::AutomatismMetadata & obj = objIt->second;

        for (std::map<std::string, gd::InstructionMetadata >::iterator it = obj.actionsInfos.begin(); it != obj.actionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                    it->second.codeExtraInformation.optionalCustomCodeGenerator == boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>())
            {
                obj.actionsInfos.erase(it++);
            }
            else ++it;
        }

        for (std::map<std::string, gd::InstructionMetadata >::iterator it = obj.conditionsInfos.begin(); it != obj.conditionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                    it->second.codeExtraInformation.optionalCustomCodeGenerator == boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>())
            {
                obj.conditionsInfos.erase(it++);
            }
            else ++it;
        }

        for (std::map<std::string, gd::ExpressionMetadata >::iterator it = obj.expressionsInfos.begin(); it != obj.expressionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                    it->second.codeExtraInformation.optionalCustomCodeGenerator == boost::shared_ptr<gd::ExpressionCodeGenerationInformation::CustomCodeGenerator>())
            {
                obj.expressionsInfos.erase(it++);
            }
            else ++it;
        }

        for (std::map<std::string, gd::StrExpressionMetadata >::iterator it = obj.strExpressionsInfos.begin(); it != obj.strExpressionsInfos.end();)
        {
            if ( it->second.codeExtraInformation.functionCallName.empty() &&
                    it->second.codeExtraInformation.optionalCustomCodeGenerator == boost::shared_ptr<gd::ExpressionCodeGenerationInformation::CustomCodeGenerator>())
            {
                obj.strExpressionsInfos.erase(it++);
            }
            else ++it;
        }
    }

    for(std::map<std::string, gd::EventMetadata >::iterator it = eventsInfos.begin(); it!=eventsInfos.end();)
    {
        if ( it->second.codeGeneration == boost::shared_ptr<gd::EventMetadata::CodeGenerator>())
            eventsInfos.erase(it++);
        else ++it;
    }
}
Exemplo n.º 18
0
void PlatformExtension::CloneExtension(const std::string & platformName, const std::string & extensionName, bool stripFunctionsNameAndCodeGeneration)
{
    gd::Platform* platform = gd::PlatformManager::Get()->GetPlatform(platformName);
    if ( !platform ) {
        std::cout << "Unable to clone extension \""<< extensionName << "\" from " << platformName << ": This platform doesn't exist.";
        return;
    }

    boost::shared_ptr<gd::PlatformExtension> extension = platform->GetExtension(extensionName);
    if ( !extension ) {
        std::cout << "Unable to clone extension \""<< extensionName << "\" from " << platformName << ": This extension doesn't exist.";
        return;
    }

    *this = *extension;

    if ( stripFunctionsNameAndCodeGeneration )
    {
        for (std::map<std::string, gd::InstructionMetadata >::iterator it = GetAllActions().begin(); it != GetAllActions().end(); ++it)
            it->second.codeExtraInformation.SetFunctionName("").SetAssociatedGetter("")
            .SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>());

        for (std::map<std::string, gd::InstructionMetadata >::iterator it = GetAllConditions().begin(); it != GetAllConditions().end(); ++it)
            it->second.codeExtraInformation.SetFunctionName("").SetAssociatedGetter("")
            .SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>());

        for (std::map<std::string, gd::ExpressionMetadata >::iterator it = GetAllExpressions().begin(); it != GetAllExpressions().end(); ++it)
            it->second.codeExtraInformation.SetFunctionName("")
            .SetCustomCodeGenerator(boost::shared_ptr<gd::ExpressionCodeGenerationInformation::CustomCodeGenerator>());

        for (std::map<std::string, gd::StrExpressionMetadata >::iterator it = GetAllStrExpressions().begin(); it != GetAllStrExpressions().end(); ++it)
            it->second.codeExtraInformation.SetFunctionName("")
            .SetCustomCodeGenerator(boost::shared_ptr<gd::ExpressionCodeGenerationInformation::CustomCodeGenerator>());

        for(std::map<std::string, gd::ObjectMetadata >::iterator objIt = objectsInfos.begin(); objIt!=objectsInfos.end(); ++objIt)
        {
            gd::ObjectMetadata & obj = objIt->second;

            for (std::map<std::string, gd::InstructionMetadata >::iterator it = obj.actionsInfos.begin(); it != obj.actionsInfos.end(); ++it)
                it->second.codeExtraInformation.SetFunctionName("").SetAssociatedGetter("")
                .SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>());

            for (std::map<std::string, gd::InstructionMetadata >::iterator it = obj.conditionsInfos.begin(); it != obj.conditionsInfos.end(); ++it)
                it->second.codeExtraInformation.SetFunctionName("").SetAssociatedGetter("")
                .SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>());

            for (std::map<std::string, gd::ExpressionMetadata >::iterator it = obj.expressionsInfos.begin(); it != obj.expressionsInfos.end(); ++it)
                it->second.codeExtraInformation.SetFunctionName("")
                .SetCustomCodeGenerator(boost::shared_ptr<gd::ExpressionCodeGenerationInformation::CustomCodeGenerator>());

            for (std::map<std::string, gd::StrExpressionMetadata >::iterator it = obj.strExpressionsInfos.begin(); it != obj.strExpressionsInfos.end(); ++it)
                it->second.codeExtraInformation.SetFunctionName("")
                .SetCustomCodeGenerator(boost::shared_ptr<gd::ExpressionCodeGenerationInformation::CustomCodeGenerator>());
        }

        for(std::map<std::string, gd::AutomatismMetadata >::iterator objIt = automatismsInfo.begin(); objIt!=automatismsInfo.end(); ++objIt)
        {
            gd::AutomatismMetadata & obj = objIt->second;

            for (std::map<std::string, gd::InstructionMetadata >::iterator it = obj.actionsInfos.begin(); it != obj.actionsInfos.end(); ++it)
                it->second.codeExtraInformation.SetFunctionName("").SetAssociatedGetter("")
                .SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>());

            for (std::map<std::string, gd::InstructionMetadata >::iterator it = obj.conditionsInfos.begin(); it != obj.conditionsInfos.end(); ++it)
                it->second.codeExtraInformation.SetFunctionName("").SetAssociatedGetter("")
                .SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>());

            for (std::map<std::string, gd::ExpressionMetadata >::iterator it = obj.expressionsInfos.begin(); it != obj.expressionsInfos.end(); ++it)
                it->second.codeExtraInformation.SetFunctionName("")
                .SetCustomCodeGenerator(boost::shared_ptr<gd::ExpressionCodeGenerationInformation::CustomCodeGenerator>());

            for (std::map<std::string, gd::StrExpressionMetadata >::iterator it = obj.strExpressionsInfos.begin(); it != obj.strExpressionsInfos.end(); ++it)
                it->second.codeExtraInformation.SetFunctionName("")
                .SetCustomCodeGenerator(boost::shared_ptr<gd::ExpressionCodeGenerationInformation::CustomCodeGenerator>());
        }

        for(std::map<std::string, gd::EventMetadata >::iterator it = eventsInfos.begin(); it!=eventsInfos.end(); ++it)
            it->second.codeGeneration = boost::shared_ptr<gd::EventMetadata::CodeGenerator>();
    }
}
Exemplo n.º 19
0
SceneExtension::SceneExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsSceneExtension(*this);

    SetExtensionInformation("BuiltinScene",
                          _("Scene management features"),
                          _("Built-in extension allowing to manipulate scenes"),
                          "Florian Rival",
                          "Open source (LGPL)");

    GetAllExpressions()["Random"].codeExtraInformation
        .SetFunctionName("gdjs.random");

    GetAllConditions()["DepartScene"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.runtimeScene.sceneJustBegins");
    GetAllActions()["SceneBackground"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.runtimeScene.setBackgroundColor");
    GetAllActions()["Scene"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.runtimeScene.changeScene");
    GetAllActions()["Quit"].codeExtraInformation
        .SetFunctionName("gdjs.evtTools.runtimeScene.stopGame");

    {
        class CodeGenerator : public gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator
        {
            virtual std::string GenerateCode(gd::Instruction & instruction, gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context)
            {
                std::string value1Code;
                {
                    gd::CallbacksForGeneratingExpressionCode callbacks(value1Code, codeGenerator, context);
                    gd::ExpressionParser parser(instruction.GetParameters()[0].GetPlainString());
                    if (!parser.ParseMathExpression(codeGenerator.GetPlatform(), codeGenerator.GetProject(), codeGenerator.GetLayout(), callbacks) || value1Code.empty()) value1Code = "0";
                }

                std::string value2Code;
                {
                    gd::CallbacksForGeneratingExpressionCode callbacks(value2Code, codeGenerator, context);
                    gd::ExpressionParser parser(instruction.GetParameters()[2].GetPlainString());
                    if (!parser.ParseMathExpression(codeGenerator.GetPlatform(), codeGenerator.GetProject(), codeGenerator.GetLayout(), callbacks) || value2Code.empty()) value2Code = "0";
                }

                std::string resultingBoolean = codeGenerator.GenerateBooleanFullName("conditionTrue", context)+".val";

                if ( instruction.GetParameters()[1].GetPlainString() == "=" || instruction.GetParameters()[1].GetPlainString().empty() )
                    return resultingBoolean + " = ("+value1Code+" == "+value2Code+");\n";
                else if ( instruction.GetParameters()[1].GetPlainString() == ">")
                    return resultingBoolean + " = ("+value1Code+" > "+value2Code+");\n";
                else if ( instruction.GetParameters()[1].GetPlainString() == "<")
                    return resultingBoolean + " = ("+value1Code+" < "+value2Code+");\n";
                else if ( instruction.GetParameters()[1].GetPlainString() == "<=")
                    return resultingBoolean + " = ("+value1Code+" <= "+value2Code+");\n";
                else if ( instruction.GetParameters()[1].GetPlainString() == ">=")
                    return resultingBoolean + " = ("+value1Code+" >= "+value2Code+");\n";
                else if ( instruction.GetParameters()[1].GetPlainString() == "!=")
                    return resultingBoolean + " = ("+value1Code+" != "+value2Code+");\n";

                return "";
            };
        };
        gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator * codeGenerator = new CodeGenerator;

        GetAllConditions()["Egal"].codeExtraInformation
            .SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>(codeGenerator));
    }

    StripUnimplementedInstructionsAndExpressions(); //Unimplemented things are listed here:
        /*

    AddAction("DisableInputWhenFocusIsLost",
                   _("Disable input when focus is lost"),
                   _("Set if the keyboard and mouse buttons must be taken into account even\nif the window is not active."),
                   _("Disable input when focus is lost: _PARAM1_"),
                   _("Scene"),
                   "res/actions/window24.png",
                   "res/actions/window.png")
        .AddCodeOnlyParameter("currentScene", "")
        .AddParameter("yesorno", _("Deactivate input when focus is lost"))
        .codeExtraInformation.SetFunctionName("DisableInputWhenFocusIsLost").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");
        */

}
Exemplo n.º 20
0
VariablesExtension::VariablesExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsVariablesExtension(*this);

    SetExtensionInformation("BuiltinVariables",
                          _("Variable features"),
                          _("Built-in extension allowing to manipulate variables"),
                          "Florian Rival",
                          "Open source (LGPL)");

    GetAllConditions()["VarScene"].codeExtraInformation.SetFunctionName("gdjs.evtTools.common.getVariableNumber");
    GetAllConditions()["VarSceneTxt"].codeExtraInformation.SetFunctionName("gdjs.evtTools.common.getVariableString");
    GetAllConditions()["VarGlobal"].codeExtraInformation.SetFunctionName("gdjs.evtTools.common.getVariableNumber");
    GetAllConditions()["VarGlobalTxt"].codeExtraInformation.SetFunctionName("gdjs.evtTools.common.getVariableString");
    GetAllExpressions()["Variable"].codeExtraInformation.SetFunctionName("gdjs.evtTools.common.getVariableNumber");
    GetAllStrExpressions()["VariableString"].codeExtraInformation.SetFunctionName("gdjs.evtTools.common.getVariableString");
    GetAllExpressions()["GlobalVariable"].codeExtraInformation.SetFunctionName("gdjs.evtTools.common.getVariableNumber");
    GetAllStrExpressions()["GlobalVariableString"].codeExtraInformation.SetFunctionName("gdjs.evtTools.common.getVariableString");

    GetAllConditions()["VarSceneDef"].codeExtraInformation.SetFunctionName("gdjs.evtTools.common.sceneVariableExists");
    GetAllConditions()["VarGlobalDef"].codeExtraInformation.SetFunctionName("gdjs.evtTools.common.globalVariableExists");

    GetAllConditions()["VariableChildExists"].codeExtraInformation.SetFunctionName("gdjs.evtTools.common.variableChildExists");
    GetAllConditions()["GlobalVariableChildExists"].codeExtraInformation.SetFunctionName("gdjs.evtTools.common.variableChildExists");
    GetAllActions()["VariableRemoveChild"].codeExtraInformation.SetFunctionName("gdjs.evtTools.common.variableRemoveChild");
    GetAllActions()["GlobalVariableRemoveChild"].codeExtraInformation.SetFunctionName("gdjs.evtTools.common.variableRemoveChild");

    {
        class CodeGenerator : public gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator
        {
            virtual std::string GenerateCode(gd::Instruction & instruction, gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context)
            {
                std::string expressionCode;
                {
                    gd::CallbacksForGeneratingExpressionCode callbacks(expressionCode, codeGenerator, context);
                    gd::ExpressionParser parser(instruction.GetParameters()[2].GetPlainString());
                    if (!parser.ParseMathExpression(codeGenerator.GetPlatform(), codeGenerator.GetProject(), codeGenerator.GetLayout(), callbacks) || expressionCode.empty())
                        expressionCode = "0";
                }
                std::string varGetter;
                {
                    VariableCodeGenerationCallbacks callbacks(varGetter, codeGenerator, context, VariableCodeGenerationCallbacks::LAYOUT_VARIABLE);
                    gd::VariableParser parser(instruction.GetParameters()[0].GetPlainString());
                    if ( !parser.Parse(callbacks) )
                        varGetter = "runtimeScene.getVariables().get(\"\")";
                }

                std::string op = instruction.GetParameters()[1].GetPlainString();
                if ( op == "=" )
                    return varGetter+".setNumber("+expressionCode+");\n";
                else if ( op == "+" )
                    return varGetter+".add("+expressionCode+");\n";
                else if ( op == "-" )
                    return varGetter+".sub("+expressionCode+");\n";
                else if ( op == "*" )
                    return varGetter+".mul("+expressionCode+");\n";
                else if ( op == "/" )
                    return varGetter+".div("+expressionCode+");\n";

                return "";
            };
        };

        gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator * codeGen = new CodeGenerator;
        GetAllActions()["ModVarScene"].codeExtraInformation.SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>(codeGen));
    }
    {
        class CodeGenerator : public gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator
        {
            virtual std::string GenerateCode(gd::Instruction & instruction, gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context)
            {
                std::string expressionCode;
                {
                    gd::CallbacksForGeneratingExpressionCode callbacks(expressionCode, codeGenerator, context);
                    gd::ExpressionParser parser(instruction.GetParameters()[2].GetPlainString());
                    if (!parser.ParseStringExpression(codeGenerator.GetPlatform(), codeGenerator.GetProject(), codeGenerator.GetLayout(), callbacks) || expressionCode.empty())
                        expressionCode = "\"\"";
                }

                std::string varGetter;
                {
                    VariableCodeGenerationCallbacks callbacks(varGetter, codeGenerator, context, VariableCodeGenerationCallbacks::LAYOUT_VARIABLE);
                    gd::VariableParser parser(instruction.GetParameters()[0].GetPlainString());
                    if ( !parser.Parse(callbacks) )
                        varGetter = "runtimeScene.getVariables().get(\"\")";
                }

                std::string op = instruction.GetParameters()[1].GetPlainString();
                if ( op == "=" )
                    return varGetter+".setString("+expressionCode+");\n";
                else if ( op == "+" )
                    return varGetter+".concatenate("+expressionCode+");\n";

                return "";
            };
        };

        gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator * codeGen = new CodeGenerator;
        GetAllActions()["ModVarSceneTxt"].codeExtraInformation.SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>(codeGen));
    }
    {
        class CodeGenerator : public gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator
        {
            virtual std::string GenerateCode(gd::Instruction & instruction, gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context)
            {
                std::string expressionCode;
                {
                    gd::CallbacksForGeneratingExpressionCode callbacks(expressionCode, codeGenerator, context);
                    gd::ExpressionParser parser(instruction.GetParameters()[2].GetPlainString());
                    if (!parser.ParseMathExpression(codeGenerator.GetPlatform(), codeGenerator.GetProject(), codeGenerator.GetLayout(), callbacks) || expressionCode.empty())
                        expressionCode = "0";
                }
                std::string varGetter;
                {
                    VariableCodeGenerationCallbacks callbacks(varGetter, codeGenerator, context, VariableCodeGenerationCallbacks::PROJECT_VARIABLE);
                    gd::VariableParser parser(instruction.GetParameters()[0].GetPlainString());
                    if ( !parser.Parse(callbacks) )
                        varGetter = "runtimeScene.getVariables().get(\"\")";
                }

                std::string op = instruction.GetParameters()[1].GetPlainString();
                if ( op == "=" )
                    return varGetter+".setNumber("+expressionCode+");\n";
                else if ( op == "+" )
                    return varGetter+".add("+expressionCode+");\n";
                else if ( op == "-" )
                    return varGetter+".sub("+expressionCode+");\n";
                else if ( op == "*" )
                    return varGetter+".mul("+expressionCode+");\n";
                else if ( op == "/" )
                    return varGetter+".div("+expressionCode+");\n";

                return "";
            };
        };

        gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator * codeGen = new CodeGenerator;
        GetAllActions()["ModVarGlobal"].codeExtraInformation.SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>(codeGen));
    }
    {
        class CodeGenerator : public gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator
        {
            virtual std::string GenerateCode(gd::Instruction & instruction, gd::EventsCodeGenerator & codeGenerator, gd::EventsCodeGenerationContext & context)
            {
                std::string expressionCode;
                {
                    gd::CallbacksForGeneratingExpressionCode callbacks(expressionCode, codeGenerator, context);
                    gd::ExpressionParser parser(instruction.GetParameters()[2].GetPlainString());
                    if (!parser.ParseStringExpression(codeGenerator.GetPlatform(), codeGenerator.GetProject(), codeGenerator.GetLayout(), callbacks) || expressionCode.empty())
                        expressionCode = "\"\"";
                }

                std::string varGetter;
                {
                    VariableCodeGenerationCallbacks callbacks(varGetter, codeGenerator, context, VariableCodeGenerationCallbacks::PROJECT_VARIABLE);
                    gd::VariableParser parser(instruction.GetParameters()[0].GetPlainString());
                    if ( !parser.Parse(callbacks) )
                        varGetter = "runtimeScene.getVariables().get(\"\")";
                }

                std::string op = instruction.GetParameters()[1].GetPlainString();
                if ( op == "=" )
                    return varGetter+".setString("+expressionCode+");\n";
                else if ( op == "+" )
                    return varGetter+".concatenate("+expressionCode+");\n";

                return "";
            };
        };

        gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator * codeGen = new CodeGenerator;
        GetAllActions()["ModVarGlobalTxt"].codeExtraInformation.SetCustomCodeGenerator(boost::shared_ptr<gd::InstructionMetadata::ExtraInformation::CustomCodeGenerator>(codeGen));
    }
}
Exemplo n.º 21
0
SpriteExtension::SpriteExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsSpriteExtension(*this);

    SetExtensionInformation("Sprite",
                          _("Sprite"),
                          _("Extension for adding animated objects in the scene, which can contain animations with directions within each."),
                          "Florian Rival",
                          "Open source (MIT License)");

    std::map<gd::String, gd::InstructionMetadata > & spriteActions = GetAllActionsForObject("Sprite");
    std::map<gd::String, gd::InstructionMetadata > & spriteConditions = GetAllConditionsForObject("Sprite");
    std::map<gd::String, gd::ExpressionMetadata > & spriteExpressions = GetAllExpressionsForObject("Sprite");
    spriteActions["ChangeBlendMode"].SetFunctionName("setBlendMode").SetIncludeFile("spriteruntimeobject.js");
    spriteActions["Opacity"].SetFunctionName("setOpacity").SetGetter("getOpacity").SetIncludeFile("spriteruntimeobject.js");
    spriteConditions["BlendMode"].SetFunctionName("getBlendMode").SetIncludeFile("spriteruntimeobject.js");
    spriteConditions["Opacity"].SetFunctionName("getOpacity").SetIncludeFile("spriteruntimeobject.js");

    spriteActions["ChangeAnimation"].SetFunctionName("setAnimation").SetGetter("getAnimation");
    spriteActions["ChangeDirection"].SetFunctionName("setDirectionOrAngle").SetGetter("getDirectionOrAngle");
    spriteActions["ChangeSprite"].SetFunctionName("setAnimationFrame").SetGetter("getAnimationFrame");
    spriteConditions["Animation"].SetFunctionName("getAnimation");
    spriteConditions["Direction"].SetFunctionName("getDirectionOrAngle");
    spriteConditions["Sprite"].SetFunctionName("getAnimationFrame");
    spriteConditions["AnimationEnded"].SetFunctionName("hasAnimationEnded");
    spriteActions["PauseAnimation"].SetFunctionName("pauseAnimation");
    spriteActions["PlayAnimation"].SetFunctionName("playAnimation");
    spriteConditions["AnimStopped"].SetFunctionName("animationPaused");
    spriteActions["ChangeAnimationSpeedScale"].SetFunctionName("setAnimationSpeedScale").SetGetter("getAnimationSpeedScale").SetManipulatedType("number").SetIncludeFile("spriteruntimeobject.js");


    spriteActions["ChangeScaleWidth"].SetFunctionName("setScaleX").SetGetter("getScaleX");
    spriteActions["ChangeScaleHeight"].SetFunctionName("setScaleY").SetGetter("getScaleY");
    spriteActions["ChangeScale"].SetFunctionName("setScale").SetManipulatedType("number").SetGetter("getScale");
    spriteConditions["ScaleWidth"].SetFunctionName("getScaleX");
    spriteConditions["ScaleHeight"].SetFunctionName("getScaleY");
    spriteActions["TourneVersPos"].SetFunctionName("rotateTowardPosition");
    spriteActions["TourneVers"].SetFunctionName("turnTowardObject");
    spriteActions["ChangeColor"].SetFunctionName("setColor");
    spriteActions["FlipX"].SetFunctionName("flipX");
    spriteActions["FlipY"].SetFunctionName("flipY");
    spriteConditions["FlippedX"].SetFunctionName("isFlippedX");
    spriteConditions["FlippedY"].SetFunctionName("isFlippedY");

    GetAllConditions()["Collision"]
        .AddCodeOnlyParameter("currentScene", "") //We need an extra parameter pointing to the scene.
        .SetFunctionName("gdjs.evtTools.object.hitBoxesCollisionTest"); //No pixel perfect collision for now on the JS platform.

    spriteExpressions["X"].SetFunctionName("getPointX");
    spriteExpressions["Y"].SetFunctionName("getPointY");
    spriteExpressions["PointX"].SetFunctionName("getPointX");
    spriteExpressions["PointY"].SetFunctionName("getPointY");
    spriteExpressions["Direc"].SetFunctionName("getDirectionOrAngle"); //Deprecated
    spriteExpressions["Direction"].SetFunctionName("getDirectionOrAngle");
    spriteExpressions["Anim"].SetFunctionName("getAnimation"); //Deprecated
    spriteExpressions["Animation"].SetFunctionName("getAnimation");
    spriteExpressions["Sprite"].SetFunctionName("getAnimationFrame");
    spriteExpressions["AnimationSpeedScale"].SetFunctionName("getAnimationSpeedScale");
    spriteExpressions["ScaleX"].SetFunctionName("getScaleX");
    spriteExpressions["ScaleY"].SetFunctionName("getScaleY");


    StripUnimplementedInstructionsAndExpressions(); //Unimplemented things are listed here:
/*
    //Objects instructions:
    {
        obj.AddAction("CopyImageOnImageOfSprite",
                       _("Copy an image on the current one of an object"),
                       _("Copy an image on the current image of an object.\nNote that the source image must be preferably kept loaded in memory."),
                       _("Copy image _PARAM2_ on the current of _PARAM0_ at _PARAM3_;_PARAM4_"),
                       _("Effects"),
                       "res/copy24.png",
                       "res/copyicon.png")

            .AddParameter("object", _("Object"), "Sprite")
            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Name of the source image"))
            .AddParameter("expression", _("X position"))
            .AddParameter("expression", _("Y position"))
            .AddParameter("yesorno", _("Should the copy take in account the source transparency\?"))
            .SetFunctionName("CopyImageOnImageOfCurrentSprite").SetIncludeFile("GDCpp/RuntimeSpriteObject.h");



        obj.AddAction("CreateMaskFromColorOnActualImage", //Actual is indeed a mistake : Current should have been chosen.
                       _("Make a color of the image of an object transparent"),
                       _("Make a color of the image of an object transparent."),
                       _("Make color _PARAM1_ of the current image of _PARAM0_ transparent"),
                       _("Effects"),
                       "res/actions/opacity24.png",
                       "res/actions/opacity.png")

            .AddParameter("object", _("Object"), "Sprite")
            .AddParameter("color", _("Color to make transparent"))
            .SetFunctionName("MakeColorTransparent").SetIncludeFile("GDCpp/RuntimeSpriteObject.h");
    }

*/
}
Exemplo n.º 22
0
FileExtension::FileExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsFileExtension(*this);

    SetExtensionInformation("BuiltinFile",
                          _("Files"),
                          _("Built-in extension providing functions for storing data."),
                          "Florian Rival",
                          "Open source (LGPL)");

    GetAllActions()["LoadFile"]
        .codeExtraInformation.SetFunctionName("gdjs.evtTools.storage.loadJSONFileFromStorage");
    GetAllConditions()["GroupExists"]
        .codeExtraInformation.SetFunctionName("gdjs.evtTools.storage.elementExistsInJSONFile");
    GetAllActions()["UnloadFile"]
        .codeExtraInformation.SetFunctionName("gdjs.evtTools.storage.unloadJSONFile");
    GetAllActions()["EcrireFichierExp"]
        .codeExtraInformation.SetFunctionName("gdjs.evtTools.storage.writeNumberInJSONFile");
    GetAllActions()["EcrireFichierTxt"]
        .codeExtraInformation.SetFunctionName("gdjs.evtTools.storage.writeStringInJSONFile");
    GetAllActions()["LireFichierExp"]
        .codeExtraInformation.SetFunctionName("gdjs.evtTools.storage.readNumberFromJSONFile");
    GetAllActions()["LireFichierTxt"]
        .codeExtraInformation.SetFunctionName("gdjs.evtTools.storage.readStringFromJSONFile");
    GetAllActions()["DeleteGroupFichier"]
        .codeExtraInformation.SetFunctionName("gdjs.evtTools.storage.deleteElementFromJSONFile");
    GetAllActions()["DeleteFichier"].SetGroup(_("Storage"))
        .codeExtraInformation.SetFunctionName("gdjs.evtTools.storage.clearJSONFile");

    StripUnimplementedInstructionsAndExpressions(); //Unimplemented things are listed here:
    /*
    AddCondition("FileExists",
                   _("A file exists"),
                   _("Test if the file exists."),
                   _("The file _PARAM0_ exists"),
                   _("Files"),
                   "res/conditions/fichier24.png",
                   "res/conditions/fichier.png")
        .AddParameter("file", _("Filename"), "",false)
        .codeExtraInformation.SetFunctionName("FileExists").SetIncludeFile("GDCpp/BuiltinExtensions/FileTools.h");

    AddAction("LaunchFile",
                   _("Launch a file"),
                   _("This action launch the specified file."),
                   _("Launch the file _PARAM0_"),
                   _("Files"),
                   "res/actions/launchFile24.png",
                   "res/actions/launchFile.png")
        .AddParameter("file", _("Filename"), "",false)
        .codeExtraInformation.SetFunctionName("LaunchFile").SetIncludeFile("GDCpp/BuiltinExtensions/FileTools.h");

    AddAction("ExecuteCmd",
                   _("Execute a command"),
                   _("This action execute the specified command."),
                   _("Execute _PARAM0_"),
                   _("Files"),
                   "res/actions/launchFile24.png",
                   "res/actions/launchFile.png")
        .AddParameter("string", _("Command"), "",false)
        .codeExtraInformation.SetFunctionName("ExecuteCmd").SetIncludeFile("GDCpp/BuiltinExtensions/FileTools.h");
    */
}
Exemplo n.º 23
0
SpriteExtension::SpriteExtension()
{
    SetExtensionInformation("Sprite",
                          _("Sprite"),
                          _("Extension for adding animated objects in the scene, which can contain animations with directions within each."),
                          "Florian Rival",
                          "Open source ( LGPL )");
    CloneExtension("Game Develop C++ platform", "Sprite");

    std::map<std::string, gd::InstructionMetadata > & spriteActions = GetAllActionsForObject("Sprite");
    std::map<std::string, gd::InstructionMetadata > & spriteConditions = GetAllConditionsForObject("Sprite");
    std::map<std::string, gd::ExpressionMetadata > & spriteExpressions = GetAllExpressionsForObject("Sprite");
    spriteActions["ChangeBlendMode"].codeExtraInformation.
        SetFunctionName("setBlendMode").SetIncludeFile("spriteruntimeobject.js");
    spriteActions["Opacity"].codeExtraInformation.
        SetFunctionName("setOpacity").SetAssociatedGetter("getOpacity").SetIncludeFile("spriteruntimeobject.js");
    spriteConditions["BlendMode"].codeExtraInformation.
        SetFunctionName("getBlendMode").SetIncludeFile("spriteruntimeobject.js");
    spriteConditions["Opacity"].codeExtraInformation.
        SetFunctionName("getOpacity").SetIncludeFile("spriteruntimeobject.js");

    spriteActions["ChangeAnimation"].codeExtraInformation.
        SetFunctionName("setAnimation").SetAssociatedGetter("getAnimation");
    spriteActions["ChangeDirection"].codeExtraInformation.
        SetFunctionName("setDirectionOrAngle").SetAssociatedGetter("getDirectionOrAngle");
    spriteActions["ChangeSprite"].codeExtraInformation.
        SetFunctionName("setAnimationFrame").SetAssociatedGetter("getAnimationFrame");
    spriteConditions["Animation"].codeExtraInformation.
        SetFunctionName("getAnimation");
    spriteConditions["Direction"].codeExtraInformation.
        SetFunctionName("getDirectionOrAngle");
    spriteConditions["Sprite"].codeExtraInformation.
        SetFunctionName("getAnimationFrame");
    spriteConditions["AnimationEnded"].codeExtraInformation.
        SetFunctionName("hasAnimationEnded");
    spriteActions["PauseAnimation"].codeExtraInformation.
        SetFunctionName("pauseAnimation");
    spriteActions["PlayAnimation"].codeExtraInformation.
        SetFunctionName("playAnimation");
    spriteConditions["AnimStopped"].codeExtraInformation.
        SetFunctionName("animationPaused");

    spriteActions["ChangeScaleWidth"].codeExtraInformation.
        SetFunctionName("setScaleX").SetAssociatedGetter("getScaleX");
    spriteActions["ChangeScaleHeight"].codeExtraInformation.
        SetFunctionName("setScaleY").SetAssociatedGetter("getScaleY");
    spriteActions["ChangeScale"].codeExtraInformation.
        SetFunctionName("setScale").SetManipulatedType("number").SetAssociatedGetter("getScale");
    spriteConditions["ScaleWidth"].codeExtraInformation
        .SetFunctionName("getScaleX");
    spriteConditions["ScaleHeight"].codeExtraInformation
        .SetFunctionName("getScaleY");
    spriteActions["TourneVersPos"].codeExtraInformation.
        SetFunctionName("turnTowardPosition");
    spriteActions["TourneVers"].codeExtraInformation.
        SetFunctionName("turnTowardObject");
    spriteActions["FlipX"].codeExtraInformation.
        SetFunctionName("flipX");
    spriteActions["FlipY"].codeExtraInformation.
        SetFunctionName("flipY");

    spriteConditions["SourisSurObjet"].codeExtraInformation.
        SetFunctionName("cursorOnObject");

    GetAllConditions()["Collision"]
        .AddCodeOnlyParameter("currentScene", "") //We need an extra parameter pointing to the scene.
        .codeExtraInformation //No pixel perfect collision for now on the JS platform.
        .SetFunctionName("gdjs.evtTools.object.hitBoxesCollisionTest");

    spriteExpressions["X"].codeExtraInformation.
        SetFunctionName("getPointX");
    spriteExpressions["Y"].codeExtraInformation.
        SetFunctionName("getPointY");
    spriteExpressions["PointX"].codeExtraInformation.
        SetFunctionName("getPointX");
    spriteExpressions["PointY"].codeExtraInformation.
        SetFunctionName("getPointY");
    spriteExpressions["Direc"].codeExtraInformation. //Deprecated
        SetFunctionName("getDirectionOrAngle");
    spriteExpressions["Direction"].codeExtraInformation.
        SetFunctionName("getDirectionOrAngle");
    spriteExpressions["Anim"].codeExtraInformation.  //Deprecated
        SetFunctionName("getAnimation");
    spriteExpressions["Animation"].codeExtraInformation.
        SetFunctionName("getAnimation");
    spriteExpressions["Sprite"].codeExtraInformation.
        SetFunctionName("getAnimationFrame");
    spriteExpressions["ScaleX"].codeExtraInformation.
        SetFunctionName("getScaleX");
    spriteExpressions["ScaleY"].codeExtraInformation.
        SetFunctionName("getScaleY");


    StripUnimplementedInstructionsAndExpressions(); //Unimplemented things are listed here:
/*
    //Objects instructions:
    {
        obj.AddCondition("BlendMode",
                       _("Blend mode"),
                       _("Compare the number of the blend mode currently used by an object"),
                       _("The number of the current blend mode of _PARAM0_ is _PARAM1__PARAM2_"),
                       _("Effects"),
                       "res/conditions/opacity24.png",
                       "res/conditions/opacity.png")

            .AddParameter("object", _("Object"), "Sprite", false)
            .AddParameter("relationalOperator", _("Sign of the test"), "",false)
            .AddParameter("expression", _("Value to test  ( 0 : Alpha, 1 : Add, 2 : Multiply, 3 : None )"), "",false)
            .codeExtraInformation.SetFunctionName("GetBlendMode").SetManipulatedType("number").SetIncludeFile("GDCpp/SpriteObject.h");

        obj.AddAction("CopyImageOnImageOfSprite",
                       _("Copy an image on the current one of an object"),
                       _("Copy an image on the current image of an object.\nNote that the source image must be preferably kept loaded in memory."),
                       _("Copy image _PARAM2_ on the current of _PARAM0_ at _PARAM3_;_PARAM4_"),
                       _("Effects"),
                       "res/copy24.png",
                       "res/copyicon.png")

            .AddParameter("object", _("Object"), "Sprite", false)
            .AddCodeOnlyParameter("currentScene", "")
            .AddParameter("string", _("Name of the source image"), "",false)
            .AddParameter("expression", _("X position"), "",false)
            .AddParameter("expression", _("Y position"), "",false)
            .AddParameter("yesorno", _("Should the copy take in account the source transparency\?"), "",false)
            .codeExtraInformation.SetFunctionName("CopyImageOnImageOfCurrentSprite").SetIncludeFile("GDCpp/SpriteObject.h");



        obj.AddAction("CreateMaskFromColorOnActualImage", //Actual is indeed a mistake : Current should have been chosen.
                       _("Make a color of the image of an object transparent"),
                       _("Make a color of the image of an object transparent."),
                       _("Make color _PARAM1_ of the current image of _PARAM0_ transparent"),
                       _("Effects"),
                       "res/actions/opacity24.png",
                       "res/actions/opacity.png")

            .AddParameter("object", _("Object"), "Sprite", false)
            .AddParameter("color", _("Color to make transparent"), "",false)
            .codeExtraInformation.SetFunctionName("MakeColorTransparent").SetIncludeFile("GDCpp/SpriteObject.h");


        obj.AddAction("ChangeColor",
                       _("Change the global color"),
                       _("Change the global color of an object. The default color is white."),
                       _("Change color of _PARAM0_ to _PARAM1_"),
                       _("Effects"),
                       "res/actions/color24.png",
                       "res/actions/color.png")

            .AddParameter("object", _("Object"), "Sprite", false)
            .AddParameter("color", _("Color"), "",false)
            .codeExtraInformation.SetFunctionName("SetColor").SetIncludeFile("GDCpp/SpriteObject.h");


        obj.AddAction("ChangeBlendMode",
                       _("Change Blend mode"),
                       _("Change the number of the blend mode of an object.\nThe default blend mode is 0 ( Alpha )."),
                       _("Change Blend mode of _PARAM0_ to _PARAM1_"),
                       _("Effects"),
                       "res/actions/color24.png",
                       "res/actions/color.png")

            .AddParameter("object", _("Object"), "Sprite", false)
            .AddParameter("expression", _("Mode ( 0 : Alpha, 1 : Add, 2 : Multiply, 3 : None )"), "",false)
            .codeExtraInformation.SetFunctionName("SetBlendMode").SetIncludeFile("GDCpp/SpriteObject.h");
        #endif

    }

*/
}
Exemplo n.º 24
0
BaseObjectExtension::BaseObjectExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(*this);

    gd::ObjectMetadata & obj = GetObjectMetadata("");
    AddRuntimeObject(obj, "", &CreateBaseRuntimeObject);

    #if defined(GD_IDE_ONLY)
    std::map<gd::String, gd::InstructionMetadata > & objectActions = GetAllActionsForObject("");
    std::map<gd::String, gd::InstructionMetadata > & objectConditions = GetAllConditionsForObject("");
    std::map<gd::String, gd::ExpressionMetadata > & objectExpressions = GetAllExpressionsForObject("");
    std::map<gd::String, gd::ExpressionMetadata > & objectStrExpressions = GetAllStrExpressionsForObject("");

    objectConditions["PosX"].SetFunctionName("GetX").SetManipulatedType("number");
    objectActions["MettreX"].SetFunctionName("SetX").SetManipulatedType("number").SetGetter("GetX");
    objectConditions["PosY"].SetFunctionName("GetY").SetManipulatedType("number");
    objectActions["MettreY"].SetFunctionName("SetY").SetManipulatedType("number").SetGetter("GetY");
    objectActions["MettreXY"].SetFunctionName("SetXY");
    objectConditions["Angle"].SetFunctionName("GetAngle");

    objectActions["SetAngle"].SetFunctionName("SetAngle").SetManipulatedType("number").SetGetter("GetAngle");
    objectActions["Rotate"].SetFunctionName("Rotate");
    objectActions["RotateTowardAngle"].SetFunctionName("RotateTowardAngle");
    objectActions["RotateTowardPosition"].SetFunctionName("RotateTowardPosition");

    objectActions["MettreAutourPos"].SetFunctionName("PutAroundAPosition");
    objectActions["AddForceXY"].SetFunctionName("AddForce");
    objectActions["AddForceAL"].SetFunctionName("AddForceUsingPolarCoordinates");
    objectActions["AddForceVersPos"].SetFunctionName("AddForceTowardPosition");
    objectActions["AddForceTournePos"].SetFunctionName("AddForceToMoveAround");
    objectActions["Arreter"].SetFunctionName("ClearForce");
    objectActions["Delete"].SetFunctionName("DeleteFromScene");
    objectActions["ChangePlan"].SetFunctionName("SetZOrder").SetGetter("GetZOrder").SetManipulatedType("number");
    objectActions["ChangeLayer"].SetFunctionName("SetLayer");

    objectActions["ModVarObjet"].SetFunctionName("ReturnVariable").SetManipulatedType("number");
    objectActions["ModVarObjetTxt"].SetFunctionName("ReturnVariable").SetManipulatedType("string");
    objectConditions["ObjectVariableChildExists"].SetFunctionName("VariableChildExists");
    objectActions["ObjectVariableRemoveChild"].SetFunctionName("VariableRemoveChild");

    objectActions["Cache"].SetFunctionName("SetHidden");
    objectActions["Montre"].SetFunctionName("SetHidden");

    objectConditions["Plan"].SetFunctionName("GetZOrder").SetManipulatedType("number");
    objectConditions["Layer"].SetFunctionName("IsOnLayer");
    objectConditions["Visible"].SetFunctionName("IsVisible");
    objectConditions["Invisible"].SetFunctionName("IsHidden");
    objectConditions["Arret"].SetFunctionName("IsStopped");
    objectConditions["Vitesse"].SetFunctionName("TotalForceLength").SetManipulatedType("number");
    objectConditions["AngleOfDisplacement"].SetFunctionName("TestAngleOfDisplacement");
    objectConditions["VarObjet"].SetFunctionName("ReturnVariable").SetManipulatedType("number");
    objectConditions["VarObjetTxt"].SetFunctionName("ReturnVariable").SetManipulatedType("string");
    objectConditions["VarObjetDef"].SetFunctionName("VariableExists");
    objectConditions["BehaviorActivated"].SetFunctionName("BehaviorActivated");
    objectActions["ActivateBehavior"].SetFunctionName("ActivateBehavior");
    objectActions["AddForceVers"].SetFunctionName("AddForceTowardObject").SetIncludeFile("GDCpp/BuiltinExtensions/ObjectTools.h");
    objectActions["AddForceTourne"].SetFunctionName("AddForceToMoveAroundObject").SetIncludeFile("GDCpp/BuiltinExtensions/ObjectTools.h");
    objectActions["MettreAutour"].SetFunctionName("PutAroundObject").SetIncludeFile("GDCpp/BuiltinExtensions/ObjectTools.h");
    objectActions["Rebondir"].SetFunctionName("SeparateObjectsWithForces").SetIncludeFile("GDCpp/BuiltinExtensions/ObjectTools.h");
    objectActions["Ecarter"].SetFunctionName("SeparateObjectsWithoutForces").SetIncludeFile("GDCpp/BuiltinExtensions/ObjectTools.h");
    objectActions["SeparateFromObjects"].SetFunctionName("SeparateFromObjects").SetIncludeFile("GDCpp/BuiltinExtensions/ObjectTools.h");


    objectExpressions["X"].SetFunctionName("GetX");
    objectExpressions["Y"].SetFunctionName("GetY");
    objectExpressions["ForceX"].SetFunctionName("TotalForceX");
    objectExpressions["ForceY"].SetFunctionName("TotalForceY");
    objectExpressions["ForceAngle"].SetFunctionName("TotalForceAngle");
    objectExpressions["Angle"].SetFunctionName("GetAngle");
    objectExpressions["ForceLength"].SetFunctionName("TotalForceLength");
    objectExpressions["Longueur"].SetFunctionName("TotalForceLength");
    objectExpressions["Width"].SetFunctionName("GetWidth");
    objectExpressions["Largeur"].SetFunctionName("GetWidth");
    objectExpressions["Height"].SetFunctionName("GetHeight");
    objectExpressions["Hauteur"].SetFunctionName("GetHeight");
    objectExpressions["ZOrder"].SetFunctionName("GetZOrder");
    objectExpressions["Plan"].SetFunctionName("GetZOrder");
    objectExpressions["Distance"].SetFunctionName("GetDistanceWithObject");
    objectExpressions["SqDistance"].SetFunctionName("GetSqDistanceWithObject");
    objectExpressions["Variable"].SetFunctionName("GetVariableValue").SetStatic();
    objectStrExpressions["VariableString"].SetFunctionName("GetVariableString").SetStatic();

    GetAllActions()["Create"].SetFunctionName("CreateObjectOnScene").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");
    GetAllActions()["CreateByName"].SetFunctionName("CreateObjectFromGroupOnScene").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");
    GetAllActions()["AjoutObjConcern"].SetFunctionName("PickAllObjects").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");
    GetAllActions()["AjoutHasard"].SetFunctionName("PickRandomObject").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");
    GetAllActions()["MoveObjects"].SetFunctionName("MoveObjects").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");

    GetAllConditions()["SeDirige"].SetFunctionName("MovesToward").SetIncludeFile("GDCpp/BuiltinExtensions/ObjectTools.h");
    GetAllConditions()["Distance"].SetFunctionName("DistanceBetweenObjects").SetIncludeFile("GDCpp/BuiltinExtensions/ObjectTools.h");
    GetAllConditions()["AjoutObjConcern"].SetFunctionName("PickAllObjects").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");
    GetAllConditions()["AjoutHasard"].SetFunctionName("PickRandomObject").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");
    GetAllConditions()["PickNearest"].SetFunctionName("PickNearestObject").SetIncludeFile("GDCpp/BuiltinExtensions/RuntimeSceneTools.h");
    GetAllConditions()["NbObjet"].SetFunctionName("PickedObjectsCount").SetManipulatedType("number").SetIncludeFile("GDCpp/BuiltinExtensions/ObjectTools.h");
    GetAllConditions()["CollisionNP"].SetFunctionName("HitBoxesCollision").SetIncludeFile("GDCpp/BuiltinExtensions/ObjectTools.h");
    GetAllConditions()["EstTourne"].SetFunctionName("ObjectsTurnedToward").SetIncludeFile("GDCpp/BuiltinExtensions/ObjectTools.h");

    GetAllExpressions()["Count"].SetFunctionName("PickedObjectsCount").SetIncludeFile("GDCpp/BuiltinExtensions/ObjectTools.h");
    #endif
}
Exemplo n.º 25
0
SpriteExtension::SpriteExtension()
{
    gd::BuiltinExtensionsImplementer::ImplementsSpriteExtension(*this);

    gd::ObjectMetadata & obj = GetObjectMetadata("Sprite");
    AddRuntimeObject<gd::SpriteObject, RuntimeSpriteObject>(obj, "RuntimeSpriteObject");

    #if defined(GD_IDE_ONLY)
    obj.SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");

    std::map<gd::String, gd::InstructionMetadata > & objectActions = GetAllActionsForObject("Sprite");
    std::map<gd::String, gd::InstructionMetadata > & objectConditions = GetAllConditionsForObject("Sprite");
    std::map<gd::String, gd::ExpressionMetadata > & objectExpressions = GetAllExpressionsForObject("Sprite");

    objectActions["Opacity"].SetFunctionName("SetOpacity").SetGetter("GetOpacity").SetManipulatedType("number").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectActions["ChangeAnimation"].SetFunctionName("SetCurrentAnimation").SetGetter("GetCurrentAnimation").SetManipulatedType("number").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectActions["ChangeDirection"].SetFunctionName("SetDirection").SetGetter("GetCurrentDirectionOrAngle").SetManipulatedType("number").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectActions["ChangeSprite"].SetFunctionName("SetSprite").SetGetter("GetSpriteNb").SetManipulatedType("number").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectActions["PauseAnimation"].SetFunctionName("StopAnimation").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectActions["PlayAnimation"].SetFunctionName("PlayAnimation").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectActions["ChangeAnimationSpeedScale"].SetFunctionName("SetAnimationSpeedScale").SetGetter("GetAnimationSpeedScale").SetManipulatedType("number").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectActions["TourneVersPos"].SetFunctionName("RotateTowardPosition").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectActions["ChangeScale"].SetFunctionName("ChangeScale").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectActions["ChangeScaleWidth"].SetFunctionName("SetScaleX").SetGetter("GetScaleX").SetManipulatedType("number").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectActions["ChangeScaleHeight"].SetFunctionName("SetScaleY").SetGetter("GetScaleY").SetManipulatedType("number").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");

    objectConditions["Animation"].SetFunctionName("GetCurrentAnimation").SetManipulatedType("number").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectConditions["Direction"].SetFunctionName("GetCurrentDirectionOrAngle").SetManipulatedType("number").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectConditions["Sprite"].SetFunctionName("GetSpriteNb").SetManipulatedType("number").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectConditions["AnimStopped"].SetFunctionName("IsAnimationStopped").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectConditions["AnimationEnded"].SetFunctionName("AnimationEnded").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectConditions["ScaleWidth"].SetFunctionName("GetScaleX").SetManipulatedType("number").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectConditions["ScaleHeight"].SetFunctionName("GetScaleY").SetManipulatedType("number").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectConditions["Opacity"].SetFunctionName("GetOpacity").SetManipulatedType("number").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectConditions["BlendMode"].SetFunctionName("GetBlendMode").SetManipulatedType("number").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");

    objectActions["CopyImageOnImageOfSprite"].SetFunctionName("CopyImageOnImageOfCurrentSprite").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectActions["CreateMaskFromColorOnActualImage"].SetFunctionName("MakeColorTransparent").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectActions["ChangeColor"].SetFunctionName("SetColor").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectActions["ChangeBlendMode"].SetFunctionName("SetBlendMode").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");

    objectActions["FlipX"].SetFunctionName("FlipX").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectActions["FlipY"].SetFunctionName("FlipY").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectConditions["FlippedX"].SetFunctionName("IsFlippedX").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectConditions["FlippedY"].SetFunctionName("IsFlippedY").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");

    objectActions["TourneVers"].SetFunctionName("TurnTowardObject").SetIncludeFile("GDCpp/Extensions/Builtin/SpriteTools.h");

    objectExpressions["X"].SetFunctionName("GetPointX").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectExpressions["Y"].SetFunctionName("GetPointY").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectExpressions["PointX"].SetFunctionName("GetPointX").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectExpressions["PointY"].SetFunctionName("GetPointY").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectExpressions["Direc"].SetFunctionName("GetCurrentDirectionOrAngle").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectExpressions["Direction"].SetFunctionName("GetCurrentDirectionOrAngle").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectExpressions["Anim"].SetFunctionName("GetCurrentAnimation").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectExpressions["Animation"].SetFunctionName("GetCurrentAnimation").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectExpressions["Sprite"].SetFunctionName("GetSpriteNb").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectExpressions["AnimationSpeedScale"].SetFunctionName("GetAnimationSpeedScale").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectExpressions["ScaleX"].SetFunctionName("GetScaleX").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");
    objectExpressions["ScaleY"].SetFunctionName("GetScaleY").SetIncludeFile("GDCpp/Runtime/RuntimeSpriteObject.h");

    GetAllConditions()["Collision"].SetFunctionName("SpriteCollision").SetIncludeFile("GDCpp/Extensions/Builtin/SpriteTools.h");
    #endif
}