mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Compare commits
194 Commits
feature/im
...
v5.1.157
Author | SHA1 | Date | |
---|---|---|---|
![]() |
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 | ||
![]() |
95783fd58f | ||
![]() |
a78aa4af6e | ||
![]() |
4f4b2b7901 | ||
![]() |
957f672b90 | ||
![]() |
b9e932d0de | ||
![]() |
fdd2362dae | ||
![]() |
47583e3092 | ||
![]() |
8d7967d71a | ||
![]() |
72142a62c4 | ||
![]() |
619890a25f | ||
![]() |
debcd3045f | ||
![]() |
86635e4f66 | ||
![]() |
eedc68b0f2 | ||
![]() |
b1a6425ab8 | ||
![]() |
3d1ee5efcc | ||
![]() |
4d1fde608b | ||
![]() |
e40666bd73 | ||
![]() |
4a6c075e41 | ||
![]() |
82426fa564 | ||
![]() |
a21eef6930 | ||
![]() |
c6112a1549 | ||
![]() |
d8350396df | ||
![]() |
a8282aaf83 | ||
![]() |
7de7fc7193 | ||
![]() |
81c5829267 | ||
![]() |
07cf1a90a4 | ||
![]() |
3213985a81 | ||
![]() |
d4441fda99 | ||
![]() |
91c55fcf94 | ||
![]() |
6d7b5ac7d3 | ||
![]() |
903b353b7b | ||
![]() |
4dd189512b | ||
![]() |
535fa39a7b | ||
![]() |
78c0cb944f | ||
![]() |
55e037484f | ||
![]() |
84392c08b2 | ||
![]() |
0061b1cb8b | ||
![]() |
9e19aa8886 | ||
![]() |
f4b812ab29 | ||
![]() |
106d9de47c | ||
![]() |
ecbafe60d1 | ||
![]() |
c0ba26f1d5 | ||
![]() |
089be66e82 | ||
![]() |
ffb8a399cd | ||
![]() |
63482a0cda | ||
![]() |
4fe8dcaf0c | ||
![]() |
9729461aa1 | ||
![]() |
26fcc9770b | ||
![]() |
c62f9c5c65 | ||
![]() |
9b199d5aa0 | ||
![]() |
46e1a5c6e8 | ||
![]() |
052a6240c5 | ||
![]() |
d081711838 | ||
![]() |
f0151b2e1f | ||
![]() |
e2f42ca290 | ||
![]() |
b7a3d85287 | ||
![]() |
4b542e071a | ||
![]() |
64cad25b81 | ||
![]() |
8472e30342 | ||
![]() |
1b7d258727 | ||
![]() |
946b77093d | ||
![]() |
74c882f219 | ||
![]() |
abd417c494 | ||
![]() |
2005f9c37b | ||
![]() |
b749ac1106 | ||
![]() |
f34f901fa7 | ||
![]() |
c74110c058 | ||
![]() |
2a38be827c | ||
![]() |
7cd97e8cc4 | ||
![]() |
4c9445f6f5 | ||
![]() |
b7772520b5 | ||
![]() |
93121d1a1c | ||
![]() |
9f7c1a1748 | ||
![]() |
f6fc2406a5 | ||
![]() |
daede19d0d | ||
![]() |
36e835c461 | ||
![]() |
8d0b3ef53e | ||
![]() |
7ccd2cd146 | ||
![]() |
49974131d0 | ||
![]() |
77320ce12e | ||
![]() |
35833e6e23 | ||
![]() |
7436032787 | ||
![]() |
aa4fd1bda9 | ||
![]() |
e10dd57fed | ||
![]() |
893257491a | ||
![]() |
b8f04515f3 | ||
![]() |
4a807b6053 | ||
![]() |
dbfef27d2e | ||
![]() |
72b69e4cdf | ||
![]() |
2f11cd667b | ||
![]() |
d9de2a3177 | ||
![]() |
53828a6b61 | ||
![]() |
eb797281cf | ||
![]() |
80f5a9a0d6 | ||
![]() |
07ab4c938b | ||
![]() |
41fa153ddf | ||
![]() |
4cdac65944 | ||
![]() |
7b5036286f | ||
![]() |
fd4dd62f9b | ||
![]() |
6701a52a88 | ||
![]() |
0b61bb5053 | ||
![]() |
259e35d941 | ||
![]() |
b9ac22208b | ||
![]() |
a991283bb5 | ||
![]() |
bf3ecceb06 | ||
![]() |
b3bc1dd21b | ||
![]() |
d63b83b606 | ||
![]() |
05e222c92d | ||
![]() |
d843a9e607 | ||
![]() |
5d3f1a502c | ||
![]() |
fbcc63a0d0 | ||
![]() |
46a459bdb4 | ||
![]() |
86c8467cdc | ||
![]() |
5426f656cb | ||
![]() |
b7f4f3166e | ||
![]() |
e62b90d5ff | ||
![]() |
45c1c6c38a | ||
![]() |
82524fba12 | ||
![]() |
40fb6e4874 | ||
![]() |
52742cfa10 | ||
![]() |
702c71390b | ||
![]() |
1a6074b8ea | ||
![]() |
0e45d468ea | ||
![]() |
ed900befd4 | ||
![]() |
16ccd168e0 | ||
![]() |
74cc7ac684 | ||
![]() |
52278180ab | ||
![]() |
471053da11 | ||
![]() |
237786b0a0 | ||
![]() |
ba52577c24 | ||
![]() |
e99c3800e4 | ||
![]() |
c780b6c6d6 | ||
![]() |
70380dc056 | ||
![]() |
c1bed2ebb2 | ||
![]() |
d639f87f31 | ||
![]() |
e8888bbe76 | ||
![]() |
4797ce3a8a | ||
![]() |
a44a20d1d5 | ||
![]() |
5f717643b3 | ||
![]() |
346e08192c | ||
![]() |
f2eddd9c88 | ||
![]() |
d6e21d0854 |
@@ -726,6 +726,8 @@ gd::String EventsCodeGenerator::GenerateParameterCodes(
|
||||
metadata.GetType() == "fontResource" ||
|
||||
metadata.GetType() == "imageResource" ||
|
||||
metadata.GetType() == "jsonResource" ||
|
||||
metadata.GetType() == "tilemapResource" ||
|
||||
metadata.GetType() == "tilesetResource" ||
|
||||
metadata.GetType() == "videoResource" ||
|
||||
// Deprecated, old parameter names:
|
||||
metadata.GetType() == "password" || metadata.GetType() == "musicfile" ||
|
||||
|
@@ -105,7 +105,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAdvancedExtension(
|
||||
"res/function32.png",
|
||||
"res/function16.png")
|
||||
.AddParameter("functionParameterName", "Parameter name")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
@@ -117,7 +118,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAdvancedExtension(
|
||||
"res/function32.png",
|
||||
"res/function16.png")
|
||||
.AddParameter("functionParameterName", "Parameter name")
|
||||
.UseStandardRelationalOperatorParameters("string");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"string", gd::ParameterOptions::MakeNewOptions());
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -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
|
||||
|
@@ -23,6 +23,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
.SetCategory("Audio");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Sounds and music"))
|
||||
.SetIcon("res/actions/music24.png");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Sounds on channels"))
|
||||
.SetIcon("res/actions/son24.png");
|
||||
|
||||
extension
|
||||
.AddAction("PlaySoundCanal",
|
||||
@@ -146,69 +148,83 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
.AddAction("ModVolumeSoundCanal",
|
||||
_("Volume of the sound on a channel"),
|
||||
_("This action modifies the volume of the sound on the "
|
||||
"specified channel. The volume is between 0 and 100."),
|
||||
"specified channel."),
|
||||
_("the volume of the sound on channel _PARAM1_"),
|
||||
_("Sounds on channels"),
|
||||
"res/actions/sonVolume24.png",
|
||||
"res/actions/sonVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Volume (0-100)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("ModVolumeMusicCanal",
|
||||
_("Volume of the music on a channel"),
|
||||
_("This action modifies the volume of the music on the "
|
||||
"specified channel. The volume is between 0 and 100."),
|
||||
"specified channel."),
|
||||
_("the volume of the music on channel _PARAM1_"),
|
||||
_("Music on channels"),
|
||||
"res/actions/musicVolume24.png",
|
||||
"res/actions/musicVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Volume (0-100)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("ModGlobalVolume",
|
||||
_("Game global volume"),
|
||||
_("This action modifies the global volume of the game. The "
|
||||
"volume is between 0 and 100."),
|
||||
_("This action modifies the global volume of the game."),
|
||||
_("the global sound level"),
|
||||
"",
|
||||
"res/actions/volume24.png",
|
||||
"res/actions/volume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Volume (0-100)")))
|
||||
.MarkAsSimple();
|
||||
|
||||
extension
|
||||
.AddAction("ModPitchSoundChannel",
|
||||
_("Pitch of the sound of a channel"),
|
||||
_("This action modifies the pitch (speed) of the sound on a "
|
||||
"channel.\n1 is the default pitch."),
|
||||
"channel."),
|
||||
_("the pitch of the sound on channel _PARAM1_"),
|
||||
_("Sounds on channels"),
|
||||
"res/actions/son24.png",
|
||||
"res/actions/son.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Pitch (1 by default)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddAction("ModPitchMusicChannel",
|
||||
_("Pitch of the music on a channel"),
|
||||
_("This action modifies the pitch of the music on the "
|
||||
"specified channel. 1 is the default pitch"),
|
||||
"specified channel."),
|
||||
_("the pitch of the music on channel _PARAM1_"),
|
||||
_("Music on channels"),
|
||||
"res/actions/music24.png",
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Pitch (1 by default)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -222,7 +238,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
"res/actions/son.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Position (in seconds)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -236,7 +255,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
"res/actions/music.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Position (in seconds)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -448,15 +470,17 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
.AddCondition(
|
||||
"SoundCanalVolume",
|
||||
_("Volume of the sound on a channel"),
|
||||
_("Test the volume of the sound on the specified channel. The volume "
|
||||
"is between 0 and 100."),
|
||||
_("Test the volume of the sound on the specified channel."),
|
||||
_("the volume of the sound on channel _PARAM1_"),
|
||||
_("Sounds on channels"),
|
||||
"res/conditions/sonVolume24.png",
|
||||
"res/conditions/sonVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Volume to compare to (0-100)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -471,7 +495,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
"res/conditions/musicVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Volume to compare to (0-100)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -484,7 +511,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
"res/conditions/volume24.png",
|
||||
"res/conditions/volume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Volume to compare to (0-100)")));
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
@@ -498,22 +528,27 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
"res/conditions/sonVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Pitch to compare to (1 by default)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"MusicChannelPitch",
|
||||
_("Pitch of the music on a channel"),
|
||||
_("Test the pitch (speed) of the music on a specified channel. 1 is "
|
||||
"the default pitch."),
|
||||
_("Test the pitch (speed) of the music on a specified channel."),
|
||||
_("the pitch of the music on channel _PARAM1_"),
|
||||
_("Music on channels"),
|
||||
"res/conditions/musicVolume24.png",
|
||||
"res/conditions/musicVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Pitch to compare to (1 by default)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -527,7 +562,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
"res/conditions/sonVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Position to compare to (in seconds)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -541,7 +579,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsAudioExtension(
|
||||
"res/conditions/musicVolume.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Channel identifier"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Position to compare to (in seconds)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
|
@@ -40,7 +40,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/conditions/position_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction("MettreX",
|
||||
@@ -52,7 +53,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/actions/position_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
ParameterOptions::MakeNewOptions())
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddCondition("PosY",
|
||||
@@ -64,7 +66,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/conditions/position_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction("MettreY",
|
||||
@@ -76,7 +79,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/actions/position_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
ParameterOptions::MakeNewOptions())
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction("MettreXY",
|
||||
@@ -120,7 +124,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
_("Position/Center"),
|
||||
"res/actions/position24_black.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddExpressionAndConditionAndAction(
|
||||
"number",
|
||||
@@ -131,7 +135,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
_("Position/Center"),
|
||||
"res/actions/position24_black.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddExpressionAndCondition("number",
|
||||
"BoundingBoxLeft",
|
||||
@@ -142,7 +146,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-left_black.svg")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddExpressionAndCondition(
|
||||
"number",
|
||||
@@ -153,7 +157,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-top_black.svg")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddExpressionAndCondition("number",
|
||||
"BoundingBoxRight",
|
||||
@@ -164,7 +168,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-right_black.svg")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddExpressionAndCondition("number",
|
||||
"BoundingBoxBottom",
|
||||
@@ -175,7 +179,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-bottom_black.svg")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddExpressionAndCondition("number",
|
||||
"BoundingBoxCenterX",
|
||||
@@ -186,7 +190,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-center_black.svg")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddExpressionAndCondition("number",
|
||||
"BoundingBoxCenterY",
|
||||
@@ -197,7 +201,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
_("Position/Bounding Box"),
|
||||
"res/conditions/bounding-box-center_black.svg")
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardParameters("number");
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("MettreAutourPos",
|
||||
_("Put around a position"),
|
||||
@@ -226,7 +230,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/actions/direction_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Angle (in degrees)")));
|
||||
|
||||
obj.AddAction("Rotate",
|
||||
_("Rotate"),
|
||||
@@ -382,7 +389,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/actions/planicon.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters("number",
|
||||
ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("ChangeLayer",
|
||||
_("Layer"),
|
||||
@@ -407,7 +415,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters("number",
|
||||
ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("ModVarObjetTxt",
|
||||
_("Text of an object variable"),
|
||||
@@ -419,7 +428,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.UseStandardOperatorParameters("string");
|
||||
.UseStandardOperatorParameters("string",
|
||||
ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("SetObjectVariableAsBoolean",
|
||||
_("Boolean value of an object variable"),
|
||||
@@ -516,7 +526,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/conditions/direction_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Angle to compare to (in degrees)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("Plan",
|
||||
@@ -528,7 +541,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/conditions/planicon.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("Layer",
|
||||
@@ -585,7 +599,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/conditions/vitesse.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("AngleOfDisplacement",
|
||||
@@ -613,7 +628,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition("VarObjetTxt",
|
||||
_("Text of an object variable"),
|
||||
@@ -625,7 +641,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("objectvar", _("Variable"))
|
||||
.UseStandardRelationalOperatorParameters("string");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"string", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition("ObjectVariableAsBoolean",
|
||||
_("Boolean value of an object variable"),
|
||||
@@ -1423,34 +1440,39 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"res/conditions/nbObjet24.png",
|
||||
"res/conditions/nbObjet.png")
|
||||
.AddParameter("objectList", _("Object"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsSimple()
|
||||
.SetHidden();
|
||||
|
||||
extension.AddExpressionAndCondition(
|
||||
"number",
|
||||
"SceneInstancesCount",
|
||||
_("Number of object instances on the scene"),
|
||||
_("the number of instances of the specified objects living on the scene"),
|
||||
_("the number of _PARAM1_ living on the scene"),
|
||||
_("Objects"),
|
||||
"res/conditions/nbObjet24.png")
|
||||
.AddCodeOnlyParameter("objectsContext", "")
|
||||
.AddParameter("objectListOrEmptyWithoutPicking", _("Object"))
|
||||
.UseStandardParameters("number")
|
||||
.MarkAsSimple();
|
||||
extension
|
||||
.AddExpressionAndCondition(
|
||||
"number",
|
||||
"SceneInstancesCount",
|
||||
_("Number of object instances on the scene"),
|
||||
_("the number of instances of the specified objects living on the "
|
||||
"scene"),
|
||||
_("the number of _PARAM1_ living on the scene"),
|
||||
_("Objects"),
|
||||
"res/conditions/nbObjet24.png")
|
||||
.AddCodeOnlyParameter("objectsContext", "")
|
||||
.AddParameter("objectListOrEmptyWithoutPicking", _("Object"))
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsSimple();
|
||||
|
||||
extension.AddExpressionAndCondition(
|
||||
"number",
|
||||
"PickedInstancesCount",
|
||||
_("Number of object instances currently picked"),
|
||||
_("the number of instances picked by the previous conditions (or actions)"),
|
||||
_("the number of _PARAM0_ currently picked"),
|
||||
_("Objects"),
|
||||
"res/conditions/nbObjet24.png")
|
||||
.AddParameter("objectListOrEmptyWithoutPicking", _("Object"))
|
||||
.UseStandardParameters("number")
|
||||
.MarkAsSimple();
|
||||
extension
|
||||
.AddExpressionAndCondition(
|
||||
"number",
|
||||
"PickedInstancesCount",
|
||||
_("Number of object instances currently picked"),
|
||||
_("the number of instances picked by the previous conditions (or "
|
||||
"actions)"),
|
||||
_("the number of _PARAM0_ currently picked"),
|
||||
_("Objects"),
|
||||
"res/conditions/nbObjet24.png")
|
||||
.AddParameter("objectListOrEmptyWithoutPicking", _("Object"))
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsSimple();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
@@ -1559,7 +1581,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsBaseObjectExtension(
|
||||
"",
|
||||
"res/conditions/nbObjet.png")
|
||||
.AddParameter("objectList", _("Object"))
|
||||
.SetHidden(); // Deprecated
|
||||
.SetHidden(); // Deprecated
|
||||
|
||||
obj.AddStrExpression("ObjectName",
|
||||
_("Object name"),
|
||||
|
@@ -26,6 +26,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.SetExtensionHelpPath("/interface/scene-editor/layers-and-cameras");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Layers and cameras"))
|
||||
.SetIcon("res/conditions/camera24.png");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Effects"))
|
||||
.SetIcon("res/actions/effect24.png");
|
||||
|
||||
extension
|
||||
.AddExpressionAndConditionAndAction(
|
||||
@@ -37,7 +39,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"",
|
||||
"res/conditions/camera24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
@@ -69,7 +71,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"",
|
||||
"res/conditions/camera24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
@@ -104,7 +106,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number"), "", true)
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -120,7 +122,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number"), "", true)
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -137,7 +139,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number"), "", true)
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -154,7 +156,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number"), "", true)
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -171,7 +173,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number"), "", true)
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -188,7 +190,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number"), "", true)
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -201,7 +203,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"",
|
||||
"res/conditions/camera24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
@@ -453,8 +455,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"names) in the effects window."),
|
||||
_("Set _PARAM3_ to _PARAM4_ for effect _PARAM2_ of layer _PARAM1_"),
|
||||
_("Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
"res/actions/effect24.png",
|
||||
"res/actions/effect.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
@@ -472,8 +474,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"names) in the effects window."),
|
||||
_("Set _PARAM3_ to _PARAM4_ for effect _PARAM2_ of layer _PARAM1_"),
|
||||
_("Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
"res/actions/effect24.png",
|
||||
"res/actions/effect.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
@@ -491,8 +493,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
"names) in the effects window."),
|
||||
_("Enable _PARAM3_ for effect _PARAM2_ of layer _PARAM1_: _PARAM4_"),
|
||||
_("Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
"res/actions/effect24.png",
|
||||
"res/actions/effect.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
@@ -506,9 +508,9 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Layer effect is enabled"),
|
||||
_("The effect on a layer is enabled"),
|
||||
_("Effect _PARAM2_ on layer _PARAM1_ is enabled"),
|
||||
_("Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
_(""),
|
||||
"res/actions/effect24.png",
|
||||
"res/actions/effect.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
@@ -521,8 +523,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Enable an effect on a layer"),
|
||||
_("Enable effect _PARAM2_ on layer _PARAM1_: _PARAM3_"),
|
||||
_("Effects"),
|
||||
"res/conditions/camera24.png",
|
||||
"res/conditions/camera.png")
|
||||
"res/actions/effect24.png",
|
||||
"res/actions/effect.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
@@ -542,7 +544,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Time scale (1 by default)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -572,7 +577,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -597,7 +603,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension(
|
||||
_("Set the ambient light color of the lighting layer in format "
|
||||
"\"R;G;B\" string."),
|
||||
_("Set the ambient color of the lighting layer _PARAM1_ to _PARAM2_"),
|
||||
_("Lighting"),
|
||||
_(""),
|
||||
"res/actions/color24.png",
|
||||
"res/actions/color.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
|
@@ -492,6 +492,16 @@ BuiltinExtensionsImplementer::ImplementsMathematicalToolsExtension(
|
||||
"",
|
||||
"res/mathfunction.png")
|
||||
.SetHelpPath("/all-features/expressions");
|
||||
|
||||
extension
|
||||
.AddExpression("lerpAngle",
|
||||
_("Lerp (Linear interpolation) between two angles"),
|
||||
_("Linearly interpolates between two angles (in degrees) by taking the shortest direction around the circle."),
|
||||
"",
|
||||
"res/mathfunction.png")
|
||||
.AddParameter("expression", _("Starting angle, in degrees"))
|
||||
.AddParameter("expression", _("Destination angle, in degrees"))
|
||||
.AddParameter("expression", _("Interpolation value between 0 and 1."));
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -27,6 +27,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
.SetCategory("Input");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Mouse and touch"))
|
||||
.SetIcon("res/actions/mouse24.png");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Multitouch"))
|
||||
.SetIcon("res/conditions/touch24.png");
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
@@ -153,42 +155,80 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
extension
|
||||
.AddExpressionAndCondition(
|
||||
"number",
|
||||
"MouseX",
|
||||
"CursorX",
|
||||
_("Cursor X position"),
|
||||
_("the X position of the cursor or of a touch"),
|
||||
_("the cursor (or touch) X position"),
|
||||
"",
|
||||
"res/conditions/mouse24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0");
|
||||
|
||||
// Support for deprecated names:
|
||||
extension.AddDuplicatedCondition("SourisX", "MouseX").SetHidden();
|
||||
extension.AddDuplicatedExpression("SourisX", "MouseX").SetHidden();
|
||||
extension.AddDuplicatedCondition("MouseX", "CursorX").SetHidden();
|
||||
extension.AddDuplicatedExpression("MouseX", "CursorX").SetHidden();
|
||||
extension.AddDuplicatedCondition("SourisX", "CursorX").SetHidden();
|
||||
extension.AddDuplicatedExpression("SourisX", "CursorX").SetHidden();
|
||||
|
||||
extension
|
||||
.AddExpressionAndCondition(
|
||||
"number",
|
||||
"MouseY",
|
||||
"CursorY",
|
||||
_("Cursor Y position"),
|
||||
_("the Y position of the cursor or of a touch"),
|
||||
_("the cursor (or touch) Y position"),
|
||||
"",
|
||||
"res/conditions/mouse24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0");
|
||||
|
||||
// Support for deprecated names:
|
||||
extension.AddDuplicatedCondition("SourisY", "MouseY").SetHidden();
|
||||
extension.AddDuplicatedExpression("SourisY", "MouseY").SetHidden();
|
||||
extension.AddDuplicatedCondition("MouseY", "CursorY").SetHidden();
|
||||
extension.AddDuplicatedExpression("MouseY", "CursorY").SetHidden();
|
||||
extension.AddDuplicatedCondition("SourisY", "CursorY").SetHidden();
|
||||
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")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0")
|
||||
// It's only useful for extensions as they can't use TouchSimulateMouse.
|
||||
.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")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
.SetDefaultValue("0")
|
||||
// It's only useful for extensions as they can't use TouchSimulateMouse.
|
||||
.SetHidden();
|
||||
|
||||
extension
|
||||
.AddCondition("IsMouseInsideCanvas",
|
||||
@@ -276,7 +316,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
"res/conditions/touch24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Touch identifier"))
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
@@ -292,7 +332,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsMouseExtension(
|
||||
"res/conditions/touch24.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Touch identifier"))
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters("number", ParameterOptions::MakeNewOptions())
|
||||
.AddParameter("layer", _("Layer (base layer if empty)"), "", true)
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("expression", _("Camera number (default : 0)"), "", true)
|
||||
@@ -334,44 +374,85 @@ 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"),
|
||||
"res/conditions/touch24.png",
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.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")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetHidden();
|
||||
|
||||
extension
|
||||
.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();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"HasAnyTouchOrMouseStarted",
|
||||
_("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()."),
|
||||
_("A new touch has started"),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch24.png",
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
extension
|
||||
.AddExpression(
|
||||
"StartedTouchCount",
|
||||
"StartedTouchOrMouseCount",
|
||||
_("Started touch count"),
|
||||
_("The number of touches that have just started on this frame. The touch identifiers can be "
|
||||
"accessed using StartedTouchId()."),
|
||||
_("The number of touches (including the mouse) that have just "
|
||||
"started on this frame. The touch identifiers can be "
|
||||
"accessed using StartedTouchOrMouseId()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
extension
|
||||
.AddExpression(
|
||||
"StartedTouchId",
|
||||
"StartedTouchOrMouseId",
|
||||
_("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()."),
|
||||
_("The identifier of the touch or mouse that has just started on "
|
||||
"this frame. The number of touches can be "
|
||||
"accessed using StartedTouchOrMouseCount()."),
|
||||
_("Multitouch"),
|
||||
"res/conditions/touch.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("expression", _("Touch index"));
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"HasTouchEnded",
|
||||
_("A touch has ended"),
|
||||
_("Check if a touch has ended."),
|
||||
_("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"));
|
||||
|
||||
|
@@ -136,6 +136,20 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSceneExtension(
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("yesorno", _("Deactivate input when focus is lost"))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"HasGameJustResumed",
|
||||
_("Game has just resumed"),
|
||||
_("Check if the game has just resumed from being hidden. It "
|
||||
"happens when the game tab is selected, a minimized window is "
|
||||
"restored or the application is put back on front."),
|
||||
_("Game has just resumed"),
|
||||
"",
|
||||
"res/actions/window24.png",
|
||||
"res/actions/window.png")
|
||||
.SetHelpPath("/interface/scene-editor/events")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -31,7 +31,7 @@ class GD_CORE_API Point {
|
||||
/**
|
||||
* Change point position.
|
||||
*/
|
||||
void SetXY(float x_, float y_) {
|
||||
void SetXY(double x_, double y_) {
|
||||
x = x_;
|
||||
y = y_;
|
||||
}
|
||||
@@ -39,27 +39,27 @@ class GD_CORE_API Point {
|
||||
/**
|
||||
* Change point X position.
|
||||
*/
|
||||
void SetX(float x_) { x = x_; }
|
||||
void SetX(double x_) { x = x_; }
|
||||
|
||||
/**
|
||||
* Change point Y position.
|
||||
*/
|
||||
void SetY(float y_) { y = y_; }
|
||||
void SetY(double y_) { y = y_; }
|
||||
|
||||
/**
|
||||
* Get point X position.
|
||||
*/
|
||||
float GetX() const { return x; }
|
||||
double GetX() const { return x; }
|
||||
|
||||
/**
|
||||
* Get point Y position.
|
||||
*/
|
||||
float GetY() const { return y; }
|
||||
double GetY() const { return y; }
|
||||
|
||||
private:
|
||||
gd::String name;
|
||||
float x;
|
||||
float y;
|
||||
double x;
|
||||
double y;
|
||||
};
|
||||
|
||||
#endif // GDCORE_POINT_H
|
||||
|
@@ -4,13 +4,15 @@
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#include "Polygon2d.h"
|
||||
#include "GDCore/Vector2.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
void Polygon2d::Rotate(float angle) {
|
||||
float t, cosa = cos(-angle),
|
||||
sina = sin(-angle); // We want a clockwise rotation
|
||||
#include "GDCore/Vector2.h"
|
||||
|
||||
void Polygon2d::Rotate(double angle) {
|
||||
double t, cosa = cos(-angle),
|
||||
sina = sin(-angle); // We want a clockwise rotation
|
||||
|
||||
for (std::size_t i = 0; i < vertices.size(); ++i) {
|
||||
t = vertices[i].x;
|
||||
@@ -19,7 +21,7 @@ void Polygon2d::Rotate(float angle) {
|
||||
}
|
||||
}
|
||||
|
||||
void Polygon2d::Move(float x, float y) {
|
||||
void Polygon2d::Move(double x, double y) {
|
||||
for (std::size_t i = 0; i < vertices.size(); i++) {
|
||||
vertices[i].x += x;
|
||||
vertices[i].y += y;
|
||||
@@ -50,13 +52,13 @@ bool Polygon2d::IsConvex() const {
|
||||
(edges[0].x * edges[0 + 1].y - edges[0].y * edges[0 + 1].x) > 0;
|
||||
|
||||
for (std::size_t i = 1; i < edges.size() - 1; ++i) {
|
||||
float zCrossProduct =
|
||||
double zCrossProduct =
|
||||
edges[i].x * edges[i + 1].y - edges[i].y * edges[i + 1].x;
|
||||
if ((zCrossProduct > 0) != zProductIsPositive) return false;
|
||||
}
|
||||
|
||||
float lastZCrossProduct = edges[edges.size() - 1].x * edges[0].y -
|
||||
edges[edges.size() - 1].y * edges[0].x;
|
||||
double lastZCrossProduct = edges[edges.size() - 1].x * edges[0].y -
|
||||
edges[edges.size() - 1].y * edges[0].x;
|
||||
if ((lastZCrossProduct > 0) != zProductIsPositive) return false;
|
||||
|
||||
return true;
|
||||
@@ -75,7 +77,7 @@ gd::Vector2f Polygon2d::ComputeCenter() const {
|
||||
return center;
|
||||
}
|
||||
|
||||
Polygon2d Polygon2d::CreateRectangle(float width, float height) {
|
||||
Polygon2d Polygon2d::CreateRectangle(double width, double height) {
|
||||
Polygon2d rect;
|
||||
rect.vertices.push_back(gd::Vector2f(-width / 2.0f, -height / 2.0f));
|
||||
rect.vertices.push_back(gd::Vector2f(+width / 2.0f, -height / 2.0f));
|
||||
|
@@ -5,9 +5,10 @@
|
||||
*/
|
||||
#ifndef GDCORE_POLYGON_H
|
||||
#define GDCORE_POLYGON_H
|
||||
#include "GDCore/Vector2.h"
|
||||
#include <vector>
|
||||
|
||||
#include "GDCore/Vector2.h"
|
||||
|
||||
/**
|
||||
* \brief Represents a polygon. Usually used for collisions masks.
|
||||
*
|
||||
@@ -42,7 +43,7 @@ class GD_CORE_API Polygon2d {
|
||||
* \note Edges are updated, there is no need to call ComputeEdges after
|
||||
* calling Move.
|
||||
*/
|
||||
void Move(float x, float y);
|
||||
void Move(double x, double y);
|
||||
|
||||
/**
|
||||
* \brief Rotate the polygon.
|
||||
@@ -52,7 +53,7 @@ class GD_CORE_API Polygon2d {
|
||||
* \warning edges vector is not updated, you have to call ComputeEdges if
|
||||
* needed.
|
||||
*/
|
||||
void Rotate(float angle);
|
||||
void Rotate(double angle);
|
||||
|
||||
/**
|
||||
* \brief Automatically fill edges vector using vertices.
|
||||
@@ -77,7 +78,7 @@ class GD_CORE_API Polygon2d {
|
||||
/**
|
||||
* \brief Create a rectangle
|
||||
*/
|
||||
static Polygon2d CreateRectangle(float width, float height);
|
||||
static Polygon2d CreateRectangle(double width, double height);
|
||||
///@}
|
||||
};
|
||||
|
||||
|
@@ -44,7 +44,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/actions/opacity.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Opacity (0-255)")))
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction("ChangeAnimation",
|
||||
@@ -57,7 +60,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/actions/animation.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
ParameterOptions::MakeNewOptions())
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction("SetAnimationName",
|
||||
@@ -86,7 +90,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
.SetHidden() // Hide as 8 direction is not supported officially in the
|
||||
// interface.
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ChangeSprite",
|
||||
@@ -98,7 +103,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/actions/sprite.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("PauseAnimation",
|
||||
@@ -134,7 +140,9 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/actions/animation.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(_("Speed scale")))
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddAction("TourneVersPos",
|
||||
@@ -162,7 +170,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/actions/scale_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Scale (1 by default)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ChangeScaleWidth",
|
||||
@@ -174,7 +185,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/actions/scaleWidth_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Scale (1 by default)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ChangeScaleHeight",
|
||||
@@ -186,7 +200,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/actions/scaleHeight_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Scale (1 by default)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ChangeWidth",
|
||||
@@ -198,7 +215,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/actions/scaleWidth_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("Width",
|
||||
@@ -210,7 +228,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/conditions/scaleWidth_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ChangeHeight",
|
||||
@@ -222,7 +241,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/actions/scaleHeight_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("Height",
|
||||
@@ -234,7 +254,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/conditions/scaleHeight_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("SetSize",
|
||||
@@ -260,7 +281,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/conditions/animation.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("AnimationName",
|
||||
@@ -288,7 +310,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
.SetHidden() // Hide as 8 direction is not supported officially in the
|
||||
// interface.
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition("Sprite",
|
||||
_("Current frame"),
|
||||
@@ -301,7 +324,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/conditions/sprite.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("AnimStopped",
|
||||
@@ -349,7 +373,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/conditions/scaleWidth_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Scale (1 by default)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("ScaleHeight",
|
||||
@@ -361,7 +388,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/conditions/scaleHeight_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Scale (1 by default)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddCondition("Opacity",
|
||||
@@ -374,7 +404,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/conditions/opacity.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Opacity to compare to (0-255)")))
|
||||
.MarkAsSimple();
|
||||
|
||||
obj.AddCondition(
|
||||
@@ -387,7 +420,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
"res/conditions/opacity.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "Sprite")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("ChangeColor",
|
||||
@@ -549,7 +583,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsSpriteExtension(
|
||||
|
||||
obj.AddExpression("Sprite",
|
||||
_("Image"),
|
||||
_("Animation frame of the object"),
|
||||
_("Current frame of the animation of the object"),
|
||||
_("Animations and images"),
|
||||
"res/actions/sprite.png")
|
||||
.AddParameter("object", _("Object"), "Sprite");
|
||||
|
||||
obj.AddExpression("AnimationFrameCount",
|
||||
_("Number of frames"),
|
||||
_("Number of frames in the current animation of the object"),
|
||||
_("Animations and images"),
|
||||
"res/actions/sprite.png")
|
||||
.AddParameter("object", _("Object"), "Sprite");
|
||||
|
@@ -183,6 +183,26 @@ BuiltinExtensionsImplementer::ImplementsStringInstructionsExtension(
|
||||
_("Position of the last character in the string to be "
|
||||
"considered in the search"));
|
||||
|
||||
extension
|
||||
.AddStrExpression("StrReplaceOne",
|
||||
_("Replace the first occurrence of a text by another."),
|
||||
_("Replace the first occurrence of a text by another."),
|
||||
"",
|
||||
"res/conditions/toujours24_black.png")
|
||||
.AddParameter("string", _("Text in which the replacement must be done"))
|
||||
.AddParameter("string", _("Text to find inside the first text"))
|
||||
.AddParameter("string", _("Replacement to put instead of the text to find"));
|
||||
|
||||
extension
|
||||
.AddStrExpression("StrReplaceAll",
|
||||
_("Replace all occurrences of a text by another."),
|
||||
_("Replace all occurrences of a text by another."),
|
||||
"",
|
||||
"res/conditions/toujours24_black.png")
|
||||
.AddParameter("string", _("Text in which the replacement(s) must be done"))
|
||||
.AddParameter("string", _("Text to find inside the first text"))
|
||||
.AddParameter("string", _("Replacement to put instead of the text to find"));
|
||||
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -65,7 +65,10 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
"res/conditions/time24.png",
|
||||
"res/conditions/time.png")
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Time scale (1 by default)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -148,7 +151,7 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
|
||||
|
||||
extension
|
||||
.AddAction("Wait",
|
||||
_("Wait X seconds (experimental)"),
|
||||
_("Wait X seconds"),
|
||||
_("Waits a number of seconds before running "
|
||||
"the next actions (and sub-events)."),
|
||||
_("Wait _PARAM0_ seconds"),
|
||||
|
@@ -34,7 +34,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions());
|
||||
|
||||
extension
|
||||
.AddCondition("VarSceneTxt",
|
||||
@@ -45,7 +46,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.UseStandardRelationalOperatorParameters("string");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"string", ParameterOptions::MakeNewOptions());
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
@@ -107,7 +109,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -119,7 +122,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
"res/conditions/var24.png",
|
||||
"res/conditions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
.UseStandardRelationalOperatorParameters("string")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"string", ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -157,7 +161,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters("number",
|
||||
ParameterOptions::MakeNewOptions());
|
||||
|
||||
extension
|
||||
.AddAction("ModVarSceneTxt",
|
||||
@@ -168,7 +173,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("scenevar", _("Variable"))
|
||||
.UseStandardOperatorParameters("string");
|
||||
.UseStandardOperatorParameters("string",
|
||||
ParameterOptions::MakeNewOptions());
|
||||
|
||||
extension
|
||||
.AddAction(
|
||||
@@ -203,7 +209,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
@@ -215,7 +222,8 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsVariablesExtension(
|
||||
"res/actions/var24.png",
|
||||
"res/actions/var.png")
|
||||
.AddParameter("globalvar", _("Variable"))
|
||||
.UseStandardOperatorParameters("string")
|
||||
.UseStandardOperatorParameters("string",
|
||||
ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
extension
|
||||
|
@@ -94,13 +94,15 @@ InstructionMetadata& InstructionMetadata::AddCodeOnlyParameter(
|
||||
}
|
||||
|
||||
InstructionMetadata& InstructionMetadata::UseStandardOperatorParameters(
|
||||
const gd::String& type, const gd::String& typeExtraInfo) {
|
||||
const gd::String& type, const ParameterOptions &options) {
|
||||
const gd::String& expressionValueType =
|
||||
gd::ValueTypeMetadata::GetPrimitiveValueType(type);
|
||||
SetManipulatedType(expressionValueType);
|
||||
|
||||
if (type == "boolean") {
|
||||
AddParameter("yesorno", _("New value"));
|
||||
AddParameter(
|
||||
"yesorno",
|
||||
options.description.empty() ? _("New value") : options.description);
|
||||
size_t valueParamIndex = parameters.size() - 1;
|
||||
|
||||
if (isObjectInstruction || isBehaviorInstruction) {
|
||||
@@ -122,7 +124,9 @@ InstructionMetadata& InstructionMetadata::UseStandardOperatorParameters(
|
||||
}
|
||||
} else {
|
||||
AddParameter("operator", _("Modification's sign"), expressionValueType);
|
||||
AddParameter(type, _("Value"), typeExtraInfo);
|
||||
AddParameter(type,
|
||||
options.description.empty() ? _("Value") : options.description,
|
||||
options.typeExtraInfo);
|
||||
|
||||
size_t operatorParamIndex = parameters.size() - 2;
|
||||
size_t valueParamIndex = parameters.size() - 1;
|
||||
@@ -155,7 +159,7 @@ InstructionMetadata& InstructionMetadata::UseStandardOperatorParameters(
|
||||
|
||||
InstructionMetadata&
|
||||
InstructionMetadata::UseStandardRelationalOperatorParameters(
|
||||
const gd::String& type, const gd::String& typeExtraInfo) {
|
||||
const gd::String& type, const ParameterOptions &options) {
|
||||
const gd::String& expressionValueType =
|
||||
gd::ValueTypeMetadata::GetPrimitiveValueType(type);
|
||||
SetManipulatedType(expressionValueType);
|
||||
@@ -175,7 +179,9 @@ InstructionMetadata::UseStandardRelationalOperatorParameters(
|
||||
}
|
||||
} else {
|
||||
AddParameter("relationalOperator", _("Sign of the test"), expressionValueType);
|
||||
AddParameter(type, _("Value to compare"), typeExtraInfo);
|
||||
AddParameter(type,
|
||||
options.description.empty() ? _("Value to compare") : options.description,
|
||||
options.typeExtraInfo);
|
||||
size_t operatorParamIndex = parameters.size() - 2;
|
||||
size_t valueParamIndex = parameters.size() - 1;
|
||||
|
||||
|
@@ -14,6 +14,8 @@
|
||||
#include "GDCore/Events/Instruction.h"
|
||||
#include "GDCore/String.h"
|
||||
#include "ParameterMetadata.h"
|
||||
#include "ParameterOptions.h"
|
||||
|
||||
namespace gd {
|
||||
class Project;
|
||||
class Layout;
|
||||
@@ -109,8 +111,8 @@ class GD_CORE_API InstructionMetadata {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the instruction asynchronicity is optional. If it is, it can either
|
||||
* be used synchronously or asynchronously, with one function for each.
|
||||
* Check if the instruction asynchronicity is optional. If it is, it can
|
||||
* either be used synchronously or asynchronously, with one function for each.
|
||||
*/
|
||||
bool IsOptionallyAsync() const {
|
||||
return IsAsync() && !codeExtraInformation.functionCallName.empty();
|
||||
@@ -223,21 +225,22 @@ class GD_CORE_API InstructionMetadata {
|
||||
/**
|
||||
* \brief Add the default parameters for an instruction manipulating the
|
||||
* specified type ("string", "number") with the default operators.
|
||||
*
|
||||
*
|
||||
* \note The type "string" can be declined in several subtypes.
|
||||
* \see ParameterMetadata
|
||||
*/
|
||||
InstructionMetadata &UseStandardOperatorParameters(const gd::String &type, const gd::String& typeExtraInfo = "");
|
||||
InstructionMetadata &UseStandardOperatorParameters(
|
||||
const gd::String &type, const ParameterOptions &options);
|
||||
|
||||
/**
|
||||
* \brief Add the default parameters for an instruction comparing the
|
||||
* specified type ("string", "number") with the default relational operators.
|
||||
*
|
||||
*
|
||||
* \note The type "string" can be declined in several subtypes.
|
||||
* \see ParameterMetadata
|
||||
*/
|
||||
InstructionMetadata &UseStandardRelationalOperatorParameters(
|
||||
const gd::String &type, const gd::String& typeExtraInfo = "");
|
||||
const gd::String &type, const ParameterOptions &options);
|
||||
|
||||
/**
|
||||
* \brief Mark the instruction as an object instruction. Automatically called
|
||||
@@ -334,11 +337,12 @@ class GD_CORE_API InstructionMetadata {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the function, doing asynchronous work, which will be called in
|
||||
* the generated code. This function should return an asynchronous task
|
||||
* (i.e: `gdjs.AsyncTask` in the JavaScript runtime).
|
||||
* Set the name of the function, doing asynchronous work, which will be
|
||||
* called in the generated code. This function should return an asynchronous
|
||||
* task (i.e: `gdjs.AsyncTask` in the JavaScript runtime).
|
||||
*
|
||||
* \param functionName the name of the function doing asynchronous work to call.
|
||||
* \param functionName the name of the function doing asynchronous work to
|
||||
* call.
|
||||
*/
|
||||
ExtraInformation &SetAsyncFunctionName(const gd::String &functionName_) {
|
||||
asyncFunctionCallName = functionName_;
|
||||
@@ -482,12 +486,12 @@ class GD_CORE_API InstructionMetadata {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the name of the function, doing asynchronous work, which will be called in
|
||||
* the generated code. This function should return an asynchronous task
|
||||
* Set the name of the function, doing asynchronous work, which will be called
|
||||
* in the generated code. This function should return an asynchronous task
|
||||
* (i.e: `gdjs.AsyncTask` in the JavaScript runtime).
|
||||
*
|
||||
* \param functionName the name of the function doing asynchronous work to call.
|
||||
* \note Shortcut for `codeExtraInformation.SetAsyncFunctionName`.
|
||||
* \param functionName the name of the function doing asynchronous work to
|
||||
* call. \note Shortcut for `codeExtraInformation.SetAsyncFunctionName`.
|
||||
*/
|
||||
ExtraInformation &SetAsyncFunctionName(const gd::String &functionName) {
|
||||
return codeExtraInformation.SetAsyncFunctionName(functionName);
|
||||
@@ -512,7 +516,7 @@ class GD_CORE_API InstructionMetadata {
|
||||
/**
|
||||
* \brief Get the files that must be included to use the instruction.
|
||||
*/
|
||||
const std::vector<gd::String>& GetIncludeFiles() const {
|
||||
const std::vector<gd::String> &GetIncludeFiles() const {
|
||||
return codeExtraInformation.GetIncludeFiles();
|
||||
};
|
||||
|
||||
|
@@ -8,6 +8,8 @@
|
||||
#include "GDCore/Extensions/Metadata/ExpressionMetadata.h"
|
||||
#include "GDCore/Extensions/Metadata/InstructionMetadata.h"
|
||||
#include "GDCore/String.h"
|
||||
#include "ParameterOptions.h"
|
||||
|
||||
namespace gd {} // namespace gd
|
||||
|
||||
namespace gd {
|
||||
@@ -32,8 +34,7 @@ class GD_CORE_API MultipleInstructionMetadata {
|
||||
return MultipleInstructionMetadata(expression, condition, action);
|
||||
}
|
||||
static MultipleInstructionMetadata WithConditionAndAction(
|
||||
gd::InstructionMetadata &condition,
|
||||
gd::InstructionMetadata &action) {
|
||||
gd::InstructionMetadata &condition, gd::InstructionMetadata &action) {
|
||||
return MultipleInstructionMetadata(condition, action);
|
||||
}
|
||||
|
||||
@@ -83,7 +84,8 @@ class GD_CORE_API MultipleInstructionMetadata {
|
||||
/**
|
||||
* \see gd::InstructionMetadata::SetParameterExtraInfo
|
||||
*/
|
||||
MultipleInstructionMetadata &SetParameterExtraInfo(const gd::String &defaultValue) {
|
||||
MultipleInstructionMetadata &SetParameterExtraInfo(
|
||||
const gd::String &defaultValue) {
|
||||
if (expression) expression->SetParameterExtraInfo(defaultValue);
|
||||
if (condition) condition->SetParameterExtraInfo(defaultValue);
|
||||
if (action) action->SetParameterExtraInfo(defaultValue);
|
||||
@@ -126,9 +128,11 @@ class GD_CORE_API MultipleInstructionMetadata {
|
||||
* \see gd::InstructionMetadata::UseStandardOperatorParameters
|
||||
* \see gd::InstructionMetadata::UseStandardRelationalOperatorParameters
|
||||
*/
|
||||
MultipleInstructionMetadata &UseStandardParameters(const gd::String &type, const gd::String& typeExtraInfo = "") {
|
||||
if (condition) condition->UseStandardRelationalOperatorParameters(type, typeExtraInfo);
|
||||
if (action) action->UseStandardOperatorParameters(type, typeExtraInfo);
|
||||
MultipleInstructionMetadata &UseStandardParameters(
|
||||
const gd::String &type, const ParameterOptions &options) {
|
||||
if (condition)
|
||||
condition->UseStandardRelationalOperatorParameters(type, options);
|
||||
if (action) action->UseStandardOperatorParameters(type, options);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -167,13 +171,12 @@ class GD_CORE_API MultipleInstructionMetadata {
|
||||
/**
|
||||
* \brief Get the files that must be included to use the instruction.
|
||||
*/
|
||||
const std::vector<gd::String>& GetIncludeFiles() const {
|
||||
const std::vector<gd::String> &GetIncludeFiles() const {
|
||||
if (expression)
|
||||
return expression->GetCodeExtraInformation().GetIncludeFiles();
|
||||
if (condition)
|
||||
return condition->GetCodeExtraInformation().GetIncludeFiles();
|
||||
if (action)
|
||||
return action->GetCodeExtraInformation().GetIncludeFiles();
|
||||
if (action) return action->GetCodeExtraInformation().GetIncludeFiles();
|
||||
// It can't actually happen.
|
||||
throw std::logic_error("no instruction metadata");
|
||||
}
|
||||
@@ -182,12 +185,9 @@ class GD_CORE_API MultipleInstructionMetadata {
|
||||
* \see gd::InstructionMetadata::SetPrivate
|
||||
*/
|
||||
MultipleInstructionMetadata &SetPrivate() {
|
||||
if (expression)
|
||||
expression->SetPrivate();
|
||||
if (condition)
|
||||
condition->SetPrivate();
|
||||
if (action)
|
||||
action->SetPrivate();
|
||||
if (expression) expression->SetPrivate();
|
||||
if (condition) condition->SetPrivate();
|
||||
if (action) action->SetPrivate();
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
35
Core/GDCore/Extensions/Metadata/ParameterOptions.h
Normal file
35
Core/GDCore/Extensions/Metadata/ParameterOptions.h
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef PARAMETEROPTIONS_H
|
||||
#define PARAMETEROPTIONS_H
|
||||
#include "GDCore/String.h"
|
||||
#include "ParameterMetadata.h"
|
||||
|
||||
namespace gd {} // namespace gd
|
||||
|
||||
namespace gd {
|
||||
struct GD_CORE_API ParameterOptions {
|
||||
gd::String description;
|
||||
gd::String typeExtraInfo;
|
||||
|
||||
ParameterOptions &SetDescription(const gd::String &description_) {
|
||||
description = description_;
|
||||
return *this;
|
||||
}
|
||||
ParameterOptions &SetTypeExtraInfo(const gd::String &typeExtraInfo_) {
|
||||
typeExtraInfo = typeExtraInfo_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
static ParameterOptions MakeNewOptions() {
|
||||
ParameterOptions emptyOptions;
|
||||
return emptyOptions;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // PARAMETEROPTIONS_H
|
@@ -3,7 +3,6 @@
|
||||
* Copyright 2008-2016 Florian Rival (Florian.Rival@gmail.com). All rights
|
||||
* reserved. This project is released under the MIT License.
|
||||
*/
|
||||
#if defined(GD_IDE_ONLY)
|
||||
#ifndef SCENECANVASSETTINGS_H
|
||||
#define SCENECANVASSETTINGS_H
|
||||
#include "GDCore/String.h"
|
||||
@@ -43,4 +42,3 @@ private:
|
||||
} // namespace gd
|
||||
|
||||
#endif // SCENECANVASSETTINGS_H
|
||||
#endif
|
||||
|
@@ -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
|
||||
*/
|
||||
|
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "GDCore/Events/Instruction.h"
|
||||
#include "GDCore/Extensions/Metadata/MetadataProvider.h"
|
||||
#include "GDCore/Extensions/Metadata/ParameterMetadataTools.h"
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
#include "GDCore/IDE/WholeProjectRefactorer.h"
|
||||
#include "GDCore/IDE/Events/ExpressionTypeFinder.h"
|
||||
@@ -11,30 +12,36 @@
|
||||
|
||||
namespace gd {
|
||||
|
||||
std::set<gd::String> UsedExtensionsFinder::ScanProject(gd::Project& project) {
|
||||
const UsedExtensionsResult UsedExtensionsFinder::ScanProject(gd::Project& project) {
|
||||
UsedExtensionsFinder worker(project);
|
||||
gd::WholeProjectRefactorer::ExposeProjectObjects(project, worker);
|
||||
gd::WholeProjectRefactorer::ExposeProjectEvents(project, worker);
|
||||
return worker.usedExtensions;
|
||||
return worker.result;
|
||||
};
|
||||
|
||||
// Objects scanner
|
||||
|
||||
void UsedExtensionsFinder::DoVisitObject(gd::Object& object) {
|
||||
usedExtensions.insert(gd::MetadataProvider::GetExtensionAndObjectMetadata(
|
||||
project.GetCurrentPlatform(), object.GetType())
|
||||
.GetExtension()
|
||||
.GetName());
|
||||
void UsedExtensionsFinder::DoVisitObject(gd::Object &object) {
|
||||
auto metadata = gd::MetadataProvider::GetExtensionAndObjectMetadata(
|
||||
project.GetCurrentPlatform(), object.GetType());
|
||||
result.GetUsedExtensions().insert(metadata.GetExtension().GetName());
|
||||
for (auto &&includeFile : metadata.GetMetadata().includeFiles) {
|
||||
result.GetUsedIncludeFiles().insert(includeFile);
|
||||
}
|
||||
};
|
||||
|
||||
// Behaviors scanner
|
||||
|
||||
void UsedExtensionsFinder::DoVisitBehavior(gd::Behavior& behavior) {
|
||||
usedExtensions.insert(
|
||||
gd::MetadataProvider::GetExtensionAndBehaviorMetadata(
|
||||
project.GetCurrentPlatform(), behavior.GetTypeName())
|
||||
.GetExtension()
|
||||
.GetName());
|
||||
void UsedExtensionsFinder::DoVisitBehavior(gd::Behavior &behavior) {
|
||||
auto metadata = gd::MetadataProvider::GetExtensionAndBehaviorMetadata(
|
||||
project.GetCurrentPlatform(), behavior.GetTypeName());
|
||||
result.GetUsedExtensions().insert(metadata.GetExtension().GetName());
|
||||
for (auto &&includeFile : metadata.GetMetadata().includeFiles) {
|
||||
result.GetUsedIncludeFiles().insert(includeFile);
|
||||
}
|
||||
for (auto &&includeFile : metadata.GetMetadata().requiredFiles) {
|
||||
result.GetUsedRequiredFiles().insert(includeFile);
|
||||
}
|
||||
};
|
||||
|
||||
// Instructions scanner
|
||||
@@ -46,23 +53,29 @@ bool UsedExtensionsFinder::DoVisitInstruction(gd::Instruction& instruction,
|
||||
project.GetCurrentPlatform(), instruction.GetType())
|
||||
: gd::MetadataProvider::GetExtensionAndActionMetadata(
|
||||
project.GetCurrentPlatform(), instruction.GetType());
|
||||
usedExtensions.insert(metadata.GetExtension().GetName());
|
||||
result.GetUsedExtensions().insert(metadata.GetExtension().GetName());
|
||||
for (auto&& includeFile : metadata.GetMetadata().GetIncludeFiles()) {
|
||||
result.GetUsedIncludeFiles().insert(includeFile);
|
||||
}
|
||||
|
||||
size_t i = 0;
|
||||
for (auto expression : instruction.GetParameters()) {
|
||||
const gd::String& parameterType =
|
||||
metadata.GetMetadata().GetParameter(i).GetType();
|
||||
i++;
|
||||
gd::ParameterMetadataTools::IterateOverParameters(
|
||||
instruction.GetParameters(),
|
||||
metadata.GetMetadata().GetParameters(),
|
||||
[this](const gd::ParameterMetadata& parameterMetadata,
|
||||
const gd::Expression& parameterValue,
|
||||
const gd::String& lastObjectName) {
|
||||
const gd::String& parameterType = parameterMetadata.GetType();
|
||||
|
||||
if (gd::ParameterMetadata::IsExpression("string", parameterType)) {
|
||||
rootType = "string";
|
||||
expression.GetRootNode()->Visit(*this);
|
||||
parameterValue.GetRootNode()->Visit(*this);
|
||||
} else if (gd::ParameterMetadata::IsExpression("number", parameterType)) {
|
||||
rootType = "number";
|
||||
expression.GetRootNode()->Visit(*this);
|
||||
parameterValue.GetRootNode()->Visit(*this);
|
||||
} else if (gd::ParameterMetadata::IsExpression("variable", parameterType))
|
||||
usedExtensions.insert("BuiltinVariables");
|
||||
}
|
||||
result.GetUsedExtensions().insert("BuiltinVariables");
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -93,31 +106,35 @@ void UsedExtensionsFinder::OnVisitUnaryOperatorNode(UnaryOperatorNode& node) {
|
||||
|
||||
// Add variable extension and visit sub-expressions on variable nodes
|
||||
void UsedExtensionsFinder::OnVisitVariableNode(VariableNode& node) {
|
||||
usedExtensions.insert("BuiltinVariables");
|
||||
result.GetUsedExtensions().insert("BuiltinVariables");
|
||||
if (node.child) node.child->Visit(*this);
|
||||
};
|
||||
|
||||
void UsedExtensionsFinder::OnVisitVariableAccessorNode(
|
||||
VariableAccessorNode& node) {
|
||||
usedExtensions.insert("BuiltinVariables");
|
||||
result.GetUsedExtensions().insert("BuiltinVariables");
|
||||
if (node.child) node.child->Visit(*this);
|
||||
};
|
||||
|
||||
void UsedExtensionsFinder::OnVisitVariableBracketAccessorNode(
|
||||
VariableBracketAccessorNode& node) {
|
||||
usedExtensions.insert("BuiltinVariables");
|
||||
result.GetUsedExtensions().insert("BuiltinVariables");
|
||||
node.expression->Visit(*this);
|
||||
if (node.child) node.child->Visit(*this);
|
||||
};
|
||||
|
||||
// Add extensions bound to Objects/Behaviors/Functions
|
||||
void UsedExtensionsFinder::OnVisitIdentifierNode(IdentifierNode& node) {
|
||||
auto type = gd::ExpressionTypeFinder::GetType(project.GetCurrentPlatform(), GetGlobalObjectsContainer(), GetObjectsContainer(), rootType, node);
|
||||
void UsedExtensionsFinder::OnVisitIdentifierNode(IdentifierNode &node) {
|
||||
auto type = gd::ExpressionTypeFinder::GetType(
|
||||
project.GetCurrentPlatform(), GetGlobalObjectsContainer(),
|
||||
GetObjectsContainer(), rootType, node);
|
||||
if (gd::ParameterMetadata::IsObject(type)) {
|
||||
usedExtensions.insert(gd::MetadataProvider::GetExtensionAndObjectMetadata(
|
||||
project.GetCurrentPlatform(), node.identifierName)
|
||||
.GetExtension()
|
||||
.GetName());
|
||||
auto metadata = gd::MetadataProvider::GetExtensionAndObjectMetadata(
|
||||
project.GetCurrentPlatform(), node.identifierName);
|
||||
result.GetUsedExtensions().insert(metadata.GetExtension().GetName());
|
||||
for (auto &&includeFile : metadata.GetMetadata().includeFiles) {
|
||||
result.GetUsedIncludeFiles().insert(includeFile);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -138,7 +155,10 @@ void UsedExtensionsFinder::OnVisitFunctionCallNode(FunctionCallNode& node) {
|
||||
return;
|
||||
}
|
||||
|
||||
usedExtensions.insert(metadata.GetExtension().GetName());
|
||||
result.GetUsedExtensions().insert(metadata.GetExtension().GetName());
|
||||
for (auto&& includeFile : metadata.GetMetadata().GetIncludeFiles()) {
|
||||
result.GetUsedIncludeFiles().insert(includeFile);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -21,18 +21,62 @@ class Behavior;
|
||||
|
||||
namespace gd {
|
||||
|
||||
class GD_CORE_API UsedExtensionsResult {
|
||||
public:
|
||||
/**
|
||||
* The extensions used by the project (or part of it).
|
||||
*/
|
||||
const std::set<gd::String> &GetUsedExtensions() const {
|
||||
return usedExtensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* The include files used at runtime by the project (or part of it).
|
||||
*/
|
||||
const std::set<gd::String> &GetUsedIncludeFiles() const {
|
||||
return usedIncludeFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* The additional files required at runtime by the project (or part of it).
|
||||
*/
|
||||
const std::set<gd::String> &GetUsedRequiredFiles() const {
|
||||
return usedRequiredFiles;
|
||||
}
|
||||
|
||||
/**
|
||||
* The extensions used by the project (or part of it).
|
||||
*/
|
||||
std::set<gd::String> &GetUsedExtensions() { return usedExtensions; }
|
||||
|
||||
/**
|
||||
* The include files used at runtime by the project (or part of it).
|
||||
*/
|
||||
std::set<gd::String> &GetUsedIncludeFiles() { return usedIncludeFiles; }
|
||||
|
||||
/**
|
||||
* The additional files required at runtime by the project (or part of it).
|
||||
*/
|
||||
std::set<gd::String> &GetUsedRequiredFiles() { return usedRequiredFiles; }
|
||||
|
||||
private:
|
||||
std::set<gd::String> usedExtensions;
|
||||
std::set<gd::String> usedIncludeFiles;
|
||||
std::set<gd::String> usedRequiredFiles;
|
||||
};
|
||||
|
||||
class GD_CORE_API UsedExtensionsFinder
|
||||
: public ArbitraryObjectsWorker,
|
||||
public ArbitraryEventsWorkerWithContext,
|
||||
public ExpressionParser2NodeWorker {
|
||||
public:
|
||||
static std::set<gd::String> ScanProject(gd::Project& project);
|
||||
static const UsedExtensionsResult ScanProject(gd::Project& project);
|
||||
|
||||
private:
|
||||
UsedExtensionsFinder(gd::Project& project_) : project(project_){};
|
||||
gd::Project& project;
|
||||
gd::String rootType;
|
||||
std::set<gd::String> usedExtensions;
|
||||
UsedExtensionsResult result;
|
||||
|
||||
// Object Visitor
|
||||
void DoVisitObject(gd::Object& object) override;
|
||||
|
@@ -35,6 +35,16 @@ void ArbitraryResourceWorker::ExposeJson(gd::String& jsonName){
|
||||
// do.
|
||||
};
|
||||
|
||||
void ArbitraryResourceWorker::ExposeTilemap(gd::String& tilemapName){
|
||||
// Nothing to do by default - each child class can define here the action to
|
||||
// do.
|
||||
};
|
||||
|
||||
void ArbitraryResourceWorker::ExposeTileset(gd::String& tilesetName){
|
||||
// Nothing to do by default - each child class can define here the action to
|
||||
// do.
|
||||
};
|
||||
|
||||
void ArbitraryResourceWorker::ExposeVideo(gd::String& videoName){
|
||||
// Nothing to do by default - each child class can define here the action to
|
||||
// do.
|
||||
@@ -92,6 +102,67 @@ void ArbitraryResourceWorker::ExposeResources(
|
||||
}
|
||||
}
|
||||
|
||||
void ArbitraryResourceWorker::ExposeEmbeddeds(gd::String& resourceName) {
|
||||
if (resourcesManagers.empty()) return;
|
||||
gd::ResourcesManager* resourcesManager = resourcesManagers[0];
|
||||
|
||||
gd::Resource& resource = resourcesManager->GetResource(resourceName);
|
||||
|
||||
if (!resource.GetMetadata().empty()) {
|
||||
gd::SerializerElement serializerElement =
|
||||
gd::Serializer::FromJSON(resource.GetMetadata());
|
||||
|
||||
if (serializerElement.HasChild("embeddedResourcesMapping")) {
|
||||
bool anyEmbeddedResourceNameWasRenamed = false;
|
||||
gd::SerializerElement& embeddedResourcesMappingElement =
|
||||
serializerElement.GetChild("embeddedResourcesMapping");
|
||||
|
||||
for (const auto& child :
|
||||
embeddedResourcesMappingElement.GetAllChildren()) {
|
||||
const gd::String& targetResourceName =
|
||||
child.second->GetValue().GetString();
|
||||
|
||||
if (resourcesManager->HasResource(targetResourceName)) {
|
||||
std::cout << targetResourceName << std::endl;
|
||||
gd::Resource& targetResource =
|
||||
resourcesManager->GetResource(targetResourceName);
|
||||
const gd::String& targetResourceKind = targetResource.GetKind();
|
||||
|
||||
gd::String potentiallyUpdatedTargetResourceName = targetResourceName;
|
||||
|
||||
if (targetResourceKind == "audio") {
|
||||
ExposeAudio(potentiallyUpdatedTargetResourceName);
|
||||
} else if (targetResourceKind == "bitmapFont") {
|
||||
ExposeBitmapFont(potentiallyUpdatedTargetResourceName);
|
||||
} else if (targetResourceKind == "font") {
|
||||
ExposeFont(potentiallyUpdatedTargetResourceName);
|
||||
} else if (targetResourceKind == "image") {
|
||||
ExposeImage(potentiallyUpdatedTargetResourceName);
|
||||
} else if (targetResourceKind == "json") {
|
||||
ExposeJson(potentiallyUpdatedTargetResourceName);
|
||||
} else if (targetResourceKind == "tilemap") {
|
||||
ExposeTilemap(potentiallyUpdatedTargetResourceName);
|
||||
} else if (targetResourceKind == "tileset") {
|
||||
ExposeTileset(potentiallyUpdatedTargetResourceName);
|
||||
} else if (targetResourceKind == "video") {
|
||||
ExposeVideo(potentiallyUpdatedTargetResourceName);
|
||||
}
|
||||
|
||||
if (potentiallyUpdatedTargetResourceName != targetResourceName) {
|
||||
// The resource name was renamed. Also update the mapping.
|
||||
child.second->SetStringValue(potentiallyUpdatedTargetResourceName);
|
||||
anyEmbeddedResourceNameWasRenamed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (anyEmbeddedResourceNameWasRenamed) {
|
||||
resource.SetMetadata(gd::Serializer::ToJSON(serializerElement));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ArbitraryResourceWorker::ExposeResource(gd::Resource& resource) {
|
||||
if (!resource.UseFile()) return;
|
||||
|
||||
@@ -154,6 +225,14 @@ class ResourceWorkerInEventsWorker : public ArbitraryEventsWorker {
|
||||
gd::String updatedParameterValue = parameterValue;
|
||||
worker.ExposeJson(updatedParameterValue);
|
||||
instruction.SetParameter(parameterIndex, updatedParameterValue);
|
||||
} else if (parameterMetadata.GetType() == "tilemapResource") {
|
||||
gd::String updatedParameterValue = parameterValue;
|
||||
worker.ExposeTilemap(updatedParameterValue);
|
||||
instruction.SetParameter(parameterIndex, updatedParameterValue);
|
||||
} else if (parameterMetadata.GetType() == "tilesetResource") {
|
||||
gd::String updatedParameterValue = parameterValue;
|
||||
worker.ExposeTileset(updatedParameterValue);
|
||||
instruction.SetParameter(parameterIndex, updatedParameterValue);
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -75,6 +75,16 @@ class GD_CORE_API ArbitraryResourceWorker {
|
||||
*/
|
||||
virtual void ExposeJson(gd::String &jsonName);
|
||||
|
||||
/**
|
||||
* \brief Expose a Tilemap, which is always a reference to a "tilemap" resource.
|
||||
*/
|
||||
virtual void ExposeTilemap(gd::String &tilemapName);
|
||||
|
||||
/**
|
||||
* \brief Expose a Tileset, which is always a reference to a "tileset" resource.
|
||||
*/
|
||||
virtual void ExposeTileset(gd::String &tilesetName);
|
||||
|
||||
/**
|
||||
* \brief Expose a video, which is always a reference to a "video" resource.
|
||||
*/
|
||||
@@ -96,6 +106,11 @@ class GD_CORE_API ArbitraryResourceWorker {
|
||||
*/
|
||||
virtual void ExposeFile(gd::String &resourceFileName) = 0;
|
||||
|
||||
/**
|
||||
* \brief Expose the embedded resources of the specified resource.
|
||||
*/
|
||||
virtual void ExposeEmbeddeds(gd::String &resourceName);
|
||||
|
||||
protected:
|
||||
const std::vector<gd::ResourcesManager *> &GetResources() {
|
||||
return resourcesManagers;
|
||||
|
@@ -40,6 +40,8 @@ class ResourcesInUseHelper : public gd::ArbitraryResourceWorker {
|
||||
std::set<gd::String>& GetAllAudios() { return GetAll("audio"); };
|
||||
std::set<gd::String>& GetAllFonts() { return GetAll("font"); };
|
||||
std::set<gd::String>& GetAllJsons() { return GetAll("json"); };
|
||||
std::set<gd::String>& GetAllTilemaps() { return GetAll("tilemap"); };
|
||||
std::set<gd::String>& GetAllTilesets() { return GetAll("tileset"); };
|
||||
std::set<gd::String>& GetAllVideos() { return GetAll("video"); };
|
||||
std::set<gd::String>& GetAllBitmapFonts() { return GetAll("bitmapFont"); };
|
||||
std::set<gd::String>& GetAll(const gd::String& resourceType) {
|
||||
@@ -47,6 +49,8 @@ class ResourcesInUseHelper : public gd::ArbitraryResourceWorker {
|
||||
if (resourceType == "audio") return allAudios;
|
||||
if (resourceType == "font") return allFonts;
|
||||
if (resourceType == "json") return allJsons;
|
||||
if (resourceType == "tilemap") return allTilemaps;
|
||||
if (resourceType == "tileset") return allTilesets;
|
||||
if (resourceType == "video") return allVideos;
|
||||
if (resourceType == "bitmapFont") return allBitmapFonts;
|
||||
|
||||
@@ -68,6 +72,12 @@ class ResourcesInUseHelper : public gd::ArbitraryResourceWorker {
|
||||
virtual void ExposeJson(gd::String& jsonResourceName) override {
|
||||
allJsons.insert(jsonResourceName);
|
||||
};
|
||||
virtual void ExposeTilemap(gd::String& tilemapResourceName) override {
|
||||
allTilemaps.insert(tilemapResourceName);
|
||||
};
|
||||
virtual void ExposeTileset(gd::String& tilesetResourceName) override {
|
||||
allTilesets.insert(tilesetResourceName);
|
||||
};
|
||||
virtual void ExposeVideo(gd::String& videoResourceName) override {
|
||||
allVideos.insert(videoResourceName);
|
||||
};
|
||||
@@ -80,6 +90,8 @@ class ResourcesInUseHelper : public gd::ArbitraryResourceWorker {
|
||||
std::set<gd::String> allAudios;
|
||||
std::set<gd::String> allFonts;
|
||||
std::set<gd::String> allJsons;
|
||||
std::set<gd::String> allTilemaps;
|
||||
std::set<gd::String> allTilesets;
|
||||
std::set<gd::String> allVideos;
|
||||
std::set<gd::String> allBitmapFonts;
|
||||
std::set<gd::String> emptyResources;
|
||||
|
@@ -49,6 +49,12 @@ class ResourcesRenamer : public gd::ArbitraryResourceWorker {
|
||||
virtual void ExposeJson(gd::String& jsonResourceName) override {
|
||||
RenameIfNeeded(jsonResourceName);
|
||||
};
|
||||
virtual void ExposeTilemap(gd::String& tilemapResourceName) override {
|
||||
RenameIfNeeded(tilemapResourceName);
|
||||
};
|
||||
virtual void ExposeTileset(gd::String& tilesetResourceName) override {
|
||||
RenameIfNeeded(tilesetResourceName);
|
||||
};
|
||||
virtual void ExposeVideo(gd::String& videoResourceName) override {
|
||||
RenameIfNeeded(videoResourceName);
|
||||
};
|
||||
|
@@ -12,6 +12,7 @@
|
||||
#include "GDCore/Project/EventsBasedBehavior.h"
|
||||
#include "GDCore/Project/EventsBasedObject.h"
|
||||
#include "GDCore/Project/EventsFunctionsExtension.h"
|
||||
#include "GDCore/Project/EventsFunction.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
#include "GDCore/Project/PropertyDescriptor.h"
|
||||
#include "GDCore/String.h"
|
||||
@@ -298,4 +299,16 @@ PropertyFunctionGenerator::UnCapitalizeFirstLetter(const gd::String &string) {
|
||||
return string.substr(0, 1).LowerCase() + string.substr(1);
|
||||
}
|
||||
|
||||
void PropertyFunctionGenerator::GenerateConditionSkeleton(
|
||||
gd::Project &project, gd::EventsFunction &eventFunction) {
|
||||
auto &event = dynamic_cast<gd::StandardEvent &>(
|
||||
eventFunction.GetEvents().InsertNewEvent(
|
||||
project, "BuiltinCommonInstructions::Standard", 0));
|
||||
|
||||
gd::Instruction action;
|
||||
action.SetType("SetReturnBoolean");
|
||||
action.AddParameter("True");
|
||||
event.GetActions().Insert(action, 0);
|
||||
}
|
||||
|
||||
} // namespace gd
|
||||
|
@@ -10,6 +10,7 @@ namespace gd {
|
||||
class String;
|
||||
class Project;
|
||||
class EventsFunctionsExtension;
|
||||
class EventsFunction;
|
||||
class EventsBasedBehavior;
|
||||
class EventsBasedObject;
|
||||
class AbstractEventsBasedEntity;
|
||||
@@ -43,6 +44,12 @@ public:
|
||||
const gd::AbstractEventsBasedEntity &eventsBasedEntity,
|
||||
const gd::NamedPropertyDescriptor &property);
|
||||
|
||||
/**
|
||||
* \brief Generate an event with a "return" action.
|
||||
*/
|
||||
static void GenerateConditionSkeleton(gd::Project &project,
|
||||
gd::EventsFunction &eventFunction);
|
||||
|
||||
~PropertyFunctionGenerator();
|
||||
|
||||
private:
|
||||
|
@@ -125,6 +125,11 @@ class GD_CORE_API AbstractEventsBasedEntity {
|
||||
*/
|
||||
static gd::String GetPropertyExpressionName(const gd::String& propertyName) { return "Property" + propertyName; };
|
||||
|
||||
/**
|
||||
* \brief Get the name of the action to toggle a boolean property.
|
||||
*/
|
||||
static gd::String GetPropertyToggleActionName(const gd::String& propertyName) { return "ToggleProperty" + propertyName; };
|
||||
|
||||
/** \name Serialization
|
||||
*/
|
||||
///@{
|
||||
|
@@ -38,7 +38,7 @@ gd::ObjectConfiguration &CustomObjectConfiguration::GetChildObjectConfiguration(
|
||||
return badObjectConfiguration;
|
||||
}
|
||||
const auto &eventsBasedObject = project->GetEventsBasedObject(GetType());
|
||||
|
||||
|
||||
if (!eventsBasedObject.HasObjectNamed(objectName)) {
|
||||
gd::LogError("Tried to get the configuration of a child-object:" + objectName
|
||||
+ " that doesn't exist in the event-based object: " + GetType());
|
||||
@@ -78,7 +78,7 @@ bool CustomObjectConfiguration::UpdateProperty(const gd::String& propertyName,
|
||||
}
|
||||
const auto &eventsBasedObject = project->GetEventsBasedObject(GetType());
|
||||
const auto &properties = eventsBasedObject.GetPropertyDescriptors();
|
||||
|
||||
|
||||
return gd::CustomConfigurationHelper::UpdateProperty(
|
||||
properties,
|
||||
objectContent,
|
||||
@@ -125,8 +125,7 @@ void CustomObjectConfiguration::DoUnserializeFrom(Project& project,
|
||||
}
|
||||
}
|
||||
|
||||
void CustomObjectConfiguration::ExposeResources(
|
||||
gd::ArbitraryResourceWorker& worker) {
|
||||
void CustomObjectConfiguration::ExposeResources(gd::ArbitraryResourceWorker& worker) {
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties = GetProperties();
|
||||
|
||||
for (auto& property : properties) {
|
||||
@@ -148,6 +147,10 @@ void CustomObjectConfiguration::ExposeResources(
|
||||
worker.ExposeVideo(newPropertyValue);
|
||||
} else if (resourceType == "json") {
|
||||
worker.ExposeJson(newPropertyValue);
|
||||
} else if (resourceType == "tilemap") {
|
||||
worker.ExposeTilemap(newPropertyValue);
|
||||
} else if (resourceType == "tileset") {
|
||||
worker.ExposeTileset(newPropertyValue);
|
||||
} else if (resourceType == "bitmapFont") {
|
||||
worker.ExposeBitmapFont(newPropertyValue);
|
||||
}
|
||||
|
@@ -87,9 +87,9 @@ class CustomObjectConfiguration : public gd::ObjectConfiguration {
|
||||
/**
|
||||
* Initialize configuration using another configuration. Used by copy-ctor
|
||||
* and assign-op.
|
||||
*
|
||||
*
|
||||
* Don't forget to update me if members were changed!
|
||||
*
|
||||
*
|
||||
* It's needed because there is no default copy for childObjectConfigurations
|
||||
* and it must be a deep copy.
|
||||
*/
|
||||
|
@@ -125,6 +125,13 @@ class GD_CORE_API EventsBasedBehavior: public AbstractEventsBasedEntity {
|
||||
return "SharedProperty" + propertyName;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Get the name of the action to toggle a boolean shared property.
|
||||
*/
|
||||
static gd::String GetSharedPropertyToggleActionName(const gd::String &propertyName) {
|
||||
return "ToggleSharedProperty" + propertyName;
|
||||
};
|
||||
|
||||
void SerializeTo(SerializerElement& element) const override;
|
||||
|
||||
void UnserializeFrom(gd::Project& project,
|
||||
|
@@ -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
|
||||
|
@@ -7,13 +7,14 @@
|
||||
#ifndef GDCORE_INITIALINSTANCE_H
|
||||
#define GDCORE_INITIALINSTANCE_H
|
||||
#include <map>
|
||||
|
||||
#include "GDCore/Project/VariablesContainer.h"
|
||||
#include "GDCore/String.h"
|
||||
namespace gd {
|
||||
class PropertyDescriptor;
|
||||
class Project;
|
||||
class Layout;
|
||||
}
|
||||
} // namespace gd
|
||||
|
||||
namespace gd {
|
||||
|
||||
@@ -127,7 +128,8 @@ class GD_CORE_API InitialInstance {
|
||||
void SetCustomHeight(double height_) { height = height_; }
|
||||
|
||||
/**
|
||||
* \brief Return true if the instance is locked and cannot be moved in the IDE.
|
||||
* \brief Return true if the instance is locked and cannot be moved in the
|
||||
* IDE.
|
||||
*/
|
||||
bool IsLocked() const { return locked; };
|
||||
|
||||
@@ -240,7 +242,7 @@ class GD_CORE_API InitialInstance {
|
||||
* \brief Set the value of a string property stored in the instance.
|
||||
*/
|
||||
void SetRawStringProperty(const gd::String& name, const gd::String& value);
|
||||
///@}
|
||||
///@}
|
||||
|
||||
/** \name Saving and loading
|
||||
* Members functions related to serialization.
|
||||
@@ -272,18 +274,19 @@ class GD_CORE_API InitialInstance {
|
||||
stringProperties; ///< More data which can be used by the object
|
||||
|
||||
gd::String objectName; ///< Object name
|
||||
double x; ///< Object initial X position
|
||||
double y; ///< Object initial Y position
|
||||
double angle; ///< Object initial angle
|
||||
double x; ///< Object initial X position
|
||||
double y; ///< Object initial Y position
|
||||
double angle; ///< Object initial angle
|
||||
int zOrder; ///< Object initial Z order
|
||||
gd::String layer; ///< Object initial layer
|
||||
bool personalizedSize; ///< True if object has a custom size
|
||||
double width; ///< Object custom width
|
||||
double height; ///< Object custom height
|
||||
double width; ///< Object custom width
|
||||
double height; ///< Object custom height
|
||||
gd::VariablesContainer initialVariables; ///< Instance specific variables
|
||||
bool locked; ///< True if the instance is locked
|
||||
bool sealed; ///< True if the instance is sealed
|
||||
mutable gd::String persistentUuid; ///< A persistent random version 4 UUID, useful for hot reloading.
|
||||
mutable gd::String persistentUuid; ///< A persistent random version 4 UUID,
|
||||
///< useful for hot reloading.
|
||||
|
||||
static gd::String*
|
||||
badStringProperyValue; ///< Empty string returned by GetRawStringProperty
|
||||
|
@@ -60,7 +60,6 @@ void InitialInstancesContainer::IterateOverInstancesWithZOrdering(
|
||||
for (auto& instance : sortedInstances) func(instance);
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
gd::InitialInstance& InitialInstancesContainer::InsertNewInitialInstance() {
|
||||
gd::InitialInstance newInstance;
|
||||
initialInstances.push_back(newInstance);
|
||||
@@ -173,7 +172,6 @@ void InitialInstancesContainer::SerializeTo(SerializerElement& element) const {
|
||||
}
|
||||
|
||||
void InitialInstancesContainer::Clear() { initialInstances.clear(); }
|
||||
#endif
|
||||
|
||||
InitialInstanceFunctor::~InitialInstanceFunctor(){};
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -12,6 +12,7 @@
|
||||
|
||||
#include "GDCore/Project/Behavior.h"
|
||||
#include "GDCore/Project/EffectsContainer.h"
|
||||
#include "GDCore/Project/ResourcesManager.h"
|
||||
#include "GDCore/Project/VariablesContainer.h"
|
||||
#include "GDCore/String.h"
|
||||
#include "GDCore/Tools/MakeUnique.h"
|
||||
|
@@ -22,8 +22,8 @@
|
||||
#include "GDCore/IDE/Events/UsedExtensionsFinder.h"
|
||||
#include "GDCore/IDE/PlatformManager.h"
|
||||
#include "GDCore/IDE/Project/ArbitraryResourceWorker.h"
|
||||
#include "GDCore/Project/EventsFunctionsExtension.h"
|
||||
#include "GDCore/Project/CustomObjectConfiguration.h"
|
||||
#include "GDCore/Project/EventsFunctionsExtension.h"
|
||||
#include "GDCore/Project/ExternalEvents.h"
|
||||
#include "GDCore/Project/ExternalLayout.h"
|
||||
#include "GDCore/Project/Layout.h"
|
||||
@@ -347,6 +347,49 @@ void Project::RemoveExternalEvents(const gd::String& name) {
|
||||
externalEvents.erase(events);
|
||||
}
|
||||
|
||||
void Project::MoveLayout(std::size_t oldIndex, std::size_t newIndex) {
|
||||
if (oldIndex >= scenes.size() || newIndex >= scenes.size()) return;
|
||||
|
||||
std::unique_ptr<gd::Layout> scene = std::move(scenes[oldIndex]);
|
||||
scenes.erase(scenes.begin() + oldIndex);
|
||||
scenes.insert(scenes.begin() + newIndex, std::move(scene));
|
||||
};
|
||||
|
||||
void Project::MoveExternalEvents(std::size_t oldIndex, std::size_t newIndex) {
|
||||
if (oldIndex >= externalEvents.size() || newIndex >= externalEvents.size())
|
||||
return;
|
||||
|
||||
std::unique_ptr<gd::ExternalEvents> externalEventsItem =
|
||||
std::move(externalEvents[oldIndex]);
|
||||
externalEvents.erase(externalEvents.begin() + oldIndex);
|
||||
externalEvents.insert(externalEvents.begin() + newIndex,
|
||||
std::move(externalEventsItem));
|
||||
};
|
||||
|
||||
void Project::MoveExternalLayout(std::size_t oldIndex, std::size_t newIndex) {
|
||||
if (oldIndex >= externalLayouts.size() || newIndex >= externalLayouts.size())
|
||||
return;
|
||||
|
||||
std::unique_ptr<gd::ExternalLayout> externalLayout =
|
||||
std::move(externalLayouts[oldIndex]);
|
||||
externalLayouts.erase(externalLayouts.begin() + oldIndex);
|
||||
externalLayouts.insert(externalLayouts.begin() + newIndex,
|
||||
std::move(externalLayout));
|
||||
};
|
||||
|
||||
void Project::MoveEventsFunctionsExtension(std::size_t oldIndex,
|
||||
std::size_t newIndex) {
|
||||
if (oldIndex >= eventsFunctionsExtensions.size() ||
|
||||
newIndex >= eventsFunctionsExtensions.size())
|
||||
return;
|
||||
|
||||
std::unique_ptr<gd::EventsFunctionsExtension> eventsFunctionsExtension =
|
||||
std::move(eventsFunctionsExtensions[oldIndex]);
|
||||
eventsFunctionsExtensions.erase(eventsFunctionsExtensions.begin() + oldIndex);
|
||||
eventsFunctionsExtensions.insert(eventsFunctionsExtensions.begin() + newIndex,
|
||||
std::move(eventsFunctionsExtension));
|
||||
};
|
||||
|
||||
void Project::SwapExternalEvents(std::size_t first, std::size_t second) {
|
||||
if (first >= externalEvents.size() || second >= externalEvents.size()) return;
|
||||
|
||||
@@ -593,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");
|
||||
@@ -603,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");
|
||||
@@ -832,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");
|
||||
@@ -839,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();
|
||||
@@ -939,8 +996,10 @@ void Project::ExposeResources(gd::ArbitraryResourceWorker& worker) {
|
||||
// (this time for effects). Ideally, this method could be moved outside of
|
||||
// gd::Project.
|
||||
|
||||
gd::ResourcesManager* resourcesManager = &GetResourcesManager();
|
||||
|
||||
// Add project resources
|
||||
worker.ExposeResources(&GetResourcesManager());
|
||||
worker.ExposeResources(resourcesManager);
|
||||
platformSpecificAssets.ExposeResources(worker);
|
||||
|
||||
// Add layouts resources
|
||||
@@ -1052,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;
|
||||
@@ -1062,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.
|
||||
@@ -165,7 +176,7 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
*/
|
||||
const gd::String& GetPackageName() const { return packageName; }
|
||||
|
||||
/**
|
||||
/**
|
||||
* \brief Change the slug of the template from which the project is created.
|
||||
*/
|
||||
void SetTemplateSlug(const gd::String& templateSlug_) {
|
||||
@@ -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.
|
||||
*
|
||||
@@ -458,7 +479,7 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
|
||||
/**
|
||||
* Create an object of the given type with the specified name.
|
||||
*
|
||||
*
|
||||
* \param type The type of the object
|
||||
* \param name The name of the object
|
||||
*/
|
||||
@@ -467,7 +488,7 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
|
||||
/**
|
||||
* Create an object configuration of the given type.
|
||||
*
|
||||
*
|
||||
* \param type The type of the object
|
||||
*/
|
||||
std::unique_ptr<gd::ObjectConfiguration> CreateObjectConfiguration(
|
||||
@@ -525,6 +546,11 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
*/
|
||||
std::size_t GetLayoutPosition(const gd::String& name) const;
|
||||
|
||||
/**
|
||||
* Change the position of the specified layout.
|
||||
*/
|
||||
void MoveLayout(std::size_t oldIndex, std::size_t newIndex);
|
||||
|
||||
/**
|
||||
* \brief Swap the specified layouts.
|
||||
*
|
||||
@@ -628,6 +654,11 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
*/
|
||||
std::size_t GetExternalEventsPosition(const gd::String& name) const;
|
||||
|
||||
/**
|
||||
* Change the position of the specified external events.
|
||||
*/
|
||||
void MoveExternalEvents(std::size_t oldIndex, std::size_t newIndex);
|
||||
|
||||
/**
|
||||
* \brief Swap the specified external events.
|
||||
*
|
||||
@@ -702,6 +733,11 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
*/
|
||||
std::size_t GetExternalLayoutPosition(const gd::String& name) const;
|
||||
|
||||
/**
|
||||
* Change the position of the specified external layout.
|
||||
*/
|
||||
void MoveExternalLayout(std::size_t oldIndex, std::size_t newIndex);
|
||||
|
||||
/**
|
||||
* \brief Swap the specified external layouts.
|
||||
*
|
||||
@@ -791,6 +827,11 @@ class GD_CORE_API Project : public ObjectsContainer {
|
||||
*/
|
||||
std::size_t GetEventsFunctionsExtensionPosition(const gd::String& name) const;
|
||||
|
||||
/**
|
||||
* Change the position of the specified events function extension.
|
||||
*/
|
||||
void MoveEventsFunctionsExtension(std::size_t oldIndex, std::size_t newIndex);
|
||||
|
||||
/**
|
||||
* \brief Swap the specified events functions extensions.
|
||||
*
|
||||
@@ -1023,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.
|
||||
@@ -1042,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
|
||||
|
@@ -85,6 +85,10 @@ std::shared_ptr<Resource> ResourcesManager::CreateResource(
|
||||
return std::make_shared<VideoResource>();
|
||||
else if (kind == "json")
|
||||
return std::make_shared<JsonResource>();
|
||||
else if (kind == "tilemap")
|
||||
return std::make_shared<TilemapResource>();
|
||||
else if (kind == "tileset")
|
||||
return std::make_shared<TilesetResource>();
|
||||
else if (kind == "bitmapFont")
|
||||
return std::make_shared<BitmapFontResource>();
|
||||
|
||||
@@ -650,6 +654,74 @@ bool JsonResource::UpdateProperty(const gd::String& name,
|
||||
return true;
|
||||
}
|
||||
|
||||
void TilemapResource::SetFile(const gd::String& newFile) {
|
||||
file = NormalizePathSeparator(newFile);
|
||||
}
|
||||
|
||||
void TilemapResource::UnserializeFrom(const SerializerElement& element) {
|
||||
SetUserAdded(element.GetBoolAttribute("userAdded"));
|
||||
SetFile(element.GetStringAttribute("file"));
|
||||
DisablePreload(element.GetBoolAttribute("disablePreload", false));
|
||||
}
|
||||
|
||||
void TilemapResource::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("userAdded", IsUserAdded());
|
||||
element.SetAttribute("file", GetFile());
|
||||
element.SetAttribute("disablePreload", IsPreloadDisabled());
|
||||
}
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> TilemapResource::GetProperties()
|
||||
const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties;
|
||||
properties["disablePreload"]
|
||||
.SetValue(disablePreload ? "true" : "false")
|
||||
.SetType("Boolean")
|
||||
.SetLabel(_("Disable preloading at game startup"));
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
bool TilemapResource::UpdateProperty(const gd::String& name,
|
||||
const gd::String& value) {
|
||||
if (name == "disablePreload") disablePreload = value == "1";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TilesetResource::SetFile(const gd::String& newFile) {
|
||||
file = NormalizePathSeparator(newFile);
|
||||
}
|
||||
|
||||
void TilesetResource::UnserializeFrom(const SerializerElement& element) {
|
||||
SetUserAdded(element.GetBoolAttribute("userAdded"));
|
||||
SetFile(element.GetStringAttribute("file"));
|
||||
DisablePreload(element.GetBoolAttribute("disablePreload", false));
|
||||
}
|
||||
|
||||
void TilesetResource::SerializeTo(SerializerElement& element) const {
|
||||
element.SetAttribute("userAdded", IsUserAdded());
|
||||
element.SetAttribute("file", GetFile());
|
||||
element.SetAttribute("disablePreload", IsPreloadDisabled());
|
||||
}
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> TilesetResource::GetProperties()
|
||||
const {
|
||||
std::map<gd::String, gd::PropertyDescriptor> properties;
|
||||
properties["disablePreload"]
|
||||
.SetValue(disablePreload ? "true" : "false")
|
||||
.SetType("Boolean")
|
||||
.SetLabel(_("Disable preloading at game startup"));
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
bool TilesetResource::UpdateProperty(const gd::String& name,
|
||||
const gd::String& value) {
|
||||
if (name == "disablePreload") disablePreload = value == "1";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void BitmapFontResource::SetFile(const gd::String& newFile) {
|
||||
file = NormalizePathSeparator(newFile);
|
||||
}
|
||||
|
@@ -373,6 +373,88 @@ class GD_CORE_API JsonResource : public Resource {
|
||||
gd::String file;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Describe a tilemap file used by a project.
|
||||
*
|
||||
* \see Resource
|
||||
* \ingroup ResourcesManagement
|
||||
*/
|
||||
class GD_CORE_API TilemapResource : public Resource {
|
||||
public:
|
||||
TilemapResource() : Resource(), disablePreload(false) { SetKind("tilemap"); };
|
||||
virtual ~TilemapResource(){};
|
||||
virtual TilemapResource* Clone() const override {
|
||||
return new TilemapResource(*this);
|
||||
}
|
||||
|
||||
virtual const gd::String& GetFile() const override { return file; };
|
||||
virtual void SetFile(const gd::String& newFile) override;
|
||||
|
||||
virtual bool UseFile() const override { return true; }
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> GetProperties() const override;
|
||||
bool UpdateProperty(const gd::String& name, const gd::String& value) override;
|
||||
|
||||
void SerializeTo(SerializerElement& element) const override;
|
||||
|
||||
void UnserializeFrom(const SerializerElement& element) override;
|
||||
|
||||
/**
|
||||
* \brief Return true if the loading at game startup must be disabled
|
||||
*/
|
||||
bool IsPreloadDisabled() const { return disablePreload; }
|
||||
|
||||
/**
|
||||
* \brief Set if the tilemap preload at game startup must be disabled
|
||||
*/
|
||||
void DisablePreload(bool disable = true) { disablePreload = disable; }
|
||||
|
||||
private:
|
||||
bool disablePreload; ///< If "true", don't load the tilemap at game startup
|
||||
gd::String file;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Describe a tileset file used by a project.
|
||||
*
|
||||
* \see Resource
|
||||
* \ingroup ResourcesManagement
|
||||
*/
|
||||
class GD_CORE_API TilesetResource : public Resource {
|
||||
public:
|
||||
TilesetResource() : Resource(), disablePreload(false) { SetKind("tileset"); };
|
||||
virtual ~TilesetResource(){};
|
||||
virtual TilesetResource* Clone() const override {
|
||||
return new TilesetResource(*this);
|
||||
}
|
||||
|
||||
virtual const gd::String& GetFile() const override { return file; };
|
||||
virtual void SetFile(const gd::String& newFile) override;
|
||||
|
||||
virtual bool UseFile() const override { return true; }
|
||||
|
||||
std::map<gd::String, gd::PropertyDescriptor> GetProperties() const override;
|
||||
bool UpdateProperty(const gd::String& name, const gd::String& value) override;
|
||||
|
||||
void SerializeTo(SerializerElement& element) const override;
|
||||
|
||||
void UnserializeFrom(const SerializerElement& element) override;
|
||||
|
||||
/**
|
||||
* \brief Return true if the loading at game startup must be disabled
|
||||
*/
|
||||
bool IsPreloadDisabled() const { return disablePreload; }
|
||||
|
||||
/**
|
||||
* \brief Set if the tilemap preload at game startup must be disabled
|
||||
*/
|
||||
void DisablePreload(bool disable = true) { disablePreload = disable; }
|
||||
|
||||
private:
|
||||
bool disablePreload; ///< If "true", don't load the tilemap at game startup
|
||||
gd::String file;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Describe a bitmap font file used by a project.
|
||||
*
|
||||
|
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
|
@@ -3,8 +3,7 @@
|
||||
#ifndef GDCORE_VECTOR2_H
|
||||
#define GDCORE_VECTOR2_H
|
||||
|
||||
namespace gd
|
||||
{
|
||||
namespace gd {
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -12,11 +11,12 @@ namespace gd
|
||||
// Copyright (C) 2007-2016 Laurent Gomila (laurent@sfml-dev.org)
|
||||
//
|
||||
// This software is provided 'as-is', without any express or implied warranty.
|
||||
// In no event will the authors be held liable for any damages arising from the use of this software.
|
||||
// In no event will the authors be held liable for any damages arising from the
|
||||
// use of this software.
|
||||
//
|
||||
// Permission is granted to anyone to use this software for any purpose,
|
||||
// including commercial applications, and to alter it and redistribute it freely,
|
||||
// subject to the following restrictions:
|
||||
// including commercial applications, and to alter it and redistribute it
|
||||
// freely, subject to the following restrictions:
|
||||
//
|
||||
// 1. The origin of this software must not be misrepresented;
|
||||
// you must not claim that you wrote the original software.
|
||||
|
@@ -187,7 +187,7 @@ void SetupProjectWithDummyPlatform(gd::Project& project,
|
||||
.SetDefaultValue("\"\"")
|
||||
.AddParameter("camera", _("Camera"), "", true)
|
||||
.SetDefaultValue("0")
|
||||
.SetFunctionName("getMouseX");
|
||||
.SetFunctionName("getCursorX");
|
||||
extension
|
||||
->AddExpression("GetGlobalVariableAsNumber",
|
||||
"Get me a global variable value",
|
||||
|
@@ -217,7 +217,7 @@ TEST_CASE("ExpressionCodeGenerator", "[common][events]") {
|
||||
REQUIRE(node);
|
||||
node->Visit(expressionCodeGenerator);
|
||||
REQUIRE(expressionCodeGenerator.GetOutput() ==
|
||||
"getMouseX(\"\", \"layer1\", 2 + 2)");
|
||||
"getCursorX(\"\", \"layer1\", 2 + 2)");
|
||||
// (first argument is the currentScene)
|
||||
}
|
||||
SECTION("with last optional parameter omit") {
|
||||
@@ -231,7 +231,7 @@ TEST_CASE("ExpressionCodeGenerator", "[common][events]") {
|
||||
REQUIRE(node);
|
||||
node->Visit(expressionCodeGenerator);
|
||||
REQUIRE(expressionCodeGenerator.GetOutput() ==
|
||||
"getMouseX(\"\", \"layer1\", 0)");
|
||||
"getCursorX(\"\", \"layer1\", 0)");
|
||||
// (first argument is the currentScene)
|
||||
}
|
||||
SECTION("with last optional parameter omit (deprecated way)") {
|
||||
@@ -245,7 +245,7 @@ TEST_CASE("ExpressionCodeGenerator", "[common][events]") {
|
||||
REQUIRE(node);
|
||||
node->Visit(expressionCodeGenerator);
|
||||
REQUIRE(expressionCodeGenerator.GetOutput() ==
|
||||
"getMouseX(\"\", \"layer1\", 0)");
|
||||
"getCursorX(\"\", \"layer1\", 0)");
|
||||
// (first argument is the currentScene)
|
||||
}
|
||||
SECTION("with explicit comma (deprecated way)") {
|
||||
@@ -258,7 +258,7 @@ TEST_CASE("ExpressionCodeGenerator", "[common][events]") {
|
||||
REQUIRE(node);
|
||||
node->Visit(expressionCodeGenerator);
|
||||
REQUIRE(expressionCodeGenerator.GetOutput() ==
|
||||
"getMouseX(\"\", \"\", 0)");
|
||||
"getCursorX(\"\", \"\", 0)");
|
||||
// (first argument is the currentScene)
|
||||
}
|
||||
}
|
||||
@@ -624,7 +624,7 @@ TEST_CASE("ExpressionCodeGenerator", "[common][events]") {
|
||||
REQUIRE(node);
|
||||
node->Visit(expressionCodeGenerator);
|
||||
REQUIRE(expressionCodeGenerator.GetOutput() ==
|
||||
"-(+(-(getMouseX(\"\", \"\", 0))))");
|
||||
"-(+(-(getCursorX(\"\", \"\", 0))))");
|
||||
// (first argument is the currentScene)
|
||||
}
|
||||
}
|
||||
|
@@ -19,15 +19,77 @@ TEST_CASE("ResourcesRenamer", "[common]") {
|
||||
gd::ResourcesRenamer resourcesRenamer(renamings);
|
||||
|
||||
gd::Project project;
|
||||
|
||||
// Add "classic", plain resources.
|
||||
gd::ImageResource resource1;
|
||||
resource1.SetName("Resource1");
|
||||
project.GetResourcesManager().AddResource(resource1);
|
||||
gd::ImageResource resource2;
|
||||
resource2.SetName("Resource2");
|
||||
project.GetResourcesManager().AddResource(resource2);
|
||||
|
||||
// Add usage of some resources.
|
||||
project.GetPlatformSpecificAssets().Set(
|
||||
"android", "some-icon", "Resource1");
|
||||
project.GetPlatformSpecificAssets().Set(
|
||||
"android", "some-other-icon", "Resource2");
|
||||
|
||||
project.ExposeResources(resourcesRenamer);
|
||||
|
||||
// Check that resources were renamed were used.
|
||||
REQUIRE(project.GetPlatformSpecificAssets().Get("android", "some-icon") ==
|
||||
"RenamedResource1");
|
||||
REQUIRE(project.GetPlatformSpecificAssets().Get(
|
||||
"android", "some-other-icon") == "Resource2");
|
||||
}
|
||||
|
||||
SECTION("It renames embedded resources") {
|
||||
std::map<gd::String, gd::String> renamings = {
|
||||
{"Resource1", "RenamedResource1"}};
|
||||
gd::ResourcesRenamer resourcesRenamer(renamings);
|
||||
|
||||
gd::Project project;
|
||||
|
||||
// Add "classic", plain resources.
|
||||
gd::ImageResource resource1;
|
||||
resource1.SetName("Resource1");
|
||||
project.GetResourcesManager().AddResource(resource1);
|
||||
gd::ImageResource resource2;
|
||||
resource2.SetName("Resource2");
|
||||
project.GetResourcesManager().AddResource(resource2);
|
||||
|
||||
// Add a resource containing a mapping to other resources.
|
||||
gd::JsonResource jsonResourceWithEmbeddeds;
|
||||
jsonResourceWithEmbeddeds.SetName("Resource3");
|
||||
jsonResourceWithEmbeddeds.SetMetadata(
|
||||
"{ \"embeddedResourcesMapping\": {\"some-resource-name\": "
|
||||
"\"Resource1\", \"some-other-resource-name\": \"Resource2\"} }");
|
||||
project.GetResourcesManager().AddResource(jsonResourceWithEmbeddeds);
|
||||
|
||||
// Add usage of some resources.
|
||||
project.GetPlatformSpecificAssets().Set(
|
||||
"android", "some-icon", "Resource1");
|
||||
project.GetPlatformSpecificAssets().Set(
|
||||
"android", "some-other-icon", "Resource2");
|
||||
|
||||
project.ExposeResources(resourcesRenamer);
|
||||
|
||||
// TODO: This should not be necessary, but for now not all resources support embeddeds,
|
||||
// so we must call it manually:
|
||||
gd::String resource3Name = "Resource3";
|
||||
resourcesRenamer.ExposeEmbeddeds(resource3Name);
|
||||
|
||||
// Check that resources were renamed were used.
|
||||
REQUIRE(project.GetPlatformSpecificAssets().Get("android", "some-icon") ==
|
||||
"RenamedResource1");
|
||||
REQUIRE(project.GetPlatformSpecificAssets().Get(
|
||||
"android", "some-other-icon") == "Resource2");
|
||||
|
||||
// Check that the names were also updated in the embedded resources mapping.
|
||||
REQUIRE(project.GetResourcesManager().HasResource("Resource3") == true);
|
||||
REQUIRE(
|
||||
project.GetResourcesManager().GetResource("Resource3").GetMetadata() ==
|
||||
"{\"embeddedResourcesMapping\":{\"some-resource-name\":"
|
||||
"\"RenamedResource1\",\"some-other-resource-name\":\"Resource2\"}}");
|
||||
}
|
||||
}
|
||||
|
@@ -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;
|
||||
},
|
||||
|
@@ -1,10 +1,46 @@
|
||||
namespace gdjs {
|
||||
declare var admob: any;
|
||||
declare var cordova: any;
|
||||
|
||||
export namespace adMob {
|
||||
const logger = new gdjs.Logger('AdMob');
|
||||
|
||||
export enum AdSizeType {
|
||||
const testAdIds = {
|
||||
appOpen: {
|
||||
android: 'ca-app-pub-3940256099942544/3419835294',
|
||||
ios: 'ca-app-pub-3940256099942544/5662855259',
|
||||
},
|
||||
banner: {
|
||||
android: 'ca-app-pub-3940256099942544/6300978111',
|
||||
ios: 'ca-app-pub-3940256099942544/2934735716',
|
||||
},
|
||||
interstitial: {
|
||||
android: 'ca-app-pub-3940256099942544/1033173712',
|
||||
ios: 'ca-app-pub-3940256099942544/4411468910',
|
||||
},
|
||||
interstitialVideo: {
|
||||
android: 'ca-app-pub-3940256099942544/8691691433',
|
||||
ios: 'ca-app-pub-3940256099942544/5135589807',
|
||||
},
|
||||
rewarded: {
|
||||
android: 'ca-app-pub-3940256099942544/5224354917',
|
||||
ios: 'ca-app-pub-3940256099942544/1712485313',
|
||||
},
|
||||
rewardedInterstitial: {
|
||||
android: 'ca-app-pub-3940256099942544/5354046379',
|
||||
ios: 'ca-app-pub-3940256099942544/6978759866',
|
||||
},
|
||||
native: {
|
||||
android: 'ca-app-pub-3940256099942544/2247696110',
|
||||
ios: 'ca-app-pub-3940256099942544/3986624511',
|
||||
},
|
||||
nativeVideo: {
|
||||
android: 'ca-app-pub-3940256099942544/1044960115',
|
||||
ios: 'ca-app-pub-3940256099942544/2521693316',
|
||||
},
|
||||
};
|
||||
|
||||
enum AdSizeType {
|
||||
BANNER,
|
||||
LARGE_BANNER,
|
||||
MEDIUM_RECTANGLE,
|
||||
@@ -13,31 +49,113 @@ namespace gdjs {
|
||||
SMART_BANNER,
|
||||
}
|
||||
|
||||
// Banner
|
||||
let bannerAndroidId = '';
|
||||
let bannerIosId = '';
|
||||
let bannerPosition: 'top' | 'bottom' = 'top';
|
||||
let bannerRequestedAdSizeType: AdSizeType = AdSizeType.SMART_BANNER;
|
||||
const adSizeTypes = {
|
||||
BANNER: AdSizeType.BANNER,
|
||||
LARGE_BANNER: AdSizeType.LARGE_BANNER,
|
||||
MEDIUM_RECTANGLE: AdSizeType.MEDIUM_RECTANGLE,
|
||||
FULL_BANNER: AdSizeType.FULL_BANNER,
|
||||
LEADERBOARD: AdSizeType.LEADERBOARD,
|
||||
SMART_BANNER: AdSizeType.SMART_BANNER,
|
||||
};
|
||||
|
||||
let bannerLoading = false;
|
||||
let bannerErrored = false;
|
||||
let bannerShowing = false;
|
||||
enum AppOpenAdOrientation {
|
||||
Portrait = 1,
|
||||
PortraitUpsideDown = 2,
|
||||
LandscapeRight = 3,
|
||||
LandscapeLeft = 4,
|
||||
}
|
||||
|
||||
// Admob does not initialize automatically, so we store a flag to know if it's initialized.
|
||||
let admobStarted = false;
|
||||
let isUsingTestAds = false;
|
||||
|
||||
// Banner
|
||||
let banner;
|
||||
let bannerRequestedAdSizeType: AdSizeType = AdSizeType.SMART_BANNER;
|
||||
let bannerConfigured = false; // Becomes true when the user configures the ad id and the position of the banner.
|
||||
let bannerLoaded = false; // Becomes true when the banner is loaded by loaded.
|
||||
let bannerShowing = false; // Becomes true when loaded or when the user shows/hides the banner.
|
||||
let bannerErrored = false; // Becomes true when the banner fails to load.
|
||||
|
||||
// Interstitial
|
||||
let interstitialLoading = false;
|
||||
let interstitialReady = false;
|
||||
let interstitialErrored = false;
|
||||
let interstitialShowing = false;
|
||||
let interstitial;
|
||||
let interstitialLoading = false; // Becomes true when the interstitial is loading.
|
||||
let interstitialReady = false; // Becomes true when the interstitial is loaded and ready to be shown.
|
||||
let interstitialShowing = false; // Becomes true when the interstitial is showing.
|
||||
let interstitialErrored = false; // Becomes true when the interstitial fails to load.
|
||||
|
||||
// Reward video
|
||||
let videoLoading = false;
|
||||
let videoReady = false;
|
||||
let videoErrored = false;
|
||||
let videoShowing = false;
|
||||
let videoRewardReceived = false;
|
||||
// App Open
|
||||
let appOpen;
|
||||
let appOpenLoading = false; // Becomes true when the appOpen is loading.
|
||||
let appOpenReady = false; // Becomes true when the appOpen is loaded and ready to be shown.
|
||||
let appOpenShowing = false; // Becomes true when the appOpen is showing.
|
||||
let appOpenErrored = false; // Becomes true when the appOpen fails to load.
|
||||
|
||||
// Rewarded interstitial
|
||||
let rewardedInterstitial;
|
||||
let rewardedInterstitialLoading = false; // Becomes true when the interstitial is loading.
|
||||
let rewardedInterstitialReady = false; // Becomes true when the interstitial is loaded and ready to be shown.
|
||||
let rewardedInterstitialShowing = false; // Becomes true when the interstitial is showing.
|
||||
let rewardedInterstitialRewardReceived = false; // Becomes true when the interstitial is closed and the reward is received.
|
||||
let rewardedInterstitialErrored = false; // Becomes true when the interstitial fails to load.
|
||||
|
||||
// Rewarded video
|
||||
let rewardedVideo;
|
||||
let rewardedVideoLoading = false; // Becomes true when the video is loading.
|
||||
let rewardedVideoReady = false; // Becomes true when the video is loaded and ready to be shown.
|
||||
let rewardedVideoShowing = false; // Becomes true when the video is showing.
|
||||
let rewardedVideoRewardReceived = false; // Becomes true when the video is closed and the reward is received.
|
||||
let rewardedVideoErrored = false; // Becomes true when the video fails to load.
|
||||
|
||||
let npaValue = '0'; // TODO: expose an API to change this and also an automatic way using the consent SDK.
|
||||
|
||||
// Admob initialization listener
|
||||
document.addEventListener(
|
||||
'deviceready',
|
||||
async () => {
|
||||
// Obtain user consent ?
|
||||
|
||||
await admob.start();
|
||||
|
||||
logger.info('AdMob succesfully started.');
|
||||
admobStarted = true;
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
/**
|
||||
* Helper to know if we are on mobile and admob is correctly initialized.
|
||||
*/
|
||||
const checkIfAdMobIsAvailable = () => {
|
||||
if (typeof cordova === 'undefined') {
|
||||
logger.warn('We are not on mobile, AdMob will not be available.');
|
||||
return false;
|
||||
}
|
||||
if (typeof admob === 'undefined' || !admobStarted) {
|
||||
logger.warn('AdMob has not been configured or started properly.');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper to get the correct ad id depending on the platform. Android and iOS use different ids.
|
||||
*/
|
||||
const getAdUnitId = (androidAdUnitId, iosAdUnitId, type) => {
|
||||
if (typeof cordova === 'undefined') {
|
||||
logger.warn('Cordova is not available.');
|
||||
return;
|
||||
}
|
||||
if (cordova.platformId === 'android') {
|
||||
return isUsingTestAds ? testAdIds[type].android : androidAdUnitId;
|
||||
} else if (cordova.platformId === 'ios') {
|
||||
return isUsingTestAds ? testAdIds[type].ios : iosAdUnitId;
|
||||
}
|
||||
|
||||
logger.error('Unsupported platform: ', cordova.platformId);
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Activate or deactivate the test mode ("development" mode).
|
||||
* When activated, tests ads will be served instead of real ones.
|
||||
@@ -47,43 +165,116 @@ namespace gdjs {
|
||||
* account being flagged for invalid activity.
|
||||
*/
|
||||
export const setTestMode = (enable: boolean) => {
|
||||
if (typeof admob === 'undefined') {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
|
||||
isUsingTestAds = enable;
|
||||
};
|
||||
|
||||
// -------------------
|
||||
// ---- App Open -----
|
||||
// -------------------
|
||||
export const isAppOpenLoading = () => appOpenLoading;
|
||||
export const isAppOpenReady = () => appOpenReady;
|
||||
export const isAppOpenShowing = () => appOpenShowing;
|
||||
export const isAppOpenErrored = () => appOpenErrored;
|
||||
|
||||
/** Load an AppOpen. */
|
||||
export const loadAppOpen = async (
|
||||
androidAdUnitId,
|
||||
iosAdUnitId,
|
||||
displayLandscape,
|
||||
displayWhenLoaded
|
||||
) => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
// If an appOpen is already loading or showing, we don't stop it.
|
||||
if (appOpenLoading || appOpenShowing) {
|
||||
return;
|
||||
}
|
||||
|
||||
admob.setDevMode(enable);
|
||||
const adUnitId = getAdUnitId(androidAdUnitId, iosAdUnitId, 'appOpen');
|
||||
if (!adUnitId) return;
|
||||
|
||||
appOpenLoading = true;
|
||||
appOpenReady = false;
|
||||
appOpenErrored = false;
|
||||
|
||||
appOpen = new admob.AppOpenAd({
|
||||
adUnitId,
|
||||
orientation: displayLandscape
|
||||
? AppOpenAdOrientation.LandscapeLeft
|
||||
: AppOpenAdOrientation.Portrait,
|
||||
});
|
||||
|
||||
appOpen.on('load', () => {
|
||||
appOpenReady = true;
|
||||
appOpenLoading = false;
|
||||
});
|
||||
appOpen.on('loadfail', () => {
|
||||
appOpenLoading = false;
|
||||
appOpenErrored = true;
|
||||
});
|
||||
appOpen.on('show', () => {
|
||||
appOpenShowing = true;
|
||||
appOpenReady = false;
|
||||
});
|
||||
appOpen.on('showfail', () => {
|
||||
appOpenShowing = false;
|
||||
appOpenErrored = true;
|
||||
});
|
||||
appOpen.on('dismiss', () => {
|
||||
appOpenShowing = false;
|
||||
});
|
||||
|
||||
try {
|
||||
logger.info('Loading Admob App Open.');
|
||||
await appOpen.load();
|
||||
logger.info('AdMob App Open successfully loaded.');
|
||||
appOpenLoading = false;
|
||||
appOpenReady = true;
|
||||
if (displayWhenLoaded) showAppOpen();
|
||||
} catch (error) {
|
||||
logger.error('Error while loading an App Open:', error);
|
||||
appOpenLoading = false;
|
||||
appOpenReady = false;
|
||||
appOpenErrored = true;
|
||||
}
|
||||
};
|
||||
|
||||
// Banner
|
||||
/** Check if a banner is loading. */
|
||||
export const isBannerLoading = () => {
|
||||
return bannerLoading;
|
||||
};
|
||||
/** Check if a banner is being shown on screen. */
|
||||
export const isBannerShowing = () => {
|
||||
return bannerShowing;
|
||||
};
|
||||
/** Check if the banner had an error while loading it. */
|
||||
export const isBannerErrored = () => {
|
||||
return bannerErrored;
|
||||
};
|
||||
/** Show the loaded appOpen. */
|
||||
export const showAppOpen = async () => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
|
||||
/**
|
||||
* Set up a banner that can then be displayed by calling `showBanner`.
|
||||
*/
|
||||
export const setupBanner = function (androidID, iosID, atTop) {
|
||||
if (typeof admob === 'undefined') {
|
||||
if (!appOpen) {
|
||||
logger.warn('App Open has not been set up, call loadAppOpen first.');
|
||||
return;
|
||||
}
|
||||
if (!appOpenReady) {
|
||||
logger.info('App Open not loaded yet, cannot display it.');
|
||||
return;
|
||||
}
|
||||
appOpenErrored = false;
|
||||
|
||||
bannerAndroidId = androidID;
|
||||
bannerIosId = iosID;
|
||||
bannerPosition = atTop ? 'top' : 'bottom';
|
||||
try {
|
||||
logger.info('Showing AdMob App Open.');
|
||||
await appOpen.show();
|
||||
// AppOpen will be shown and
|
||||
// `appOpenShowing` will be updated thanks to events
|
||||
// (but it's too early to change it now).
|
||||
} catch (error) {
|
||||
logger.error('Error while showing an AdMob App Open:', error);
|
||||
appOpenShowing = false;
|
||||
appOpenErrored = true;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Set the size of the banner to be shown when `showBanner` is called.
|
||||
* @param bannerAdSizeType The type of the banner to displayed
|
||||
*/
|
||||
|
||||
// -----------------
|
||||
// ---- Banner -----
|
||||
// -----------------
|
||||
export const isBannerConfigured = () => bannerConfigured;
|
||||
export const isBannerLoaded = () => bannerLoaded;
|
||||
export const isBannerShowing = () => bannerShowing;
|
||||
export const isBannerErrored = () => bannerErrored;
|
||||
|
||||
export const setBannerAdSizeType = (
|
||||
bannerAdSizeType:
|
||||
| 'BANNER'
|
||||
@@ -93,288 +284,421 @@ namespace gdjs {
|
||||
| 'LEADERBOARD'
|
||||
| 'SMART_BANNER'
|
||||
) => {
|
||||
const adSizeTypes = {
|
||||
BANNER: AdSizeType.BANNER,
|
||||
LARGE_BANNER: AdSizeType.LARGE_BANNER,
|
||||
MEDIUM_RECTANGLE: AdSizeType.MEDIUM_RECTANGLE,
|
||||
FULL_BANNER: AdSizeType.FULL_BANNER,
|
||||
LEADERBOARD: AdSizeType.LEADERBOARD,
|
||||
SMART_BANNER: AdSizeType.SMART_BANNER,
|
||||
};
|
||||
|
||||
bannerRequestedAdSizeType =
|
||||
adSizeTypes[bannerAdSizeType] || AdSizeType.SMART_BANNER;
|
||||
};
|
||||
|
||||
/**
|
||||
* Display the banner that was set up with `loadBanner` (and `setBannerAdSizeType`).
|
||||
* Set up a banner that can then be displayed by calling `showBanner`.
|
||||
* If a banner is already set up, it will be hidden and replaced by the new one.
|
||||
*/
|
||||
export const showBanner = () => {
|
||||
if (typeof admob === 'undefined') {
|
||||
return;
|
||||
export const setupBanner = async (androidAdUnitId, iosAdUnitId, atTop) => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
const adUnitId = getAdUnitId(androidAdUnitId, iosAdUnitId, 'banner');
|
||||
if (!adUnitId) return;
|
||||
|
||||
if (banner && bannerShowing) {
|
||||
logger.info('Banner already visible, hiding it to display new one.');
|
||||
await hideBanner();
|
||||
}
|
||||
|
||||
bannerLoading = true;
|
||||
bannerShowing = false;
|
||||
bannerErrored = false;
|
||||
admob.banner
|
||||
.show({
|
||||
id: {
|
||||
android: bannerAndroidId,
|
||||
ios: bannerIosId,
|
||||
},
|
||||
position: bannerPosition,
|
||||
size: bannerRequestedAdSizeType,
|
||||
})
|
||||
.then(
|
||||
() => {
|
||||
bannerShowing = true;
|
||||
bannerLoading = false;
|
||||
logger.info('AdMob banner successfully shown.');
|
||||
},
|
||||
(error) => {
|
||||
bannerShowing = false;
|
||||
bannerLoading = false;
|
||||
bannerErrored = true;
|
||||
logger.error('Error while showing an AdMob banner:', error);
|
||||
}
|
||||
);
|
||||
};
|
||||
/** Hide the banner shown on screen. */
|
||||
export const hideBanner = () => {
|
||||
if (typeof admob === 'undefined') {
|
||||
return;
|
||||
}
|
||||
bannerConfigured = false;
|
||||
bannerLoaded = false;
|
||||
|
||||
bannerShowing = false;
|
||||
admob.banner.hide({
|
||||
android: bannerAndroidId,
|
||||
ios: bannerIosId,
|
||||
banner = new admob.BannerAd({
|
||||
adUnitId,
|
||||
position: atTop ? 'top' : 'bottom',
|
||||
size: bannerRequestedAdSizeType,
|
||||
});
|
||||
|
||||
banner.on('load', () => {
|
||||
bannerShowing = true;
|
||||
bannerLoaded = true;
|
||||
});
|
||||
banner.on('loadfail', () => {
|
||||
bannerShowing = false;
|
||||
bannerLoaded = false;
|
||||
bannerErrored = true;
|
||||
});
|
||||
|
||||
bannerConfigured = true;
|
||||
};
|
||||
|
||||
// Interstitial
|
||||
/** Check if the interstitial is loading. */
|
||||
export const isInterstitialLoading = () => {
|
||||
return interstitialLoading;
|
||||
/**
|
||||
* Display a banner that was set up with `setupBanner` (and `setBannerAdSizeType`).
|
||||
*/
|
||||
export const showBanner = async () => {
|
||||
if (!banner) {
|
||||
logger.info('Banner not configured, use setupBanner first.');
|
||||
return;
|
||||
}
|
||||
if (bannerShowing) {
|
||||
logger.info('Banner already visible. Ignoring.');
|
||||
return;
|
||||
}
|
||||
bannerErrored = false;
|
||||
|
||||
try {
|
||||
logger.info('Showing AdMob banner.');
|
||||
await banner.show();
|
||||
if (bannerLoaded) {
|
||||
// Banner is already loaded, so it will be shown immediately.
|
||||
bannerShowing = true;
|
||||
}
|
||||
} catch (error) {
|
||||
bannerShowing = false;
|
||||
bannerErrored = true;
|
||||
logger.error('Error while showing an AdMob banner:', error);
|
||||
}
|
||||
};
|
||||
/** Check if the interstitial is ready to display. */
|
||||
export const isInterstitialReady = () => {
|
||||
return interstitialReady;
|
||||
};
|
||||
/** Check if the interstitial is shown on screen. */
|
||||
export const isInterstitialShowing = () => {
|
||||
return interstitialShowing;
|
||||
};
|
||||
/** Check if the interstitial had an error while loading it. */
|
||||
export const isInterstitialErrored = () => {
|
||||
return interstitialErrored;
|
||||
|
||||
/** Hide the banner shown on screen. */
|
||||
export const hideBanner = async () => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
|
||||
if (!banner || !bannerShowing) {
|
||||
logger.warn('No banner is being shown.');
|
||||
return;
|
||||
}
|
||||
|
||||
await banner.hide();
|
||||
bannerShowing = false;
|
||||
// Note that the banner is still loaded, which is why bannerLoaded is not set to false.
|
||||
// We hide the banner, but keep it configured to display it again if needed.
|
||||
};
|
||||
|
||||
// -----------------------
|
||||
// ---- Interstitial -----
|
||||
// -----------------------
|
||||
export const isInterstitialLoading = () => interstitialLoading;
|
||||
export const isInterstitialReady = () => interstitialReady;
|
||||
export const isInterstitialShowing = () => interstitialShowing;
|
||||
export const isInterstitialErrored = () => interstitialErrored;
|
||||
|
||||
/** Load an interstitial. */
|
||||
export const loadInterstitial = (androidID, iosID, displayWhenLoaded) => {
|
||||
if (typeof admob === 'undefined') {
|
||||
return;
|
||||
}
|
||||
if (interstitialLoading || interstitialReady || interstitialShowing) {
|
||||
export const loadInterstitial = async (
|
||||
androidAdUnitId,
|
||||
iosAdUnitId,
|
||||
displayWhenLoaded
|
||||
) => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
// If an interstitial is already loading or showing, we don't stop it.
|
||||
if (interstitialLoading || interstitialShowing) {
|
||||
return;
|
||||
}
|
||||
|
||||
const adUnitId = getAdUnitId(
|
||||
androidAdUnitId,
|
||||
iosAdUnitId,
|
||||
'interstitial'
|
||||
);
|
||||
if (!adUnitId) return;
|
||||
|
||||
interstitialLoading = true;
|
||||
interstitialReady = false;
|
||||
interstitialErrored = false;
|
||||
admob.interstitial
|
||||
.load({
|
||||
id: {
|
||||
android: androidID,
|
||||
ios: iosID,
|
||||
},
|
||||
npa: npaValue,
|
||||
})
|
||||
.then(
|
||||
() => {
|
||||
logger.info('AdMob interstitial successfully loaded.');
|
||||
if (displayWhenLoaded) showInterstitial();
|
||||
},
|
||||
(error) => {
|
||||
interstitialLoading = false;
|
||||
interstitialReady = false;
|
||||
interstitialErrored = true;
|
||||
logger.error('Error while loading a interstitial:', error);
|
||||
}
|
||||
);
|
||||
|
||||
interstitial = new admob.InterstitialAd({
|
||||
adUnitId,
|
||||
npa: npaValue,
|
||||
});
|
||||
|
||||
interstitial.on('load', () => {
|
||||
interstitialReady = true;
|
||||
interstitialLoading = false;
|
||||
});
|
||||
interstitial.on('loadfail', () => {
|
||||
interstitialLoading = false;
|
||||
interstitialErrored = true;
|
||||
});
|
||||
interstitial.on('show', () => {
|
||||
interstitialShowing = true;
|
||||
interstitialReady = false;
|
||||
});
|
||||
interstitial.on('showfail', () => {
|
||||
interstitialShowing = false;
|
||||
interstitialErrored = true;
|
||||
});
|
||||
interstitial.on('dismiss', () => {
|
||||
interstitialShowing = false;
|
||||
});
|
||||
|
||||
try {
|
||||
logger.info('Loading Admob interstitial.');
|
||||
await interstitial.load();
|
||||
logger.info('AdMob interstitial successfully loaded.');
|
||||
interstitialLoading = false;
|
||||
interstitialReady = true;
|
||||
if (displayWhenLoaded) showInterstitial();
|
||||
} catch (error) {
|
||||
logger.error('Error while loading a interstitial:', error);
|
||||
interstitialLoading = false;
|
||||
interstitialReady = false;
|
||||
interstitialErrored = true;
|
||||
}
|
||||
};
|
||||
|
||||
/** Show the loaded interstitial. */
|
||||
export const showInterstitial = () => {
|
||||
if (typeof admob === 'undefined') {
|
||||
export const showInterstitial = async () => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
|
||||
if (!interstitial) {
|
||||
logger.warn(
|
||||
'Interstitial has not been set up, call loadInterstitial first.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
admob.interstitial.show().then(
|
||||
() => {
|
||||
// Interstitial will be shown and
|
||||
// `interstitialShowing` will be updated thanks to events
|
||||
// (but it's too early to change it now).
|
||||
},
|
||||
(error) => {
|
||||
interstitialShowing = false;
|
||||
interstitialErrored = true;
|
||||
logger.error('Error while trying to show an interstitial:', error);
|
||||
}
|
||||
);
|
||||
if (!interstitialReady) {
|
||||
logger.info('Interstitial not loaded yet, cannot display it.');
|
||||
return;
|
||||
}
|
||||
interstitialErrored = false;
|
||||
|
||||
try {
|
||||
logger.info('Showing AdMob interstitial.');
|
||||
await interstitial.show();
|
||||
// Interstitial will be shown and
|
||||
// `interstitialShowing` will be updated thanks to events
|
||||
// (but it's too early to change it now).
|
||||
} catch (error) {
|
||||
logger.error('Error while showing an AdMob interstitial:', error);
|
||||
interstitialShowing = false;
|
||||
interstitialErrored = true;
|
||||
}
|
||||
};
|
||||
|
||||
// Reward video
|
||||
/** Check if the video is loading. */
|
||||
export const isVideoLoading = () => {
|
||||
return videoLoading;
|
||||
};
|
||||
/** Check if the video is ready to display. */
|
||||
export const isVideoReady = () => {
|
||||
return videoReady;
|
||||
};
|
||||
/** Check if the video is shown on screen. */
|
||||
export const isVideoShowing = () => {
|
||||
return videoShowing;
|
||||
};
|
||||
/** Check if the video had an error while loading it. */
|
||||
export const isVideoErrored = () => {
|
||||
return videoErrored;
|
||||
};
|
||||
// --------------------------------
|
||||
// ---- Rewarded Interstitial -----
|
||||
// --------------------------------
|
||||
export const isRewardedInterstitialLoading = () =>
|
||||
rewardedInterstitialLoading;
|
||||
export const isRewardedInterstitialReady = () => rewardedInterstitialReady;
|
||||
export const isRewardedInterstitialShowing = () =>
|
||||
rewardedInterstitialShowing;
|
||||
export const isRewardedInterstitialErrored = () =>
|
||||
rewardedInterstitialErrored;
|
||||
|
||||
/** Check if the reward of the video was received. */
|
||||
export const wasVideoRewardReceived = function (markAsClaimed) {
|
||||
const reward = videoRewardReceived;
|
||||
/** Check if the reward of the rewarded interstitial was received. */
|
||||
export const wasRewardedInterstitialRewardReceived = function (
|
||||
markAsClaimed
|
||||
) {
|
||||
const reward = rewardedInterstitialRewardReceived;
|
||||
if (markAsClaimed) {
|
||||
videoRewardReceived = false;
|
||||
rewardedInterstitialRewardReceived = false;
|
||||
}
|
||||
return reward;
|
||||
};
|
||||
|
||||
/** Load a reward video. */
|
||||
export const loadVideo = function (androidID, iosID, displayWhenLoaded) {
|
||||
if (typeof admob === 'undefined') {
|
||||
return;
|
||||
}
|
||||
if (videoLoading || videoReady || videoShowing) {
|
||||
/** Load a rewarded interstitial. */
|
||||
export const loadRewardedInterstitial = async (
|
||||
androidAdUnitID,
|
||||
iosAdUnitID,
|
||||
displayWhenLoaded
|
||||
) => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
if (rewardedInterstitialLoading || rewardedInterstitialShowing) {
|
||||
return;
|
||||
}
|
||||
|
||||
videoLoading = true;
|
||||
videoReady = false;
|
||||
videoErrored = false;
|
||||
admob.rewardVideo
|
||||
.load({
|
||||
id: {
|
||||
android: androidID,
|
||||
ios: iosID,
|
||||
},
|
||||
npa: npaValue,
|
||||
})
|
||||
.then(
|
||||
() => {
|
||||
logger.info('AdMob reward video successfully loaded.');
|
||||
const adUnitId = getAdUnitId(
|
||||
androidAdUnitID,
|
||||
iosAdUnitID,
|
||||
'rewardedInterstitial'
|
||||
);
|
||||
if (!adUnitId) return;
|
||||
|
||||
if (displayWhenLoaded) showVideo();
|
||||
},
|
||||
(error) => {
|
||||
videoLoading = false;
|
||||
videoReady = false;
|
||||
videoErrored = true;
|
||||
logger.error('Error while loading a reward video:', error);
|
||||
}
|
||||
rewardedInterstitialLoading = true;
|
||||
rewardedInterstitialReady = false;
|
||||
rewardedInterstitialErrored = false;
|
||||
|
||||
rewardedInterstitial = new admob.RewardedInterstitialAd({
|
||||
adUnitId,
|
||||
npa: npaValue,
|
||||
});
|
||||
|
||||
// Rewarded video event listeners
|
||||
rewardedInterstitial.on('load', () => {
|
||||
rewardedInterstitialReady = true;
|
||||
rewardedInterstitialLoading = false;
|
||||
});
|
||||
rewardedInterstitial.on('loadfail', () => {
|
||||
rewardedInterstitialLoading = false;
|
||||
rewardedInterstitialErrored = true;
|
||||
});
|
||||
rewardedInterstitial.on('show', () => {
|
||||
rewardedInterstitialShowing = true;
|
||||
rewardedInterstitialReady = false;
|
||||
});
|
||||
rewardedInterstitial.on('showfail', () => {
|
||||
rewardedInterstitialShowing = false;
|
||||
rewardedInterstitialErrored = true;
|
||||
});
|
||||
rewardedInterstitial.on('dismiss', () => {
|
||||
rewardedInterstitialShowing = false;
|
||||
});
|
||||
rewardedInterstitial.on('reward', () => {
|
||||
rewardedInterstitialRewardReceived = true;
|
||||
});
|
||||
|
||||
try {
|
||||
logger.info('Loading AdMob rewarded interstitial.');
|
||||
await rewardedInterstitial.load();
|
||||
logger.info('AdMob rewarded interstitial successfully loaded.');
|
||||
rewardedInterstitialLoading = false;
|
||||
rewardedInterstitialReady = true;
|
||||
if (displayWhenLoaded) showRewardedInterstitial();
|
||||
} catch (error) {
|
||||
rewardedInterstitialLoading = false;
|
||||
rewardedInterstitialReady = false;
|
||||
rewardedInterstitialErrored = true;
|
||||
logger.error('Error while loading a rewarded interstitial:', error);
|
||||
}
|
||||
};
|
||||
|
||||
/** Show the loaded reward interstitial. */
|
||||
export const showRewardedInterstitial = async () => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
|
||||
if (!rewardedInterstitial) {
|
||||
logger.warn(
|
||||
'interstitial has not been set up, call loadRewardedInterstitial first.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!rewardedInterstitialReady) {
|
||||
logger.info('Rewarded interstitial not loaded yet, cannot display it.');
|
||||
}
|
||||
rewardedInterstitialErrored = false;
|
||||
|
||||
try {
|
||||
logger.info('Showing AdMob rewarded interstitial.');
|
||||
await rewardedInterstitial.show();
|
||||
// Rewarded interstitial will be shown and
|
||||
// `rewardedInterstitialShowing` will be updated thanks to events
|
||||
// (but it's too early to change it now).
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
'Error while showing an AdMob rewarded interstitial:',
|
||||
error
|
||||
);
|
||||
rewardedInterstitialShowing = false;
|
||||
rewardedInterstitialErrored = true;
|
||||
}
|
||||
};
|
||||
|
||||
/** Mark the reward of the interstitial as claimed. */
|
||||
export const markRewardedInterstitialRewardAsClaimed = () => {
|
||||
rewardedInterstitialRewardReceived = false;
|
||||
};
|
||||
|
||||
// -------------------------
|
||||
// ---- Rewarded Video -----
|
||||
// -------------------------
|
||||
export const isRewardedVideoLoading = () => rewardedVideoLoading;
|
||||
export const isRewardedVideoReady = () => rewardedVideoReady;
|
||||
export const isRewardedVideoShowing = () => rewardedVideoShowing;
|
||||
export const isRewardedVideoErrored = () => rewardedVideoErrored;
|
||||
|
||||
/** Check if the reward of the rewarded video was received. */
|
||||
export const wasRewardedVideoRewardReceived = function (markAsClaimed) {
|
||||
const reward = rewardedVideoRewardReceived;
|
||||
if (markAsClaimed) {
|
||||
rewardedVideoRewardReceived = false;
|
||||
}
|
||||
return reward;
|
||||
};
|
||||
|
||||
/** Load a rewarded video. */
|
||||
export const loadRewardedVideo = async (
|
||||
androidAdUnitID,
|
||||
iosAdUnitID,
|
||||
displayWhenLoaded
|
||||
) => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
if (rewardedVideoLoading || rewardedVideoShowing) {
|
||||
return;
|
||||
}
|
||||
|
||||
const adUnitId = getAdUnitId(androidAdUnitID, iosAdUnitID, 'rewarded');
|
||||
if (!adUnitId) return;
|
||||
|
||||
rewardedVideoLoading = true;
|
||||
rewardedVideoReady = false;
|
||||
rewardedVideoErrored = false;
|
||||
|
||||
rewardedVideo = new admob.RewardedAd({
|
||||
adUnitId,
|
||||
npa: npaValue,
|
||||
});
|
||||
|
||||
// Rewarded video event listeners
|
||||
rewardedVideo.on('load', () => {
|
||||
rewardedVideoReady = true;
|
||||
rewardedVideoLoading = false;
|
||||
});
|
||||
rewardedVideo.on('loadfail', () => {
|
||||
rewardedVideoLoading = false;
|
||||
rewardedVideoErrored = true;
|
||||
});
|
||||
rewardedVideo.on('show', () => {
|
||||
rewardedVideoShowing = true;
|
||||
rewardedVideoReady = false;
|
||||
});
|
||||
rewardedVideo.on('showfail', () => {
|
||||
rewardedVideoShowing = false;
|
||||
rewardedVideoErrored = true;
|
||||
});
|
||||
rewardedVideo.on('dismiss', () => {
|
||||
rewardedVideoShowing = false;
|
||||
});
|
||||
rewardedVideo.on('reward', () => {
|
||||
rewardedVideoRewardReceived = true;
|
||||
});
|
||||
|
||||
try {
|
||||
logger.info('Loading AdMob rewarded video.');
|
||||
await rewardedVideo.load();
|
||||
logger.info('AdMob rewarded video successfully loaded.');
|
||||
rewardedVideoLoading = false;
|
||||
rewardedVideoReady = true;
|
||||
if (displayWhenLoaded) showRewardedVideo();
|
||||
} catch (error) {
|
||||
rewardedVideoLoading = false;
|
||||
rewardedVideoReady = false;
|
||||
rewardedVideoErrored = true;
|
||||
logger.error('Error while loading a rewarded video:', error);
|
||||
}
|
||||
};
|
||||
|
||||
/** Show the loaded reward video. */
|
||||
export const showVideo = () => {
|
||||
if (typeof admob === 'undefined') {
|
||||
export const showRewardedVideo = async () => {
|
||||
if (!checkIfAdMobIsAvailable()) return;
|
||||
|
||||
if (!rewardedVideo) {
|
||||
logger.warn('Video has not been set up, call loadRewardedVideo first.');
|
||||
return;
|
||||
}
|
||||
if (!rewardedVideoReady) {
|
||||
logger.info('Rewarded video not loaded yet, cannot display it.');
|
||||
}
|
||||
rewardedVideoErrored = false;
|
||||
|
||||
admob.rewardVideo.show().then(
|
||||
() => {
|
||||
// Video will be shown and
|
||||
// `videoShowing` will be updated thanks to events
|
||||
// (but it's too early to change it now).
|
||||
},
|
||||
(error) => {
|
||||
videoShowing = false;
|
||||
videoErrored = true;
|
||||
logger.error('Error while trying to show a reward video:', error);
|
||||
}
|
||||
);
|
||||
try {
|
||||
logger.info('Showing AdMob rewarded video.');
|
||||
await rewardedVideo.show();
|
||||
// Rewarded video will be shown and
|
||||
// `rewardedVideoShowing` will be updated thanks to events
|
||||
// (but it's too early to change it now).
|
||||
} catch (error) {
|
||||
logger.error('Error while showing an AdMob rewarded video:', error);
|
||||
rewardedVideoShowing = false;
|
||||
rewardedVideoErrored = true;
|
||||
}
|
||||
};
|
||||
|
||||
/** Mark the reward of the video as claimed. */
|
||||
export const markVideoRewardAsClaimed = () => {
|
||||
videoRewardReceived = false;
|
||||
export const markRewardedVideoRewardAsClaimed = () => {
|
||||
rewardedVideoRewardReceived = false;
|
||||
};
|
||||
|
||||
// Banner event listeners:
|
||||
document.addEventListener('admob.banner.load', () => {
|
||||
bannerShowing = true;
|
||||
bannerLoading = false;
|
||||
});
|
||||
document.addEventListener('admob.banner.load_fail', () => {
|
||||
bannerLoading = false;
|
||||
});
|
||||
|
||||
document.addEventListener('admob.banner.open', () => {
|
||||
// Not implemented.
|
||||
});
|
||||
|
||||
document.addEventListener('admob.banner.exit_app', () => {
|
||||
// Not implemented.
|
||||
});
|
||||
document.addEventListener('admob.banner.close', () => {
|
||||
// Not implemented.
|
||||
});
|
||||
|
||||
// Interstitial event listeners
|
||||
document.addEventListener('admob.interstitial.load', () => {
|
||||
interstitialReady = true;
|
||||
interstitialLoading = false;
|
||||
});
|
||||
document.addEventListener('admob.interstitial.load_fail', () => {
|
||||
interstitialLoading = false;
|
||||
});
|
||||
document.addEventListener('admob.interstitial.open', () => {
|
||||
interstitialShowing = true;
|
||||
interstitialReady = false;
|
||||
});
|
||||
document.addEventListener('admob.interstitial.close', () => {
|
||||
interstitialShowing = false;
|
||||
});
|
||||
document.addEventListener('admob.interstitial.exit_app', () => {
|
||||
// Not implemented.
|
||||
});
|
||||
|
||||
// Reward video event listeners
|
||||
document.addEventListener('admob.reward_video.load', () => {
|
||||
videoReady = true;
|
||||
videoLoading = false;
|
||||
});
|
||||
document.addEventListener('admob.reward_video.load_fail', () => {
|
||||
videoLoading = false;
|
||||
});
|
||||
document.addEventListener('admob.reward_video.open', () => {
|
||||
videoShowing = true;
|
||||
videoReady = false;
|
||||
});
|
||||
document.addEventListener('admob.reward_video.close', () => {
|
||||
videoShowing = false;
|
||||
});
|
||||
document.addEventListener('admob.reward_video.start', () => {
|
||||
// Not implemented.
|
||||
});
|
||||
document.addEventListener('admob.reward_video.complete', () => {
|
||||
// Not implemented.
|
||||
});
|
||||
document.addEventListener('admob.reward_video.reward', () => {
|
||||
videoRewardReceived = true;
|
||||
});
|
||||
document.addEventListener('admob.reward_video.exit_app', () => {
|
||||
// Not implemented.
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
|
@@ -19,6 +19,8 @@
|
||||
import { type ObjectsRenderingService, type ObjectsEditorService } from '../JsExtensionTypes.flow.js'
|
||||
*/
|
||||
|
||||
const stringifyOptions = (options) => '["' + options.join('","') + '"]';
|
||||
|
||||
module.exports = {
|
||||
createExtension: function (
|
||||
_ /*: (string) => string */,
|
||||
@@ -34,9 +36,10 @@ module.exports = {
|
||||
'Open source (MIT License)'
|
||||
)
|
||||
.setExtensionHelpPath('/objects/bbtext')
|
||||
.setCategory('User interface');
|
||||
extension.addInstructionOrExpressionGroupMetadata(_("BBCode Text Object"))
|
||||
.setIcon("JsPlatform/Extensions/bbcode32.png");
|
||||
.setCategory('Text');
|
||||
extension
|
||||
.addInstructionOrExpressionGroupMetadata(_('BBCode Text Object'))
|
||||
.setIcon('JsPlatform/Extensions/bbcode32.png');
|
||||
|
||||
var objectBBText = new gd.ObjectJsImplementation();
|
||||
// $FlowExpectedError
|
||||
@@ -171,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.
|
||||
@@ -195,7 +198,10 @@ module.exports = {
|
||||
.addParameter('object', objectName, objectName, false)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName(`get${property.functionName}`);
|
||||
} else if (parameterType === 'string') {
|
||||
} else if (
|
||||
parameterType === 'string' ||
|
||||
parameterType === 'stringWithSelector'
|
||||
) {
|
||||
gdObject
|
||||
.addStrExpression(
|
||||
`Get${property.functionName}`,
|
||||
@@ -210,13 +216,24 @@ module.exports = {
|
||||
}
|
||||
|
||||
// Add the action
|
||||
if (parameterType === 'number' || parameterType === 'string') {
|
||||
const expressionType =
|
||||
parameterType === 'number' ? 'expression' : 'string';
|
||||
if (
|
||||
parameterType === 'number' ||
|
||||
parameterType === 'string' ||
|
||||
parameterType === 'stringWithSelector'
|
||||
) {
|
||||
const parameterOptions =
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
property.paramLabel
|
||||
);
|
||||
if (property.options) {
|
||||
parameterOptions.setTypeExtraInfo(
|
||||
stringifyOptions(property.options)
|
||||
);
|
||||
}
|
||||
gdObject
|
||||
.addAction(
|
||||
`Set${property.functionName}`,
|
||||
property.paramLabel,
|
||||
property.instructionLabel,
|
||||
property.actionDescription,
|
||||
property.actionSentence,
|
||||
'',
|
||||
@@ -224,7 +241,7 @@ module.exports = {
|
||||
property.iconPath
|
||||
)
|
||||
.addParameter('object', objectName, objectName, false)
|
||||
.useStandardOperatorParameters(parameterType)
|
||||
.useStandardOperatorParameters(parameterType, parameterOptions)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName(`set${property.functionName}`)
|
||||
.setGetter(`get${property.functionName}`);
|
||||
@@ -232,7 +249,7 @@ module.exports = {
|
||||
gdObject
|
||||
.addAction(
|
||||
`Set${property.functionName}`,
|
||||
property.paramLabel,
|
||||
property.instructionLabel,
|
||||
property.actionDescription,
|
||||
property.actionSentence,
|
||||
'',
|
||||
@@ -243,9 +260,7 @@ module.exports = {
|
||||
.addParameter(
|
||||
parameterType,
|
||||
property.paramLabel,
|
||||
property.options
|
||||
? '["' + property.options.join('", "') + '"]'
|
||||
: '',
|
||||
'', // There should not be options for the property if it's not a stringWithSelector
|
||||
false
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
@@ -254,13 +269,24 @@ module.exports = {
|
||||
}
|
||||
|
||||
// Add condition
|
||||
if (parameterType === 'string' || parameterType === 'number') {
|
||||
const propExpressionType =
|
||||
parameterType === 'string' ? 'string' : 'expression';
|
||||
if (
|
||||
parameterType === 'string' ||
|
||||
parameterType === 'number' ||
|
||||
parameterType === 'stringWithSelector'
|
||||
) {
|
||||
const parameterOptions =
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
property.paramLabel
|
||||
);
|
||||
if (property.options) {
|
||||
parameterOptions.setTypeExtraInfo(
|
||||
stringifyOptions(property.options)
|
||||
);
|
||||
}
|
||||
gdObject
|
||||
.addCondition(
|
||||
`Is${property.functionName}`,
|
||||
property.paramLabel,
|
||||
property.instructionLabel,
|
||||
property.conditionDescription,
|
||||
property.conditionSentence,
|
||||
'',
|
||||
@@ -268,14 +294,17 @@ module.exports = {
|
||||
property.iconPath
|
||||
)
|
||||
.addParameter('object', objectName, objectName, false)
|
||||
.useStandardRelationalOperatorParameters(parameterType)
|
||||
.useStandardRelationalOperatorParameters(
|
||||
parameterType,
|
||||
parameterOptions
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName(`get${property.functionName}`);
|
||||
} else if (parameterType === 'yesorno') {
|
||||
gdObject
|
||||
.addCondition(
|
||||
`Is${property.functionName}`,
|
||||
property.paramLabel,
|
||||
property.instructionLabel,
|
||||
property.conditionDescription,
|
||||
property.conditionSentence,
|
||||
'',
|
||||
@@ -294,7 +323,8 @@ module.exports = {
|
||||
functionName: 'BBText',
|
||||
iconPath: 'res/actions/text24_black.png',
|
||||
type: 'string',
|
||||
paramLabel: _('BBCode text'),
|
||||
instructionLabel: _('BBCode text'),
|
||||
paramLabel: _('Text'),
|
||||
conditionDescription: _('Compare the value of the BBCode text.'),
|
||||
conditionSentence: _('the BBCode text'),
|
||||
actionDescription: _('Set BBCode text'),
|
||||
@@ -306,7 +336,8 @@ module.exports = {
|
||||
functionName: 'Color',
|
||||
iconPath: 'res/actions/color24.png',
|
||||
type: 'color',
|
||||
paramLabel: _('Color'),
|
||||
instructionLabel: _('Color'),
|
||||
paramLabel: _('Color (R;G;B)'),
|
||||
conditionDescription: '', // No conditions for a "color" property
|
||||
conditionSentence: '', // No conditions for a "color" property
|
||||
actionDescription: _('Set base color'),
|
||||
@@ -318,7 +349,8 @@ module.exports = {
|
||||
functionName: 'Opacity',
|
||||
iconPath: 'res/actions/opacity24.png',
|
||||
type: 'number',
|
||||
paramLabel: _('Opacity'),
|
||||
instructionLabel: _('Opacity'),
|
||||
paramLabel: _('Opacity (0-255)'),
|
||||
conditionDescription: _(
|
||||
'Compare the value of the base opacity of the text.'
|
||||
),
|
||||
@@ -332,6 +364,7 @@ module.exports = {
|
||||
functionName: 'FontSize',
|
||||
iconPath: 'res/actions/characterSize24.png',
|
||||
type: 'number',
|
||||
instructionLabel: _('Font size'),
|
||||
paramLabel: _('Font size'),
|
||||
conditionDescription: _('Compare the base font size of the text.'),
|
||||
conditionSentence: _('the base font size'),
|
||||
@@ -344,6 +377,7 @@ module.exports = {
|
||||
functionName: 'FontFamily',
|
||||
iconPath: 'res/actions/font24.png',
|
||||
type: 'string',
|
||||
instructionLabel: _('Font family'),
|
||||
paramLabel: _('Font family'),
|
||||
conditionDescription: _('Compare the value of font family'),
|
||||
conditionSentence: _('the base font family'),
|
||||
@@ -356,6 +390,7 @@ module.exports = {
|
||||
functionName: 'Alignment',
|
||||
iconPath: 'res/actions/textAlign24.png',
|
||||
type: 'stringWithSelector',
|
||||
instructionLabel: _('Alignment'),
|
||||
paramLabel: _('Alignment'),
|
||||
options: ['left', 'right', 'center'],
|
||||
conditionDescription: _('Check the current text alignment.'),
|
||||
@@ -369,6 +404,7 @@ module.exports = {
|
||||
functionName: 'WordWrap',
|
||||
iconPath: 'res/actions/scaleWidth24_black.png',
|
||||
type: 'boolean',
|
||||
instructionLabel: _('Word wrap'),
|
||||
paramLabel: _('Word wrap'),
|
||||
conditionDescription: _('Check if word wrap is enabled.'),
|
||||
conditionSentence: _('Word wrap is enabled'),
|
||||
@@ -381,6 +417,7 @@ module.exports = {
|
||||
functionName: 'WrappingWidth',
|
||||
iconPath: 'res/actions/scaleWidth24_black.png',
|
||||
type: 'number',
|
||||
instructionLabel: _('Wrapping width'),
|
||||
paramLabel: _('Wrapping width'),
|
||||
conditionDescription: _(
|
||||
'Compare the width, in pixels, after which the text is wrapped on next line.'
|
||||
@@ -510,8 +547,7 @@ module.exports = {
|
||||
* This is called to update the PIXI object on the scene editor
|
||||
*/
|
||||
RenderedBBTextInstance.prototype.update = function () {
|
||||
const properties = this._associatedObjectConfiguration
|
||||
.getProperties();
|
||||
const properties = this._associatedObjectConfiguration.getProperties();
|
||||
|
||||
const rawText = properties.get('text').getValue();
|
||||
if (rawText !== this._pixiObject.text) {
|
||||
|
@@ -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(
|
||||
@@ -187,7 +188,7 @@ module.exports = {
|
||||
'res/conditions/text24_black.png'
|
||||
)
|
||||
.addParameter('object', _('Bitmap text'), 'BitmapTextObject', false)
|
||||
.useStandardParameters('string')
|
||||
.useStandardParameters('string', gd.ParameterOptions.makeNewOptions())
|
||||
.setFunctionName('setText')
|
||||
.setGetter('getText');
|
||||
|
||||
@@ -202,7 +203,12 @@ module.exports = {
|
||||
'res/conditions/opacity24.png'
|
||||
)
|
||||
.addParameter('object', _('Bitmap text'), 'BitmapTextObject', false)
|
||||
.useStandardParameters('number')
|
||||
.useStandardParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Opacity (0-255)')
|
||||
)
|
||||
)
|
||||
.setFunctionName('setOpacity')
|
||||
.setGetter('getOpacity');
|
||||
|
||||
@@ -217,7 +223,7 @@ module.exports = {
|
||||
'res/conditions/characterSize24.png'
|
||||
)
|
||||
.addParameter('object', _('Bitmap text'), 'BitmapTextObject', false)
|
||||
.useStandardParameters('number')
|
||||
.useStandardParameters('number', gd.ParameterOptions.makeNewOptions())
|
||||
.setFunctionName('getFontSize');
|
||||
|
||||
object
|
||||
@@ -231,7 +237,12 @@ module.exports = {
|
||||
'res/actions/scale24_black.png'
|
||||
)
|
||||
.addParameter('object', _('Bitmap text'), 'BitmapTextObject', false)
|
||||
.useStandardParameters('number')
|
||||
.useStandardParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Scale (1 by default)')
|
||||
)
|
||||
)
|
||||
.setFunctionName('setScale')
|
||||
.setGetter('getScale');
|
||||
|
||||
@@ -246,7 +257,7 @@ module.exports = {
|
||||
'res/conditions/font24.png'
|
||||
)
|
||||
.addParameter('object', _('Bitmap text'), 'BitmapTextObject', false)
|
||||
.useStandardParameters('string')
|
||||
.useStandardParameters('string', gd.ParameterOptions.makeNewOptions())
|
||||
.setFunctionName('getFontName');
|
||||
|
||||
object
|
||||
@@ -304,7 +315,12 @@ module.exports = {
|
||||
'res/actions/textAlign24.png'
|
||||
)
|
||||
.addParameter('object', _('Bitmap text'), 'BitmapTextObject', false)
|
||||
.useStandardParameters('string')
|
||||
.useStandardParameters(
|
||||
'string',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Alignment ("left", "right" or "center")')
|
||||
)
|
||||
)
|
||||
.setFunctionName('getAlignment');
|
||||
|
||||
object
|
||||
@@ -367,7 +383,7 @@ module.exports = {
|
||||
'res/actions/scaleWidth24_black.png'
|
||||
)
|
||||
.addParameter('object', _('Bitmap text'), 'BitmapTextObject', false)
|
||||
.useStandardParameters('number')
|
||||
.useStandardParameters('number', gd.ParameterOptions.makeNewOptions())
|
||||
.setFunctionName('setWrappingWidth')
|
||||
.setGetter('getWrappingWidth');
|
||||
|
||||
@@ -637,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).
|
||||
|
@@ -45,7 +45,8 @@ void DeclareDestroyOutsideBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"CppPlatform/Extensions/destroyoutsideicon16.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "DestroyOutside")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("GetExtraBorder");
|
||||
|
||||
@@ -59,7 +60,8 @@ void DeclareDestroyOutsideBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"CppPlatform/Extensions/destroyoutsideicon16.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "DestroyOutside")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("SetExtraBorder")
|
||||
.SetGetter("GetExtraBorder");
|
||||
|
@@ -28,7 +28,7 @@ module.exports = {
|
||||
extension
|
||||
.setExtensionInformation(
|
||||
'DialogueTree',
|
||||
_('Dialogue Tree (experimental)'),
|
||||
_('Dialogue Tree'),
|
||||
'Handle dialogue trees, made using Yarn Spinner. Useful to make complex dialogues with multiple choices. The Yarn Spinner editor is embedded in GDevelop so you can edit your dialogues without leaving GDevelop.',
|
||||
'Todor Imreorov',
|
||||
'Open source (MIT License)'
|
||||
@@ -36,7 +36,7 @@ module.exports = {
|
||||
.setExtensionHelpPath('/all-features/dialogue-tree')
|
||||
.setCategory('Game mechanic');
|
||||
extension
|
||||
.addInstructionOrExpressionGroupMetadata(_('Dialogue Tree (experimental)'))
|
||||
.addInstructionOrExpressionGroupMetadata(_('Dialogue Tree'))
|
||||
.setIcon('JsPlatform/Extensions/yarn32.png');
|
||||
|
||||
extension
|
||||
|
@@ -57,35 +57,18 @@ namespace gdjs {
|
||||
}
|
||||
const inputManager = instanceContainer.getGame().getInputManager();
|
||||
|
||||
//Try mouse
|
||||
const mouseDraggableManager = DraggableManager.getMouseManager(
|
||||
instanceContainer
|
||||
);
|
||||
if (
|
||||
inputManager.isMouseButtonPressed(0) &&
|
||||
!mouseDraggableManager.isDragging(this)
|
||||
) {
|
||||
if (mouseDraggableManager.tryAndTakeDragging(instanceContainer, this)) {
|
||||
this._draggedByDraggableManager = mouseDraggableManager;
|
||||
return true;
|
||||
const touchIds = inputManager.getStartedTouchIdentifiers();
|
||||
for (let i = 0; i < touchIds.length; ++i) {
|
||||
const touchDraggableManager = DraggableManager.getTouchManager(
|
||||
instanceContainer,
|
||||
touchIds[i]
|
||||
);
|
||||
if (touchDraggableManager.isDragging(this)) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
//Try touches
|
||||
const touchIds = inputManager.getStartedTouchIdentifiers();
|
||||
for (let i = 0; i < touchIds.length; ++i) {
|
||||
const touchDraggableManager = DraggableManager.getTouchManager(
|
||||
instanceContainer,
|
||||
touchIds[i]
|
||||
);
|
||||
if (touchDraggableManager.isDragging(this)) {
|
||||
continue;
|
||||
}
|
||||
if (
|
||||
touchDraggableManager.tryAndTakeDragging(instanceContainer, this)
|
||||
) {
|
||||
this._draggedByDraggableManager = touchDraggableManager;
|
||||
return true;
|
||||
}
|
||||
if (touchDraggableManager.tryAndTakeDragging(instanceContainer, this)) {
|
||||
this._draggedByDraggableManager = touchDraggableManager;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -121,14 +104,6 @@ namespace gdjs {
|
||||
}
|
||||
|
||||
doStepPostEvents(instanceContainer: gdjs.RuntimeInstanceContainer) {
|
||||
const mouseDraggableManager = DraggableManager.getMouseManager(
|
||||
instanceContainer
|
||||
);
|
||||
mouseDraggableManager.leftPressedLastFrame = instanceContainer
|
||||
.getGame()
|
||||
.getInputManager()
|
||||
.isMouseButtonPressed(0);
|
||||
|
||||
this._justDropped = false;
|
||||
}
|
||||
|
||||
@@ -144,7 +119,8 @@ namespace gdjs {
|
||||
/**
|
||||
* Handle the dragging
|
||||
*/
|
||||
abstract class DraggableManager {
|
||||
class DraggableManager {
|
||||
private _touchId: integer;
|
||||
/**
|
||||
* The object has left its original position.
|
||||
* When true, the search for the best object to drag has ended.
|
||||
@@ -157,24 +133,11 @@ namespace gdjs {
|
||||
protected _xOffset: number = 0;
|
||||
protected _yOffset: number = 0;
|
||||
|
||||
constructor(instanceContainer: gdjs.RuntimeInstanceContainer) {}
|
||||
|
||||
/**
|
||||
* Get the platforms manager of an instance container.
|
||||
*/
|
||||
static getMouseManager(
|
||||
instanceContainer: gdjs.RuntimeInstanceContainer
|
||||
): MouseDraggableManager {
|
||||
// @ts-ignore
|
||||
if (!instanceContainer.mouseDraggableManager) {
|
||||
//Create the shared manager if necessary.
|
||||
// @ts-ignore
|
||||
instanceContainer.mouseDraggableManager = new MouseDraggableManager(
|
||||
instanceContainer
|
||||
);
|
||||
}
|
||||
// @ts-ignore
|
||||
return instanceContainer.mouseDraggableManager;
|
||||
constructor(
|
||||
instanceContainer: gdjs.RuntimeInstanceContainer,
|
||||
touchId: integer
|
||||
) {
|
||||
this._touchId = touchId;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,7 +159,7 @@ namespace gdjs {
|
||||
// @ts-ignore
|
||||
instanceContainer.touchDraggableManagers[
|
||||
touchId
|
||||
] = new TouchDraggableManager(instanceContainer, touchId);
|
||||
] = new DraggableManager(instanceContainer, touchId);
|
||||
}
|
||||
// @ts-ignore
|
||||
return instanceContainer.touchDraggableManagers[touchId];
|
||||
@@ -263,75 +226,6 @@ namespace gdjs {
|
||||
this._draggableBehavior = null;
|
||||
}
|
||||
|
||||
abstract isDragging(
|
||||
draggableRuntimeBehavior: DraggableRuntimeBehavior
|
||||
): boolean;
|
||||
abstract shouldEndDrag(
|
||||
instanceContainer: gdjs.RuntimeInstanceContainer,
|
||||
draggableRuntimeBehavior: DraggableRuntimeBehavior
|
||||
): boolean;
|
||||
abstract getPosition(
|
||||
instanceContainer: gdjs.RuntimeInstanceContainer,
|
||||
draggableRuntimeBehavior: DraggableRuntimeBehavior
|
||||
): FloatPoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the dragging by mouse
|
||||
*/
|
||||
class MouseDraggableManager extends DraggableManager {
|
||||
/** Used to only start dragging when clicking. */
|
||||
leftPressedLastFrame = false;
|
||||
|
||||
constructor(instanceContainer: gdjs.RuntimeInstanceContainer) {
|
||||
super(instanceContainer);
|
||||
}
|
||||
|
||||
isDragging(draggableRuntimeBehavior: DraggableRuntimeBehavior): boolean {
|
||||
return this.leftPressedLastFrame || this._draggingSomething;
|
||||
}
|
||||
|
||||
getPosition(
|
||||
instanceContainer: gdjs.RuntimeInstanceContainer,
|
||||
draggableRuntimeBehavior: DraggableRuntimeBehavior
|
||||
): FloatPoint {
|
||||
const workingPoint: FloatPoint = gdjs.staticArray(
|
||||
MouseDraggableManager.prototype.getPosition
|
||||
) as FloatPoint;
|
||||
const inputManager = instanceContainer.getGame().getInputManager();
|
||||
return instanceContainer
|
||||
.getLayer(draggableRuntimeBehavior.owner.getLayer())
|
||||
.convertCoords(
|
||||
inputManager.getMouseX(),
|
||||
inputManager.getMouseY(),
|
||||
0,
|
||||
workingPoint
|
||||
);
|
||||
}
|
||||
|
||||
shouldEndDrag(
|
||||
instanceContainer: gdjs.RuntimeInstanceContainer,
|
||||
draggableRuntimeBehavior: DraggableRuntimeBehavior
|
||||
): boolean {
|
||||
const inputManager = instanceContainer.getGame().getInputManager();
|
||||
return !inputManager.isMouseButtonPressed(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the dragging by touch
|
||||
*/
|
||||
class TouchDraggableManager extends DraggableManager {
|
||||
private _touchId: integer;
|
||||
|
||||
constructor(
|
||||
instanceContainer: gdjs.RuntimeInstanceContainer,
|
||||
touchId: integer
|
||||
) {
|
||||
super(instanceContainer);
|
||||
this._touchId = touchId;
|
||||
}
|
||||
|
||||
isDragging(draggableRuntimeBehavior: DraggableRuntimeBehavior): boolean {
|
||||
return this._draggingSomething;
|
||||
}
|
||||
@@ -341,7 +235,7 @@ namespace gdjs {
|
||||
draggableRuntimeBehavior: DraggableRuntimeBehavior
|
||||
): FloatPoint {
|
||||
const workingPoint: FloatPoint = gdjs.staticArray(
|
||||
TouchDraggableManager.prototype.getPosition
|
||||
DraggableManager.prototype.getPosition
|
||||
) as FloatPoint;
|
||||
const inputManager = instanceContainer.getGame().getInputManager();
|
||||
return instanceContainer
|
||||
@@ -359,9 +253,7 @@ namespace gdjs {
|
||||
draggableRuntimeBehavior: DraggableRuntimeBehavior
|
||||
): boolean {
|
||||
const inputManager = instanceContainer.getGame().getInputManager();
|
||||
return (
|
||||
inputManager.getAllTouchIdentifiers().indexOf(this._touchId) === -1
|
||||
);
|
||||
return inputManager.hasTouchEnded(this._touchId);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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: [
|
||||
@@ -66,17 +61,21 @@ describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
|
||||
// Drag'n'drop
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onMouseMove(450, 500);
|
||||
runtimeGame
|
||||
.getInputManager()
|
||||
.onMouseButtonPressed(gdjs.InputManager.MOUSE_LEFT_BUTTON);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onMouseMove(750, 600);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame
|
||||
.getInputManager()
|
||||
.onMouseButtonReleased(gdjs.InputManager.MOUSE_LEFT_BUTTON);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
|
||||
expect(object.getX()).to.be(750);
|
||||
expect(object.getY()).to.be(600);
|
||||
@@ -84,6 +83,7 @@ describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
// Mouse move without dragging
|
||||
runtimeGame.getInputManager().onMouseMove(600, 600);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
|
||||
expect(object.getX()).to.be(750);
|
||||
expect(object.getY()).to.be(600);
|
||||
@@ -94,12 +94,15 @@ describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
.getInputManager()
|
||||
.onMouseButtonPressed(gdjs.InputManager.MOUSE_LEFT_BUTTON);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onMouseMove(850, 700);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame
|
||||
.getInputManager()
|
||||
.onMouseButtonReleased(gdjs.InputManager.MOUSE_LEFT_BUTTON);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
|
||||
expect(object.getX()).to.be(850);
|
||||
expect(object.getY()).to.be(700);
|
||||
@@ -111,17 +114,21 @@ describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
|
||||
// Dragged point is in the bounding box but not in hitbox
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onMouseMove(450, 500);
|
||||
runtimeGame
|
||||
.getInputManager()
|
||||
.onMouseButtonPressed(gdjs.InputManager.MOUSE_LEFT_BUTTON);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onMouseMove(750, 600);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame
|
||||
.getInputManager()
|
||||
.onMouseButtonReleased(gdjs.InputManager.MOUSE_LEFT_BUTTON);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
|
||||
expect(object.getX()).to.be(750);
|
||||
expect(object.getY()).to.be(600);
|
||||
@@ -135,34 +142,42 @@ describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
|
||||
// Dragged point is in the bounding box but not in hitbox
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onMouseMove(450, 500);
|
||||
runtimeGame
|
||||
.getInputManager()
|
||||
.onMouseButtonPressed(gdjs.InputManager.MOUSE_LEFT_BUTTON);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onMouseMove(750, 600);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame
|
||||
.getInputManager()
|
||||
.onMouseButtonReleased(gdjs.InputManager.MOUSE_LEFT_BUTTON);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
|
||||
expect(object2.getX()).to.be(450);
|
||||
expect(object2.getY()).to.be(500);
|
||||
|
||||
// Dragged point is in the bounding box and in hitbox
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onMouseMove(455, 505);
|
||||
runtimeGame
|
||||
.getInputManager()
|
||||
.onMouseButtonPressed(gdjs.InputManager.MOUSE_LEFT_BUTTON);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onMouseMove(855, 705);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame
|
||||
.getInputManager()
|
||||
.onMouseButtonReleased(gdjs.InputManager.MOUSE_LEFT_BUTTON);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
|
||||
expect(object2.getX()).to.be(850);
|
||||
expect(object2.getY()).to.be(700);
|
||||
@@ -185,17 +200,21 @@ describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
|
||||
// Drag'n'drop
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onMouseMove(450, 500);
|
||||
runtimeGame
|
||||
.getInputManager()
|
||||
.onMouseButtonPressed(gdjs.InputManager.MOUSE_LEFT_BUTTON);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onMouseMove(750, 600);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame
|
||||
.getInputManager()
|
||||
.onMouseButtonReleased(gdjs.InputManager.MOUSE_LEFT_BUTTON);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
|
||||
if (firstInFront) {
|
||||
// The 1st object moved
|
||||
@@ -220,6 +239,7 @@ describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
|
||||
// Drag'n'drop
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onTouchStart(1, 10, 20);
|
||||
runtimeGame.getInputManager().onTouchStart(0, 450, 500);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
@@ -237,22 +257,25 @@ describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
// Move another unrelated touch
|
||||
runtimeGame.getInputManager().onTouchMove(1, 750, 600);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onTouchMove(1, 850, 700);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
|
||||
expect(object.getX()).to.be(750);
|
||||
expect(object.getY()).to.be(600);
|
||||
|
||||
// Start drag'n'drop with another touch
|
||||
runtimeGame.getInputManager().onTouchEnd(1);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onTouchStart(1, 750, 600);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onTouchMove(1, 850, 700);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onTouchEnd(1);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onTouchEnd(1);
|
||||
|
||||
expect(object.getX()).to.be(850);
|
||||
expect(object.getY()).to.be(700);
|
||||
@@ -264,12 +287,12 @@ describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
|
||||
// Dragged point is in the bounding box but not in hitbox
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onTouchStart(0, 450, 500);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onTouchMove(0, 750, 600);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onTouchEnd(0);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
@@ -286,6 +309,7 @@ describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
|
||||
// Dragged point is in the bounding box but not in hitbox
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onTouchStart(0, 450, 500);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
@@ -301,6 +325,7 @@ describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
|
||||
// Dragged point is in the bounding box but not in hitbox
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onTouchStart(0, 455, 505);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
@@ -323,6 +348,7 @@ describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
|
||||
// Drag'n'drop
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onTouchStart(2, 450, 500);
|
||||
runtimeGame.getInputManager().onTouchStart(1, 650, 600);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
@@ -361,6 +387,7 @@ describe('gdjs.DraggableRuntimeBehavior', function () {
|
||||
// Drag'n'drop
|
||||
runtimeGame.getInputManager().touchSimulateMouse(false);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
runtimeGame.getInputManager().onFrameEnded();
|
||||
runtimeGame.getInputManager().onTouchStart(1, 10, 20);
|
||||
runtimeGame.getInputManager().onTouchStart(0, 450, 500);
|
||||
runtimeScene.renderAndStep(1000 / 60);
|
||||
|
@@ -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.'));
|
||||
|
@@ -2037,7 +2037,7 @@ module.exports = {
|
||||
_('Update a document in Database'),
|
||||
_('Updates a variable on the database.'),
|
||||
_(
|
||||
'Update varable _PARAM0_ with _PARAM1_ (store result state in _PARAM2_)'
|
||||
'Update variable _PARAM0_ with _PARAM1_ (store result state in _PARAM2_)'
|
||||
),
|
||||
_('Realtime Database'),
|
||||
'JsPlatform/Extensions/firebase.png',
|
||||
|
@@ -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
|
||||
@@ -41,6 +27,20 @@ const variable = new gdjs.Variable().fromJSObject({
|
||||
// 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 () {
|
||||
/**
|
||||
* 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',
|
||||
};
|
||||
|
||||
// Increase the timeout to work on low connections as well.
|
||||
this.timeout('5s');
|
||||
|
||||
|
@@ -64,7 +64,8 @@ void DeclareInventoryExtension(gd::PlatformExtension& extension) {
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.AddParameter("string", _("Inventory name"))
|
||||
.AddParameter("string", _("Item name"))
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("InventoryTools::Count");
|
||||
|
||||
extension
|
||||
|
@@ -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');
|
||||
|
@@ -28,14 +28,14 @@ module.exports = {
|
||||
extension
|
||||
.setExtensionInformation(
|
||||
'Leaderboards',
|
||||
_('Leaderboards (experimental)'),
|
||||
_('Leaderboards'),
|
||||
_('Allow your game to send scores to your leaderboards.'),
|
||||
'Florian Rival',
|
||||
'Open source (MIT License)'
|
||||
)
|
||||
.setExtensionHelpPath('/all-features/leaderboards')
|
||||
.setCategory('Players')
|
||||
.addInstructionOrExpressionGroupMetadata(_('Leaderboards (experimental)'))
|
||||
.addInstructionOrExpressionGroupMetadata(_('Leaderboards'))
|
||||
.setIcon('JsPlatform/Extensions/leaderboard.svg');
|
||||
|
||||
extension
|
||||
@@ -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':
|
||||
|
@@ -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: [
|
||||
|
@@ -28,7 +28,7 @@ module.exports = {
|
||||
extension
|
||||
.setExtensionInformation(
|
||||
'P2P',
|
||||
_('P2P (experimental)'),
|
||||
_('P2P'),
|
||||
'Allow game instances to communicate remotely using messages sent via WebRTC (P2P).',
|
||||
'Arthur Pacaud (arthuro555)',
|
||||
'MIT'
|
||||
@@ -36,7 +36,7 @@ module.exports = {
|
||||
.setExtensionHelpPath('/all-features/p2p')
|
||||
.setCategory('Network');
|
||||
extension
|
||||
.addInstructionOrExpressionGroupMetadata(_('P2P (experimental)'))
|
||||
.addInstructionOrExpressionGroupMetadata(_('P2P'))
|
||||
.setIcon('JsPlatform/Extensions/p2picon.svg');
|
||||
|
||||
extension
|
||||
|
@@ -24,7 +24,9 @@ void DeclarePanelSpriteObjectExtension(gd::PlatformExtension& extension) {
|
||||
"Victor Levasseur and Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetExtensionHelpPath("/objects/panel_sprite");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("Panel Sprite (9-patch) Object"))
|
||||
extension
|
||||
.AddInstructionOrExpressionGroupMetadata(
|
||||
_("Panel Sprite (9-patch) Object"))
|
||||
.SetIcon("CppPlatform/Extensions/PanelSpriteIcon.png");
|
||||
|
||||
gd::ObjectMetadata& obj =
|
||||
@@ -48,7 +50,10 @@ void DeclarePanelSpriteObjectExtension(gd::PlatformExtension& extension) {
|
||||
"res/conditions/opacity.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "PanelSprite")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Opacity to compare to (0-255)")));
|
||||
|
||||
obj.AddAction(
|
||||
"SetOpacity",
|
||||
@@ -61,7 +66,10 @@ void DeclarePanelSpriteObjectExtension(gd::PlatformExtension& extension) {
|
||||
"res/actions/opacity.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "PanelSprite")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Opacity (0-255)")));
|
||||
|
||||
obj.AddExpression("Opacity",
|
||||
_("Opacity"),
|
||||
@@ -91,7 +99,8 @@ void DeclarePanelSpriteObjectExtension(gd::PlatformExtension& extension) {
|
||||
"res/actions/scaleWidth_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "PanelSprite")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("SetWidth")
|
||||
.SetGetter("GetWidth");
|
||||
|
||||
@@ -104,7 +113,8 @@ void DeclarePanelSpriteObjectExtension(gd::PlatformExtension& extension) {
|
||||
"res/conditions/scaleWidth_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "PanelSprite")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("GetWidth");
|
||||
|
||||
obj.AddAction("Height",
|
||||
@@ -116,7 +126,8 @@ void DeclarePanelSpriteObjectExtension(gd::PlatformExtension& extension) {
|
||||
"res/actions/scaleHeight_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "PanelSprite")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("SetHeight")
|
||||
.SetGetter("GetHeight");
|
||||
|
||||
@@ -129,7 +140,8 @@ void DeclarePanelSpriteObjectExtension(gd::PlatformExtension& extension) {
|
||||
"res/conditions/scaleHeight_black.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "PanelSprite")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("SetHeight")
|
||||
.SetGetter("GetHeight");
|
||||
|
||||
@@ -143,7 +155,10 @@ void DeclarePanelSpriteObjectExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.SetHidden() // Deprecated
|
||||
.AddParameter("object", _("Object"), "PanelSprite")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Angle (in degrees)")))
|
||||
.SetFunctionName("SetAngle")
|
||||
.SetGetter("GetAngle");
|
||||
|
||||
@@ -157,7 +172,10 @@ void DeclarePanelSpriteObjectExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.SetHidden() // Deprecated
|
||||
.AddParameter("object", _("Object"), "PanelSprite")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Angle to compare to (in degrees)")))
|
||||
.SetFunctionName("SetAngle")
|
||||
.SetGetter("GetAngle");
|
||||
|
||||
|
@@ -54,7 +54,8 @@ void PanelSpriteObject::DoSerializeTo(gd::SerializerElement& element) const {
|
||||
element.SetAttribute("tiled", tiled);
|
||||
}
|
||||
|
||||
void PanelSpriteObject::ExposeResources(gd::ArbitraryResourceWorker& worker) {
|
||||
void PanelSpriteObject::ExposeResources(
|
||||
gd::ArbitraryResourceWorker& worker) {
|
||||
worker.ExposeImage(textureName);
|
||||
}
|
||||
#endif
|
||||
|
@@ -8,12 +8,13 @@ This project is released under the MIT License.
|
||||
#ifndef PANELSPRITEOBJECT_H
|
||||
#define PANELSPRITEOBJECT_H
|
||||
#include <memory>
|
||||
|
||||
#include "GDCore/Project/Object.h"
|
||||
namespace gd {
|
||||
class ObjectConfiguration;
|
||||
class InitialInstance;
|
||||
class Project;
|
||||
}
|
||||
} // namespace gd
|
||||
|
||||
/**
|
||||
* PanelSprite Object
|
||||
@@ -23,37 +24,36 @@ class GD_EXTENSION_API PanelSpriteObject : public gd::ObjectConfiguration {
|
||||
PanelSpriteObject();
|
||||
virtual ~PanelSpriteObject();
|
||||
virtual std::unique_ptr<gd::ObjectConfiguration> Clone() const {
|
||||
return std::unique_ptr<gd::ObjectConfiguration>(new PanelSpriteObject(*this));
|
||||
return std::unique_ptr<gd::ObjectConfiguration>(
|
||||
new PanelSpriteObject(*this));
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual void ExposeResources(gd::ArbitraryResourceWorker &worker);
|
||||
#endif
|
||||
|
||||
float GetWidth() const { return width; };
|
||||
float GetHeight() const { return height; };
|
||||
double GetWidth() const { return width; };
|
||||
double GetHeight() const { return height; };
|
||||
|
||||
void SetWidth(float newWidth) {
|
||||
void SetWidth(double newWidth) {
|
||||
width = newWidth >= (leftMargin + rightMargin) ? newWidth
|
||||
: (leftMargin + rightMargin);
|
||||
};
|
||||
void SetHeight(float newHeight) {
|
||||
void SetHeight(double newHeight) {
|
||||
height = newHeight >= (topMargin + bottomMargin)
|
||||
? newHeight
|
||||
: (topMargin + bottomMargin);
|
||||
};
|
||||
|
||||
float GetLeftMargin() const { return leftMargin; };
|
||||
void SetLeftMargin(float newMargin) { leftMargin = newMargin; };
|
||||
double GetLeftMargin() const { return leftMargin; };
|
||||
void SetLeftMargin(double newMargin) { leftMargin = newMargin; };
|
||||
|
||||
float GetTopMargin() const { return topMargin; };
|
||||
void SetTopMargin(float newMargin) { topMargin = newMargin; };
|
||||
double GetTopMargin() const { return topMargin; };
|
||||
void SetTopMargin(double newMargin) { topMargin = newMargin; };
|
||||
|
||||
float GetRightMargin() const { return rightMargin; };
|
||||
void SetRightMargin(float newMargin) { rightMargin = newMargin; };
|
||||
double GetRightMargin() const { return rightMargin; };
|
||||
void SetRightMargin(double newMargin) { rightMargin = newMargin; };
|
||||
|
||||
float GetBottomMargin() const { return bottomMargin; };
|
||||
void SetBottomMargin(float newMargin) { bottomMargin = newMargin; };
|
||||
double GetBottomMargin() const { return bottomMargin; };
|
||||
void SetBottomMargin(double newMargin) { bottomMargin = newMargin; };
|
||||
|
||||
bool IsTiled() const { return tiled; };
|
||||
void SetTiled(bool enable = true) { tiled = enable; };
|
||||
@@ -72,13 +72,13 @@ class GD_EXTENSION_API PanelSpriteObject : public gd::ObjectConfiguration {
|
||||
virtual void DoSerializeTo(gd::SerializerElement &element) const;
|
||||
#endif
|
||||
|
||||
float width;
|
||||
float height;
|
||||
double width;
|
||||
double height;
|
||||
|
||||
float leftMargin;
|
||||
float topMargin;
|
||||
float rightMargin;
|
||||
float bottomMargin;
|
||||
double leftMargin;
|
||||
double topMargin;
|
||||
double rightMargin;
|
||||
double bottomMargin;
|
||||
|
||||
bool tiled;
|
||||
};
|
||||
|
@@ -5,10 +5,9 @@ Copyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com)
|
||||
This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "Extension.h"
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
|
||||
#include "Extension.h"
|
||||
#include "ParticleEmitterObject.h"
|
||||
|
||||
/**
|
||||
@@ -23,7 +22,8 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("EmitterForceMax",
|
||||
_("Emission maximal force"),
|
||||
@@ -33,7 +33,8 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("EmitterAngle",
|
||||
_("Emission angle"),
|
||||
@@ -43,7 +44,10 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Angle (in degrees)")));
|
||||
|
||||
obj.AddCondition("EmitterAngle",
|
||||
_("Emission angle"),
|
||||
@@ -53,7 +57,10 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Angle to compare to (in degrees)")));
|
||||
|
||||
obj.AddAction("EmitterAngleA",
|
||||
_("Emission angle 1"),
|
||||
@@ -63,8 +70,9 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.SetHidden(); // Angle A is not used.
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions())
|
||||
.SetHidden(); // Angle A is not used.
|
||||
|
||||
obj.AddCondition("EmitterAngleA",
|
||||
_("Emission angle 1"),
|
||||
@@ -74,8 +82,9 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.SetHidden(); // Angle A is not used.
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.SetHidden(); // Angle A is not used.
|
||||
|
||||
obj.AddAction("EmitterAngleB",
|
||||
_("Emission angle 2"),
|
||||
@@ -85,8 +94,9 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.SetHidden(); // Angle B is the same as cone spray angle
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions())
|
||||
.SetHidden(); // Angle B is the same as cone spray angle
|
||||
|
||||
obj.AddCondition("EmitterAngleB",
|
||||
_("Emission angle 2"),
|
||||
@@ -96,8 +106,9 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.SetHidden(); // Angle B is the same as cone spray angle
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.SetHidden(); // Angle B is the same as cone spray angle
|
||||
|
||||
obj.AddAction(
|
||||
"ConeSprayAngle",
|
||||
@@ -108,7 +119,10 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Angle (in degrees)")));
|
||||
|
||||
obj.AddCondition("ConeSprayAngle",
|
||||
_("Angle of the spray cone"),
|
||||
@@ -118,7 +132,10 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Angle to compare to (in degrees)")));
|
||||
|
||||
obj.AddAction("ZoneRadius",
|
||||
_("Creation radius"),
|
||||
@@ -129,7 +146,8 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition("ZoneRadius",
|
||||
_("Creation radius"),
|
||||
@@ -139,19 +157,23 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction(
|
||||
"ParticleLifeTimeMin",
|
||||
_("Minimum lifetime"),
|
||||
_("Modify particles minimum lifetime.Particles have to be recreated "
|
||||
_("Modify particles minimum lifetime. Particles have to be recreated "
|
||||
"in order to take changes in account."),
|
||||
_("the minimum lifetime of particles"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Duration (in seconds)")));
|
||||
|
||||
obj.AddCondition(
|
||||
"ParticleLifeTimeMin",
|
||||
@@ -162,7 +184,10 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Duration to compare to (in seconds)")));
|
||||
|
||||
obj.AddAction(
|
||||
"ParticleLifeTimeMax",
|
||||
@@ -174,7 +199,10 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Duration (in seconds)")));
|
||||
|
||||
obj.AddCondition(
|
||||
"ParticleLifeTimeMax",
|
||||
@@ -185,7 +213,10 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Duration to compare to (in seconds)")));
|
||||
|
||||
obj.AddAction("ParticleGravityX",
|
||||
_("Gravity value on X axis"),
|
||||
@@ -195,7 +226,8 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition(
|
||||
"ParticleGravityX",
|
||||
@@ -206,7 +238,8 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("ParticleGravityY",
|
||||
_("Gravity value on Y axis"),
|
||||
@@ -216,7 +249,8 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition(
|
||||
"ParticleGravityY",
|
||||
@@ -227,7 +261,8 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("ParticleGravityAngle",
|
||||
_("Gravity angle"),
|
||||
@@ -237,7 +272,10 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Angle (in degrees)")));
|
||||
|
||||
obj.AddCondition("ParticleGravityAngle",
|
||||
_("Gravity angle"),
|
||||
@@ -247,7 +285,10 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Angle to compare to (in degrees)")));
|
||||
|
||||
obj.AddAction("ParticleGravityLength",
|
||||
_("Gravity"),
|
||||
@@ -257,7 +298,8 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition("ParticleGravityLength",
|
||||
_("Gravity"),
|
||||
@@ -267,11 +309,13 @@ void ExtensionSubDeclaration1(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("StartEmission",
|
||||
_("Start emission"),
|
||||
_("Refill tank (if not infinite) and start emission of the particles."),
|
||||
_("Refill tank (if not infinite) and start emission of the "
|
||||
"particles."),
|
||||
_("Start emission of _PARAM0_"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
|
@@ -5,11 +5,10 @@ Copyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com)
|
||||
This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "Extension.h"
|
||||
#include "GDCore/Extensions/Metadata/MultipleInstructionMetadata.h"
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "GDCore/Extensions/Metadata/MultipleInstructionMetadata.h"
|
||||
|
||||
#include "Extension.h"
|
||||
#include "ParticleEmitterObject.h"
|
||||
|
||||
/**
|
||||
@@ -36,137 +35,161 @@ void ExtensionSubDeclaration2(gd::ObjectMetadata& obj) {
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.AddParameter("color", _("End color"));
|
||||
|
||||
obj.AddAction(
|
||||
"ParticleRed1",
|
||||
_("Start color red component"),
|
||||
_("Modify the start color red component."),
|
||||
_("the start color red component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddAction("ParticleRed1",
|
||||
_("Start color red component"),
|
||||
_("Modify the start color red component."),
|
||||
_("the start color red component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value (0-255)")));
|
||||
|
||||
obj.AddCondition(
|
||||
"ParticleRed1",
|
||||
_("Start color red component"),
|
||||
_("Compare the start color red component."),
|
||||
_("the start color red component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddCondition("ParticleRed1",
|
||||
_("Start color red component"),
|
||||
_("Compare the start color red component."),
|
||||
_("the start color red component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value to compare to (0-255)")));
|
||||
|
||||
obj.AddAction(
|
||||
"ParticleRed2",
|
||||
_("End color red component"),
|
||||
_("Modify the end color red component."),
|
||||
_("the end color red component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddAction("ParticleRed2",
|
||||
_("End color red component"),
|
||||
_("Modify the end color red component."),
|
||||
_("the end color red component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value (0-255)")));
|
||||
|
||||
obj.AddCondition(
|
||||
"ParticleRed2",
|
||||
_("End color red component"),
|
||||
_("Compare the end color red component."),
|
||||
_("the end color red component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddCondition("ParticleRed2",
|
||||
_("End color red component"),
|
||||
_("Compare the end color red component."),
|
||||
_("the end color red component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value to compare to (0-255)")));
|
||||
|
||||
obj.AddAction(
|
||||
"ParticleBlue1",
|
||||
_("Start color blue component"),
|
||||
_("Modify the start color blue component."),
|
||||
_("the start color blue component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddAction("ParticleBlue1",
|
||||
_("Start color blue component"),
|
||||
_("Modify the start color blue component."),
|
||||
_("the start color blue component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value (0-255)")));
|
||||
|
||||
obj.AddCondition(
|
||||
"ParticleBlue1",
|
||||
_("Start color blue component"),
|
||||
_("Compare the start color blue component."),
|
||||
_("the start color blue component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddCondition("ParticleBlue1",
|
||||
_("Start color blue component"),
|
||||
_("Compare the start color blue component."),
|
||||
_("the start color blue component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value to compare to (0-255)")));
|
||||
|
||||
obj.AddAction(
|
||||
"ParticleBlue2",
|
||||
_("End color blue component"),
|
||||
_("Modify the end color blue component."),
|
||||
_("the end color blue component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddAction("ParticleBlue2",
|
||||
_("End color blue component"),
|
||||
_("Modify the end color blue component."),
|
||||
_("the end color blue component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value (0-255)")));
|
||||
|
||||
obj.AddCondition(
|
||||
"ParticleBlue2",
|
||||
_("End color blue component"),
|
||||
_("Compare the end color blue component."),
|
||||
_("the end color blue component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddCondition("ParticleBlue2",
|
||||
_("End color blue component"),
|
||||
_("Compare the end color blue component."),
|
||||
_("the end color blue component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value to compare to (0-255)")));
|
||||
|
||||
obj.AddAction(
|
||||
"ParticleGreen1",
|
||||
_("Start color green component"),
|
||||
_("Modify the start color green component."),
|
||||
_("the start color green component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddAction("ParticleGreen1",
|
||||
_("Start color green component"),
|
||||
_("Modify the start color green component."),
|
||||
_("the start color green component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value (0-255)")));
|
||||
|
||||
obj.AddCondition(
|
||||
"ParticleGreen1",
|
||||
_("Start color green component"),
|
||||
_("Compare the start color green component."),
|
||||
_("the start color green component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddCondition("ParticleGreen1",
|
||||
_("Start color green component"),
|
||||
_("Compare the start color green component."),
|
||||
_("the start color green component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value to compare to (0-255)")));
|
||||
|
||||
obj.AddAction(
|
||||
"ParticleGreen2",
|
||||
_("End color green component"),
|
||||
_("Modify the end color green component."),
|
||||
_("the end color green component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddAction("ParticleGreen2",
|
||||
_("End color green component"),
|
||||
_("Modify the end color green component."),
|
||||
_("the end color green component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value (0-255)")));
|
||||
|
||||
obj.AddCondition(
|
||||
"ParticleGreen2",
|
||||
_("End color green component"),
|
||||
_("Compare the end color green component."),
|
||||
_("the end color green component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddCondition("ParticleGreen2",
|
||||
_("End color green component"),
|
||||
_("Compare the end color green component."),
|
||||
_("the end color green component"),
|
||||
_("Advanced"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value to compare to (0-255)")));
|
||||
|
||||
obj.AddAction("ParticleSize1",
|
||||
_("Start size"),
|
||||
@@ -176,7 +199,8 @@ void ExtensionSubDeclaration2(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition("ParticleSize1",
|
||||
_("Start size"),
|
||||
@@ -186,7 +210,8 @@ void ExtensionSubDeclaration2(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("ParticleSize2",
|
||||
_("End size"),
|
||||
@@ -196,7 +221,8 @@ void ExtensionSubDeclaration2(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition("ParticleSize2",
|
||||
_("End size"),
|
||||
@@ -206,7 +232,8 @@ void ExtensionSubDeclaration2(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("ParticleAlpha1",
|
||||
_("Start opacity"),
|
||||
@@ -216,18 +243,23 @@ void ExtensionSubDeclaration2(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value (0-255)")));
|
||||
|
||||
obj.AddCondition(
|
||||
"ParticleAlpha1",
|
||||
_("Start opacity"),
|
||||
_("Compare the start opacity of particles."),
|
||||
_("the start opacity"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddCondition("ParticleAlpha1",
|
||||
_("Start opacity"),
|
||||
_("Compare the start opacity of particles."),
|
||||
_("the start opacity"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value to compare to (0-255)")));
|
||||
|
||||
obj.AddAction("ParticleAlpha2",
|
||||
_("End opacity"),
|
||||
@@ -237,18 +269,23 @@ void ExtensionSubDeclaration2(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value (0-255)")));
|
||||
|
||||
obj.AddCondition(
|
||||
"ParticleAlpha2",
|
||||
_("End opacity"),
|
||||
_("Compare the end opacity of particles."),
|
||||
_("the end opacity"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddCondition("ParticleAlpha2",
|
||||
_("End opacity"),
|
||||
_("Compare the end opacity of particles."),
|
||||
_("the end opacity"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Value to compare to (0-255)")));
|
||||
|
||||
obj.AddCondition("NoMoreParticles",
|
||||
_("No more particles"),
|
||||
@@ -261,58 +298,63 @@ void ExtensionSubDeclaration2(gd::ObjectMetadata& obj) {
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter");
|
||||
|
||||
obj.AddExpressionAndConditionAndAction(
|
||||
"number",
|
||||
"ParticleRotationMinSpeed",
|
||||
_("Particle rotation min speed"),
|
||||
_("the minimum rotation speed of the particles"),
|
||||
_("the particles minimum rotation speed"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png")
|
||||
"number",
|
||||
"ParticleRotationMinSpeed",
|
||||
_("Particle rotation min speed"),
|
||||
_("the minimum rotation speed of the particles"),
|
||||
_("the particles minimum rotation speed"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Angular speed (in degrees per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("setParticleRotationMinSpeed")
|
||||
.SetGetter("getParticleRotationMinSpeed");
|
||||
|
||||
obj.AddExpressionAndConditionAndAction(
|
||||
"number",
|
||||
"ParticleRotationMaxSpeed",
|
||||
_("Particle rotation max speed"),
|
||||
_("the maximum rotation speed of the particles"),
|
||||
_("the particles maximum rotation speed"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png")
|
||||
"number",
|
||||
"ParticleRotationMaxSpeed",
|
||||
_("Particle rotation max speed"),
|
||||
_("the maximum rotation speed of the particles"),
|
||||
_("the particles maximum rotation speed"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Angular speed (in degrees per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("setParticleRotationMaxSpeed")
|
||||
.SetGetter("getParticleRotationMaxSpeed");
|
||||
|
||||
obj.AddExpressionAndConditionAndAction(
|
||||
"number",
|
||||
"MaxParticlesCount",
|
||||
_("Number of displayed particles"),
|
||||
_("the maximum number of displayed particles"),
|
||||
_("the maximum number of displayed particles"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png")
|
||||
"number",
|
||||
"MaxParticlesCount",
|
||||
_("Number of displayed particles"),
|
||||
_("the maximum number of displayed particles"),
|
||||
_("the maximum number of displayed particles"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters("number", gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("setMaxParticlesCount")
|
||||
.SetGetter("getMaxParticlesCount");
|
||||
|
||||
obj.AddExpressionAndConditionAndAction(
|
||||
"boolean",
|
||||
"AdditiveRendering",
|
||||
_("Activate particles additive rendering"),
|
||||
_("the particles additive rendering is activated"),
|
||||
_("displaying particles with additive rendering activated"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png")
|
||||
"boolean",
|
||||
"AdditiveRendering",
|
||||
_("Activate particles additive rendering"),
|
||||
_("the particles additive rendering is activated"),
|
||||
_("displaying particles with additive rendering activated"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardParameters("boolean")
|
||||
.UseStandardParameters("boolean", gd::ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("setAdditiveRendering")
|
||||
.SetGetter("getAdditiveRendering");
|
||||
|
||||
}
|
||||
|
@@ -34,19 +34,20 @@ void ExtensionSubDeclaration3(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition(
|
||||
"RendererParam1",
|
||||
_("Rendering first parameter"),
|
||||
_("Test the first parameter of rendering (Size/Length)."),
|
||||
_("the 1st rendering parameter"),
|
||||
_("Setup"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddCondition("RendererParam1",
|
||||
_("Rendering first parameter"),
|
||||
_("Test the first parameter of rendering (Size/Length)."),
|
||||
_("the 1st rendering parameter"),
|
||||
_("Setup"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("RendererParam2",
|
||||
_("Rendering second parameter"),
|
||||
@@ -58,18 +59,19 @@ void ExtensionSubDeclaration3(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddCondition(
|
||||
"RendererParam2",
|
||||
_("Rendering second parameter"),
|
||||
_("Test the second parameter of rendering (Size/Length)."),
|
||||
_("the 2nd rendering parameter"),
|
||||
_("Setup"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddCondition("RendererParam2",
|
||||
_("Rendering second parameter"),
|
||||
_("Test the second parameter of rendering (Size/Length)."),
|
||||
_("the 2nd rendering parameter"),
|
||||
_("Setup"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("Tank",
|
||||
_("Capacity"),
|
||||
@@ -79,8 +81,9 @@ void ExtensionSubDeclaration3(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.SetHidden() // DEPRECATED - Use SetTank instead
|
||||
.UseStandardOperatorParameters("number");
|
||||
.SetHidden() // DEPRECATED - Use SetTank instead
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("SetTank",
|
||||
_("Capacity"),
|
||||
@@ -90,7 +93,9 @@ void ExtensionSubDeclaration3(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(_("Capacity")));
|
||||
|
||||
obj.AddCondition("Tank",
|
||||
_("Capacity"),
|
||||
@@ -100,7 +105,10 @@ void ExtensionSubDeclaration3(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Capacity to compare to")));
|
||||
|
||||
obj.AddAction("Flow",
|
||||
_("Flow"),
|
||||
@@ -110,8 +118,9 @@ void ExtensionSubDeclaration3(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.SetHidden() // DEPRECATED - Use SetFlow instead
|
||||
.UseStandardOperatorParameters("number");
|
||||
.SetHidden() // DEPRECATED - Use SetFlow instead
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddAction("SetFlow",
|
||||
_("Flow"),
|
||||
@@ -121,7 +130,10 @@ void ExtensionSubDeclaration3(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Flow (in particles per second)")));
|
||||
|
||||
obj.AddCondition("Flow",
|
||||
_("Flow"),
|
||||
@@ -131,7 +143,10 @@ void ExtensionSubDeclaration3(gd::ObjectMetadata& obj) {
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("number");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Flow to compare to (in particles per second)")));
|
||||
|
||||
obj.AddAction("Texture",
|
||||
_("Particle image (using an expression)"),
|
||||
@@ -154,16 +169,16 @@ void ExtensionSubDeclaration3(gd::ObjectMetadata& obj) {
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.AddParameter("imageResource", _("Image file (or image resource name)"));
|
||||
|
||||
obj.AddCondition(
|
||||
"Texture",
|
||||
_("Image"),
|
||||
_("Test the name of the image displayed by particles."),
|
||||
_("the image displayed by particles"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
obj.AddCondition("Texture",
|
||||
_("Image"),
|
||||
_("Test the name of the image displayed by particles."),
|
||||
_("the image displayed by particles"),
|
||||
_("Common"),
|
||||
"CppPlatform/Extensions/particleSystemicon24.png",
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter")
|
||||
.UseStandardRelationalOperatorParameters("string");
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"string", gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
obj.AddStrExpression("Texture",
|
||||
_("Particles image"),
|
||||
@@ -177,7 +192,7 @@ void ExtensionSubDeclaration3(gd::ObjectMetadata& obj) {
|
||||
_("Particles number"),
|
||||
_("Particles"),
|
||||
"CppPlatform/Extensions/particleSystemicon16.png")
|
||||
.SetHidden() // DEPRECATED - Use CurrentParticleCount instead
|
||||
.SetHidden() // DEPRECATED - Use CurrentParticleCount instead
|
||||
.AddParameter("object", _("Object"), "ParticleEmitter", false);
|
||||
|
||||
obj.AddExpression("CurrentParticleCount",
|
||||
|
@@ -5,16 +5,15 @@ Copyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com)
|
||||
This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "ParticleEmitterObject.h"
|
||||
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/IDE/Project/ArbitraryResourceWorker.h"
|
||||
#include "GDCore/Project/InitialInstance.h"
|
||||
#include "GDCore/Project/Object.h"
|
||||
#include "GDCore/Project/Project.h"
|
||||
#include "GDCore/Serialization/SerializerElement.h"
|
||||
#include "ParticleEmitterObject.h"
|
||||
|
||||
#include "GDCore/IDE/Project/ArbitraryResourceWorker.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -178,53 +177,49 @@ void ParticleEmitterObject::ExposeResources(
|
||||
SetParticleTexture(texture);
|
||||
}
|
||||
|
||||
void ParticleEmitterBase::SetTank(float newValue) {
|
||||
tank = newValue;
|
||||
}
|
||||
void ParticleEmitterBase::SetFlow(float newValue) {
|
||||
flow = newValue;
|
||||
}
|
||||
void ParticleEmitterBase::SetEmitterForceMin(float newValue) {
|
||||
void ParticleEmitterBase::SetTank(double newValue) { tank = newValue; }
|
||||
void ParticleEmitterBase::SetFlow(double newValue) { flow = newValue; }
|
||||
void ParticleEmitterBase::SetEmitterForceMin(double newValue) {
|
||||
emitterForceMin = newValue;
|
||||
}
|
||||
void ParticleEmitterBase::SetEmitterForceMax(float newValue) {
|
||||
void ParticleEmitterBase::SetEmitterForceMax(double newValue) {
|
||||
emitterForceMax = newValue;
|
||||
}
|
||||
void ParticleEmitterBase::SetParticleGravityX(float newValue) {
|
||||
void ParticleEmitterBase::SetParticleGravityX(double newValue) {
|
||||
particleGravityX = newValue;
|
||||
}
|
||||
void ParticleEmitterBase::SetParticleGravityY(float newValue) {
|
||||
void ParticleEmitterBase::SetParticleGravityY(double newValue) {
|
||||
particleGravityY = newValue;
|
||||
}
|
||||
void ParticleEmitterBase::SetEmitterAngleA(float newValue) {
|
||||
void ParticleEmitterBase::SetEmitterAngleA(double newValue) {
|
||||
emitterAngleA = newValue;
|
||||
}
|
||||
void ParticleEmitterBase::SetEmitterAngleB(float newValue) {
|
||||
void ParticleEmitterBase::SetEmitterAngleB(double newValue) {
|
||||
emitterAngleB = newValue;
|
||||
}
|
||||
void ParticleEmitterBase::SetZoneRadius(float newValue) {
|
||||
void ParticleEmitterBase::SetZoneRadius(double newValue) {
|
||||
zoneRadius = newValue;
|
||||
}
|
||||
|
||||
void ParticleEmitterBase::SetParticleGravityAngle(float newAngleInDegree) {
|
||||
float length = sqrt(GetParticleGravityY() * GetParticleGravityY() +
|
||||
GetParticleGravityX() * GetParticleGravityX());
|
||||
void ParticleEmitterBase::SetParticleGravityAngle(double newAngleInDegree) {
|
||||
double length = sqrt(GetParticleGravityY() * GetParticleGravityY() +
|
||||
GetParticleGravityX() * GetParticleGravityX());
|
||||
|
||||
SetParticleGravityX(cos(newAngleInDegree / 180.0f * 3.14159f) * length);
|
||||
SetParticleGravityY(sin(newAngleInDegree / 180.0f * 3.14159f) * length);
|
||||
}
|
||||
void ParticleEmitterBase::SetParticleGravityLength(float length) {
|
||||
float angle = atan2(GetParticleGravityY(), GetParticleGravityX());
|
||||
void ParticleEmitterBase::SetParticleGravityLength(double length) {
|
||||
double angle = atan2(GetParticleGravityY(), GetParticleGravityX());
|
||||
|
||||
SetParticleGravityX(cos(angle) * length);
|
||||
SetParticleGravityY(sin(angle) * length);
|
||||
}
|
||||
|
||||
float ParticleEmitterBase::GetParticleGravityAngle() const {
|
||||
double ParticleEmitterBase::GetParticleGravityAngle() const {
|
||||
return atan2(GetParticleGravityY(), GetParticleGravityX()) * 180.0f /
|
||||
3.14159f;
|
||||
}
|
||||
float ParticleEmitterBase::GetParticleGravityLength() const {
|
||||
double ParticleEmitterBase::GetParticleGravityLength() const {
|
||||
return sqrt(GetParticleGravityY() * GetParticleGravityY() +
|
||||
GetParticleGravityX() * GetParticleGravityX());
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ This project is released under the MIT License.
|
||||
namespace gd {
|
||||
class InitialInstance;
|
||||
class Project;
|
||||
}
|
||||
} // namespace gd
|
||||
|
||||
/**
|
||||
* \brief Base class containing the parameters of an emitter as well as the
|
||||
@@ -22,95 +22,69 @@ class GD_EXTENSION_API ParticleEmitterBase {
|
||||
public:
|
||||
ParticleEmitterBase();
|
||||
virtual ~ParticleEmitterBase();
|
||||
ParticleEmitterBase(const ParticleEmitterBase& other) {
|
||||
Init(other);
|
||||
};
|
||||
ParticleEmitterBase(const ParticleEmitterBase& other) { Init(other); };
|
||||
ParticleEmitterBase& operator=(const ParticleEmitterBase& other) {
|
||||
if (&other != this) Init(other);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void SetParticleTexture(const gd::String & imageName) {
|
||||
void SetParticleTexture(const gd::String& imageName) {
|
||||
textureParticleName = imageName;
|
||||
};
|
||||
const gd::String & GetParticleTexture() const { return textureParticleName; };
|
||||
const gd::String& GetParticleTexture() const { return textureParticleName; };
|
||||
|
||||
void SetRendererParam1(float newValue) { rendererParam1 = newValue; };
|
||||
void SetRendererParam2(float newValue) { rendererParam2 = newValue; };
|
||||
void SetTank(float newValue);
|
||||
void SetFlow(float newValue);
|
||||
void SetEmitterForceMin(float newValue);
|
||||
void SetEmitterForceMax(float newValue);
|
||||
void SetEmitterAngleA(float newValue);
|
||||
void SetEmitterAngleB(float newValue);
|
||||
void SetConeSprayAngle(float newValue) { SetEmitterAngleB(newValue); };
|
||||
void SetZoneRadius(float newValue);
|
||||
void SetParticleGravityX(float newValue);
|
||||
void SetParticleGravityY(float newValue);
|
||||
void SetParticleGravityAngle(float newAngleInDegree);
|
||||
void SetParticleGravityLength(float newLength);
|
||||
void SetRendererParam1(double newValue) { rendererParam1 = newValue; };
|
||||
void SetRendererParam2(double newValue) { rendererParam2 = newValue; };
|
||||
void SetTank(double newValue);
|
||||
void SetFlow(double newValue);
|
||||
void SetEmitterForceMin(double newValue);
|
||||
void SetEmitterForceMax(double newValue);
|
||||
void SetEmitterAngleA(double newValue);
|
||||
void SetEmitterAngleB(double newValue);
|
||||
void SetConeSprayAngle(double newValue) { SetEmitterAngleB(newValue); };
|
||||
void SetZoneRadius(double newValue);
|
||||
void SetParticleGravityX(double newValue);
|
||||
void SetParticleGravityY(double newValue);
|
||||
void SetParticleGravityAngle(double newAngleInDegree);
|
||||
void SetParticleGravityLength(double newLength);
|
||||
|
||||
void SetParticleColor1(const gd::String& color);
|
||||
void SetParticleColor2(const gd::String& color);
|
||||
|
||||
void SetParticleRed1(float newValue) {
|
||||
particleRed1 = newValue;
|
||||
};
|
||||
void SetParticleRed2(float newValue) {
|
||||
particleRed2 = newValue;
|
||||
};
|
||||
void SetParticleGreen1(float newValue) {
|
||||
particleGreen1 = newValue;
|
||||
};
|
||||
void SetParticleGreen2(float newValue) {
|
||||
particleGreen2 = newValue;
|
||||
};
|
||||
void SetParticleBlue1(float newValue) {
|
||||
particleBlue1 = newValue;
|
||||
};
|
||||
void SetParticleBlue2(float newValue) {
|
||||
particleBlue2 = newValue;
|
||||
};
|
||||
void SetParticleAlpha1(float newValue) {
|
||||
particleAlpha1 = newValue;
|
||||
};
|
||||
void SetParticleAlpha2(float newValue) {
|
||||
particleAlpha2 = newValue;
|
||||
};
|
||||
void SetParticleSize1(float newValue) {
|
||||
particleSize1 = newValue;
|
||||
};
|
||||
void SetParticleSize2(float newValue) {
|
||||
particleSize2 = newValue;
|
||||
};
|
||||
void SetParticleAngle1(float newValue) {
|
||||
particleAngle1 = newValue;
|
||||
};
|
||||
void SetParticleAngle2(float newValue) {
|
||||
particleAngle2 = newValue;
|
||||
};
|
||||
void SetParticleAlphaRandomness1(float newValue) {
|
||||
void SetParticleRed1(double newValue) { particleRed1 = newValue; };
|
||||
void SetParticleRed2(double newValue) { particleRed2 = newValue; };
|
||||
void SetParticleGreen1(double newValue) { particleGreen1 = newValue; };
|
||||
void SetParticleGreen2(double newValue) { particleGreen2 = newValue; };
|
||||
void SetParticleBlue1(double newValue) { particleBlue1 = newValue; };
|
||||
void SetParticleBlue2(double newValue) { particleBlue2 = newValue; };
|
||||
void SetParticleAlpha1(double newValue) { particleAlpha1 = newValue; };
|
||||
void SetParticleAlpha2(double newValue) { particleAlpha2 = newValue; };
|
||||
void SetParticleSize1(double newValue) { particleSize1 = newValue; };
|
||||
void SetParticleSize2(double newValue) { particleSize2 = newValue; };
|
||||
void SetParticleAngle1(double newValue) { particleAngle1 = newValue; };
|
||||
void SetParticleAngle2(double newValue) { particleAngle2 = newValue; };
|
||||
void SetParticleAlphaRandomness1(double newValue) {
|
||||
particleAlphaRandomness1 = newValue;
|
||||
};
|
||||
void SetParticleAlphaRandomness2(float newValue) {
|
||||
void SetParticleAlphaRandomness2(double newValue) {
|
||||
particleAlphaRandomness2 = newValue;
|
||||
};
|
||||
void SetParticleSizeRandomness1(float newValue) {
|
||||
void SetParticleSizeRandomness1(double newValue) {
|
||||
particleSizeRandomness1 = newValue;
|
||||
};
|
||||
void SetParticleSizeRandomness2(float newValue) {
|
||||
void SetParticleSizeRandomness2(double newValue) {
|
||||
particleSizeRandomness2 = newValue;
|
||||
};
|
||||
void SetParticleAngleRandomness1(float newValue) {
|
||||
void SetParticleAngleRandomness1(double newValue) {
|
||||
particleAngleRandomness1 = newValue;
|
||||
};
|
||||
void SetParticleAngleRandomness2(float newValue) {
|
||||
void SetParticleAngleRandomness2(double newValue) {
|
||||
particleAngleRandomness2 = newValue;
|
||||
};
|
||||
void SetParticleLifeTimeMin(float newValue) {
|
||||
void SetParticleLifeTimeMin(double newValue) {
|
||||
particleLifeTimeMin = newValue;
|
||||
};
|
||||
void SetParticleLifeTimeMax(float newValue) {
|
||||
void SetParticleLifeTimeMax(double newValue) {
|
||||
particleLifeTimeMax = newValue;
|
||||
};
|
||||
void SetMaxParticleNb(std::size_t newValue) { maxParticleNb = newValue; };
|
||||
@@ -118,50 +92,49 @@ class GD_EXTENSION_API ParticleEmitterBase {
|
||||
destroyWhenNoParticles = enable;
|
||||
};
|
||||
|
||||
float GetRendererParam1() const { return rendererParam1; };
|
||||
float GetRendererParam2() const { return rendererParam2; };
|
||||
float GetTank() const { return tank; };
|
||||
float GetFlow() const { return flow; };
|
||||
float GetEmitterForceMin() const { return emitterForceMin; };
|
||||
float GetEmitterForceMax() const { return emitterForceMax; };
|
||||
float GetEmitterAngleA() const { return emitterAngleA; };
|
||||
float GetEmitterAngleB() const { return emitterAngleB; };
|
||||
float GetConeSprayAngle() const { return GetEmitterAngleB(); };
|
||||
float GetZoneRadius() const { return zoneRadius; };
|
||||
float GetParticleGravityX() const { return particleGravityX; };
|
||||
float GetParticleGravityY() const { return particleGravityY; };
|
||||
float GetParticleGravityAngle() const;
|
||||
float GetParticleGravityLength() const;
|
||||
float GetParticleLifeTimeMin() const { return particleLifeTimeMin; };
|
||||
float GetParticleLifeTimeMax() const { return particleLifeTimeMax; };
|
||||
double GetRendererParam1() const { return rendererParam1; };
|
||||
double GetRendererParam2() const { return rendererParam2; };
|
||||
double GetTank() const { return tank; };
|
||||
double GetFlow() const { return flow; };
|
||||
double GetEmitterForceMin() const { return emitterForceMin; };
|
||||
double GetEmitterForceMax() const { return emitterForceMax; };
|
||||
double GetEmitterAngleA() const { return emitterAngleA; };
|
||||
double GetEmitterAngleB() const { return emitterAngleB; };
|
||||
double GetConeSprayAngle() const { return GetEmitterAngleB(); };
|
||||
double GetZoneRadius() const { return zoneRadius; };
|
||||
double GetParticleGravityX() const { return particleGravityX; };
|
||||
double GetParticleGravityY() const { return particleGravityY; };
|
||||
double GetParticleGravityAngle() const;
|
||||
double GetParticleGravityLength() const;
|
||||
double GetParticleLifeTimeMin() const { return particleLifeTimeMin; };
|
||||
double GetParticleLifeTimeMax() const { return particleLifeTimeMax; };
|
||||
std::size_t GetMaxParticleNb() const { return maxParticleNb; };
|
||||
bool GetDestroyWhenNoParticles() const { return destroyWhenNoParticles; };
|
||||
|
||||
|
||||
float GetParticleRed1() const { return particleRed1; };
|
||||
float GetParticleRed2() const { return particleRed2; };
|
||||
float GetParticleGreen1() const { return particleGreen1; };
|
||||
float GetParticleGreen2() const { return particleGreen2; };
|
||||
float GetParticleBlue1() const { return particleBlue1; };
|
||||
float GetParticleBlue2() const { return particleBlue2; };
|
||||
float GetParticleAlpha1() const { return particleAlpha1; };
|
||||
float GetParticleAlpha2() const { return particleAlpha2; };
|
||||
float GetParticleSize1() const { return particleSize1; };
|
||||
float GetParticleSize2() const { return particleSize2; };
|
||||
float GetParticleAngle1() const { return particleAngle1; };
|
||||
float GetParticleAngle2() const { return particleAngle2; };
|
||||
float GetParticleAlphaRandomness1() const {
|
||||
double GetParticleRed1() const { return particleRed1; };
|
||||
double GetParticleRed2() const { return particleRed2; };
|
||||
double GetParticleGreen1() const { return particleGreen1; };
|
||||
double GetParticleGreen2() const { return particleGreen2; };
|
||||
double GetParticleBlue1() const { return particleBlue1; };
|
||||
double GetParticleBlue2() const { return particleBlue2; };
|
||||
double GetParticleAlpha1() const { return particleAlpha1; };
|
||||
double GetParticleAlpha2() const { return particleAlpha2; };
|
||||
double GetParticleSize1() const { return particleSize1; };
|
||||
double GetParticleSize2() const { return particleSize2; };
|
||||
double GetParticleAngle1() const { return particleAngle1; };
|
||||
double GetParticleAngle2() const { return particleAngle2; };
|
||||
double GetParticleAlphaRandomness1() const {
|
||||
return particleAlphaRandomness1;
|
||||
};
|
||||
float GetParticleAlphaRandomness2() const {
|
||||
double GetParticleAlphaRandomness2() const {
|
||||
return particleAlphaRandomness2;
|
||||
};
|
||||
float GetParticleSizeRandomness1() const { return particleSizeRandomness1; };
|
||||
float GetParticleSizeRandomness2() const { return particleSizeRandomness2; };
|
||||
float GetParticleAngleRandomness1() const {
|
||||
double GetParticleSizeRandomness1() const { return particleSizeRandomness1; };
|
||||
double GetParticleSizeRandomness2() const { return particleSizeRandomness2; };
|
||||
double GetParticleAngleRandomness1() const {
|
||||
return particleAngleRandomness1;
|
||||
};
|
||||
float GetParticleAngleRandomness2() const {
|
||||
double GetParticleAngleRandomness2() const {
|
||||
return particleAngleRandomness2;
|
||||
};
|
||||
|
||||
@@ -184,23 +157,23 @@ class GD_EXTENSION_API ParticleEmitterBase {
|
||||
|
||||
gd::String textureParticleName;
|
||||
RendererType rendererType;
|
||||
float rendererParam1;
|
||||
float rendererParam2;
|
||||
double rendererParam1;
|
||||
double rendererParam2;
|
||||
bool additive;
|
||||
float tank;
|
||||
float flow;
|
||||
float emitterForceMin;
|
||||
float emitterForceMax;
|
||||
float emitterAngleA;
|
||||
float emitterAngleB;
|
||||
float zoneRadius;
|
||||
float particleGravityX, particleGravityY;
|
||||
float particleLifeTimeMin, particleLifeTimeMax;
|
||||
float particleRed1, particleRed2, particleGreen1, particleGreen2,
|
||||
double tank;
|
||||
double flow;
|
||||
double emitterForceMin;
|
||||
double emitterForceMax;
|
||||
double emitterAngleA;
|
||||
double emitterAngleB;
|
||||
double zoneRadius;
|
||||
double particleGravityX, particleGravityY;
|
||||
double particleLifeTimeMin, particleLifeTimeMax;
|
||||
double particleRed1, particleRed2, particleGreen1, particleGreen2,
|
||||
particleBlue1, particleBlue2, particleAlpha1, particleAlpha2;
|
||||
float particleSize1, particleSize2, particleAngle1, particleAngle2;
|
||||
float particleAlphaRandomness1, particleAlphaRandomness2;
|
||||
float particleSizeRandomness1, particleSizeRandomness2,
|
||||
double particleSize1, particleSize2, particleAngle1, particleAngle2;
|
||||
double particleAlphaRandomness1, particleAlphaRandomness2;
|
||||
double particleSizeRandomness1, particleSizeRandomness2,
|
||||
particleAngleRandomness1, particleAngleRandomness2;
|
||||
std::size_t maxParticleNb;
|
||||
bool destroyWhenNoParticles; ///< If set to true, the object will removed
|
||||
|
@@ -5,10 +5,10 @@ Copyright (c) 2010-2016 Florian Rival (Florian.Rival@gmail.com)
|
||||
This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
#include "GDCore/Extensions/Metadata/MultipleInstructionMetadata.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
#include "GDCore/Project/BehaviorsSharedData.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "PathfindingBehavior.h"
|
||||
#include "PathfindingObstacleBehavior.h"
|
||||
|
||||
@@ -89,7 +89,8 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("SetCellWidth")
|
||||
.SetGetter("GetCellWidth");
|
||||
|
||||
@@ -103,7 +104,8 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("GetCellWidth");
|
||||
|
||||
aut.AddAction("CellHeight",
|
||||
@@ -116,7 +118,8 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("SetCellHeight")
|
||||
.SetGetter("GetCellHeight");
|
||||
|
||||
@@ -130,7 +133,8 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("GetCellHeight");
|
||||
|
||||
aut.AddAction("Acceleration",
|
||||
@@ -143,7 +147,8 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("SetAcceleration")
|
||||
.SetGetter("GetAcceleration");
|
||||
|
||||
@@ -157,7 +162,8 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("GetAcceleration");
|
||||
|
||||
aut.AddAction("MaxSpeed",
|
||||
@@ -170,7 +176,10 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Max speed (in pixels per second)")))
|
||||
.SetFunctionName("SetMaxSpeed")
|
||||
.SetGetter("GetMaxSpeed");
|
||||
|
||||
@@ -184,7 +193,10 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Max speed to compare to (in pixels per second)")))
|
||||
.SetFunctionName("GetMaxSpeed");
|
||||
|
||||
aut.AddAction("Speed",
|
||||
@@ -197,7 +209,10 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Speed (in pixels per second)")))
|
||||
.SetFunctionName("SetSpeed")
|
||||
.SetGetter("GetSpeed");
|
||||
|
||||
@@ -211,17 +226,21 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Speed to compare to (in pixels per second)")))
|
||||
.SetFunctionName("GetSpeed");
|
||||
|
||||
aut.AddScopedCondition("MovementAngleIsAround",
|
||||
_("Angle of movement on its path"),
|
||||
_("Compare the angle of movement of an object on its path."),
|
||||
_("Angle of movement of _PARAM0_ is _PARAM2_ (tolerance"
|
||||
": _PARAM3_ degrees)"),
|
||||
_("Movement on the path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
aut.AddScopedCondition(
|
||||
"MovementAngleIsAround",
|
||||
_("Angle of movement on its path"),
|
||||
_("Compare the angle of movement of an object on its path."),
|
||||
_("Angle of movement of _PARAM0_ is _PARAM2_ (tolerance"
|
||||
": _PARAM3_ degrees)"),
|
||||
_("Movement on the path"),
|
||||
"CppPlatform/Extensions/AStaricon24.png",
|
||||
"CppPlatform/Extensions/AStaricon16.png")
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
@@ -238,7 +257,10 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Max angular speed (in degrees per second)")))
|
||||
.SetFunctionName("SetAngularMaxSpeed")
|
||||
.SetGetter("GetAngularMaxSpeed");
|
||||
|
||||
@@ -253,7 +275,10 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Max angular speed to compare to (in degrees per second)")))
|
||||
.SetFunctionName("GetAngularMaxSpeed");
|
||||
|
||||
aut.AddAction(
|
||||
@@ -267,7 +292,10 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Angle (in degrees)")))
|
||||
.SetFunctionName("SetAngleOffset")
|
||||
.SetGetter("GetAngleOffset");
|
||||
|
||||
@@ -281,7 +309,10 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Angle to compare to (in degrees)")))
|
||||
.SetFunctionName("GetAngleOffset");
|
||||
|
||||
aut.AddAction(
|
||||
@@ -296,7 +327,8 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("SetExtraBorder")
|
||||
.SetGetter("GetExtraBorder");
|
||||
|
||||
@@ -311,7 +343,8 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("GetExtraBorder");
|
||||
|
||||
aut.AddAction(
|
||||
@@ -548,7 +581,7 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"CppPlatform/Extensions/AStaricon24.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardParameters("number");
|
||||
.UseStandardParameters("number", gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
aut.AddExpressionAndConditionAndAction("number",
|
||||
"GridOffsetY",
|
||||
@@ -559,7 +592,7 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"CppPlatform/Extensions/AStaricon24.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingBehavior")
|
||||
.UseStandardParameters("number");
|
||||
.UseStandardParameters("number", gd::ParameterOptions::MakeNewOptions());
|
||||
|
||||
}
|
||||
{
|
||||
@@ -584,7 +617,8 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("SetCost")
|
||||
.SetGetter("GetCost");
|
||||
|
||||
@@ -598,7 +632,8 @@ void DeclarePathfindingBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PathfindingObstacleBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("GetCost");
|
||||
|
||||
aut.AddAction("SetImpassable",
|
||||
|
@@ -8,6 +8,7 @@ This project is released under the MIT License.
|
||||
#ifndef PATHFINDINGOBSTACLEBEHAVIOR_H
|
||||
#define PATHFINDINGOBSTACLEBEHAVIOR_H
|
||||
#include <map>
|
||||
|
||||
#include "GDCore/Project/Behavior.h"
|
||||
namespace gd {
|
||||
class SerializerElement;
|
||||
@@ -28,13 +29,11 @@ class GD_EXTENSION_API PathfindingObstacleBehavior : public gd::Behavior {
|
||||
return new PathfindingObstacleBehavior(*this);
|
||||
}
|
||||
|
||||
#if defined(GD_IDE_ONLY)
|
||||
virtual std::map<gd::String, gd::PropertyDescriptor> GetProperties(
|
||||
const gd::SerializerElement& behaviorContent) const override;
|
||||
virtual bool UpdateProperty(gd::SerializerElement& behaviorContent,
|
||||
const gd::String& name,
|
||||
const gd::String& value) override;
|
||||
#endif
|
||||
|
||||
virtual void InitializeContent(
|
||||
gd::SerializerElement& behaviorContent) override;
|
||||
|
@@ -179,9 +179,8 @@ namespace gdjs {
|
||||
|
||||
movementAngleIsAround(degreeAngle: float, tolerance: float) {
|
||||
return (
|
||||
gdjs.evtTools.common.angleDifference(
|
||||
this._movementAngle,
|
||||
degreeAngle
|
||||
Math.abs(
|
||||
gdjs.evtTools.common.angleDifference(this._movementAngle, degreeAngle)
|
||||
) <= tolerance
|
||||
);
|
||||
}
|
||||
|
@@ -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: [
|
||||
|
@@ -426,7 +426,9 @@ module.exports = {
|
||||
)
|
||||
.setIncludeFile('Extensions/Physics2Behavior/physics2runtimebehavior.js')
|
||||
.addIncludeFile('Extensions/Physics2Behavior/Box2D_v2.3.1_min.wasm.js')
|
||||
.addRequiredFile('Extensions/Physics2Behavior/Box2D_v2.3.1_min.wasm.wasm')
|
||||
.addRequiredFile(
|
||||
'Extensions/Physics2Behavior/Box2D_v2.3.1_min.wasm.wasm'
|
||||
);
|
||||
|
||||
// Global
|
||||
aut
|
||||
@@ -441,7 +443,12 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Gravity to compare to (in pixels per second per second)')
|
||||
)
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getGravityX');
|
||||
|
||||
@@ -470,7 +477,12 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Gravity to compare to (in pixels per second per second)')
|
||||
)
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getGravityY');
|
||||
|
||||
@@ -520,7 +532,12 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Time scale to compare to (1 by default)')
|
||||
)
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getTimeScale');
|
||||
|
||||
@@ -541,7 +558,7 @@ module.exports = {
|
||||
)
|
||||
.addParameter('objectList', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Value'))
|
||||
.addParameter('expression', _('Time scale (1 by default)'))
|
||||
.getCodeExtraInformation()
|
||||
.setIncludeFile('Extensions/Physics2Behavior/physics2tools.js')
|
||||
.setFunctionName('gdjs.physics2.setTimeScale');
|
||||
@@ -788,7 +805,12 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Scale (1 by default)')
|
||||
)
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setShapeScale')
|
||||
.setGetter('getShapeScale');
|
||||
@@ -805,7 +827,10 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getDensity');
|
||||
|
||||
@@ -823,7 +848,10 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setDensity')
|
||||
.setGetter('getDensity');
|
||||
@@ -853,7 +881,10 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getFriction');
|
||||
|
||||
@@ -871,7 +902,10 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setFriction')
|
||||
.setGetter('getFriction');
|
||||
@@ -901,7 +935,10 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getRestitution');
|
||||
|
||||
@@ -919,7 +956,10 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setRestitution')
|
||||
.setGetter('getRestitution');
|
||||
@@ -949,7 +989,10 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getLinearDamping');
|
||||
|
||||
@@ -967,7 +1010,10 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setLinearDamping')
|
||||
.setGetter('getLinearDamping');
|
||||
@@ -997,7 +1043,10 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getAngularDamping');
|
||||
|
||||
@@ -1015,7 +1064,10 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setAngularDamping')
|
||||
.setGetter('getAngularDamping');
|
||||
@@ -1045,7 +1097,12 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Scale to compare to (1 by default)')
|
||||
)
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getGravityScale');
|
||||
|
||||
@@ -1063,7 +1120,12 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Scale (1 by default)')
|
||||
)
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setGravityScale')
|
||||
.setGetter('getGravityScale');
|
||||
@@ -1167,7 +1229,12 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Speed to compare to (in pixels per second)')
|
||||
)
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getLinearVelocityX');
|
||||
|
||||
@@ -1183,7 +1250,12 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Speed (in pixels per second)')
|
||||
)
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setLinearVelocityX')
|
||||
.setGetter('getLinearVelocityX');
|
||||
@@ -1213,7 +1285,12 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Speed to compare to (in pixels per second)')
|
||||
)
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getLinearVelocityY');
|
||||
|
||||
@@ -1229,7 +1306,12 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Speed (in pixels per second)')
|
||||
)
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setLinearVelocityY')
|
||||
.setGetter('getLinearVelocityY');
|
||||
@@ -1259,7 +1341,12 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Speed to compare to (in pixels per second)')
|
||||
)
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getLinearVelocityLength');
|
||||
|
||||
@@ -1276,6 +1363,40 @@ module.exports = {
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getLinearVelocityLength');
|
||||
|
||||
aut
|
||||
.addCondition(
|
||||
'LinearVelocityAngle',
|
||||
_('Linear velocity angle'),
|
||||
_('Test an object linear velocity angle.'),
|
||||
_('the linear velocity angle'),
|
||||
_('Velocity'),
|
||||
'res/physics32.png',
|
||||
'res/physics32.png'
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Angle to compare to (in degrees)')
|
||||
)
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getLinearVelocityAngle');
|
||||
|
||||
aut
|
||||
.addExpression(
|
||||
'LinearVelocityAngle',
|
||||
_('Linear velocity angle'),
|
||||
_('Get the linear velocity angle of an object.'),
|
||||
_('Velocity'),
|
||||
'res/physics32.png'
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getLinearVelocityAngle');
|
||||
|
||||
aut
|
||||
.addCondition(
|
||||
'AngularVelocity',
|
||||
@@ -1288,7 +1409,12 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Angular speed to compare to (in degrees per second)')
|
||||
)
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getAngularVelocity');
|
||||
|
||||
@@ -1304,7 +1430,12 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions().setDescription(
|
||||
_('Angular speed (in degrees per second)')
|
||||
)
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setAngularVelocity')
|
||||
.setGetter('getAngularVelocity');
|
||||
@@ -1403,8 +1534,14 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('X component (in Newton * seconds or kilogram * meter per second)'))
|
||||
.addParameter('expression', _('Y component (in Newton * seconds or kilogram * meter per second)'))
|
||||
.addParameter(
|
||||
'expression',
|
||||
_('X component (in Newton * seconds or kilogram * meter per second)')
|
||||
)
|
||||
.addParameter(
|
||||
'expression',
|
||||
_('Y component (in Newton * seconds or kilogram * meter per second)')
|
||||
)
|
||||
.addParameter('expression', _('Applying X position'))
|
||||
.addParameter('expression', _('Applying Y position'))
|
||||
.getCodeExtraInformation()
|
||||
@@ -1427,7 +1564,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Angle'))
|
||||
.addParameter('expression', _('Length (in Newton * seconds or kilogram * meter per second)'))
|
||||
.addParameter(
|
||||
'expression',
|
||||
_('Length (in Newton * seconds or kilogram * meter per second)')
|
||||
)
|
||||
.addParameter('expression', _('Applying X position'))
|
||||
.addParameter('expression', _('Applying Y position'))
|
||||
.getCodeExtraInformation()
|
||||
@@ -1449,7 +1589,10 @@ module.exports = {
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Length (in Newton * seconds or kilogram * meter per second)'))
|
||||
.addParameter(
|
||||
'expression',
|
||||
_('Length (in Newton * seconds or kilogram * meter per second)')
|
||||
)
|
||||
.addParameter('expression', _('X position'))
|
||||
.addParameter('expression', _('Y position'))
|
||||
.addParameter('expression', _('Applying X position'))
|
||||
@@ -1493,7 +1636,7 @@ module.exports = {
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('applyAngularImpulse');
|
||||
|
||||
aut
|
||||
aut
|
||||
.addExpression(
|
||||
'Mass',
|
||||
_('Mass'),
|
||||
@@ -1506,31 +1649,33 @@ module.exports = {
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getMass');
|
||||
|
||||
aut
|
||||
.addExpression(
|
||||
'Inertia',
|
||||
_('Inertia'),
|
||||
_('Return the rotational inertia of the object (in kilograms * meters * meters)'),
|
||||
'',
|
||||
'res/physics32.png'
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getInertia');
|
||||
aut
|
||||
.addExpression(
|
||||
'Inertia',
|
||||
_('Inertia'),
|
||||
_(
|
||||
'Return the rotational inertia of the object (in kilograms * meters * meters)'
|
||||
),
|
||||
'',
|
||||
'res/physics32.png'
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getInertia');
|
||||
|
||||
aut
|
||||
.addExpression(
|
||||
'MassCenterX',
|
||||
_('Mass center X'),
|
||||
_('Mass center X'),
|
||||
'',
|
||||
'res/physics32.png'
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getMassCenterX');
|
||||
aut
|
||||
.addExpression(
|
||||
'MassCenterX',
|
||||
_('Mass center X'),
|
||||
_('Mass center X'),
|
||||
'',
|
||||
'res/physics32.png'
|
||||
)
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getMassCenterX');
|
||||
|
||||
aut
|
||||
.addExpression(
|
||||
@@ -1647,7 +1792,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getJointReactionForce');
|
||||
|
||||
@@ -1678,7 +1826,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardRelationalOperatorParameters('number')
|
||||
.useStandardRelationalOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('getJointReactionTorque');
|
||||
|
||||
@@ -1782,7 +1933,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setDistanceJointLength')
|
||||
.setGetter('getDistanceJointLength');
|
||||
@@ -1814,7 +1968,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setDistanceJointFrequency')
|
||||
.setGetter('getDistanceJointFrequency');
|
||||
@@ -1846,7 +2003,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setDistanceJointDampingRatio')
|
||||
.setGetter('getDistanceJointDampingRatio');
|
||||
@@ -2141,7 +2301,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setRevoluteJointMotorSpeed')
|
||||
.setGetter('getRevoluteJointMotorSpeed');
|
||||
@@ -2173,7 +2336,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setRevoluteJointMaxMotorTorque')
|
||||
.setGetter('getRevoluteJointMaxMotorTorque');
|
||||
@@ -2453,7 +2619,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setPrismaticJointMotorSpeed')
|
||||
.setGetter('getPrismaticJointMotorSpeed');
|
||||
@@ -2485,7 +2654,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setPrismaticJointMaxMotorForce')
|
||||
.setGetter('getPrismaticJointMaxMotorForce');
|
||||
@@ -2755,7 +2927,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setGearJointRatio')
|
||||
.setGetter('getGearJointRatio');
|
||||
@@ -2882,7 +3057,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setMouseJointMaxForce')
|
||||
.setGetter('getMouseJointMaxForce');
|
||||
@@ -2914,7 +3092,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setMouseJointFrequency')
|
||||
.setGetter('getMouseJointFrequency');
|
||||
@@ -2946,7 +3127,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setMouseJointDampingRatio')
|
||||
.setGetter('getMouseJointDampingRatio');
|
||||
@@ -3115,7 +3299,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setWheelJointMotorSpeed')
|
||||
.setGetter('getWheelJointMotorSpeed');
|
||||
@@ -3147,7 +3334,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setWheelJointMaxMotorTorque')
|
||||
.setGetter('getWheelJointMaxMotorTorque');
|
||||
@@ -3193,7 +3383,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setWheelJointFrequency')
|
||||
.setGetter('getWheelJointFrequency');
|
||||
@@ -3225,7 +3418,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setWheelJointDampingRatio')
|
||||
.setGetter('getWheelJointDampingRatio');
|
||||
@@ -3321,7 +3517,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setWeldJointFrequency')
|
||||
.setGetter('getWeldJointFrequency');
|
||||
@@ -3353,7 +3552,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setWeldJointDampingRatio')
|
||||
.setGetter('getWeldJointDampingRatio');
|
||||
@@ -3428,7 +3630,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setRopeJointMaxLength')
|
||||
.setGetter('getRopeJointMaxLength');
|
||||
@@ -3496,7 +3701,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setFrictionJointMaxForce')
|
||||
.setGetter('getFrictionJointMaxForce');
|
||||
@@ -3528,7 +3736,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setFrictionJointMaxTorque')
|
||||
.setGetter('getFrictionJointMaxTorque');
|
||||
@@ -3645,7 +3856,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setMotorJointAngularOffset')
|
||||
.setGetter('getMotorJointAngularOffset');
|
||||
@@ -3677,7 +3891,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setMotorJointMaxForce')
|
||||
.setGetter('getMotorJointMaxForce');
|
||||
@@ -3709,7 +3926,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setMotorJointMaxTorque')
|
||||
.setGetter('getMotorJointMaxTorque');
|
||||
@@ -3741,7 +3961,10 @@ module.exports = {
|
||||
.addParameter('object', _('Object'), '', false)
|
||||
.addParameter('behavior', _('Behavior'), 'Physics2Behavior')
|
||||
.addParameter('expression', _('Joint ID'))
|
||||
.useStandardOperatorParameters('number')
|
||||
.useStandardOperatorParameters(
|
||||
'number',
|
||||
gd.ParameterOptions.makeNewOptions()
|
||||
)
|
||||
.getCodeExtraInformation()
|
||||
.setFunctionName('setMotorJointCorrectionFactor')
|
||||
.setGetter('getMotorJointCorrectionFactor');
|
||||
@@ -3767,7 +3990,7 @@ module.exports = {
|
||||
_('Collision'),
|
||||
_('Check if two objects collide.'),
|
||||
_('_PARAM0_ is colliding with _PARAM2_'),
|
||||
'',
|
||||
'',
|
||||
'res/physics32.png',
|
||||
'res/physics32.png'
|
||||
)
|
||||
|
@@ -1408,6 +1408,22 @@ namespace gdjs {
|
||||
).Length();
|
||||
}
|
||||
|
||||
getLinearVelocityAngle(): float {
|
||||
// If there is no body, set a new one
|
||||
if (this._body === null) {
|
||||
if (!this.createBody()) return 0;
|
||||
}
|
||||
const body = this._body!;
|
||||
|
||||
// Get the linear velocity angle
|
||||
return gdjs.toDegrees(
|
||||
Math.atan2(
|
||||
body.GetLinearVelocity().get_y() * this._sharedData.scaleY,
|
||||
body.GetLinearVelocity().get_x() * this._sharedData.scaleX
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
getAngularVelocity(): float {
|
||||
// If there is no body, set a new one
|
||||
if (this._body === null) {
|
||||
|
@@ -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: [
|
||||
|
@@ -337,7 +337,8 @@ void DeclarePhysicsBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"res/physics16.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PhysicsBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetFunctionName("GetLinearVelocityX");
|
||||
|
||||
@@ -351,7 +352,8 @@ void DeclarePhysicsBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"res/physics16.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PhysicsBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetFunctionName("GetLinearVelocityY");
|
||||
|
||||
@@ -364,7 +366,8 @@ void DeclarePhysicsBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"res/physics16.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PhysicsBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetFunctionName("GetLinearVelocity");
|
||||
|
||||
@@ -390,7 +393,8 @@ void DeclarePhysicsBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"res/physics16.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PhysicsBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetFunctionName("GetAngularVelocity");
|
||||
|
||||
@@ -403,7 +407,8 @@ void DeclarePhysicsBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"res/physics16.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PhysicsBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetFunctionName("GetLinearDamping");
|
||||
|
||||
@@ -445,7 +450,8 @@ void DeclarePhysicsBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"res/physics16.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PhysicsBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetFunctionName("GetAngularDamping");
|
||||
|
||||
@@ -516,7 +522,8 @@ void DeclarePhysicsBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"res/physics16.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PhysicsBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetFunctionName("GetPolygonScaleX");
|
||||
|
||||
@@ -530,7 +537,8 @@ void DeclarePhysicsBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"res/physics16.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PhysicsBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.AddCodeOnlyParameter("currentScene", "")
|
||||
.SetFunctionName("GetPolygonScaleY");
|
||||
|
||||
|
@@ -5,11 +5,10 @@ Copyright (c) 2014-2016 Florian Rival (Florian.Rival@gmail.com)
|
||||
This project is released under the MIT License.
|
||||
*/
|
||||
|
||||
#include "PlatformBehavior.h"
|
||||
|
||||
#include "GDCore/Extensions/PlatformExtension.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "GDCore/Project/BehaviorsSharedData.h"
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "PlatformBehavior.h"
|
||||
#include "PlatformerObjectBehavior.h"
|
||||
|
||||
void DeclarePlatformBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
@@ -134,61 +133,71 @@ void DeclarePlatformBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
|
||||
aut.AddCondition("Gravity",
|
||||
_("Gravity"),
|
||||
_("Compare the gravity applied on the object (in pixels "
|
||||
"per second per second)."),
|
||||
_("Compare the gravity applied on the object."),
|
||||
_("the gravity"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Gravity to compare to (in pixels per "
|
||||
"second per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("GetGravity");
|
||||
|
||||
aut.AddAction("Gravity",
|
||||
_("Gravity"),
|
||||
_("Change the gravity applied on an object (in pixels per "
|
||||
"second per second)."),
|
||||
_("Change the gravity applied on an object."),
|
||||
_("the gravity"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Gravity (in pixels per "
|
||||
"second per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("SetGravity")
|
||||
.SetGetter("GetGravity");
|
||||
|
||||
aut.AddCondition(
|
||||
"MaxFallingSpeed",
|
||||
_("Maximum falling speed"),
|
||||
_("Compare the maximum falling speed of the object (in pixels per "
|
||||
"second)."),
|
||||
_("the maximum falling speed"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
aut.AddCondition("MaxFallingSpeed",
|
||||
_("Maximum falling speed"),
|
||||
_("Compare the maximum falling speed of the object."),
|
||||
_("the maximum falling speed"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Max speed to compare to (in pixels per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("GetMaxFallingSpeed");
|
||||
|
||||
aut.AddAction(
|
||||
"MaxFallingSpeed",
|
||||
_("Maximum falling speed"),
|
||||
_("Change the maximum falling speed of an object (in pixels per "
|
||||
"second)."),
|
||||
_("the maximum falling speed"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
aut.AddAction("MaxFallingSpeed",
|
||||
_("Maximum falling speed"),
|
||||
_("Change the maximum falling speed of an object."),
|
||||
_("the maximum falling speed"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.AddParameter("yesorno", _("If jumping, try to preserve the current speed in the air"))
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Max speed (in pixels per second)")))
|
||||
.AddParameter(
|
||||
"yesorno",
|
||||
_("If jumping, try to preserve the current speed in the air"))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("SetMaxFallingSpeed")
|
||||
.SetGetter("GetMaxFallingSpeed");
|
||||
@@ -203,145 +212,170 @@ void DeclarePlatformBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Speed to compare to (in pixels per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("GetLadderClimbingSpeed");
|
||||
|
||||
aut.AddAction("LadderClimbingSpeed",
|
||||
_("Ladder climbing speed"),
|
||||
_("Change the ladder climbing speed (in pixels per "
|
||||
"second)."),
|
||||
_("Change the ladder climbing speed."),
|
||||
_("the ladder climbing speed"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Speed (in pixels per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("SetLadderClimbingSpeed")
|
||||
.SetGetter("GetLadderClimbingSpeed");
|
||||
|
||||
aut.AddCondition("Acceleration",
|
||||
_("Acceleration"),
|
||||
_("Compare the horizontal acceleration of the object (in pixels per "
|
||||
"second per second)."),
|
||||
_("Compare the horizontal acceleration of the object."),
|
||||
_("the horizontal acceleration"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Acceleration to compare to (in pixels per "
|
||||
"second per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("GetAcceleration");
|
||||
|
||||
aut.AddAction("Acceleration",
|
||||
_("Acceleration"),
|
||||
_("Change the horizontal acceleration of an object (in pixels per "
|
||||
"second per second)."),
|
||||
_("Change the horizontal acceleration of an object."),
|
||||
_("the horizontal acceleration"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Acceleration (in pixels per "
|
||||
"second per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("SetAcceleration")
|
||||
.SetGetter("GetAcceleration");
|
||||
|
||||
aut.AddCondition("Deceleration",
|
||||
_("Deceleration"),
|
||||
_("Compare the horizontal deceleration of the object (in pixels per "
|
||||
"second per second)."),
|
||||
_("Compare the horizontal deceleration of the object."),
|
||||
_("the horizontal deceleration"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Deceleration to compare to (in pixels per "
|
||||
"second per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("GetDeceleration");
|
||||
|
||||
aut.AddAction("Deceleration",
|
||||
_("Deceleration"),
|
||||
_("Change the horizontal deceleration of an object (in pixels per "
|
||||
"second per second)."),
|
||||
_("Change the horizontal deceleration of an object."),
|
||||
_("the horizontal deceleration"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Deceleration (in pixels per "
|
||||
"second per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("SetDeceleration")
|
||||
.SetGetter("GetDeceleration");
|
||||
|
||||
aut.AddCondition(
|
||||
"MaxSpeed",
|
||||
_("Maximum horizontal speed"),
|
||||
_("Compare the maximum horizontal speed of the object (in pixels per second)."),
|
||||
_("the maximum horizontal speed"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
aut.AddCondition("MaxSpeed",
|
||||
_("Maximum horizontal speed"),
|
||||
_("Compare the maximum horizontal speed of the object."),
|
||||
_("the maximum horizontal speed"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Max speed to compare to (in pixels per second)")))
|
||||
.SetFunctionName("GetMaxSpeed");
|
||||
|
||||
aut.AddAction(
|
||||
"MaxSpeed",
|
||||
_("Maximum horizontal speed"),
|
||||
_("Change the maximum horizontal speed of an object (in pixels per second)."),
|
||||
_("the maximum horizontal speed"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
aut.AddAction("MaxSpeed",
|
||||
_("Maximum horizontal speed"),
|
||||
_("Change the maximum horizontal speed of an object."),
|
||||
_("the maximum horizontal speed"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Max speed (in pixels per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("SetMaxSpeed")
|
||||
.SetGetter("GetMaxSpeed");
|
||||
|
||||
aut.AddCondition(
|
||||
"JumpSpeed",
|
||||
_("Jump speed"),
|
||||
_("Compare the jump speed of the object (in pixels per second)."
|
||||
"Its value is always positive."),
|
||||
_("the jump speed"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
aut.AddCondition("JumpSpeed",
|
||||
_("Jump speed"),
|
||||
_("Compare the jump speed of the object."
|
||||
"Its value is always positive."),
|
||||
_("the jump speed"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Speed to compare to (in pixels per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("GetJumpSpeed");
|
||||
|
||||
aut.AddAction(
|
||||
"JumpSpeed",
|
||||
_("Jump speed"),
|
||||
_("Change the jump speed of an object (in pixels per second). "
|
||||
"Its value is always positive."),
|
||||
_("the jump speed"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
aut.AddAction("JumpSpeed",
|
||||
_("Jump speed"),
|
||||
_("Change the jump speed of an object. "
|
||||
"Its value is always positive."),
|
||||
_("the jump speed"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Speed (in pixels per second)")))
|
||||
.SetFunctionName("SetJumpSpeed")
|
||||
.SetGetter("GetJumpSpeed");
|
||||
|
||||
aut.AddCondition(
|
||||
"JumpSustainTime",
|
||||
_("Jump sustain time"),
|
||||
_("Compare the jump sustain time of the object (in seconds)."
|
||||
_("Compare the jump sustain time of the object."
|
||||
"This is the time during which keeping the jump button held "
|
||||
"allow the initial jump speed to be maintained."),
|
||||
_("the jump sustain time"),
|
||||
@@ -350,21 +384,28 @@ void DeclarePlatformBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Duration to compare to (in seconds)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
aut.AddAction("JumpSustainTime",
|
||||
_("Jump sustain time"),
|
||||
_("Change the jump sustain time of an object (in seconds). "
|
||||
"This is the time during which keeping the jump button held "
|
||||
"allow the initial jump speed to be maintained."),
|
||||
_("the jump sustain time"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
aut.AddAction(
|
||||
"JumpSustainTime",
|
||||
_("Jump sustain time"),
|
||||
_("Change the jump sustain time of an object."
|
||||
"This is the time during which keeping the jump button held "
|
||||
"allow the initial jump speed to be maintained."),
|
||||
_("the jump sustain time"),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardOperatorParameters("number");
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Duration (in seconds)")));
|
||||
|
||||
aut.AddAction(
|
||||
"SetCanJump",
|
||||
@@ -400,7 +441,8 @@ void DeclarePlatformBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"AbortJump",
|
||||
_("Abort jump"),
|
||||
_("Abort the current jump and stop the object vertically. "
|
||||
"This action doesn't have any effect when the character is not jumping."),
|
||||
"This action doesn't have any effect when the character is not "
|
||||
"jumping."),
|
||||
_("Abort the current jump of _PARAM0_"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
@@ -589,11 +631,28 @@ void DeclarePlatformBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
.MarkAsSimple()
|
||||
.SetFunctionName("canGrabPlatforms");
|
||||
|
||||
aut.AddCondition("CurrentFallSpeed",
|
||||
_("Current falling speed"),
|
||||
_("Compare the current falling speed of the object. Its "
|
||||
"value is always positive."),
|
||||
_("the current falling speed"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Speed to compare to (in pixels per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("GetCurrentFallSpeed");
|
||||
|
||||
aut.AddScopedAction(
|
||||
"SetCurrentFallSpeed",
|
||||
_("Current falling speed"),
|
||||
_("Change the current falling speed of the object (in pixels per "
|
||||
"second). This action doesn't have any effect when the character "
|
||||
_("Change the current falling speed of the object. This action "
|
||||
"doesn't have any effect when the character "
|
||||
"is not falling or is in the first phase of a jump."),
|
||||
_("the current falling speed"),
|
||||
_(""),
|
||||
@@ -601,72 +660,70 @@ void DeclarePlatformBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Speed (in pixels per second)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
aut.AddCondition(
|
||||
"CurrentFallSpeed",
|
||||
_("Current falling speed"),
|
||||
_("Compare the current falling speed of the object (in pixels per "
|
||||
"second). Its value is always positive."),
|
||||
_("the current falling speed"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
aut.AddCondition("CurrentJumpSpeed",
|
||||
_("Current jump speed"),
|
||||
_("Compare the current jump speed of the object. Its "
|
||||
"value is always positive."),
|
||||
_("the current jump speed"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("GetCurrentFallSpeed");
|
||||
|
||||
aut.AddCondition(
|
||||
"CurrentJumpSpeed",
|
||||
_("Current jump speed"),
|
||||
_("Compare the current jump speed of the object (in pixels per "
|
||||
"second). Its value is always positive."),
|
||||
_("the current jump speed"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Speed to compare to (in pixels per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("GetCurrentJumpSpeed");
|
||||
|
||||
aut.AddScopedAction("SetCurrentSpeed",
|
||||
_("Current horizontal speed"),
|
||||
_("Change the current horizontal speed of the object "
|
||||
"(in pixels per second). The object moves to the left "
|
||||
"with negative values and to the right with positive ones"),
|
||||
_("the current horizontal speed"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
aut.AddScopedAction(
|
||||
"SetCurrentSpeed",
|
||||
_("Current horizontal speed"),
|
||||
_("Change the current horizontal speed of the object. The object "
|
||||
"moves to the left with negative values and to the right with "
|
||||
"positive ones"),
|
||||
_("the current horizontal speed"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Speed (in pixels per second)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
aut.AddCondition("CurrentSpeed",
|
||||
_("Current horizontal speed"),
|
||||
_("Compare the current horizontal speed of the object "
|
||||
"(in pixels per second). The object moves to the left "
|
||||
"with negative values and to the right with positive ones"),
|
||||
_("the current horizontal speed"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
aut.AddCondition(
|
||||
"CurrentSpeed",
|
||||
_("Current horizontal speed"),
|
||||
_("Compare the current horizontal speed of the object. The object "
|
||||
"moves to the left "
|
||||
"with negative values and to the right with positive ones"),
|
||||
_("the current horizontal speed"),
|
||||
_(""),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png",
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Speed to compare to (in pixels per second)")))
|
||||
.MarkAsAdvanced()
|
||||
.SetFunctionName("GetCurrentSpeed");
|
||||
|
||||
aut.AddExpression("Gravity",
|
||||
_("Gravity"),
|
||||
_("Return the gravity applied on the object "
|
||||
"(in pixels per second per second)."),
|
||||
"(in pixels per second per second)."),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
@@ -696,7 +753,7 @@ void DeclarePlatformBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
aut.AddExpression("Acceleration",
|
||||
_("Acceleration"),
|
||||
_("Return the horizontal acceleration of the object "
|
||||
"(in pixels per second per second)."),
|
||||
"(in pixels per second per second)."),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
@@ -706,7 +763,7 @@ void DeclarePlatformBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
aut.AddExpression("Deceleration",
|
||||
_("Deceleration"),
|
||||
_("Return the horizontal deceleration of the object "
|
||||
"(in pixels per second per second)."),
|
||||
"(in pixels per second per second)."),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
@@ -723,12 +780,13 @@ void DeclarePlatformBehaviorExtension(gd::PlatformExtension& extension) {
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.SetFunctionName("GetMaxSpeed");
|
||||
|
||||
aut.AddExpression("JumpSpeed",
|
||||
_("Jump speed"),
|
||||
_("Return the jump speed of the object "
|
||||
"(in pixels per second). Its value is always positive."),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
aut.AddExpression(
|
||||
"JumpSpeed",
|
||||
_("Jump speed"),
|
||||
_("Return the jump speed of the object "
|
||||
"(in pixels per second). Its value is always positive."),
|
||||
_("Options"),
|
||||
"CppPlatform/Extensions/platformerobjecticon.png")
|
||||
.AddParameter("object", _("Object"))
|
||||
.AddParameter("behavior", _("Behavior"), "PlatformerObjectBehavior")
|
||||
.SetFunctionName("GetJumpSpeed");
|
||||
|
@@ -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: [] }],
|
||||
|
@@ -28,7 +28,7 @@ module.exports = {
|
||||
extension
|
||||
.setExtensionInformation(
|
||||
'PlayerAuthentication',
|
||||
_('Player Authentication (experimental)'),
|
||||
_('Player Authentication'),
|
||||
_('Allow your game to authenticate players.'),
|
||||
'Florian Rival',
|
||||
'Open source (MIT License)'
|
||||
@@ -36,9 +36,7 @@ module.exports = {
|
||||
.setExtensionHelpPath('/all-features/player-authentication')
|
||||
.setCategory('Players');
|
||||
extension
|
||||
.addInstructionOrExpressionGroupMetadata(
|
||||
_('Player Authentication (experimental)')
|
||||
)
|
||||
.addInstructionOrExpressionGroupMetadata(_('Player Authentication'))
|
||||
.setIcon('JsPlatform/Extensions/authentication.svg');
|
||||
|
||||
extension
|
||||
@@ -70,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',
|
||||
|
@@ -19,10 +19,11 @@ namespace gdjs {
|
||||
'If the window did not open, please check your pop-up blocker and click the button below to try again.',
|
||||
}
|
||||
: {
|
||||
title: 'Your game is not registered!',
|
||||
title: 'Publish your game!',
|
||||
text1:
|
||||
'In order to use player authentication, this game must be registered with GDevelop Services first.',
|
||||
text2: 'Head to your Game Dashboard, then try again.',
|
||||
"GDevelop's player accounts are only available for published games.",
|
||||
text2:
|
||||
'Click the button below to learn how to publish your game then try again.',
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -119,7 +120,8 @@ namespace gdjs {
|
||||
export const addAuthenticationTextsToLoadingContainer = (
|
||||
loaderContainer: HTMLDivElement,
|
||||
platform,
|
||||
isGameRegistered
|
||||
isGameRegistered,
|
||||
wikiOpenAction
|
||||
) => {
|
||||
const textContainer: HTMLDivElement = document.createElement('div');
|
||||
textContainer.id = 'authentication-container-texts';
|
||||
@@ -151,8 +153,20 @@ namespace gdjs {
|
||||
textContainer.appendChild(text2);
|
||||
|
||||
if (!isGameRegistered) {
|
||||
// Remove the loader.
|
||||
// Remove the loader and add the wiki link.
|
||||
loaderContainer.innerHTML = '';
|
||||
|
||||
if (wikiOpenAction) {
|
||||
const link = document.createElement('a');
|
||||
addTouchAndClickEventListeners(link, wikiOpenAction);
|
||||
link.innerText = 'How to publish my game';
|
||||
link.style.color = '#0078d4';
|
||||
link.style.textDecoration = 'none';
|
||||
link.style.textDecoration = 'underline';
|
||||
link.style.cursor = 'pointer';
|
||||
|
||||
textContainer.appendChild(link);
|
||||
}
|
||||
}
|
||||
|
||||
loaderContainer.prepend(textContainer);
|
||||
@@ -170,7 +184,7 @@ namespace gdjs {
|
||||
) => {
|
||||
const link = document.createElement('a');
|
||||
addTouchAndClickEventListeners(link, onClick);
|
||||
link.innerText = 'Click here to authenticate';
|
||||
link.innerText = 'Try again';
|
||||
link.style.color = '#0078d4';
|
||||
link.style.textDecoration = 'none';
|
||||
link.style.textDecoration = 'underline';
|
||||
@@ -431,7 +445,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
|
||||
) {
|
||||
|
@@ -20,6 +20,7 @@ namespace gdjs {
|
||||
let _authenticationLoaderContainer: HTMLDivElement | null = null;
|
||||
let _authenticationTextContainer: HTMLDivElement | null = null;
|
||||
let _authenticationBanner: HTMLDivElement | null = null;
|
||||
let _initialAuthenticationTimeoutId: NodeJS.Timeout | null = null;
|
||||
let _authenticationTimeoutId: NodeJS.Timeout | null = null;
|
||||
|
||||
// Communication methods.
|
||||
@@ -36,6 +37,43 @@ namespace gdjs {
|
||||
_justLoggedIn = false;
|
||||
});
|
||||
|
||||
// If the extension is used, register an eventlistener to know if the user is
|
||||
// logged in while playing the game on Liluo.io.
|
||||
// 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.
|
||||
return;
|
||||
}
|
||||
removeAuthenticationCallbacks(); // Remove any callback that could have been registered before.
|
||||
_authenticationMessageCallback = (event: MessageEvent) => {
|
||||
receiveAuthenticationMessage(runtimeScene, event, {
|
||||
checkOrigin: true,
|
||||
});
|
||||
};
|
||||
window.addEventListener(
|
||||
'message',
|
||||
_authenticationMessageCallback,
|
||||
true
|
||||
);
|
||||
logger.info(
|
||||
'Notifying parent window that player authentication is ready.'
|
||||
);
|
||||
window.parent.postMessage(
|
||||
{
|
||||
id: 'playerAuthReady',
|
||||
},
|
||||
'*' // We could restrict to liluo.io 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.
|
||||
_initialAuthenticationTimeoutId = setTimeout(() => {
|
||||
logger.info('Removing initial authentication listener.');
|
||||
removeAuthenticationCallbacks();
|
||||
}, 3000);
|
||||
}
|
||||
);
|
||||
|
||||
const getLocalStorageKey = (gameId: string) =>
|
||||
`${gameId}_authenticatedUser`;
|
||||
|
||||
@@ -190,19 +228,26 @@ namespace gdjs {
|
||||
logger.error('Missing game id in project properties.');
|
||||
return;
|
||||
}
|
||||
const authenticatedUserStorageItem = window.localStorage.getItem(
|
||||
getLocalStorageKey(gameId)
|
||||
);
|
||||
if (!authenticatedUserStorageItem) {
|
||||
_checkedLocalStorage = true;
|
||||
return;
|
||||
}
|
||||
const authenticatedUser = JSON.parse(authenticatedUserStorageItem);
|
||||
try {
|
||||
const authenticatedUserStorageItem = window.localStorage.getItem(
|
||||
getLocalStorageKey(gameId)
|
||||
);
|
||||
if (!authenticatedUserStorageItem) {
|
||||
_checkedLocalStorage = true;
|
||||
return;
|
||||
}
|
||||
const authenticatedUser = JSON.parse(authenticatedUserStorageItem);
|
||||
|
||||
_username = authenticatedUser.username;
|
||||
_userId = authenticatedUser.userId;
|
||||
_userToken = authenticatedUser.userToken;
|
||||
_checkedLocalStorage = true;
|
||||
_username = authenticatedUser.username;
|
||||
_userId = authenticatedUser.userId;
|
||||
_userToken = authenticatedUser.userToken;
|
||||
_checkedLocalStorage = true;
|
||||
} catch (err) {
|
||||
logger.warn(
|
||||
'Unable to read authentication details from localStorage. Player authentication will not be available.',
|
||||
err
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -228,16 +273,15 @@ namespace gdjs {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* When the websocket receives the authentication result, close all the
|
||||
* authentication windows, display the notification and focus on the game.
|
||||
*/
|
||||
const handleLoggedInEvent = function (
|
||||
runtimeScene: gdjs.RuntimeScene,
|
||||
userId: string,
|
||||
username: string | null,
|
||||
userToken: string
|
||||
) {
|
||||
const saveAuthKeyToStorage = ({
|
||||
username,
|
||||
userId,
|
||||
userToken,
|
||||
}: {
|
||||
username: string | null;
|
||||
userId: string;
|
||||
userToken: string;
|
||||
}) => {
|
||||
if (!username) {
|
||||
logger.warn('The authenticated player does not have a username');
|
||||
}
|
||||
@@ -251,14 +295,34 @@ namespace gdjs {
|
||||
logger.error('Missing game id in project properties.');
|
||||
return;
|
||||
}
|
||||
window.localStorage.setItem(
|
||||
getLocalStorageKey(gameId),
|
||||
JSON.stringify({
|
||||
username: _username,
|
||||
userId: _userId,
|
||||
userToken: _userToken,
|
||||
})
|
||||
);
|
||||
try {
|
||||
window.localStorage.setItem(
|
||||
getLocalStorageKey(gameId),
|
||||
JSON.stringify({
|
||||
username: _username,
|
||||
userId: _userId,
|
||||
userToken: _userToken,
|
||||
})
|
||||
);
|
||||
} catch (err) {
|
||||
logger.warn(
|
||||
'Unable to save the authentication details to localStorage. Player authentication will not be available.',
|
||||
err
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* When the game receives the authentication result, close all the
|
||||
* authentication windows, display the notification and focus on the game.
|
||||
*/
|
||||
const handleLoggedInEvent = function (
|
||||
runtimeScene: gdjs.RuntimeScene,
|
||||
userId: string,
|
||||
username: string | null,
|
||||
userToken: string
|
||||
) {
|
||||
saveAuthKeyToStorage({ userId, username, userToken });
|
||||
cleanUpAuthWindowAndCallbacks(runtimeScene);
|
||||
removeAuthenticationBanner(runtimeScene);
|
||||
|
||||
@@ -284,15 +348,15 @@ namespace gdjs {
|
||||
* Reads the event sent by the authentication window and
|
||||
* display the appropriate banner.
|
||||
*/
|
||||
const receiveMessageFromAuthenticationWindow = function (
|
||||
const receiveAuthenticationMessage = function (
|
||||
runtimeScene: gdjs.RuntimeScene,
|
||||
event: MessageEvent,
|
||||
{ checkOrigin }: { checkOrigin: boolean }
|
||||
) {
|
||||
const allowedOrigin = 'https://liluo.io';
|
||||
const allowedOrigins = ['https://liluo.io', 'https://gd.games'];
|
||||
|
||||
// Check origin of message.
|
||||
if (checkOrigin && event.origin !== allowedOrigin) {
|
||||
if (checkOrigin && !allowedOrigins.includes(event.origin)) {
|
||||
throw new Error(`Unexpected origin: ${event.origin}`);
|
||||
}
|
||||
// Check that message is not malformed.
|
||||
@@ -315,6 +379,20 @@ namespace gdjs {
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 'alreadyAuthenticated': {
|
||||
if (!(event.data.body && event.data.body.token)) {
|
||||
throw new Error('Malformed message.');
|
||||
}
|
||||
|
||||
saveAuthKeyToStorage({
|
||||
userId: event.data.body.userId,
|
||||
username: event.data.body.username,
|
||||
userToken: event.data.body.token,
|
||||
});
|
||||
removeAuthenticationCallbacks();
|
||||
refreshAuthenticationBannerIfAny(runtimeScene);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -362,15 +440,42 @@ namespace gdjs {
|
||||
};
|
||||
|
||||
/**
|
||||
* Clear the authentication window timeout.
|
||||
* Clear all existing authentication timeouts.
|
||||
* Useful when:
|
||||
* - a new authentication starts
|
||||
* - the authentication succeeded
|
||||
* - the authentication window is closed
|
||||
*/
|
||||
const clearAuthenticationWindowTimeout = () => {
|
||||
if (_initialAuthenticationTimeoutId)
|
||||
clearTimeout(_initialAuthenticationTimeoutId);
|
||||
if (_authenticationTimeoutId) clearTimeout(_authenticationTimeoutId);
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper to create the authentication banner based on the authentication status.
|
||||
*/
|
||||
const createAuthenticationBanner = function (
|
||||
runtimeScene: gdjs.RuntimeScene
|
||||
): HTMLDivElement {
|
||||
const onDismissBanner = () => {
|
||||
removeAuthenticationBanner(runtimeScene);
|
||||
};
|
||||
const onOpenAuthenticationWindow = () => {
|
||||
openAuthenticationWindow(runtimeScene);
|
||||
};
|
||||
return _userToken
|
||||
? authComponents.computeAuthenticatedBanner(
|
||||
onOpenAuthenticationWindow,
|
||||
onDismissBanner,
|
||||
_username
|
||||
)
|
||||
: authComponents.computeNotAuthenticatedBanner(
|
||||
onOpenAuthenticationWindow,
|
||||
onDismissBanner
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Action to display the banner to the user, depending on their authentication status.
|
||||
*/
|
||||
@@ -397,26 +502,39 @@ namespace gdjs {
|
||||
);
|
||||
return;
|
||||
}
|
||||
const onDismissBanner = () => {
|
||||
removeAuthenticationBanner(runtimeScene);
|
||||
};
|
||||
const onOpenAuthenticationWindow = () => {
|
||||
openAuthenticationWindow(runtimeScene);
|
||||
};
|
||||
// We display the corresponding banner depending on the authentication status.
|
||||
_authenticationBanner = _userToken
|
||||
? authComponents.computeAuthenticatedBanner(
|
||||
onOpenAuthenticationWindow,
|
||||
onDismissBanner,
|
||||
_username
|
||||
)
|
||||
: authComponents.computeNotAuthenticatedBanner(
|
||||
onOpenAuthenticationWindow,
|
||||
onDismissBanner
|
||||
);
|
||||
|
||||
_authenticationBanner = createAuthenticationBanner(runtimeScene);
|
||||
domElementContainer.appendChild(_authenticationBanner);
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper to recompute the authentication banner.
|
||||
* This is useful if the user is already logged in on Liluo.io
|
||||
* and we want to display the banner with the username.
|
||||
*/
|
||||
const refreshAuthenticationBannerIfAny = function (
|
||||
runtimeScene: gdjs.RuntimeScene
|
||||
) {
|
||||
if (!_authenticationBanner) return;
|
||||
const domElementContainer = runtimeScene
|
||||
.getGame()
|
||||
.getRenderer()
|
||||
.getDomElementContainer();
|
||||
if (!domElementContainer) {
|
||||
handleAuthenticationError(
|
||||
runtimeScene,
|
||||
"The div element covering the game couldn't be found, the authentication banner cannot be displayed."
|
||||
);
|
||||
return;
|
||||
}
|
||||
const oldAuthenticationBanner = _authenticationBanner;
|
||||
_authenticationBanner = createAuthenticationBanner(runtimeScene);
|
||||
domElementContainer.replaceChild(
|
||||
_authenticationBanner,
|
||||
oldAuthenticationBanner
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper to handle authentication window on Electron.
|
||||
* We open a new window, and create a websocket to know when the user is logged in.
|
||||
@@ -516,7 +634,7 @@ namespace gdjs {
|
||||
// know when the user is authenticated.
|
||||
if (_authenticationInAppWindow) {
|
||||
_cordovaAuthenticationMessageCallback = (event: MessageEvent) => {
|
||||
receiveMessageFromAuthenticationWindow(runtimeScene, event, {
|
||||
receiveAuthenticationMessage(runtimeScene, event, {
|
||||
checkOrigin: false, // For Cordova we don't check the origin, as the message is read from the InAppBrowser directly.
|
||||
});
|
||||
};
|
||||
@@ -545,7 +663,7 @@ namespace gdjs {
|
||||
// Listen to messages posted by the authentication window, so that we can
|
||||
// know when the user is authenticated.
|
||||
_authenticationMessageCallback = (event: MessageEvent) => {
|
||||
receiveMessageFromAuthenticationWindow(runtimeScene, event, {
|
||||
receiveAuthenticationMessage(runtimeScene, event, {
|
||||
checkOrigin: true,
|
||||
});
|
||||
};
|
||||
@@ -622,10 +740,19 @@ namespace gdjs {
|
||||
checkIfGameIsRegistered(runtimeScene.getGame(), _gameId)
|
||||
.then((isGameRegistered) => {
|
||||
if (_authenticationLoaderContainer) {
|
||||
const electron = runtimeScene.getGame().getRenderer().getElectron();
|
||||
const wikiOpenAction = electron
|
||||
? () =>
|
||||
electron.shell.openExternal(
|
||||
'https://wiki.gdevelop.io/gdevelop5/publishing/web'
|
||||
)
|
||||
: null; // Only show a link if we're on electron.
|
||||
|
||||
_authenticationTextContainer = authComponents.addAuthenticationTextsToLoadingContainer(
|
||||
_authenticationLoaderContainer,
|
||||
platform,
|
||||
isGameRegistered
|
||||
isGameRegistered,
|
||||
wikiOpenAction
|
||||
);
|
||||
}
|
||||
if (isGameRegistered) {
|
||||
@@ -652,7 +779,7 @@ namespace gdjs {
|
||||
runtimeScene,
|
||||
'Error while checking if the game is registered.'
|
||||
);
|
||||
console.error(error);
|
||||
logger.error(error);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -669,6 +796,7 @@ namespace gdjs {
|
||||
export const removeAuthenticationContainer = function (
|
||||
runtimeScene: gdjs.RuntimeScene
|
||||
) {
|
||||
removeAuthenticationCallbacks();
|
||||
const domElementContainer = runtimeScene
|
||||
.getGame()
|
||||
.getRenderer()
|
||||
@@ -685,6 +813,15 @@ namespace gdjs {
|
||||
domElementContainer.removeChild(_authenticationRootContainer);
|
||||
}
|
||||
|
||||
_authenticationRootContainer = null;
|
||||
_authenticationLoaderContainer = null;
|
||||
_authenticationTextContainer = null;
|
||||
};
|
||||
|
||||
/*
|
||||
* Remove the authentication callbacks from web or cordova.
|
||||
*/
|
||||
const removeAuthenticationCallbacks = function () {
|
||||
// Remove the authentication callbacks.
|
||||
if (_authenticationMessageCallback) {
|
||||
window.removeEventListener(
|
||||
@@ -696,16 +833,12 @@ namespace gdjs {
|
||||
// No need to detach the callback from the InAppBrowser, as it's destroyed when the window is closed.
|
||||
_cordovaAuthenticationMessageCallback = null;
|
||||
}
|
||||
|
||||
_authenticationRootContainer = null;
|
||||
_authenticationLoaderContainer = null;
|
||||
_authenticationTextContainer = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* 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(
|
||||
@@ -480,7 +480,8 @@ void DeclarePrimitiveDrawingExtension(gd::PlatformExtension& extension) {
|
||||
"res/actions/outlineSize_black.png")
|
||||
|
||||
.AddParameter("object", _("Shape Painter object"), "Drawer")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("SetOutlineSize")
|
||||
.SetGetter("GetOutlineSize");
|
||||
|
||||
@@ -493,7 +494,8 @@ void DeclarePrimitiveDrawingExtension(gd::PlatformExtension& extension) {
|
||||
"res/conditions/outlineSize_black.png")
|
||||
|
||||
.AddParameter("object", _("Shape Painter object"), "Drawer")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number", gd::ParameterOptions::MakeNewOptions())
|
||||
.SetFunctionName("GetOutlineSize");
|
||||
|
||||
obj.AddExpression("OutlineSize",
|
||||
@@ -514,7 +516,10 @@ void DeclarePrimitiveDrawingExtension(gd::PlatformExtension& extension) {
|
||||
"res/actions/opacity.png")
|
||||
|
||||
.AddParameter("object", _("Shape Painter object"), "Drawer")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Opacity (0-255)")))
|
||||
.SetFunctionName("SetFillOpacity")
|
||||
.SetGetter("GetFillOpacity");
|
||||
|
||||
@@ -527,7 +532,10 @@ void DeclarePrimitiveDrawingExtension(gd::PlatformExtension& extension) {
|
||||
"res/conditions/opacity.png")
|
||||
|
||||
.AddParameter("object", _("Shape Painter object"), "Drawer")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Opacity to compare to (0-255)")))
|
||||
.SetFunctionName("GetFillOpacity");
|
||||
|
||||
obj.AddExpression("FillOpacity",
|
||||
@@ -547,7 +555,10 @@ void DeclarePrimitiveDrawingExtension(gd::PlatformExtension& extension) {
|
||||
"res/actions/opacity.png")
|
||||
|
||||
.AddParameter("object", _("Shape Painter object"), "Drawer")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Opacity (0-255)")))
|
||||
.SetFunctionName("SetOutlineOpacity")
|
||||
.SetGetter("GetOutlineOpacity");
|
||||
|
||||
@@ -560,7 +571,10 @@ void DeclarePrimitiveDrawingExtension(gd::PlatformExtension& extension) {
|
||||
"res/conditions/opacity.png")
|
||||
|
||||
.AddParameter("object", _("Shape Painter object"), "Drawer")
|
||||
.UseStandardRelationalOperatorParameters("number")
|
||||
.UseStandardRelationalOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Opacity to compare to (0-255)")))
|
||||
.SetFunctionName("GetOutlineOpacity");
|
||||
|
||||
obj.AddExpression("OutlineOpacity",
|
||||
@@ -605,7 +619,10 @@ void DeclarePrimitiveDrawingExtension(gd::PlatformExtension& extension) {
|
||||
"res/actions/scale24_black.png",
|
||||
"res/actions/scale_black.png")
|
||||
.AddParameter("object", _("Object"), "Drawer")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Scale (1 by default)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddExpressionAndConditionAndAction("number",
|
||||
@@ -616,7 +633,10 @@ void DeclarePrimitiveDrawingExtension(gd::PlatformExtension& extension) {
|
||||
_("Size"),
|
||||
"res/actions/scaleWidth24_black.png")
|
||||
.AddParameter("object", _("Object"), "Drawer")
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Scale (1 by default)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddExpressionAndConditionAndAction("number",
|
||||
@@ -627,7 +647,10 @@ void DeclarePrimitiveDrawingExtension(gd::PlatformExtension& extension) {
|
||||
_("Size"),
|
||||
"res/actions/scaleHeight24_black.png")
|
||||
.AddParameter("object", _("Object"), "Drawer")
|
||||
.UseStandardParameters("number")
|
||||
.UseStandardParameters(
|
||||
"number",
|
||||
gd::ParameterOptions::MakeNewOptions().SetDescription(
|
||||
_("Scale (1 by default)")))
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("FlipX",
|
||||
@@ -678,7 +701,8 @@ void DeclarePrimitiveDrawingExtension(gd::PlatformExtension& extension) {
|
||||
"res/actions/scaleWidth24_black.png",
|
||||
"res/actions/scaleWidth_black.png")
|
||||
.AddParameter("object", _("Object"), "Drawer")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction("Height",
|
||||
@@ -689,7 +713,8 @@ void DeclarePrimitiveDrawingExtension(gd::PlatformExtension& extension) {
|
||||
"res/actions/scaleHeight24_black.png",
|
||||
"res/actions/scaleHeight_black.png")
|
||||
.AddParameter("object", _("Object"), "Drawer")
|
||||
.UseStandardOperatorParameters("number")
|
||||
.UseStandardOperatorParameters("number",
|
||||
gd::ParameterOptions::MakeNewOptions())
|
||||
.MarkAsAdvanced();
|
||||
|
||||
obj.AddAction(
|
||||
|
@@ -108,7 +108,7 @@ void ShapePainterObjectBase::SetFillColor(unsigned int r,
|
||||
fillColorB = b;
|
||||
}
|
||||
|
||||
void ShapePainterObjectBase::SetFillOpacity(float val) {
|
||||
void ShapePainterObjectBase::SetFillOpacity(double val) {
|
||||
if (val > 255)
|
||||
val = 255;
|
||||
else if (val < 0)
|
||||
@@ -128,7 +128,7 @@ void ShapePainterObjectBase::SetOutlineColor(unsigned int r,
|
||||
outlineColorB = b;
|
||||
}
|
||||
|
||||
void ShapePainterObjectBase::SetOutlineOpacity(float val) {
|
||||
void ShapePainterObjectBase::SetOutlineOpacity(double val) {
|
||||
if (val > 255)
|
||||
val = 255;
|
||||
else if (val < 0)
|
||||
|
@@ -26,11 +26,11 @@ class GD_EXTENSION_API ShapePainterObjectBase {
|
||||
ShapePainterObjectBase();
|
||||
virtual ~ShapePainterObjectBase(){};
|
||||
|
||||
inline void SetOutlineSize(float size) { outlineSize = size; };
|
||||
inline float GetOutlineSize() const { return outlineSize; };
|
||||
inline void SetOutlineSize(double size) { outlineSize = size; };
|
||||
inline double GetOutlineSize() const { return outlineSize; };
|
||||
|
||||
void SetOutlineOpacity(float val);
|
||||
inline float GetOutlineOpacity() const { return outlineOpacity; };
|
||||
void SetOutlineOpacity(double val);
|
||||
inline double GetOutlineOpacity() const { return outlineOpacity; };
|
||||
|
||||
void SetOutlineColor(unsigned int r, unsigned int v, unsigned int b);
|
||||
inline unsigned int GetOutlineColorR() const { return outlineColorR; };
|
||||
@@ -41,8 +41,8 @@ class GD_EXTENSION_API ShapePainterObjectBase {
|
||||
*/
|
||||
void SetOutlineColor(const gd::String& color);
|
||||
|
||||
void SetFillOpacity(float val);
|
||||
inline float GetFillOpacity() const { return fillOpacity; };
|
||||
void SetFillOpacity(double val);
|
||||
inline double GetFillOpacity() const { return fillOpacity; };
|
||||
|
||||
void SetFillColor(unsigned int r, unsigned int v, unsigned int b);
|
||||
inline unsigned int GetFillColorR() const { return fillColorR; };
|
||||
|
@@ -9,27 +9,47 @@ This project is released under the MIT License.
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
|
||||
void DeclareSystemInfoExtension(gd::PlatformExtension& extension) {
|
||||
extension.SetExtensionInformation(
|
||||
"SystemInfo",
|
||||
_("System information"),
|
||||
_("Get information about the system and device running the game."),
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
extension
|
||||
.SetExtensionInformation(
|
||||
"SystemInfo",
|
||||
_("System information"),
|
||||
_("Get information about the system and device running the game."),
|
||||
"Florian Rival",
|
||||
"Open source (MIT License)")
|
||||
.SetCategory("Advanced");
|
||||
extension.AddInstructionOrExpressionGroupMetadata(_("System information"))
|
||||
.SetIcon("CppPlatform/Extensions/systeminfoicon.png");
|
||||
|
||||
extension
|
||||
.AddCondition(
|
||||
"IsMobile",
|
||||
_("Is a mobile device"),
|
||||
_("Check if the device running the game is a mobile device"),
|
||||
_("The device is a mobile device"),
|
||||
"",
|
||||
"CppPlatform/Extensions/systeminfoicon.png",
|
||||
"CppPlatform/Extensions/systeminfoicon.png")
|
||||
extension.AddCondition(
|
||||
"IsMobile",
|
||||
_("Is a mobile device"),
|
||||
_("Check if the device running the game is a mobile device (phone or "
|
||||
"tablet on iOS, Android or other mobile devices). The game itself "
|
||||
"might be a web game or distributed as a native mobile app (to check "
|
||||
"this precisely, use other conditions)."),
|
||||
_("The device is a mobile device"),
|
||||
"",
|
||||
"CppPlatform/Extensions/systeminfoicon.png",
|
||||
"CppPlatform/Extensions/systeminfoicon.png");
|
||||
|
||||
.SetFunctionName("SystemInfo::IsMobile");
|
||||
extension.AddCondition("IsNativeMobileApp",
|
||||
_("Is a native mobile app"),
|
||||
_("Check if the game is running as a native mobile "
|
||||
"app (iOS or Android app)."),
|
||||
_("The game is running as a native mobile app"),
|
||||
"",
|
||||
"CppPlatform/Extensions/systeminfoicon.png",
|
||||
"CppPlatform/Extensions/systeminfoicon.png");
|
||||
|
||||
extension
|
||||
.AddCondition("IsNativeDesktopApp",
|
||||
_("Is a native desktop app"),
|
||||
_("Check if the game is running as a native desktop app."),
|
||||
_("The game is running as a native desktop app"),
|
||||
"",
|
||||
"CppPlatform/Extensions/systeminfoicon.png",
|
||||
"CppPlatform/Extensions/systeminfoicon.png")
|
||||
.AddCodeOnlyParameter("currentScene", "");
|
||||
|
||||
extension
|
||||
.AddCondition("IsWebGLSupported",
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user