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