@defold-typescript/types 0.49.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/api-availability.json +696 -624
  2. package/api-signatures.json +6799 -160
  3. package/api-targets.json +393 -2
  4. package/examples/translations.json +12 -0
  5. package/generated/b2d.d.ts +15 -0
  6. package/generated/bullet3d.d.ts +16 -0
  7. package/generated/font.d.ts +7 -3
  8. package/generated/graphics.d.ts +7 -0
  9. package/generated/gui.d.ts +5 -4
  10. package/generated/label.d.ts +3 -3
  11. package/generated/render.d.ts +16 -1
  12. package/generated/versions/defold-1.13.2/b2d.d.ts +709 -0
  13. package/generated/versions/defold-1.13.2/b2d_body.d.ts +593 -0
  14. package/generated/versions/defold-1.13.2/b2d_chain.d.ts +105 -0
  15. package/generated/versions/defold-1.13.2/b2d_fixture.d.ts +175 -0
  16. package/generated/versions/defold-1.13.2/b2d_joint.d.ts +1301 -0
  17. package/generated/versions/defold-1.13.2/b2d_shape.d.ts +423 -0
  18. package/generated/versions/defold-1.13.2/b2d_world.d.ts +308 -0
  19. package/generated/versions/defold-1.13.2/buffer.d.ts +192 -0
  20. package/generated/versions/defold-1.13.2/bullet3d.d.ts +91 -0
  21. package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +433 -0
  22. package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +818 -0
  23. package/generated/versions/defold-1.13.2/bullet3d_rigid_body.d.ts +429 -0
  24. package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +123 -0
  25. package/generated/versions/defold-1.13.2/bullet3d_world.d.ts +492 -0
  26. package/generated/versions/defold-1.13.2/camera.d.ts +300 -0
  27. package/generated/versions/defold-1.13.2/collectionfactory.d.ts +148 -0
  28. package/generated/versions/defold-1.13.2/collectionproxy.d.ts +109 -0
  29. package/generated/versions/defold-1.13.2/compute.d.ts +107 -0
  30. package/generated/versions/defold-1.13.2/crash.d.ts +157 -0
  31. package/generated/versions/defold-1.13.2/editor-vm/http.d.ts +139 -0
  32. package/generated/versions/defold-1.13.2/editor-vm/image.d.ts +48 -0
  33. package/generated/versions/defold-1.13.2/editor-vm/json.d.ts +21 -0
  34. package/generated/versions/defold-1.13.2/editor-vm/localization.d.ts +42 -0
  35. package/generated/versions/defold-1.13.2/editor-vm/tilemap_tiles.d.ts +126 -0
  36. package/generated/versions/defold-1.13.2/editor-vm/zip.d.ts +38 -0
  37. package/generated/versions/defold-1.13.2/editor-vm/zlib.d.ts +24 -0
  38. package/generated/versions/defold-1.13.2/editor.d.ts +2177 -0
  39. package/generated/versions/defold-1.13.2/factory.d.ts +121 -0
  40. package/generated/versions/defold-1.13.2/font.d.ts +123 -0
  41. package/generated/versions/defold-1.13.2/go.d.ts +1166 -0
  42. package/generated/versions/defold-1.13.2/graphics.d.ts +613 -0
  43. package/generated/versions/defold-1.13.2/gui.d.ts +2212 -0
  44. package/generated/versions/defold-1.13.2/html5.d.ts +55 -0
  45. package/generated/versions/defold-1.13.2/http.d.ts +83 -0
  46. package/generated/versions/defold-1.13.2/image.d.ts +181 -0
  47. package/generated/versions/defold-1.13.2/index.d.ts +63 -0
  48. package/generated/versions/defold-1.13.2/json.d.ts +94 -0
  49. package/generated/versions/defold-1.13.2/kinds/editor-script.d.ts +14 -0
  50. package/generated/versions/defold-1.13.2/label.d.ts +164 -0
  51. package/generated/versions/defold-1.13.2/liveupdate.d.ts +143 -0
  52. package/generated/versions/defold-1.13.2/material.d.ts +490 -0
  53. package/generated/versions/defold-1.13.2/model.d.ts +287 -0
  54. package/generated/versions/defold-1.13.2/msg.d.ts +10 -0
  55. package/generated/versions/defold-1.13.2/particlefx.d.ts +155 -0
  56. package/generated/versions/defold-1.13.2/physics.d.ts +789 -0
  57. package/generated/versions/defold-1.13.2/profiler.d.ts +228 -0
  58. package/generated/versions/defold-1.13.2/render.d.ts +1153 -0
  59. package/generated/versions/defold-1.13.2/resource.d.ts +1628 -0
  60. package/generated/versions/defold-1.13.2/socket.d.ts +797 -0
  61. package/generated/versions/defold-1.13.2/sound.d.ts +323 -0
  62. package/generated/versions/defold-1.13.2/sprite.d.ts +179 -0
  63. package/generated/versions/defold-1.13.2/sys.d.ts +754 -0
  64. package/generated/versions/defold-1.13.2/tilemap.d.ts +206 -0
  65. package/generated/versions/defold-1.13.2/timer.d.ts +136 -0
  66. package/generated/versions/defold-1.13.2/types.d.ts +61 -0
  67. package/generated/versions/defold-1.13.2/vmath.d.ts +775 -0
  68. package/generated/versions/defold-1.13.2/window.d.ts +196 -0
  69. package/generated/versions/defold-1.13.2/zlib.d.ts +41 -0
  70. package/identity-vocabulary.json +1 -0
  71. package/package.json +2 -2
  72. package/scripts/import-defold-release.ts +3 -31
  73. package/scripts/materialize-version.ts +13 -7
  74. package/scripts/regen.ts +63 -29
  75. package/scripts/sync-api-docs.ts +31 -2
  76. package/src/emit-dts.ts +25 -3
@@ -0,0 +1,2212 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash, Matrix4, Opaque, Quaternion, Url, Vector, Vector3, Vector4 } from "../../../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * GUI API documentation
7
+ */
8
+ namespace gui {
9
+ /**
10
+ * Rich-text layout object
11
+ */
12
+ interface layout_object {
13
+ /**
14
+ * object type, currently `link` or `sprite`
15
+ */
16
+ type: string;
17
+ /**
18
+ * the object's `id` attribute, or its generated layout object id
19
+ */
20
+ id: Hash;
21
+ /**
22
+ * zero-based UTF-32 offset in the visible text
23
+ */
24
+ text_offset: number;
25
+ /**
26
+ * visible UTF-32 text length covered by the object
27
+ */
28
+ text_length: number;
29
+ /**
30
+ * lower-left x-coordinate relative to the text node's upper-left layout origin
31
+ */
32
+ x: number;
33
+ /**
34
+ * lower-left y-coordinate relative to the text node's upper-left layout origin
35
+ */
36
+ y: number;
37
+ /**
38
+ * resolved object width
39
+ */
40
+ width: number;
41
+ /**
42
+ * resolved object height
43
+ */
44
+ height: number;
45
+ /**
46
+ * markup attributes keyed by name
47
+ */
48
+ attributes: LuaTable<string, string>;
49
+ }
50
+ type node = Opaque<"node">;
51
+ /**
52
+ * GUI flipbook playback properties
53
+ */
54
+ interface play_properties {
55
+ /**
56
+ * Normalized initial animation cursor.
57
+ */
58
+ offset?: number;
59
+ /**
60
+ * Positive animation playback rate.
61
+ */
62
+ playback_rate?: number;
63
+ }
64
+ /**
65
+ * Generic GUI property options
66
+ */
67
+ interface set_options {
68
+ /**
69
+ * One-based material-constant array index.
70
+ */
71
+ index?: number;
72
+ /**
73
+ * Internal property name.
74
+ */
75
+ key?: string | Hash;
76
+ }
77
+ type AdjustMode = typeof gui.ADJUST_FIT | typeof gui.ADJUST_ZOOM | typeof gui.ADJUST_STRETCH;
78
+ type BlendMode = typeof gui.BLEND_ALPHA | typeof gui.BLEND_ADD | typeof gui.BLEND_ADD_ALPHA | typeof gui.BLEND_MULT | typeof gui.BLEND_SCREEN;
79
+ type ClippingMode = typeof gui.CLIPPING_MODE_NONE | typeof gui.CLIPPING_MODE_STENCIL;
80
+ type Easing = typeof gui.EASING_INBACK | typeof gui.EASING_INBOUNCE | typeof gui.EASING_INCIRC | typeof gui.EASING_INCUBIC | typeof gui.EASING_INELASTIC | typeof gui.EASING_INEXPO | typeof gui.EASING_INOUTBACK | typeof gui.EASING_INOUTBOUNCE | typeof gui.EASING_INOUTCIRC | typeof gui.EASING_INOUTCUBIC | typeof gui.EASING_INOUTELASTIC | typeof gui.EASING_INOUTEXPO | typeof gui.EASING_INOUTQUAD | typeof gui.EASING_INOUTQUART | typeof gui.EASING_INOUTQUINT | typeof gui.EASING_INOUTSINE | typeof gui.EASING_INQUAD | typeof gui.EASING_INQUART | typeof gui.EASING_INQUINT | typeof gui.EASING_INSINE | typeof gui.EASING_LINEAR | typeof gui.EASING_OUTBACK | typeof gui.EASING_OUTBOUNCE | typeof gui.EASING_OUTCIRC | typeof gui.EASING_OUTCUBIC | typeof gui.EASING_OUTELASTIC | typeof gui.EASING_OUTEXPO | typeof gui.EASING_OUTINBACK | typeof gui.EASING_OUTINBOUNCE | typeof gui.EASING_OUTINCIRC | typeof gui.EASING_OUTINCUBIC | typeof gui.EASING_OUTINELASTIC | typeof gui.EASING_OUTINEXPO | typeof gui.EASING_OUTINQUAD | typeof gui.EASING_OUTINQUART | typeof gui.EASING_OUTINQUINT | typeof gui.EASING_OUTINSINE | typeof gui.EASING_OUTQUAD | typeof gui.EASING_OUTQUART | typeof gui.EASING_OUTQUINT | typeof gui.EASING_OUTSINE;
81
+ type KeyboardType = typeof gui.KEYBOARD_TYPE_DEFAULT | typeof gui.KEYBOARD_TYPE_EMAIL | typeof gui.KEYBOARD_TYPE_NUMBER_PAD | typeof gui.KEYBOARD_TYPE_PASSWORD;
82
+ type NodeType = typeof gui.TYPE_BOX | typeof gui.TYPE_TEXT | typeof gui.TYPE_PIE | typeof gui.TYPE_PARTICLEFX | typeof gui.TYPE_CUSTOM;
83
+ type PieBounds = typeof gui.PIEBOUNDS_RECTANGLE | typeof gui.PIEBOUNDS_ELLIPSE;
84
+ type Pivot = typeof gui.PIVOT_CENTER | typeof gui.PIVOT_N | typeof gui.PIVOT_NE | typeof gui.PIVOT_E | typeof gui.PIVOT_SE | typeof gui.PIVOT_S | typeof gui.PIVOT_SW | typeof gui.PIVOT_W | typeof gui.PIVOT_NW;
85
+ type Playback = typeof gui.PLAYBACK_ONCE_FORWARD | typeof gui.PLAYBACK_ONCE_BACKWARD | typeof gui.PLAYBACK_ONCE_PINGPONG | typeof gui.PLAYBACK_LOOP_FORWARD | typeof gui.PLAYBACK_LOOP_BACKWARD | typeof gui.PLAYBACK_LOOP_PINGPONG;
86
+ type Property = typeof gui.PROP_POSITION | typeof gui.PROP_ROTATION | typeof gui.PROP_EULER | typeof gui.PROP_SCALE | typeof gui.PROP_COLOR | typeof gui.PROP_OUTLINE | typeof gui.PROP_SHADOW | typeof gui.PROP_SIZE | typeof gui.PROP_FILL_ANGLE | typeof gui.PROP_INNER_RADIUS | typeof gui.PROP_LEADING | typeof gui.PROP_TRACKING | typeof gui.PROP_SLICE9;
87
+ type SafeAreaMode = typeof gui.SAFE_AREA_NONE | typeof gui.SAFE_AREA_LONG | typeof gui.SAFE_AREA_SHORT | typeof gui.SAFE_AREA_BOTH;
88
+ type SizeMode = typeof gui.SIZE_MODE_MANUAL | typeof gui.SIZE_MODE_AUTO;
89
+ type XAnchor = typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT;
90
+ type YAnchor = typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_TOP | typeof gui.ANCHOR_BOTTOM;
91
+ type ADJUST = typeof gui.ADJUST_FIT | typeof gui.ADJUST_STRETCH | typeof gui.ADJUST_ZOOM;
92
+ type ANCHOR = typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_RIGHT | typeof gui.ANCHOR_TOP;
93
+ type BLEND = typeof gui.BLEND_ADD | typeof gui.BLEND_ADD_ALPHA | typeof gui.BLEND_ALPHA | typeof gui.BLEND_MULT | typeof gui.BLEND_SCREEN;
94
+ type CLIPPING_MODE = typeof gui.CLIPPING_MODE_NONE | typeof gui.CLIPPING_MODE_STENCIL;
95
+ type EASING = typeof gui.EASING_INBACK | typeof gui.EASING_INBOUNCE | typeof gui.EASING_INCIRC | typeof gui.EASING_INCUBIC | typeof gui.EASING_INELASTIC | typeof gui.EASING_INEXPO | typeof gui.EASING_INOUTBACK | typeof gui.EASING_INOUTBOUNCE | typeof gui.EASING_INOUTCIRC | typeof gui.EASING_INOUTCUBIC | typeof gui.EASING_INOUTELASTIC | typeof gui.EASING_INOUTEXPO | typeof gui.EASING_INOUTQUAD | typeof gui.EASING_INOUTQUART | typeof gui.EASING_INOUTQUINT | typeof gui.EASING_INOUTSINE | typeof gui.EASING_INQUAD | typeof gui.EASING_INQUART | typeof gui.EASING_INQUINT | typeof gui.EASING_INSINE | typeof gui.EASING_LINEAR | typeof gui.EASING_OUTBACK | typeof gui.EASING_OUTBOUNCE | typeof gui.EASING_OUTCIRC | typeof gui.EASING_OUTCUBIC | typeof gui.EASING_OUTELASTIC | typeof gui.EASING_OUTEXPO | typeof gui.EASING_OUTINBACK | typeof gui.EASING_OUTINBOUNCE | typeof gui.EASING_OUTINCIRC | typeof gui.EASING_OUTINCUBIC | typeof gui.EASING_OUTINELASTIC | typeof gui.EASING_OUTINEXPO | typeof gui.EASING_OUTINQUAD | typeof gui.EASING_OUTINQUART | typeof gui.EASING_OUTINQUINT | typeof gui.EASING_OUTINSINE | typeof gui.EASING_OUTQUAD | typeof gui.EASING_OUTQUART | typeof gui.EASING_OUTQUINT | typeof gui.EASING_OUTSINE;
96
+ type KEYBOARD_TYPE = typeof gui.KEYBOARD_TYPE_DEFAULT | typeof gui.KEYBOARD_TYPE_EMAIL | typeof gui.KEYBOARD_TYPE_NUMBER_PAD | typeof gui.KEYBOARD_TYPE_PASSWORD;
97
+ type PIEBOUNDS = typeof gui.PIEBOUNDS_ELLIPSE | typeof gui.PIEBOUNDS_RECTANGLE;
98
+ type PIVOT = typeof gui.PIVOT_CENTER | typeof gui.PIVOT_E | typeof gui.PIVOT_N | typeof gui.PIVOT_NE | typeof gui.PIVOT_NW | typeof gui.PIVOT_S | typeof gui.PIVOT_SE | typeof gui.PIVOT_SW | typeof gui.PIVOT_W;
99
+ type PLAYBACK = typeof gui.PLAYBACK_LOOP_BACKWARD | typeof gui.PLAYBACK_LOOP_FORWARD | typeof gui.PLAYBACK_LOOP_PINGPONG | typeof gui.PLAYBACK_ONCE_BACKWARD | typeof gui.PLAYBACK_ONCE_FORWARD | typeof gui.PLAYBACK_ONCE_PINGPONG;
100
+ type PROP = typeof gui.PROP_COLOR | typeof gui.PROP_EULER | typeof gui.PROP_FILL_ANGLE | typeof gui.PROP_INNER_RADIUS | typeof gui.PROP_LEADING | typeof gui.PROP_OUTLINE | typeof gui.PROP_POSITION | typeof gui.PROP_ROTATION | typeof gui.PROP_SCALE | typeof gui.PROP_SHADOW | typeof gui.PROP_SIZE | typeof gui.PROP_SLICE9 | typeof gui.PROP_TRACKING;
101
+ type RESULT = typeof gui.RESULT_DATA_ERROR | typeof gui.RESULT_OUT_OF_RESOURCES | typeof gui.RESULT_TEXTURE_ALREADY_EXISTS;
102
+ type SAFE_AREA = typeof gui.SAFE_AREA_BOTH | typeof gui.SAFE_AREA_LONG | typeof gui.SAFE_AREA_NONE | typeof gui.SAFE_AREA_SHORT;
103
+ type SIZE_MODE = typeof gui.SIZE_MODE_AUTO | typeof gui.SIZE_MODE_MANUAL;
104
+ type TYPE = typeof gui.TYPE_BOX | typeof gui.TYPE_CUSTOM | typeof gui.TYPE_PARTICLEFX | typeof gui.TYPE_PIE | typeof gui.TYPE_TEXT;
105
+ /**
106
+ * fit adjust mode Adjust mode is used when the screen resolution differs from the project settings. The fit mode ensures that the entire node is visible in the adjusted gui scene.
107
+ */
108
+ const ADJUST_FIT: number & { readonly __brand: "gui.ADJUST_FIT" };
109
+ /**
110
+ * stretch adjust mode Adjust mode is used when the screen resolution differs from the project settings. The stretch mode ensures that the node is displayed as is in the adjusted gui scene, which might scale it non-uniformally.
111
+ */
112
+ const ADJUST_STRETCH: number & { readonly __brand: "gui.ADJUST_STRETCH" };
113
+ /**
114
+ * zoom adjust mode Adjust mode is used when the screen resolution differs from the project settings. The zoom mode ensures that the node fills its entire area and might make the node exceed it.
115
+ */
116
+ const ADJUST_ZOOM: number & { readonly __brand: "gui.ADJUST_ZOOM" };
117
+ /**
118
+ * bottom y-anchor
119
+ */
120
+ const ANCHOR_BOTTOM: number & { readonly __brand: "gui.ANCHOR_BOTTOM" };
121
+ /**
122
+ * left x-anchor
123
+ */
124
+ const ANCHOR_LEFT: number & { readonly __brand: "gui.ANCHOR_LEFT" };
125
+ /**
126
+ * no anchor
127
+ */
128
+ const ANCHOR_NONE: number & { readonly __brand: "gui.ANCHOR_NONE" };
129
+ /**
130
+ * right x-anchor
131
+ */
132
+ const ANCHOR_RIGHT: number & { readonly __brand: "gui.ANCHOR_RIGHT" };
133
+ /**
134
+ * top y-anchor
135
+ */
136
+ const ANCHOR_TOP: number & { readonly __brand: "gui.ANCHOR_TOP" };
137
+ /**
138
+ * additive blending
139
+ */
140
+ const BLEND_ADD: number & { readonly __brand: "gui.BLEND_ADD" };
141
+ /**
142
+ * additive alpha blending
143
+ */
144
+ const BLEND_ADD_ALPHA: number & { readonly __brand: "gui.BLEND_ADD_ALPHA" };
145
+ /**
146
+ * alpha blending
147
+ */
148
+ const BLEND_ALPHA: number & { readonly __brand: "gui.BLEND_ALPHA" };
149
+ /**
150
+ * multiply blending
151
+ */
152
+ const BLEND_MULT: number & { readonly __brand: "gui.BLEND_MULT" };
153
+ /**
154
+ * screen blending
155
+ */
156
+ const BLEND_SCREEN: number & { readonly __brand: "gui.BLEND_SCREEN" };
157
+ /**
158
+ * clipping mode none
159
+ */
160
+ const CLIPPING_MODE_NONE: number & { readonly __brand: "gui.CLIPPING_MODE_NONE" };
161
+ /**
162
+ * clipping mode stencil
163
+ */
164
+ const CLIPPING_MODE_STENCIL: number & { readonly __brand: "gui.CLIPPING_MODE_STENCIL" };
165
+ /**
166
+ * in-back
167
+ */
168
+ const EASING_INBACK: number & { readonly __brand: "gui.EASING_INBACK" };
169
+ /**
170
+ * in-bounce
171
+ */
172
+ const EASING_INBOUNCE: number & { readonly __brand: "gui.EASING_INBOUNCE" };
173
+ /**
174
+ * in-circlic
175
+ */
176
+ const EASING_INCIRC: number & { readonly __brand: "gui.EASING_INCIRC" };
177
+ /**
178
+ * in-cubic
179
+ */
180
+ const EASING_INCUBIC: number & { readonly __brand: "gui.EASING_INCUBIC" };
181
+ /**
182
+ * in-elastic
183
+ */
184
+ const EASING_INELASTIC: number & { readonly __brand: "gui.EASING_INELASTIC" };
185
+ /**
186
+ * in-exponential
187
+ */
188
+ const EASING_INEXPO: number & { readonly __brand: "gui.EASING_INEXPO" };
189
+ /**
190
+ * in-out-back
191
+ */
192
+ const EASING_INOUTBACK: number & { readonly __brand: "gui.EASING_INOUTBACK" };
193
+ /**
194
+ * in-out-bounce
195
+ */
196
+ const EASING_INOUTBOUNCE: number & { readonly __brand: "gui.EASING_INOUTBOUNCE" };
197
+ /**
198
+ * in-out-circlic
199
+ */
200
+ const EASING_INOUTCIRC: number & { readonly __brand: "gui.EASING_INOUTCIRC" };
201
+ /**
202
+ * in-out-cubic
203
+ */
204
+ const EASING_INOUTCUBIC: number & { readonly __brand: "gui.EASING_INOUTCUBIC" };
205
+ /**
206
+ * in-out-elastic
207
+ */
208
+ const EASING_INOUTELASTIC: number & { readonly __brand: "gui.EASING_INOUTELASTIC" };
209
+ /**
210
+ * in-out-exponential
211
+ */
212
+ const EASING_INOUTEXPO: number & { readonly __brand: "gui.EASING_INOUTEXPO" };
213
+ /**
214
+ * in-out-quadratic
215
+ */
216
+ const EASING_INOUTQUAD: number & { readonly __brand: "gui.EASING_INOUTQUAD" };
217
+ /**
218
+ * in-out-quartic
219
+ */
220
+ const EASING_INOUTQUART: number & { readonly __brand: "gui.EASING_INOUTQUART" };
221
+ /**
222
+ * in-out-quintic
223
+ */
224
+ const EASING_INOUTQUINT: number & { readonly __brand: "gui.EASING_INOUTQUINT" };
225
+ /**
226
+ * in-out-sine
227
+ */
228
+ const EASING_INOUTSINE: number & { readonly __brand: "gui.EASING_INOUTSINE" };
229
+ /**
230
+ * in-quadratic
231
+ */
232
+ const EASING_INQUAD: number & { readonly __brand: "gui.EASING_INQUAD" };
233
+ /**
234
+ * in-quartic
235
+ */
236
+ const EASING_INQUART: number & { readonly __brand: "gui.EASING_INQUART" };
237
+ /**
238
+ * in-quintic
239
+ */
240
+ const EASING_INQUINT: number & { readonly __brand: "gui.EASING_INQUINT" };
241
+ /**
242
+ * in-sine
243
+ */
244
+ const EASING_INSINE: number & { readonly __brand: "gui.EASING_INSINE" };
245
+ /**
246
+ * linear interpolation
247
+ */
248
+ const EASING_LINEAR: number & { readonly __brand: "gui.EASING_LINEAR" };
249
+ /**
250
+ * out-back
251
+ */
252
+ const EASING_OUTBACK: number & { readonly __brand: "gui.EASING_OUTBACK" };
253
+ /**
254
+ * out-bounce
255
+ */
256
+ const EASING_OUTBOUNCE: number & { readonly __brand: "gui.EASING_OUTBOUNCE" };
257
+ /**
258
+ * out-circlic
259
+ */
260
+ const EASING_OUTCIRC: number & { readonly __brand: "gui.EASING_OUTCIRC" };
261
+ /**
262
+ * out-cubic
263
+ */
264
+ const EASING_OUTCUBIC: number & { readonly __brand: "gui.EASING_OUTCUBIC" };
265
+ /**
266
+ * out-elastic
267
+ */
268
+ const EASING_OUTELASTIC: number & { readonly __brand: "gui.EASING_OUTELASTIC" };
269
+ /**
270
+ * out-exponential
271
+ */
272
+ const EASING_OUTEXPO: number & { readonly __brand: "gui.EASING_OUTEXPO" };
273
+ /**
274
+ * out-in-back
275
+ */
276
+ const EASING_OUTINBACK: number & { readonly __brand: "gui.EASING_OUTINBACK" };
277
+ /**
278
+ * out-in-bounce
279
+ */
280
+ const EASING_OUTINBOUNCE: number & { readonly __brand: "gui.EASING_OUTINBOUNCE" };
281
+ /**
282
+ * out-in-circlic
283
+ */
284
+ const EASING_OUTINCIRC: number & { readonly __brand: "gui.EASING_OUTINCIRC" };
285
+ /**
286
+ * out-in-cubic
287
+ */
288
+ const EASING_OUTINCUBIC: number & { readonly __brand: "gui.EASING_OUTINCUBIC" };
289
+ /**
290
+ * out-in-elastic
291
+ */
292
+ const EASING_OUTINELASTIC: number & { readonly __brand: "gui.EASING_OUTINELASTIC" };
293
+ /**
294
+ * out-in-exponential
295
+ */
296
+ const EASING_OUTINEXPO: number & { readonly __brand: "gui.EASING_OUTINEXPO" };
297
+ /**
298
+ * out-in-quadratic
299
+ */
300
+ const EASING_OUTINQUAD: number & { readonly __brand: "gui.EASING_OUTINQUAD" };
301
+ /**
302
+ * out-in-quartic
303
+ */
304
+ const EASING_OUTINQUART: number & { readonly __brand: "gui.EASING_OUTINQUART" };
305
+ /**
306
+ * out-in-quintic
307
+ */
308
+ const EASING_OUTINQUINT: number & { readonly __brand: "gui.EASING_OUTINQUINT" };
309
+ /**
310
+ * out-in-sine
311
+ */
312
+ const EASING_OUTINSINE: number & { readonly __brand: "gui.EASING_OUTINSINE" };
313
+ /**
314
+ * out-quadratic
315
+ */
316
+ const EASING_OUTQUAD: number & { readonly __brand: "gui.EASING_OUTQUAD" };
317
+ /**
318
+ * out-quartic
319
+ */
320
+ const EASING_OUTQUART: number & { readonly __brand: "gui.EASING_OUTQUART" };
321
+ /**
322
+ * out-quintic
323
+ */
324
+ const EASING_OUTQUINT: number & { readonly __brand: "gui.EASING_OUTQUINT" };
325
+ /**
326
+ * out-sine
327
+ */
328
+ const EASING_OUTSINE: number & { readonly __brand: "gui.EASING_OUTSINE" };
329
+ /**
330
+ * default keyboard
331
+ */
332
+ const KEYBOARD_TYPE_DEFAULT: number & { readonly __brand: "gui.KEYBOARD_TYPE_DEFAULT" };
333
+ /**
334
+ * email keyboard
335
+ */
336
+ const KEYBOARD_TYPE_EMAIL: number & { readonly __brand: "gui.KEYBOARD_TYPE_EMAIL" };
337
+ /**
338
+ * number input keyboard
339
+ */
340
+ const KEYBOARD_TYPE_NUMBER_PAD: number & { readonly __brand: "gui.KEYBOARD_TYPE_NUMBER_PAD" };
341
+ /**
342
+ * password keyboard
343
+ */
344
+ const KEYBOARD_TYPE_PASSWORD: number & { readonly __brand: "gui.KEYBOARD_TYPE_PASSWORD" };
345
+ /**
346
+ * elliptical pie node bounds
347
+ */
348
+ const PIEBOUNDS_ELLIPSE: number & { readonly __brand: "gui.PIEBOUNDS_ELLIPSE" };
349
+ /**
350
+ * rectangular pie node bounds
351
+ */
352
+ const PIEBOUNDS_RECTANGLE: number & { readonly __brand: "gui.PIEBOUNDS_RECTANGLE" };
353
+ /**
354
+ * center pivot
355
+ */
356
+ const PIVOT_CENTER: number & { readonly __brand: "gui.PIVOT_CENTER" };
357
+ /**
358
+ * east pivot
359
+ */
360
+ const PIVOT_E: number & { readonly __brand: "gui.PIVOT_E" };
361
+ /**
362
+ * north pivot
363
+ */
364
+ const PIVOT_N: number & { readonly __brand: "gui.PIVOT_N" };
365
+ /**
366
+ * north-east pivot
367
+ */
368
+ const PIVOT_NE: number & { readonly __brand: "gui.PIVOT_NE" };
369
+ /**
370
+ * north-west pivot
371
+ */
372
+ const PIVOT_NW: number & { readonly __brand: "gui.PIVOT_NW" };
373
+ /**
374
+ * south pivot
375
+ */
376
+ const PIVOT_S: number & { readonly __brand: "gui.PIVOT_S" };
377
+ /**
378
+ * south-east pivot
379
+ */
380
+ const PIVOT_SE: number & { readonly __brand: "gui.PIVOT_SE" };
381
+ /**
382
+ * south-west pivot
383
+ */
384
+ const PIVOT_SW: number & { readonly __brand: "gui.PIVOT_SW" };
385
+ /**
386
+ * west pivot
387
+ */
388
+ const PIVOT_W: number & { readonly __brand: "gui.PIVOT_W" };
389
+ /**
390
+ * loop backward
391
+ */
392
+ const PLAYBACK_LOOP_BACKWARD: number & { readonly __brand: "gui.PLAYBACK_LOOP_BACKWARD" };
393
+ /**
394
+ * loop forward
395
+ */
396
+ const PLAYBACK_LOOP_FORWARD: number & { readonly __brand: "gui.PLAYBACK_LOOP_FORWARD" };
397
+ /**
398
+ * ping pong loop
399
+ */
400
+ const PLAYBACK_LOOP_PINGPONG: number & { readonly __brand: "gui.PLAYBACK_LOOP_PINGPONG" };
401
+ /**
402
+ * once backward
403
+ */
404
+ const PLAYBACK_ONCE_BACKWARD: number & { readonly __brand: "gui.PLAYBACK_ONCE_BACKWARD" };
405
+ /**
406
+ * once forward
407
+ */
408
+ const PLAYBACK_ONCE_FORWARD: number & { readonly __brand: "gui.PLAYBACK_ONCE_FORWARD" };
409
+ /**
410
+ * once forward and then backward
411
+ */
412
+ const PLAYBACK_ONCE_PINGPONG: number & { readonly __brand: "gui.PLAYBACK_ONCE_PINGPONG" };
413
+ /**
414
+ * color property
415
+ */
416
+ const PROP_COLOR: string & { readonly __brand: "gui.PROP_COLOR" };
417
+ /**
418
+ * euler property
419
+ */
420
+ const PROP_EULER: string & { readonly __brand: "gui.PROP_EULER" };
421
+ /**
422
+ * fill_angle property
423
+ */
424
+ const PROP_FILL_ANGLE: string & { readonly __brand: "gui.PROP_FILL_ANGLE" };
425
+ /**
426
+ * inner_radius property
427
+ */
428
+ const PROP_INNER_RADIUS: string & { readonly __brand: "gui.PROP_INNER_RADIUS" };
429
+ /**
430
+ * leading property
431
+ */
432
+ const PROP_LEADING: string & { readonly __brand: "gui.PROP_LEADING" };
433
+ /**
434
+ * outline color property
435
+ */
436
+ const PROP_OUTLINE: string & { readonly __brand: "gui.PROP_OUTLINE" };
437
+ /**
438
+ * position property
439
+ */
440
+ const PROP_POSITION: string & { readonly __brand: "gui.PROP_POSITION" };
441
+ /**
442
+ * rotation property
443
+ */
444
+ const PROP_ROTATION: string & { readonly __brand: "gui.PROP_ROTATION" };
445
+ /**
446
+ * scale property
447
+ */
448
+ const PROP_SCALE: string & { readonly __brand: "gui.PROP_SCALE" };
449
+ /**
450
+ * shadow color property
451
+ */
452
+ const PROP_SHADOW: string & { readonly __brand: "gui.PROP_SHADOW" };
453
+ /**
454
+ * size property
455
+ */
456
+ const PROP_SIZE: string & { readonly __brand: "gui.PROP_SIZE" };
457
+ /**
458
+ * slice9 property
459
+ */
460
+ const PROP_SLICE9: string & { readonly __brand: "gui.PROP_SLICE9" };
461
+ /**
462
+ * tracking property
463
+ */
464
+ const PROP_TRACKING: string & { readonly __brand: "gui.PROP_TRACKING" };
465
+ /**
466
+ * data error The provided data is not in the expected format or is in some other way incorrect, for instance the image data provided to gui.new_texture().
467
+ */
468
+ const RESULT_DATA_ERROR: number & { readonly __brand: "gui.RESULT_DATA_ERROR" };
469
+ /**
470
+ * out of resource The system is out of resources, for instance when trying to create a new texture using gui.new_texture().
471
+ */
472
+ const RESULT_OUT_OF_RESOURCES: number & { readonly __brand: "gui.RESULT_OUT_OF_RESOURCES" };
473
+ /**
474
+ * texture already exists The texture id already exists when trying to use gui.new_texture().
475
+ */
476
+ const RESULT_TEXTURE_ALREADY_EXISTS: number & { readonly __brand: "gui.RESULT_TEXTURE_ALREADY_EXISTS" };
477
+ /**
478
+ * both sides safe area Safe area mode that applies insets on all edges.
479
+ */
480
+ const SAFE_AREA_BOTH: number & { readonly __brand: "gui.SAFE_AREA_BOTH" };
481
+ /**
482
+ * long side safe area Safe area mode that applies insets only on the long edges.
483
+ */
484
+ const SAFE_AREA_LONG: number & { readonly __brand: "gui.SAFE_AREA_LONG" };
485
+ /**
486
+ * no safe area Safe area mode that ignores safe area insets.
487
+ */
488
+ const SAFE_AREA_NONE: number & { readonly __brand: "gui.SAFE_AREA_NONE" };
489
+ /**
490
+ * short side safe area Safe area mode that applies insets only on the short edges.
491
+ */
492
+ const SAFE_AREA_SHORT: number & { readonly __brand: "gui.SAFE_AREA_SHORT" };
493
+ /**
494
+ * automatic size mode The size of the node is determined by the currently assigned texture.
495
+ */
496
+ const SIZE_MODE_AUTO: number & { readonly __brand: "gui.SIZE_MODE_AUTO" };
497
+ /**
498
+ * manual size mode The size of the node is determined by the size set in the editor, the constructor or by gui.set_size()
499
+ */
500
+ const SIZE_MODE_MANUAL: number & { readonly __brand: "gui.SIZE_MODE_MANUAL" };
501
+ /**
502
+ * box type
503
+ */
504
+ const TYPE_BOX: number & { readonly __brand: "gui.TYPE_BOX" };
505
+ /**
506
+ * custom type
507
+ */
508
+ const TYPE_CUSTOM: number & { readonly __brand: "gui.TYPE_CUSTOM" };
509
+ /**
510
+ * particlefx type
511
+ */
512
+ const TYPE_PARTICLEFX: number & { readonly __brand: "gui.TYPE_PARTICLEFX" };
513
+ /**
514
+ * pie type
515
+ */
516
+ const TYPE_PIE: number & { readonly __brand: "gui.TYPE_PIE" };
517
+ /**
518
+ * text type
519
+ */
520
+ const TYPE_TEXT: number & { readonly __brand: "gui.TYPE_TEXT" };
521
+ /**
522
+ * This starts an animation of a node property according to the specified parameters.
523
+ * If the node property is already being animated, that animation will be canceled and
524
+ * replaced by the new one. Note however that several different node properties
525
+ * can be animated simultaneously. Use `gui.cancel_animations` to stop the animation
526
+ * before it has completed.
527
+ * Composite properties of type vector3, vector4 or quaternion
528
+ * also expose their sub-components (x, y, z and w).
529
+ * You can address the components individually by suffixing the name with a dot '.'
530
+ * and the name of the component.
531
+ * For instance, `"position.x"` (the position x coordinate) or `"color.w"`
532
+ * (the color alpha value).
533
+ * If a `complete_function` (Lua function) is specified, that function will be called
534
+ * when the animation has completed.
535
+ * By starting a new animation in that function, several animations can be sequenced
536
+ * together. See the examples below for more information.
537
+ *
538
+ * @param node - node to animate
539
+ * @param property - property to animate; each gui.PROP member equals its corresponding property name string
540
+ * @param to - target property value
541
+ * @param easing - easing to use during animation.
542
+ * Either specify one of the `gui.EASING_*` constants or provide a
543
+ * vector with a custom curve. See the animation guide for more information.
544
+ * @param duration - duration of the animation in seconds.
545
+ * @param delay - delay before the animation starts in seconds.
546
+ * @param complete_function - function to call when the
547
+ * animation has completed
548
+ * @param playback - playback mode
549
+ * @example
550
+ * How to start a simple color animation, where the node fades in to white during 0.5 seconds:
551
+ * ```ts
552
+ * // How to start a simple color animation, where the node fades in to white during 0.5 seconds:
553
+ * const node = gui.get_node("my_node");
554
+ * gui.set_color(node, vmath.vector4(0, 0, 0, 0)); // node is fully transparent
555
+ * gui.animate(node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5); // start animation
556
+ * ```
557
+ * @example
558
+ * How to start a sequenced animation where the node fades in to white during 0.5 seconds, stays visible for 2 seconds and then fades out:
559
+ * ```ts
560
+ * // How to start a sequenced animation where the node fades in to white during 0.5
561
+ * // seconds, stays visible for 2 seconds and then fades out:
562
+ * function on_animation_done(self: unknown, node: unknown) {
563
+ * // fade out node, but wait 2 seconds before the animation starts
564
+ * gui.animate(node as Opaque<"node">, gui.PROP_COLOR, vmath.vector4(0, 0, 0, 0), gui.EASING_OUTQUAD, 0.5, 2.0);
565
+ * }
566
+ *
567
+ * export default defineGuiScript({
568
+ * init(self) {
569
+ * // fetch the node we want to animate
570
+ * const my_node = gui.get_node("my_node");
571
+ * // node is initially set to fully transparent
572
+ * gui.set_color(my_node, vmath.vector4(0, 0, 0, 0));
573
+ * // animate the node immediately and call on_animation_done when the animation has completed
574
+ * gui.animate(my_node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5, 0.0, on_animation_done);
575
+ * },
576
+ * });
577
+ * ```
578
+ * @example
579
+ * How to animate a node's y position using a crazy custom easing curve:
580
+ * ```ts
581
+ * // How to animate a node's y position using a crazy custom easing curve:
582
+ * export default defineGuiScript({
583
+ * init(self) {
584
+ * const values = [
585
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
586
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
587
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
588
+ * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
589
+ * ];
590
+ * const vec = vmath.vector(values);
591
+ * const node = gui.get_node("box");
592
+ * gui.animate(node, "position.y", 100, vec, 4.0, 0, undefined, gui.PLAYBACK_LOOP_PINGPONG);
593
+ * },
594
+ * });
595
+ * ```
596
+ */
597
+ function animate(node: Opaque<"node">, property: string | Hash | gui.PROP, to: number | Vector3 | Vector4 | Quaternion, easing: gui.EASING | Vector, duration: number, delay?: number, complete_function?: (self: unknown, node: Opaque<"node">) => void, playback?: gui.PLAYBACK): void;
598
+ /**
599
+ * If one or more animations of the specified node is currently running (started by `gui.animate`), they will immediately be canceled.
600
+ *
601
+ * @param node - node that should have its animation canceled
602
+ * @param property - optional property for which the animation should be canceled
603
+ *
604
+ * - `"position"`
605
+ * - `"rotation"`
606
+ * - `"euler"`
607
+ * - `"scale"`
608
+ * - `"color"`
609
+ * - `"outline"`
610
+ * - `"shadow"`
611
+ * - `"size"`
612
+ * - `"fill_angle"` (pie)
613
+ * - `"inner_radius"` (pie)
614
+ * - `"leading"` (text)
615
+ * - `"tracking"` (text)
616
+ * - `"slice9"` (slice9)
617
+ * @example
618
+ * Start an animation of the position property of a node, then cancel parts of
619
+ * the animation:
620
+ * ```ts
621
+ * const node = gui.get_node("my_node");
622
+ * // animate to new position
623
+ * const pos = vmath.vector3(100, 100, 0);
624
+ * gui.animate(node, "position", pos, gui.EASING_LINEAR, 2);
625
+ * // ...
626
+ * // cancel animation of the x component.
627
+ * gui.cancel_animations(node, "position.x");
628
+ * ```
629
+ * @example
630
+ * Cancels all property animations on a node in a single call:
631
+ * ```ts
632
+ * const node = gui.get_node("my_node");
633
+ * // animate to new position and scale
634
+ * gui.animate(node, "position", vmath.vector3(100, 100, 0), gui.EASING_LINEAR, 5);
635
+ * gui.animate(node, "scale", vmath.vector3(0.5), gui.EASING_LINEAR, 5);
636
+ * // ...
637
+ * // cancel positioning and scaling at once
638
+ * gui.cancel_animations(node);
639
+ * ```
640
+ */
641
+ function cancel_animations(node: Opaque<"node">, property?: string | Hash | gui.PROP): void;
642
+ /**
643
+ * Cancels any running flipbook animation on the specified node.
644
+ *
645
+ * @param node - node cancel flipbook animation for
646
+ * @example
647
+ * ```ts
648
+ * const node = gui.get_node("anim_node");
649
+ * gui.cancel_flipbook(node);
650
+ * ```
651
+ */
652
+ function cancel_flipbook(node: Opaque<"node">): void;
653
+ /**
654
+ * Make a clone instance of a node. The cloned node will be identical to the
655
+ * original node, except the id which is generated as the string "node" plus
656
+ * a sequential unsigned integer value.
657
+ * This function does not clone the supplied node's children nodes.
658
+ * Use gui.clone_tree for that purpose.
659
+ *
660
+ * @param node - node to clone
661
+ * @returns the cloned node
662
+ */
663
+ function clone(node: Opaque<"node">): Opaque<"node">;
664
+ /**
665
+ * Make a clone instance of a node and all its children.
666
+ * Use gui.clone to clone a node excluding its children.
667
+ *
668
+ * @param node - root node to clone
669
+ * @returns a table mapping node ids to the corresponding cloned nodes
670
+ */
671
+ function clone_tree(node: Opaque<"node">): LuaTable<Hash, Opaque<"node">>;
672
+ /**
673
+ * Deletes the specified node. Any child nodes of the specified node will be
674
+ * recursively deleted.
675
+ *
676
+ * @param node - node to delete
677
+ * @example
678
+ * ```ts
679
+ * // Delete a particular node and any child nodes it might have:
680
+ * const node = gui.get_node("my_node");
681
+ * gui.delete_node(node);
682
+ * ```
683
+ */
684
+ function delete_node(node: Opaque<"node">): void;
685
+ /**
686
+ * Delete a dynamically created texture.
687
+ *
688
+ * @param texture - texture id
689
+ * @example
690
+ * ```ts
691
+ * export default defineGuiScript({
692
+ * init(self) {
693
+ * // Create a texture.
694
+ * if (gui.new_texture("temp_tx", 10, 10, "rgb", "\0".repeat(10 * 10 * 3))) {
695
+ * // Do something with the texture.
696
+ * // ...
697
+ *
698
+ * // Delete the texture
699
+ * gui.delete_texture("temp_tx");
700
+ * }
701
+ * },
702
+ * });
703
+ * ```
704
+ */
705
+ function delete_texture(texture: string | Hash): void;
706
+ /**
707
+ * This is a callback-function, which is called by the engine when a gui component is finalized (destroyed). It can
708
+ * be used to e.g. take some last action, report the finalization to other game object instances
709
+ * or release user input focus (see `release_input_focus`). There is no use in starting any animations or similar
710
+ * from this function since the gui component is about to be destroyed.
711
+ *
712
+ * @param self - script instance used for storing state
713
+ * @example
714
+ * ```ts
715
+ * export default defineScript({
716
+ * init() {
717
+ * return { some_value: 0 };
718
+ * },
719
+ *
720
+ * final(self) {
721
+ * // report finalization
722
+ * msg.post("my_friend_instance", "im_dead", { my_stats: self.some_value });
723
+ * },
724
+ * });
725
+ * ```
726
+ */
727
+ function final(self: unknown): void;
728
+ /**
729
+ * Instead of using specific getters such as gui.get_position or gui.get_scale,
730
+ * you can use gui.get instead and supply the property as a string or a hash.
731
+ * While this function is similar to go.get, there are a few more restrictions
732
+ * when operating in the gui namespace. Most notably, only these explicitly named properties are supported:
733
+ *
734
+ * - `"position"`
735
+ * - `"rotation"`
736
+ * - `"euler"`
737
+ * - `"scale"`
738
+ * - `"color"`
739
+ * - `"outline"`
740
+ * - `"shadow"`
741
+ * - `"size"`
742
+ * - `"fill_angle"` (pie)
743
+ * - `"inner_radius"` (pie)
744
+ * - `"leading"` (text)
745
+ * - `"tracking"` (text)
746
+ * - `"slice9"` (slice9)
747
+ *
748
+ * The value returned will either be a vmath.vector4 or a single number, i.e getting the "position"
749
+ * property will return a vec4 while getting the "position.x" property will return a single value.
750
+ * You can also use this function to get material constants.
751
+ *
752
+ * @param node - node to get the property for
753
+ * @param property - the property to retrieve
754
+ * @param options - optional options table (only applicable for material constants)
755
+ * - `index` integer index into array property (1 based)
756
+ *
757
+ * **⚠️ `index` is 1-based; passed to Defold unchanged.**
758
+ * @example
759
+ * ```ts
760
+ * // Get properties on existing nodes:
761
+ * const node = gui.get_node("my_box_node");
762
+ * const node_position = gui.get(node, "position");
763
+ * ```
764
+ */
765
+ function get(node: Opaque<"node">, property: string | Hash | gui.PROP, options?: { index?: number; key?: string | Hash; keys?: (Hash | string)[] }): unknown;
766
+ /**
767
+ * Returns the adjust mode of a node.
768
+ * The adjust mode defines how the node will adjust itself to screen
769
+ * resolutions that differs from the one in the project settings.
770
+ *
771
+ * @param node - node from which to get the adjust mode (node)
772
+ * @returns the current adjust mode
773
+ */
774
+ function get_adjust_mode(node: Opaque<"node">): gui.ADJUST;
775
+ /**
776
+ * gets the node alpha
777
+ *
778
+ * @param node - node from which to get alpha
779
+ * @returns alpha
780
+ */
781
+ function get_alpha(node: Opaque<"node">): number;
782
+ /**
783
+ * Returns the blend mode of a node.
784
+ * Blend mode defines how the node will be blended with the background.
785
+ *
786
+ * @param node - node from which to get the blend mode
787
+ * @returns blend mode
788
+ */
789
+ function get_blend_mode(node: Opaque<"node">): gui.BLEND;
790
+ /**
791
+ * If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
792
+ *
793
+ * @param node - node from which to get the clipping inverted state
794
+ * @returns `true` or `false`
795
+ */
796
+ function get_clipping_inverted(node: Opaque<"node">): boolean;
797
+ /**
798
+ * Clipping mode defines how the node will clip it's children nodes
799
+ *
800
+ * @param node - node from which to get the clipping mode
801
+ * @returns clipping mode
802
+ *
803
+ * - `gui.CLIPPING_MODE_NONE`
804
+ * - `gui.CLIPPING_MODE_STENCIL`
805
+ */
806
+ function get_clipping_mode(node: Opaque<"node">): gui.CLIPPING_MODE;
807
+ /**
808
+ * If node is set as visible clipping node, it will be shown as well as clipping. Otherwise, it will only clip but not show visually.
809
+ *
810
+ * @param node - node from which to get the clipping visibility state
811
+ * @returns `true` or `false`
812
+ */
813
+ function get_clipping_visible(node: Opaque<"node">): boolean;
814
+ /**
815
+ * Returns the color of the supplied node. The components
816
+ * of the returned vector4 contains the color channel values:
817
+ *
818
+ * Component
819
+ * Color value
820
+ *
821
+ * x
822
+ * Red value
823
+ *
824
+ * y
825
+ * Green value
826
+ *
827
+ * z
828
+ * Blue value
829
+ *
830
+ * w
831
+ * Alpha value
832
+ *
833
+ * @param node - node to get the color from
834
+ * @returns node color
835
+ */
836
+ function get_color(node: Opaque<"node">): Vector4;
837
+ /**
838
+ * Returns the rotation of the supplied node.
839
+ * The rotation is expressed in degree Euler angles.
840
+ *
841
+ * @param node - node to get the rotation from
842
+ * @returns node rotation
843
+ */
844
+ function get_euler(node: Opaque<"node">): Vector3;
845
+ /**
846
+ * Returns the sector angle of a pie node.
847
+ *
848
+ * @param node - node from which to get the fill angle
849
+ * @returns sector angle
850
+ */
851
+ function get_fill_angle(node: Opaque<"node">): number;
852
+ /**
853
+ * Get node flipbook animation.
854
+ *
855
+ * @param node - node to get flipbook animation from
856
+ * @returns animation id
857
+ */
858
+ function get_flipbook(node: Opaque<"node">): Hash;
859
+ /**
860
+ * This is only useful nodes with flipbook animations. Gets the normalized cursor of the flipbook animation on a node.
861
+ *
862
+ * @param node - node to get the cursor for (node)
863
+ * @returns cursor value
864
+ */
865
+ function get_flipbook_cursor(node: Opaque<"node">): number;
866
+ /**
867
+ * This is only useful nodes with flipbook animations. Gets the playback rate of the flipbook animation on a node.
868
+ *
869
+ * @param node - node to set the cursor for
870
+ * @returns playback rate
871
+ */
872
+ function get_flipbook_playback_rate(node: Opaque<"node">): number;
873
+ /**
874
+ * This is only useful for text nodes. The font must be mapped to the gui scene in the gui editor.
875
+ *
876
+ * @param node - node from which to get the font
877
+ * @returns font id
878
+ */
879
+ function get_font(node: Opaque<"node">): Hash;
880
+ /**
881
+ * This is only useful for text nodes. The font must be mapped to the gui scene in the gui editor.
882
+ *
883
+ * @param font_name - font of which to get the path hash
884
+ * @returns path hash to resource
885
+ * @example
886
+ * ```ts
887
+ * // Get the text metrics for a text
888
+ * export default defineGuiScript({
889
+ * init(self) {
890
+ * const node = gui.get_node("name");
891
+ * const font_name = gui.get_font(node);
892
+ * const font = gui.get_font_resource(font_name);
893
+ * const metrics = resource.get_text_metrics(font, "The quick brown fox\n jumps over the lazy dog");
894
+ * },
895
+ * });
896
+ * ```
897
+ */
898
+ function get_font_resource(font_name: Hash | string): Hash;
899
+ /**
900
+ * Returns the scene height.
901
+ *
902
+ * @returns scene height
903
+ */
904
+ function get_height(): number;
905
+ /**
906
+ * Retrieves the id of the specified node.
907
+ *
908
+ * @param node - the node to retrieve the id from
909
+ * @returns the id of the node
910
+ * @example
911
+ * ```ts
912
+ * // Gets the id of a node:
913
+ * const node = gui.get_node("my_node");
914
+ *
915
+ * const id = gui.get_id(node);
916
+ * print(id); // => hash: [my_node]
917
+ * ```
918
+ */
919
+ function get_id(node: Opaque<"node">): Hash;
920
+ /**
921
+ * Retrieve the index of the specified node among its siblings.
922
+ * The index defines the order in which a node appear in a GUI scene.
923
+ * Higher index means the node is drawn on top of lower indexed nodes.
924
+ *
925
+ * @param node - the node to retrieve the id from
926
+ * @returns the index of the node. **0️⃣ 0-based; passed to Defold unchanged.**
927
+ * @example
928
+ * ```ts
929
+ * // Compare the index order of two sibling nodes:
930
+ * const node1 = gui.get_node("my_node_1");
931
+ * const node2 = gui.get_node("my_node_2");
932
+ *
933
+ * if (gui.get_index(node1) < gui.get_index(node2)) {
934
+ * // node1 is drawn below node2
935
+ * } else {
936
+ * // node2 is drawn below node1
937
+ * }
938
+ * ```
939
+ */
940
+ function get_index(node: Opaque<"node">): number;
941
+ /**
942
+ * gets the node inherit alpha state
943
+ *
944
+ * @param node - node from which to get the inherit alpha state
945
+ * @returns `true` or `false`
946
+ */
947
+ function get_inherit_alpha(node: Opaque<"node">): boolean;
948
+ /**
949
+ * Returns the inner radius of a pie node.
950
+ * The radius is defined along the x-axis.
951
+ *
952
+ * @param node - node from where to get the inner radius
953
+ * @returns inner radius
954
+ */
955
+ function get_inner_radius(node: Opaque<"node">): number;
956
+ /**
957
+ * The layer must be mapped to the gui scene in the gui editor.
958
+ *
959
+ * @param node - node from which to get the layer
960
+ * @returns layer id
961
+ */
962
+ function get_layer(node: Opaque<"node">): Hash;
963
+ /**
964
+ * gets the scene current layout
965
+ *
966
+ * @returns layout id
967
+ */
968
+ function get_layout(): Hash;
969
+ /**
970
+ * Returns the sprites and links found in the text node's current layout.
971
+ * Each object's `x` and `y` identify its lower-left corner relative to the
972
+ * text node's upper-left layout origin.
973
+ *
974
+ * @param node - text node to inspect
975
+ * @returns layout objects in source order. **0️⃣ `text_offset` is 0-based; passed to Defold unchanged.**
976
+ */
977
+ function get_layout_objects(node: Opaque<"node">): gui.layout_object[];
978
+ /**
979
+ * Returns a table mapping each layout id hash to a vector3(width, height, 0). For the default layout,
980
+ * the current scene resolution is returned. If a layout name is not present in the Display Profiles (or when
981
+ * no display profiles are assigned), the width/height pair is 0.
982
+ *
983
+ * @returns layout_id_hash -> vmath.vector3(width, height, 0)
984
+ */
985
+ function get_layouts(): LuaTable<Hash, Vector3>;
986
+ /**
987
+ * Returns the leading value for a text node.
988
+ *
989
+ * @param node - node from where to get the leading
990
+ * @returns leading scaling value (default=1)
991
+ */
992
+ function get_leading(node: Opaque<"node">): number;
993
+ /**
994
+ * Returns whether a text node is in line-break mode or not.
995
+ * This is only useful for text nodes.
996
+ *
997
+ * @param node - node from which to get the line-break for
998
+ * @returns `true` or `false`
999
+ */
1000
+ function get_line_break(node: Opaque<"node">): boolean;
1001
+ /**
1002
+ * Returns the material of a node.
1003
+ * The material must be mapped to the gui scene in the gui editor.
1004
+ *
1005
+ * @param node - node to get the material for
1006
+ * @returns material id
1007
+ * @example
1008
+ * ```ts
1009
+ * // Getting the material for a node, and assign it to another node:
1010
+ * const node1 = gui.get_node("my_node");
1011
+ * const node2 = gui.get_node("other_node");
1012
+ * const node1_material = gui.get_material(node1);
1013
+ * gui.set_material(node2, node1_material);
1014
+ * ```
1015
+ */
1016
+ function get_material(node: Opaque<"node">): Hash;
1017
+ /**
1018
+ * Retrieves the node with the specified id.
1019
+ *
1020
+ * @param id - id of the node to retrieve
1021
+ * @returns a new node instance
1022
+ * @example
1023
+ * ```ts
1024
+ * // Gets a node by id and change its color:
1025
+ * const node = gui.get_node("my_node");
1026
+ * const red = vmath.vector4(1.0, 0.0, 0.0, 1.0);
1027
+ * gui.set_color(node, red);
1028
+ * ```
1029
+ */
1030
+ function get_node(id: string | Hash): Opaque<"node">;
1031
+ /**
1032
+ * Returns the outer bounds mode for a pie node.
1033
+ *
1034
+ * @param node - node from where to get the outer bounds mode
1035
+ * @returns the outer bounds mode of the pie node
1036
+ */
1037
+ function get_outer_bounds(node: Opaque<"node">): gui.PIEBOUNDS;
1038
+ /**
1039
+ * Returns the outline color of the supplied node.
1040
+ * See gui.get_color for info how vectors encode color values.
1041
+ *
1042
+ * @param node - node to get the outline color from
1043
+ * @returns outline color
1044
+ */
1045
+ function get_outline(node: Opaque<"node">): Vector4;
1046
+ /**
1047
+ * Returns the parent node of the specified node.
1048
+ * If the supplied node does not have a parent, `nil` is returned.
1049
+ *
1050
+ * @param node - the node from which to retrieve its parent
1051
+ * @returns parent instance or `nil`
1052
+ */
1053
+ function get_parent(node: Opaque<"node">): Opaque<"node"> | undefined;
1054
+ /**
1055
+ * Get the paricle fx for a gui node
1056
+ *
1057
+ * @param node - node to get particle fx for
1058
+ * @returns particle fx id
1059
+ */
1060
+ function get_particlefx(node: Opaque<"node">): Hash;
1061
+ /**
1062
+ * Returns the number of generated vertices around the perimeter
1063
+ * of a pie node.
1064
+ *
1065
+ * @param node - pie node
1066
+ * @returns vertex count
1067
+ */
1068
+ function get_perimeter_vertices(node: Opaque<"node">): number;
1069
+ /**
1070
+ * The pivot specifies how the node is drawn and rotated from its position.
1071
+ *
1072
+ * @param node - node to get pivot from
1073
+ * @returns pivot constant
1074
+ *
1075
+ * - `gui.PIVOT_CENTER`
1076
+ * - `gui.PIVOT_N`
1077
+ * - `gui.PIVOT_NE`
1078
+ * - `gui.PIVOT_E`
1079
+ * - `gui.PIVOT_SE`
1080
+ * - `gui.PIVOT_S`
1081
+ * - `gui.PIVOT_SW`
1082
+ * - `gui.PIVOT_W`
1083
+ * - `gui.PIVOT_NW`
1084
+ */
1085
+ function get_pivot(node: Opaque<"node">): gui.PIVOT;
1086
+ /**
1087
+ * Returns the position of the supplied node.
1088
+ *
1089
+ * @param node - node to get the position from
1090
+ * @returns node position
1091
+ */
1092
+ function get_position(node: Opaque<"node">): Vector3;
1093
+ /**
1094
+ * Returns the rotation of the supplied node.
1095
+ * The rotation is expressed as a quaternion
1096
+ *
1097
+ * @param node - node to get the rotation from
1098
+ * @returns node rotation
1099
+ */
1100
+ function get_rotation(node: Opaque<"node">): Quaternion;
1101
+ /**
1102
+ * Returns the scale of the supplied node.
1103
+ *
1104
+ * @param node - node to get the scale from
1105
+ * @returns node scale
1106
+ */
1107
+ function get_scale(node: Opaque<"node">): Vector3;
1108
+ /**
1109
+ * Returns the screen position of the supplied node. This function returns the
1110
+ * calculated transformed position of the node, taking into account any parent node
1111
+ * transforms.
1112
+ *
1113
+ * @param node - node to get the screen position from
1114
+ * @returns node screen position
1115
+ */
1116
+ function get_screen_position(node: Opaque<"node">): Vector3;
1117
+ /**
1118
+ * Returns the shadow color of the supplied node.
1119
+ * See gui.get_color for info how vectors encode color values.
1120
+ *
1121
+ * @param node - node to get the shadow color from
1122
+ * @returns node shadow color
1123
+ */
1124
+ function get_shadow(node: Opaque<"node">): Vector4;
1125
+ /**
1126
+ * Returns the size of the supplied node.
1127
+ *
1128
+ * @param node - node to get the size from
1129
+ * @returns node size
1130
+ */
1131
+ function get_size(node: Opaque<"node">): Vector3;
1132
+ /**
1133
+ * Returns the size of a node.
1134
+ * The size mode defines how the node will adjust itself in size. Automatic
1135
+ * size mode alters the node size based on the node's content. Automatic size
1136
+ * mode works for Box nodes and Pie nodes which will both adjust their size
1137
+ * to match the assigned image. Particle fx and Text nodes will ignore
1138
+ * any size mode setting.
1139
+ *
1140
+ * @param node - node from which to get the size mode (node)
1141
+ * @returns the current size mode
1142
+ */
1143
+ function get_size_mode(node: Opaque<"node">): gui.SIZE_MODE;
1144
+ /**
1145
+ * Returns the slice9 configuration values for the node.
1146
+ *
1147
+ * @param node - node to manipulate
1148
+ * @returns configuration values
1149
+ */
1150
+ function get_slice9(node: Opaque<"node">): Vector4;
1151
+ /**
1152
+ * Returns the text value of a text node. This is only useful for text nodes.
1153
+ *
1154
+ * @param node - node from which to get the text
1155
+ * @returns text value
1156
+ */
1157
+ function get_text(node: Opaque<"node">): string;
1158
+ /**
1159
+ * Returns the texture of a node.
1160
+ * This is currently only useful for box or pie nodes.
1161
+ * The texture must be mapped to the gui scene in the gui editor.
1162
+ *
1163
+ * @param node - node to get texture from
1164
+ * @returns texture id
1165
+ */
1166
+ function get_texture(node: Opaque<"node">): Hash;
1167
+ /**
1168
+ * Returns the tracking value of a text node.
1169
+ *
1170
+ * @param node - node from where to get the tracking
1171
+ * @returns tracking scaling number (default=0)
1172
+ */
1173
+ function get_tracking(node: Opaque<"node">): number;
1174
+ /**
1175
+ * Get a node and all its children as a Lua table.
1176
+ *
1177
+ * @param node - root node to get node tree from
1178
+ * @returns a table mapping node ids to the corresponding nodes
1179
+ */
1180
+ function get_tree(node: Opaque<"node">): LuaTable<Hash, Opaque<"node">>;
1181
+ /**
1182
+ * gets the node type
1183
+ *
1184
+ * @param node - node from which to get the type
1185
+ */
1186
+ function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.TYPE, number | undefined]>;
1187
+ /**
1188
+ * Returns `true` if a node is visible and `false` if it's not.
1189
+ * Invisible nodes are not rendered.
1190
+ *
1191
+ * @param node - node to query
1192
+ * @returns whether the node is visible or not
1193
+ */
1194
+ function get_visible(node: Opaque<"node">): boolean;
1195
+ /**
1196
+ * Returns the scene width.
1197
+ *
1198
+ * @returns scene width
1199
+ */
1200
+ function get_width(): number;
1201
+ /**
1202
+ * The x-anchor specifies how the node is moved when the game is run in a different resolution.
1203
+ *
1204
+ * @param node - node to get x-anchor from
1205
+ * @returns anchor constant
1206
+ *
1207
+ * - `gui.ANCHOR_NONE`
1208
+ * - `gui.ANCHOR_LEFT`
1209
+ * - `gui.ANCHOR_RIGHT`
1210
+ */
1211
+ function get_xanchor(node: Opaque<"node">): gui.ANCHOR;
1212
+ /**
1213
+ * The y-anchor specifies how the node is moved when the game is run in a different resolution.
1214
+ *
1215
+ * @param node - node to get y-anchor from
1216
+ * @returns anchor constant
1217
+ *
1218
+ * - `gui.ANCHOR_NONE`
1219
+ * - `gui.ANCHOR_TOP`
1220
+ * - `gui.ANCHOR_BOTTOM`
1221
+ */
1222
+ function get_yanchor(node: Opaque<"node">): gui.ANCHOR;
1223
+ /**
1224
+ * Hides the on-display touch keyboard on the device.
1225
+ */
1226
+ function hide_keyboard(): void;
1227
+ /**
1228
+ * This is a callback-function, which is called by the engine when a gui component is initialized. It can be used
1229
+ * to set the initial state of the script and gui scene.
1230
+ *
1231
+ * @param self - script instance used for storing state
1232
+ * @example
1233
+ * ```ts
1234
+ * export default defineScript({
1235
+ * init() {
1236
+ * // set up useful data
1237
+ * return { my_value: 1 };
1238
+ * },
1239
+ * });
1240
+ * ```
1241
+ */
1242
+ function init(self: unknown): void;
1243
+ /**
1244
+ * Returns `true` if a node is enabled and `false` if it's not.
1245
+ * Disabled nodes are not rendered and animations acting on them are not evaluated.
1246
+ *
1247
+ * @param node - node to query
1248
+ * @param recursive - check hierarchy recursively
1249
+ * @returns whether the node is enabled or not
1250
+ */
1251
+ function is_enabled(node: Opaque<"node">, recursive?: boolean): boolean;
1252
+ /**
1253
+ * Alters the ordering of the two supplied nodes by moving the first node
1254
+ * above the second.
1255
+ * If the second argument is `nil` the first node is moved to the top.
1256
+ *
1257
+ * @param node - to move
1258
+ * @param reference - reference node above which the first node should be moved
1259
+ */
1260
+ function move_above(node: Opaque<"node">, reference: Opaque<"node"> | undefined): void;
1261
+ /**
1262
+ * Alters the ordering of the two supplied nodes by moving the first node
1263
+ * below the second.
1264
+ * If the second argument is `nil` the first node is moved to the bottom.
1265
+ *
1266
+ * @param node - to move
1267
+ * @param reference - reference node below which the first node should be moved
1268
+ */
1269
+ function move_below(node: Opaque<"node">, reference: Opaque<"node"> | undefined): void;
1270
+ /**
1271
+ * Dynamically create a new box node.
1272
+ *
1273
+ * @param pos - node position
1274
+ * @param size - node size
1275
+ * @returns new box node
1276
+ */
1277
+ function new_box_node(pos: Vector3 | Vector4, size: Vector3): Opaque<"node">;
1278
+ /**
1279
+ * Dynamically create a particle fx node.
1280
+ *
1281
+ * @param pos - node position
1282
+ * @param particlefx - particle fx resource name
1283
+ * @returns new particle fx node
1284
+ */
1285
+ function new_particlefx_node(pos: Vector3 | Vector4, particlefx: Hash | string): Opaque<"node">;
1286
+ /**
1287
+ * Dynamically create a new pie node.
1288
+ *
1289
+ * @param pos - node position
1290
+ * @param size - node size
1291
+ * @returns new pie node
1292
+ */
1293
+ function new_pie_node(pos: Vector3 | Vector4, size: Vector3): Opaque<"node">;
1294
+ /**
1295
+ * Dynamically create a new text node.
1296
+ *
1297
+ * @param pos - node position
1298
+ * @param text - node text
1299
+ * @returns new text node
1300
+ */
1301
+ function new_text_node(pos: Vector3 | Vector4, text: string): Opaque<"node">;
1302
+ /**
1303
+ * Dynamically create a new texture.
1304
+ *
1305
+ * @param texture_id - texture id
1306
+ * @param width - texture width
1307
+ * @param height - texture height
1308
+ * @param type - texture type
1309
+ *
1310
+ * - `"rgb"` or `image.TYPE_RGB` - RGB
1311
+ * - `"rgba"` or `image.TYPE_RGBA` - RGBA
1312
+ * - `"l"` or `image.TYPE_LUMINANCE` - LUMINANCE
1313
+ * - `"astc"` - ASTC compressed format
1314
+ * @param buffer - texture data
1315
+ * @param flip - flip texture vertically
1316
+ * @example
1317
+ * How to create a texture and apply it to a new box node:
1318
+ * ```ts
1319
+ * export default defineGuiScript({
1320
+ * init(self) {
1321
+ * const w = 200;
1322
+ * const h = 300;
1323
+ *
1324
+ * // A nice orange. String with the RGB values.
1325
+ * const orange = String.fromCharCode(0xff, 0x80, 0x10);
1326
+ *
1327
+ * // Create the texture. Repeat the color string for each pixel.
1328
+ * const [ok, reason] = gui.new_texture("orange_tx", w, h, "rgb", orange.repeat(w * h));
1329
+ * if (ok) {
1330
+ * // Create a box node and apply the texture to it.
1331
+ * const n = gui.new_box_node(vmath.vector3(200, 200, 0), vmath.vector3(w, h, 0));
1332
+ * gui.set_texture(n, "orange_tx");
1333
+ * } else {
1334
+ * // Could not create texture for some reason...
1335
+ * if (reason === gui.RESULT_TEXTURE_ALREADY_EXISTS) {
1336
+ * // ...
1337
+ * } else {
1338
+ * // ...
1339
+ * }
1340
+ * }
1341
+ * },
1342
+ * });
1343
+ * ```
1344
+ * @example
1345
+ * How to create a texture using .astc format
1346
+ * ```ts
1347
+ * const size = 4;
1348
+ * const pos = vmath.vector3(200, 200, 0);
1349
+ * const path = "/assets/images/logo_4x4.astc";
1350
+ * const [data] = sys.load_resource(path);
1351
+ * if (data !== undefined) {
1352
+ * const n = gui.new_box_node(pos, vmath.vector3(size, size, 0));
1353
+ * // size is read from the .astc buffer
1354
+ * // flip is not supported
1355
+ * gui.new_texture(path, 0, 0, "astc", data, false);
1356
+ * gui.set_texture(n, path);
1357
+ * }
1358
+ * ```
1359
+ */
1360
+ function new_texture(texture_id: string | Hash, width: number, height: number, type: string | image.TYPE, buffer: string, flip?: boolean): LuaMultiReturn<[boolean, gui.RESULT | undefined]>;
1361
+ /**
1362
+ * This is a callback-function, which is called by the engine when user input is sent to the instance of the gui component.
1363
+ * It can be used to take action on the input, e.g. modify the gui according to the input.
1364
+ * For an instance to obtain user input, it must first acquire input
1365
+ * focus through the message `acquire_input_focus`.
1366
+ * Any instance that has obtained input will be put on top of an
1367
+ * input stack. Input is sent to all listeners on the stack until the
1368
+ * end of stack is reached, or a listener returns `true`
1369
+ * to signal that it wants input to be consumed.
1370
+ * See the documentation of acquire_input_focus for more
1371
+ * information.
1372
+ *
1373
+ * @param self - script instance used for storing state
1374
+ * @param action_id - id of the received input action, as mapped in the input_binding-file, or `nil` for mouse movement
1375
+ * @param action - input data for the action. **0️⃣ `gamepad` is 0-based; passed to Defold unchanged.**
1376
+ * @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
1377
+ * @example
1378
+ * ```ts
1379
+ * export default defineGuiScript({
1380
+ * init(): { my_value: number | undefined } {
1381
+ * return { my_value: undefined };
1382
+ * },
1383
+ *
1384
+ * on_input(self, action_id, action) {
1385
+ * // check for input
1386
+ * if (action_id === hash("my_action")) {
1387
+ * // take appropriate action
1388
+ * self.my_value = action.value;
1389
+ * }
1390
+ * // consume input
1391
+ * return true;
1392
+ * },
1393
+ * });
1394
+ * ```
1395
+ */
1396
+ function on_input(self: unknown, action_id: Hash | undefined, action: go.on_input.action): boolean | undefined;
1397
+ /**
1398
+ * This is a callback-function, which is called by the engine whenever a message has been sent to the gui component.
1399
+ * It can be used to take action on the message, e.g. update the gui or send a response back to the sender of the message.
1400
+ * The `message` parameter is a table containing the message data. If the message is sent from the engine, the
1401
+ * documentation of the message specifies which data is supplied.
1402
+ * See the update function for examples on how to use this callback-function.
1403
+ *
1404
+ * @param self - script instance used for storing state
1405
+ * @param message_id - id of the received message
1406
+ * @param message - a table containing the message data
1407
+ * @param sender - address of the sender
1408
+ */
1409
+ function on_message(self: unknown, message_id: Hash, message: LuaMap<AnyNotNil, unknown> | Record<string, unknown>, sender: Url): void;
1410
+ /**
1411
+ * This is a callback-function, which is called by the engine when the gui script is reloaded, e.g. from the editor.
1412
+ * It can be used for live development, e.g. to tweak constants or set up the state properly for the script.
1413
+ *
1414
+ * @param self - script instance used for storing state
1415
+ * @example
1416
+ * ```ts
1417
+ * export default defineGuiScript({
1418
+ * init() {
1419
+ * return { my_original_color: gui.get_color(gui.get_node("my_node")) };
1420
+ * },
1421
+ *
1422
+ * on_reload(self) {
1423
+ * // restore some color (or similar)
1424
+ * gui.set_color(gui.get_node("my_node"), self.my_original_color);
1425
+ * },
1426
+ * });
1427
+ * ```
1428
+ */
1429
+ function on_reload(self: unknown): void;
1430
+ /**
1431
+ * Tests whether a coordinate is within the bounding box of a
1432
+ * node.
1433
+ *
1434
+ * @param node - node to be tested for picking
1435
+ * @param x - x-coordinate (see on_input )
1436
+ * @param y - y-coordinate (see on_input )
1437
+ * @returns pick result
1438
+ */
1439
+ function pick_node(node: Opaque<"node">, x: number, y: number): boolean;
1440
+ /**
1441
+ * Play flipbook animation on a box or pie node.
1442
+ * The current node texture must contain the animation.
1443
+ * Use this function to set one-frame still images on the node.
1444
+ *
1445
+ * @param node - node to set animation for
1446
+ * @param animation - animation id
1447
+ * @param complete_function - optional function to call when the animation has completed
1448
+ *
1449
+ * `self`
1450
+ *
1451
+ * script_instance The current script instance.
1452
+ *
1453
+ * `node`
1454
+ *
1455
+ * node The node that is animated.
1456
+ * @param play_properties - optional playback properties
1457
+ * @example
1458
+ * Set the texture of a node to a flipbook animation from an atlas:
1459
+ * ```ts
1460
+ * function anim_callback(self: unknown, node: unknown) {
1461
+ * // Take action after animation has played.
1462
+ * }
1463
+ *
1464
+ * export default defineGuiScript({
1465
+ * init(self) {
1466
+ * // Create a new node and set the texture to a flipbook animation
1467
+ * const node = gui.get_node("button_node");
1468
+ * gui.set_texture(node, "gui_sprites");
1469
+ * gui.play_flipbook(node, "animated_button");
1470
+ * },
1471
+ * });
1472
+ * ```
1473
+ * @example
1474
+ * Set the texture of a node to an image from an atlas:
1475
+ * ```ts
1476
+ * // Create a new node and set the texture to a "button.png" from atlas
1477
+ * const node = gui.get_node("button_node");
1478
+ * gui.set_texture(node, "gui_sprites");
1479
+ * gui.play_flipbook(node, "button");
1480
+ * ```
1481
+ */
1482
+ function play_flipbook(node: Opaque<"node">, animation: string | Hash, complete_function?: (self: unknown, node: Opaque<"node">) => void, play_properties?: gui.play_properties): void;
1483
+ /**
1484
+ * Plays the paricle fx for a gui node
1485
+ *
1486
+ * @param node - node to play particle fx for
1487
+ * @param emitter_state_function - optional callback function that will be called when an emitter attached to this particlefx changes state.
1488
+ * @example
1489
+ * ```ts
1490
+ * // How to play a particle fx when a gui node is created.
1491
+ * // The callback receives the gui node, the hash of the id
1492
+ * // of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
1493
+ * export default defineGuiScript({
1494
+ * init(self) {
1495
+ * gui.play_particlefx(gui.get_node("particlefx"), (self, node, emitter, state) => {
1496
+ * if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
1497
+ * // exhaust is done spawning particles...
1498
+ * }
1499
+ * });
1500
+ * },
1501
+ * });
1502
+ * ```
1503
+ */
1504
+ function play_particlefx(node: Opaque<"node">, emitter_state_function?: (self: unknown, node: Opaque<"node"> | undefined, emitter: Hash, state: particlefx.EMITTER_STATE) => void): void;
1505
+ /**
1506
+ * Resets the input context of keyboard. This will clear marked text.
1507
+ */
1508
+ function reset_keyboard(): void;
1509
+ /**
1510
+ * Resets the node material to the material assigned in the gui scene.
1511
+ *
1512
+ * @param node - node to reset the material for
1513
+ * @example
1514
+ * ```ts
1515
+ * // Resetting the material for a node:
1516
+ * const node = gui.get_node("my_node");
1517
+ * gui.reset_material(node);
1518
+ * ```
1519
+ */
1520
+ function reset_material(node: Opaque<"node">): void;
1521
+ /**
1522
+ * Resets all nodes in the current GUI scene to their initial state.
1523
+ * The reset only applies to static node loaded from the scene.
1524
+ * Nodes that are created dynamically from script are not affected.
1525
+ */
1526
+ function reset_nodes(): void;
1527
+ /**
1528
+ * Converts a screen-space position to the local position value for the supplied node.
1529
+ * The conversion takes the parent transform, anchors, adjust mode, and adjust reference into account.
1530
+ *
1531
+ * @param node - node whose local position space should be used
1532
+ * @param screen_position - screen-space position
1533
+ * @returns local position value for the node
1534
+ * @example
1535
+ * ```ts
1536
+ * // Animate a node to the pressed pointer position:
1537
+ * export default defineGuiScript({
1538
+ * init() {
1539
+ * msg.post(".", "acquire_input_focus");
1540
+ * return { marker: gui.get_node("marker") };
1541
+ * },
1542
+ *
1543
+ * on_input(self, action_id, action) {
1544
+ * if (
1545
+ * action_id === hash("touch") &&
1546
+ * action.pressed &&
1547
+ * action.screen_x !== undefined &&
1548
+ * action.screen_y !== undefined
1549
+ * ) {
1550
+ * const screen_position = vmath.vector3(action.screen_x, action.screen_y, 0);
1551
+ * const target_position = gui.screen_to_local(self.marker, screen_position);
1552
+ * gui.animate(self.marker, gui.PROP_POSITION, target_position, gui.EASING_OUTQUAD, 0.2);
1553
+ * return true;
1554
+ * }
1555
+ * },
1556
+ * });
1557
+ * ```
1558
+ */
1559
+ function screen_to_local(node: Opaque<"node">, screen_position: Vector3 | Vector4): Vector3;
1560
+ /**
1561
+ * Instead of using specific setteres such as gui.set_position or gui.set_scale,
1562
+ * you can use gui.set instead and supply the property as a string or a hash.
1563
+ * While this function is similar to go.get and go.set, there are a few more restrictions
1564
+ * when operating in the gui namespace. Most notably, only these named properties identifiers are supported:
1565
+ *
1566
+ * - `"position"`
1567
+ * - `"rotation"`
1568
+ * - `"euler"`
1569
+ * - `"scale"`
1570
+ * - `"color"`
1571
+ * - `"outline"`
1572
+ * - `"shadow"`
1573
+ * - `"size"`
1574
+ * - `"fill_angle"` (pie)
1575
+ * - `"inner_radius"` (pie)
1576
+ * - `"leading"` (text)
1577
+ * - `"tracking"` (text)
1578
+ * - `"slice9"` (slice9)
1579
+ *
1580
+ * The value to set must either be a vmath.vector4, vmath.vector3, vmath.quat or a single number and depends on the property name you want to set.
1581
+ * I.e when setting the "position" property, you need to use a vmath.vector4 and when setting a single component of the property,
1582
+ * such as "position.x", you need to use a single value.
1583
+ * Note: When setting the rotation using the "rotation" property, you need to pass in a vmath.quat. This behaviour is different than from the gui.set_rotation function,
1584
+ * the intention is to move new functionality closer to go namespace so that migrating between gui and go is easier. To set the rotation using degrees instead,
1585
+ * use the "euler" property instead. The rotation and euler properties are linked, changing one of them will change the backing data of the other.
1586
+ * Similar to go.set, you can also use gui.set for setting material constant values on a node. E.g if a material has specified a constant called `tint` in
1587
+ * the .material file, you can use gui.set to set the value of that constant by calling `gui.set(node, "tint", vmath.vec4(1,0,0,1))`, or `gui.set(node, "matrix", vmath.matrix4())`
1588
+ * if the constant is a matrix. Arrays are also supported by gui.set - to set an array constant, you need to pass in an options table with the 'index' key set.
1589
+ * If the material has a constant array called 'tint_array' specified in the material, you can use `gui.set(node, "tint_array", vmath.vec4(1,0,0,1), { index = 4})` to set the fourth array element to a different value.
1590
+ *
1591
+ * @param node - node to set the property for, or msg.url() to the gui itself
1592
+ * @param property - the property to set
1593
+ * @param value - the property to set. `nil` is only supported for removing runtime texture mappings with `gui.set(msg.url(), "textures", nil, {key = ...})`.
1594
+ * @param options - optional material-constant options. **⚠️ `index` is 1-based; passed to Defold unchanged.**
1595
+ * @example
1596
+ * Updates the position property on an existing node:
1597
+ * ```ts
1598
+ * const node = gui.get_node("my_box_node");
1599
+ * const node_position = gui.get(node, "position") as Vector3;
1600
+ * gui.set(node, "position.x", node_position.x + 128);
1601
+ * ```
1602
+ * @example
1603
+ * Updates the rotation property on an existing node:
1604
+ * ```ts
1605
+ * const node = gui.get_node("my_box_node");
1606
+ * gui.set(node, "rotation", vmath.quat_rotation_z(math.rad(45)));
1607
+ * // this is equivalent to:
1608
+ * gui.set(node, "euler.z", 45);
1609
+ * // or using the entire vector:
1610
+ * gui.set(node, "euler", vmath.vector3(0, 0, 45));
1611
+ * // or using the set_rotation
1612
+ * gui.set_rotation(node, vmath.vector3(0, 0, 45));
1613
+ * ```
1614
+ * @example
1615
+ * Sets various material constants for a node:
1616
+ * ```ts
1617
+ * const node = gui.get_node("my_box_node");
1618
+ * gui.set(node, "tint", vmath.vector4(1, 0, 0, 1));
1619
+ * // matrix4 is also supported
1620
+ * gui.set(node, "light_matrix", vmath.matrix4());
1621
+ * // update a constant in an array at position 4. the array is specified in the shader as:
1622
+ * // uniform vec4 tint_array[4]; // lua is 1 based, shader is 0 based
1623
+ * gui.set(node, "tint_array", vmath.vector4(1, 0, 0, 1), { index: 4 });
1624
+ * // update a matrix constant in an array at position 4. the array is specified in the shader as:
1625
+ * // uniform mat4 light_matrix_array[4];
1626
+ * gui.set(node, "light_matrix_array", vmath.matrix4(), { index: 4 });
1627
+ * // update a sub-element in a constant
1628
+ * gui.set(node, "tint.x", 1);
1629
+ * // update a sub-element in an array constant at position 4
1630
+ * gui.set(node, "tint_array.x", 1, { index: 4 });
1631
+ * ```
1632
+ * @example
1633
+ * Set a named property
1634
+ * ```ts
1635
+ * export default defineGuiScript({
1636
+ * on_message(self, message_id, message) {
1637
+ * if (message_id === hash("set_font") && types.is_hash(message.font)) {
1638
+ * gui.set(msg.url(), "fonts", message.font, { key: "my_font_name" });
1639
+ * gui.set_font(gui.get_node("text"), "my_font_name");
1640
+ * } else if (message_id === hash("set_texture") && types.is_hash(message.texture)) {
1641
+ * gui.set(msg.url(), "textures", message.texture, { key: "my_texture" });
1642
+ * gui.set_texture(gui.get_node("box"), "my_texture");
1643
+ * gui.play_flipbook(gui.get_node("box"), "logo_256");
1644
+ * }
1645
+ * },
1646
+ * });
1647
+ * ```
1648
+ * @example
1649
+ * Remove a named runtime texture resource mapping:
1650
+ * ```ts
1651
+ * const atlas_params = {
1652
+ * texture: "/runtime.texturec",
1653
+ * animations: [{ id: "runtime", width: 1, height: 1, frames: [1] }],
1654
+ * geometries: [{ vertices: [0, 0, 0, 1, 1, 1, 1, 0], uvs: [0, 0, 0, 1, 1, 1, 1, 0], indices: [0, 1, 2, 0, 2, 3] }],
1655
+ * } satisfies Parameters<typeof resource.create_atlas>[1];
1656
+ * const atlas_id = resource.create_atlas("/runtime.texturesetc", atlas_params);
1657
+ * gui.set(msg.url(), "textures", atlas_id, { key: "runtime_texture" });
1658
+ * gui.set_texture(gui.get_node("box"), "runtime_texture");
1659
+ *
1660
+ * // Later, remove the GUI mapping before releasing the atlas resource.
1661
+ * gui.set(msg.url(), "textures", undefined, { key: "runtime_texture" });
1662
+ * resource.release(atlas_id);
1663
+ * ```
1664
+ */
1665
+ function set(node: Opaque<"node"> | Url, property: string | Hash | gui.PROP, value: number | Vector4 | Vector3 | Quaternion | Matrix4 | Hash | undefined, options?: { index?: number; key?: string | Hash; keys?: (Hash | string)[] }): void;
1666
+ /**
1667
+ * Sets the adjust mode on a node.
1668
+ * The adjust mode defines how the node will adjust itself to screen
1669
+ * resolutions that differs from the one in the project settings.
1670
+ *
1671
+ * @param node - node to set adjust mode for
1672
+ * @param adjust_mode - adjust mode to set
1673
+ */
1674
+ function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.ADJUST): void;
1675
+ /**
1676
+ * sets the node alpha
1677
+ *
1678
+ * @param node - node for which to set alpha
1679
+ * @param alpha - 0..1 alpha color
1680
+ */
1681
+ function set_alpha(node: Opaque<"node">, alpha: number): void;
1682
+ /**
1683
+ * Set the blend mode of a node.
1684
+ * Blend mode defines how the node will be blended with the background.
1685
+ *
1686
+ * @param node - node to set blend mode for
1687
+ * @param blend_mode - blend mode to set
1688
+ */
1689
+ function set_blend_mode(node: Opaque<"node">, blend_mode: gui.BLEND): void;
1690
+ /**
1691
+ * If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
1692
+ *
1693
+ * @param node - node to set clipping inverted state for
1694
+ * @param inverted - `true` or `false`
1695
+ */
1696
+ function set_clipping_inverted(node: Opaque<"node">, inverted: boolean): void;
1697
+ /**
1698
+ * Clipping mode defines how the node will clip it's children nodes
1699
+ *
1700
+ * @param node - node to set clipping mode for
1701
+ * @param clipping_mode - clipping mode to set
1702
+ *
1703
+ * - `gui.CLIPPING_MODE_NONE`
1704
+ * - `gui.CLIPPING_MODE_STENCIL`
1705
+ */
1706
+ function set_clipping_mode(node: Opaque<"node">, clipping_mode: gui.CLIPPING_MODE): void;
1707
+ /**
1708
+ * If node is set as an visible clipping node, it will be shown as well as clipping. Otherwise, it will only clip but not show visually.
1709
+ *
1710
+ * @param node - node to set clipping visibility for
1711
+ * @param visible - `true` or `false`
1712
+ */
1713
+ function set_clipping_visible(node: Opaque<"node">, visible: boolean): void;
1714
+ /**
1715
+ * Sets the color of the supplied node. The components
1716
+ * of the supplied vector3 or vector4 should contain the color channel values:
1717
+ *
1718
+ * Component
1719
+ * Color value
1720
+ *
1721
+ * x
1722
+ * Red value
1723
+ *
1724
+ * y
1725
+ * Green value
1726
+ *
1727
+ * z
1728
+ * Blue value
1729
+ *
1730
+ * w vector4
1731
+ * Alpha value
1732
+ *
1733
+ * @param node - node to set the color for
1734
+ * @param color - new color
1735
+ */
1736
+ function set_color(node: Opaque<"node">, color: Vector3 | Vector4): void;
1737
+ /**
1738
+ * Sets a node to the disabled or enabled state.
1739
+ * Disabled nodes are not rendered and animations acting on them are not evaluated.
1740
+ *
1741
+ * @param node - node to be enabled/disabled
1742
+ * @param enabled - whether the node should be enabled or not
1743
+ */
1744
+ function set_enabled(node: Opaque<"node">, enabled: boolean): void;
1745
+ /**
1746
+ * Sets the rotation of the supplied node.
1747
+ * The rotation is expressed in degree Euler angles.
1748
+ *
1749
+ * @param node - node to set the rotation for
1750
+ * @param rotation - new rotation
1751
+ */
1752
+ function set_euler(node: Opaque<"node">, rotation: Vector3 | Vector4): void;
1753
+ /**
1754
+ * Set the sector angle of a pie node.
1755
+ *
1756
+ * @param node - node to set the fill angle for
1757
+ * @param angle - sector angle
1758
+ */
1759
+ function set_fill_angle(node: Opaque<"node">, angle: number): void;
1760
+ /**
1761
+ * This is only useful nodes with flipbook animations. The cursor is normalized.
1762
+ *
1763
+ * @param node - node to set the cursor for
1764
+ * @param cursor - cursor value
1765
+ */
1766
+ function set_flipbook_cursor(node: Opaque<"node">, cursor: number): void;
1767
+ /**
1768
+ * This is only useful nodes with flipbook animations. Sets the playback rate of the flipbook animation on a node. Must be positive.
1769
+ *
1770
+ * @param node - node to set the cursor for
1771
+ * @param playback_rate - playback rate
1772
+ */
1773
+ function set_flipbook_playback_rate(node: Opaque<"node">, playback_rate: number): void;
1774
+ /**
1775
+ * This is only useful for text nodes.
1776
+ * The font must be mapped to the gui scene in the gui editor.
1777
+ *
1778
+ * @param node - node for which to set the font
1779
+ * @param font - font id
1780
+ */
1781
+ function set_font(node: Opaque<"node">, font: string | Hash): void;
1782
+ /**
1783
+ * Set the id of the specicied node to a new value.
1784
+ * Nodes created with the gui.new_*_node() functions get
1785
+ * an empty id. This function allows you to give dynamically
1786
+ * created nodes an id.
1787
+ * No checking is done on the uniqueness of supplied ids.
1788
+ * It is up to you to make sure you use unique ids.
1789
+ *
1790
+ * @param node - node to set the id for
1791
+ * @param id - id to set
1792
+ * @example
1793
+ * ```ts
1794
+ * // Create a new node and set its id:
1795
+ * const pos = vmath.vector3(100, 100, 0);
1796
+ * const size = vmath.vector3(100, 100, 0);
1797
+ * const node = gui.new_box_node(pos, size);
1798
+ * gui.set_id(node, "my_new_node");
1799
+ * ```
1800
+ */
1801
+ function set_id(node: Opaque<"node">, id: string | Hash): void;
1802
+ /**
1803
+ * sets the node inherit alpha state
1804
+ *
1805
+ * @param node - node from which to set the inherit alpha state
1806
+ * @param inherit_alpha - `true` or `false`
1807
+ */
1808
+ function set_inherit_alpha(node: Opaque<"node">, inherit_alpha: boolean): void;
1809
+ /**
1810
+ * Sets the inner radius of a pie node.
1811
+ * The radius is defined along the x-axis.
1812
+ *
1813
+ * @param node - node to set the inner radius for
1814
+ * @param radius - inner radius
1815
+ */
1816
+ function set_inner_radius(node: Opaque<"node">, radius: number): void;
1817
+ /**
1818
+ * The layer must be mapped to the gui scene in the gui editor.
1819
+ *
1820
+ * @param node - node for which to set the layer
1821
+ * @param layer - layer id
1822
+ */
1823
+ function set_layer(node: Opaque<"node">, layer: string | Hash): void;
1824
+ /**
1825
+ * Applies a named layout on the GUI scene. This re-applies per-layout node descriptors
1826
+ * and, if a matching Display Profile exists, updates the scene resolution. Emits
1827
+ * the "layout_changed" message to the scene script when the layout actually changes.
1828
+ *
1829
+ * @param layout - the layout id to apply
1830
+ * @returns true if the layout exists in the scene and was applied, false otherwise
1831
+ */
1832
+ function set_layout(layout: string | Hash): boolean;
1833
+ /**
1834
+ * Sets the leading value for a text node. This value is used to
1835
+ * scale the line spacing of text.
1836
+ *
1837
+ * @param node - node for which to set the leading
1838
+ * @param leading - a scaling value for the line spacing (default=1)
1839
+ */
1840
+ function set_leading(node: Opaque<"node">, leading: number): void;
1841
+ /**
1842
+ * Sets the line-break mode on a text node.
1843
+ * This is only useful for text nodes.
1844
+ *
1845
+ * @param node - node to set line-break for
1846
+ * @param line_break - `true` or `false`
1847
+ */
1848
+ function set_line_break(node: Opaque<"node">, line_break: boolean): void;
1849
+ /**
1850
+ * Set the material on a node. The material must be mapped to the gui scene in the gui editor,
1851
+ * and assigning a material is supported for all node types. To set the default material that
1852
+ * is assigned to the gui scene node, use `gui.reset_material(node_id)` instead.
1853
+ *
1854
+ * @param node - node to set material for
1855
+ * @param material - material id
1856
+ * @example
1857
+ * ```ts
1858
+ * // Assign an existing material to a node:
1859
+ * const node = gui.get_node("my_node");
1860
+ * gui.set_material(node, "my_material");
1861
+ * ```
1862
+ */
1863
+ function set_material(node: Opaque<"node">, material: string | Hash): void;
1864
+ /**
1865
+ * Sets the outer bounds mode for a pie node.
1866
+ *
1867
+ * @param node - node for which to set the outer bounds mode
1868
+ * @param bounds_mode - the outer bounds mode of the pie node
1869
+ */
1870
+ function set_outer_bounds(node: Opaque<"node">, bounds_mode: gui.PIEBOUNDS): void;
1871
+ /**
1872
+ * Sets the outline color of the supplied node.
1873
+ * See gui.set_color for info how vectors encode color values.
1874
+ *
1875
+ * @param node - node to set the outline color for
1876
+ * @param color - new outline color
1877
+ */
1878
+ function set_outline(node: Opaque<"node">, color: Vector3 | Vector4): void;
1879
+ /**
1880
+ * Sets the parent node of the specified node.
1881
+ *
1882
+ * @param node - node for which to set its parent
1883
+ * @param parent - parent node to set, pass `nil` to remove parent
1884
+ * @param keep_scene_transform - optional flag to make the scene position being perserved
1885
+ */
1886
+ function set_parent(node: Opaque<"node">, parent: Opaque<"node"> | undefined, keep_scene_transform?: boolean): void;
1887
+ /**
1888
+ * Set the paricle fx for a gui node
1889
+ *
1890
+ * @param node - node to set particle fx for
1891
+ * @param particlefx - particle fx id
1892
+ */
1893
+ function set_particlefx(node: Opaque<"node">, particlefx: Hash | string): void;
1894
+ /**
1895
+ * Sets the number of generated vertices around the perimeter of a pie node.
1896
+ *
1897
+ * @param node - pie node
1898
+ * @param vertices - vertex count
1899
+ */
1900
+ function set_perimeter_vertices(node: Opaque<"node">, vertices: number): void;
1901
+ /**
1902
+ * The pivot specifies how the node is drawn and rotated from its position.
1903
+ *
1904
+ * @param node - node to set pivot for
1905
+ * @param pivot - pivot constant
1906
+ *
1907
+ * - `gui.PIVOT_CENTER`
1908
+ * - `gui.PIVOT_N`
1909
+ * - `gui.PIVOT_NE`
1910
+ * - `gui.PIVOT_E`
1911
+ * - `gui.PIVOT_SE`
1912
+ * - `gui.PIVOT_S`
1913
+ * - `gui.PIVOT_SW`
1914
+ * - `gui.PIVOT_W`
1915
+ * - `gui.PIVOT_NW`
1916
+ */
1917
+ function set_pivot(node: Opaque<"node">, pivot: gui.PIVOT): void;
1918
+ /**
1919
+ * Sets the position of the supplied node.
1920
+ *
1921
+ * @param node - node to set the position for
1922
+ * @param position - new position
1923
+ */
1924
+ function set_position(node: Opaque<"node">, position: Vector3 | Vector4): void;
1925
+ /**
1926
+ * Set the order number for the current GUI scene.
1927
+ * The number dictates the sorting of the "gui" render predicate,
1928
+ * in other words in which order the scene will be rendered in relation
1929
+ * to other currently rendered GUI scenes.
1930
+ * The number must be in the range 0 to 15.
1931
+ *
1932
+ * @param order - rendering order (0-15)
1933
+ */
1934
+ function set_render_order(order: number): void;
1935
+ /**
1936
+ * Sets the rotation of the supplied node.
1937
+ * The rotation is expressed as a quaternion
1938
+ *
1939
+ * @param node - node to set the rotation for
1940
+ * @param rotation - new rotation
1941
+ */
1942
+ function set_rotation(node: Opaque<"node">, rotation: Quaternion | Vector4 | Vector3): void;
1943
+ /**
1944
+ * Sets how the safe area is applied to this gui scene.
1945
+ *
1946
+ * @param mode - safe area mode
1947
+ */
1948
+ function set_safe_area_mode(mode: gui.SAFE_AREA): void;
1949
+ /**
1950
+ * Sets the scaling of the supplied node.
1951
+ *
1952
+ * @param node - node to set the scale for
1953
+ * @param scale - new scale
1954
+ */
1955
+ function set_scale(node: Opaque<"node">, scale: Vector3 | Vector4): void;
1956
+ /**
1957
+ * Set the screen position to the supplied node
1958
+ *
1959
+ * @param node - node to set the screen position to
1960
+ * @param screen_position - screen position
1961
+ */
1962
+ function set_screen_position(node: Opaque<"node">, screen_position: Vector3 | Vector4): void;
1963
+ /**
1964
+ * Sets the shadow color of the supplied node.
1965
+ * See gui.set_color for info how vectors encode color values.
1966
+ *
1967
+ * @param node - node to set the shadow color for
1968
+ * @param color - new shadow color
1969
+ */
1970
+ function set_shadow(node: Opaque<"node">, color: Vector3 | Vector4): void;
1971
+ /**
1972
+ * Sets the size of the supplied node.
1973
+ * You can only set size on nodes with size mode set to SIZE_MODE_MANUAL
1974
+ *
1975
+ * @param node - node to set the size for
1976
+ * @param size - new size
1977
+ */
1978
+ function set_size(node: Opaque<"node">, size: Vector3 | Vector4): void;
1979
+ /**
1980
+ * Sets the size mode of a node.
1981
+ * The size mode defines how the node will adjust itself in size. Automatic
1982
+ * size mode alters the node size based on the node's content. Automatic size
1983
+ * mode works for Box nodes and Pie nodes which will both adjust their size
1984
+ * to match the assigned image. Particle fx and Text nodes will ignore
1985
+ * any size mode setting.
1986
+ *
1987
+ * @param node - node to set size mode for
1988
+ * @param size_mode - size mode to set
1989
+ */
1990
+ function set_size_mode(node: Opaque<"node">, size_mode: gui.SIZE_MODE): void;
1991
+ /**
1992
+ * Set the slice9 configuration values for the node.
1993
+ *
1994
+ * @param node - node to manipulate
1995
+ * @param values - new values
1996
+ */
1997
+ function set_slice9(node: Opaque<"node">, values: Vector4): void;
1998
+ /**
1999
+ * Set the text value of a text node. This is only useful for text nodes.
2000
+ *
2001
+ * @param node - node to set text for
2002
+ * @param text - text to set
2003
+ */
2004
+ function set_text(node: Opaque<"node">, text: string | number): void;
2005
+ /**
2006
+ * Set the texture on a box or pie node. The texture must be mapped to
2007
+ * the gui scene in the gui editor. The function points out which texture
2008
+ * the node should render from. If the texture is an atlas, further
2009
+ * information is needed to select which image/animation in the atlas
2010
+ * to render. In such cases, use `gui.play_flipbook()` in
2011
+ * addition to this function.
2012
+ *
2013
+ * @param node - node to set texture for
2014
+ * @param texture - texture id
2015
+ * @example
2016
+ * To set a texture (or animation) from an atlas:
2017
+ * ```ts
2018
+ * const node = gui.get_node("box_node");
2019
+ * gui.set_texture(node, "my_atlas");
2020
+ * gui.play_flipbook(node, "image");
2021
+ * ```
2022
+ * @example
2023
+ * Set a dynamically created texture to a node. Note that there is only
2024
+ * one texture image in this case so `gui.set_texture()` is
2025
+ * sufficient.
2026
+ * ```ts
2027
+ * const w = 200;
2028
+ * const h = 300;
2029
+ * // A nice orange. String with the RGB values.
2030
+ * const orange = String.fromCharCode(0xff, 0x80, 0x10);
2031
+ * // Create the texture. Repeat the color string for each pixel.
2032
+ * const [ok] = gui.new_texture("orange_tx", w, h, "rgb", orange.repeat(w * h));
2033
+ * if (ok) {
2034
+ * const node = gui.get_node("box_node");
2035
+ * gui.set_texture(node, "orange_tx");
2036
+ * }
2037
+ * ```
2038
+ */
2039
+ function set_texture(node: Opaque<"node">, texture: string | Hash): void;
2040
+ /**
2041
+ * Set the texture buffer data for a dynamically created texture.
2042
+ *
2043
+ * @param texture - texture id
2044
+ * @param width - texture width
2045
+ * @param height - texture height
2046
+ * @param type - texture type
2047
+ *
2048
+ * - `"rgb"` or `image.TYPE_RGB` - RGB
2049
+ * - `"rgba"` or `image.TYPE_RGBA` - RGBA
2050
+ * - `"l"` or `image.TYPE_LUMINANCE` - LUMINANCE
2051
+ * - `"astc"` - ASTC compressed format
2052
+ * @param buffer - texture data
2053
+ * @param flip - flip texture vertically
2054
+ * @returns setting the data was successful
2055
+ * @example
2056
+ * ```ts
2057
+ * export default defineGuiScript({
2058
+ * init(self) {
2059
+ * const w = 200;
2060
+ * const h = 300;
2061
+ *
2062
+ * // Create a dynamic texture, all white.
2063
+ * if (gui.new_texture("dynamic_tx", w, h, "rgb", String.fromCharCode(0xff).repeat(w * h * 3))) {
2064
+ * // Create a box node and apply the texture to it.
2065
+ * const n = gui.new_box_node(vmath.vector3(200, 200, 0), vmath.vector3(w, h, 0));
2066
+ * gui.set_texture(n, "dynamic_tx");
2067
+ *
2068
+ * // ...
2069
+ *
2070
+ * // Change the data in the texture to a nice orange.
2071
+ * const orange = String.fromCharCode(0xff, 0x80, 0x10);
2072
+ * if (gui.set_texture_data("dynamic_tx", w, h, "rgb", orange.repeat(w * h))) {
2073
+ * // Go on and to more stuff
2074
+ * // ...
2075
+ * }
2076
+ * } else {
2077
+ * // Something went wrong
2078
+ * // ...
2079
+ * }
2080
+ * },
2081
+ * });
2082
+ * ```
2083
+ */
2084
+ function set_texture_data(texture: string | Hash, width: number, height: number, type: string | image.TYPE, buffer: string, flip?: boolean): boolean;
2085
+ /**
2086
+ * Sets the tracking value of a text node. This value is used to
2087
+ * adjust the vertical spacing of characters in the text.
2088
+ *
2089
+ * @param node - node for which to set the tracking
2090
+ * @param tracking - a scaling number for the letter spacing (default=0)
2091
+ */
2092
+ function set_tracking(node: Opaque<"node">, tracking: number): void;
2093
+ /**
2094
+ * Set if a node should be visible or not. Only visible nodes are rendered.
2095
+ *
2096
+ * @param node - node to be visible or not
2097
+ * @param visible - whether the node should be visible or not
2098
+ */
2099
+ function set_visible(node: Opaque<"node">, visible: boolean): void;
2100
+ /**
2101
+ * The x-anchor specifies how the node is moved when the game is run in a different resolution.
2102
+ *
2103
+ * @param node - node to set x-anchor for
2104
+ * @param anchor - anchor constant
2105
+ *
2106
+ * - `gui.ANCHOR_NONE`
2107
+ * - `gui.ANCHOR_LEFT`
2108
+ * - `gui.ANCHOR_RIGHT`
2109
+ */
2110
+ function set_xanchor(node: Opaque<"node">, anchor: gui.ANCHOR): void;
2111
+ /**
2112
+ * The y-anchor specifies how the node is moved when the game is run in a different resolution.
2113
+ *
2114
+ * @param node - node to set y-anchor for
2115
+ * @param anchor - anchor constant
2116
+ *
2117
+ * - `gui.ANCHOR_NONE`
2118
+ * - `gui.ANCHOR_TOP`
2119
+ * - `gui.ANCHOR_BOTTOM`
2120
+ */
2121
+ function set_yanchor(node: Opaque<"node">, anchor: gui.ANCHOR): void;
2122
+ /**
2123
+ * Shows the on-display touch keyboard.
2124
+ * The specified type of keyboard is displayed if it is available on
2125
+ * the device.
2126
+ * This function is only available on iOS and Android. .
2127
+ *
2128
+ * @param type - keyboard type
2129
+ * @param autoclose - if the keyboard should automatically close when clicking outside
2130
+ */
2131
+ function show_keyboard(type: gui.KEYBOARD_TYPE, autoclose: boolean): void;
2132
+ /**
2133
+ * Stops the particle fx for a gui node
2134
+ *
2135
+ * @param node - node to stop particle fx for
2136
+ * @param options - options used when stopping the particle fx
2137
+ */
2138
+ function stop_particlefx(node: Opaque<"node">, options?: particlefx.stop_options): void;
2139
+ /**
2140
+ * This is a callback-function, which is called by the engine every frame to update the state of a gui component.
2141
+ * It can be used to perform any kind of gui related tasks, e.g. animating nodes.
2142
+ *
2143
+ * @param self - script instance used for storing state
2144
+ * @param dt - the time-step of the frame update
2145
+ * @example
2146
+ * ```ts
2147
+ * // This example demonstrates how to update a text node that displays game score
2148
+ * // in a counting fashion. It is assumed that the gui component receives messages
2149
+ * // from the game when a new score is to be shown.
2150
+ * export default defineGuiScript({
2151
+ * init() {
2152
+ * return {
2153
+ * // fetch the score text node for later use (assumes it is called "score")
2154
+ * score_node: gui.get_node("score"),
2155
+ * // keep track of the current score counted up so far
2156
+ * current_score: 0,
2157
+ * // keep track of the target score we should count up to
2158
+ * target_score: 0,
2159
+ * // how fast we will update the score, in score/second
2160
+ * score_update_speed: 1,
2161
+ * };
2162
+ * },
2163
+ *
2164
+ * update(self, dt) {
2165
+ * // check if target score is more than current score
2166
+ * if (self.current_score < self.target_score) {
2167
+ * // increment current score according to the speed
2168
+ * self.current_score = self.current_score + dt * self.score_update_speed;
2169
+ * // check if we went past the target score, clamp current score in that case
2170
+ * if (self.current_score > self.target_score) {
2171
+ * self.current_score = self.target_score;
2172
+ * }
2173
+ * // update the score text node
2174
+ * gui.set_text(self.score_node, "" + math.floor(self.current_score));
2175
+ * }
2176
+ * },
2177
+ *
2178
+ * on_message(self, message_id, message) {
2179
+ * // check the message
2180
+ * if (message_id === hash("set_score") && typeof message.score === "number") {
2181
+ * self.target_score = message.score;
2182
+ * }
2183
+ * },
2184
+ * });
2185
+ * ```
2186
+ */
2187
+ function update(self: unknown, dt: number): void;
2188
+ interface properties {
2189
+ /**
2190
+ * The fonts used in the gui. The type of the property is hash.
2191
+ * Key must be specified in options table.
2192
+ */
2193
+ fonts: Hash;
2194
+ /**
2195
+ * The main material (the default material assigned to a GUI) used when rendering the gui. The type of the property is hash.
2196
+ */
2197
+ material: Hash;
2198
+ /**
2199
+ * The materials used when rendering the gui. The type of the property is hash.
2200
+ * Key must be specified in options table.
2201
+ */
2202
+ materials: Hash;
2203
+ /**
2204
+ * The textures used in the gui. The type of the property is hash.
2205
+ * Key must be specified in options table.
2206
+ */
2207
+ textures: Hash;
2208
+ }
2209
+ }
2210
+ }
2211
+
2212
+ export {};