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