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