From aadbfefc2208aff92bf4bd4b3f7bdaca24a8857e Mon Sep 17 00:00:00 2001 From: GDDEGabriel Date: Sun, 26 Apr 2026 20:58:12 +0000 Subject: [PATCH] Automated Extension submission for issue #2103 --- extensions/community/BetterScaling.json | 964 ++++++++++++++++++++++++ 1 file changed, 964 insertions(+) create mode 100644 extensions/community/BetterScaling.json diff --git a/extensions/community/BetterScaling.json b/extensions/community/BetterScaling.json new file mode 100644 index 000000000..190db66ba --- /dev/null +++ b/extensions/community/BetterScaling.json @@ -0,0 +1,964 @@ +{ + "author": "", + "category": "User interface", + "dimension": "", + "extensionNamespace": "", + "fullName": "Better scaling", + "gdevelopVersion": "", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLXdpbmRvdy1tYXhpbWl6ZSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiPjxwYXRoIGQ9Ik00LDRIMjBWMjBINFY0TTYsOFYxOEgxOFY4SDZaIiAvPjwvc3ZnPg==", + "name": "BetterScaling", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/96c0d21abb7c02f7f4190ae2d70b286d94376425c182ac801dcd4300812d3ce4_window-maximize.svg", + "shortDescription": "Better resolution scaling with multiple options.", + "version": "1.0.0", + "description": [ + "Better resolution scaling with multiple options.", + "", + "Supports scale offsets.", + "Current modes available : stretch to fit, simple letterboxing using floats or integers." + ], + "tags": [ + "scaling", + "resolution" + ], + "authorIds": [ + "DnN9YkkzkmapL1ksunbnNaiy2NF3" + ], + "dependencies": [], + "globalVariables": [ + { + "name": "scale", + "type": "structure", + "children": [ + { + "name": "factor", + "type": "number", + "value": 1 + }, + { + "name": "mode", + "type": "string", + "value": "letterbox" + }, + { + "name": "offset", + "type": "number", + "value": 0 + } + ] + } + ], + "sceneVariables": [], + "eventsFunctions": [ + { + "description": "Set current scaling mode.", + "fullName": "Set scale mode", + "functionType": "Action", + "group": "modes", + "name": "SetScalingMode", + "sentence": "Set scaling mode to _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetStringVariable" + }, + "parameters": [ + "scale.mode", + "=", + "newMode" + ] + } + ] + } + ], + "parameters": [ + { + "description": "New scaling mode", + "name": "newMode", + "supplementaryInformation": "[\"Stretch\",\"Letterbox\",\"LetterboxInteger\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + }, + { + "fullName": "", + "functionType": "Action", + "name": "onScenePostEvents", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "scaling types" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "ToLowerCase(scale.mode)", + "=", + "\"stretch\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "targetScale.x", + "=", + "ScreenWidth() / SceneWindowWidth()" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "targetScale.y", + "=", + "ScreenHeight() / SceneWindowHeight()" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "ToLowerCase(scale.mode)", + "contains", + "\"letterbox\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "tempScale", + "=", + "min(ScreenWidth() / SceneWindowWidth(), ScreenHeight() / SceneWindowHeight())" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "targetScale.x", + "=", + "tempScale" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "targetScale.y", + "=", + "tempScale" + ] + } + ], + "variables": [ + { + "name": "tempScale", + "type": "number", + "value": 1 + } + ] + }, + { + "colorB": 228, + "colorG": 176, + "colorR": 74, + "creationTime": 0, + "folded": true, + "name": "apply all variables", + "source": "", + "type": "BuiltinCommonInstructions::Group", + "events": [ + { + "folded": true, + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "maxScale.x", + "=", + "ScreenWidth() / SceneWindowWidth()" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "maxScale.y", + "=", + "ScreenHeight() / SceneWindowHeight()" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "apply integer" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::CompareStrings" + }, + "parameters": [ + "ToLowerCase(scale.mode)", + "contains", + "\"integer\"" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "targetScale.x", + "=", + "floor(targetScale.x)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "targetScale.y", + "=", + "floor(targetScale.y)" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "apply offset" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "targetScale.x", + "-", + "scale.offset" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "targetScale.y", + "-", + "scale.offset" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "clamp value to limit" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "targetScale.x", + "=", + "clamp(targetScale.x, 1, maxScale.x)" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "targetScale.y", + "=", + "clamp(targetScale.y, 1, maxScale.y)" + ] + } + ] + } + ], + "variables": [ + { + "name": "maxScale", + "type": "structure", + "children": [ + { + "name": "x", + "type": "number", + "value": 1 + }, + { + "name": "y", + "type": "number", + "value": 1 + } + ] + } + ] + } + ], + "parameters": [] + }, + { + "type": "BuiltinCommonInstructions::Comment", + "color": { + "b": 109, + "g": 230, + "r": 255, + "textB": 0, + "textG": 0, + "textR": 0 + }, + "comment": "apply scaling" + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "finalScale.x", + "=", + "(ScreenWidth() - (SceneWindowWidth() * targetScale.x)) / 2" + ] + }, + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "finalScale.y", + "=", + "(ScreenHeight() - (SceneWindowHeight() * targetScale.y)) / 2" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "inverted": true, + "value": "IsFullScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetWindowSize" + }, + "parameters": [ + "", + "SceneWindowWidth() * scale.factor", + "SceneWindowHeight() * scale.factor", + "0" + ] + }, + { + "type": { + "value": "SetWindowMargins" + }, + "parameters": [ + "", + "0", + "0", + "0", + "0" + ] + } + ], + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BuiltinCommonInstructions::Once" + }, + "parameters": [] + } + ], + "actions": [ + { + "type": { + "value": "CenterWindow" + }, + "parameters": [ + "" + ] + } + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "IsFullScreen" + }, + "parameters": [ + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "SetWindowMargins" + }, + "parameters": [ + "", + "finalScale.y", + "finalScale.x", + "finalScale.y", + "finalScale.x" + ] + } + ] + } + ], + "variables": [ + { + "name": "finalScale", + "type": "structure", + "children": [ + { + "name": "x", + "type": "number", + "value": 1 + }, + { + "name": "y", + "type": "number", + "value": 1 + } + ] + } + ] + } + ], + "variables": [ + { + "name": "targetScale", + "type": "structure", + "children": [ + { + "name": "x", + "type": "number", + "value": 1 + }, + { + "name": "y", + "type": "number", + "value": 1 + } + ] + } + ] + } + ], + "parameters": [], + "objectGroups": [] + }, + { + "description": "Current scaling mode.", + "fullName": "Scaling mode", + "functionType": "ExpressionAndCondition", + "group": "modes", + "name": "ScalingMode", + "sentence": "Return current scaling mode", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "scale.mode" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "[\"Stretch\",\"Letterbox\",\"LetterboxInteger\"]", + "type": "stringWithSelector" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "Set current scaling offset.", + "fullName": "Set scale offset", + "functionType": "Action", + "group": "offset", + "name": "SetScalingOffset", + "sentence": "Set current scaling offset to _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "scale.offset", + "=", + "newOffset" + ] + } + ] + } + ], + "parameters": [ + { + "description": "new offset amount", + "name": "newOffset", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Current scaling offset.", + "fullName": "Scale offset", + "functionType": "ExpressionAndCondition", + "group": "offset", + "name": "ScalingOffset", + "sentence": "Return current scaling offset", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "scale.offset" + ] + } + ] + } + ], + "expressionType": { + "type": "expression" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "Set current scaling factor.", + "fullName": "Set scale factor", + "functionType": "Action", + "group": "factor", + "name": "SetScalingFactor", + "sentence": "Set scaling factor to _PARAM1_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "scale.factor", + "=", + "newFactor" + ] + } + ] + } + ], + "parameters": [ + { + "description": "New scaling factor", + "name": "newFactor", + "supplementaryInformation": "[\"Stretch\",\"Letterbox\",\"LetterboxInteger\"]", + "type": "expression" + } + ], + "objectGroups": [] + }, + { + "description": "Current scaling factor.", + "fullName": "Scaling factor", + "functionType": "ExpressionAndCondition", + "group": "factor", + "name": "ScalingFactor", + "sentence": "Return current scaling factor", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetReturnString" + }, + "parameters": [ + "scale.factor" + ] + } + ] + } + ], + "expressionType": { + "supplementaryInformation": "[\"Stretch\",\"Letterbox\",\"LetterboxInteger\"]", + "type": "expression" + }, + "parameters": [], + "objectGroups": [] + }, + { + "description": "This action activates or deactivates fullscreen.", + "fullName": "Custom fullscreen", + "functionType": "Action", + "name": "CustomFullscreen", + "sentence": "Activate fullscreen _PARAM1_ with scale factor of _PARAM2_", + "events": [ + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [], + "actions": [ + { + "type": { + "value": "SetNumberVariable" + }, + "parameters": [ + "scale.factor", + "=", + "newFactor" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "fs", + "=", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Wait" + }, + "parameters": [ + "0" + ] + }, + { + "type": { + "value": "AdvancedWindow::SetFullScreenable" + }, + "parameters": [ + "yes", + "" + ] + }, + { + "type": { + "value": "AdvancedWindow::SetResizable" + }, + "parameters": [ + "yes", + "" + ] + }, + { + "type": { + "value": "SetFullScreen" + }, + "parameters": [ + "", + "no", + "yes" + ] + }, + { + "type": { + "value": "AdvancedWindow::SetFullScreenable" + }, + "parameters": [ + "", + "" + ] + }, + { + "type": { + "value": "SetWindowSize" + }, + "parameters": [ + "", + "SceneWindowWidth()", + "SceneWindowHeight()", + "" + ] + }, + { + "type": { + "value": "CenterWindow" + }, + "parameters": [ + "" + ] + }, + { + "type": { + "value": "AdvancedWindow::SetResizable" + }, + "parameters": [ + "no", + "" + ] + } + ] + }, + { + "type": "BuiltinCommonInstructions::Standard", + "conditions": [ + { + "type": { + "value": "BooleanVariable" + }, + "parameters": [ + "fs", + "True", + "" + ] + } + ], + "actions": [ + { + "type": { + "value": "Wait" + }, + "parameters": [ + "0" + ] + }, + { + "type": { + "value": "AdvancedWindow::SetFullScreenable" + }, + "parameters": [ + "yes", + "" + ] + }, + { + "type": { + "value": "AdvancedWindow::SetResizable" + }, + "parameters": [ + "yes", + "" + ] + }, + { + "type": { + "value": "SetFullScreen" + }, + "parameters": [ + "", + "yes", + "yes" + ] + }, + { + "type": { + "value": "AdvancedWindow::SetFullScreenable" + }, + "parameters": [ + "", + "" + ] + }, + { + "type": { + "value": "AdvancedWindow::SetResizable" + }, + "parameters": [ + "no", + "" + ] + } + ] + } + ], + "parameters": [ + { + "defaultValue": "no", + "description": "Fullscreen?", + "name": "fs", + "optional": true, + "type": "yesorno" + }, + { + "description": "scale factor", + "name": "newFactor", + "type": "expression" + } + ], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "folderName": "modes", + "children": [ + { + "functionName": "SetScalingMode" + }, + { + "functionName": "ScalingMode" + } + ] + }, + { + "folderName": "factor", + "children": [ + { + "functionName": "SetScalingFactor" + }, + { + "functionName": "ScalingFactor" + } + ] + }, + { + "folderName": "offset", + "children": [ + { + "functionName": "SetScalingOffset" + }, + { + "functionName": "ScalingOffset" + } + ] + }, + { + "functionName": "onScenePostEvents" + }, + { + "functionName": "CustomFullscreen" + } + ] + }, + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] +}