From 8c88038bfb1c7fc1d4d9377717e463d3487c7d23 Mon Sep 17 00:00:00 2001 From: Tristan Rhodes Date: Thu, 4 Jul 2024 06:05:35 -0600 Subject: [PATCH] Added new condition to check the zoom of a camera of a layer (#6747) --- .../Extensions/Builtin/CameraExtension.cpp | 19 +++++++++++++++++++ .../Extensions/Builtin/CameraExtension.cpp | 2 ++ 2 files changed, 21 insertions(+) diff --git a/Core/GDCore/Extensions/Builtin/CameraExtension.cpp b/Core/GDCore/Extensions/Builtin/CameraExtension.cpp index b7c76f5142e7..ee2c9f4bd502 100644 --- a/Core/GDCore/Extensions/Builtin/CameraExtension.cpp +++ b/Core/GDCore/Extensions/Builtin/CameraExtension.cpp @@ -327,6 +327,25 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsCameraExtension( .AddParameter("expression", _("Camera number (default : 0)"), "", true) .SetDefaultValue("0"); + extension + .AddCondition( + "CameraZoom", + _("Camera zoom"), + _("Compare the zoom of a camera of a layer."), + _("Zoom of camera _PARAM2_ of layer _PARAM1_"), + "", + "res/conditions/camera24.png", + "res/conditions/camera.png") + .AddCodeOnlyParameter("currentScene", "") + .AddParameter("layer", _("Layer"), "", true) + .SetDefaultValue("\"\"") + .AddParameter("expression", _("Camera number (default : 0)"), "", true) + .SetDefaultValue("0") + .UseStandardRelationalOperatorParameters( + "number", gd::ParameterOptions::MakeNewOptions().SetDescription( + _("Zoom"))) + .MarkAsAdvanced(); + extension .AddAction( "FixCamera", diff --git a/GDJS/GDJS/Extensions/Builtin/CameraExtension.cpp b/GDJS/GDJS/Extensions/Builtin/CameraExtension.cpp index 22f6edb3122c..b00fb0699294 100644 --- a/GDJS/GDJS/Extensions/Builtin/CameraExtension.cpp +++ b/GDJS/GDJS/Extensions/Builtin/CameraExtension.cpp @@ -69,6 +69,8 @@ CameraExtension::CameraExtension() { .SetGetter("gdjs.evtTools.camera.getCameraRotation"); GetAllActions()["ZoomCamera"].SetFunctionName( "gdjs.evtTools.camera.setCameraZoom"); + GetAllConditions()["CameraZoom"].SetFunctionName( + "gdjs.evtTools.camera.getCameraZoom"); GetAllExpressions()["CameraX"].SetFunctionName( "gdjs.evtTools.camera.getCameraX"); // Deprecated