mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Compare commits
98 Commits
v5.1.156
...
fix-admob-
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3476c043f8 | ||
![]() |
e85229d38e | ||
![]() |
e7381a7229 | ||
![]() |
257ba78486 | ||
![]() |
fb3d821368 | ||
![]() |
a5068d8fcf | ||
![]() |
d20b3228cf | ||
![]() |
aae54ef331 | ||
![]() |
caa5105651 | ||
![]() |
5eccdde332 | ||
![]() |
c34d758ccf | ||
![]() |
4e57d6aee9 | ||
![]() |
74d208f736 | ||
![]() |
d88b76becf | ||
![]() |
4a0e2481e6 | ||
![]() |
612b041da4 | ||
![]() |
3df7cd8e80 | ||
![]() |
7ba96ed0ab | ||
![]() |
689cd14947 | ||
![]() |
de50dc7967 | ||
![]() |
1aa2afaf85 | ||
![]() |
9120a52a08 | ||
![]() |
b0ffaebe91 | ||
![]() |
64a4a0b3a1 | ||
![]() |
cdfd7a7ab1 | ||
![]() |
a944ac43db | ||
![]() |
b7a1a96e7b | ||
![]() |
29d71796cc | ||
![]() |
78a1361897 | ||
![]() |
e340784ad6 | ||
![]() |
511466f0b8 | ||
![]() |
3f4e372acb | ||
![]() |
a73a92d748 | ||
![]() |
6e131d8a17 | ||
![]() |
9ac4c021e0 | ||
![]() |
a1fbf91ac7 | ||
![]() |
3f8d01e25e | ||
![]() |
03b4170d74 | ||
![]() |
0146ad9c38 | ||
![]() |
fbb23f86cd | ||
![]() |
1fdaeea4f8 | ||
![]() |
32b97f2c40 | ||
![]() |
d61f8336a8 | ||
![]() |
3448cd57fe | ||
![]() |
b7333612aa | ||
![]() |
de82182b37 | ||
![]() |
a8177b0e6f | ||
![]() |
9716ff14ed | ||
![]() |
f0e1d7a6d9 | ||
![]() |
dd89562405 | ||
![]() |
f0e56c4513 | ||
![]() |
ad2ea0abb8 | ||
![]() |
7ff71ea11f | ||
![]() |
cd1d82f7ee | ||
![]() |
0724b7d113 | ||
![]() |
c58ea73631 | ||
![]() |
b1039c6146 | ||
![]() |
1b5acc9fa9 | ||
![]() |
54cf91f180 | ||
![]() |
a434e4d9a9 | ||
![]() |
2f339dd170 | ||
![]() |
e843ca67ad | ||
![]() |
e4286b2021 | ||
![]() |
4579568866 | ||
![]() |
4543a03530 | ||
![]() |
5aed25a02f | ||
![]() |
6fd9cfe4c3 | ||
![]() |
091324d93b | ||
![]() |
d802bd14b9 | ||
![]() |
f46a6dc421 | ||
![]() |
b09e783b06 | ||
![]() |
e2a050b717 | ||
![]() |
ae22d1b876 | ||
![]() |
9e6e7166ef | ||
![]() |
22c71a8aef | ||
![]() |
4908c84494 | ||
![]() |
e4f44f7899 | ||
![]() |
c441610123 | ||
![]() |
d724712aa4 | ||
![]() |
08fc7d3e9f | ||
![]() |
ba30665811 | ||
![]() |
c72658e2d6 | ||
![]() |
a3fc7585b4 | ||
![]() |
244bc7e274 | ||
![]() |
5a5bf60aac | ||
![]() |
33a69849d9 | ||
![]() |
131ee1534a | ||
![]() |
614c324a63 | ||
![]() |
ca4ff1fa6d | ||
![]() |
0e9ed86b4d | ||
![]() |
3961c2af4a | ||
![]() |
cc4d78b08a | ||
![]() |
8d13285c97 | ||
![]() |
7b7e13817c | ||
![]() |
129ebeb4e4 | ||
![]() |
808f2bc802 | ||
![]() |
c5935232f7 | ||
![]() |
35a8341964 |
4
.github/workflows/build-storybook.yml
vendored
4
.github/workflows/build-storybook.yml
vendored
@@ -57,8 +57,8 @@ jobs:
|
||||
|
||||
- name: Log urls to the Storybook
|
||||
run: |
|
||||
echo "Find the latest Storybook for this branch on http://gdevelop-storybook.s3-website-us-east-1.amazonaws.com/$(git rev-parse --abbrev-ref HEAD)/latest/index.html"
|
||||
echo "Find the Storybook for this commit on http://gdevelop-storybook.s3-website-us-east-1.amazonaws.com/$(git rev-parse --abbrev-ref HEAD)/commit/$(git rev-parse HEAD)/index.html"
|
||||
echo "Find the latest Storybook for this branch on https://gdevelop-storybook.s3.amazonaws.com/$(git rev-parse --abbrev-ref HEAD)/latest/index.html"
|
||||
echo "Find the Storybook for this commit on https://gdevelop-storybook.s3.amazonaws.com/$(git rev-parse --abbrev-ref HEAD)/commit/$(git rev-parse HEAD)/index.html"
|
||||
|
||||
# Publish on Chromatic, only when manually launched (too costly to run on every commit).
|
||||
- name: Publish Storybook to Chromatic
|
||||
|
@@ -15,11 +15,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAsyncExtension(
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"BuiltinAsync",
|
||||
_("Async functions"),
|
||||
_("Asynchronous functions"),
|
||||
_("Functions that defer the execution of the events after it."),
|
||||
"Arthur Pacaud (arthuro555)",
|
||||
"Open source (MIT License)")
|
||||
.SetCategory("Advanced");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Asynchronous functions"))
|
||||
.SetIcon("res/function32.png");
|
||||
|
||||
extension.AddEvent("Async",
|
||||
_("Async event"),
|
||||
@@ -27,6 +29,18 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAsyncExtension(
|
||||
"",
|
||||
"res/eventaddicon.png",
|
||||
std::make_shared<gd::AsyncEvent>());
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"ResolveAsyncEventsFunction",
|
||||
_("End asynchronous function"),
|
||||
_("Mark an asynchronous function as finished. This will allow the "
|
||||
"actions and subevents following it to be run."),
|
||||
"Mark asynchronous function as ended",
|
||||
"",
|
||||
"res/actions/quit24.png",
|
||||
"res/actions/quit.png")
|
||||
.AddCodeOnlyParameter("eventsFunctionContext", "");
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -406,8 +406,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ModVarObjet",
|
||||
_("Value of an object variable"),
|
||||
_("Change the value of an object variable."),
|
||||
_("Change number variable"),
|
||||
_("Modify the number value of an object variable."),
|
||||
_("the variable _PARAM1_"),
|
||||
_("Variables"),
|
||||
"res/actions/var24.png",
|
||||
@@ -419,8 +419,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("ModVarObjetTxt",
|
||||
_("Text of an object variable"),
|
||||
_("Change the text of an object variable."),
|
||||
_("Change text variable"),
|
||||
_("Modify the text of an object variable."),
|
||||
_("the text of variable _PARAM1_"),
|
||||
_("Variables"),
|
||||
"res/actions/var24.png",
|
||||
@@ -432,8 +432,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("SetObjectVariableAsBoolean",
|
||||
_("Boolean value of an object variable"),
|
||||
_("Change the boolean value of an object variable."),
|
||||
_("Change boolean variable"),
|
||||
_("Modify the boolean value of an object variable."),
|
||||
_("Set the boolean value of variable _PARAM1_ of "
|
||||
"_PARAM0_ to _PARAM2_"),
|
||||
_("Variables"),
|
||||
@@ -446,7 +446,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
obj.AddAction(
|
||||
"ToggleObjectVariableAsBoolean",
|
||||
_("Toggle the boolean value of an object variable"),
|
||||
_("Toggle boolean variable"),
|
||||
_("Toggles the boolean value of an object variable.") + "\n" +
|
||||
_("If it was true, it will become false, and if it was false "
|
||||
"it will become true."),
|
||||
@@ -461,37 +461,39 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
obj.AddCondition("ObjectVariableChildExists",
|
||||
_("Child existence"),
|
||||
_("Check if the specified child of the variable exists."),
|
||||
_("Check if the specified child of the object "
|
||||
"structure variable exists."),
|
||||
_("Child _PARAM2_ of variable _PARAM1_ of _PARAM0_ exists"),
|
||||
_("Variables/Collections/Structures"),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.AddParameter("objectvar", _("Structure variable"))
|
||||
.AddParameter("string", _("Name of the child"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ObjectVariableRemoveChild",
|
||||
_("Remove a child"),
|
||||
_("Remove a child from an object variable."),
|
||||
_("Remove a child from an object structure variable."),
|
||||
_("Remove child _PARAM2_ from variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Collections/Structures"),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.AddParameter("objectvar", _("Structure variable"))
|
||||
.AddParameter("string", _("Child's name"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ObjectVariableClearChildren",
|
||||
_("Clear variable"),
|
||||
_("Remove all the children from the object variable."),
|
||||
_("Clear children"),
|
||||
_("Remove all the children from the object array or structure "
|
||||
"variable."),
|
||||
_("Clear children from variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Collections"),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.AddParameter("objectvar", _("Array or structure variable"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("Cache",
|
||||
@@ -619,8 +621,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("VarObjet",
|
||||
_("Value of an object variable"),
|
||||
_("Compare the value of an object variable."),
|
||||
_("Number variable"),
|
||||
_("Compare the number value of an object variable."),
|
||||
_("the variable _PARAM1_"),
|
||||
_("Variables"),
|
||||
"res/conditions/var24.png",
|
||||
@@ -632,7 +634,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"number", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition("VarObjetTxt",
|
||||
_("Text of an object variable"),
|
||||
_("Text variable"),
|
||||
_("Compare the text of an object variable."),
|
||||
_("the text of variable _PARAM1_"),
|
||||
_("Variables"),
|
||||
@@ -645,7 +647,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"string", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition("ObjectVariableAsBoolean",
|
||||
_("Boolean value of an object variable"),
|
||||
_("Boolean variable"),
|
||||
_("Compare the boolean value of an object variable."),
|
||||
_("The boolean value of variable _PARAM1_ of object "
|
||||
"_PARAM0_ is _PARAM2_"),
|
||||
@@ -659,7 +661,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
obj.AddCondition("VarObjetDef",
|
||||
"Variable defined",
|
||||
"Check if the variable is defined.",
|
||||
"Check if the object variable is defined.",
|
||||
"Variable _PARAM1 of _PARAM0_ is defined",
|
||||
_("Variables"),
|
||||
"res/conditions/var24.png",
|
||||
@@ -667,78 +669,131 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("string", _("Variable"))
|
||||
.SetHidden();
|
||||
.SetHidden(); // Deprecated.
|
||||
|
||||
obj.AddAction(
|
||||
"ObjectVariablePush",
|
||||
_("Append variable to an object array"),
|
||||
_("Appends a variable to the end of an object array variable."),
|
||||
_("Append variable _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Collections/Arrays"),
|
||||
_("Add existing variable"),
|
||||
_("Adds an existing variable to the end of an object array variable."),
|
||||
_("Add variable _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"))
|
||||
.AddParameter("scenevar", _("Scene variable with the content to append"))
|
||||
.SetParameterLongDescription(
|
||||
_("The content of the variable will *be copied* and appended at the "
|
||||
"end of the array."))
|
||||
.AddParameter("scenevar", _("Scene variable with the content to add"))
|
||||
.SetParameterLongDescription(_("The content of the object variable will "
|
||||
"*be copied* and added at the "
|
||||
"end of the array."))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction(
|
||||
"ObjectVariablePushString",
|
||||
_("Append a string to an object array"),
|
||||
_("Appends a string to the end of an object array variable."),
|
||||
_("Append string _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Collections/Arrays"),
|
||||
_("Add text variable"),
|
||||
_("Adds a text (string) to the end of an object array variable."),
|
||||
_("Add text _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"))
|
||||
.AddParameter("string", _("String to append"))
|
||||
.AddParameter("string", _("Text to add"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction(
|
||||
"ObjectVariablePushNumber",
|
||||
_("Append a number to an object array"),
|
||||
_("Appends a number to the end of an object array variable."),
|
||||
_("Append number _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
obj.AddAction("ObjectVariablePushNumber",
|
||||
_("Add number variable"),
|
||||
_("Adds a number to the end of an object array variable."),
|
||||
_("Add number _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"))
|
||||
.AddParameter("expression", _("Number to append"))
|
||||
.AddParameter("expression", _("Number to add"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction(
|
||||
"ObjectVariablePushBool",
|
||||
_("Append a boolean to an object array"),
|
||||
_("Appends a boolean to the end of an object array variable."),
|
||||
_("Append boolean _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Collections/Arrays"),
|
||||
_("Add boolean variable"),
|
||||
_("Adds a boolean to the end of an object array variable."),
|
||||
_("Add boolean _PARAM2_ to array variable _PARAM1_ of _PARAM0_"),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"))
|
||||
.AddParameter("trueorfalse", _("Boolean to append"))
|
||||
.AddParameter("trueorfalse", _("Boolean to add"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction(
|
||||
"ObjectVariableRemoveAt",
|
||||
_("Remove variable from an object array (by index)"),
|
||||
_("Remove variable by index"),
|
||||
_("Removes a variable at the specified index of an object array "
|
||||
"variable."),
|
||||
_("Remove variable at index _PARAM2_ from array variable _PARAM1_ of "
|
||||
"_PARAM0_"),
|
||||
_("Variables/Collections/Arrays"),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.AddParameter("objectvar", _("Array variable"))
|
||||
.AddParameter("expression", _("Index to remove"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition(
|
||||
"ObjectVariableChildCount",
|
||||
_("Number of children"),
|
||||
_("Compare the number of children in an object array variable."),
|
||||
_("The number of children in the array variable _PARAM1_"),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddStrExpression(
|
||||
"ArrayVariableFirstString",
|
||||
_("First text child"),
|
||||
_("Get the value of the first element of an object array variable, if "
|
||||
"it is a text (string) variable."),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"));
|
||||
|
||||
obj.AddExpression(
|
||||
"ArrayVariableFirstNumber",
|
||||
_("First number child"),
|
||||
_("Get the value of the first element of an object array variable, if "
|
||||
"it is a number variable."),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"));
|
||||
|
||||
obj.AddStrExpression(
|
||||
"ArrayVariableLastString",
|
||||
_("Last text child"),
|
||||
_("Get the value of the last element of an object array variable, if "
|
||||
"it is a text (string) variable."),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"));
|
||||
|
||||
obj.AddExpression(
|
||||
"ArrayVariableLastNumber",
|
||||
_("Last number child"),
|
||||
_("Get the value of the last element of an object array variable, if "
|
||||
"it is a number variable."),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Array variable"));
|
||||
|
||||
obj.AddCondition("BehaviorActivated",
|
||||
_("Behavior activated"),
|
||||
_("Check if the behavior is activated for the object."),
|
||||
@@ -1115,23 +1170,24 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
.AddParameter("expression", _("Target Y position"));
|
||||
|
||||
obj.AddExpression("Variable",
|
||||
_("Value of an object variable"),
|
||||
_("Value of an object variable"),
|
||||
_("Number variable"),
|
||||
_("Number value of an object variable"),
|
||||
_("Variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"));
|
||||
|
||||
obj.AddExpression("VariableChildCount",
|
||||
_("Number of children of an object variable"),
|
||||
_("Number of children of an object variable"),
|
||||
_("Variables"),
|
||||
"res/actions/var.png")
|
||||
obj.AddExpression(
|
||||
"VariableChildCount",
|
||||
_("Number of children"),
|
||||
_("Number of children in an object array or structure variable"),
|
||||
_("Variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"));
|
||||
.AddParameter("objectvar", _("Array or structure variable"));
|
||||
|
||||
obj.AddStrExpression("VariableString",
|
||||
_("Text of an object variable"),
|
||||
_("Text variable"),
|
||||
_("Text of an object variable"),
|
||||
_("Variables"),
|
||||
"res/actions/var.png")
|
||||
@@ -1293,7 +1349,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/actions/create24.png",
|
||||
"res/actions/create24.png")
|
||||
.AddCodeOnlyParameter("objectsContext", "")
|
||||
.AddParameter("objectListOrEmptyIfJustDeclared", _("Group of potential objects"))
|
||||
.AddParameter("objectListOrEmptyIfJustDeclared",
|
||||
_("Group of potential objects"))
|
||||
.SetParameterLongDescription(
|
||||
_("Group containing objects that can be created by the action."))
|
||||
.AddParameter("string", _("Name of the object to create"))
|
||||
|
@@ -197,14 +197,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
extension.AddDuplicatedExpression("SourisY", "CursorY").SetHidden();
|
||||
|
||||
extension
|
||||
.AddExpressionAndCondition(
|
||||
"number",
|
||||
"MouseOnlyCursorX",
|
||||
_("Mouse cursor X position"),
|
||||
_("the X position of the mouse cursor"),
|
||||
_("the mouse cursor X position"),
|
||||
"",
|
||||
"res/conditions/mouse24.png")
|
||||
.AddExpressionAndCondition("number",
|
||||
"MouseOnlyCursorX",
|
||||
_("Mouse cursor X position"),
|
||||
_("the X position of the mouse cursor"),
|
||||
_("the mouse cursor X position"),
|
||||
"",
|
||||
"res/conditions/mouse24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
@@ -215,14 +214,13 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
.SetHidden();
|
||||
|
||||
extension
|
||||
.AddExpressionAndCondition(
|
||||
"number",
|
||||
"MouseOnlyCursorY",
|
||||
_("Mouse cursor Y position"),
|
||||
_("the Y position of the mouse cursor"),
|
||||
_("the mouse cursor Y position"),
|
||||
"",
|
||||
"res/conditions/mouse24.png")
|
||||
.AddExpressionAndCondition("number",
|
||||
"MouseOnlyCursorY",
|
||||
_("Mouse cursor Y position"),
|
||||
_("the Y position of the mouse cursor"),
|
||||
_("the mouse cursor Y position"),
|
||||
"",
|
||||
"res/conditions/mouse24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
@@ -376,7 +374,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
.AddCondition(
|
||||
"HasAnyTouchStarted",
|
||||
_("A new touch has started"),
|
||||
_("Check if a touch has just started on this frame. The touch identifiers can be "
|
||||
_("Check if a touch has just started on this frame. The touch "
|
||||
"identifiers can be "
|
||||
"accessed using StartedTouchId() and StartedTouchCount()."),
|
||||
_("A new touch has started"),
|
||||
_("Multitouch"),
|
||||
@@ -386,24 +385,24 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
.SetHidden();
|
||||
|
||||
extension
|
||||
.AddExpression(
|
||||
"StartedTouchCount",
|
||||
_("Started touch count"),
|
||||
_("The number of touches that have just started on this frame. The touch identifiers can be "
|
||||
"accessed using StartedTouchId()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddExpression("StartedTouchCount",
|
||||
_("Started touch count"),
|
||||
_("The number of touches that have just started on this "
|
||||
"frame. The touch identifiers can be "
|
||||
"accessed using StartedTouchId()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetHidden();
|
||||
|
||||
extension
|
||||
.AddExpression(
|
||||
"StartedTouchId",
|
||||
_("Started touch identifier"),
|
||||
_("The identifier of the touch that has just started on this frame. The touch number of touches can be "
|
||||
"accessed using StartedTouchCount()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddExpression("StartedTouchId",
|
||||
_("Started touch identifier"),
|
||||
_("The identifier of the touch that has just started on "
|
||||
"this frame. The number of touches can be "
|
||||
"accessed using StartedTouchCount()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Touch index"))
|
||||
.SetHidden();
|
||||
@@ -414,7 +413,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("A new touch has started"),
|
||||
_("Check if a touch has just started or the mouse left button has "
|
||||
"been pressed on this frame. The touch identifiers can be "
|
||||
"accessed using StartedTouchOrMouseId() and StartedTouchOrMouseCount()."),
|
||||
"accessed using StartedTouchOrMouseId() and "
|
||||
"StartedTouchOrMouseCount()."),
|
||||
_("A new touch has started"),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch24.png",
|
||||
@@ -427,7 +427,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
_("Started touch count"),
|
||||
_("The number of touches (including the mouse) that have just "
|
||||
"started on this frame. The touch identifiers can be "
|
||||
"accessed using StartedTouchOrMouseCount()."),
|
||||
"accessed using StartedTouchOrMouseId()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
@@ -437,7 +437,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
"StartedTouchOrMouseId",
|
||||
_("Started touch identifier"),
|
||||
_("The identifier of the touch or mouse that has just started on "
|
||||
"this frame. The touch number of touches can be "
|
||||
"this frame. The number of touches can be "
|
||||
"accessed using StartedTouchOrMouseCount()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
@@ -445,14 +445,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
.AddParameter("expression", _("Touch index"));
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"HasTouchEnded",
|
||||
_("A touch has ended"),
|
||||
_("Check if a touch has ended or a mouse left button has been released."),
|
||||
_("The touch with identifier _PARAM1_ has ended"),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch24.png",
|
||||
"res/conditions/touch.png")
|
||||
.AddCondition("HasTouchEnded",
|
||||
_("A touch has ended"),
|
||||
_("Check if a touch has ended or a mouse left button has "
|
||||
"been released."),
|
||||
_("The touch with identifier _PARAM1_ has ended"),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch24.png",
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Touch identifier"));
|
||||
|
||||
|
@@ -27,9 +27,9 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddCondition("VarScene",
|
||||
_("Value of a scene variable"),
|
||||
_("Compare the value of a scene variable."),
|
||||
_("the scene variable _PARAM0_"),
|
||||
_("Number variable"),
|
||||
_("Compare the number value of a scene variable."),
|
||||
_("The number of scene variable _PARAM0_"),
|
||||
_("Scene variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
@@ -39,9 +39,9 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddCondition("VarSceneTxt",
|
||||
_("Text of a scene variable"),
|
||||
_("Compare the text of a scene variable."),
|
||||
_("the text of scene variable _PARAM0_"),
|
||||
_("Text variable"),
|
||||
_("Compare the text (string) of a scene variable."),
|
||||
_("The text of scene variable _PARAM0_"),
|
||||
_("Scene variables"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
@@ -52,7 +52,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
extension
|
||||
.AddCondition(
|
||||
"SceneVariableAsBoolean",
|
||||
_("Boolean value of a scene variable"),
|
||||
_("Boolean variable"),
|
||||
_("Compare the boolean value of a scene variable."),
|
||||
_("The boolean value of scene variable _PARAM0_ is _PARAM1_"),
|
||||
_("Scene variables"),
|
||||
@@ -63,14 +63,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.SetDefaultValue("true");
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"VariableChildExists",
|
||||
_("Child existence"),
|
||||
_("Check if the specified child of the scene variable exists."),
|
||||
_("Child _PARAM1_ of scene variable _PARAM0_ exists"),
|
||||
_("Scene variables/Collections/Structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddCondition("VariableChildExists",
|
||||
_("Child existence"),
|
||||
_("Check if the specified child of the scene structure "
|
||||
"variable exists."),
|
||||
_("Child _PARAM1_ of scene variable _PARAM0_ exists"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.AddParameter("string", _("Name of the child"))
|
||||
.MarkAsAdvanced();
|
||||
@@ -78,10 +78,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
extension
|
||||
.AddCondition("GlobalVariableChildExists",
|
||||
_("Child existence"),
|
||||
_("Check if the specified child of the global "
|
||||
_("Check if the specified child of the global structure "
|
||||
"variable exists."),
|
||||
_("Child _PARAM1_ of global variable _PARAM0_ exists"),
|
||||
_("Global variables/Collections/Structures"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
@@ -90,7 +90,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddCondition("VarSceneDef",
|
||||
"Test if a scene variable is defined",
|
||||
"Variable defined",
|
||||
"Test if the scene variable exists.",
|
||||
"Scene variable _PARAM0_ is defined",
|
||||
_("Scene variables"),
|
||||
@@ -98,12 +98,12 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
"res/conditions/var.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("string", _("Variable"))
|
||||
.SetHidden();
|
||||
.SetHidden(); // Deprecated.
|
||||
|
||||
extension
|
||||
.AddCondition("VarGlobal",
|
||||
_("Value of a global variable"),
|
||||
_("Compare the value of a global variable."),
|
||||
_("Number variable"),
|
||||
_("Compare the number value of a global variable."),
|
||||
_("the global variable _PARAM0_"),
|
||||
_("Global variables"),
|
||||
"res/conditions/var24.png",
|
||||
@@ -115,8 +115,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddCondition("VarGlobalTxt",
|
||||
_("Text of a global variable"),
|
||||
_("Compare the text of a global variable."),
|
||||
_("Text variable"),
|
||||
_("Compare the text (string) of a global variable."),
|
||||
_("the text of the global variable _PARAM0_"),
|
||||
_("Global variables"),
|
||||
"res/conditions/var24.png",
|
||||
@@ -129,7 +129,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
extension
|
||||
.AddCondition(
|
||||
"GlobalVariableAsBoolean",
|
||||
_("Boolean value of a global variable"),
|
||||
_("Boolean variable"),
|
||||
_("Compare the boolean value of a global variable."),
|
||||
_("The boolean value of global variable _PARAM0_ is _PARAM1_"),
|
||||
_("Global variables"),
|
||||
@@ -141,8 +141,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddCondition("VarGlobalDef",
|
||||
"Test if a global variable is defined",
|
||||
"Test if a global variable exists",
|
||||
"Variable defined",
|
||||
"Test if a global variable exists.",
|
||||
"Global variable _PARAM0_ is defined",
|
||||
_("Global variables"),
|
||||
"res/conditions/var24.png",
|
||||
@@ -150,12 +150,12 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("string", _("Variable"))
|
||||
.MarkAsAdvanced()
|
||||
.SetHidden();
|
||||
.SetHidden(); // Deprecated.
|
||||
|
||||
extension
|
||||
.AddAction("ModVarScene",
|
||||
_("Value of a scene variable"),
|
||||
_("Change the value of a scene variable."),
|
||||
_("Change number variable"),
|
||||
_("Modify the number value of a scene variable."),
|
||||
_("the scene variable _PARAM0_"),
|
||||
_("Scene variables"),
|
||||
"res/actions/var24.png",
|
||||
@@ -166,8 +166,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddAction("ModVarSceneTxt",
|
||||
_("String of a scene variable"),
|
||||
_("Modify the text of a scene variable."),
|
||||
_("Change text variable"),
|
||||
_("Modify the text (string) of a scene variable."),
|
||||
_("the text of scene variable _PARAM0_"),
|
||||
_("Scene variables"),
|
||||
"res/actions/var24.png",
|
||||
@@ -179,7 +179,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
extension
|
||||
.AddAction(
|
||||
"SetSceneVariableAsBoolean",
|
||||
_("Boolean value of a scene variable"),
|
||||
_("Change boolean variable"),
|
||||
_("Modify the boolean value of a scene variable."),
|
||||
_("Set the boolean value of scene variable _PARAM0_ to _PARAM1_"),
|
||||
_("Scene variables"),
|
||||
@@ -190,7 +190,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddAction("ToggleSceneVariableAsBoolean",
|
||||
_("Toggle boolean value of a scene variable"),
|
||||
_("Toggle boolean variable"),
|
||||
_("Toggle the boolean value of a scene variable.") + "\n" +
|
||||
_("If it was true, it will become false, and if it was "
|
||||
"false it will become true."),
|
||||
@@ -202,8 +202,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddAction("ModVarGlobal",
|
||||
_("Value of a global variable"),
|
||||
_("Change the value of a global variable"),
|
||||
_("Change number variable"),
|
||||
_("Modify the number value of a global variable."),
|
||||
_("the global variable _PARAM0_"),
|
||||
_("Global variables"),
|
||||
"res/actions/var24.png",
|
||||
@@ -215,8 +215,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddAction("ModVarGlobalTxt",
|
||||
_("String of a global variable"),
|
||||
_("Modify the text of a global variable."),
|
||||
_("Change text variable"),
|
||||
_("Modify the text (string) of a global variable."),
|
||||
_("the text of global variable _PARAM0_"),
|
||||
_("Global variables"),
|
||||
"res/actions/var24.png",
|
||||
@@ -229,7 +229,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
extension
|
||||
.AddAction(
|
||||
"SetGlobalVariableAsBoolean",
|
||||
_("Boolean value of a global variable"),
|
||||
_("Change boolean variable"),
|
||||
_("Modify the boolean value of a global variable."),
|
||||
_("Set the boolean value of global variable _PARAM0_ to _PARAM1_"),
|
||||
_("Global variables"),
|
||||
@@ -240,7 +240,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddAction("ToggleGlobalVariableAsBoolean",
|
||||
_("Toggle boolean value of a global variable"),
|
||||
_("Toggle boolean variable"),
|
||||
_("Toggle the boolean value of a global variable.") + "\n" +
|
||||
_("If it was true, it will become false, and if it was "
|
||||
"false it will become true."),
|
||||
@@ -251,202 +251,324 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
.AddParameter("globalvar", _("Variable"));
|
||||
|
||||
extension
|
||||
.AddAction("VariableRemoveChild",
|
||||
_("Remove a child"),
|
||||
_("Remove a child from a scene variable."),
|
||||
_("Remove child _PARAM1_ from scene variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.AddAction(
|
||||
"VariableRemoveChild",
|
||||
_("Remove a child"),
|
||||
_("Remove a child from a scene structure variable."),
|
||||
_("Remove child _PARAM1_ from scene structure variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Structure variable"))
|
||||
.AddParameter("string", _("Child's name"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("GlobalVariableRemoveChild",
|
||||
_("Remove a child"),
|
||||
_("Remove a child from a global variable."),
|
||||
_("Remove child _PARAM1_ from global variable _PARAM0_"),
|
||||
_("Global variables/Collections/Structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
.AddAction(
|
||||
"GlobalVariableRemoveChild",
|
||||
_("Remove a child"),
|
||||
_("Remove a child from a global structure variable."),
|
||||
_("Remove child _PARAM1_ from global structure variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Structure variable"))
|
||||
.AddParameter("string", _("Child's name"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("VariableClearChildren",
|
||||
_("Clear scene variable"),
|
||||
_("Remove all the children from the scene variable."),
|
||||
_("Clear children"),
|
||||
_("Remove all the children from the scene structure or array "
|
||||
"variable."),
|
||||
_("Clear children from scene variable _PARAM0_"),
|
||||
_("Scene variables/Collections"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.AddParameter("scenevar", _("Structure or array variable"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("GlobalVariableClearChildren",
|
||||
_("Clear global variable"),
|
||||
_("Remove all the children from the global variable."),
|
||||
_("Clear children"),
|
||||
_("Remove all the children from the global structure or array "
|
||||
"variable."),
|
||||
_("Clear children from global variable _PARAM0_"),
|
||||
_("Global variables/Collections"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
.AddParameter("globalvar", _("Structure or array variable"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("SceneVariablePush",
|
||||
_("Append variable to a scene array"),
|
||||
_("Appends a variable at the end of a scene array variable."),
|
||||
_("Append variable _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
_("Add existing variable"),
|
||||
_("Adds an existing variable at the end of a scene array "
|
||||
"variable."),
|
||||
_("Add variable _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
.AddParameter("scenevar", _("Scene variable with the content to append"))
|
||||
.SetParameterLongDescription(_("The content of the variable will *be copied* and appended at the end of the array."))
|
||||
.AddParameter("scenevar", _("Scene variable with the content to add"))
|
||||
.SetParameterLongDescription(
|
||||
_("The content of the variable will *be copied* and added at the "
|
||||
"end of the array."))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("SceneVariablePushString",
|
||||
_("Append a string to a scene array"),
|
||||
_("Appends a string at the end of a scene array variable."),
|
||||
_("Append string _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddAction(
|
||||
"SceneVariablePushString",
|
||||
_("Add text variable"),
|
||||
_("Adds a text (string) at the end of a scene array variable."),
|
||||
_("Add text _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
.AddParameter("string", _("String to append"))
|
||||
.AddParameter("string", _("Text to add"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("SceneVariablePushNumber",
|
||||
_("Append a number to a scene array"),
|
||||
_("Appends a number at the end of a scene array variable."),
|
||||
_("Append number _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
_("Add number variable"),
|
||||
_("Adds a number at the end of a scene array variable."),
|
||||
_("Add number _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
.AddParameter("expression", _("Number to append"))
|
||||
.AddParameter("expression", _("Number to add"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("SceneVariablePushBool",
|
||||
_("Append a boolean to a scene array"),
|
||||
_("Appends a boolean at the end of a scene array variable."),
|
||||
_("Append boolean _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
_("Add boolean variable"),
|
||||
_("Adds a boolean at the end of a scene array variable."),
|
||||
_("Add boolean _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
.AddParameter("trueorfalse", _("Boolean to append"))
|
||||
.AddParameter("trueorfalse", _("Boolean to add"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"SceneVariableRemoveAt",
|
||||
_("Remove variable from a scene array (by index)"),
|
||||
_("Removes a variable at the specified index of a scene array variable."),
|
||||
_("Remove variable at index _PARAM1_ from scene array variable _PARAM0_"),
|
||||
_("Scene variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.AddAction("SceneVariableRemoveAt",
|
||||
_("Remove variable by index"),
|
||||
_("Removes a variable at the specified index of a scene array "
|
||||
"variable."),
|
||||
_("Remove variable at index _PARAM1_ from scene array "
|
||||
"variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
.AddParameter("expression", _("Index to remove"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("GlobalVariablePush",
|
||||
_("Append variable to a global array"),
|
||||
_("Appends a variable at the end of a global array variable."),
|
||||
_("Append variable _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
.AddParameter("scenevar", _("Scene variable with the content to append"))
|
||||
.SetParameterLongDescription(_("The content of the variable will *be copied* and appended at the end of the array."))
|
||||
.AddCondition(
|
||||
"SceneVariableChildCount",
|
||||
_("Number of children"),
|
||||
_("Compare the number of children in a scene array variable."),
|
||||
_("The number of children in the array variable _PARAM0_"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"))
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddStrExpression(
|
||||
"SceneVariableFirstString",
|
||||
_("First text child"),
|
||||
_("Get the value of the first element of a scene array variable, if "
|
||||
"it is a text (string)."),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddExpression(
|
||||
"SceneVariableFirstNumber",
|
||||
_("First number child"),
|
||||
_("Get the value of the first element of a scene array variable, if "
|
||||
"it is a number."),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddStrExpression(
|
||||
"SceneVariableLastString",
|
||||
_("Last text child"),
|
||||
_("Get the value of the last element of a scene array variable, if "
|
||||
"it is a text (string)."),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddExpression(
|
||||
"SceneVariableLastNumber",
|
||||
_("Last number child"),
|
||||
_("Get the value of the last element of a scene array variable, if "
|
||||
"it is a number."),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
"GlobalVariableRemoveAt",
|
||||
_("Remove variable from a global array (by index)"),
|
||||
_("Removes a variable at the specified index of a global array variable."),
|
||||
_("Remove variable at index _PARAM1_ from global array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
"GlobalVariablePush",
|
||||
_("Add existing variable"),
|
||||
_("Adds an existing variable at the end of a global array variable."),
|
||||
_("Add variable _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
.AddParameter("scenevar", _("Scene variable with the content to add"))
|
||||
.SetParameterLongDescription(
|
||||
_("The content of the variable will *be copied* and added at the "
|
||||
"end of the array."))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("GlobalVariableRemoveAt",
|
||||
_("Remove variable by index"),
|
||||
_("Removes a variable at the specified index of a global "
|
||||
"array variable."),
|
||||
_("Remove variable at index _PARAM1_ from global array "
|
||||
"variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
.AddParameter("expression", _("Index to remove"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("GlobalVariablePushString",
|
||||
_("Append a string to a global array"),
|
||||
_("Appends a string at the end of a global array variable."),
|
||||
_("Append string _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddAction(
|
||||
"GlobalVariablePushString",
|
||||
_("Add text variable"),
|
||||
_("Adds a text (string) at the end of a global array variable."),
|
||||
_("Add text _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
.AddParameter("string", _("String to append"))
|
||||
.AddParameter("string", _("Text to add"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("GlobalVariablePushNumber",
|
||||
_("Append a number to a global array"),
|
||||
_("Appends a number at the end of a global array variable."),
|
||||
_("Append number _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
_("Add number variable"),
|
||||
_("Adds a number at the end of a global array variable."),
|
||||
_("Add number _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
.AddParameter("expression", _("Number to append"))
|
||||
.AddParameter("expression", _("Number to add"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("GlobalVariablePushBool",
|
||||
_("Append a boolean to a global array"),
|
||||
_("Appends a boolean at the end of a global array variable."),
|
||||
_("Append boolean _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Collections/Arrays"),
|
||||
_("Add boolean variable"),
|
||||
_("Adds a boolean at the end of a global array variable."),
|
||||
_("Add boolean _PARAM1_ to array variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
.AddParameter("trueorfalse", _("Boolean to append"))
|
||||
.AddParameter("trueorfalse", _("Boolean to add"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddExpression("GlobalVariableChildCount",
|
||||
_("Number of children of a global variable"),
|
||||
_("Number of children of a global variable"),
|
||||
_("Global variables"),
|
||||
.AddCondition(
|
||||
"GlobalVariableChildCount",
|
||||
_("Number of children"),
|
||||
_("Compare the number of children in a global array variable."),
|
||||
_("The number of children of the array variable _PARAM0_"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"))
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddStrExpression("GlobalVariableFirstString",
|
||||
_("First text child"),
|
||||
_("Value of the first element of a global array "
|
||||
"variable, if it is a text (string) variable."),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddExpression("GlobalVariableFirstNumber",
|
||||
_("First number child"),
|
||||
_("Value of the first element of a global array "
|
||||
"variable, if it is a number variable"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"));
|
||||
.AddParameter("globalvar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddStrExpression(
|
||||
"GlobalVariableLastString",
|
||||
_("Last text child"),
|
||||
_("Value of the last element of a global array variable, if "
|
||||
"it is a text (string) variable."),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddExpression(
|
||||
"GlobalVariableLastNumber",
|
||||
_("Last number child"),
|
||||
_("Value of the last element of a global array variable, if "
|
||||
"it is a number variable"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array variable"));
|
||||
|
||||
extension
|
||||
.AddExpression("GlobalVariableChildCount",
|
||||
_("Number of children"),
|
||||
_("Number of children in a global array or "
|
||||
"structure variable"),
|
||||
_("Global variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Array or structure variable"));
|
||||
|
||||
extension
|
||||
.AddExpression("VariableChildCount",
|
||||
_("Number of children of a scene variable"),
|
||||
_("Number of children of a scene variable"),
|
||||
_("Scene variables"),
|
||||
_("Number of children"),
|
||||
_("Number of children in a scene array or "
|
||||
"structure variable"),
|
||||
_("Scene variables/Arrays and structures"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"));
|
||||
.AddParameter("scenevar", _("Array or structure variable"));
|
||||
|
||||
extension
|
||||
.AddExpression("Variable",
|
||||
_("Value of a scene variable"),
|
||||
_("Value of a scene variable"),
|
||||
_("Number variable"),
|
||||
_("Number value of a scene variable"),
|
||||
_("Scene variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"));
|
||||
|
||||
extension
|
||||
.AddStrExpression("VariableString",
|
||||
_("Text of a scene variable"),
|
||||
_("Text variable"),
|
||||
_("Text of a scene variable"),
|
||||
_("Scene variables"),
|
||||
"res/actions/var.png")
|
||||
@@ -454,15 +576,15 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
|
||||
extension
|
||||
.AddExpression("GlobalVariable",
|
||||
_("Value of a global variable"),
|
||||
_("Value of a global variable"),
|
||||
_("Number variable"),
|
||||
_("Number value of a global variable"),
|
||||
_("Global variables"),
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Name of the global variable"));
|
||||
|
||||
extension
|
||||
.AddStrExpression("GlobalVariableString",
|
||||
_("Text of a global variable"),
|
||||
_("Text variable"),
|
||||
_("Text of a global variable"),
|
||||
_("Global variables"),
|
||||
"res/actions/var.png")
|
||||
|
@@ -46,7 +46,7 @@ class GD_CORE_API ObjectMetadata {
|
||||
std::shared_ptr<gd::ObjectConfiguration> blueprintObject_);
|
||||
/**
|
||||
* \brief Construct an object metadata, without "blueprint" object
|
||||
*
|
||||
*
|
||||
* \note This is used by events based objects.
|
||||
*/
|
||||
ObjectMetadata(const gd::String& extensionNamespace_,
|
||||
@@ -295,6 +295,22 @@ class GD_CORE_API ObjectMetadata {
|
||||
*/
|
||||
std::map<gd::String, gd::ExpressionMetadata>& GetAllStrExpressions() { return strExpressionsInfos; };
|
||||
|
||||
/**
|
||||
* \brief Set the object to be hidden in the IDE.
|
||||
*
|
||||
* Used mainly when an object is deprecated.
|
||||
*/
|
||||
ObjectMetadata &SetHidden() {
|
||||
hidden = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Return true if the instruction must be hidden in the IDE.
|
||||
*/
|
||||
bool IsHidden() const { return hidden; }
|
||||
|
||||
std::map<gd::String, gd::InstructionMetadata> conditionsInfos;
|
||||
std::map<gd::String, gd::InstructionMetadata> actionsInfos;
|
||||
std::map<gd::String, gd::ExpressionMetadata> expressionsInfos;
|
||||
@@ -314,6 +330,7 @@ class GD_CORE_API ObjectMetadata {
|
||||
gd::String iconFilename;
|
||||
gd::String categoryFullName;
|
||||
std::set<gd::String> unsupportedBaseObjectCapabilities;
|
||||
bool hidden = false;
|
||||
|
||||
std::shared_ptr<gd::ObjectConfiguration>
|
||||
blueprintObject; ///< The "blueprint" object to be copied when a new
|
||||
|
@@ -22,7 +22,7 @@ class EventsList;
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief List the values of the parameters of events and their type.
|
||||
* \brief Allow to safely remove a bunch of events.
|
||||
*
|
||||
* \ingroup IDE
|
||||
*/
|
||||
|
24
Core/GDCore/IDE/Events/InstructionsCountEvaluator.cpp
Normal file
24
Core/GDCore/IDE/Events/InstructionsCountEvaluator.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "InstructionsCountEvaluator.h"
|
||||
|
||||
#include "GDCore/Events/Instruction.h"
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
#include "GDCore/IDE/WholeProjectRefactorer.h"
|
||||
|
||||
namespace gd {
|
||||
|
||||
const int InstructionsCountEvaluator::ScanProject(gd::Project &project) {
|
||||
InstructionsCountEvaluator worker(project);
|
||||
gd::WholeProjectRefactorer::ExposeProjectEventsWithoutExtensions(project,
|
||||
worker);
|
||||
return worker.instructionCount;
|
||||
};
|
||||
|
||||
// Instructions scanner
|
||||
|
||||
bool InstructionsCountEvaluator::DoVisitInstruction(
|
||||
gd::Instruction &instruction, bool isCondition) {
|
||||
instructionCount++;
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace gd
|
50
Core/GDCore/IDE/Events/InstructionsCountEvaluator.h
Normal file
50
Core/GDCore/IDE/Events/InstructionsCountEvaluator.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef GDCORE_INSTRUCTIONS_COUNT_EVALUATOR_H
|
||||
#define GDCORE_INSTRUCTIONS_COUNT_EVALUATOR_H
|
||||
#include <set>
|
||||
|
||||
#include "GDCore/Events/Parsers/ExpressionParser2NodeWorker.h"
|
||||
#include "GDCore/IDE/Events/ArbitraryEventsWorker.h"
|
||||
#include "GDCore/IDE/Project/ArbitraryObjectsWorker.h"
|
||||
#include "GDCore/String.h"
|
||||
|
||||
namespace gd {
|
||||
class Project;
|
||||
class Object;
|
||||
class Behavior;
|
||||
} // namespace gd
|
||||
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* @brief Count the number of instructions in a project excluding extensions.
|
||||
*
|
||||
* This is used by the examples repository to evaluate examples size.
|
||||
*
|
||||
*/
|
||||
class GD_CORE_API InstructionsCountEvaluator : public ArbitraryEventsWorker {
|
||||
public:
|
||||
/**
|
||||
* Return the number of instructions in the project excluding extensions.
|
||||
*/
|
||||
static const int ScanProject(gd::Project &project);
|
||||
|
||||
private:
|
||||
InstructionsCountEvaluator(gd::Project &project_)
|
||||
: project(project_), instructionCount(0){};
|
||||
gd::Project &project;
|
||||
int instructionCount;
|
||||
|
||||
// Instructions Visitor
|
||||
bool DoVisitInstruction(gd::Instruction &instruction,
|
||||
bool isCondition) override;
|
||||
};
|
||||
|
||||
}; // namespace gd
|
||||
|
||||
#endif
|
@@ -49,14 +49,8 @@ void WholeProjectRefactorer::ExposeProjectEvents(
|
||||
// See also gd::Project::ExposeResources for a method that traverse the whole
|
||||
// project (this time for resources).
|
||||
|
||||
// Add layouts events
|
||||
for (std::size_t s = 0; s < project.GetLayoutsCount(); s++) {
|
||||
worker.Launch(project.GetLayout(s).GetEvents());
|
||||
}
|
||||
// Add external events events
|
||||
for (std::size_t s = 0; s < project.GetExternalEventsCount(); s++) {
|
||||
worker.Launch(project.GetExternalEvents(s).GetEvents());
|
||||
}
|
||||
ExposeProjectEventsWithoutExtensions(project, worker);
|
||||
|
||||
// Add events based extensions
|
||||
for (std::size_t e = 0; e < project.GetEventsFunctionsExtensionsCount();
|
||||
e++) {
|
||||
@@ -90,6 +84,18 @@ void WholeProjectRefactorer::ExposeProjectEvents(
|
||||
}
|
||||
}
|
||||
|
||||
void WholeProjectRefactorer::ExposeProjectEventsWithoutExtensions(
|
||||
gd::Project& project, gd::ArbitraryEventsWorker& worker) {
|
||||
// Add layouts events
|
||||
for (std::size_t s = 0; s < project.GetLayoutsCount(); s++) {
|
||||
worker.Launch(project.GetLayout(s).GetEvents());
|
||||
}
|
||||
// Add external events events
|
||||
for (std::size_t s = 0; s < project.GetExternalEventsCount(); s++) {
|
||||
worker.Launch(project.GetExternalEvents(s).GetEvents());
|
||||
}
|
||||
}
|
||||
|
||||
void WholeProjectRefactorer::ExposeProjectEvents(
|
||||
gd::Project& project, gd::ArbitraryEventsWorkerWithContext& worker) {
|
||||
// See also gd::Project::ExposeResources for a method that traverse the whole
|
||||
|
@@ -47,6 +47,14 @@ class GD_CORE_API WholeProjectRefactorer {
|
||||
*/
|
||||
static void ExposeProjectEvents(gd::Project& project,
|
||||
gd::ArbitraryEventsWorker& worker);
|
||||
/**
|
||||
* \brief Call the specified worker on all events of the project (layout and
|
||||
* external events) but not events from extensions.
|
||||
*
|
||||
* Only use this for stats.
|
||||
*/
|
||||
static void ExposeProjectEventsWithoutExtensions(gd::Project& project,
|
||||
gd::ArbitraryEventsWorker& worker);
|
||||
|
||||
/**
|
||||
* \brief Call the specified worker on all events of the project (layout,
|
||||
|
@@ -72,6 +72,9 @@ void EventsFunction::SerializeTo(SerializerElement& element) const {
|
||||
if (isPrivate) {
|
||||
element.SetBoolAttribute("private", isPrivate);
|
||||
}
|
||||
if (isAsync) {
|
||||
element.SetBoolAttribute("async", isAsync);
|
||||
}
|
||||
events.SerializeTo(element.AddChild("events"));
|
||||
|
||||
gd::String functionTypeStr = "Action";
|
||||
@@ -115,6 +118,7 @@ void EventsFunction::UnserializeFrom(gd::Project& project,
|
||||
group = element.GetStringAttribute("group");
|
||||
getterName = element.GetStringAttribute("getterName");
|
||||
isPrivate = element.GetBoolAttribute("private");
|
||||
isAsync = element.GetBoolAttribute("async");
|
||||
events.UnserializeFrom(project, element.GetChild("events"));
|
||||
|
||||
gd::String functionTypeStr = element.GetStringAttribute("functionType");
|
||||
|
@@ -211,6 +211,19 @@ class GD_CORE_API EventsFunction {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Returns true if the function is async.
|
||||
*/
|
||||
bool IsAsync() const { return isAsync; }
|
||||
|
||||
/**
|
||||
* \brief Sets the asycronity of the function.
|
||||
*/
|
||||
EventsFunction& SetAsync(bool _isAsync) {
|
||||
isAsync = _isAsync;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Return the events.
|
||||
*/
|
||||
@@ -291,6 +304,7 @@ class GD_CORE_API EventsFunction {
|
||||
mutable std::vector<gd::ParameterMetadata> actionWithOperationParameters;
|
||||
gd::ObjectGroupsContainer objectGroups;
|
||||
bool isPrivate = false;
|
||||
bool isAsync = false;
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -11,7 +11,7 @@
|
||||
namespace gd {
|
||||
|
||||
LoadingScreen::LoadingScreen()
|
||||
: showGDevelopSplash(true),
|
||||
: showGDevelopLogoDuringLoadingScreen(false),
|
||||
gdevelopLogoStyle("light"),
|
||||
backgroundImageResourceName(""),
|
||||
backgroundColor(0),
|
||||
@@ -27,7 +27,7 @@ LoadingScreen::LoadingScreen()
|
||||
progressBarColor(0xFFFFFF){};
|
||||
|
||||
void LoadingScreen::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("showGDevelopSplash", showGDevelopSplash);
|
||||
element.SetAttribute("showGDevelopSplash", showGDevelopLogoDuringLoadingScreen);
|
||||
element.SetAttribute("gdevelopLogoStyle",
|
||||
gdevelopLogoStyle);
|
||||
element.SetAttribute("backgroundImageResourceName",
|
||||
@@ -46,7 +46,7 @@ void LoadingScreen::SerializeTo(SerializerElement& element) const {
|
||||
}
|
||||
|
||||
void LoadingScreen::UnserializeFrom(const SerializerElement& element) {
|
||||
showGDevelopSplash = element.GetBoolAttribute("showGDevelopSplash", true);
|
||||
showGDevelopLogoDuringLoadingScreen = element.GetBoolAttribute("showGDevelopSplash", true);
|
||||
gdevelopLogoStyle =
|
||||
element.GetStringAttribute("gdevelopLogoStyle", "light");
|
||||
backgroundImageResourceName =
|
||||
|
@@ -29,13 +29,13 @@ class GD_CORE_API LoadingScreen {
|
||||
* \brief Return true if the GDevelop logo should be shown while loading
|
||||
* assets.
|
||||
*/
|
||||
bool IsGDevelopSplashShown() const { return showGDevelopSplash; };
|
||||
bool IsGDevelopLogoShownDuringLoadingScreen() const { return showGDevelopLogoDuringLoadingScreen; };
|
||||
|
||||
/**
|
||||
* \brief Set if the GDevelop logo should be shown while loading assets.
|
||||
*/
|
||||
LoadingScreen& ShowGDevelopSplash(bool show) {
|
||||
showGDevelopSplash = show;
|
||||
LoadingScreen& ShowGDevelopLogoDuringLoadingScreen(bool show) {
|
||||
showGDevelopLogoDuringLoadingScreen = show;
|
||||
return *this;
|
||||
};
|
||||
|
||||
@@ -157,7 +157,7 @@ class GD_CORE_API LoadingScreen {
|
||||
///@}
|
||||
|
||||
private:
|
||||
bool showGDevelopSplash;
|
||||
bool showGDevelopLogoDuringLoadingScreen;
|
||||
gd::String gdevelopLogoStyle;
|
||||
gd::String backgroundImageResourceName;
|
||||
int backgroundColor;
|
||||
|
@@ -636,6 +636,7 @@ void Project::UnserializeFrom(const SerializerElement& element) {
|
||||
platformSpecificAssets.UnserializeFrom(
|
||||
propElement.GetChild("platformSpecificAssets"));
|
||||
loadingScreen.UnserializeFrom(propElement.GetChild("loadingScreen"));
|
||||
watermark.UnserializeFrom(propElement.GetChild("watermark"));
|
||||
|
||||
useExternalSourceFiles =
|
||||
propElement.GetBoolAttribute("useExternalSourceFiles");
|
||||
@@ -646,6 +647,13 @@ void Project::UnserializeFrom(const SerializerElement& element) {
|
||||
for (std::size_t i = 0; i < authorIdsElement.GetChildrenCount(); ++i) {
|
||||
authorIds.push_back(authorIdsElement.GetChild(i).GetStringValue());
|
||||
}
|
||||
authorUsernames.clear();
|
||||
auto& authorUsernamesElement = propElement.GetChild("authorUsernames");
|
||||
authorUsernamesElement.ConsiderAsArray();
|
||||
for (std::size_t i = 0; i < authorUsernamesElement.GetChildrenCount(); ++i) {
|
||||
authorUsernames.push_back(
|
||||
authorUsernamesElement.GetChild(i).GetStringValue());
|
||||
}
|
||||
|
||||
categories.clear();
|
||||
auto& categoriesElement = propElement.GetChild("categories");
|
||||
@@ -875,6 +883,7 @@ void Project::SerializeTo(SerializerElement& element) const {
|
||||
platformSpecificAssets.SerializeTo(
|
||||
propElement.AddChild("platformSpecificAssets"));
|
||||
loadingScreen.SerializeTo(propElement.AddChild("loadingScreen"));
|
||||
watermark.SerializeTo(propElement.AddChild("watermark"));
|
||||
propElement.SetAttribute("useExternalSourceFiles", useExternalSourceFiles);
|
||||
|
||||
auto& authorIdsElement = propElement.AddChild("authorIds");
|
||||
@@ -882,6 +891,11 @@ void Project::SerializeTo(SerializerElement& element) const {
|
||||
for (const auto& authorId : authorIds) {
|
||||
authorIdsElement.AddChild("").SetStringValue(authorId);
|
||||
}
|
||||
auto& authorUsernamesElement = propElement.AddChild("authorUsernames");
|
||||
authorUsernamesElement.ConsiderAsArray();
|
||||
for (const auto& authorUsername : authorUsernames) {
|
||||
authorUsernamesElement.AddChild("").SetStringValue(authorUsername);
|
||||
}
|
||||
|
||||
auto& categoriesElement = propElement.AddChild("categories");
|
||||
categoriesElement.ConsiderAsArray();
|
||||
@@ -1097,6 +1111,7 @@ void Project::Init(const gd::Project& game) {
|
||||
|
||||
author = game.author;
|
||||
authorIds = game.authorIds;
|
||||
authorUsernames = game.authorUsernames;
|
||||
isPlayableWithKeyboard = game.isPlayableWithKeyboard;
|
||||
isPlayableWithGamepad = game.isPlayableWithGamepad;
|
||||
isPlayableWithMobile = game.isPlayableWithMobile;
|
||||
@@ -1107,6 +1122,7 @@ void Project::Init(const gd::Project& game) {
|
||||
latestCompilationDirectory = game.latestCompilationDirectory;
|
||||
platformSpecificAssets = game.platformSpecificAssets;
|
||||
loadingScreen = game.loadingScreen;
|
||||
watermark = game.watermark;
|
||||
objectGroups = game.objectGroups;
|
||||
|
||||
extensionProperties = game.extensionProperties;
|
||||
|
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "GDCore/Project/ExtensionProperties.h"
|
||||
#include "GDCore/Project/LoadingScreen.h"
|
||||
#include "GDCore/Project/Watermark.h"
|
||||
#include "GDCore/Project/ObjectGroupsContainer.h"
|
||||
#include "GDCore/Project/ObjectsContainer.h"
|
||||
#include "GDCore/Project/PlatformSpecificAssets.h"
|
||||
@@ -120,6 +121,16 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
*/
|
||||
std::vector<gd::String>& GetAuthorIds() { return authorIds; };
|
||||
|
||||
/**
|
||||
* \brief Get the author usernames of the project.
|
||||
*/
|
||||
const std::vector<gd::String>& GetAuthorUsernames() const { return authorUsernames; };
|
||||
|
||||
/**
|
||||
* \brief Get the author usernames of the project, to modify them (non-const).
|
||||
*/
|
||||
std::vector<gd::String>& GetAuthorUsernames() { return authorUsernames; };
|
||||
|
||||
/**
|
||||
* Define the project as playable with a keyboard.
|
||||
* \param enable True to define the project as playable with a keyboard.
|
||||
@@ -256,6 +267,16 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
*/
|
||||
const gd::LoadingScreen& GetLoadingScreen() const { return loadingScreen; }
|
||||
|
||||
/**
|
||||
* \brief Return a reference to watermark setup for the project
|
||||
*/
|
||||
gd::Watermark& GetWatermark() { return watermark; }
|
||||
|
||||
/**
|
||||
* \brief Return a reference to watermark setup for the project
|
||||
*/
|
||||
const gd::Watermark& GetWatermark() const { return watermark; }
|
||||
|
||||
/**
|
||||
* Change game's main window default width.
|
||||
*
|
||||
@@ -1043,6 +1064,8 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
gd::String author; ///< Game author name, for publishing purpose.
|
||||
std::vector<gd::String>
|
||||
authorIds; ///< Game author ids, from GDevelop users DB.
|
||||
std::vector<gd::String>
|
||||
authorUsernames; ///< Game author usernames, from GDevelop users DB.
|
||||
std::vector<gd::String>
|
||||
categories; ///< Game categories
|
||||
bool isPlayableWithKeyboard; ///< The project is playable with a keyboard.
|
||||
@@ -1062,6 +1085,7 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
currentPlatform; ///< The platform being used to edit the project.
|
||||
gd::PlatformSpecificAssets platformSpecificAssets;
|
||||
gd::LoadingScreen loadingScreen;
|
||||
gd::Watermark watermark;
|
||||
std::vector<std::unique_ptr<gd::ExternalEvents> >
|
||||
externalEvents; ///< List of all externals events
|
||||
ExtensionProperties
|
||||
|
24
Core/GDCore/Project/Watermark.cpp
Normal file
24
Core/GDCore/Project/Watermark.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2018 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "Watermark.h"
|
||||
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
|
||||
namespace gd {
|
||||
|
||||
Watermark::Watermark() : showWatermark(true), placement("bottom-left"){};
|
||||
|
||||
void Watermark::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("showWatermark", showWatermark);
|
||||
element.SetAttribute("placement", placement);
|
||||
}
|
||||
|
||||
void Watermark::UnserializeFrom(const SerializerElement& element) {
|
||||
showWatermark = element.GetBoolAttribute("showWatermark", true);
|
||||
placement = element.GetStringAttribute("placement", "bottom-left");
|
||||
}
|
||||
} // namespace gd
|
70
Core/GDCore/Project/Watermark.h
Normal file
70
Core/GDCore/Project/Watermark.h
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2018 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef GDCORE_WATERMARK_H
|
||||
#define GDCORE_WATERMARK_H
|
||||
#include "GDCore/String.h"
|
||||
namespace gd {
|
||||
class SerializerElement;
|
||||
}
|
||||
|
||||
namespace gd {
|
||||
|
||||
/**
|
||||
* \brief Describe the content and set up of the watermark
|
||||
*
|
||||
* \see gd::Watermark
|
||||
*
|
||||
* \ingroup PlatformDefinition
|
||||
*/
|
||||
class GD_CORE_API Watermark {
|
||||
public:
|
||||
Watermark();
|
||||
virtual ~Watermark(){};
|
||||
|
||||
/**
|
||||
* \brief Return true if the GDevelop watermark should be shown after
|
||||
* the game has loaded its assets.
|
||||
*/
|
||||
bool IsGDevelopWatermarkShown() const { return showWatermark; };
|
||||
|
||||
/**
|
||||
* \brief Set if the GDevelop watermark should be shown after the game
|
||||
* has loaded its assets.
|
||||
*/
|
||||
Watermark& ShowGDevelopWatermark(bool show) {
|
||||
showWatermark = show;
|
||||
return *this;
|
||||
};
|
||||
|
||||
const gd::String& GetPlacement() const { return placement; };
|
||||
|
||||
Watermark& SetPlacement(const gd::String& value) {
|
||||
placement = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** \name Saving and loading
|
||||
*/
|
||||
///@{
|
||||
/**
|
||||
* \brief Serialize the watermark setup.
|
||||
*/
|
||||
void SerializeTo(SerializerElement& element) const;
|
||||
|
||||
/**
|
||||
* \brief Unserialize the watermark setup.
|
||||
*/
|
||||
void UnserializeFrom(const SerializerElement& element);
|
||||
///@}
|
||||
|
||||
private:
|
||||
bool showWatermark;
|
||||
gd::String placement;
|
||||
};
|
||||
} // namespace gd
|
||||
|
||||
#endif // GDCORE_WATERMARK_H
|
40
Core/tests/InstructionCountEvaluator.cpp
Normal file
40
Core/tests/InstructionCountEvaluator.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "GDCore/IDE/Events/InstructionsCountEvaluator.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "DummyPlatform.h"
|
||||
#include "GDCore/Events/Builtin/StandardEvent.h"
|
||||
#include "GDCore/Events/Event.h"
|
||||
#include "GDCore/Extensions/Platform.h"
|
||||
#include "GDCore/Project/Layout.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
#include "catch.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
TEST_CASE("InstructionsCountEvaluator", "[events]") {
|
||||
|
||||
SECTION("Can count 1 action in a layout") {
|
||||
gd::Project project;
|
||||
gd::Platform platform;
|
||||
SetupProjectWithDummyPlatform(project, platform);
|
||||
auto &layout1 = project.InsertNewLayout("Layout1", 0);
|
||||
|
||||
// Add an event with an action.
|
||||
gd::StandardEvent event;
|
||||
gd::Instruction instruction;
|
||||
instruction.SetType("MyExtension::DoSomething");
|
||||
instruction.SetParametersCount(1);
|
||||
event.GetActions().Insert(instruction);
|
||||
layout1.GetEvents().InsertEvent(event);
|
||||
|
||||
REQUIRE(gd::InstructionsCountEvaluator::ScanProject(project) == 1);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
@@ -30,7 +30,7 @@ module.exports = {
|
||||
'AdMob',
|
||||
_('AdMob'),
|
||||
_(
|
||||
'Allow to display AdMob banners, interstitials and reward video ads.'
|
||||
'Allow to display AdMob banners, app open, interstitials, rewarded interstitials and rewarded video ads.'
|
||||
),
|
||||
'Florian Rival',
|
||||
'MIT'
|
||||
@@ -57,8 +57,8 @@ module.exports = {
|
||||
.addDependency()
|
||||
.setName('AdMob Cordova plugin')
|
||||
.setDependencyType('cordova')
|
||||
.setExportName('gdevelop-cordova-admob-plus')
|
||||
.setVersion('0.45.0')
|
||||
.setExportName('admob-plus-cordova')
|
||||
.setVersion('1.28.0')
|
||||
.setExtraSetting(
|
||||
'APP_ID_ANDROID',
|
||||
new gd.PropertyDescriptor('AdMobAppIdAndroid').setType(
|
||||
@@ -100,23 +100,120 @@ module.exports = {
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.setTestMode');
|
||||
|
||||
// Banner
|
||||
// App Open
|
||||
extension
|
||||
.addCondition(
|
||||
'BannerLoading',
|
||||
_('Banner loading'),
|
||||
_(
|
||||
'Check if a banner is currently loading. It will be shown automatically when loaded.'
|
||||
),
|
||||
_('Banner is loading'),
|
||||
'AppOpenLoading',
|
||||
_('App open loading'),
|
||||
_('Check if an app open is currently loading.'),
|
||||
_('App open is loading'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isBannerLoading');
|
||||
.setFunctionName('gdjs.adMob.isAppOpenLoading');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'AppOpenReady',
|
||||
_('App open ready'),
|
||||
_('Check if an app open is ready to be displayed.'),
|
||||
_('App open is ready'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isAppOpenReady');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'AppOpenShowing',
|
||||
_('App open showing'),
|
||||
_('Check if there is an app open being displayed.'),
|
||||
_('App open is showing'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isAppOpenShowing');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'AppOpenErrored',
|
||||
_('App open errored'),
|
||||
_('Check if there was a error while loading the app open.'),
|
||||
_('App open had an error'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isAppOpenErrored');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'LoadAppOpen',
|
||||
_('Load app open'),
|
||||
_(
|
||||
'Start loading an app open (that can be displayed automatically when the loading is finished).\nIf test mode is set, a test app open will be displayed.'
|
||||
),
|
||||
_(
|
||||
'Load app open with Android ad unit ID: _PARAM0_, iOS ad unit ID: _PARAM1_ (landscape: _PARAM2_, display automatically when loaded: _PARAM3_)'
|
||||
),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.addParameter('string', _('Android app open ID'), '', false)
|
||||
.setParameterLongDescription(
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/3419835294"` for loading a test app open.'
|
||||
)
|
||||
.addParameter('string', _('iOS app open ID'), '', false)
|
||||
.setParameterLongDescription(
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/5662855259"` for loading a test app open.'
|
||||
)
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
_('Display in landscape? (portait otherwise)'),
|
||||
'',
|
||||
false
|
||||
)
|
||||
.setDefaultValue('false')
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
_('Displayed automatically when loading is finished?'),
|
||||
'',
|
||||
false
|
||||
)
|
||||
.setDefaultValue('true')
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.loadAppOpen');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'ShowAppOpen',
|
||||
_('Show app open'),
|
||||
_(
|
||||
'Show the app open that was loaded. Will work only when the app open is fully loaded.'
|
||||
),
|
||||
_('Show the loaded app open'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.showAppOpen');
|
||||
|
||||
// Banner
|
||||
extension
|
||||
.addCondition(
|
||||
'BannerShowing',
|
||||
@@ -131,6 +228,34 @@ module.exports = {
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isBannerShowing');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'BannerConfigured',
|
||||
_('Banner configured'),
|
||||
_('Check if there is a banner correctly configured ready to be shown.'),
|
||||
_('Banner is configured'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isBannerConfigured');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'BannerLoaded',
|
||||
_('Banner loaded'),
|
||||
_('Check if there is a banner correctly loaded ready to be shown.'),
|
||||
_('Banner is loaded'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isBannerLoaded');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'BannerErrored',
|
||||
@@ -149,6 +274,9 @@ module.exports = {
|
||||
extension
|
||||
.addDuplicatedCondition('BannerReady', 'BannerShowing')
|
||||
.setHidden();
|
||||
extension
|
||||
.addDuplicatedCondition('Bannerloading', 'BannerShowing')
|
||||
.setHidden();
|
||||
extension
|
||||
.addDuplicatedCondition('BannerExists', 'BannerShowing')
|
||||
.setHidden();
|
||||
@@ -158,7 +286,7 @@ module.exports = {
|
||||
'SetupBanner',
|
||||
_('Configure the banner'),
|
||||
_(
|
||||
"Configure a banner, which can then be displayed.\nIf test mode is set, a test banner will be displayed.\n\nOnce a banner is positioned (at the top or bottom of the game), it can't be moved anymore."
|
||||
"Configure a banner, which can then be displayed.\nIf a banner is already displayed, it will be removed\nIf test mode is set, a test banner will be displayed.\n\nOnce a banner is positioned (at the top or bottom of the game), it can't be moved anymore."
|
||||
),
|
||||
_(
|
||||
'Configure the banner with Android ad unit ID: _PARAM0_, iOS ad unit ID: _PARAM1_, display at top: _PARAM2_'
|
||||
@@ -173,7 +301,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('string', _('iOS banner ID'), '', false)
|
||||
.setParameterLongDescription(
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/6300978111"` for showing a test banner.'
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/2934735716"` for showing a test banner.'
|
||||
)
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
@@ -298,7 +426,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('string', _('iOS interstitial ID'), '', false)
|
||||
.setParameterLongDescription(
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/1033173712"` for loading a test interstitial.'
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/4411468910"` for loading a test interstitial.'
|
||||
)
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
@@ -327,90 +455,266 @@ module.exports = {
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.showInterstitial');
|
||||
|
||||
// Reward video
|
||||
// Rewarded Interstitial
|
||||
extension
|
||||
.addCondition(
|
||||
'VideoLoading',
|
||||
_('Video loading'),
|
||||
_('Check if a reward video is currently loading.'),
|
||||
_('Reward video is loading'),
|
||||
'RewardedInterstitialLoading',
|
||||
_('Rewarded interstitial loading'),
|
||||
_('Check if a rewarded interstitial is currently loading.'),
|
||||
_('Rewarded interstitial is loading'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isVideoLoading');
|
||||
.setFunctionName('gdjs.adMob.isRewardedInterstitialLoading');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'VideoReady',
|
||||
_('Video ready'),
|
||||
_('Check if a reward video is ready to be displayed.'),
|
||||
_('Reward video is ready'),
|
||||
'RewardedInterstitialReady',
|
||||
_('Rewarded interstitial ready'),
|
||||
_('Check if a rewarded interstitial is ready to be displayed.'),
|
||||
_('Rewarded interstitial is ready'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isVideoReady');
|
||||
.setFunctionName('gdjs.adMob.isRewardedInterstitialReady');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'VideoShowing',
|
||||
_('Video showing'),
|
||||
_('Check if there is a reward video being displayed.'),
|
||||
_('Reward video is showing'),
|
||||
'RewardedInterstitialShowing',
|
||||
_('Rewarded interstitial showing'),
|
||||
_('Check if there is a rewarded interstitial being displayed.'),
|
||||
_('Rewarded interstitial is showing'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isVideoShowing');
|
||||
.setFunctionName('gdjs.adMob.isRewardedInterstitialShowing');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'VideoErrored',
|
||||
_('Video had an error'),
|
||||
_('Check if there was a error while loading the rewarded video.'),
|
||||
_('Video ad had an error'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isVideoErrored');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'VideoReward',
|
||||
_('Video reward received'),
|
||||
'RewardedInterstitialErrored',
|
||||
_('Rewarded interstitial had an error'),
|
||||
_(
|
||||
'Check if the reward of the video was given to the user.\nYou can mark this reward as cleared, so that the condition will be false and you can show later another reward video.'
|
||||
'Check if there was a error while loading the rewarded interstitial.'
|
||||
),
|
||||
_('Rewarded Interstitial had an error'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isRewardedInterstitialErrored');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedInterstitialRewardReceived',
|
||||
_('Rewarded Interstitial reward received'),
|
||||
_(
|
||||
'Check if the reward of the rewarded interstitial was given to the user.\nYou can mark this reward as cleared, so that the condition will be false and you can show later another rewarded interstitial.'
|
||||
),
|
||||
_(
|
||||
'User got the reward of the rewarded interstitial (and clear this reward: _PARAM0_)'
|
||||
),
|
||||
_('User got the reward of the video (and clear this reward: _PARAM0_)'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
_('Clear the reward (needed to show another video)'),
|
||||
_('Clear the reward (needed to show another rewarded interstitial)'),
|
||||
'',
|
||||
false
|
||||
)
|
||||
.setDefaultValue('true')
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.wasVideoRewardReceived');
|
||||
.setFunctionName('gdjs.adMob.wasRewardedInterstitialRewardReceived');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'LoadVideo',
|
||||
_('Load video'),
|
||||
'LoadRewardedInterstitial',
|
||||
_('Load rewarded interstitial'),
|
||||
_(
|
||||
'Start loading a rewarded interstitial (that can be displayed automatically when the loading is finished).\nIf test mode is set, a test rewarded interstitial will be displayed.\nThis is similar to a rewarded video, but can be displayed at any time, and the user can close it.'
|
||||
),
|
||||
_(
|
||||
'Load rewarded interstitial with Android ad unit ID: _PARAM0_, iOS ad unit ID: _PARAM1_ (display automatically when loaded: _PARAM2_)'
|
||||
),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.addParameter('string', _('Android rewarded interstitial ID'), '', false)
|
||||
.setParameterLongDescription(
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/5354046379"` for loading a test rewarded interstitial.'
|
||||
)
|
||||
.addParameter('string', _('iOS interstitial ID'), '', false)
|
||||
.setParameterLongDescription(
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/6978759866"` for loading a test rewarded interstitial.'
|
||||
)
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
_('Displayed automatically when loading is finished?'),
|
||||
'',
|
||||
false
|
||||
)
|
||||
.setDefaultValue('true')
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.loadRewardedInterstitial');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'ShowRewardedInterstitial',
|
||||
_('Show rewarded interstitial'),
|
||||
_(
|
||||
'Show the rewarded interstitial that was loaded. Will work only when the rewarded interstitial is fully loaded.'
|
||||
),
|
||||
_('Show the loaded rewarded interstitial'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.showRewardedInterstitial');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'ClaimRewardedInterstitialReward',
|
||||
_('Mark the reward of the rewarded interstitial as claimed'),
|
||||
_(
|
||||
'Mark the rewarded interstitial reward as claimed. Useful if you used the condition to check if the reward was given to the user without clearing the reward.'
|
||||
),
|
||||
_('Mark the reward of the rewarded interstitial as claimed'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.markRewardedInterstitialRewardAsClaimed');
|
||||
|
||||
// Rewarded video
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedVideoLoading',
|
||||
_('Rewarded video loading'),
|
||||
_('Check if a rewarded video is currently loading.'),
|
||||
_('Rewarded video is loading'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isRewardedVideoLoading');
|
||||
|
||||
// Deprecated condition (was renamed):
|
||||
extension
|
||||
.addDuplicatedCondition('VideoLoading', 'RewardedVideoLoading')
|
||||
.setHidden();
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedVideoReady',
|
||||
_('Rewarded video ready'),
|
||||
_('Check if a rewarded video is ready to be displayed.'),
|
||||
_('Rewarded video is ready'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isRewardedVideoReady');
|
||||
|
||||
// Deprecated condition (was renamed):
|
||||
extension
|
||||
.addDuplicatedCondition('VideoReady', 'RewardedVideoReady')
|
||||
.setHidden();
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedVideoShowing',
|
||||
_('Rewarded video showing'),
|
||||
_('Check if there is a rewarded video being displayed.'),
|
||||
_('Rewarded video is showing'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isRewardedVideoShowing');
|
||||
|
||||
// Deprecated condition (was renamed):
|
||||
extension
|
||||
.addDuplicatedCondition('VideoShowing', 'RewardedVideoShowing')
|
||||
.setHidden();
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedVideoErrored',
|
||||
_('Rewarded video had an error'),
|
||||
_('Check if there was a error while loading the rewarded video.'),
|
||||
_('Rewarded video ad had an error'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.isRewardedVideoErrored');
|
||||
|
||||
// Deprecated condition (was renamed):
|
||||
extension
|
||||
.addDuplicatedCondition('VideoErrored', 'RewardedVideoErrored')
|
||||
.setHidden();
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'RewardedVideoRewardReceived',
|
||||
_('Rewarded Video reward received'),
|
||||
_(
|
||||
'Check if the reward of the rewarded video was given to the user.\nYou can mark this reward as cleared, so that the condition will be false and you can show later another rewarded video.'
|
||||
),
|
||||
_(
|
||||
'User got the reward of the rewarded video (and clear this reward: _PARAM0_)'
|
||||
),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
_('Clear the reward (needed to show another rewarded video)'),
|
||||
'',
|
||||
false
|
||||
)
|
||||
.setDefaultValue('true')
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.wasRewardedVideoRewardReceived');
|
||||
|
||||
// Deprecated condition (was renamed):
|
||||
extension
|
||||
.addDuplicatedCondition('VideoReward', 'RewardedVideoRewardReceived')
|
||||
.setHidden();
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'LoadRewardedVideo',
|
||||
_('Load rewarded video'),
|
||||
_(
|
||||
'Start loading a reward video (that can be displayed automatically when the loading is finished).\nIf test mode is set, a test video will be displayed.'
|
||||
),
|
||||
@@ -427,7 +731,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('string', _('iOS reward video ID'), '', false)
|
||||
.setParameterLongDescription(
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/5224354917"` for loading a test rewarded video.'
|
||||
'Get it from your AdMob account. You can use `"ca-app-pub-3940256099942544/1712485313"` for loading a test rewarded video.'
|
||||
)
|
||||
.addParameter(
|
||||
'yesorno',
|
||||
@@ -438,12 +742,15 @@ module.exports = {
|
||||
.setDefaultValue('true')
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.loadVideo');
|
||||
.setFunctionName('gdjs.adMob.loadRewardedVideo');
|
||||
|
||||
// Deprecated action (was renamed):
|
||||
extension.addDuplicatedAction('LoadVideo', 'LoadRewardedVideo').setHidden();
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'ShowVideo',
|
||||
_('Show video'),
|
||||
'ShowRewardedVideo',
|
||||
_('Show rewarded video'),
|
||||
_(
|
||||
'Show the reward video that was loaded. Will work only when the video is fully loaded.'
|
||||
),
|
||||
@@ -454,23 +761,31 @@ module.exports = {
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.showVideo');
|
||||
.setFunctionName('gdjs.adMob.showRewardedVideo');
|
||||
|
||||
// Deprecated action (was renamed):
|
||||
extension.addDuplicatedAction('ShowVideo', 'ShowRewardedVideo').setHidden();
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'ClaimReward',
|
||||
_('Mark the reward of the video as claimed'),
|
||||
'ClaimRewardedVideoReward',
|
||||
_('Mark the reward of the rewarded video as claimed'),
|
||||
_(
|
||||
'Mark the video reward as claimed. Useful if you used the condition to check if the reward was given to the user without clearing the reward.'
|
||||
'Mark the rewarded video reward as claimed. Useful if you used the condition to check if the reward was given to the user without clearing the reward.'
|
||||
),
|
||||
_('Mark the reward of the video as claimed'),
|
||||
_('Mark the reward of the rewarded video as claimed'),
|
||||
'',
|
||||
'JsPlatform/Extensions/admobicon24.png',
|
||||
'JsPlatform/Extensions/admobicon16.png'
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/AdMob/admobtools.js')
|
||||
.setFunctionName('gdjs.adMob.markVideoRewardAsClaimed');
|
||||
.setFunctionName('gdjs.adMob.markRewardedVideoRewardAsClaimed');
|
||||
|
||||
// Deprecated action (was renamed):
|
||||
extension
|
||||
.addDuplicatedAction('ClaimReward', 'ClaimRewardedVideoReward')
|
||||
.setHidden();
|
||||
|
||||
return extension;
|
||||
},
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,7 @@
|
||||
// @ts-check
|
||||
describe('gdjs.AnchorRuntimeBehavior', function () {
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: { resources: [] },
|
||||
// @ts-ignore
|
||||
properties: { windowWidth: 1000, windowHeight: 1000 },
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame({
|
||||
propertiesOverrides: { windowHeight: 1000, windowWidth: 1000 },
|
||||
});
|
||||
const anchorBehaviorName = 'Anchor';
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
|
@@ -36,7 +36,7 @@ module.exports = {
|
||||
'Open source (MIT License)'
|
||||
)
|
||||
.setExtensionHelpPath('/objects/bbtext')
|
||||
.setCategory('User interface');
|
||||
.setCategory('Text');
|
||||
extension
|
||||
.addInstructionOrExpressionGroupMetadata(_('BBCode Text Object'))
|
||||
.setIcon('JsPlatform/Extensions/bbcode32.png');
|
||||
@@ -174,7 +174,7 @@ module.exports = {
|
||||
.addIncludeFile(
|
||||
'Extensions/BBText/pixi-multistyle-text/dist/pixi-multistyle-text.umd.js'
|
||||
)
|
||||
.setCategoryFullName(_('User interface'));
|
||||
.setCategoryFullName(_('Text'));
|
||||
|
||||
/**
|
||||
* Utility function to add both a setter and a getter to a property from a list.
|
||||
|
@@ -36,9 +36,10 @@ module.exports = {
|
||||
'Open source (MIT License)'
|
||||
)
|
||||
.setExtensionHelpPath('/objects/bitmap_text')
|
||||
.setCategory('User interface');
|
||||
extension.addInstructionOrExpressionGroupMetadata(_("Bitmap Text"))
|
||||
.setIcon("JsPlatform/Extensions/bitmapfont32.png");
|
||||
.setCategory('Text');
|
||||
extension
|
||||
.addInstructionOrExpressionGroupMetadata(_('Bitmap Text'))
|
||||
.setIcon('JsPlatform/Extensions/bitmapfont32.png');
|
||||
|
||||
const bitmapTextObject = new gd.ObjectJsImplementation();
|
||||
// $FlowExpectedError
|
||||
@@ -91,7 +92,7 @@ module.exports = {
|
||||
.setType('resource')
|
||||
.addExtraInfo('bitmapFont') //fnt or xml files
|
||||
.setLabel(_('Bitmap Font'))
|
||||
.setGroup(_("Font"));
|
||||
.setGroup(_('Font'));
|
||||
|
||||
objectProperties
|
||||
.getOrCreate('textureAtlasResourceName')
|
||||
@@ -99,7 +100,7 @@ module.exports = {
|
||||
.setType('resource')
|
||||
.addExtraInfo('image')
|
||||
.setLabel(_('Bitmap atlas image'))
|
||||
.setGroup(_("Font"));
|
||||
.setGroup(_('Font'));
|
||||
|
||||
objectProperties
|
||||
.getOrCreate('scale')
|
||||
@@ -113,7 +114,7 @@ module.exports = {
|
||||
.setValue(objectContent.tint)
|
||||
.setType('color')
|
||||
.setLabel(_('Font tint'))
|
||||
.setGroup(_("Font"));
|
||||
.setGroup(_('Font'));
|
||||
|
||||
objectProperties
|
||||
.getOrCreate('wordWrap')
|
||||
@@ -174,7 +175,7 @@ module.exports = {
|
||||
.addIncludeFile(
|
||||
'Extensions/BitmapText/bitmaptextruntimeobject-pixi-renderer.js'
|
||||
)
|
||||
.setCategoryFullName(_('User interface'));
|
||||
.setCategoryFullName(_('Text'));
|
||||
|
||||
object
|
||||
.addExpressionAndConditionAndAction(
|
||||
@@ -652,8 +653,7 @@ module.exports = {
|
||||
|
||||
// This is called to update the PIXI object on the scene editor
|
||||
RenderedBitmapTextInstance.prototype.update = function () {
|
||||
const properties = this._associatedObjectConfiguration
|
||||
.getProperties();
|
||||
const properties = this._associatedObjectConfiguration.getProperties();
|
||||
|
||||
// Update the rendered text properties (note: Pixi is only
|
||||
// applying changes if there were changed).
|
||||
|
@@ -1,11 +1,6 @@
|
||||
// @ts-check
|
||||
describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
var runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: { resources: [] },
|
||||
// @ts-ignore
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
});
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
var runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [
|
||||
|
@@ -176,12 +176,12 @@ module.exports = {
|
||||
.setType('number');
|
||||
bevelProperties
|
||||
.getOrCreate('lightColor')
|
||||
.setValue('#ffffff')
|
||||
.setValue('255;255;255')
|
||||
.setLabel(_('Light color (color of the outline)'))
|
||||
.setType('color');
|
||||
bevelProperties
|
||||
.getOrCreate('shadowColor')
|
||||
.setValue('#000000')
|
||||
.setValue('0;0;0')
|
||||
.setLabel(_('Shadow color (color of the outline)'))
|
||||
.setType('color');
|
||||
bevelProperties
|
||||
@@ -333,13 +333,13 @@ module.exports = {
|
||||
const colorReplaceProperties = colorReplaceEffect.getProperties();
|
||||
colorReplaceProperties
|
||||
.getOrCreate('originalColor')
|
||||
.setValue('#ff0000')
|
||||
.setValue('252;3;65')
|
||||
.setLabel(_('Original Color'))
|
||||
.setType('color')
|
||||
.setDescription('The color that will be changed');
|
||||
colorReplaceProperties
|
||||
.getOrCreate('newColor')
|
||||
.setValue('#000000')
|
||||
.setValue('255;255;255')
|
||||
.setLabel(_('New Color'))
|
||||
.setType('color')
|
||||
.setDescription('The new color');
|
||||
@@ -517,7 +517,7 @@ module.exports = {
|
||||
.setType('number');
|
||||
dropShadowProperties
|
||||
.getOrCreate('color')
|
||||
.setValue('#000000')
|
||||
.setValue('255;255;255')
|
||||
.setLabel(_('Color of the shadow'))
|
||||
.setType('color');
|
||||
dropShadowProperties
|
||||
@@ -646,7 +646,7 @@ module.exports = {
|
||||
.setType('number');
|
||||
glowProperties
|
||||
.getOrCreate('color')
|
||||
.setValue('#ffffff')
|
||||
.setValue('255;255;255')
|
||||
.setLabel(_('Color (color of the outline)'))
|
||||
.setType('color');
|
||||
|
||||
@@ -868,7 +868,7 @@ module.exports = {
|
||||
.setType('number');
|
||||
outlineProperties
|
||||
.getOrCreate('color')
|
||||
.setValue('1')
|
||||
.setValue('255;255;255')
|
||||
.setLabel(_('Color of the outline'))
|
||||
.setType('color');
|
||||
outlineProperties
|
||||
|
@@ -89,7 +89,7 @@ module.exports = {
|
||||
.addExtraInfo('image');
|
||||
dummyEffectProperties
|
||||
.getOrCreate('someColor')
|
||||
.setValue('#0022FF')
|
||||
.setValue('255;3;62')
|
||||
.setLabel(_("Color (won't be used, just for demonstration purpose)"))
|
||||
.setType('color')
|
||||
.setDescription(_('Another optional description.'));
|
||||
|
@@ -1,17 +1,3 @@
|
||||
/**
|
||||
* A firebase configuaration of a project made only for those tests.
|
||||
*/
|
||||
const firebaseConfig = {
|
||||
apiKey: 'AIzaSyBwPnGpfEBXDjwQrWfU0wqgp4m9qEt7YM8',
|
||||
authDomain: 'gdtest-e11a5.firebaseapp.com',
|
||||
databaseURL: 'https://gdtest-e11a5.firebaseio.com',
|
||||
projectId: 'gdtest-e11a5',
|
||||
storageBucket: 'gdtest-e11a5.appspot.com',
|
||||
messagingSenderId: '254035412678',
|
||||
appId: '1:254035412678:web:2ddd6b83019b7f259b79c7',
|
||||
measurementId: 'G-4REML26L59',
|
||||
};
|
||||
|
||||
/**
|
||||
* Turns a callback variable into a promise.
|
||||
* @param {(callbackVariable: {setString: (result: "ok" | string) => void}, result: gdjs.Variable) => any} executor
|
||||
@@ -38,6 +24,20 @@ const variable = new gdjs.Variable().fromJSObject({
|
||||
it: ['is', true],
|
||||
});
|
||||
|
||||
/**
|
||||
* A firebase configuration of a project made only for those tests.
|
||||
*/
|
||||
const firebaseConfig = {
|
||||
apiKey: 'AIzaSyBwPnGpfEBXDjwQrWfU0wqgp4m9qEt7YM8',
|
||||
authDomain: 'gdtest-e11a5.firebaseapp.com',
|
||||
databaseURL: 'https://gdtest-e11a5.firebaseio.com',
|
||||
projectId: 'gdtest-e11a5',
|
||||
storageBucket: 'gdtest-e11a5.appspot.com',
|
||||
messagingSenderId: '254035412678',
|
||||
appId: '1:254035412678:web:2ddd6b83019b7f259b79c7',
|
||||
measurementId: 'G-4REML26L59',
|
||||
};
|
||||
|
||||
// The tests require an internet connection, as a real Firebase instance is used.
|
||||
const describeIfOnline = navigator.onLine ? describe : describe.skip;
|
||||
describeIfOnline('Firebase extension end-to-end tests', function () {
|
||||
@@ -48,8 +48,8 @@ describeIfOnline('Firebase extension end-to-end tests', function () {
|
||||
.toString()
|
||||
.replace('.', '-')}-${Date.now()}`;
|
||||
|
||||
before(function setupFirebase() {
|
||||
gdjs.evtTools.firebaseTools._setupFirebase({
|
||||
before(async function setupFirebase() {
|
||||
await gdjs.evtTools.firebaseTools._setupFirebase({
|
||||
getGame: () => ({
|
||||
getExtensionProperty: () => JSON.stringify(firebaseConfig),
|
||||
}),
|
||||
|
@@ -1,10 +1,6 @@
|
||||
describe('Inventory', function () {
|
||||
it('Inventories can be serialized then unserialized with no data loss', () => {
|
||||
var runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
resources: { resources: [] },
|
||||
});
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
var runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
|
||||
gdjs.evtTools.inventory.add(runtimeScene, 'MyInventory', 'sword');
|
||||
|
@@ -154,6 +154,21 @@ module.exports = {
|
||||
.setIncludeFile('Extensions/Leaderboards/leaderboardstools.js')
|
||||
.setFunctionName('gdjs.evtTools.leaderboards.isSaving');
|
||||
|
||||
extension
|
||||
.addCondition(
|
||||
'HasPlayerJustClosedLeaderboardView',
|
||||
_('Closed by player'),
|
||||
_('Check if the player has just closed the leaderboard view.'),
|
||||
_('Player has just closed the leaderboard view'),
|
||||
_('Display leaderboard'),
|
||||
'JsPlatform/Extensions/leaderboard.svg',
|
||||
'JsPlatform/Extensions/leaderboard.svg'
|
||||
)
|
||||
.setHelpPath('/all-features/leaderboards')
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/Leaderboards/leaderboardstools.js')
|
||||
.setFunctionName('gdjs.evtTools.leaderboards.hasPlayerJustClosedLeaderboardView');
|
||||
|
||||
extension
|
||||
.addStrExpression(
|
||||
'LastSaveError',
|
||||
|
@@ -5,6 +5,19 @@ namespace gdjs {
|
||||
const logger = new gdjs.Logger('Leaderboards');
|
||||
export namespace evtTools {
|
||||
export namespace leaderboards {
|
||||
let _hasPlayerJustClosedLeaderboardView = false;
|
||||
|
||||
gdjs.registerRuntimeScenePostEventsCallback(() => {
|
||||
// Set it back to false for the next frame.
|
||||
_hasPlayerJustClosedLeaderboardView = false;
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns true if the player has just closed the leaderboard view.
|
||||
*/
|
||||
export const hasPlayerJustClosedLeaderboardView = () =>
|
||||
_hasPlayerJustClosedLeaderboardView;
|
||||
|
||||
const computeDigest = (payload: string): string => {
|
||||
const shaObj = new jsSHA('SHA-256', 'TEXT', { encoding: 'UTF8' });
|
||||
shaObj.update(payload);
|
||||
@@ -521,6 +534,7 @@ namespace gdjs {
|
||||
) {
|
||||
switch (event.data) {
|
||||
case 'closeLeaderboardView':
|
||||
_hasPlayerJustClosedLeaderboardView = true;
|
||||
closeLeaderboardView(runtimeScene);
|
||||
break;
|
||||
case 'leaderboardViewLoaded':
|
||||
@@ -672,7 +686,7 @@ namespace gdjs {
|
||||
const isDev = runtimeScene
|
||||
.getGame()
|
||||
.isUsingGDevelopDevelopmentEnvironment();
|
||||
const targetUrl = `https://liluo.io/games/${gameId}/leaderboard/${leaderboardId}?inGameEmbedded=true${
|
||||
const targetUrl = `https://gd.games/games/${gameId}/leaderboard/${leaderboardId}?inGameEmbedded=true${
|
||||
isDev ? '&dev=true' : ''
|
||||
}`;
|
||||
checkLeaderboardAvailability(targetUrl).then(
|
||||
|
@@ -56,13 +56,7 @@ const addLightObstacle = (runtimeScene, width, height) => {
|
||||
|
||||
describe('gdjs.LightRuntimeObject', function () {
|
||||
PIXI.settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: {
|
||||
resources: [],
|
||||
},
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
});
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [{ name: '', visibility: true, effects: [] }],
|
||||
@@ -96,13 +90,7 @@ describe('gdjs.LightRuntimeObject', function () {
|
||||
|
||||
describe('Light with obstacles around it', function () {
|
||||
PIXI.settings.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT = false;
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: {
|
||||
resources: [],
|
||||
},
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
});
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [{ name: '', visibility: true, effects: [] }],
|
||||
|
@@ -6,12 +6,7 @@ describe('gdjs.LinksManager', function () {
|
||||
object3Names,
|
||||
eventsFunctionContext
|
||||
) => {
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
// @ts-ignore - missing properties.
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
resources: { resources: [] },
|
||||
});
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [
|
||||
|
@@ -6,12 +6,7 @@ describe('gdjs.PathfindingRuntimeBehavior', function () {
|
||||
const pathFindingName = 'auto1';
|
||||
|
||||
const createScene = (framePerSecond = 60) => {
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
// @ts-ignore - missing properties.
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
resources: { resources: [] },
|
||||
});
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [
|
||||
|
@@ -9,12 +9,7 @@ describe('gdjs.PathfindingRuntimeBehavior', function () {
|
||||
const pathFindingName = 'auto1';
|
||||
|
||||
const createScene = (framePerSecond = 60) => {
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
// @ts-ignore - missing properties.
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
resources: { resources: [] },
|
||||
});
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [
|
||||
|
@@ -11,12 +11,7 @@ describe('gdjs.PathfindingRuntimeBehavior', function () {
|
||||
const pathFindingName = 'auto1';
|
||||
|
||||
let createScene = () => {
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
// @ts-ignore - missing properties.
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
resources: { resources: [] },
|
||||
});
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [
|
||||
|
@@ -59,11 +59,7 @@ describe('Physics2RuntimeBehavior', () => {
|
||||
}
|
||||
|
||||
function createGameWithSceneWithPhysics2SharedData() {
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: { resources: [] },
|
||||
properties: { windowWidth: 1000, windowHeight: 1000 },
|
||||
});
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeScene = new gdjs.TestRuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [
|
||||
|
@@ -1,12 +1,6 @@
|
||||
|
||||
const makePlatformerTestRuntimeScene = (timeDelta = 1000 / 60) => {
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: {
|
||||
resources: [],
|
||||
},
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
});
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeScene = new gdjs.TestRuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [{ name: '', visibility: true, effects: [] }],
|
||||
|
@@ -1,12 +1,6 @@
|
||||
describe(`gdjs.PlatformerObjectRuntimeBehavior.findHighestFloorAndMoveOnTop`, function () {
|
||||
const makeTestRuntimeScene = () => {
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
resources: {
|
||||
resources: [],
|
||||
},
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
});
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [{ name: '', visibility: true, effects: [] }],
|
||||
|
@@ -68,6 +68,29 @@ module.exports = {
|
||||
)
|
||||
.setFunctionName('gdjs.playerAuthentication.displayAuthenticationBanner');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'HideAuthenticationBanner',
|
||||
_('Hide authentication banner'),
|
||||
_(
|
||||
'Hide the authentication banner from the top of the game screen.'
|
||||
),
|
||||
_('Hide the authentication banner'),
|
||||
'',
|
||||
'JsPlatform/Extensions/authentication.svg',
|
||||
'JsPlatform/Extensions/authentication.svg'
|
||||
)
|
||||
.addCodeOnlyParameter('currentScene', '')
|
||||
.setHelpPath('/all-features/player-authentication')
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile(
|
||||
'Extensions/PlayerAuthentication/playerauthenticationcomponents.js'
|
||||
)
|
||||
.addIncludeFile(
|
||||
'Extensions/PlayerAuthentication/playerauthenticationtools.js'
|
||||
)
|
||||
.setFunctionName('gdjs.playerAuthentication.removeAuthenticationBanner');
|
||||
|
||||
extension
|
||||
.addAction(
|
||||
'OpenAuthenticationWindow',
|
||||
|
@@ -34,6 +34,7 @@ namespace gdjs {
|
||||
): {
|
||||
rootContainer: HTMLDivElement;
|
||||
loaderContainer: HTMLDivElement;
|
||||
iframeContainer: HTMLDivElement;
|
||||
} {
|
||||
const rootContainer = document.createElement('div');
|
||||
rootContainer.id = 'authentication-root-container';
|
||||
@@ -45,17 +46,17 @@ namespace gdjs {
|
||||
rootContainer.style.zIndex = '2';
|
||||
rootContainer.style.pointerEvents = 'all';
|
||||
|
||||
const subContainer = document.createElement('div');
|
||||
subContainer.id = 'authentication-sub-container';
|
||||
subContainer.style.backgroundColor = '#FFFFFF';
|
||||
subContainer.style.position = 'absolute';
|
||||
subContainer.style.top = '16px';
|
||||
subContainer.style.bottom = '16px';
|
||||
subContainer.style.left = '16px';
|
||||
subContainer.style.right = '16px';
|
||||
subContainer.style.borderRadius = '8px';
|
||||
subContainer.style.boxShadow = '0px 4px 4px rgba(0, 0, 0, 0.25)';
|
||||
subContainer.style.padding = '16px';
|
||||
const frameContainer = document.createElement('div');
|
||||
frameContainer.id = 'authentication-frame-container';
|
||||
frameContainer.style.backgroundColor = '#FFFFFF';
|
||||
frameContainer.style.position = 'absolute';
|
||||
frameContainer.style.top = '16px';
|
||||
frameContainer.style.bottom = '16px';
|
||||
frameContainer.style.left = '16px';
|
||||
frameContainer.style.right = '16px';
|
||||
frameContainer.style.borderRadius = '8px';
|
||||
frameContainer.style.boxShadow = '0px 4px 4px rgba(0, 0, 0, 0.25)';
|
||||
frameContainer.style.padding = '16px';
|
||||
|
||||
const _closeContainer: HTMLDivElement = document.createElement('div');
|
||||
_closeContainer.style.cursor = 'pointer';
|
||||
@@ -106,11 +107,57 @@ namespace gdjs {
|
||||
|
||||
loaderContainer.appendChild(_loader);
|
||||
|
||||
subContainer.appendChild(_closeContainer);
|
||||
subContainer.appendChild(loaderContainer);
|
||||
rootContainer.appendChild(subContainer);
|
||||
const iframeContainer: HTMLDivElement = document.createElement('div');
|
||||
iframeContainer.style.display = 'flex';
|
||||
iframeContainer.style.flexDirection = 'column';
|
||||
iframeContainer.style.height = '100%';
|
||||
iframeContainer.style.width = '100%';
|
||||
iframeContainer.style.justifyContent = 'stretch';
|
||||
iframeContainer.style.alignItems = 'stretch';
|
||||
iframeContainer.style.display = 'none';
|
||||
|
||||
return { rootContainer, loaderContainer };
|
||||
frameContainer.appendChild(_closeContainer);
|
||||
frameContainer.appendChild(loaderContainer);
|
||||
frameContainer.appendChild(iframeContainer);
|
||||
rootContainer.appendChild(frameContainer);
|
||||
|
||||
return { rootContainer, loaderContainer, iframeContainer };
|
||||
};
|
||||
|
||||
export const displayIframeInsideAuthenticationContainer = (
|
||||
iframeContainer: HTMLDivElement,
|
||||
loaderContainer: HTMLDivElement,
|
||||
textContainer: HTMLDivElement,
|
||||
url: string
|
||||
) => {
|
||||
const iframe = document.createElement('iframe');
|
||||
iframe.setAttribute(
|
||||
'sandbox',
|
||||
'allow-forms allow-modals allow-orientation-lock allow-popups allow-same-origin allow-scripts'
|
||||
);
|
||||
iframe.addEventListener('load', () => {
|
||||
iframeContainer.style.display = 'flex';
|
||||
loaderContainer.style.display = 'none';
|
||||
});
|
||||
iframe.addEventListener('loaderror', () => {
|
||||
addAuthenticationUrlToTextsContainer(() => {
|
||||
// Try again.
|
||||
iframeContainer.removeChild(iframe);
|
||||
iframeContainer.style.display = 'none';
|
||||
loaderContainer.style.display = 'flex';
|
||||
displayIframeInsideAuthenticationContainer(
|
||||
iframeContainer,
|
||||
loaderContainer,
|
||||
textContainer,
|
||||
url
|
||||
);
|
||||
}, textContainer);
|
||||
});
|
||||
iframe.src = url;
|
||||
iframe.style.flex = '1';
|
||||
iframe.style.border = '0';
|
||||
|
||||
iframeContainer.appendChild(iframe);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -445,7 +492,7 @@ namespace gdjs {
|
||||
* Helper to add event listeners on a pressable/clickable element
|
||||
* to work on both desktop and mobile.
|
||||
*/
|
||||
export const addTouchAndClickEventListeners = function (
|
||||
const addTouchAndClickEventListeners = function (
|
||||
element: HTMLElement,
|
||||
action: () => void
|
||||
) {
|
||||
|
@@ -18,6 +18,7 @@ namespace gdjs {
|
||||
let _authenticationInAppWindow: Window | null = null; // For Cordova.
|
||||
let _authenticationRootContainer: HTMLDivElement | null = null;
|
||||
let _authenticationLoaderContainer: HTMLDivElement | null = null;
|
||||
let _authenticationIframeContainer: HTMLDivElement | null = null;
|
||||
let _authenticationTextContainer: HTMLDivElement | null = null;
|
||||
let _authenticationBanner: HTMLDivElement | null = null;
|
||||
let _initialAuthenticationTimeoutId: NodeJS.Timeout | null = null;
|
||||
@@ -38,12 +39,12 @@ namespace gdjs {
|
||||
});
|
||||
|
||||
// If the extension is used, register an eventlistener to know if the user is
|
||||
// logged in while playing the game on Liluo.io.
|
||||
// logged in while playing the game on GDevelop games platform.
|
||||
// Then send a message to the parent iframe to say that the player auth is ready.
|
||||
gdjs.registerFirstRuntimeSceneLoadedCallback(
|
||||
(runtimeScene: RuntimeScene) => {
|
||||
if (getPlatform(runtimeScene) !== 'web') {
|
||||
// Automatic authentication is only valid when the game is hosted in Liluo.io.
|
||||
// Automatic authentication is only valid when the game is hosted on GDevelop games platform.
|
||||
return;
|
||||
}
|
||||
removeAuthenticationCallbacks(); // Remove any callback that could have been registered before.
|
||||
@@ -64,9 +65,9 @@ namespace gdjs {
|
||||
{
|
||||
id: 'playerAuthReady',
|
||||
},
|
||||
'*' // We could restrict to liluo.io but it's not necessary as the message is not sensitive, and it allows easy debugging.
|
||||
'*' // We could restrict to GDevelop games platform but it's not necessary as the message is not sensitive, and it allows easy debugging.
|
||||
);
|
||||
// If no answer after 3 seconds, assume that the game is not embedded in Liluo.io, and remove the listener.
|
||||
// If no answer after 3 seconds, assume that the game is not embedded in GDevelop games platform, and remove the listener.
|
||||
_initialAuthenticationTimeoutId = setTimeout(() => {
|
||||
logger.info('Removing initial authentication listener.');
|
||||
removeAuthenticationCallbacks();
|
||||
@@ -85,12 +86,16 @@ namespace gdjs {
|
||||
runtimeGame: gdjs.RuntimeGame;
|
||||
gameId: string;
|
||||
connectionId?: string;
|
||||
}) =>
|
||||
`https://liluo.io/auth?gameId=${gameId}${
|
||||
}) => {
|
||||
// Uncomment to test the case of a failing loading:
|
||||
// return 'https://gd.games.wronglink';
|
||||
|
||||
return `https://gd.games/auth?gameId=${gameId}${
|
||||
connectionId ? `&connectionId=${connectionId}` : ''
|
||||
}${
|
||||
runtimeGame.isUsingGDevelopDevelopmentEnvironment() ? '&dev=true' : ''
|
||||
}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper returning the platform.
|
||||
@@ -98,14 +103,31 @@ namespace gdjs {
|
||||
const getPlatform = (
|
||||
runtimeScene: RuntimeScene
|
||||
): 'electron' | 'cordova' | 'web' => {
|
||||
const electron = runtimeScene.getGame().getRenderer().getElectron();
|
||||
const runtimeGame = runtimeScene.getGame();
|
||||
const electron = runtimeGame.getRenderer().getElectron();
|
||||
if (electron) {
|
||||
return 'electron';
|
||||
}
|
||||
if (typeof cordova !== 'undefined') return 'cordova';
|
||||
|
||||
return 'web';
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if, in some exceptional cases, we allow authentication
|
||||
* to be done through a iframe.
|
||||
* This is usually discouraged as the user can't verify that the authentication
|
||||
* window is a genuine one. It's only to be used in trusted contexts.
|
||||
*/
|
||||
const shouldAuthenticationUseIframe = (runtimeScene: RuntimeScene) => {
|
||||
const runtimeGameOptions = runtimeScene.getGame().getAdditionalOptions();
|
||||
return (
|
||||
runtimeGameOptions &&
|
||||
runtimeGameOptions.isPreview &&
|
||||
runtimeGameOptions.allowAuthenticationUsingIframeForPreview
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if a user token is present in the local storage.
|
||||
*/
|
||||
@@ -509,7 +531,7 @@ namespace gdjs {
|
||||
|
||||
/**
|
||||
* Helper to recompute the authentication banner.
|
||||
* This is useful if the user is already logged in on Liluo.io
|
||||
* This is useful if the user is already logged on GDevelop games platform
|
||||
* and we want to display the banner with the username.
|
||||
*/
|
||||
const refreshAuthenticationBannerIfAny = function (
|
||||
@@ -685,6 +707,47 @@ namespace gdjs {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper to handle authentication iframe on web.
|
||||
* We open an iframe, and listen to messages posted back to the game window.
|
||||
*/
|
||||
const openAuthenticationIframeForWeb = (
|
||||
runtimeScene: gdjs.RuntimeScene,
|
||||
gameId: string
|
||||
) => {
|
||||
if (
|
||||
!_authenticationIframeContainer ||
|
||||
!_authenticationLoaderContainer ||
|
||||
!_authenticationTextContainer
|
||||
) {
|
||||
console.error(
|
||||
"Can't open an authentication iframe - no iframe container, loader container or text container was opened for it."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const targetUrl = getAuthWindowUrl({
|
||||
runtimeGame: runtimeScene.getGame(),
|
||||
gameId,
|
||||
});
|
||||
|
||||
// Listen to messages posted by the authentication window, so that we can
|
||||
// know when the user is authenticated.
|
||||
_authenticationMessageCallback = (event: MessageEvent) => {
|
||||
receiveAuthenticationMessage(runtimeScene, event, {
|
||||
checkOrigin: true,
|
||||
});
|
||||
};
|
||||
window.addEventListener('message', _authenticationMessageCallback, true);
|
||||
|
||||
authComponents.displayIframeInsideAuthenticationContainer(
|
||||
_authenticationIframeContainer,
|
||||
_authenticationLoaderContainer,
|
||||
_authenticationTextContainer,
|
||||
targetUrl
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Action to display the authentication window to the user.
|
||||
*/
|
||||
@@ -725,11 +788,13 @@ namespace gdjs {
|
||||
const {
|
||||
rootContainer,
|
||||
loaderContainer,
|
||||
iframeContainer,
|
||||
} = authComponents.computeAuthenticationContainer(
|
||||
onAuthenticationContainerDismissed
|
||||
);
|
||||
_authenticationRootContainer = rootContainer;
|
||||
_authenticationLoaderContainer = loaderContainer;
|
||||
_authenticationIframeContainer = iframeContainer;
|
||||
|
||||
// Display the authentication window right away, to show a loader
|
||||
// while the call for game registration is happening.
|
||||
@@ -769,7 +834,11 @@ namespace gdjs {
|
||||
break;
|
||||
case 'web':
|
||||
default:
|
||||
openAuthenticationWindowForWeb(runtimeScene, _gameId);
|
||||
if (shouldAuthenticationUseIframe(runtimeScene)) {
|
||||
openAuthenticationIframeForWeb(runtimeScene, _gameId);
|
||||
} else {
|
||||
openAuthenticationWindowForWeb(runtimeScene, _gameId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -815,6 +884,7 @@ namespace gdjs {
|
||||
|
||||
_authenticationRootContainer = null;
|
||||
_authenticationLoaderContainer = null;
|
||||
_authenticationIframeContainer = null;
|
||||
_authenticationTextContainer = null;
|
||||
};
|
||||
|
||||
@@ -838,7 +908,7 @@ namespace gdjs {
|
||||
/**
|
||||
* Remove the banner displaying the authentication status.
|
||||
*/
|
||||
const removeAuthenticationBanner = function (
|
||||
export const removeAuthenticationBanner = function (
|
||||
runtimeScene: gdjs.RuntimeScene
|
||||
) {
|
||||
if (!_authenticationBanner) {
|
||||
|
@@ -28,9 +28,9 @@ void DeclarePrimitiveDrawingExtension(gd::PlatformExtension& extension) {
|
||||
.AddObject<ShapePainterObject>(
|
||||
"Drawer", //"Drawer" is kept for compatibility with GD<=3.6.76
|
||||
_("Shape painter"),
|
||||
_("Allows you to draw simple shapes on the screen"),
|
||||
_("Allows you to draw simple shapes on the screen using the events."),
|
||||
"CppPlatform/Extensions/primitivedrawingicon.png")
|
||||
.SetCategoryFullName(_("General"));
|
||||
.SetCategoryFullName(_("Advanced"));
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
obj.AddAction(
|
||||
@@ -722,7 +722,7 @@ void DeclarePrimitiveDrawingExtension(gd::PlatformExtension& extension) {
|
||||
_("Center of rotation"),
|
||||
_("Change the center of rotation of an object relatively to the "
|
||||
"object origin."),
|
||||
_("Change the center of rotation of _PARAM0_: _PARAM1_; _PARAM2_"),
|
||||
_("Change the center of rotation of _PARAM0_ to _PARAM1_, _PARAM2_"),
|
||||
_("Angle"),
|
||||
"res/actions/position24_black.png",
|
||||
"res/actions/position_black.png")
|
||||
|
@@ -474,7 +474,7 @@ namespace gdjs {
|
||||
/**
|
||||
* The center of rotation is defined relatively
|
||||
* to the drawing origin (the object position).
|
||||
* This avoid the center to move on the drawing
|
||||
* This avoids the center to move on the drawing
|
||||
* when new shapes push the bounds.
|
||||
*
|
||||
* When no custom center is defined, it will move
|
||||
|
@@ -9,13 +9,14 @@ This project is released under the MIT License.
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "TextEntryObject.h"
|
||||
|
||||
// Deprecated extension - so no translation markers and the object is hidden in the editor.
|
||||
void DeclareTextEntryObjectExtension(gd::PlatformExtension& extension) {
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"TextEntryObject",
|
||||
_("Text entry object"),
|
||||
_("An object that can be used to capture the text "
|
||||
"entered with a keyboard by a player."),
|
||||
"Text entry object",
|
||||
"Deprecated object that can be used to capture the text "
|
||||
"entered with a keyboard by a player.",
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetCategory("User interface")
|
||||
@@ -24,71 +25,72 @@ void DeclareTextEntryObjectExtension(gd::PlatformExtension& extension) {
|
||||
gd::ObjectMetadata& obj =
|
||||
extension
|
||||
.AddObject<TextEntryObject>("TextEntry",
|
||||
_("Text entry"),
|
||||
_("Invisible object used to get the text "
|
||||
"entered with the keyboard."),
|
||||
"Text entry",
|
||||
"Invisible object used to get the text "
|
||||
"entered with the keyboard.",
|
||||
"CppPlatform/Extensions/textentry.png")
|
||||
.SetCategoryFullName(_("User interface"));
|
||||
.SetCategoryFullName("User interface")
|
||||
.SetHidden(); // Deprecated
|
||||
|
||||
obj.AddAction("String",
|
||||
_("Text in memory"),
|
||||
_("Modify text in memory of the object"),
|
||||
_("the text in memory"),
|
||||
"Text in memory",
|
||||
"Modify text in memory of the object",
|
||||
"the text in memory",
|
||||
"",
|
||||
"CppPlatform/Extensions/textentry24.png",
|
||||
"CppPlatform/Extensions/textentryicon.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "TextEntry")
|
||||
.AddParameter("object", "Object", "TextEntry")
|
||||
.UseStandardOperatorParameters(
|
||||
"string",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(_("Text")))
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription("Text"))
|
||||
.SetFunctionName("SetString")
|
||||
.SetGetter("GetString");
|
||||
|
||||
obj.AddCondition("String",
|
||||
_("Text in memory"),
|
||||
_("Test the text of a Text Entry object."),
|
||||
_("the text"),
|
||||
"Text in memory",
|
||||
"Test the text of a Text Entry object.",
|
||||
"the text",
|
||||
"",
|
||||
"CppPlatform/Extensions/textentry24.png",
|
||||
"CppPlatform/Extensions/textentryicon.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "TextEntry")
|
||||
.AddParameter("object", "Object", "TextEntry")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"string",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(_("Text to compare to")))
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription("Text to compare to"))
|
||||
.SetFunctionName("GetString");
|
||||
|
||||
obj.AddAction(
|
||||
"Activate",
|
||||
_("De/activate capturing text input"),
|
||||
_("Activate or deactivate the capture of text entered with keyboard."),
|
||||
_("Activate capture by _PARAM0_ of the text entered with keyboard: "
|
||||
"_PARAM1_"),
|
||||
_("Setup"),
|
||||
"De/activate capturing text input",
|
||||
"Activate or deactivate the capture of text entered with keyboard.",
|
||||
"Activate capture by _PARAM0_ of the text entered with keyboard: "
|
||||
"_PARAM1_",
|
||||
"Setup",
|
||||
"CppPlatform/Extensions/textentry24.png",
|
||||
"CppPlatform/Extensions/textentryicon.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "TextEntry")
|
||||
.AddParameter("yesorno", _("Activate"))
|
||||
.AddParameter("object", "Object", "TextEntry")
|
||||
.AddParameter("yesorno", "Activate")
|
||||
.SetFunctionName("Activate");
|
||||
|
||||
obj.AddCondition("Activated",
|
||||
_("Text input"),
|
||||
_("Test if the object captured text entered with keyboard."),
|
||||
_("_PARAM0_ capture the text entered with keyboard"),
|
||||
_("Setup"),
|
||||
"Text input",
|
||||
"Test if the object captured text entered with keyboard.",
|
||||
"_PARAM0_ capture the text entered with keyboard",
|
||||
"Setup",
|
||||
"CppPlatform/Extensions/textentry24.png",
|
||||
"CppPlatform/Extensions/textentryicon.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "TextEntry")
|
||||
.AddParameter("object", "Object", "TextEntry")
|
||||
.SetFunctionName("IsActivated");
|
||||
|
||||
obj.AddStrExpression("String",
|
||||
_("Text entered with keyboard"),
|
||||
_("Text entered with keyboard"),
|
||||
_("Text entered with keyboard"),
|
||||
"Text entered with keyboard",
|
||||
"Text entered with keyboard",
|
||||
"Text entered with keyboard",
|
||||
"res/texteicon.png")
|
||||
.AddParameter("object", _("Object"), "TextEntry")
|
||||
.AddParameter("object", "Object", "TextEntry")
|
||||
.SetFunctionName("GetString");
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ void DeclareTextObjectExtension(gd::PlatformExtension& extension) {
|
||||
"some indicators, menu buttons, dialogues..."),
|
||||
"Florian Rival and Victor Levasseur",
|
||||
"Open source (MIT License)")
|
||||
.SetCategory("User interface")
|
||||
.SetCategory("Text")
|
||||
.SetExtensionHelpPath("/objects/text");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Text object"))
|
||||
.SetIcon("CppPlatform/Extensions/texticon.png");
|
||||
@@ -34,7 +34,7 @@ void DeclareTextObjectExtension(gd::PlatformExtension& extension) {
|
||||
_("Text"),
|
||||
_("Displays a text on the screen."),
|
||||
"CppPlatform/Extensions/texticon.png")
|
||||
.SetCategoryFullName(_("User interface"));
|
||||
.SetCategoryFullName(_("Text"));
|
||||
|
||||
obj.AddAction("String",
|
||||
_("Modify the text"),
|
||||
|
@@ -1294,9 +1294,8 @@ module.exports = {
|
||||
tilemapJsonFile,
|
||||
tilesetJsonFile
|
||||
) {
|
||||
let tileMapJsonData = null;
|
||||
try {
|
||||
tileMapJsonData = await this._pixiResourcesLoader.getResourceJsonData(
|
||||
const tileMapJsonData = await this._pixiResourcesLoader.getResourceJsonData(
|
||||
this._project,
|
||||
tilemapJsonFile
|
||||
);
|
||||
@@ -1320,6 +1319,7 @@ module.exports = {
|
||||
} catch (err) {
|
||||
console.error('Unable to load a Tilemap JSON data: ', err);
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1540,34 +1540,38 @@ module.exports = {
|
||||
// GDJS doesn't use Promise to avoid allocation.
|
||||
RenderedCollisionMaskInstance.prototype._loadTiledMapWithCallback =
|
||||
function (tilemapJsonFile, tilesetJsonFile, callback) {
|
||||
this._loadTiledMap(tilemapJsonFile, tilesetJsonFile).then(callback);
|
||||
this._loadTileMap(tilemapJsonFile, tilesetJsonFile).then(callback);
|
||||
};
|
||||
|
||||
RenderedCollisionMaskInstance.prototype._loadTiledMap = async function (
|
||||
RenderedCollisionMaskInstance.prototype._loadTileMap = async function (
|
||||
tilemapJsonFile,
|
||||
tilesetJsonFile
|
||||
) {
|
||||
let tileMapJsonData = null;
|
||||
try {
|
||||
tileMapJsonData = await this._pixiResourcesLoader.getResourceJsonData(
|
||||
const tileMapJsonData = await this._pixiResourcesLoader.getResourceJsonData(
|
||||
this._project,
|
||||
tilemapJsonFile
|
||||
);
|
||||
|
||||
const tilesetJsonData = tilesetJsonFile
|
||||
? await this._pixiResourcesLoader.getResourceJsonData(
|
||||
this._project,
|
||||
tilesetJsonFile
|
||||
)
|
||||
: null;
|
||||
const tileMap = TilemapHelper.TileMapManager.identify(tileMapJsonData);
|
||||
|
||||
if (tilesetJsonData) {
|
||||
tileMapJsonData.tilesets = [tilesetJsonData];
|
||||
if (tileMap.kind === 'tiled') {
|
||||
const tilesetJsonData = tilesetJsonFile
|
||||
? await this._pixiResourcesLoader.getResourceJsonData(
|
||||
this._project,
|
||||
tilesetJsonFile
|
||||
)
|
||||
: null;
|
||||
|
||||
if (tilesetJsonData) {
|
||||
tileMapJsonData.tilesets = [tilesetJsonData];
|
||||
}
|
||||
}
|
||||
return tileMap;
|
||||
} catch (err) {
|
||||
console.error('Unable to load a Tilemap JSON data: ', err);
|
||||
}
|
||||
return tileMapJsonData;
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -67,7 +67,9 @@ namespace gdjs {
|
||||
tileMapJsonResourceName: string,
|
||||
tileSetJsonResourceName: string,
|
||||
levelIndex: number,
|
||||
callback: (tileMap: TileMapHelper.EditableTileMap | null) => void
|
||||
callback: (
|
||||
tileMapFileContent: TileMapHelper.EditableTileMap | null
|
||||
) => void
|
||||
): void {
|
||||
this._manager.getOrLoadTileMap(
|
||||
this._loadTileMap.bind(this),
|
||||
@@ -113,7 +115,9 @@ namespace gdjs {
|
||||
private _loadTileMap(
|
||||
tileMapJsonResourceName: string,
|
||||
tileSetJsonResourceName: string,
|
||||
callback: (tileMap: TileMapHelper.TileMap | null) => void
|
||||
callback: (
|
||||
tileMapFileContent: TileMapHelper.TileMapFileContent | null
|
||||
) => void
|
||||
): void {
|
||||
this._instanceContainer
|
||||
.getGame()
|
||||
@@ -127,14 +131,17 @@ namespace gdjs {
|
||||
callback(null);
|
||||
return;
|
||||
}
|
||||
const tileMap = TileMapHelper.TileMapManager.identify(
|
||||
const tileMapFileContent = TileMapHelper.TileMapManager.identify(
|
||||
tileMapJsonData
|
||||
);
|
||||
if (!tileMap) {
|
||||
if (!tileMapFileContent) {
|
||||
callback(null);
|
||||
return;
|
||||
}
|
||||
if (tileMap.kind === 'tiled' && tileSetJsonResourceName) {
|
||||
if (
|
||||
tileMapFileContent.kind === 'tiled' &&
|
||||
tileSetJsonResourceName
|
||||
) {
|
||||
this._instanceContainer
|
||||
.getGame()
|
||||
.getJsonManager()
|
||||
@@ -147,14 +154,14 @@ namespace gdjs {
|
||||
callback(null);
|
||||
return;
|
||||
}
|
||||
const tiledMap = tileMap.data;
|
||||
const tiledMap = tileMapFileContent.data;
|
||||
const tileSet = tileSetJsonData as TileMapHelper.TiledTileset;
|
||||
tileSet.firstgid = tiledMap.tilesets[0].firstgid;
|
||||
tiledMap.tilesets = [tileSet];
|
||||
callback(tileMap);
|
||||
callback(tileMapFileContent);
|
||||
});
|
||||
} else {
|
||||
callback(tileMap);
|
||||
callback(tileMapFileContent);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
4
Extensions/TileMap/helper/TileMapHelper.d.ts
vendored
4
Extensions/TileMap/helper/TileMapHelper.d.ts
vendored
@@ -3,7 +3,7 @@ import {
|
||||
EditableTileMapLayer,
|
||||
PixiTileMapHelper,
|
||||
TileDefinition,
|
||||
TileMap,
|
||||
TileMapFileContent,
|
||||
TileMapManager,
|
||||
TileTextureCache,
|
||||
TiledTileset,
|
||||
@@ -16,7 +16,7 @@ declare global {
|
||||
EditableTileMapLayer,
|
||||
PixiTileMapHelper,
|
||||
TileDefinition,
|
||||
TileMap,
|
||||
TileMapFileContent,
|
||||
TileMapManager,
|
||||
TileTextureCache,
|
||||
TiledTileset,
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
Extensions/TileMap/helper/dts/index.d.ts
vendored
2
Extensions/TileMap/helper/dts/index.d.ts
vendored
@@ -10,7 +10,7 @@ export {
|
||||
export { TileMapManager } from './render/TileMapManager';
|
||||
export { TileTextureCache } from './render/TileTextureCache';
|
||||
export { PixiTileMapHelper } from './render/TileMapPixiHelper';
|
||||
export * from './types/index';
|
||||
export * from './load/TileMapFileContent';
|
||||
export * from './model/CommonTypes';
|
||||
export { TiledTileset } from './load/tiled/TiledFormat';
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACL,eAAe,EACf,oBAAoB,EACpB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAE/D,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC"}
|
12
Extensions/TileMap/helper/dts/load/TileMapFileContent.d.ts
vendored
Normal file
12
Extensions/TileMap/helper/dts/load/TileMapFileContent.d.ts
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
import { LDtkTileMap } from '../load/ldtk/LDtkFormat';
|
||||
import { TiledTileMap } from '../load/tiled/TiledFormat';
|
||||
export declare type TileMapFileContent =
|
||||
| {
|
||||
kind: 'tiled';
|
||||
data: TiledTileMap;
|
||||
}
|
||||
| {
|
||||
kind: 'ldtk';
|
||||
data: LDtkTileMap;
|
||||
};
|
||||
//# sourceMappingURL=TileMapFileContent.d.ts.map
|
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"TileMapFileContent.d.ts","sourceRoot":"","sources":["../../src/load/TileMapFileContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,oBAAY,kBAAkB,GAC1B;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;CACpB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC"}
|
@@ -1,16 +1,16 @@
|
||||
import type { EditableTileMap } from '../model/TileMapModel';
|
||||
import { TileMap } from '../types';
|
||||
import { TileMapFileContent } from './TileMapFileContent';
|
||||
export declare namespace TileMapLoader {
|
||||
/**
|
||||
* Create a {@link EditableTileMap} from the raw data.
|
||||
*
|
||||
* @param tiledMap The data exported from Tiled/LDtk.
|
||||
* @param tileMapFileContent The data exported from Tiled/LDtk.
|
||||
* @param levelIndex The level of the tile map to load from.
|
||||
* @param pako The zlib library.
|
||||
* @returns A {@link EditableTileMap}
|
||||
*/
|
||||
function load(
|
||||
tileMap: TileMap,
|
||||
tileMapFileContent: TileMapFileContent,
|
||||
levelIndex: number,
|
||||
pako: any
|
||||
): EditableTileMap | null;
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"TileMapLoader.d.ts","sourceRoot":"","sources":["../../src/load/TileMapLoader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAInC,yBAAiB,aAAa,CAAC;IAC7B;;;;;;;OAOG;IACH,SAAgB,IAAI,CAClB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,GAAG,GACR,eAAe,GAAG,IAAI,CAaxB;CACF"}
|
||||
{"version":3,"file":"TileMapLoader.d.ts","sourceRoot":"","sources":["../../src/load/TileMapLoader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAI1D,yBAAiB,aAAa,CAAC;IAC7B;;;;;;;OAOG;IACH,SAAgB,IAAI,CAClB,kBAAkB,EAAE,kBAAkB,EACtC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,GAAG,GACR,eAAe,GAAG,IAAI,CAaxB;CACF"}
|
@@ -2,7 +2,7 @@ import { integer } from '../../model/CommonTypes';
|
||||
/**
|
||||
* version 1.1.3 - https://github.com/deepnight/ldtk/blob/66fff7199932357f3ab9b044c2fc2a856f527831/docs/JSON_SCHEMA.json
|
||||
*/
|
||||
export type LDtkTileMap = {
|
||||
export declare type LDtkTileMap = {
|
||||
/** LDtk application build identifier.<br/> This is only used to identify the LDtk version that generated this particular project file, which can be useful for specific bug fixing. Note that the build identifier is just the date of the release, so it's not unique to each user (one single global ID per LDtk public release), and as a result, completely anonymous. */
|
||||
appBuildId: number;
|
||||
/** Number of backup files to keep, if the `backupOnSave` is TRUE */
|
||||
@@ -72,7 +72,7 @@ export type LDtkTileMap = {
|
||||
| null;
|
||||
};
|
||||
/** Auto-layer rule group */
|
||||
type LDtkAutoLayerRuleGroup = {
|
||||
declare type LDtkAutoLayerRuleGroup = {
|
||||
/** */
|
||||
active: boolean;
|
||||
/** *This field was removed in 1.0.0 and should no longer be used.* */
|
||||
@@ -87,9 +87,9 @@ type LDtkAutoLayerRuleGroup = {
|
||||
uid: integer;
|
||||
};
|
||||
/** This complex section isn't meant to be used by game devs at all, as these rules are completely resolved internally by the editor before any saving. You should just ignore this part. */
|
||||
type LDtkAutoRuleDef = {};
|
||||
declare type LDtkAutoRuleDef = {};
|
||||
/** If you're writing your own LDtk importer, you should probably just ignore *most* stuff in the `defs` section, as it contains data that are mostly important to the editor. To keep you away from the `defs` section and avoid some unnecessary JSON parsing, important data from definitions is often duplicated in fields prefixed with a double underscore (eg. `__identifier` or `__type`). The 2 only definition types you might need here are **Tilesets** and **Enums**. */
|
||||
type LDtkDefinition = {
|
||||
declare type LDtkDefinition = {
|
||||
/** All entities definitions, including their custom fields */
|
||||
entities: LDtkEntityDef[];
|
||||
/** All internal enums */
|
||||
@@ -104,7 +104,7 @@ type LDtkDefinition = {
|
||||
tilesets: LDtkTilesetDef[];
|
||||
};
|
||||
/** Entity definition */
|
||||
type LDtkEntityDef = {
|
||||
declare type LDtkEntityDef = {
|
||||
/** Base entity color */
|
||||
color: string;
|
||||
/** Array of field definitions */
|
||||
@@ -166,7 +166,7 @@ type LDtkEntityDef = {
|
||||
width: integer;
|
||||
};
|
||||
/** Entity instance */
|
||||
type LDtkEntityInstance = {
|
||||
declare type LDtkEntityInstance = {
|
||||
/** Grid-based coordinates (`[x,y]` format) */
|
||||
__grid: integer[];
|
||||
/** Entity definition identifier */
|
||||
@@ -193,7 +193,7 @@ type LDtkEntityInstance = {
|
||||
width: integer;
|
||||
};
|
||||
/** Enum definition */
|
||||
type LDtkEnumDef = {
|
||||
declare type LDtkEnumDef = {
|
||||
/** */
|
||||
externalFileChecksum: string | null;
|
||||
/** Relative path to the external file providing this Enum */
|
||||
@@ -210,7 +210,7 @@ type LDtkEnumDef = {
|
||||
values: LDtkEnumDefValues[];
|
||||
};
|
||||
/** Enum value definition */
|
||||
type LDtkEnumDefValues = {
|
||||
declare type LDtkEnumDefValues = {
|
||||
/** An array of 4 Int values that refers to the tile in the tileset image: `[ x, y, width, height ]` */
|
||||
__tileSrcRect: integer[] | null;
|
||||
/** Optional color */
|
||||
@@ -221,14 +221,14 @@ type LDtkEnumDefValues = {
|
||||
tileId: integer | null;
|
||||
};
|
||||
/** In a tileset definition, enum based tag infos */
|
||||
type LDtkEnumTagValue = {
|
||||
declare type LDtkEnumTagValue = {
|
||||
/** */
|
||||
enumValueId: string;
|
||||
/** */
|
||||
tileIds: integer[];
|
||||
};
|
||||
/** This section is mostly only intended for the LDtk editor app itself. You can safely ignore it. */
|
||||
type LDtkFieldDef = {
|
||||
declare type LDtkFieldDef = {
|
||||
/** Human readable value type. Possible values: `Int, Float, String, Bool, Color, ExternEnum.XXX, LocalEnum.XXX, Point, FilePath`.<br/> If the field is an array, this field will look like `Array<...>` (eg. `Array<Int>`, `Array<Point>` etc.)<br/> NOTE: if you enable the advanced option **Use Multilines type**, you will have \"*Multilines*\" instead of \"*String*\" when relevant. */
|
||||
__type: string;
|
||||
/** Optional list of accepted file extensions for FilePath value type. Includes the dot: `.ext` */
|
||||
@@ -310,7 +310,7 @@ type LDtkFieldDef = {
|
||||
useForSmartColor: boolean;
|
||||
};
|
||||
/** Field instance */
|
||||
type LDtkFieldInstance = {
|
||||
declare type LDtkFieldInstance = {
|
||||
/** Field definition identifier */
|
||||
__identifier: string;
|
||||
/** Optional TilesetRect used to display this field (this can be the field own Tile, or some other Tile guessed from the value, like an Enum). */
|
||||
@@ -324,7 +324,7 @@ type LDtkFieldInstance = {
|
||||
/** Editor internal raw values */
|
||||
realEditorValues: any[];
|
||||
};
|
||||
type LDtkFlag =
|
||||
declare type LDtkFlag =
|
||||
| 'DiscardPreCsvIntGrid'
|
||||
| 'ExportPreCsvIntGridFormat'
|
||||
| 'IgnoreBackupSuggest'
|
||||
@@ -332,7 +332,7 @@ type LDtkFlag =
|
||||
| 'MultiWorlds'
|
||||
| 'UseMultilinesType';
|
||||
/** IntGrid value definition */
|
||||
type LDtkIntGridValueDef = {
|
||||
declare type LDtkIntGridValueDef = {
|
||||
/** */
|
||||
color: string;
|
||||
/** User defined unique identifier */
|
||||
@@ -341,14 +341,14 @@ type LDtkIntGridValueDef = {
|
||||
value: integer;
|
||||
};
|
||||
/** IntGrid value instance */
|
||||
type LDtkIntGridValueInstance = {
|
||||
declare type LDtkIntGridValueInstance = {
|
||||
/** Coordinate ID in the layer grid */
|
||||
coordId: integer;
|
||||
/** IntGrid value */
|
||||
v: integer;
|
||||
};
|
||||
/** Layer definition */
|
||||
type LDtkLayerDef = {
|
||||
declare type LDtkLayerDef = {
|
||||
/** Type of the layer (*IntGrid, Entities, Tiles or AutoLayer*) */
|
||||
__type: string;
|
||||
/** Contains all the auto-layer rule definitions. */
|
||||
@@ -401,7 +401,7 @@ type LDtkLayerDef = {
|
||||
uid: integer;
|
||||
};
|
||||
/** Layer instance */
|
||||
type LDtkLayerInstance = {
|
||||
declare type LDtkLayerInstance = {
|
||||
/** Grid-based height */
|
||||
__cHei: integer;
|
||||
/** Grid-based width */
|
||||
@@ -452,7 +452,7 @@ type LDtkLayerInstance = {
|
||||
visible: boolean;
|
||||
};
|
||||
/** This section contains all the level data. It can be found in 2 distinct forms, depending on Project current settings: - If \"*Separate level files*\" is **disabled** (default): full level data is *embedded* inside the main Project JSON file, - If \"*Separate level files*\" is **enabled**: level data is stored in *separate* standalone `.ldtkl` files (one per level). In this case, the main Project JSON file will still contain most level data, except heavy sections, like the `layerInstances` array (which will be null). The `externalRelPath` string points to the `ldtkl` file. A `ldtkl` file is just a JSON file containing exactly what is described below. */
|
||||
type LDtkLevel = {
|
||||
declare type LDtkLevel = {
|
||||
/** Background color of the level (same as `bgColor`, except the default value is automatically used here if its value is `null`) */
|
||||
__bgColor: string;
|
||||
/** Position informations of the background image, if there is one. */
|
||||
@@ -497,7 +497,7 @@ type LDtkLevel = {
|
||||
worldY: integer;
|
||||
};
|
||||
/** Level background image position info */
|
||||
type LDtkLevelBgPosInfos = {
|
||||
declare type LDtkLevelBgPosInfos = {
|
||||
/** An array of 4 float values describing the cropped sub-rectangle of the displayed background image. This cropping happens when original is larger than the level bounds. Array format: `[ cropX, cropY, cropWidth, cropHeight ]` */
|
||||
cropRect: number[];
|
||||
/** An array containing the `[scaleX,scaleY]` values of the **cropped** background image, depending on `bgPos` option. */
|
||||
@@ -506,7 +506,7 @@ type LDtkLevelBgPosInfos = {
|
||||
topLeftPx: integer[];
|
||||
};
|
||||
/** Nearby level info */
|
||||
type LDtkNeighbourLevel = {
|
||||
declare type LDtkNeighbourLevel = {
|
||||
/** A single lowercase character tipping on the level location (`n`orth, `s`outh, `w`est, `e`ast). */
|
||||
dir: string;
|
||||
/** Neighbour Instance Identifier */
|
||||
@@ -515,7 +515,7 @@ type LDtkNeighbourLevel = {
|
||||
levelUid: integer;
|
||||
};
|
||||
/** This structure represents a single tile from a given Tileset. */
|
||||
type LDtkTile = {
|
||||
declare type LDtkTile = {
|
||||
/** Internal data used by the editor.<br/> For auto-layer tiles: `[ruleId, coordId]`.<br/> For tile-layer tiles: `[coordId]`. */
|
||||
d: integer[];
|
||||
/** \"Flip bits\", a 2-bits integer to represent the mirror transformations of the tile.<br/> - Bit 0 = X flip<br/> - Bit 1 = Y flip<br/> Examples: f=0 (no flip), f=1 (X flip only), f=2 (Y flip only), f=3 (both flips) */
|
||||
@@ -528,7 +528,7 @@ type LDtkTile = {
|
||||
t: integer;
|
||||
};
|
||||
/** The `Tileset` definition is the most important part among project definitions. It contains some extra informations about each integrated tileset. If you only had to parse one definition section, that would be the one. */
|
||||
export type LDtkTilesetDef = {
|
||||
export declare type LDtkTilesetDef = {
|
||||
/** Grid-based height */
|
||||
__cHei: integer;
|
||||
/** Grid-based width */
|
||||
@@ -565,14 +565,14 @@ export type LDtkTilesetDef = {
|
||||
uid: integer;
|
||||
};
|
||||
/** In a tileset definition, user defined meta-data of a tile. */
|
||||
type LDtkTileCustomMetadata = {
|
||||
declare type LDtkTileCustomMetadata = {
|
||||
/** */
|
||||
data: string;
|
||||
/** */
|
||||
tileId: integer;
|
||||
};
|
||||
/** This object represents a custom sub rectangle in a Tileset image. */
|
||||
type LDtkTilesetRect = {
|
||||
declare type LDtkTilesetRect = {
|
||||
/** Height in pixels */
|
||||
h: integer;
|
||||
/** UID of the tileset */
|
||||
@@ -584,6 +584,6 @@ type LDtkTilesetRect = {
|
||||
/** Y pixels coordinate of the top-left corner in the Tileset image */
|
||||
y: integer;
|
||||
};
|
||||
type LDtkWorld = {};
|
||||
declare type LDtkWorld = {};
|
||||
export {};
|
||||
//# sourceMappingURL=LDtkFormat.d.ts.map
|
||||
|
File diff suppressed because one or more lines are too long
@@ -2,7 +2,7 @@ import { float, integer } from '../../model/CommonTypes';
|
||||
/**
|
||||
* Tiled JSON format (https://github.com/mapeditor/tiled/blob/master/docs/reference/json-map-format.rst).
|
||||
*/
|
||||
export type TiledTileMap = {
|
||||
export declare type TiledTileMap = {
|
||||
/** Hex-formatted color (#RRGGBB or #AARRGGBB) (optional) */
|
||||
backgroundcolor?: string;
|
||||
/** The compression level to use for tile layer data (defaults to -1, which means to use the algorithm default) */
|
||||
@@ -44,7 +44,7 @@ export type TiledTileMap = {
|
||||
/** Number of tile columns */
|
||||
width: integer;
|
||||
};
|
||||
export type TiledLayer = {
|
||||
export declare type TiledLayer = {
|
||||
/** Array of {@link TiledChunk} (optional). `tilelayer` only. */
|
||||
chunks?: Array<TiledChunk>;
|
||||
/** `zlib`, `gzip`, `zstd` (since Tiled 1.3) or empty (default). `tilelayer` only. */
|
||||
@@ -98,7 +98,7 @@ export type TiledLayer = {
|
||||
/** Vertical layer offset in tiles. Always 0. */
|
||||
y: integer;
|
||||
};
|
||||
export type TiledChunk = {
|
||||
export declare type TiledChunk = {
|
||||
/** Array of `unsigned` `integer` (GIDs) or base64-encoded data */
|
||||
data: Array<integer> | string;
|
||||
/** Height in tiles */
|
||||
@@ -110,7 +110,7 @@ export type TiledChunk = {
|
||||
/** Y coordinate in tiles */
|
||||
y: integer;
|
||||
};
|
||||
export type TiledObject = {
|
||||
export declare type TiledObject = {
|
||||
/** The class of the object (renamed from type since 1.9, optional) */
|
||||
class?: string;
|
||||
/** Used to mark an object as an ellipse */
|
||||
@@ -146,7 +146,7 @@ export type TiledObject = {
|
||||
/** Y coordinate in pixels */
|
||||
y: float;
|
||||
};
|
||||
export type TiledText = {
|
||||
export declare type TiledText = {
|
||||
/** Whether to use a bold font (default: `false`) */
|
||||
bold: boolean;
|
||||
/** Hex-formatted color (#RRGGBB or #AARRGGBB) (default: `#000000`) */
|
||||
@@ -172,7 +172,7 @@ export type TiledText = {
|
||||
/** Whether the text is wrapped within the object bounds (default: `false`) */
|
||||
wrap: boolean;
|
||||
};
|
||||
export type TiledTileset = {
|
||||
export declare type TiledTileset = {
|
||||
/** Hex-formatted color (#RRGGBB or #AARRGGBB) (optional) */
|
||||
backgroundcolor?: string;
|
||||
/** The number of tile columns in the tileset */
|
||||
@@ -224,7 +224,7 @@ export type TiledTileset = {
|
||||
/** Array of {@link TiledWangSet} (since 1.1.5) */
|
||||
wangsets?: Array<TiledWangSet>;
|
||||
};
|
||||
export type TiledGrid = {
|
||||
export declare type TiledGrid = {
|
||||
/** Cell height of tile grid */
|
||||
height: integer;
|
||||
/** `orthogonal` (default) or `isometric` */
|
||||
@@ -232,13 +232,13 @@ export type TiledGrid = {
|
||||
/** Cell width of tile grid */
|
||||
width: integer;
|
||||
};
|
||||
export type TileOffset = {
|
||||
export declare type TileOffset = {
|
||||
/** Horizontal offset in pixels */
|
||||
x: integer;
|
||||
/** Vertical offset in pixels (positive is down) */
|
||||
y: integer;
|
||||
};
|
||||
export type TiledTransformations = {
|
||||
export declare type TiledTransformations = {
|
||||
/** Tiles can be flipped horizontally */
|
||||
hflip: boolean;
|
||||
/** Tiles can be flipped vertically */
|
||||
@@ -248,7 +248,7 @@ export type TiledTransformations = {
|
||||
/** Whether untransformed tiles remain preferred, otherwise transformed tiles are used to produce more variations */
|
||||
preferuntransformed: boolean;
|
||||
};
|
||||
export type TiledTileDefinition = {
|
||||
export declare type TiledTileDefinition = {
|
||||
/** Array of {@link TiledTiles} */
|
||||
animation?: Array<TiledTileDefinition>;
|
||||
/** The class of the tile (renamed from type since 1.9, optional) */
|
||||
@@ -270,13 +270,13 @@ export type TiledTileDefinition = {
|
||||
/** Index of terrain for each corner of tile (optional) */
|
||||
terrain?: Array<integer>;
|
||||
};
|
||||
export type TiledFrame = {
|
||||
export declare type TiledFrame = {
|
||||
/** Frame duration in milliseconds */
|
||||
duration: integer;
|
||||
/** Local tile ID representing this frame */
|
||||
tileid: integer;
|
||||
};
|
||||
export type TiledTerrain = {
|
||||
export declare type TiledTerrain = {
|
||||
/** Name of terrain */
|
||||
name: string;
|
||||
/** Array of {@link TiledProperty} */
|
||||
@@ -284,7 +284,7 @@ export type TiledTerrain = {
|
||||
/** Local ID of tile representing terrain */
|
||||
tile: integer;
|
||||
};
|
||||
export type TiledWangSet = {
|
||||
export declare type TiledWangSet = {
|
||||
/** Array of {@link TiledWangColor} */
|
||||
colors: Array<TiledWangColor>;
|
||||
/** Name of the Wang set */
|
||||
@@ -296,7 +296,7 @@ export type TiledWangSet = {
|
||||
/** Array of {@link TiledWangTile} */
|
||||
wangtiles: Array<TiledWangTile>;
|
||||
};
|
||||
export type TiledWangColor = {
|
||||
export declare type TiledWangColor = {
|
||||
/** Hex-formatted color (#RRGGBB or #AARRGGBB) */
|
||||
color: string;
|
||||
/** Name of the Wang color */
|
||||
@@ -308,13 +308,13 @@ export type TiledWangColor = {
|
||||
/** Local ID of tile representing the Wang color */
|
||||
tile: integer;
|
||||
};
|
||||
export type TiledWangTile = {
|
||||
export declare type TiledWangTile = {
|
||||
/** Local ID of tile */
|
||||
tileid: integer;
|
||||
/** Array of Wang color indexes (`uchar[8]`) */
|
||||
wangid: Array<integer>;
|
||||
};
|
||||
export type TiledObjectTemplate = {
|
||||
export declare type TiledObjectTemplate = {
|
||||
/** `template` */
|
||||
type: string;
|
||||
/** External tileset used by the template (optional) */
|
||||
@@ -322,7 +322,7 @@ export type TiledObjectTemplate = {
|
||||
/** The object instantiated by this template */
|
||||
object: Object;
|
||||
};
|
||||
export type TiledProperty = {
|
||||
export declare type TiledProperty = {
|
||||
/** Name of the property */
|
||||
name: string;
|
||||
/** type of the property (`string` (default), `integer`, `float`, `boolean`, `color` or `file` (since 0.16, with `color` and `file` added in 0.17)) */
|
||||
@@ -330,7 +330,7 @@ export type TiledProperty = {
|
||||
/** Value of the property */
|
||||
value: string | number;
|
||||
};
|
||||
export type TiledPoint = {
|
||||
export declare type TiledPoint = {
|
||||
/** X coordinate in pixels */
|
||||
x: float;
|
||||
/** Y coordinate in pixels */
|
||||
|
File diff suppressed because one or more lines are too long
@@ -12,7 +12,7 @@ export declare const decodeBase64LayerData: (
|
||||
pako: any,
|
||||
tiledLayer: TiledLayer
|
||||
) => number[];
|
||||
export type TiledGID = {
|
||||
export declare type TiledGID = {
|
||||
id: integer;
|
||||
flippedHorizontally: boolean;
|
||||
flippedVertically: boolean;
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"TiledTileMapLoaderHelper.d.ts","sourceRoot":"","sources":["../../../src/load/tiled/TiledTileMapLoaderHelper.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,SAAU,GAAG,cAAc,UAAU,aAgDtE,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,OAAO,CAAC;IACZ,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,kBACvB,OAAO,KACrB,QAmBF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,GAAG,SAAS,CAEpB"}
|
||||
{"version":3,"file":"TiledTileMapLoaderHelper.d.ts","sourceRoot":"","sources":["../../../src/load/tiled/TiledTileMapLoaderHelper.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,SAAU,GAAG,cAAc,UAAU,aAgDtE,CAAC;AAEF,oBAAY,QAAQ,GAAG;IACrB,EAAE,EAAE,OAAO,CAAC;IACZ,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,kBACvB,OAAO,KACrB,QAmBF,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,MAAM,GAAG,SAAS,CAEpB"}
|
@@ -1,5 +1,5 @@
|
||||
export declare type integer = number;
|
||||
export declare type float = number;
|
||||
export type FloatPoint = [float, float];
|
||||
export type PolygonVertices = FloatPoint[];
|
||||
export declare type FloatPoint = [float, float];
|
||||
export declare type PolygonVertices = FloatPoint[];
|
||||
//# sourceMappingURL=CommonTypes.d.ts.map
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"CommonTypes.d.ts","sourceRoot":"","sources":["../../src/model/CommonTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,MAAM,OAAO,GAAG,MAAM,CAAC;AACrC,MAAM,CAAC,OAAO,MAAM,KAAK,GAAG,MAAM,CAAC;AACnC,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAExC,MAAM,MAAM,eAAe,GAAG,UAAU,EAAE,CAAC"}
|
||||
{"version":3,"file":"CommonTypes.d.ts","sourceRoot":"","sources":["../../src/model/CommonTypes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,MAAM,OAAO,GAAG,MAAM,CAAC;AACrC,MAAM,CAAC,OAAO,MAAM,KAAK,GAAG,MAAM,CAAC;AACnC,oBAAY,UAAU,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAExC,oBAAY,eAAe,GAAG,UAAU,EAAE,CAAC"}
|
@@ -1,7 +1,7 @@
|
||||
import { EditableTileMap } from '../model/TileMapModel';
|
||||
import { TileTextureCache } from './TileTextureCache';
|
||||
import PIXI = GlobalPIXIModule.PIXI;
|
||||
import { TileMap } from '../types';
|
||||
import { TileMapFileContent } from '../load/TileMapFileContent';
|
||||
/**
|
||||
* A holder to share tile maps across the 2 extension objects.
|
||||
*
|
||||
@@ -23,7 +23,7 @@ export declare class TileMapManager {
|
||||
* @param data JSON data.
|
||||
* @returns The data enclosed with its detected kind.
|
||||
*/
|
||||
static identify(data: any): TileMap | null;
|
||||
static identify(data: any): TileMapFileContent | null;
|
||||
/**
|
||||
* @param loadTileMap The method that loads the Tiled JSON file in memory.
|
||||
* @param tileMapJsonResourceName The resource name of the tile map.
|
||||
@@ -36,7 +36,7 @@ export declare class TileMapManager {
|
||||
loadTileMap: (
|
||||
tileMapJsonResourceName: string,
|
||||
tileSetJsonResourceName: string,
|
||||
callback: (tileMap: TileMap | null) => void
|
||||
callback: (tileMapFileContent: TileMapFileContent | null) => void
|
||||
) => void,
|
||||
tileMapJsonResourceName: string,
|
||||
tileSetJsonResourceName: string,
|
||||
@@ -57,7 +57,7 @@ export declare class TileMapManager {
|
||||
loadTileMap: (
|
||||
tileMapJsonResourceName: string,
|
||||
tileSetJsonResourceName: string,
|
||||
callback: (tileMap: TileMap | null) => void
|
||||
callback: (tileMapFileContent: TileMapFileContent | null) => void
|
||||
) => void,
|
||||
getTexture: (textureName: string) => PIXI.BaseTexture<PIXI.Resource>,
|
||||
atlasImageResourceName: string,
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"TileMapManager.d.ts","sourceRoot":"","sources":["../../src/render/TileMapManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAEpC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC;;;;;;;GAOG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,mBAAmB,CAAkC;;IAO7D;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,cAAc;IAWzD;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,GAAG,IAAI;IAyB1C;;;;;;;OAOG;IACH,gBAAgB,CACd,WAAW,EAAE,CACX,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,KACxC,IAAI,EACT,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,KAAK,IAAI,GAClD,IAAI;IAiCP;;;;;;;;OAQG;IACH,qBAAqB,CACnB,WAAW,EAAE,CACX,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,KAAK,IAAI,KACxC,IAAI,EACT,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,EACpE,sBAAsB,EAAE,MAAM,EAC9B,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,CAAC,YAAY,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,GACxD,IAAI;CAuCR"}
|
||||
{"version":3,"file":"TileMapManager.d.ts","sourceRoot":"","sources":["../../src/render/TileMapManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;;;;;;GAOG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,aAAa,CAAiC;IACtD,OAAO,CAAC,mBAAmB,CAAkC;;IAO7D;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,cAAc;IAWzD;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,kBAAkB,GAAG,IAAI;IAwBrD;;;;;;;OAOG;IACH,gBAAgB,CACd,WAAW,EAAE,CACX,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,QAAQ,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,KAAK,IAAI,KAC9D,IAAI,EACT,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,KAAK,IAAI,GAClD,IAAI;IAiCP;;;;;;;;OAQG;IACH,qBAAqB,CACnB,WAAW,EAAE,CACX,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,QAAQ,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI,KAAK,IAAI,KAC9D,IAAI,EACT,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,EACpE,sBAAsB,EAAE,MAAM,EAC9B,uBAAuB,EAAE,MAAM,EAC/B,uBAAuB,EAAE,MAAM,EAC/B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,CAAC,YAAY,EAAE,gBAAgB,GAAG,IAAI,KAAK,IAAI,GACxD,IAAI;CAuCR"}
|
@@ -1,6 +1,6 @@
|
||||
import { integer, float } from '../model/CommonTypes';
|
||||
import { EditableTileMap } from '../model/TileMapModel';
|
||||
import { TileMap } from '../types';
|
||||
import { TileMapFileContent } from '../load/TileMapFileContent';
|
||||
import { TileTextureCache } from './TileTextureCache';
|
||||
import PIXI = GlobalPIXIModule.PIXI;
|
||||
export declare namespace PixiTileMapHelper {
|
||||
@@ -14,7 +14,7 @@ export declare namespace PixiTileMapHelper {
|
||||
* @returns A textures cache.
|
||||
*/
|
||||
function parseAtlas(
|
||||
tileMap: TileMap,
|
||||
tileMap: TileMapFileContent,
|
||||
levelIndex: number,
|
||||
atlasTexture: PIXI.BaseTexture<PIXI.Resource> | null,
|
||||
getTexture: (textureName: string) => PIXI.BaseTexture<PIXI.Resource>
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"TileMapPixiHelper.d.ts","sourceRoot":"","sources":["../../src/render/TileMapPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAEL,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAEpC,yBAAiB,iBAAiB,CAAC;IACjC;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,EACpD,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GACnE,gBAAgB,GAAG,IAAI,CAuBzB;IAED;;;;;;;;;;;;OAYG;IACH,SAAgB,iBAAiB,CAC/B,kBAAkB,EAAE,GAAG,EACvB,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,gBAAgB,EAC9B,WAAW,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,EACxC,UAAU,EAAE,MAAM,GACjB,IAAI,CA0GN;IAED;;OAEG;IACH,SAAgB,uBAAuB,CACrC,YAAY,EAAE,IAAI,CAAC,QAAQ,EAC3B,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,OAAO,EACrB,cAAc,EAAE,KAAK,EACrB,SAAS,EAAE,OAAO,EAClB,WAAW,EAAE,KAAK,GACjB,IAAI,CAgEN;CACF"}
|
||||
{"version":3,"file":"TileMapPixiHelper.d.ts","sourceRoot":"","sources":["../../src/render/TileMapPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAEL,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAEpC,yBAAiB,iBAAiB,CAAC;IACjC;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,kBAAkB,EAC3B,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,EACpD,UAAU,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,GACnE,gBAAgB,GAAG,IAAI,CAuBzB;IAED;;;;;;;;;;;;OAYG;IACH,SAAgB,iBAAiB,CAC/B,kBAAkB,EAAE,GAAG,EACvB,OAAO,EAAE,eAAe,EACxB,YAAY,EAAE,gBAAgB,EAC9B,WAAW,EAAE,OAAO,GAAG,SAAS,GAAG,KAAK,EACxC,UAAU,EAAE,MAAM,GACjB,IAAI,CA0GN;IAED;;OAEG;IACH,SAAgB,uBAAuB,CACrC,YAAY,EAAE,IAAI,CAAC,QAAQ,EAC3B,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,OAAO,EACpB,YAAY,EAAE,OAAO,EACrB,cAAc,EAAE,KAAK,EACrB,SAAS,EAAE,OAAO,EAClB,WAAW,EAAE,KAAK,GACjB,IAAI,CAgEN;CACF"}
|
@@ -1,8 +1,10 @@
|
||||
import { TileTextureCache } from '../TileTextureCache';
|
||||
import { LDtkTileMap } from '../../load/ldtk/LDtkFormat';
|
||||
import PIXI = GlobalPIXIModule.PIXI;
|
||||
type Texture = PIXI.BaseTexture<PIXI.Resource>;
|
||||
type TextureLoader = (textureName: string) => PIXI.BaseTexture<PIXI.Resource>;
|
||||
declare type Texture = PIXI.BaseTexture<PIXI.Resource>;
|
||||
declare type TextureLoader = (
|
||||
textureName: string
|
||||
) => PIXI.BaseTexture<PIXI.Resource>;
|
||||
export declare namespace LDtkPixiHelper {
|
||||
/**
|
||||
* Split an atlas image into Pixi textures.
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"LDtkPixiHelper.d.ts","sourceRoot":"","sources":["../../../src/render/ldtk/LDtkPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAkB,MAAM,4BAA4B,CAAC;AAEzE,OAAO,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAEpC,KAAK,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC/C,KAAK,aAAa,GAAG,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAmC9E,yBAAiB,cAAc,CAAC;IAC9B;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,OAAO,GAAG,IAAI,EAC5B,UAAU,EAAE,aAAa,GACxB,gBAAgB,GAAG,IAAI,CAoFzB;CACF"}
|
||||
{"version":3,"file":"LDtkPixiHelper.d.ts","sourceRoot":"","sources":["../../../src/render/ldtk/LDtkPixiHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAkB,MAAM,4BAA4B,CAAC;AAEzE,OAAO,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC;AAEpC,aAAK,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC/C,aAAK,aAAa,GAAG,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAmC9E,yBAAiB,cAAc,CAAC;IAC9B;;;;;;;;OAQG;IACH,SAAgB,UAAU,CACxB,OAAO,EAAE,WAAW,EACpB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,OAAO,GAAG,IAAI,EAC5B,UAAU,EAAE,aAAa,GACxB,gBAAgB,GAAG,IAAI,CAoFzB;CACF"}
|
@@ -1,6 +1,6 @@
|
||||
import { LDtkTileMap } from '../load/ldtk/LDtkFormat';
|
||||
import { TiledTileMap } from '../load/tiled/TiledFormat';
|
||||
export type TileMap =
|
||||
export declare type TileMap =
|
||||
| {
|
||||
kind: 'tiled';
|
||||
data: TiledTileMap;
|
||||
|
@@ -1 +1 @@
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,MAAM,MAAM,OAAO,GACf;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;CACpB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC"}
|
||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,oBAAY,OAAO,GACf;IACE,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,YAAY,CAAC;CACpB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,WAAW,CAAC;CACnB,CAAC"}
|
@@ -1,10 +1,7 @@
|
||||
// @ts-check
|
||||
describe('gdjs.TileMapCollisionMaskRuntimeObject', function () {
|
||||
const createScene = (framePerSecond = 60) => {
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
// @ts-ignore - missing properties.
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame({
|
||||
resources: {
|
||||
resources: [
|
||||
{
|
||||
|
@@ -4,12 +4,7 @@ describe('gdjs.TopDownMovementRuntimeBehavior', function () {
|
||||
const topDownName = 'auto1';
|
||||
|
||||
const createScene = (timeDelta = 1000 / 60) => {
|
||||
const runtimeGame = new gdjs.RuntimeGame({
|
||||
variables: [],
|
||||
// @ts-ignore - missing properties.
|
||||
properties: { windowWidth: 800, windowHeight: 600 },
|
||||
resources: { resources: [] },
|
||||
});
|
||||
const runtimeGame = gdjs.getPixiRuntimeGame();
|
||||
const runtimeScene = new gdjs.RuntimeScene(runtimeGame);
|
||||
runtimeScene.loadFromScene({
|
||||
layers: [
|
||||
|
@@ -855,9 +855,9 @@ module.exports = {
|
||||
.addParameter('expression', _('To Hue'), '', false)
|
||||
.addParameter('yesorno', _('Animate Hue'), '', false)
|
||||
.setDefaultValue('yes')
|
||||
.addParameter('expression', _('To Saturation (-1 to ignore)'), '', false)
|
||||
.addParameter('expression', _('To Saturation (0 to 100, -1 to ignore)'), '', false)
|
||||
.setDefaultValue('-1')
|
||||
.addParameter('expression', _('To Lightness (-1 to ignore)'), '', false)
|
||||
.addParameter('expression', _('To Lightness (0 to 100, -1 to ignore)'), '', false)
|
||||
.setDefaultValue('-1')
|
||||
.addParameter('stringWithSelector', _('Easing'), easingChoices, false)
|
||||
.setDefaultValue('linear')
|
||||
|
@@ -124,7 +124,11 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionCode(
|
||||
gd::ObjectsContainer globalObjectsAndGroups;
|
||||
gd::ObjectsContainer objectsAndGroups;
|
||||
gd::EventsFunctionTools::FreeEventsFunctionToObjectsContainer(
|
||||
project, functionsContainer, eventsFunction, globalObjectsAndGroups, objectsAndGroups);
|
||||
project,
|
||||
functionsContainer,
|
||||
eventsFunction,
|
||||
globalObjectsAndGroups,
|
||||
objectsAndGroups);
|
||||
|
||||
EventsCodeGenerator codeGenerator(globalObjectsAndGroups, objectsAndGroups);
|
||||
codeGenerator.SetCodeNamespace(codeNamespace);
|
||||
@@ -136,7 +140,9 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionCode(
|
||||
codeGenerator.GenerateEventsFunctionParameterDeclarationsList(
|
||||
eventsFunction.GetParametersForEvents(functionsContainer), 0, true),
|
||||
codeGenerator.GenerateFreeEventsFunctionContext(
|
||||
eventsFunction.GetParametersForEvents(functionsContainer), "runtimeScene.getOnceTriggers()"),
|
||||
eventsFunction.GetParametersForEvents(functionsContainer),
|
||||
"runtimeScene.getOnceTriggers()",
|
||||
eventsFunction.IsAsync()),
|
||||
eventsFunction.GetEvents(),
|
||||
"",
|
||||
codeGenerator.GenerateEventsFunctionReturn(eventsFunction));
|
||||
@@ -189,6 +195,7 @@ gd::String EventsCodeGenerator::GenerateBehaviorEventsFunctionCode(
|
||||
eventsFunction.GetParametersForEvents(
|
||||
eventsBasedBehavior.GetEventsFunctions()),
|
||||
onceTriggersVariable,
|
||||
eventsFunction.IsAsync(),
|
||||
// Pass the names of the parameters considered as the current
|
||||
// object and behavior parameters:
|
||||
"Object",
|
||||
@@ -199,7 +206,9 @@ gd::String EventsCodeGenerator::GenerateBehaviorEventsFunctionCode(
|
||||
fullyQualifiedFunctionName,
|
||||
codeGenerator.GenerateEventsFunctionParameterDeclarationsList(
|
||||
eventsFunction.GetParametersForEvents(
|
||||
eventsBasedBehavior.GetEventsFunctions()), 2, false),
|
||||
eventsBasedBehavior.GetEventsFunctions()),
|
||||
2,
|
||||
false),
|
||||
fullPreludeCode,
|
||||
eventsFunction.GetEvents(),
|
||||
"",
|
||||
@@ -246,35 +255,38 @@ gd::String EventsCodeGenerator::GenerateObjectEventsFunctionCode(
|
||||
// hashmap).
|
||||
"var thisObjectList = [this];\n" +
|
||||
"var Object = Hashtable.newFrom({Object: thisObjectList});\n";
|
||||
|
||||
// Add child-objects
|
||||
for (auto &childObject : eventsBasedObject.GetObjects()) {
|
||||
// child-object are never picked because they are not parameters.
|
||||
const auto &childName = ManObjListName(childObject->GetName());
|
||||
fullPreludeCode +=
|
||||
"var this" + childName + "List = [...runtimeScene.getObjects(" +
|
||||
ConvertToStringExplicit(childObject->GetName()) + ")];\n" +
|
||||
"var " + childName + " = Hashtable.newFrom({" +
|
||||
ConvertToStringExplicit(childObject->GetName()) +
|
||||
": this" + childName + "List});\n";
|
||||
}
|
||||
|
||||
fullPreludeCode += codeGenerator.GenerateObjectEventsFunctionContext(
|
||||
eventsBasedObject,
|
||||
eventsFunction.GetParametersForEvents(
|
||||
eventsBasedObject.GetEventsFunctions()),
|
||||
onceTriggersVariable,
|
||||
// Pass the names of the parameters considered as the current
|
||||
// object and behavior parameters:
|
||||
"Object");
|
||||
// Add child-objects
|
||||
for (auto& childObject : eventsBasedObject.GetObjects()) {
|
||||
// child-object are never picked because they are not parameters.
|
||||
const auto& childName = ManObjListName(childObject->GetName());
|
||||
fullPreludeCode += "var this" + childName +
|
||||
"List = [...runtimeScene.getObjects(" +
|
||||
ConvertToStringExplicit(childObject->GetName()) +
|
||||
")];\n" + "var " + childName + " = Hashtable.newFrom({" +
|
||||
ConvertToStringExplicit(childObject->GetName()) +
|
||||
": this" + childName + "List});\n";
|
||||
}
|
||||
|
||||
fullPreludeCode += codeGenerator.GenerateObjectEventsFunctionContext(
|
||||
eventsBasedObject,
|
||||
eventsFunction.GetParametersForEvents(
|
||||
eventsBasedObject.GetEventsFunctions()),
|
||||
onceTriggersVariable,
|
||||
eventsFunction.IsAsync(),
|
||||
// Pass the names of the parameters considered as the current
|
||||
// object and behavior parameters:
|
||||
"Object");
|
||||
|
||||
gd::String output = GenerateEventsListCompleteFunctionCode(
|
||||
codeGenerator,
|
||||
fullyQualifiedFunctionName,
|
||||
codeGenerator.GenerateEventsFunctionParameterDeclarationsList(
|
||||
// TODO EBO use constants for firstParameterIndex
|
||||
// TODO EBO use constants for firstParameterIndex
|
||||
eventsFunction.GetParametersForEvents(
|
||||
eventsBasedObject.GetEventsFunctions()), 1, false),
|
||||
eventsBasedObject.GetEventsFunctions()),
|
||||
1,
|
||||
false),
|
||||
fullPreludeCode,
|
||||
eventsFunction.GetEvents(),
|
||||
endingCode,
|
||||
@@ -310,7 +322,8 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionParameterDeclarationsList(
|
||||
|
||||
gd::String EventsCodeGenerator::GenerateFreeEventsFunctionContext(
|
||||
const vector<gd::ParameterMetadata>& parameters,
|
||||
const gd::String& onceTriggersVariable) {
|
||||
const gd::String& onceTriggersVariable,
|
||||
bool isAsync) {
|
||||
gd::String objectsGettersMap;
|
||||
gd::String objectArraysMap;
|
||||
gd::String behaviorNamesMap;
|
||||
@@ -318,13 +331,15 @@ gd::String EventsCodeGenerator::GenerateFreeEventsFunctionContext(
|
||||
onceTriggersVariable,
|
||||
objectsGettersMap,
|
||||
objectArraysMap,
|
||||
behaviorNamesMap);
|
||||
behaviorNamesMap,
|
||||
isAsync);
|
||||
}
|
||||
|
||||
gd::String EventsCodeGenerator::GenerateBehaviorEventsFunctionContext(
|
||||
const gd::EventsBasedBehavior& eventsBasedBehavior,
|
||||
const vector<gd::ParameterMetadata>& parameters,
|
||||
const gd::String& onceTriggersVariable,
|
||||
bool isAsync,
|
||||
const gd::String& thisObjectName,
|
||||
const gd::String& thisBehaviorName) {
|
||||
// See the comment at the start of the GenerateEventsFunctionContext function
|
||||
@@ -375,6 +390,7 @@ gd::String EventsCodeGenerator::GenerateBehaviorEventsFunctionContext(
|
||||
objectsGettersMap,
|
||||
objectArraysMap,
|
||||
behaviorNamesMap,
|
||||
isAsync,
|
||||
thisObjectName,
|
||||
thisBehaviorName);
|
||||
}
|
||||
@@ -383,6 +399,7 @@ gd::String EventsCodeGenerator::GenerateObjectEventsFunctionContext(
|
||||
const gd::EventsBasedObject& eventsBasedObject,
|
||||
const vector<gd::ParameterMetadata>& parameters,
|
||||
const gd::String& onceTriggersVariable,
|
||||
bool isAsync,
|
||||
const gd::String& thisObjectName) {
|
||||
// See the comment at the start of the GenerateEventsFunctionContext function
|
||||
|
||||
@@ -399,13 +416,17 @@ gd::String EventsCodeGenerator::GenerateObjectEventsFunctionContext(
|
||||
ConvertToStringExplicit(thisObjectName) + ": " + thisObjectName + "\n";
|
||||
objectArraysMap +=
|
||||
ConvertToStringExplicit(thisObjectName) + ": thisObjectList\n";
|
||||
|
||||
|
||||
// Add child-objects
|
||||
for (auto &childObject : eventsBasedObject.GetObjects()) {
|
||||
const auto &childName = ManObjListName(childObject->GetName());
|
||||
for (auto& childObject : eventsBasedObject.GetObjects()) {
|
||||
const auto& childName = ManObjListName(childObject->GetName());
|
||||
// child-object are never picked because they are not parameters.
|
||||
objectsGettersMap += ", " + ConvertToStringExplicit(childObject->GetName()) + ": " + childName + "\n";
|
||||
objectArraysMap += ", " + ConvertToStringExplicit(childObject->GetName()) + ": this" + childName + "List\n";
|
||||
objectsGettersMap += ", " +
|
||||
ConvertToStringExplicit(childObject->GetName()) +
|
||||
": " + childName + "\n";
|
||||
objectArraysMap += ", " +
|
||||
ConvertToStringExplicit(childObject->GetName()) +
|
||||
": this" + childName + "List\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,6 +435,7 @@ gd::String EventsCodeGenerator::GenerateObjectEventsFunctionContext(
|
||||
objectsGettersMap,
|
||||
objectArraysMap,
|
||||
behaviorNamesMap,
|
||||
isAsync,
|
||||
thisObjectName);
|
||||
}
|
||||
|
||||
@@ -423,6 +445,7 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionContext(
|
||||
gd::String& objectsGettersMap,
|
||||
gd::String& objectArraysMap,
|
||||
gd::String& behaviorNamesMap,
|
||||
bool isAsync,
|
||||
const gd::String& thisObjectName,
|
||||
const gd::String& thisBehaviorName) {
|
||||
// When running in the context of a function generated from events, we
|
||||
@@ -474,7 +497,12 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionContext(
|
||||
}
|
||||
}
|
||||
|
||||
const gd::String async =
|
||||
isAsync ? " task: new gdjs.ManuallyResolvableTask(),\n" : "";
|
||||
|
||||
return gd::String("var eventsFunctionContext = {\n") +
|
||||
// The async task, if there is one
|
||||
async +
|
||||
// The object name to parameter map:
|
||||
" _objectsMap: {\n" + objectsGettersMap +
|
||||
"},\n"
|
||||
@@ -502,8 +530,10 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionContext(
|
||||
// can be different between the parameter name vs the actual behavior
|
||||
// name passed as argument).
|
||||
" getBehaviorName: function(behaviorName) {\n" +
|
||||
// TODO EBO Handle behavior name collision between parameters and children
|
||||
" return eventsFunctionContext._behaviorNamesMap[behaviorName] || behaviorName;\n"
|
||||
// TODO EBO Handle behavior name collision between parameters and
|
||||
// children
|
||||
" return eventsFunctionContext._behaviorNamesMap[behaviorName] || "
|
||||
"behaviorName;\n"
|
||||
" },\n" +
|
||||
// Creator function that will be used to create new objects. We
|
||||
// need to check if the function was given the context of the calling
|
||||
@@ -537,15 +567,13 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionContext(
|
||||
" getInstancesCountOnScene: function(objectName) {\n"
|
||||
" const objectsList = "
|
||||
"eventsFunctionContext._objectsMap[objectName];\n" +
|
||||
" let count = 0;\n" +
|
||||
" if (objectsList) {\n" +
|
||||
" let count = 0;\n" + " if (objectsList) {\n" +
|
||||
" for(const objectName in objectsList.items)\n" +
|
||||
" count += parentEventsFunctionContext ?\n" +
|
||||
"parentEventsFunctionContext.getInstancesCountOnScene(objectName) "
|
||||
":\n" +
|
||||
" runtimeScene.getInstancesCountOnScene(objectName);\n" +
|
||||
" }\n" +
|
||||
" return count;\n" +
|
||||
" }\n" + " return count;\n" +
|
||||
" },\n"
|
||||
// Allow to get a layer directly from the context for convenience:
|
||||
" getLayer: function(layerName) {\n"
|
||||
@@ -562,6 +590,7 @@ gd::String EventsCodeGenerator::GenerateEventsFunctionContext(
|
||||
|
||||
gd::String EventsCodeGenerator::GenerateEventsFunctionReturn(
|
||||
const gd::EventsFunction& eventsFunction) {
|
||||
if (eventsFunction.IsAsync()) return "return eventsFunctionContext.task";
|
||||
// We don't use IsCondition because ExpressionAndCondition event functions
|
||||
// don't need a boolean function. They use the expression function with a
|
||||
// relational operator.
|
||||
|
@@ -375,7 +375,8 @@ class EventsCodeGenerator : public gd::EventsCodeGenerator {
|
||||
*/
|
||||
gd::String GenerateFreeEventsFunctionContext(
|
||||
const std::vector<gd::ParameterMetadata>& parameters,
|
||||
const gd::String& onceTriggersVariable);
|
||||
const gd::String& onceTriggersVariable,
|
||||
bool isAsync);
|
||||
|
||||
/**
|
||||
* \brief Generate the "eventsFunctionContext" object that allow a behavior
|
||||
@@ -386,6 +387,7 @@ class EventsCodeGenerator : public gd::EventsCodeGenerator {
|
||||
const gd::EventsBasedBehavior& eventsBasedBehavior,
|
||||
const std::vector<gd::ParameterMetadata>& parameters,
|
||||
const gd::String& onceTriggersVariable,
|
||||
bool isAsync,
|
||||
const gd::String& thisObjectName,
|
||||
const gd::String& thisBehaviorName);
|
||||
|
||||
@@ -398,6 +400,7 @@ class EventsCodeGenerator : public gd::EventsCodeGenerator {
|
||||
const gd::EventsBasedObject& eventsBasedObject,
|
||||
const std::vector<gd::ParameterMetadata>& parameters,
|
||||
const gd::String& onceTriggersVariable,
|
||||
bool isAsync,
|
||||
const gd::String& thisObjectName);
|
||||
|
||||
gd::String GenerateEventsFunctionReturn(
|
||||
@@ -429,6 +432,7 @@ class EventsCodeGenerator : public gd::EventsCodeGenerator {
|
||||
gd::String& objectsGettersMap,
|
||||
gd::String& objectArraysMap,
|
||||
gd::String& behaviorNamesMap,
|
||||
bool isAsync,
|
||||
const gd::String& thisObjectName = "",
|
||||
const gd::String& thisBehaviorName = "");
|
||||
};
|
||||
|
@@ -68,6 +68,9 @@ AsyncExtension::AsyncExtension() {
|
||||
return "{\n" + parentAsyncObjectsListGetter + "{\n" +
|
||||
asyncObjectsListBuilder + asyncActionCode + "}\n" + "}\n";
|
||||
});
|
||||
|
||||
GetAllActions()["BuiltinAsync::ResolveAsyncEventsFunction"].SetFunctionName(
|
||||
"gdjs.evtTools.common.resolveAsyncEventsFunction");
|
||||
}
|
||||
|
||||
} // namespace gdjs
|
||||
|
@@ -164,7 +164,7 @@ BaseObjectExtension::BaseObjectExtension() {
|
||||
objectConditions["CollisionPoint"]
|
||||
.SetFunctionName("isCollidingWithPoint")
|
||||
.SetIncludeFile("runtimeobject.js");
|
||||
objectConditions["ObjectTimer"] // deprecated
|
||||
objectConditions["ObjectTimer"] // deprecated
|
||||
.SetFunctionName("timerElapsedTime")
|
||||
.SetIncludeFile("runtimeobject.js");
|
||||
objectConditions["CompareObjectTimer"]
|
||||
@@ -223,6 +223,18 @@ BaseObjectExtension::BaseObjectExtension() {
|
||||
objectExpressions["VariableChildCount"]
|
||||
.SetFunctionName("gdjs.RuntimeObject.getVariableChildCount")
|
||||
.SetStatic();
|
||||
objectExpressions["ArrayVariableFirstNumber"]
|
||||
.SetFunctionName("gdjs.RuntimeObject.getFirstVariableNumber")
|
||||
.SetStatic();
|
||||
objectStrExpressions["ArrayVariableFirstString"]
|
||||
.SetFunctionName("gdjs.RuntimeObject.getFirstVariableString")
|
||||
.SetStatic();
|
||||
objectExpressions["ArrayVariableLastNumber"]
|
||||
.SetFunctionName("gdjs.RuntimeObject.getLastVariableNumber")
|
||||
.SetStatic();
|
||||
objectStrExpressions["ArrayVariableLastString"]
|
||||
.SetFunctionName("gdjs.RuntimeObject.getLastVariableString")
|
||||
.SetStatic();
|
||||
objectExpressions["ForceX"].SetFunctionName("getAverageForce().getX");
|
||||
objectExpressions["ForceY"].SetFunctionName("getAverageForce().getY");
|
||||
objectExpressions["ForceAngle"].SetFunctionName("getAverageForce().getAngle");
|
||||
@@ -254,9 +266,9 @@ BaseObjectExtension::BaseObjectExtension() {
|
||||
"gdjs.evtTools.object.createObjectFromGroupOnScene");
|
||||
|
||||
GetAllExpressions()["Count"].SetFunctionName(
|
||||
"gdjs.evtTools.object.pickedObjectsCount"); // Deprecated
|
||||
"gdjs.evtTools.object.pickedObjectsCount"); // Deprecated
|
||||
GetAllConditions()["NbObjet"].SetFunctionName(
|
||||
"gdjs.evtTools.object.pickedObjectsCount"); // Deprecated
|
||||
"gdjs.evtTools.object.pickedObjectsCount"); // Deprecated
|
||||
|
||||
GetAllExpressions()["SceneInstancesCount"].SetFunctionName(
|
||||
"gdjs.evtTools.object.getSceneInstancesCount");
|
||||
@@ -335,6 +347,9 @@ BaseObjectExtension::BaseObjectExtension() {
|
||||
objectActions["ObjectVariableRemoveAt"]
|
||||
.SetFunctionName("variableRemoveAt")
|
||||
.SetIncludeFile("runtimeobject.js");
|
||||
objectConditions["ObjectVariableChildCount"]
|
||||
.SetFunctionName("getVariableChildCount")
|
||||
.SetIncludeFile("runtimeobject.js");
|
||||
|
||||
GetAllActions()["MoveObjects"].codeExtraInformation.SetCustomCodeGenerator(
|
||||
[](gd::Instruction &,
|
||||
|
@@ -34,23 +34,46 @@ VariablesExtension::VariablesExtension() {
|
||||
"gdjs.evtTools.variable.getVariableString");
|
||||
GetAllConditions()["GlobalVariableAsBoolean"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableBoolean");
|
||||
GetAllExpressions()["Variable"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableNumber");
|
||||
GetAllStrExpressions()["VariableString"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableString");
|
||||
|
||||
GetAllExpressions()["VariableChildCount"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableChildCount");
|
||||
GetAllExpressions()["GlobalVariableChildCount"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableChildCount");
|
||||
|
||||
GetAllExpressions()["Variable"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableNumber");
|
||||
GetAllStrExpressions()["VariableString"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableString");
|
||||
GetAllExpressions()["GlobalVariable"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableNumber");
|
||||
GetAllStrExpressions()["GlobalVariableString"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableString");
|
||||
|
||||
GetAllStrExpressions()["GlobalVariableFirstString"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getFirstVariableString");
|
||||
GetAllExpressions()["GlobalVariableFirstNumber"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getFirstVariableNumber");
|
||||
GetAllStrExpressions()["GlobalVariableLastString"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getLastVariableString");
|
||||
GetAllExpressions()["GlobalVariableLastNumber"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getLastVariableNumber");
|
||||
GetAllStrExpressions()["SceneVariableFirstString"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getFirstVariableString");
|
||||
GetAllExpressions()["SceneVariableFirstNumber"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getFirstVariableNumber");
|
||||
GetAllStrExpressions()["SceneVariableLastString"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getLastVariableString");
|
||||
GetAllExpressions()["SceneVariableLastNumber"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getLastVariableNumber");
|
||||
|
||||
GetAllConditions()["VarSceneDef"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.sceneVariableExists");
|
||||
GetAllConditions()["VarGlobalDef"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.globalVariableExists");
|
||||
GetAllConditions()["SceneVariableChildCount"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableChildCount");
|
||||
GetAllConditions()["GlobalVariableChildCount"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.getVariableChildCount");
|
||||
|
||||
GetAllActions()["SetSceneVariableAsBoolean"].SetFunctionName(
|
||||
"gdjs.evtTools.variable.setVariableBoolean");
|
||||
|
@@ -50,25 +50,29 @@ bool Exporter::ExportProjectForPixiPreview(
|
||||
return helper.ExportProjectForPixiPreview(options);
|
||||
}
|
||||
|
||||
bool Exporter::ExportWholePixiProject(
|
||||
gd::Project &project,
|
||||
gd::String exportDir,
|
||||
std::map<gd::String, bool> &exportOptions) {
|
||||
bool Exporter::ExportWholePixiProject(const ExportOptions &options) {
|
||||
ExporterHelper helper(fs, gdjsRoot, codeOutputDir);
|
||||
gd::Project exportedProject = project;
|
||||
gd::Project exportedProject = options.project;
|
||||
|
||||
auto usedExtensionsResult = gd::UsedExtensionsFinder::ScanProject(project);
|
||||
auto& usedExtensions = usedExtensionsResult.GetUsedExtensions();
|
||||
auto usedExtensionsResult =
|
||||
gd::UsedExtensionsFinder::ScanProject(options.project);
|
||||
auto &usedExtensions = usedExtensionsResult.GetUsedExtensions();
|
||||
|
||||
auto exportProject = [this, &exportedProject, &exportOptions, &helper,
|
||||
auto exportProject = [this,
|
||||
&exportedProject,
|
||||
&options,
|
||||
&helper,
|
||||
&usedExtensionsResult](gd::String exportDir) {
|
||||
bool exportForCordova = exportOptions["exportForCordova"];
|
||||
bool exportForFacebookInstantGames =
|
||||
exportOptions["exportForFacebookInstantGames"];
|
||||
|
||||
// Always disable the splash for Facebook Instant Games
|
||||
if (exportForFacebookInstantGames)
|
||||
exportedProject.GetLoadingScreen().ShowGDevelopSplash(false);
|
||||
// Use project properties fallback to set empty properties
|
||||
if (exportedProject.GetAuthorIds().empty() &&
|
||||
!options.fallbackAuthorId.empty()) {
|
||||
exportedProject.GetAuthorIds().push_back(options.fallbackAuthorId);
|
||||
}
|
||||
if (exportedProject.GetAuthorUsernames().empty() &&
|
||||
!options.fallbackAuthorUsername.empty()) {
|
||||
exportedProject.GetAuthorUsernames().push_back(
|
||||
options.fallbackAuthorUsername);
|
||||
}
|
||||
|
||||
// Prepare the export directory
|
||||
fs.MkDir(exportDir);
|
||||
@@ -143,9 +147,9 @@ bool Exporter::ExportWholePixiProject(
|
||||
helper.ExportIncludesAndLibs(resourcesFiles, exportDir, false);
|
||||
|
||||
gd::String source = gdjsRoot + "/Runtime/index.html";
|
||||
if (exportForCordova)
|
||||
if (options.target == "cordova")
|
||||
source = gdjsRoot + "/Runtime/Cordova/www/index.html";
|
||||
else if (exportForFacebookInstantGames)
|
||||
else if (options.target == "facebookInstantGames")
|
||||
source = gdjsRoot + "/Runtime/FacebookInstantGames/index.html";
|
||||
|
||||
if (!helper.ExportPixiIndexFile(exportedProject,
|
||||
@@ -161,28 +165,31 @@ bool Exporter::ExportWholePixiProject(
|
||||
return true;
|
||||
};
|
||||
|
||||
if (exportOptions["exportForCordova"]) {
|
||||
fs.MkDir(exportDir);
|
||||
fs.MkDir(exportDir + "/www");
|
||||
if (options.target == "cordova") {
|
||||
fs.MkDir(options.exportPath);
|
||||
fs.MkDir(options.exportPath + "/www");
|
||||
|
||||
if (!exportProject(exportDir + "/www")) return false;
|
||||
if (!exportProject(options.exportPath + "/www")) return false;
|
||||
|
||||
if (!helper.ExportCordovaFiles(exportedProject, exportDir, usedExtensions))
|
||||
if (!helper.ExportCordovaFiles(
|
||||
exportedProject, options.exportPath, usedExtensions))
|
||||
return false;
|
||||
} else if (exportOptions["exportForElectron"]) {
|
||||
fs.MkDir(exportDir);
|
||||
} else if (options.target == "electron") {
|
||||
fs.MkDir(options.exportPath);
|
||||
|
||||
if (!exportProject(exportDir + "/app")) return false;
|
||||
if (!exportProject(options.exportPath + "/app")) return false;
|
||||
|
||||
if (!helper.ExportElectronFiles(exportedProject, exportDir, usedExtensions))
|
||||
if (!helper.ExportElectronFiles(
|
||||
exportedProject, options.exportPath, usedExtensions))
|
||||
return false;
|
||||
} else if (exportOptions["exportForFacebookInstantGames"]) {
|
||||
if (!exportProject(exportDir)) return false;
|
||||
} else if (options.target == "facebookInstantGames") {
|
||||
if (!exportProject(options.exportPath)) return false;
|
||||
|
||||
if (!helper.ExportFacebookInstantGamesFiles(exportedProject, exportDir))
|
||||
if (!helper.ExportFacebookInstantGamesFiles(exportedProject,
|
||||
options.exportPath))
|
||||
return false;
|
||||
} else {
|
||||
if (!exportProject(exportDir)) return false;
|
||||
if (!exportProject(options.exportPath)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@@ -17,7 +17,10 @@ class Layout;
|
||||
class ExternalLayout;
|
||||
class AbstractFileSystem;
|
||||
} // namespace gd
|
||||
namespace gdjs { struct PreviewExportOptions; }
|
||||
namespace gdjs {
|
||||
struct PreviewExportOptions;
|
||||
struct ExportOptions;
|
||||
}
|
||||
|
||||
namespace gdjs {
|
||||
|
||||
@@ -45,9 +48,7 @@ class Exporter {
|
||||
*
|
||||
* Called by ShowProjectExportDialog if the user clicked on Ok.
|
||||
*/
|
||||
bool ExportWholePixiProject(gd::Project& project,
|
||||
gd::String exportDir,
|
||||
std::map<gd::String, bool>& exportOptions);
|
||||
bool ExportWholePixiProject(const ExportOptions& options);
|
||||
|
||||
/**
|
||||
* \brief Return the error that occurred during the last export.
|
||||
|
@@ -23,16 +23,17 @@
|
||||
#include "GDCore/Extensions/Platform.h"
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
#include "GDCore/IDE/AbstractFileSystem.h"
|
||||
#include "GDCore/IDE/Events/UsedExtensionsFinder.h"
|
||||
#include "GDCore/IDE/ExportedDependencyResolver.h"
|
||||
#include "GDCore/IDE/Project/ProjectResourcesCopier.h"
|
||||
#include "GDCore/IDE/ProjectStripper.h"
|
||||
#include "GDCore/IDE/SceneNameMangler.h"
|
||||
#include "GDCore/Project/EventsBasedObject.h"
|
||||
#include "GDCore/Project/EventsFunctionsExtension.h"
|
||||
#include "GDCore/Project/ExternalEvents.h"
|
||||
#include "GDCore/Project/ExternalLayout.h"
|
||||
#include "GDCore/Project/Layout.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
#include "GDCore/Project/EventsBasedObject.h"
|
||||
#include "GDCore/Project/EventsFunctionsExtension.h"
|
||||
#include "GDCore/Project/PropertyDescriptor.h"
|
||||
#include "GDCore/Project/SourceFile.h"
|
||||
#include "GDCore/Serialization/Serializer.h"
|
||||
@@ -41,7 +42,6 @@
|
||||
#include "GDCore/Tools/Log.h"
|
||||
#include "GDJS/Events/CodeGeneration/LayoutCodeGenerator.h"
|
||||
#include "GDJS/Extensions/JsPlatform.h"
|
||||
#include "GDCore/IDE/Events/UsedExtensionsFinder.h"
|
||||
#undef CopyFile // Disable an annoying macro
|
||||
|
||||
namespace {
|
||||
@@ -87,11 +87,23 @@ bool ExporterHelper::ExportProjectForPixiPreview(
|
||||
gd::Project exportedProject = options.project;
|
||||
const gd::Project &immutableProject = exportedProject;
|
||||
|
||||
if (!options.fullLoadingScreen) {
|
||||
if (options.fullLoadingScreen) {
|
||||
// Use project properties fallback to set empty properties
|
||||
if (exportedProject.GetAuthorIds().empty() &&
|
||||
!options.fallbackAuthorId.empty()) {
|
||||
exportedProject.GetAuthorIds().push_back(options.fallbackAuthorId);
|
||||
}
|
||||
if (exportedProject.GetAuthorUsernames().empty() &&
|
||||
!options.fallbackAuthorUsername.empty()) {
|
||||
exportedProject.GetAuthorUsernames().push_back(
|
||||
options.fallbackAuthorUsername);
|
||||
}
|
||||
} else {
|
||||
// Most of the time, we skip the logo and minimum duration so that
|
||||
// the preview start as soon as possible.
|
||||
exportedProject.GetLoadingScreen().ShowGDevelopSplash(false);
|
||||
exportedProject.GetLoadingScreen().SetMinDuration(0);
|
||||
exportedProject.GetLoadingScreen().ShowGDevelopLogoDuringLoadingScreen(false).SetMinDuration(
|
||||
0);
|
||||
exportedProject.GetWatermark().ShowGDevelopWatermark(false);
|
||||
}
|
||||
|
||||
// Export resources (*before* generating events as some resources filenames
|
||||
@@ -174,6 +186,12 @@ bool ExporterHelper::ExportProjectForPixiPreview(
|
||||
if (options.isDevelopmentEnvironment) {
|
||||
runtimeGameOptions.AddChild("environment").SetStringValue("dev");
|
||||
}
|
||||
if (!options.gdevelopResourceToken.empty()) {
|
||||
runtimeGameOptions.AddChild("gdevelopResourceToken")
|
||||
.SetStringValue(options.gdevelopResourceToken);
|
||||
}
|
||||
runtimeGameOptions.AddChild("allowAuthenticationUsingIframeForPreview")
|
||||
.SetBoolValue(options.allowAuthenticationUsingIframeForPreview);
|
||||
|
||||
// Pass in the options the list of scripts files - useful for hot-reloading.
|
||||
auto &scriptFilesElement = runtimeGameOptions.AddChild("scriptFiles");
|
||||
@@ -573,9 +591,11 @@ void ExporterHelper::AddLibsInclude(bool pixiRenderers,
|
||||
InsertUnique(includesFiles, "runtimescene.js");
|
||||
InsertUnique(includesFiles, "scenestack.js");
|
||||
InsertUnique(includesFiles, "force.js");
|
||||
InsertUnique(includesFiles, "RuntimeLayer.js");
|
||||
InsertUnique(includesFiles, "layer.js");
|
||||
InsertUnique(includesFiles, "RuntimeSceneLayer.js");
|
||||
InsertUnique(includesFiles, "RuntimeCustomObjectLayer.js");
|
||||
InsertUnique(includesFiles, "timer.js");
|
||||
InsertUnique(includesFiles, "runtimewatermark.js");
|
||||
InsertUnique(includesFiles, "runtimegame.js");
|
||||
InsertUnique(includesFiles, "variable.js");
|
||||
InsertUnique(includesFiles, "variablescontainer.js");
|
||||
|
@@ -38,7 +38,10 @@ struct PreviewExportOptions {
|
||||
projectDataOnlyExport(false),
|
||||
fullLoadingScreen(false),
|
||||
isDevelopmentEnvironment(false),
|
||||
nonRuntimeScriptsCacheBurst(0){};
|
||||
nonRuntimeScriptsCacheBurst(0),
|
||||
fallbackAuthorId(""),
|
||||
fallbackAuthorUsername(""),
|
||||
allowAuthenticationUsingIframeForPreview(false){};
|
||||
|
||||
/**
|
||||
* \brief Set the address of the debugger server that the game should reach
|
||||
@@ -51,6 +54,17 @@ struct PreviewExportOptions {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set the fallback author info (if info not present in project
|
||||
* properties).
|
||||
*/
|
||||
PreviewExportOptions &SetFallbackAuthor(const gd::String &id,
|
||||
const gd::String &username) {
|
||||
fallbackAuthorId = id;
|
||||
fallbackAuthorUsername = username;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set that the game should connect to the debugger server using
|
||||
* the "Window Message " debugger client.
|
||||
@@ -137,6 +151,30 @@ struct PreviewExportOptions {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the token to use by the game engine when requiring any resource stored on
|
||||
* GDevelop Cloud buckets. Note that this is only useful during previews.
|
||||
*/
|
||||
PreviewExportOptions &SetGDevelopResourceToken(
|
||||
const gd::String &gdevelopResourceToken_) {
|
||||
gdevelopResourceToken = gdevelopResourceToken_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if, in some exceptional cases, we allow authentication
|
||||
* to be done through a iframe.
|
||||
* This is usually discouraged as the user can't verify that the
|
||||
* authentication window is a genuine one. It's only to be used in trusted
|
||||
* contexts.
|
||||
*/
|
||||
PreviewExportOptions &SetAllowAuthenticationUsingIframeForPreview(
|
||||
bool allowAuthenticationUsingIframeForPreview_) {
|
||||
allowAuthenticationUsingIframeForPreview =
|
||||
allowAuthenticationUsingIframeForPreview_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
gd::Project &project;
|
||||
gd::String exportPath;
|
||||
gd::String websocketDebuggerServerAddress;
|
||||
@@ -144,12 +182,60 @@ struct PreviewExportOptions {
|
||||
bool useWindowMessageDebuggerClient;
|
||||
gd::String layoutName;
|
||||
gd::String externalLayoutName;
|
||||
gd::String fallbackAuthorUsername;
|
||||
gd::String fallbackAuthorId;
|
||||
std::map<gd::String, int> includeFileHashes;
|
||||
bool projectDataOnlyExport;
|
||||
bool fullLoadingScreen;
|
||||
bool isDevelopmentEnvironment;
|
||||
unsigned int nonRuntimeScriptsCacheBurst;
|
||||
gd::String electronRemoteRequirePath;
|
||||
gd::String gdevelopResourceToken;
|
||||
bool allowAuthenticationUsingIframeForPreview;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief The options used to export a project.
|
||||
*/
|
||||
struct ExportOptions {
|
||||
/**
|
||||
* \param project_ The project to export
|
||||
* \param exportPath_ The path in the filesystem where to export the files
|
||||
*/
|
||||
ExportOptions(gd::Project &project_, const gd::String &exportPath_)
|
||||
: project(project_),
|
||||
exportPath(exportPath_),
|
||||
target(""),
|
||||
fallbackAuthorId(""),
|
||||
fallbackAuthorUsername(""){};
|
||||
|
||||
/**
|
||||
* \brief Set the fallback author info (if info not present in project
|
||||
* properties).
|
||||
*/
|
||||
ExportOptions &SetFallbackAuthor(const gd::String &id,
|
||||
const gd::String &username) {
|
||||
fallbackAuthorId = id;
|
||||
fallbackAuthorUsername = username;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Set the (optional) target platform.
|
||||
*
|
||||
* \param target_ The target platform (`cordova`, `facebookInstantGames` or
|
||||
* `electron`)
|
||||
*/
|
||||
ExportOptions &SetTarget(const gd::String &target_) {
|
||||
target = target_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
gd::Project &project;
|
||||
gd::String exportPath;
|
||||
gd::String target;
|
||||
gd::String fallbackAuthorUsername;
|
||||
gd::String fallbackAuthorId;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -117,4 +117,16 @@ ${error ? 'The following error was thrown: ' + error : ''}`
|
||||
return this.isResolved;
|
||||
}
|
||||
}
|
||||
|
||||
export class ManuallyResolvableTask extends AsyncTask {
|
||||
private isResolved = false;
|
||||
|
||||
resolve() {
|
||||
this.isResolved = true;
|
||||
}
|
||||
|
||||
update(): boolean {
|
||||
return this.isResolved;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -27,11 +27,15 @@ namespace gdjs {
|
||||
_untransformedHitBoxes: gdjs.Polygon[] = [];
|
||||
/** The dimension of this object is calculated from its children AABBs. */
|
||||
_unrotatedAABB: AABB = { min: [0, 0], max: [0, 0] };
|
||||
_scaleX: number = 1;
|
||||
_scaleY: number = 1;
|
||||
_scaleX: float = 1;
|
||||
_scaleY: float = 1;
|
||||
_flippedX: boolean = false;
|
||||
_flippedY: boolean = false;
|
||||
opacity: float = 255;
|
||||
_customCenter: FloatPoint | null = null;
|
||||
_localTransformation: gdjs.AffineTransformation = new gdjs.AffineTransformation();
|
||||
_localInverseTransformation: gdjs.AffineTransformation = new gdjs.AffineTransformation();
|
||||
_isLocalTransformationDirty: boolean = true;
|
||||
|
||||
/**
|
||||
* @param parent The container the object belongs to
|
||||
@@ -149,8 +153,9 @@ namespace gdjs {
|
||||
this._updateUntransformedHitBoxes();
|
||||
}
|
||||
|
||||
//Update the current hitboxes with the frame custom hit boxes
|
||||
//and apply transformations.
|
||||
// Update the current hitboxes with the frame custom hit boxes
|
||||
// and apply transformations.
|
||||
const localTransformation = this.getLocalTransformation();
|
||||
for (let i = 0; i < this._untransformedHitBoxes.length; ++i) {
|
||||
if (i >= this.hitBoxes.length) {
|
||||
this.hitBoxes.push(new gdjs.Polygon());
|
||||
@@ -163,9 +168,8 @@ namespace gdjs {
|
||||
if (j >= this.hitBoxes[i].vertices.length) {
|
||||
this.hitBoxes[i].vertices.push([0, 0]);
|
||||
}
|
||||
this.applyObjectTransformation(
|
||||
this._untransformedHitBoxes[i].vertices[j][0],
|
||||
this._untransformedHitBoxes[i].vertices[j][1],
|
||||
localTransformation.transform(
|
||||
this._untransformedHitBoxes[i].vertices[j],
|
||||
this.hitBoxes[i].vertices[j]
|
||||
);
|
||||
}
|
||||
@@ -181,11 +185,6 @@ namespace gdjs {
|
||||
_updateUntransformedHitBoxes() {
|
||||
this._isUntransformedHitBoxesDirty = false;
|
||||
|
||||
const oldUnrotatedMinX = this._unrotatedAABB.min[0];
|
||||
const oldUnrotatedMinY = this._unrotatedAABB.min[1];
|
||||
const oldUnrotatedMaxX = this._unrotatedAABB.max[0];
|
||||
const oldUnrotatedMaxY = this._unrotatedAABB.max[1];
|
||||
|
||||
this._untransformedHitBoxes.length = 0;
|
||||
if (this._instanceContainer.getAdhocListOfAllInstances().length === 0) {
|
||||
this._unrotatedAABB.min[0] = 0;
|
||||
@@ -218,20 +217,6 @@ namespace gdjs {
|
||||
}
|
||||
this.hitBoxes.length = this._untransformedHitBoxes.length;
|
||||
}
|
||||
|
||||
// The default camera center depends on the object dimensions so checking
|
||||
// the AABB center is not enough.
|
||||
if (
|
||||
this._unrotatedAABB.min[0] !== oldUnrotatedMinX ||
|
||||
this._unrotatedAABB.min[1] !== oldUnrotatedMinY ||
|
||||
this._unrotatedAABB.max[0] !== oldUnrotatedMaxX ||
|
||||
this._unrotatedAABB.max[1] !== oldUnrotatedMaxY
|
||||
) {
|
||||
this._instanceContainer.onObjectUnscaledCenterChanged(
|
||||
(oldUnrotatedMinX + oldUnrotatedMaxX) / 2,
|
||||
(oldUnrotatedMinY + oldUnrotatedMaxY) / 2
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Position:
|
||||
@@ -246,37 +231,52 @@ namespace gdjs {
|
||||
* @param result Array that will be updated with the result
|
||||
* (x and y position of the point in parent coordinates).
|
||||
*/
|
||||
applyObjectTransformation(x: float, y: float, result: number[]) {
|
||||
let cx = this.getCenterX();
|
||||
let cy = this.getCenterY();
|
||||
applyObjectTransformation(x: float, y: float, destination: FloatPoint) {
|
||||
const source = destination;
|
||||
source[0] = x;
|
||||
source[1] = y;
|
||||
this.getLocalTransformation().transform(source, destination);
|
||||
}
|
||||
|
||||
// Flipping
|
||||
if (this._flippedX) {
|
||||
x = x + (cx - x) * 2;
|
||||
}
|
||||
if (this._flippedY) {
|
||||
y = y + (cy - y) * 2;
|
||||
/**
|
||||
* Return the affine transformation that represents
|
||||
* flipping, scale, rotation and translation of the object.
|
||||
* @returns the affine transformation.
|
||||
*/
|
||||
getLocalTransformation(): gdjs.AffineTransformation {
|
||||
if (this._isLocalTransformationDirty) {
|
||||
this._updateLocalTransformation();
|
||||
}
|
||||
return this._localTransformation;
|
||||
}
|
||||
|
||||
// Scale
|
||||
getLocalInverseTransformation(): gdjs.AffineTransformation {
|
||||
if (this._isLocalTransformationDirty) {
|
||||
this._updateLocalTransformation();
|
||||
}
|
||||
return this._localInverseTransformation;
|
||||
}
|
||||
|
||||
_updateLocalTransformation() {
|
||||
const absScaleX = Math.abs(this._scaleX);
|
||||
const absScaleY = Math.abs(this._scaleY);
|
||||
x *= absScaleX;
|
||||
y *= absScaleY;
|
||||
cx *= absScaleX;
|
||||
cy *= absScaleY;
|
||||
const centerX = this.getUnscaledCenterX() * absScaleX;
|
||||
const centerY = this.getUnscaledCenterY() * absScaleY;
|
||||
const angleInRadians = (this.angle * Math.PI) / 180;
|
||||
|
||||
// Rotation
|
||||
const angleInRadians = (this.angle / 180) * Math.PI;
|
||||
const cosValue = Math.cos(angleInRadians);
|
||||
const sinValue = Math.sin(angleInRadians);
|
||||
const xToCenterXDelta = x - cx;
|
||||
const yToCenterYDelta = y - cy;
|
||||
x = cx + cosValue * xToCenterXDelta - sinValue * yToCenterYDelta;
|
||||
y = cy + sinValue * xToCenterXDelta + cosValue * yToCenterYDelta;
|
||||
result.length = 2;
|
||||
result[0] = x + this.x;
|
||||
result[1] = y + this.y;
|
||||
this._localTransformation.setToTranslation(this.x, this.y);
|
||||
this._localTransformation.rotateAround(angleInRadians, centerX, centerY);
|
||||
if (this._flippedX) {
|
||||
this._localTransformation.flipX(centerX);
|
||||
}
|
||||
if (this._flippedY) {
|
||||
this._localTransformation.flipY(centerY);
|
||||
}
|
||||
this._localTransformation.scale(absScaleX, absScaleY);
|
||||
|
||||
this._localInverseTransformation.copyFrom(this._localTransformation);
|
||||
this._localInverseTransformation.invert();
|
||||
this._isLocalTransformationDirty = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -290,53 +290,51 @@ namespace gdjs {
|
||||
* @param result Array that will be updated with the result
|
||||
* (x and y position of the point in object coordinates).
|
||||
*/
|
||||
applyObjectInverseTransformation(x: float, y: float, result: number[]) {
|
||||
x -= this.getCenterXInScene();
|
||||
y -= this.getCenterYInScene();
|
||||
|
||||
const absScaleX = Math.abs(this._scaleX);
|
||||
const absScaleY = Math.abs(this._scaleY);
|
||||
|
||||
// Rotation
|
||||
const angleInRadians = (this.angle / 180) * Math.PI;
|
||||
const cosValue = Math.cos(-angleInRadians);
|
||||
const sinValue = Math.sin(-angleInRadians);
|
||||
const oldX = x;
|
||||
x = cosValue * x - sinValue * y;
|
||||
y = sinValue * oldX + cosValue * y;
|
||||
|
||||
// Scale
|
||||
x /= absScaleX;
|
||||
y /= absScaleY;
|
||||
|
||||
// Flipping
|
||||
if (this._flippedX) {
|
||||
x = -x;
|
||||
}
|
||||
if (this._flippedY) {
|
||||
y = -y;
|
||||
}
|
||||
|
||||
const positionToCenterX =
|
||||
this.getUnscaledWidth() / 2 + this._unrotatedAABB.min[0];
|
||||
const positionToCenterY =
|
||||
this.getUnscaledHeight() / 2 + this._unrotatedAABB.min[1];
|
||||
result[0] = x + positionToCenterX;
|
||||
result[1] = y + positionToCenterY;
|
||||
applyObjectInverseTransformation(
|
||||
x: float,
|
||||
y: float,
|
||||
destination: FloatPoint
|
||||
) {
|
||||
const source = destination;
|
||||
source[0] = x;
|
||||
source[1] = y;
|
||||
this.getLocalInverseTransformation().transform(source, destination);
|
||||
}
|
||||
|
||||
getDrawableX(): float {
|
||||
if (this._isUntransformedHitBoxesDirty) {
|
||||
this._updateUntransformedHitBoxes();
|
||||
}
|
||||
return this.x + this._unrotatedAABB.min[0] * this._scaleX;
|
||||
const absScaleX = this.getScaleX();
|
||||
if (!this._flippedX) {
|
||||
return this.x + this._unrotatedAABB.min[0] * absScaleX;
|
||||
} else {
|
||||
return (
|
||||
this.x +
|
||||
(-this._unrotatedAABB.min[0] -
|
||||
this.getUnscaledWidth() +
|
||||
2 * this.getUnscaledCenterX()) *
|
||||
absScaleX
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
getDrawableY(): float {
|
||||
if (this._isUntransformedHitBoxesDirty) {
|
||||
this._updateUntransformedHitBoxes();
|
||||
}
|
||||
return this.y + this._unrotatedAABB.min[1] * this._scaleY;
|
||||
const absScaleY = this.getScaleY();
|
||||
if (!this._flippedY) {
|
||||
return this.y + this._unrotatedAABB.min[1] * absScaleY;
|
||||
} else {
|
||||
return (
|
||||
this.y +
|
||||
(-this._unrotatedAABB.min[1] -
|
||||
this.getUnscaledHeight() +
|
||||
2 * this.getUnscaledCenterY()) *
|
||||
absScaleY
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -363,6 +361,9 @@ namespace gdjs {
|
||||
* @returns the center X from the local origin (0;0).
|
||||
*/
|
||||
getUnscaledCenterX(): float {
|
||||
if (this._customCenter) {
|
||||
return this._customCenter[0];
|
||||
}
|
||||
if (this._isUntransformedHitBoxesDirty) {
|
||||
this._updateUntransformedHitBoxes();
|
||||
}
|
||||
@@ -373,12 +374,57 @@ namespace gdjs {
|
||||
* @returns the center Y from the local origin (0;0).
|
||||
*/
|
||||
getUnscaledCenterY(): float {
|
||||
if (this._customCenter) {
|
||||
return this._customCenter[1];
|
||||
}
|
||||
if (this._isUntransformedHitBoxesDirty) {
|
||||
this._updateUntransformedHitBoxes();
|
||||
}
|
||||
return (this._unrotatedAABB.min[1] + this._unrotatedAABB.max[1]) / 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* The center of rotation is defined relatively to the origin (the object
|
||||
* position).
|
||||
* This avoids the center to move when children push the bounds.
|
||||
*
|
||||
* When no custom center is defined, it will move
|
||||
* to stay at the center of the children bounds.
|
||||
*
|
||||
* @param x coordinate of the custom center
|
||||
* @param y coordinate of the custom center
|
||||
*/
|
||||
setRotationCenter(x: float, y: float) {
|
||||
if (!this._customCenter) {
|
||||
this._customCenter = [0, 0];
|
||||
}
|
||||
this._customCenter[0] = x;
|
||||
this._customCenter[1] = y;
|
||||
|
||||
this._isLocalTransformationDirty = true;
|
||||
this.invalidateHitboxes();
|
||||
}
|
||||
|
||||
getCenterX(): float {
|
||||
if (this._isUntransformedHitBoxesDirty) {
|
||||
this._updateUntransformedHitBoxes();
|
||||
}
|
||||
return (
|
||||
(this.getUnscaledCenterX() - this._unrotatedAABB.min[0]) *
|
||||
this.getScaleX()
|
||||
);
|
||||
}
|
||||
|
||||
getCenterY(): float {
|
||||
if (this._isUntransformedHitBoxesDirty) {
|
||||
this._updateUntransformedHitBoxes();
|
||||
}
|
||||
return (
|
||||
(this.getUnscaledCenterY() - this._unrotatedAABB.min[1]) *
|
||||
this.getScaleY()
|
||||
);
|
||||
}
|
||||
|
||||
getWidth(): float {
|
||||
return this.getUnscaledWidth() * this.getScaleX();
|
||||
}
|
||||
@@ -417,6 +463,7 @@ namespace gdjs {
|
||||
return;
|
||||
}
|
||||
this.x = x;
|
||||
this._isLocalTransformationDirty = true;
|
||||
this.invalidateHitboxes();
|
||||
this.getRenderer().updateX();
|
||||
}
|
||||
@@ -426,6 +473,7 @@ namespace gdjs {
|
||||
return;
|
||||
}
|
||||
this.y = y;
|
||||
this._isLocalTransformationDirty = true;
|
||||
this.invalidateHitboxes();
|
||||
this.getRenderer().updateY();
|
||||
}
|
||||
@@ -435,6 +483,7 @@ namespace gdjs {
|
||||
return;
|
||||
}
|
||||
this.angle = angle;
|
||||
this._isLocalTransformationDirty = true;
|
||||
this.invalidateHitboxes();
|
||||
this.getRenderer().updateAngle();
|
||||
}
|
||||
@@ -456,6 +505,7 @@ namespace gdjs {
|
||||
}
|
||||
this._scaleX = newScale * (this._flippedX ? -1 : 1);
|
||||
this._scaleY = newScale * (this._flippedY ? -1 : 1);
|
||||
this._isLocalTransformationDirty = true;
|
||||
this.invalidateHitboxes();
|
||||
this.getRenderer().update();
|
||||
}
|
||||
@@ -473,6 +523,7 @@ namespace gdjs {
|
||||
return;
|
||||
}
|
||||
this._scaleX = newScale * (this._flippedX ? -1 : 1);
|
||||
this._isLocalTransformationDirty = true;
|
||||
this.invalidateHitboxes();
|
||||
this.getRenderer().update();
|
||||
}
|
||||
|
@@ -43,6 +43,13 @@ namespace gdjs {
|
||||
this._debuggerRenderer = new gdjs.DebuggerRenderer(this);
|
||||
}
|
||||
|
||||
addLayer(layerData: LayerData) {
|
||||
this._layers.put(
|
||||
layerData.name,
|
||||
new gdjs.RuntimeCustomObjectLayer(layerData, this)
|
||||
);
|
||||
}
|
||||
|
||||
createObject(objectName: string): gdjs.RuntimeObject | null {
|
||||
const result = super.createObject(objectName);
|
||||
this._customObject.onChildrenLocationChanged();
|
||||
@@ -293,21 +300,6 @@ namespace gdjs {
|
||||
this._customObject.onChildrenLocationChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Triggered when the object dimensions are changed.
|
||||
*
|
||||
* It adapts the layers camera positions.
|
||||
*/
|
||||
onObjectUnscaledCenterChanged(oldOriginX: float, oldOriginY: float): void {
|
||||
for (const name in this._layers.items) {
|
||||
if (this._layers.items.hasOwnProperty(name)) {
|
||||
/** @type gdjs.Layer */
|
||||
const theLayer: gdjs.Layer = this._layers.items[name];
|
||||
theLayer.onGameResolutionResized(oldOriginX, oldOriginY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
convertCoords(x: float, y: float, result: FloatPoint): FloatPoint {
|
||||
// The result parameter used to be optional.
|
||||
let position = result || [0, 0];
|
||||
|
104
GDJS/Runtime/RuntimeCustomObjectLayer.ts
Normal file
104
GDJS/Runtime/RuntimeCustomObjectLayer.ts
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* GDevelop JS Platform
|
||||
* Copyright 2013-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
*/
|
||||
namespace gdjs {
|
||||
/**
|
||||
* Represents a layer of a custom object. It doesn't allow to move any camera
|
||||
* because it doesn't make sense inside an object.
|
||||
*/
|
||||
export class RuntimeCustomObjectLayer extends gdjs.RuntimeLayer {
|
||||
/**
|
||||
* @param layerData The data used to initialize the layer
|
||||
* @param instanceContainer The container in which the layer is used
|
||||
*/
|
||||
constructor(
|
||||
layerData: LayerData,
|
||||
instanceContainer: gdjs.RuntimeInstanceContainer
|
||||
) {
|
||||
super(layerData, instanceContainer);
|
||||
}
|
||||
|
||||
onGameResolutionResized(
|
||||
oldGameResolutionOriginX: float,
|
||||
oldGameResolutionOriginY: float
|
||||
): void {}
|
||||
|
||||
getCameraX(cameraId?: integer): float {
|
||||
return 0;
|
||||
}
|
||||
|
||||
getCameraY(cameraId?: integer): float {
|
||||
return 0;
|
||||
}
|
||||
|
||||
setCameraX(x: float, cameraId?: integer): void {}
|
||||
|
||||
setCameraY(y: float, cameraId?: integer): void {}
|
||||
|
||||
getCameraWidth(cameraId?: integer): float {
|
||||
return 0;
|
||||
}
|
||||
|
||||
getCameraHeight(cameraId?: integer): float {
|
||||
return 0;
|
||||
}
|
||||
|
||||
setCameraZoom(newZoom: float, cameraId?: integer): void {}
|
||||
|
||||
getCameraZoom(cameraId?: integer): float {
|
||||
return 0;
|
||||
}
|
||||
|
||||
getCameraRotation(cameraId?: integer): float {
|
||||
return 0;
|
||||
}
|
||||
|
||||
setCameraRotation(rotation: float, cameraId?: integer): void {}
|
||||
|
||||
convertCoords(
|
||||
x: float,
|
||||
y: float,
|
||||
cameraId: integer,
|
||||
result: FloatPoint
|
||||
): FloatPoint {
|
||||
// TODO EBO use an AffineTransformation to avoid chained calls.
|
||||
// The result parameter used to be optional.
|
||||
return this._runtimeScene.convertCoords(x, y, result || [0, 0]);
|
||||
}
|
||||
|
||||
convertInverseCoords(
|
||||
x: float,
|
||||
y: float,
|
||||
cameraId: integer,
|
||||
result: FloatPoint
|
||||
): FloatPoint {
|
||||
// TODO EBO use an AffineTransformation to avoid chained calls.
|
||||
// The result parameter used to be optional.
|
||||
return this._runtimeScene.convertInverseCoords(x, y, result || [0, 0]);
|
||||
}
|
||||
|
||||
applyLayerInverseTransformation(
|
||||
x: float,
|
||||
y: float,
|
||||
cameraId: integer,
|
||||
result: FloatPoint
|
||||
): FloatPoint {
|
||||
result[0] = x;
|
||||
result[1] = y;
|
||||
return result;
|
||||
}
|
||||
|
||||
applyLayerTransformation(
|
||||
x: float,
|
||||
y: float,
|
||||
cameraId: integer,
|
||||
result: FloatPoint
|
||||
): FloatPoint {
|
||||
result[0] = x;
|
||||
result[1] = y;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
@@ -32,7 +32,7 @@ namespace gdjs {
|
||||
_objects: Hashtable<ObjectData>;
|
||||
_objectsCtor: Hashtable<typeof RuntimeObject>;
|
||||
|
||||
_layers: Hashtable<Layer>;
|
||||
_layers: Hashtable<RuntimeLayer>;
|
||||
_layersCameraCoordinates: Record<string, [float, float, float, float]> = {};
|
||||
|
||||
// Options for the debug draw:
|
||||
@@ -601,7 +601,7 @@ namespace gdjs {
|
||||
* @param name The name of the layer
|
||||
* @returns The layer, or the base layer if not found
|
||||
*/
|
||||
getLayer(name: string): gdjs.Layer {
|
||||
getLayer(name: string): gdjs.RuntimeLayer {
|
||||
if (this._layers.containsKey(name)) {
|
||||
return this._layers.get(name);
|
||||
}
|
||||
@@ -620,9 +620,7 @@ namespace gdjs {
|
||||
* Add a layer.
|
||||
* @param layerData The data to construct the layer
|
||||
*/
|
||||
addLayer(layerData: LayerData) {
|
||||
this._layers.put(layerData.name, new gdjs.Layer(layerData, this));
|
||||
}
|
||||
abstract addLayer(layerData: LayerData);
|
||||
|
||||
/**
|
||||
* Remove a layer. All {@link gdjs.RuntimeObject} on this layer will
|
||||
@@ -647,7 +645,7 @@ namespace gdjs {
|
||||
* @param index The new position in the list of layers
|
||||
*/
|
||||
setLayerIndex(layerName: string, index: integer): void {
|
||||
const layer: gdjs.Layer = this._layers.get(layerName);
|
||||
const layer: gdjs.RuntimeLayer = this._layers.get(layerName);
|
||||
if (!layer) {
|
||||
return;
|
||||
}
|
||||
|
490
GDJS/Runtime/RuntimeLayer.ts
Normal file
490
GDJS/Runtime/RuntimeLayer.ts
Normal file
@@ -0,0 +1,490 @@
|
||||
/*
|
||||
* GDevelop JS Platform
|
||||
* Copyright 2013-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
*/
|
||||
namespace gdjs {
|
||||
/**
|
||||
* Represents a layer of a container, used to display objects.
|
||||
*
|
||||
* Viewports and multiple cameras are not supported.
|
||||
*/
|
||||
export abstract class RuntimeLayer implements EffectsTarget {
|
||||
_name: string;
|
||||
_timeScale: float = 1;
|
||||
_defaultZOrder: integer = 0;
|
||||
_hidden: boolean;
|
||||
_initialEffectsData: Array<EffectData>;
|
||||
|
||||
_runtimeScene: gdjs.RuntimeInstanceContainer;
|
||||
_effectsManager: gdjs.EffectsManager;
|
||||
|
||||
// Lighting layer properties.
|
||||
_isLightingLayer: boolean;
|
||||
_followBaseLayerCamera: boolean;
|
||||
_clearColor: Array<integer>;
|
||||
|
||||
_rendererEffects: Record<string, PixiFiltersTools.Filter> = {};
|
||||
_renderer: gdjs.LayerRenderer;
|
||||
|
||||
/**
|
||||
* @param layerData The data used to initialize the layer
|
||||
* @param instanceContainer The container in which the layer is used
|
||||
*/
|
||||
constructor(
|
||||
layerData: LayerData,
|
||||
instanceContainer: gdjs.RuntimeInstanceContainer
|
||||
) {
|
||||
this._name = layerData.name;
|
||||
this._hidden = !layerData.visibility;
|
||||
this._initialEffectsData = layerData.effects || [];
|
||||
this._runtimeScene = instanceContainer;
|
||||
this._effectsManager = instanceContainer.getGame().getEffectsManager();
|
||||
this._isLightingLayer = layerData.isLightingLayer;
|
||||
this._followBaseLayerCamera = layerData.followBaseLayerCamera;
|
||||
this._clearColor = [
|
||||
layerData.ambientLightColorR / 255,
|
||||
layerData.ambientLightColorG / 255,
|
||||
layerData.ambientLightColorB / 255,
|
||||
1.0,
|
||||
];
|
||||
this._renderer = new gdjs.LayerRenderer(
|
||||
this,
|
||||
instanceContainer.getRenderer(),
|
||||
instanceContainer.getGame().getRenderer().getPIXIRenderer()
|
||||
);
|
||||
this.show(!this._hidden);
|
||||
for (let i = 0; i < layerData.effects.length; ++i) {
|
||||
this.addEffect(layerData.effects[i]);
|
||||
}
|
||||
}
|
||||
|
||||
getRenderer(): gdjs.LayerRenderer {
|
||||
return this._renderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default Z order to be attributed to objects created on this layer
|
||||
* (usually from events generated code).
|
||||
*/
|
||||
getDefaultZOrder(): float {
|
||||
return this._defaultZOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default Z order to be attributed to objects created on this layer.
|
||||
* @param defaultZOrder The Z order to use when creating a new object from events.
|
||||
*/
|
||||
setDefaultZOrder(defaultZOrder: integer): void {
|
||||
this._defaultZOrder = defaultZOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by the RuntimeScene whenever the game resolution size is changed.
|
||||
* Updates the layer width/height and position.
|
||||
*/
|
||||
abstract onGameResolutionResized(
|
||||
oldGameResolutionOriginX: float,
|
||||
oldGameResolutionOriginY: float
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Returns the scene the layer belongs to directly or indirectly
|
||||
* @returns the scene the layer belongs to directly or indirectly
|
||||
*/
|
||||
getRuntimeScene(): gdjs.RuntimeScene {
|
||||
return this._runtimeScene.getScene();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called at each frame, after events are run and before rendering.
|
||||
*/
|
||||
updatePreRender(instanceContainer?: gdjs.RuntimeInstanceContainer): void {
|
||||
if (this._followBaseLayerCamera) {
|
||||
this.followBaseLayer();
|
||||
}
|
||||
this._renderer.updatePreRender();
|
||||
this._effectsManager.updatePreRender(this._rendererEffects, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the layer
|
||||
* @return The name of the layer
|
||||
*/
|
||||
getName(): string {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the camera center X position.
|
||||
*
|
||||
* @param cameraId The camera number. Currently ignored.
|
||||
* @return The x position of the camera
|
||||
*/
|
||||
abstract getCameraX(cameraId?: integer): float;
|
||||
|
||||
/**
|
||||
* Change the camera center Y position.
|
||||
*
|
||||
* @param cameraId The camera number. Currently ignored.
|
||||
* @return The y position of the camera
|
||||
*/
|
||||
abstract getCameraY(cameraId?: integer): float;
|
||||
|
||||
/**
|
||||
* Set the camera center X position.
|
||||
*
|
||||
* @param x The new x position
|
||||
* @param cameraId The camera number. Currently ignored.
|
||||
*/
|
||||
abstract setCameraX(x: float, cameraId?: integer): void;
|
||||
|
||||
/**
|
||||
* Set the camera center Y position.
|
||||
*
|
||||
* @param y The new y position
|
||||
* @param cameraId The camera number. Currently ignored.
|
||||
*/
|
||||
abstract setCameraY(y: float, cameraId?: integer): void;
|
||||
|
||||
/**
|
||||
* Get the camera width (which can be different than the game resolution width
|
||||
* if the camera is zoomed).
|
||||
*
|
||||
* @param cameraId The camera number. Currently ignored.
|
||||
* @return The width of the camera
|
||||
*/
|
||||
abstract getCameraWidth(cameraId?: integer): float;
|
||||
|
||||
/**
|
||||
* Get the camera height (which can be different than the game resolution height
|
||||
* if the camera is zoomed).
|
||||
*
|
||||
* @param cameraId The camera number. Currently ignored.
|
||||
* @return The height of the camera
|
||||
*/
|
||||
abstract getCameraHeight(cameraId?: integer): float;
|
||||
|
||||
/**
|
||||
* Show (or hide) the layer.
|
||||
* @param enable true to show the layer, false to hide it.
|
||||
*/
|
||||
show(enable: boolean): void {
|
||||
this._hidden = !enable;
|
||||
this._renderer.updateVisibility(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the layer is visible.
|
||||
*
|
||||
* @return true if the layer is visible.
|
||||
*/
|
||||
isVisible(): boolean {
|
||||
return !this._hidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the zoom of a camera.
|
||||
*
|
||||
* @param newZoom The new zoom. Must be superior to 0. 1 is the default zoom.
|
||||
* @param cameraId The camera number. Currently ignored.
|
||||
*/
|
||||
abstract setCameraZoom(newZoom: float, cameraId?: integer): void;
|
||||
|
||||
/**
|
||||
* Get the zoom of a camera.
|
||||
*
|
||||
* @param cameraId The camera number. Currently ignored.
|
||||
* @return The zoom.
|
||||
*/
|
||||
abstract getCameraZoom(cameraId?: integer): float;
|
||||
|
||||
/**
|
||||
* Get the rotation of the camera, expressed in degrees.
|
||||
*
|
||||
* @param cameraId The camera number. Currently ignored.
|
||||
* @return The rotation, in degrees.
|
||||
*/
|
||||
abstract getCameraRotation(cameraId?: integer): float;
|
||||
|
||||
/**
|
||||
* Set the rotation of the camera, expressed in degrees.
|
||||
* The rotation is made around the camera center.
|
||||
*
|
||||
* @param rotation The new rotation, in degrees.
|
||||
* @param cameraId The camera number. Currently ignored.
|
||||
*/
|
||||
abstract setCameraRotation(rotation: float, cameraId?: integer): void;
|
||||
|
||||
/**
|
||||
* Convert a point from the canvas coordinates (for example,
|
||||
* the mouse position) to the container coordinates.
|
||||
*
|
||||
* @param x The x position, in canvas coordinates.
|
||||
* @param y The y position, in canvas coordinates.
|
||||
* @param cameraId The camera number. Currently ignored.
|
||||
* @param result The point instance that is used to return the result.
|
||||
*/
|
||||
abstract convertCoords(
|
||||
x: float,
|
||||
y: float,
|
||||
cameraId: integer,
|
||||
result: FloatPoint
|
||||
): FloatPoint;
|
||||
|
||||
/**
|
||||
* Return an array containing the coordinates of the point passed as parameter
|
||||
* in parent coordinate coordinates (as opposed to the layer local coordinates).
|
||||
*
|
||||
* All transformations (scale, rotation) are supported.
|
||||
*
|
||||
* @param x The X position of the point, in layer coordinates.
|
||||
* @param y The Y position of the point, in layer coordinates.
|
||||
* @param result Array that will be updated with the result
|
||||
* (x and y position of the point in parent coordinates).
|
||||
*/
|
||||
abstract applyLayerTransformation(
|
||||
x: float,
|
||||
y: float,
|
||||
cameraId: integer,
|
||||
result: FloatPoint
|
||||
): FloatPoint;
|
||||
|
||||
/**
|
||||
* Convert a point from the container coordinates (for example,
|
||||
* an object position) to the canvas coordinates.
|
||||
*
|
||||
* @param x The x position, in container coordinates.
|
||||
* @param y The y position, in container coordinates.
|
||||
* @param cameraId The camera number. Currently ignored.
|
||||
* @param result The point instance that is used to return the result.
|
||||
*/
|
||||
abstract convertInverseCoords(
|
||||
x: float,
|
||||
y: float,
|
||||
cameraId: integer,
|
||||
result: FloatPoint
|
||||
): FloatPoint;
|
||||
|
||||
/**
|
||||
* Return an array containing the coordinates of the point passed as parameter
|
||||
* in layer local coordinates (as opposed to the parent coordinates).
|
||||
*
|
||||
* All transformations (scale, rotation) are supported.
|
||||
*
|
||||
* @param x The X position of the point, in parent coordinates.
|
||||
* @param y The Y position of the point, in parent coordinates.
|
||||
* @param result Array that will be updated with the result
|
||||
* @param result The point instance that is used to return the result.
|
||||
* (x and y position of the point in layer coordinates).
|
||||
*/
|
||||
abstract applyLayerInverseTransformation(
|
||||
x: float,
|
||||
y: float,
|
||||
cameraId: integer,
|
||||
result: FloatPoint
|
||||
): FloatPoint;
|
||||
|
||||
getWidth(): float {
|
||||
return this._runtimeScene.getViewportWidth();
|
||||
}
|
||||
|
||||
getHeight(): float {
|
||||
return this._runtimeScene.getViewportHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the initial effects data for the layer. Only to
|
||||
* be used by renderers.
|
||||
* @deprecated
|
||||
*/
|
||||
getInitialEffectsData(): EffectData[] {
|
||||
return this._initialEffectsData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new effect, or replace the one with the same name.
|
||||
* @param effectData The data of the effect to add.
|
||||
*/
|
||||
addEffect(effectData: EffectData): void {
|
||||
this._effectsManager.addEffect(
|
||||
effectData,
|
||||
this._rendererEffects,
|
||||
this._renderer.getRendererObject(),
|
||||
this
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the effect with the specified name
|
||||
* @param effectName The name of the effect.
|
||||
*/
|
||||
removeEffect(effectName: string): void {
|
||||
this._effectsManager.removeEffect(
|
||||
this._rendererEffects,
|
||||
this._renderer.getRendererObject(),
|
||||
effectName
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change an effect parameter value (for parameters that are numbers).
|
||||
* @param name The name of the effect to update.
|
||||
* @param parameterName The name of the parameter to update.
|
||||
* @param value The new value (number).
|
||||
*/
|
||||
setEffectDoubleParameter(
|
||||
name: string,
|
||||
parameterName: string,
|
||||
value: float
|
||||
): void {
|
||||
this._effectsManager.setEffectDoubleParameter(
|
||||
this._rendererEffects,
|
||||
name,
|
||||
parameterName,
|
||||
value
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change an effect parameter value (for parameters that are strings).
|
||||
* @param name The name of the effect to update.
|
||||
* @param parameterName The name of the parameter to update.
|
||||
* @param value The new value (string).
|
||||
*/
|
||||
setEffectStringParameter(
|
||||
name: string,
|
||||
parameterName: string,
|
||||
value: string
|
||||
): void {
|
||||
this._effectsManager.setEffectStringParameter(
|
||||
this._rendererEffects,
|
||||
name,
|
||||
parameterName,
|
||||
value
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change an effect parameter value (for parameters that are booleans).
|
||||
* @param name The name of the effect to update.
|
||||
* @param parameterName The name of the parameter to update.
|
||||
* @param value The new value (boolean).
|
||||
*/
|
||||
setEffectBooleanParameter(
|
||||
name: string,
|
||||
parameterName: string,
|
||||
value: boolean
|
||||
): void {
|
||||
this._effectsManager.setEffectBooleanParameter(
|
||||
this._rendererEffects,
|
||||
name,
|
||||
parameterName,
|
||||
value
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable an effect.
|
||||
* @param name The name of the effect to enable or disable.
|
||||
* @param enable true to enable, false to disable
|
||||
*/
|
||||
enableEffect(name: string, enable: boolean): void {
|
||||
this._effectsManager.enableEffect(this._rendererEffects, name, enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an effect is enabled
|
||||
* @param name The name of the effect
|
||||
* @return true if the effect is enabled, false otherwise.
|
||||
*/
|
||||
isEffectEnabled(name: string): boolean {
|
||||
return this._effectsManager.isEffectEnabled(this._rendererEffects, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if an effect exists on this layer
|
||||
* @param name The name of the effect
|
||||
* @return true if the effect exists, false otherwise.
|
||||
*/
|
||||
hasEffect(name: string): boolean {
|
||||
return this._effectsManager.hasEffect(this._rendererEffects, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the time scale for the objects on the layer:
|
||||
* time will be slower if time scale is < 1, faster if > 1.
|
||||
* @param timeScale The new time scale (must be positive).
|
||||
*/
|
||||
setTimeScale(timeScale: float): void {
|
||||
if (timeScale >= 0) {
|
||||
this._timeScale = timeScale;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the time scale for the objects on the layer.
|
||||
*/
|
||||
getTimeScale(): float {
|
||||
return this._timeScale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the time elapsed since the last frame,
|
||||
* in milliseconds, for objects on the layer.
|
||||
*
|
||||
* @param instanceContainer The instance container the layer belongs to (deprecated - can be omitted).
|
||||
*/
|
||||
getElapsedTime(instanceContainer?: gdjs.RuntimeInstanceContainer): float {
|
||||
const container = instanceContainer || this._runtimeScene;
|
||||
return container.getElapsedTime() * this._timeScale;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the position, rotation and scale (zoom) of the layer camera to be the same as the base layer camera.
|
||||
*/
|
||||
followBaseLayer(): void {
|
||||
const baseLayer = this._runtimeScene.getLayer('');
|
||||
this.setCameraX(baseLayer.getCameraX());
|
||||
this.setCameraY(baseLayer.getCameraY());
|
||||
this.setCameraRotation(baseLayer.getCameraRotation());
|
||||
this.setCameraZoom(baseLayer.getCameraZoom());
|
||||
}
|
||||
|
||||
/**
|
||||
* The clear color is defined in the format [r, g, b], with components in the range of 0 to 1.
|
||||
* @return the clear color of layer in the range of [0, 1].
|
||||
*/
|
||||
getClearColor(): Array<integer> {
|
||||
return this._clearColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the clear color in format [r, g, b], with components in the range of 0 to 1.;
|
||||
* @param r Red color component in the range 0-255.
|
||||
* @param g Green color component in the range 0-255.
|
||||
* @param b Blue color component in the range 0-255.
|
||||
*/
|
||||
setClearColor(r: integer, g: integer, b: integer): void {
|
||||
this._clearColor[0] = r / 255;
|
||||
this._clearColor[1] = g / 255;
|
||||
this._clearColor[2] = b / 255;
|
||||
this._renderer.updateClearColor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether layer's camera follows base layer's camera or not.
|
||||
*/
|
||||
setFollowBaseLayerCamera(follow: boolean): void {
|
||||
this._followBaseLayerCamera = follow;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the layer is a lighting layer, false otherwise.
|
||||
* @return true if it is a lighting layer, false otherwise.
|
||||
*/
|
||||
isLightingLayer(): boolean {
|
||||
return this._isLightingLayer;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,74 +0,0 @@
|
||||
/*
|
||||
* GDevelop JS Platform
|
||||
* Copyright 2013-2016 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
*/
|
||||
namespace gdjs {
|
||||
/**
|
||||
* Represents a layer of a scene, used to display objects.
|
||||
*
|
||||
* Viewports and multiple cameras are not supported.
|
||||
*
|
||||
* It does some optimizations but works exactly the same as
|
||||
* {@link gdjs.Layer}.
|
||||
*/
|
||||
export class RuntimeSceneLayer extends gdjs.Layer {
|
||||
/**
|
||||
* @param layerData The data used to initialize the layer
|
||||
* @param scene The scene in which the layer is used
|
||||
*/
|
||||
constructor(layerData: LayerData, scene: gdjs.RuntimeScene) {
|
||||
super(layerData, scene);
|
||||
}
|
||||
|
||||
convertCoords(
|
||||
x: float,
|
||||
y: float,
|
||||
cameraId: integer = 0,
|
||||
result: FloatPoint
|
||||
): FloatPoint {
|
||||
// The result parameter used to be optional.
|
||||
let position = result || [0, 0];
|
||||
x -= this.getRuntimeScene()._cachedGameResolutionWidth / 2;
|
||||
y -= this.getRuntimeScene()._cachedGameResolutionHeight / 2;
|
||||
x /= Math.abs(this._zoomFactor);
|
||||
y /= Math.abs(this._zoomFactor);
|
||||
|
||||
// Only compute angle and cos/sin once (allow heavy optimization from JS engines).
|
||||
const angleInRadians = (this._cameraRotation / 180) * Math.PI;
|
||||
const tmp = x;
|
||||
const cosValue = Math.cos(angleInRadians);
|
||||
const sinValue = Math.sin(angleInRadians);
|
||||
x = cosValue * x - sinValue * y;
|
||||
y = sinValue * tmp + cosValue * y;
|
||||
position[0] = x + this.getCameraX(cameraId);
|
||||
position[1] = y + this.getCameraY(cameraId);
|
||||
return position;
|
||||
}
|
||||
|
||||
convertInverseCoords(
|
||||
x: float,
|
||||
y: float,
|
||||
cameraId: integer = 0,
|
||||
result: FloatPoint
|
||||
): FloatPoint {
|
||||
// The result parameter used to be optional.
|
||||
let position = result || [0, 0];
|
||||
x -= this.getCameraX(cameraId);
|
||||
y -= this.getCameraY(cameraId);
|
||||
|
||||
// Only compute angle and cos/sin once (allow heavy optimization from JS engines).
|
||||
const angleInRadians = (this._cameraRotation / 180) * Math.PI;
|
||||
const tmp = x;
|
||||
const cosValue = Math.cos(-angleInRadians);
|
||||
const sinValue = Math.sin(-angleInRadians);
|
||||
x = cosValue * x - sinValue * y;
|
||||
y = sinValue * tmp + cosValue * y;
|
||||
x *= Math.abs(this._zoomFactor);
|
||||
y *= Math.abs(this._zoomFactor);
|
||||
position[0] = x + this.getRuntimeScene()._cachedGameResolutionWidth / 2;
|
||||
position[1] = y + this.getRuntimeScene()._cachedGameResolutionHeight / 2;
|
||||
return position;
|
||||
}
|
||||
}
|
||||
}
|
@@ -339,6 +339,7 @@ namespace gdjs {
|
||||
// Avoid circular reference from behavior to parent runtimeObject
|
||||
// Exclude rendering related objects:
|
||||
'_renderer',
|
||||
'_gameRenderer',
|
||||
'_imageManager',
|
||||
// Exclude PIXI textures:
|
||||
'baseTexture',
|
||||
|
@@ -1037,7 +1037,7 @@ namespace gdjs {
|
||||
_hotReloadRuntimeLayer(
|
||||
oldLayer: LayerData,
|
||||
newLayer: LayerData,
|
||||
runtimeLayer: gdjs.Layer
|
||||
runtimeLayer: gdjs.RuntimeLayer
|
||||
): void {
|
||||
// Properties
|
||||
if (oldLayer.visibility !== newLayer.visibility) {
|
||||
@@ -1073,7 +1073,7 @@ namespace gdjs {
|
||||
_hotReloadRuntimeLayerEffects(
|
||||
oldEffectsData: EffectData[],
|
||||
newEffectsData: EffectData[],
|
||||
runtimeLayer: gdjs.Layer
|
||||
runtimeLayer: gdjs.RuntimeLayer
|
||||
): void {
|
||||
oldEffectsData.forEach((oldEffectData) => {
|
||||
const name = oldEffectData.name;
|
||||
@@ -1115,7 +1115,7 @@ namespace gdjs {
|
||||
_hotReloadRuntimeLayerEffect(
|
||||
oldEffectData: EffectData,
|
||||
newEffectData: EffectData,
|
||||
runtimeLayer: gdjs.Layer,
|
||||
runtimeLayer: gdjs.RuntimeLayer,
|
||||
effectName: string
|
||||
): void {
|
||||
// We consider oldEffectData.effectType and newEffectData.effectType
|
||||
|
@@ -385,6 +385,17 @@ namespace gdjs {
|
||||
angle1 + gdjs.evtTools.common.angleDifference(angle2, angle1) * x
|
||||
);
|
||||
};
|
||||
|
||||
export const resolveAsyncEventsFunction = (
|
||||
eventsFunctionContext: EventsFunctionContext
|
||||
) => {
|
||||
if (
|
||||
!!eventsFunctionContext &&
|
||||
!!eventsFunctionContext.task &&
|
||||
!!eventsFunctionContext.task.resolve
|
||||
)
|
||||
eventsFunctionContext.task.resolve();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -170,6 +170,54 @@ namespace gdjs {
|
||||
): number {
|
||||
return variable.getChildrenCount();
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut to get the first value of an array variable as a number.
|
||||
*/
|
||||
export const getFirstVariableNumber = function (
|
||||
array: gdjs.Variable
|
||||
): number {
|
||||
if (array.getChildrenCount() === 0) {
|
||||
return 0;
|
||||
}
|
||||
return array.getAllChildrenArray()[0].getAsNumber();
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut to get the last value of an array variable as a string.
|
||||
*/
|
||||
export const getFirstVariableString = function (
|
||||
array: gdjs.Variable
|
||||
): string {
|
||||
if (array.getChildrenCount() === 0) {
|
||||
return '';
|
||||
}
|
||||
return array.getAllChildrenArray()[0].getAsString();
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut to get the last value of an array variable as a number.
|
||||
*/
|
||||
export const getLastVariableNumber = function (
|
||||
array: gdjs.Variable
|
||||
): number {
|
||||
const children = array.getAllChildrenArray();
|
||||
return children.length === 0
|
||||
? 0
|
||||
: children[children.length - 1].getAsNumber();
|
||||
};
|
||||
|
||||
/**
|
||||
* Shortcut to get the last value of an array variable as a string.
|
||||
*/
|
||||
export const getLastVariableString = function (
|
||||
array: gdjs.Variable
|
||||
): string {
|
||||
const children = array.getAllChildrenArray();
|
||||
return children.length === 0
|
||||
? ''
|
||||
: children[children.length - 1].getAsString();
|
||||
};
|
||||
}
|
||||
|
||||
export namespace common {
|
||||
|
@@ -6,40 +6,30 @@
|
||||
namespace gdjs {
|
||||
const logger = new gdjs.Logger('Font manager');
|
||||
|
||||
const checkIfCredentialsRequired = (url: string) => {
|
||||
// Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
|
||||
// i.e: its gdevelop.io cookie, to be passed.
|
||||
// Note that this is only useful during previews.
|
||||
if (
|
||||
url.startsWith('https://project-resources.gdevelop.io/') ||
|
||||
url.startsWith('https://project-resources-dev.gdevelop.io/')
|
||||
)
|
||||
return true;
|
||||
|
||||
// For other resources, use the default way of loading resources ("anonymous" or "same-site").
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* FontFaceObserverFontManager loads fonts (using `FontFace` or `fontfaceobserver` library)
|
||||
* from the game resources (see `loadFonts`), and allow to access to
|
||||
* the font families of the loaded fonts during the game (see `getFontFamily`).
|
||||
*/
|
||||
export class FontFaceObserverFontManager {
|
||||
_resources: any;
|
||||
_resourcesLoader: RuntimeGameResourcesLoader;
|
||||
_resources: ResourceData[];
|
||||
// Associate font resource names to the loaded font family
|
||||
_loadedFontFamily: { [key: string]: string } = {};
|
||||
// Associate font resource names to the resources, for faster access
|
||||
_loadedFonts: { [key: string]: ResourceData } = {};
|
||||
_filenameToFontFamily: { [key: string]: string } = {};
|
||||
|
||||
/**
|
||||
* @param resources The resources data of the game.
|
||||
* @param resourcesLoader The resources loader of the game.
|
||||
*/
|
||||
constructor(resources: ResourceData[]) {
|
||||
constructor(
|
||||
resources: ResourceData[],
|
||||
resourcesLoader: RuntimeGameResourcesLoader
|
||||
) {
|
||||
this._resources = resources;
|
||||
|
||||
// Associate font resource names to the loaded font family
|
||||
|
||||
// Associate font resource names to the resources, for faster access
|
||||
this._resourcesLoader = resourcesLoader;
|
||||
}
|
||||
|
||||
// Cache the result of transforming a filename to a font family - useful to avoid duplicates.
|
||||
@@ -128,15 +118,15 @@ namespace gdjs {
|
||||
* @param fontFamily The font
|
||||
* @returns The font family to be used for this font resource.
|
||||
*/
|
||||
static _loadFont(fontFamily: string, src): Promise<void> {
|
||||
private _loadFont(fontFamily: string, src): Promise<void> {
|
||||
const descriptors = {};
|
||||
const srcWithUrl = 'url(' + encodeURI(src) + ')';
|
||||
|
||||
// @ts-ignore
|
||||
if (typeof FontFace !== 'undefined') {
|
||||
// Load the given font using CSS Font Loading API.
|
||||
return fetch(src, {
|
||||
credentials: checkIfCredentialsRequired(src)
|
||||
return fetch(this._resourcesLoader.getFullUrl(src), {
|
||||
credentials: this._resourcesLoader.checkIfCredentialsRequired(src)
|
||||
? // Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
|
||||
// i.e: its gdevelop.io cookie, to be passed.
|
||||
'include'
|
||||
@@ -215,32 +205,34 @@ namespace gdjs {
|
||||
const totalCount = Object.keys(filesResources).length;
|
||||
if (totalCount === 0) {
|
||||
return onComplete(
|
||||
//Nothing to load.
|
||||
// Nothing to load.
|
||||
totalCount
|
||||
);
|
||||
}
|
||||
let loadingCount = 0;
|
||||
const that = this;
|
||||
|
||||
function onFontLoaded(fontFamily: string, fontResources: ResourceData[]) {
|
||||
fontResources.forEach(function (resource) {
|
||||
that._loadedFontFamily[resource.name] = fontFamily;
|
||||
that._loadedFonts[resource.name] = resource;
|
||||
const onFontLoaded = (
|
||||
fontFamily: string,
|
||||
fontResources: ResourceData[]
|
||||
) => {
|
||||
fontResources.forEach((resource) => {
|
||||
this._loadedFontFamily[resource.name] = fontFamily;
|
||||
this._loadedFonts[resource.name] = resource;
|
||||
});
|
||||
loadingCount++;
|
||||
onProgress(loadingCount, totalCount);
|
||||
if (loadingCount === totalCount) {
|
||||
onComplete(totalCount);
|
||||
}
|
||||
}
|
||||
Object.keys(filesResources).forEach(function (file) {
|
||||
const fontFamily = that._getFontFamilyFromFilename(file);
|
||||
};
|
||||
Object.keys(filesResources).forEach((file) => {
|
||||
const fontFamily = this._getFontFamilyFromFilename(file);
|
||||
const fontResources = filesResources[file];
|
||||
FontFaceObserverFontManager._loadFont(fontFamily, file).then(
|
||||
function () {
|
||||
this._loadFont(fontFamily, file).then(
|
||||
() => {
|
||||
onFontLoaded(fontFamily, fontResources);
|
||||
},
|
||||
function (error) {
|
||||
(error) => {
|
||||
logger.error(
|
||||
'Error loading font resource "' +
|
||||
fontResources[0].name +
|
||||
|
@@ -15,20 +15,6 @@ namespace gdjs {
|
||||
logger.error('Error while loading an audio file: ' + error),
|
||||
};
|
||||
|
||||
const checkIfCredentialsRequired = (url: string) => {
|
||||
// Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
|
||||
// i.e: its gdevelop.io cookie, to be passed.
|
||||
// Note that this is only useful during previews.
|
||||
if (
|
||||
url.startsWith('https://project-resources.gdevelop.io/') ||
|
||||
url.startsWith('https://project-resources-dev.gdevelop.io/')
|
||||
)
|
||||
return true;
|
||||
|
||||
// For other resources, use the default way of loading resources ("anonymous" or "same-site").
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Ensure the volume is between 0 and 1.
|
||||
*/
|
||||
@@ -392,8 +378,18 @@ namespace gdjs {
|
||||
_pausedSounds: HowlerSound[] = [];
|
||||
_paused: boolean = false;
|
||||
|
||||
constructor(resources: ResourceData[]) {
|
||||
_resourcesLoader: RuntimeGameResourcesLoader;
|
||||
|
||||
/**
|
||||
* @param resources The resources data of the game.
|
||||
* @param resourcesLoader The resources loader of the game.
|
||||
*/
|
||||
constructor(
|
||||
resources: ResourceData[],
|
||||
resourcesLoader: RuntimeGameResourcesLoader
|
||||
) {
|
||||
this._resources = resources;
|
||||
this._resourcesLoader = resourcesLoader;
|
||||
|
||||
const that = this;
|
||||
document.addEventListener('deviceready', function () {
|
||||
@@ -529,10 +525,12 @@ namespace gdjs {
|
||||
cacheContainer[soundFile] = new Howl(
|
||||
Object.assign(
|
||||
{
|
||||
src: [soundFile],
|
||||
src: [this._resourcesLoader.getFullUrl(soundFile)],
|
||||
html5: isMusic,
|
||||
xhr: {
|
||||
withCredentials: checkIfCredentialsRequired(soundFile),
|
||||
withCredentials: this._resourcesLoader.checkIfCredentialsRequired(
|
||||
soundFile
|
||||
),
|
||||
},
|
||||
// Cache the sound with no volume. This avoids a bug where it plays at full volume
|
||||
// for a split second before setting its correct volume.
|
||||
@@ -566,10 +564,12 @@ namespace gdjs {
|
||||
cacheContainer[soundFile] = new Howl(
|
||||
Object.assign(
|
||||
{
|
||||
src: [soundFile],
|
||||
src: [this._resourcesLoader.getFullUrl(soundFile)],
|
||||
html5: isMusic,
|
||||
xhr: {
|
||||
withCredentials: checkIfCredentialsRequired(soundFile),
|
||||
withCredentials: this._resourcesLoader.checkIfCredentialsRequired(
|
||||
soundFile
|
||||
),
|
||||
},
|
||||
// Cache the sound with no volume. This avoids a bug where it plays at full volume
|
||||
// for a split second before setting its correct volume.
|
||||
@@ -807,12 +807,14 @@ namespace gdjs {
|
||||
const container = isMusic ? this._loadedMusics : this._loadedSounds;
|
||||
container[file] = new Howl(
|
||||
Object.assign({}, HowlParameters, {
|
||||
src: [file],
|
||||
src: [this._resourcesLoader.getFullUrl(file)],
|
||||
onload: onLoadCallback,
|
||||
onloaderror: onLoadCallback,
|
||||
html5: isMusic,
|
||||
xhr: {
|
||||
withCredentials: checkIfCredentialsRequired(file),
|
||||
withCredentials: this._resourcesLoader.checkIfCredentialsRequired(
|
||||
file
|
||||
),
|
||||
},
|
||||
// Cache the sound with no volume. This avoids a bug where it plays at full volume
|
||||
// for a split second before setting its correct volume.
|
||||
@@ -846,7 +848,9 @@ namespace gdjs {
|
||||
// preloading as sound already does a XHR request, hence "else if"
|
||||
loadCounter++;
|
||||
const sound = new XMLHttpRequest();
|
||||
sound.withCredentials = checkIfCredentialsRequired(file);
|
||||
sound.withCredentials = this._resourcesLoader.checkIfCredentialsRequired(
|
||||
file
|
||||
);
|
||||
sound.addEventListener('load', callback);
|
||||
sound.addEventListener('error', (_) =>
|
||||
callback(_, 'XHR error: ' + file)
|
||||
@@ -854,7 +858,7 @@ namespace gdjs {
|
||||
sound.addEventListener('abort', (_) =>
|
||||
callback(_, 'XHR abort: ' + file)
|
||||
);
|
||||
sound.open('GET', file);
|
||||
sound.open('GET', this._resourcesLoader.getFullUrl(file));
|
||||
sound.send();
|
||||
}
|
||||
|
||||
|
@@ -17,20 +17,6 @@ namespace gdjs {
|
||||
content: Object | null
|
||||
) => void;
|
||||
|
||||
const checkIfCredentialsRequired = (url: string) => {
|
||||
// Any resource stored on the GDevelop Cloud buckets needs the "credentials" of the user,
|
||||
// i.e: its gdevelop.io cookie, to be passed.
|
||||
// Note that this is only useful during previews.
|
||||
if (
|
||||
url.startsWith('https://project-resources.gdevelop.io/') ||
|
||||
url.startsWith('https://project-resources-dev.gdevelop.io/')
|
||||
)
|
||||
return true;
|
||||
|
||||
// For other resources, use the default way of loading resources ("anonymous" or "same-site").
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* JsonManager loads json files (using `XMLHttpRequest`), using the "json" resources
|
||||
* registered in the game resources.
|
||||
@@ -40,6 +26,7 @@ namespace gdjs {
|
||||
* that loading failed.
|
||||
*/
|
||||
export class JsonManager {
|
||||
_resourcesLoader: RuntimeGameResourcesLoader;
|
||||
_resources: ResourceData[];
|
||||
|
||||
_loadedJsons: { [key: string]: Object } = {};
|
||||
@@ -47,9 +34,14 @@ namespace gdjs {
|
||||
|
||||
/**
|
||||
* @param resources The resources data of the game.
|
||||
* @param resourcesLoader The resources loader of the game.
|
||||
*/
|
||||
constructor(resources: ResourceData[]) {
|
||||
constructor(
|
||||
resources: ResourceData[],
|
||||
resourcesLoader: RuntimeGameResourcesLoader
|
||||
) {
|
||||
this._resources = resources;
|
||||
this._resourcesLoader = resourcesLoader;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,8 +143,10 @@ namespace gdjs {
|
||||
const that = this;
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.responseType = 'json';
|
||||
xhr.withCredentials = checkIfCredentialsRequired(resource.file);
|
||||
xhr.open('GET', resource.file);
|
||||
xhr.withCredentials = this._resourcesLoader.checkIfCredentialsRequired(
|
||||
resource.file
|
||||
);
|
||||
xhr.open('GET', this._resourcesLoader.getFullUrl(resource.file));
|
||||
xhr.onload = function () {
|
||||
const callbacks = that._callbacks[resourceName];
|
||||
if (!callbacks) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user