-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathDynamicBanner.json
More file actions
125 lines (125 loc) · 6.01 KB
/
DynamicBanner.json
File metadata and controls
125 lines (125 loc) · 6.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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": []
}