Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions extensions/community/DynamicBanner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
{
"author": "",
"category": "General",
"extensionNamespace": "",
"fullName": "Dynamic Image URL Loader",
"gdevelopVersion": "",
"helpPath": "",
"iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjMsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iSWNvbnMiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4Ig0KCSB2aWV3Qm94PSIwIDAgMzIgMzIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDMyIDMyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+DQo8c3R5bGUgdHlwZT0idGV4dC9jc3MiPg0KCS5zdDB7ZmlsbDpub25lO3N0cm9rZTojMDAwMDAwO3N0cm9rZS13aWR0aDoyO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxMDt9DQo8L3N0eWxlPg0KPHBhdGggZD0iTTI0LDE2Yy00LjQsMC04LDMuNi04LDhzMy42LDgsOCw4czgtMy42LDgtOFMyOC40LDE2LDI0LDE2eiBNMjcuNywyNC44Yy0wLjIsMC4yLTAuNCwwLjMtMC43LDAuM2MtMC4zLDAtMC41LTAuMS0wLjctMC4zDQoJTDI1LDIzLjVWMjhjMCwwLjYtMC40LDEtMSwxcy0xLTAuNC0xLTF2LTQuNWwtMS4zLDEuM2MtMC40LDAuNC0xLDAuNC0xLjQsMGMtMC40LTAuNC0wLjQtMSwwLTEuNGwzLTMuMWMwLDAsMCwwLDAsMA0KCWMwLjItMC4yLDAuNC0wLjMsMC43LTAuM3MwLjUsMC4xLDAuNywwLjNjMCwwLDAsMCwwLDBsMywzLjFDMjguMSwyMy44LDI4LjEsMjQuNCwyNy43LDI0Ljh6Ii8+DQo8Zz4NCgk8cG9seWdvbiBwb2ludHM9IjE3LDIuNiAxNyw4IDIyLjQsOCAJIi8+DQoJPHBhdGggZD0iTTIwLjUsMTBIMTZjLTAuNiwwLTEtMC40LTEtMVYySDRDMy40LDIsMywyLjQsMywzdjI2YzAsMC42LDAuNCwxLDEsMWgxMmMtMS4zLTEuNy0yLTMuNy0yLTZjMC01LjIsNC05LjQsOS05Ljl2LTEuNg0KCQlDMjMsMTEuMSwyMS45LDEwLDIwLjUsMTB6Ii8+DQo8L2c+DQo8L3N2Zz4NCg==",
"name": "DynamicBanner",
"previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/Glyphster Pack/Master/SVG/Files and Folders/a69a1cc0ffe31941fab57ce04d576bcf91b130bd36313cf8429e7c344b75337f_Files and Folders_file_upload.svg",
"shortDescription": "Load any image from a URL or a String variable onto a Sprite object at runtime with automatic resizing.",
"version": "1.0.0",
"description": [
"Dynamic Image URL Loader",
"",
"This extension allows you to dynamically change the texture of any Sprite object during gameplay. It's perfect for displaying real-time advertisements, player avatars, or dynamic content fetched from the internet.",
"",
"Key Features:",
"",
" Automatic Fitting: No matter the source image's resolution (HD, 4K, etc.), it automatically scales to fit your Sprite's pre-defined size in the editor.",
"",
" Variable Support: Directly use GlobalVariableString(MyURL) or scene variables without complex expressions.",
"",
" Optimized Performance: Uses PixiJS texture caching to ensure smooth transitions and low memory usage.",
"",
" Error Handling: Includes built-in console logging for broken links or loading errors.",
"",
"How to use:",
"Simply use the \"Load URL into Sprite\" action, select your target Sprite, and provide a direct image link (e.g., \"https://site.com/image.png\") or a variable name."
],
"tags": [
"dynamic",
"url",
"sprite",
"texture",
"remote",
"loader",
"resize",
"advertisement",
"web-image",
"external-assets",
"pixijs",
"live-content",
"runtime",
"automatic-scale"
],
"authorIds": [
"E8iyLqwbCSNQEjZOhi9X5uxobWf2"
],
"dependencies": [],
"globalVariables": [],
"sceneVariables": [],
"eventsFunctions": [
{
"description": "Load any image from a URL or a String variable onto a Sprite object at runtime with automatic resizing.",
"fullName": "Load URL into a sprite",
"functionType": "Action",
"name": "LoadURLIntoSprite",
"sentence": "Load image from _PARAM1_ onto _PARAM2_ (Smooth: _PARAM3_)",
"events": [
{
"type": "BuiltinCommonInstructions::JsCode",
"inlineCode": [
"const objects = eventsFunctionContext.getObjects(\"Object\");",
"const url = eventsFunctionContext.getArgument(\"URL\");",
"",
"if (!objects || objects.length === 0 || !url) return;",
"",
"const newTexture = PIXI.Texture.from(url);",
"",
"const applyTexture = () => {",
" for (const obj of objects) {",
" // 1. Store current dimensions (e.g., 400x400)",
" const oldWidth = obj.getWidth();",
" const oldHeight = obj.getHeight();",
"",
" // 2. Apply the new texture",
" const renderer = obj.getRendererObject();",
" if (renderer) {",
" renderer.texture = newTexture;",
" ",
" // 3. Force dimensions back to original (Ensures images like 1280x720 fit into the defined 400x400 area)",
" obj.setWidth(oldWidth);",
" obj.setHeight(oldHeight);",
" }",
" }",
"};",
"",
"// If texture is already cached/loaded, apply immediately; otherwise, wait for the 'loaded' event.",
"if (newTexture.baseTexture.valid) {",
" applyTexture();",
"} else {",
" newTexture.baseTexture.once('loaded', applyTexture);",
"}"
],
"parameterObjects": "",
"useStrict": true,
"eventsSheetExpanded": true
}
],
"parameters": [
{
"description": "Image URL or VariableString",
"longDescription": "Enter a URL in quotes \"http://...\" or a variable like GlobalVariableString(AdURL)",
"name": "URL",
"type": "string"
},
{
"description": "Target Sprite Object",
"name": "Object",
"supplementaryInformation": "Sprite",
"type": "objectList"
},
{
"description": "Smooth Image?",
"name": "Smooth",
"type": "yesorno"
}
],
"objectGroups": []
}
],
"eventsBasedBehaviors": [],
"eventsBasedObjects": []
}