@defold-typescript/types 0.39.0 → 0.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-availability.json +4024 -716
- package/api-migrations.json +27 -0
- package/api-signatures.json +18118 -10264
- package/api-targets.json +448 -11
- package/examples/translations.json +619 -148
- package/fixtures/messages_doc.json +96 -0
- package/generated/b2d.d.ts +680 -4
- package/generated/b2d_body.d.ts +29 -103
- package/generated/b2d_chain.d.ts +5 -6
- package/generated/b2d_fixture.d.ts +34 -38
- package/generated/b2d_joint.d.ts +503 -25
- package/generated/b2d_shape.d.ts +199 -14
- package/generated/b2d_world.d.ts +57 -63
- package/generated/buffer.d.ts +33 -29
- package/generated/builtin-messages.d.ts +7 -1
- package/generated/bullet3d.d.ts +91 -0
- package/generated/bullet3d_collision_object.d.ts +433 -0
- package/generated/bullet3d_constraint.d.ts +818 -0
- package/generated/bullet3d_rigid_body.d.ts +429 -0
- package/generated/bullet3d_shape.d.ts +123 -0
- package/generated/bullet3d_world.d.ts +492 -0
- package/generated/camera.d.ts +31 -34
- package/generated/collectionfactory.d.ts +26 -27
- package/generated/collectionproxy.d.ts +22 -6
- package/generated/compute.d.ts +12 -238
- package/generated/crash.d.ts +24 -10
- package/generated/editor-vm/http.d.ts +90 -7
- package/generated/editor-vm/image.d.ts +7 -7
- package/generated/editor-vm/json.d.ts +11 -0
- package/generated/editor-vm/localization.d.ts +7 -7
- package/generated/editor-vm/tilemap_tiles.d.ts +56 -10
- package/generated/editor-vm/zip.d.ts +28 -0
- package/generated/editor.d.ts +1496 -430
- package/generated/factory.d.ts +21 -25
- package/generated/font.d.ts +64 -22
- package/generated/go.d.ts +243 -186
- package/generated/graphics.d.ts +374 -84
- package/generated/gui.d.ts +282 -492
- package/generated/html5.d.ts +5 -3
- package/generated/http.d.ts +31 -36
- package/generated/image.d.ts +127 -85
- package/generated/json.d.ts +34 -16
- package/generated/kinds/gui-script.d.ts +8 -0
- package/generated/kinds/render-script.d.ts +8 -0
- package/generated/kinds/script.d.ts +8 -0
- package/generated/label.d.ts +77 -7
- package/generated/liveupdate.d.ts +13 -10
- package/generated/material.d.ts +312 -360
- package/generated/model.d.ts +72 -42
- package/generated/particlefx.d.ts +19 -28
- package/generated/physics.d.ts +378 -144
- package/generated/profiler.d.ts +14 -24
- package/generated/render.d.ts +294 -297
- package/generated/resource.d.ts +753 -641
- package/generated/socket.d.ts +131 -134
- package/generated/sound.d.ts +65 -34
- package/generated/sprite.d.ts +39 -17
- package/generated/sys.d.ts +237 -182
- package/generated/tilemap.d.ts +21 -16
- package/generated/timer.d.ts +34 -21
- package/generated/versions/defold-1.12.4/b2d_body.d.ts +0 -7
- package/generated/versions/defold-1.12.4/buffer.d.ts +18 -17
- package/generated/versions/defold-1.12.4/camera.d.ts +23 -23
- package/generated/versions/defold-1.12.4/collectionfactory.d.ts +21 -19
- package/generated/versions/defold-1.12.4/collectionproxy.d.ts +2 -2
- package/generated/versions/defold-1.12.4/crash.d.ts +2 -2
- package/generated/versions/defold-1.12.4/factory.d.ts +15 -16
- package/generated/versions/defold-1.12.4/go.d.ts +15 -17
- package/generated/versions/defold-1.12.4/gui.d.ts +111 -193
- package/generated/versions/defold-1.12.4/html5.d.ts +4 -2
- package/generated/versions/defold-1.12.4/http.d.ts +4 -15
- package/generated/versions/defold-1.12.4/image.d.ts +38 -46
- package/generated/versions/defold-1.12.4/index.d.ts +2 -0
- package/generated/versions/defold-1.12.4/json.d.ts +10 -6
- package/generated/versions/defold-1.12.4/label.d.ts +2 -3
- package/generated/versions/defold-1.12.4/liveupdate.d.ts +5 -3
- package/generated/versions/defold-1.12.4/model.d.ts +34 -13
- package/generated/versions/defold-1.12.4/particlefx.d.ts +2 -5
- package/generated/versions/defold-1.12.4/physics.d.ts +82 -78
- package/generated/versions/defold-1.12.4/profiler.d.ts +3 -6
- package/generated/versions/defold-1.12.4/render.d.ts +160 -132
- package/generated/versions/defold-1.12.4/resource.d.ts +212 -209
- package/generated/versions/defold-1.12.4/socket.d.ts +45 -61
- package/generated/versions/defold-1.12.4/sound.d.ts +11 -11
- package/generated/versions/defold-1.12.4/sprite.d.ts +24 -6
- package/generated/versions/defold-1.12.4/sys.d.ts +45 -68
- package/generated/versions/defold-1.12.4/tilemap.d.ts +18 -11
- package/generated/versions/defold-1.12.4/timer.d.ts +5 -3
- package/generated/versions/defold-1.12.4/vmath.d.ts +5 -26
- package/generated/versions/defold-1.12.4/window.d.ts +1 -16
- package/generated/versions/defold-1.13.0/b2d_body.d.ts +10 -55
- package/generated/versions/defold-1.13.0/b2d_fixture.d.ts +25 -25
- package/generated/versions/defold-1.13.0/b2d_shape.d.ts +188 -5
- package/generated/versions/defold-1.13.0/b2d_world.d.ts +16 -10
- package/generated/versions/defold-1.13.0/buffer.d.ts +18 -17
- package/generated/versions/defold-1.13.0/camera.d.ts +27 -27
- package/generated/versions/defold-1.13.0/collectionfactory.d.ts +21 -19
- package/generated/versions/defold-1.13.0/collectionproxy.d.ts +2 -2
- package/generated/versions/defold-1.13.0/compute.d.ts +1 -70
- package/generated/versions/defold-1.13.0/crash.d.ts +2 -2
- package/generated/versions/defold-1.13.0/editor-vm/tilemap_tiles.d.ts +3 -3
- package/generated/versions/defold-1.13.0/editor.d.ts +34 -24
- package/generated/versions/defold-1.13.0/factory.d.ts +15 -16
- package/generated/versions/defold-1.13.0/go.d.ts +15 -17
- package/generated/versions/defold-1.13.0/graphics.d.ts +121 -37
- package/generated/versions/defold-1.13.0/gui.d.ts +111 -193
- package/generated/versions/defold-1.13.0/html5.d.ts +4 -2
- package/generated/versions/defold-1.13.0/http.d.ts +4 -15
- package/generated/versions/defold-1.13.0/image.d.ts +38 -46
- package/generated/versions/defold-1.13.0/index.d.ts +2 -0
- package/generated/versions/defold-1.13.0/json.d.ts +10 -6
- package/generated/versions/defold-1.13.0/label.d.ts +2 -3
- package/generated/versions/defold-1.13.0/liveupdate.d.ts +7 -5
- package/generated/versions/defold-1.13.0/material.d.ts +69 -107
- package/generated/versions/defold-1.13.0/model.d.ts +34 -13
- package/generated/versions/defold-1.13.0/particlefx.d.ts +2 -5
- package/generated/versions/defold-1.13.0/physics.d.ts +82 -78
- package/generated/versions/defold-1.13.0/profiler.d.ts +3 -6
- package/generated/versions/defold-1.13.0/render.d.ts +160 -132
- package/generated/versions/defold-1.13.0/resource.d.ts +217 -210
- package/generated/versions/defold-1.13.0/socket.d.ts +45 -61
- package/generated/versions/defold-1.13.0/sound.d.ts +11 -11
- package/generated/versions/defold-1.13.0/sprite.d.ts +24 -6
- package/generated/versions/defold-1.13.0/sys.d.ts +45 -68
- package/generated/versions/defold-1.13.0/tilemap.d.ts +18 -11
- package/generated/versions/defold-1.13.0/timer.d.ts +5 -3
- package/generated/versions/defold-1.13.0/vmath.d.ts +5 -26
- package/generated/versions/defold-1.13.0/window.d.ts +1 -16
- package/generated/versions/defold-1.13.1/b2d.d.ts +33 -0
- package/generated/versions/defold-1.13.1/b2d_body.d.ts +636 -0
- package/generated/versions/defold-1.13.1/b2d_chain.d.ts +106 -0
- package/generated/versions/defold-1.13.1/b2d_fixture.d.ts +157 -0
- package/generated/versions/defold-1.13.1/b2d_joint.d.ts +823 -0
- package/generated/versions/defold-1.13.1/b2d_shape.d.ts +400 -0
- package/generated/versions/defold-1.13.1/b2d_world.d.ts +320 -0
- package/generated/versions/defold-1.13.1/buffer.d.ts +189 -0
- package/generated/versions/defold-1.13.1/camera.d.ts +303 -0
- package/generated/versions/defold-1.13.1/collectionfactory.d.ts +151 -0
- package/generated/versions/defold-1.13.1/collectionproxy.d.ts +93 -0
- package/generated/versions/defold-1.13.1/compute.d.ts +237 -0
- package/generated/versions/defold-1.13.1/crash.d.ts +143 -0
- package/generated/versions/defold-1.13.1/editor-vm/http.d.ts +56 -0
- package/generated/versions/defold-1.13.1/editor-vm/image.d.ts +48 -0
- package/generated/versions/defold-1.13.1/editor-vm/json.d.ts +10 -0
- package/generated/versions/defold-1.13.1/editor-vm/localization.d.ts +42 -0
- package/generated/versions/defold-1.13.1/editor-vm/tilemap_tiles.d.ts +80 -0
- package/generated/versions/defold-1.13.1/editor-vm/zip.d.ts +10 -0
- package/generated/versions/defold-1.13.1/editor-vm/zlib.d.ts +24 -0
- package/generated/versions/defold-1.13.1/editor.d.ts +1121 -0
- package/generated/versions/defold-1.13.1/factory.d.ts +124 -0
- package/generated/versions/defold-1.13.1/font.d.ts +81 -0
- package/generated/versions/defold-1.13.1/go.d.ts +1107 -0
- package/generated/versions/defold-1.13.1/graphics.d.ts +411 -0
- package/generated/versions/defold-1.13.1/gui.d.ts +2353 -0
- package/generated/versions/defold-1.13.1/html5.d.ts +55 -0
- package/generated/versions/defold-1.13.1/http.d.ts +77 -0
- package/generated/versions/defold-1.13.1/image.d.ts +131 -0
- package/generated/versions/defold-1.13.1/index.d.ts +57 -0
- package/generated/versions/defold-1.13.1/json.d.ts +80 -0
- package/generated/versions/defold-1.13.1/kinds/editor-script.d.ts +14 -0
- package/generated/versions/defold-1.13.1/label.d.ts +93 -0
- package/generated/versions/defold-1.13.1/liveupdate.d.ts +142 -0
- package/generated/versions/defold-1.13.1/material.d.ts +408 -0
- package/generated/versions/defold-1.13.1/model.d.ts +272 -0
- package/generated/versions/defold-1.13.1/msg.d.ts +10 -0
- package/generated/versions/defold-1.13.1/particlefx.d.ts +163 -0
- package/generated/versions/defold-1.13.1/physics.d.ts +559 -0
- package/generated/versions/defold-1.13.1/profiler.d.ts +235 -0
- package/generated/versions/defold-1.13.1/render.d.ts +1190 -0
- package/generated/versions/defold-1.13.1/resource.d.ts +1523 -0
- package/generated/versions/defold-1.13.1/socket.d.ts +784 -0
- package/generated/versions/defold-1.13.1/sound.d.ts +292 -0
- package/generated/versions/defold-1.13.1/sprite.d.ts +175 -0
- package/generated/versions/defold-1.13.1/sys.d.ts +678 -0
- package/generated/versions/defold-1.13.1/tilemap.d.ts +208 -0
- package/generated/versions/defold-1.13.1/timer.d.ts +125 -0
- package/generated/versions/defold-1.13.1/types.d.ts +61 -0
- package/generated/versions/defold-1.13.1/vmath.d.ts +774 -0
- package/generated/versions/defold-1.13.1/window.d.ts +183 -0
- package/generated/versions/defold-1.13.1/zlib.d.ts +41 -0
- package/generated/vmath.d.ts +6 -26
- package/generated/window.d.ts +71 -71
- package/identity-vocabulary.json +561 -0
- package/index.d.ts +8 -0
- package/package.json +13 -2
- package/scripts/example-store-io.ts +12 -1
- package/scripts/extension-goldens.ts +1 -0
- package/scripts/fidelity-baseline.json +146 -46
- package/scripts/generate-api-availability.ts +90 -12
- package/scripts/generate-api-signatures.ts +14 -3
- package/scripts/import-defold-release.ts +85 -24
- package/scripts/prose-constants.ts +157 -0
- package/scripts/regen.ts +396 -78
- package/scripts/shared-handle-methods.ts +53 -0
- package/scripts/signature-store-fs.ts +1 -0
- package/scripts/sync-api-docs.ts +16 -5
- package/src/api-availability.ts +0 -0
- package/src/api-doc.ts +201 -3
- package/src/api-identity.ts +252 -0
- package/src/component-properties.d.ts +33 -0
- package/src/core-types.ts +28 -3
- package/src/correction-pins.ts +49 -0
- package/src/custom-messages.d.ts +4 -3
- package/src/doc-comment.ts +139 -23
- package/src/doc-corrections.ts +108 -0
- package/src/editor-vm-globals.d.ts +5 -2
- package/src/emit-dts.ts +2474 -281
- package/src/emit-messages.ts +52 -0
- package/src/engine-globals.d.ts +2 -2
- package/src/example-store.ts +125 -14
- package/src/field-correction-coverage.ts +204 -0
- package/src/fnv1a.ts +16 -0
- package/src/go-overloads.d.ts +33 -13
- package/src/index-base-table.ts +145 -0
- package/src/index-slot-classifications.ts +588 -0
- package/src/index.ts +39 -2
- package/src/library-index-slot-classifications.ts +332 -0
- package/src/lifecycle.ts +61 -199
- package/src/luals-type-expr.ts +354 -0
- package/src/msg-overloads.d.ts +0 -1
- package/src/param-correction-provenance.ts +64 -0
- package/src/return-correction-provenance.ts +58 -16
- package/src/script-api.ts +3 -1
- package/src/sys-overloads.d.ts +48 -0
- package/src/vmath-overloads.d.ts +27 -1
- package/src/window-event-guard.d.ts +6 -9
- package/url-parameters.json +1 -2
package/generated/gui.d.ts
CHANGED
|
@@ -1,11 +1,79 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
-
import type { Hash, Opaque, Quaternion, Url, Vector, Vector3, Vector4 } from "../src/core-types";
|
|
2
|
+
import type { Hash, Matrix4, Opaque, Quaternion, Url, Vector, Vector3, Vector4 } from "../src/core-types";
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
5
|
/**
|
|
6
6
|
* GUI API documentation
|
|
7
7
|
*/
|
|
8
8
|
namespace gui {
|
|
9
|
+
/**
|
|
10
|
+
* Rich-text layout object
|
|
11
|
+
*/
|
|
12
|
+
interface layout_object {
|
|
13
|
+
/**
|
|
14
|
+
* object type, currently `link` or `sprite`
|
|
15
|
+
*/
|
|
16
|
+
type: string;
|
|
17
|
+
/**
|
|
18
|
+
* the object's `id` attribute, or its generated layout object id
|
|
19
|
+
*/
|
|
20
|
+
id: Hash;
|
|
21
|
+
/**
|
|
22
|
+
* zero-based UTF-32 offset in the visible text
|
|
23
|
+
*/
|
|
24
|
+
text_offset: number;
|
|
25
|
+
/**
|
|
26
|
+
* visible UTF-32 text length covered by the object
|
|
27
|
+
*/
|
|
28
|
+
text_length: number;
|
|
29
|
+
/**
|
|
30
|
+
* lower-left x-coordinate relative to the text node's upper-left layout origin
|
|
31
|
+
*/
|
|
32
|
+
x: number;
|
|
33
|
+
/**
|
|
34
|
+
* lower-left y-coordinate relative to the text node's upper-left layout origin
|
|
35
|
+
*/
|
|
36
|
+
y: number;
|
|
37
|
+
/**
|
|
38
|
+
* resolved object width
|
|
39
|
+
*/
|
|
40
|
+
width: number;
|
|
41
|
+
/**
|
|
42
|
+
* resolved object height
|
|
43
|
+
*/
|
|
44
|
+
height: number;
|
|
45
|
+
/**
|
|
46
|
+
* markup attributes keyed by name
|
|
47
|
+
*/
|
|
48
|
+
attributes: LuaTable<string, string>;
|
|
49
|
+
}
|
|
50
|
+
type node = Opaque<"node">;
|
|
51
|
+
/**
|
|
52
|
+
* GUI flipbook playback properties
|
|
53
|
+
*/
|
|
54
|
+
interface play_properties {
|
|
55
|
+
/**
|
|
56
|
+
* Normalized initial animation cursor.
|
|
57
|
+
*/
|
|
58
|
+
offset?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Positive animation playback rate.
|
|
61
|
+
*/
|
|
62
|
+
playback_rate?: number;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Generic GUI property options
|
|
66
|
+
*/
|
|
67
|
+
interface set_options {
|
|
68
|
+
/**
|
|
69
|
+
* One-based material-constant array index.
|
|
70
|
+
*/
|
|
71
|
+
index?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Internal property name.
|
|
74
|
+
*/
|
|
75
|
+
key?: string | Hash;
|
|
76
|
+
}
|
|
9
77
|
type AdjustMode = typeof gui.ADJUST_FIT | typeof gui.ADJUST_ZOOM | typeof gui.ADJUST_STRETCH;
|
|
10
78
|
type BlendMode = typeof gui.BLEND_ALPHA | typeof gui.BLEND_ADD | typeof gui.BLEND_ADD_ALPHA | typeof gui.BLEND_MULT | typeof gui.BLEND_SCREEN;
|
|
11
79
|
type ClippingMode = typeof gui.CLIPPING_MODE_NONE | typeof gui.CLIPPING_MODE_STENCIL;
|
|
@@ -20,19 +88,30 @@ declare global {
|
|
|
20
88
|
type SizeMode = typeof gui.SIZE_MODE_MANUAL | typeof gui.SIZE_MODE_AUTO;
|
|
21
89
|
type XAnchor = typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT;
|
|
22
90
|
type YAnchor = typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_TOP | typeof gui.ANCHOR_BOTTOM;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
91
|
+
type ADJUST = typeof gui.ADJUST_FIT | typeof gui.ADJUST_STRETCH | typeof gui.ADJUST_ZOOM;
|
|
92
|
+
type ANCHOR = typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_RIGHT | typeof gui.ANCHOR_TOP;
|
|
93
|
+
type BLEND = typeof gui.BLEND_ADD | typeof gui.BLEND_ADD_ALPHA | typeof gui.BLEND_ALPHA | typeof gui.BLEND_MULT | typeof gui.BLEND_SCREEN;
|
|
94
|
+
type CLIPPING_MODE = typeof gui.CLIPPING_MODE_NONE | typeof gui.CLIPPING_MODE_STENCIL;
|
|
95
|
+
type EASING = typeof gui.EASING_INBACK | typeof gui.EASING_INBOUNCE | typeof gui.EASING_INCIRC | typeof gui.EASING_INCUBIC | typeof gui.EASING_INELASTIC | typeof gui.EASING_INEXPO | typeof gui.EASING_INOUTBACK | typeof gui.EASING_INOUTBOUNCE | typeof gui.EASING_INOUTCIRC | typeof gui.EASING_INOUTCUBIC | typeof gui.EASING_INOUTELASTIC | typeof gui.EASING_INOUTEXPO | typeof gui.EASING_INOUTQUAD | typeof gui.EASING_INOUTQUART | typeof gui.EASING_INOUTQUINT | typeof gui.EASING_INOUTSINE | typeof gui.EASING_INQUAD | typeof gui.EASING_INQUART | typeof gui.EASING_INQUINT | typeof gui.EASING_INSINE | typeof gui.EASING_LINEAR | typeof gui.EASING_OUTBACK | typeof gui.EASING_OUTBOUNCE | typeof gui.EASING_OUTCIRC | typeof gui.EASING_OUTCUBIC | typeof gui.EASING_OUTELASTIC | typeof gui.EASING_OUTEXPO | typeof gui.EASING_OUTINBACK | typeof gui.EASING_OUTINBOUNCE | typeof gui.EASING_OUTINCIRC | typeof gui.EASING_OUTINCUBIC | typeof gui.EASING_OUTINELASTIC | typeof gui.EASING_OUTINEXPO | typeof gui.EASING_OUTINQUAD | typeof gui.EASING_OUTINQUART | typeof gui.EASING_OUTINQUINT | typeof gui.EASING_OUTINSINE | typeof gui.EASING_OUTQUAD | typeof gui.EASING_OUTQUART | typeof gui.EASING_OUTQUINT | typeof gui.EASING_OUTSINE;
|
|
96
|
+
type KEYBOARD_TYPE = typeof gui.KEYBOARD_TYPE_DEFAULT | typeof gui.KEYBOARD_TYPE_EMAIL | typeof gui.KEYBOARD_TYPE_NUMBER_PAD | typeof gui.KEYBOARD_TYPE_PASSWORD;
|
|
97
|
+
type PIEBOUNDS = typeof gui.PIEBOUNDS_ELLIPSE | typeof gui.PIEBOUNDS_RECTANGLE;
|
|
98
|
+
type PIVOT = typeof gui.PIVOT_CENTER | typeof gui.PIVOT_E | typeof gui.PIVOT_N | typeof gui.PIVOT_NE | typeof gui.PIVOT_NW | typeof gui.PIVOT_S | typeof gui.PIVOT_SE | typeof gui.PIVOT_SW | typeof gui.PIVOT_W;
|
|
99
|
+
type PLAYBACK = typeof gui.PLAYBACK_LOOP_BACKWARD | typeof gui.PLAYBACK_LOOP_FORWARD | typeof gui.PLAYBACK_LOOP_PINGPONG | typeof gui.PLAYBACK_ONCE_BACKWARD | typeof gui.PLAYBACK_ONCE_FORWARD | typeof gui.PLAYBACK_ONCE_PINGPONG;
|
|
100
|
+
type PROP = typeof gui.PROP_COLOR | typeof gui.PROP_EULER | typeof gui.PROP_FILL_ANGLE | typeof gui.PROP_INNER_RADIUS | typeof gui.PROP_LEADING | typeof gui.PROP_OUTLINE | typeof gui.PROP_POSITION | typeof gui.PROP_ROTATION | typeof gui.PROP_SCALE | typeof gui.PROP_SHADOW | typeof gui.PROP_SIZE | typeof gui.PROP_SLICE9 | typeof gui.PROP_TRACKING;
|
|
101
|
+
type RESULT = typeof gui.RESULT_DATA_ERROR | typeof gui.RESULT_OUT_OF_RESOURCES | typeof gui.RESULT_TEXTURE_ALREADY_EXISTS;
|
|
102
|
+
type SAFE_AREA = typeof gui.SAFE_AREA_BOTH | typeof gui.SAFE_AREA_LONG | typeof gui.SAFE_AREA_NONE | typeof gui.SAFE_AREA_SHORT;
|
|
103
|
+
type SIZE_MODE = typeof gui.SIZE_MODE_AUTO | typeof gui.SIZE_MODE_MANUAL;
|
|
104
|
+
type TYPE = typeof gui.TYPE_BOX | typeof gui.TYPE_CUSTOM | typeof gui.TYPE_PARTICLEFX | typeof gui.TYPE_PIE | typeof gui.TYPE_TEXT;
|
|
105
|
+
/**
|
|
106
|
+
* fit adjust mode Adjust mode is used when the screen resolution differs from the project settings. The fit mode ensures that the entire node is visible in the adjusted gui scene.
|
|
26
107
|
*/
|
|
27
108
|
const ADJUST_FIT: number & { readonly __brand: "gui.ADJUST_FIT" };
|
|
28
109
|
/**
|
|
29
|
-
* Adjust mode is used when the screen resolution differs from the project settings.
|
|
30
|
-
* The stretch mode ensures that the node is displayed as is in the adjusted gui scene, which might scale it non-uniformally.
|
|
110
|
+
* stretch adjust mode Adjust mode is used when the screen resolution differs from the project settings. The stretch mode ensures that the node is displayed as is in the adjusted gui scene, which might scale it non-uniformally.
|
|
31
111
|
*/
|
|
32
112
|
const ADJUST_STRETCH: number & { readonly __brand: "gui.ADJUST_STRETCH" };
|
|
33
113
|
/**
|
|
34
|
-
* Adjust mode is used when the screen resolution differs from the project settings.
|
|
35
|
-
* The zoom mode ensures that the node fills its entire area and might make the node exceed it.
|
|
114
|
+
* zoom adjust mode Adjust mode is used when the screen resolution differs from the project settings. The zoom mode ensures that the node fills its entire area and might make the node exceed it.
|
|
36
115
|
*/
|
|
37
116
|
const ADJUST_ZOOM: number & { readonly __brand: "gui.ADJUST_ZOOM" };
|
|
38
117
|
/**
|
|
@@ -334,91 +413,89 @@ declare global {
|
|
|
334
413
|
/**
|
|
335
414
|
* color property
|
|
336
415
|
*/
|
|
337
|
-
const PROP_COLOR:
|
|
416
|
+
const PROP_COLOR: string & { readonly __brand: "gui.PROP_COLOR" };
|
|
338
417
|
/**
|
|
339
418
|
* euler property
|
|
340
419
|
*/
|
|
341
|
-
const PROP_EULER:
|
|
420
|
+
const PROP_EULER: string & { readonly __brand: "gui.PROP_EULER" };
|
|
342
421
|
/**
|
|
343
422
|
* fill_angle property
|
|
344
423
|
*/
|
|
345
|
-
const PROP_FILL_ANGLE:
|
|
424
|
+
const PROP_FILL_ANGLE: string & { readonly __brand: "gui.PROP_FILL_ANGLE" };
|
|
346
425
|
/**
|
|
347
426
|
* inner_radius property
|
|
348
427
|
*/
|
|
349
|
-
const PROP_INNER_RADIUS:
|
|
428
|
+
const PROP_INNER_RADIUS: string & { readonly __brand: "gui.PROP_INNER_RADIUS" };
|
|
350
429
|
/**
|
|
351
430
|
* leading property
|
|
352
431
|
*/
|
|
353
|
-
const PROP_LEADING:
|
|
432
|
+
const PROP_LEADING: string & { readonly __brand: "gui.PROP_LEADING" };
|
|
354
433
|
/**
|
|
355
434
|
* outline color property
|
|
356
435
|
*/
|
|
357
|
-
const PROP_OUTLINE:
|
|
436
|
+
const PROP_OUTLINE: string & { readonly __brand: "gui.PROP_OUTLINE" };
|
|
358
437
|
/**
|
|
359
438
|
* position property
|
|
360
439
|
*/
|
|
361
|
-
const PROP_POSITION:
|
|
440
|
+
const PROP_POSITION: string & { readonly __brand: "gui.PROP_POSITION" };
|
|
362
441
|
/**
|
|
363
442
|
* rotation property
|
|
364
443
|
*/
|
|
365
|
-
const PROP_ROTATION:
|
|
444
|
+
const PROP_ROTATION: string & { readonly __brand: "gui.PROP_ROTATION" };
|
|
366
445
|
/**
|
|
367
446
|
* scale property
|
|
368
447
|
*/
|
|
369
|
-
const PROP_SCALE:
|
|
448
|
+
const PROP_SCALE: string & { readonly __brand: "gui.PROP_SCALE" };
|
|
370
449
|
/**
|
|
371
450
|
* shadow color property
|
|
372
451
|
*/
|
|
373
|
-
const PROP_SHADOW:
|
|
452
|
+
const PROP_SHADOW: string & { readonly __brand: "gui.PROP_SHADOW" };
|
|
374
453
|
/**
|
|
375
454
|
* size property
|
|
376
455
|
*/
|
|
377
|
-
const PROP_SIZE:
|
|
456
|
+
const PROP_SIZE: string & { readonly __brand: "gui.PROP_SIZE" };
|
|
378
457
|
/**
|
|
379
458
|
* slice9 property
|
|
380
459
|
*/
|
|
381
|
-
const PROP_SLICE9:
|
|
460
|
+
const PROP_SLICE9: string & { readonly __brand: "gui.PROP_SLICE9" };
|
|
382
461
|
/**
|
|
383
462
|
* tracking property
|
|
384
463
|
*/
|
|
385
|
-
const PROP_TRACKING:
|
|
464
|
+
const PROP_TRACKING: string & { readonly __brand: "gui.PROP_TRACKING" };
|
|
386
465
|
/**
|
|
387
|
-
* The provided data is not in the expected format or is in some other way
|
|
388
|
-
* incorrect, for instance the image data provided to gui.new_texture().
|
|
466
|
+
* data error The provided data is not in the expected format or is in some other way incorrect, for instance the image data provided to gui.new_texture().
|
|
389
467
|
*/
|
|
390
468
|
const RESULT_DATA_ERROR: number & { readonly __brand: "gui.RESULT_DATA_ERROR" };
|
|
391
469
|
/**
|
|
392
|
-
* The system is out of resources, for instance when trying to create a new
|
|
393
|
-
* texture using gui.new_texture().
|
|
470
|
+
* out of resource The system is out of resources, for instance when trying to create a new texture using gui.new_texture().
|
|
394
471
|
*/
|
|
395
472
|
const RESULT_OUT_OF_RESOURCES: number & { readonly __brand: "gui.RESULT_OUT_OF_RESOURCES" };
|
|
396
473
|
/**
|
|
397
|
-
* The texture id already exists when trying to use gui.new_texture().
|
|
474
|
+
* texture already exists The texture id already exists when trying to use gui.new_texture().
|
|
398
475
|
*/
|
|
399
476
|
const RESULT_TEXTURE_ALREADY_EXISTS: number & { readonly __brand: "gui.RESULT_TEXTURE_ALREADY_EXISTS" };
|
|
400
477
|
/**
|
|
401
|
-
* Safe area mode that applies insets on all edges.
|
|
478
|
+
* both sides safe area Safe area mode that applies insets on all edges.
|
|
402
479
|
*/
|
|
403
480
|
const SAFE_AREA_BOTH: number & { readonly __brand: "gui.SAFE_AREA_BOTH" };
|
|
404
481
|
/**
|
|
405
|
-
* Safe area mode that applies insets only on the long edges.
|
|
482
|
+
* long side safe area Safe area mode that applies insets only on the long edges.
|
|
406
483
|
*/
|
|
407
484
|
const SAFE_AREA_LONG: number & { readonly __brand: "gui.SAFE_AREA_LONG" };
|
|
408
485
|
/**
|
|
409
|
-
* Safe area mode that ignores safe area insets.
|
|
486
|
+
* no safe area Safe area mode that ignores safe area insets.
|
|
410
487
|
*/
|
|
411
488
|
const SAFE_AREA_NONE: number & { readonly __brand: "gui.SAFE_AREA_NONE" };
|
|
412
489
|
/**
|
|
413
|
-
* Safe area mode that applies insets only on the short edges.
|
|
490
|
+
* short side safe area Safe area mode that applies insets only on the short edges.
|
|
414
491
|
*/
|
|
415
492
|
const SAFE_AREA_SHORT: number & { readonly __brand: "gui.SAFE_AREA_SHORT" };
|
|
416
493
|
/**
|
|
417
|
-
* The size of the node is determined by the currently assigned texture.
|
|
494
|
+
* automatic size mode The size of the node is determined by the currently assigned texture.
|
|
418
495
|
*/
|
|
419
496
|
const SIZE_MODE_AUTO: number & { readonly __brand: "gui.SIZE_MODE_AUTO" };
|
|
420
497
|
/**
|
|
421
|
-
* The size of the node is determined by the size set in the editor, the constructor or by gui.set_size()
|
|
498
|
+
* manual size mode The size of the node is determined by the size set in the editor, the constructor or by gui.set_size()
|
|
422
499
|
*/
|
|
423
500
|
const SIZE_MODE_MANUAL: number & { readonly __brand: "gui.SIZE_MODE_MANUAL" };
|
|
424
501
|
/**
|
|
@@ -459,61 +536,7 @@ declare global {
|
|
|
459
536
|
* together. See the examples below for more information.
|
|
460
537
|
*
|
|
461
538
|
* @param node - node to animate
|
|
462
|
-
* @param property - property to animate
|
|
463
|
-
*
|
|
464
|
-
* - `"position"`
|
|
465
|
-
*
|
|
466
|
-
* - `"rotation"`
|
|
467
|
-
*
|
|
468
|
-
* - `"euler"`
|
|
469
|
-
*
|
|
470
|
-
* - `"scale"`
|
|
471
|
-
*
|
|
472
|
-
* - `"color"`
|
|
473
|
-
*
|
|
474
|
-
* - `"outline"`
|
|
475
|
-
*
|
|
476
|
-
* - `"shadow"`
|
|
477
|
-
*
|
|
478
|
-
* - `"size"`
|
|
479
|
-
*
|
|
480
|
-
* - `"fill_angle"` (pie)
|
|
481
|
-
*
|
|
482
|
-
* - `"inner_radius"` (pie)
|
|
483
|
-
*
|
|
484
|
-
* - `"leading"` (text)
|
|
485
|
-
*
|
|
486
|
-
* - `"tracking"` (text)
|
|
487
|
-
*
|
|
488
|
-
* - `"slice9"` (slice9)
|
|
489
|
-
*
|
|
490
|
-
* The following property constants are defined equaling the corresponding property string names.
|
|
491
|
-
*
|
|
492
|
-
* - `gui.PROP_POSITION`
|
|
493
|
-
*
|
|
494
|
-
* - `gui.PROP_ROTATION`
|
|
495
|
-
*
|
|
496
|
-
* - `gui.PROP_EULER`
|
|
497
|
-
*
|
|
498
|
-
* - `gui.PROP_SCALE`
|
|
499
|
-
*
|
|
500
|
-
* - `gui.PROP_COLOR`
|
|
501
|
-
*
|
|
502
|
-
* - `gui.PROP_OUTLINE`
|
|
503
|
-
*
|
|
504
|
-
* - `gui.PROP_SHADOW`
|
|
505
|
-
*
|
|
506
|
-
* - `gui.PROP_SIZE`
|
|
507
|
-
*
|
|
508
|
-
* - `gui.PROP_FILL_ANGLE`
|
|
509
|
-
*
|
|
510
|
-
* - `gui.PROP_INNER_RADIUS`
|
|
511
|
-
*
|
|
512
|
-
* - `gui.PROP_LEADING`
|
|
513
|
-
*
|
|
514
|
-
* - `gui.PROP_TRACKING`
|
|
515
|
-
*
|
|
516
|
-
* - `gui.PROP_SLICE9`
|
|
539
|
+
* @param property - property to animate; each gui.PROP member equals its corresponding property name string
|
|
517
540
|
* @param to - target property value
|
|
518
541
|
* @param easing - easing to use during animation.
|
|
519
542
|
* Either specify one of the `gui.EASING_*` constants or provide a
|
|
@@ -523,18 +546,6 @@ declare global {
|
|
|
523
546
|
* @param complete_function - function to call when the
|
|
524
547
|
* animation has completed
|
|
525
548
|
* @param playback - playback mode
|
|
526
|
-
*
|
|
527
|
-
* - `gui.PLAYBACK_ONCE_FORWARD`
|
|
528
|
-
*
|
|
529
|
-
* - `gui.PLAYBACK_ONCE_BACKWARD`
|
|
530
|
-
*
|
|
531
|
-
* - `gui.PLAYBACK_ONCE_PINGPONG`
|
|
532
|
-
*
|
|
533
|
-
* - `gui.PLAYBACK_LOOP_FORWARD`
|
|
534
|
-
*
|
|
535
|
-
* - `gui.PLAYBACK_LOOP_BACKWARD`
|
|
536
|
-
*
|
|
537
|
-
* - `gui.PLAYBACK_LOOP_PINGPONG`
|
|
538
549
|
* @example
|
|
539
550
|
* How to start a simple color animation, where the node fades in to white during 0.5 seconds:
|
|
540
551
|
* ```ts
|
|
@@ -583,7 +594,7 @@ declare global {
|
|
|
583
594
|
* });
|
|
584
595
|
* ```
|
|
585
596
|
*/
|
|
586
|
-
function animate(node: Opaque<"node">, property: string | gui.
|
|
597
|
+
function animate(node: Opaque<"node">, property: string | Hash | gui.PROP, to: number | Vector3 | Vector4 | Quaternion, easing: gui.EASING | Vector, duration: number, delay?: number, complete_function?: (self: unknown, node: Opaque<"node">) => void, playback?: gui.PLAYBACK): void;
|
|
587
598
|
/**
|
|
588
599
|
* If one or more animations of the specified node is currently running (started by `gui.animate`), they will immediately be canceled.
|
|
589
600
|
*
|
|
@@ -591,52 +602,43 @@ declare global {
|
|
|
591
602
|
* @param property - optional property for which the animation should be canceled
|
|
592
603
|
*
|
|
593
604
|
* - `"position"`
|
|
594
|
-
*
|
|
595
605
|
* - `"rotation"`
|
|
596
|
-
*
|
|
597
606
|
* - `"euler"`
|
|
598
|
-
*
|
|
599
607
|
* - `"scale"`
|
|
600
|
-
*
|
|
601
608
|
* - `"color"`
|
|
602
|
-
*
|
|
603
609
|
* - `"outline"`
|
|
604
|
-
*
|
|
605
610
|
* - `"shadow"`
|
|
606
|
-
*
|
|
607
611
|
* - `"size"`
|
|
608
|
-
*
|
|
609
612
|
* - `"fill_angle"` (pie)
|
|
610
|
-
*
|
|
611
613
|
* - `"inner_radius"` (pie)
|
|
612
|
-
*
|
|
613
614
|
* - `"leading"` (text)
|
|
614
|
-
*
|
|
615
615
|
* - `"tracking"` (text)
|
|
616
|
-
*
|
|
617
616
|
* - `"slice9"` (slice9)
|
|
618
617
|
* @example
|
|
618
|
+
* Start an animation of the position property of a node, then cancel parts of
|
|
619
|
+
* the animation:
|
|
619
620
|
* ```ts
|
|
620
|
-
* // Start an animation of the position property of a node, then cancel parts of
|
|
621
|
-
* // the animation:
|
|
622
621
|
* const node = gui.get_node("my_node");
|
|
623
622
|
* // animate to new position
|
|
624
623
|
* const pos = vmath.vector3(100, 100, 0);
|
|
625
|
-
* gui.animate(node, "position", pos,
|
|
624
|
+
* gui.animate(node, "position", pos, gui.EASING_LINEAR, 2);
|
|
626
625
|
* // ...
|
|
627
626
|
* // cancel animation of the x component.
|
|
628
627
|
* gui.cancel_animations(node, "position.x");
|
|
629
|
-
*
|
|
630
|
-
*
|
|
628
|
+
* ```
|
|
629
|
+
* @example
|
|
630
|
+
* Cancels all property animations on a node in a single call:
|
|
631
|
+
* ```ts
|
|
632
|
+
* const node = gui.get_node("my_node");
|
|
631
633
|
* // animate to new position and scale
|
|
632
|
-
* gui.animate(node, "position", vmath.vector3(100, 100, 0),
|
|
633
|
-
* gui.animate(node, "scale", vmath.vector3(0.5),
|
|
634
|
+
* gui.animate(node, "position", vmath.vector3(100, 100, 0), gui.EASING_LINEAR, 5);
|
|
635
|
+
* gui.animate(node, "scale", vmath.vector3(0.5), gui.EASING_LINEAR, 5);
|
|
634
636
|
* // ...
|
|
635
637
|
* // cancel positioning and scaling at once
|
|
636
638
|
* gui.cancel_animations(node);
|
|
637
639
|
* ```
|
|
638
640
|
*/
|
|
639
|
-
function cancel_animations(node: Opaque<"node">, property?: string | gui.
|
|
641
|
+
function cancel_animations(node: Opaque<"node">, property?: string | Hash | gui.PROP): void;
|
|
640
642
|
/**
|
|
641
643
|
* Cancels any running flipbook animation on the specified node.
|
|
642
644
|
*
|
|
@@ -666,7 +668,7 @@ declare global {
|
|
|
666
668
|
* @param node - root node to clone
|
|
667
669
|
* @returns a table mapping node ids to the corresponding cloned nodes
|
|
668
670
|
*/
|
|
669
|
-
function clone_tree(node: Opaque<"node">):
|
|
671
|
+
function clone_tree(node: Opaque<"node">): LuaTable<Hash, Opaque<"node">>;
|
|
670
672
|
/**
|
|
671
673
|
* Deletes the specified node. Any child nodes of the specified node will be
|
|
672
674
|
* recursively deleted.
|
|
@@ -707,10 +709,14 @@ declare global {
|
|
|
707
709
|
* or release user input focus (see `release_input_focus`). There is no use in starting any animations or similar
|
|
708
710
|
* from this function since the gui component is about to be destroyed.
|
|
709
711
|
*
|
|
710
|
-
* @param self -
|
|
712
|
+
* @param self - script instance used for storing state
|
|
711
713
|
* @example
|
|
712
714
|
* ```ts
|
|
713
715
|
* export default defineScript({
|
|
716
|
+
* init() {
|
|
717
|
+
* return { some_value: 0 };
|
|
718
|
+
* },
|
|
719
|
+
*
|
|
714
720
|
* final(self) {
|
|
715
721
|
* // report finalization
|
|
716
722
|
* msg.post("my_friend_instance", "im_dead", { my_stats: self.some_value });
|
|
@@ -718,7 +724,7 @@ declare global {
|
|
|
718
724
|
* });
|
|
719
725
|
* ```
|
|
720
726
|
*/
|
|
721
|
-
function final(self:
|
|
727
|
+
function final(self: unknown): void;
|
|
722
728
|
/**
|
|
723
729
|
* Instead of using specific getters such as gui.get_position or gui.get_scale,
|
|
724
730
|
* you can use gui.get instead and supply the property as a string or a hash.
|
|
@@ -726,29 +732,17 @@ declare global {
|
|
|
726
732
|
* when operating in the gui namespace. Most notably, only these explicitly named properties are supported:
|
|
727
733
|
*
|
|
728
734
|
* - `"position"`
|
|
729
|
-
*
|
|
730
735
|
* - `"rotation"`
|
|
731
|
-
*
|
|
732
736
|
* - `"euler"`
|
|
733
|
-
*
|
|
734
737
|
* - `"scale"`
|
|
735
|
-
*
|
|
736
738
|
* - `"color"`
|
|
737
|
-
*
|
|
738
739
|
* - `"outline"`
|
|
739
|
-
*
|
|
740
740
|
* - `"shadow"`
|
|
741
|
-
*
|
|
742
741
|
* - `"size"`
|
|
743
|
-
*
|
|
744
742
|
* - `"fill_angle"` (pie)
|
|
745
|
-
*
|
|
746
743
|
* - `"inner_radius"` (pie)
|
|
747
|
-
*
|
|
748
744
|
* - `"leading"` (text)
|
|
749
|
-
*
|
|
750
745
|
* - `"tracking"` (text)
|
|
751
|
-
*
|
|
752
746
|
* - `"slice9"` (slice9)
|
|
753
747
|
*
|
|
754
748
|
* The value returned will either be a vmath.vector4 or a single number, i.e getting the "position"
|
|
@@ -758,7 +752,9 @@ declare global {
|
|
|
758
752
|
* @param node - node to get the property for
|
|
759
753
|
* @param property - the property to retrieve
|
|
760
754
|
* @param options - optional options table (only applicable for material constants)
|
|
761
|
-
* - `index`
|
|
755
|
+
* - `index` integer index into array property (1 based)
|
|
756
|
+
*
|
|
757
|
+
* **⚠️ `index` is 1-based; passed to Defold unchanged.**
|
|
762
758
|
* @example
|
|
763
759
|
* ```ts
|
|
764
760
|
* // Get properties on existing nodes:
|
|
@@ -766,7 +762,7 @@ declare global {
|
|
|
766
762
|
* const node_position = gui.get(node, "position");
|
|
767
763
|
* ```
|
|
768
764
|
*/
|
|
769
|
-
function get(node: Opaque<"node">, property: string | Hash | gui.
|
|
765
|
+
function get(node: Opaque<"node">, property: string | Hash | gui.PROP, options?: { index?: number; key?: string | Hash; keys?: (Hash | string)[] }): unknown;
|
|
770
766
|
/**
|
|
771
767
|
* Returns the adjust mode of a node.
|
|
772
768
|
* The adjust mode defines how the node will adjust itself to screen
|
|
@@ -774,14 +770,8 @@ declare global {
|
|
|
774
770
|
*
|
|
775
771
|
* @param node - node from which to get the adjust mode (node)
|
|
776
772
|
* @returns the current adjust mode
|
|
777
|
-
*
|
|
778
|
-
* - `gui.ADJUST_FIT`
|
|
779
|
-
*
|
|
780
|
-
* - `gui.ADJUST_ZOOM`
|
|
781
|
-
*
|
|
782
|
-
* - `gui.ADJUST_STRETCH`
|
|
783
773
|
*/
|
|
784
|
-
function get_adjust_mode(node: Opaque<"node">): gui.
|
|
774
|
+
function get_adjust_mode(node: Opaque<"node">): gui.ADJUST;
|
|
785
775
|
/**
|
|
786
776
|
* gets the node alpha
|
|
787
777
|
*
|
|
@@ -795,18 +785,8 @@ declare global {
|
|
|
795
785
|
*
|
|
796
786
|
* @param node - node from which to get the blend mode
|
|
797
787
|
* @returns blend mode
|
|
798
|
-
*
|
|
799
|
-
* - `gui.BLEND_ALPHA`
|
|
800
|
-
*
|
|
801
|
-
* - `gui.BLEND_ADD`
|
|
802
|
-
*
|
|
803
|
-
* - `gui.BLEND_ADD_ALPHA`
|
|
804
|
-
*
|
|
805
|
-
* - `gui.BLEND_MULT`
|
|
806
|
-
*
|
|
807
|
-
* - `gui.BLEND_SCREEN`
|
|
808
788
|
*/
|
|
809
|
-
function get_blend_mode(node: Opaque<"node">): gui.
|
|
789
|
+
function get_blend_mode(node: Opaque<"node">): gui.BLEND;
|
|
810
790
|
/**
|
|
811
791
|
* If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
|
|
812
792
|
*
|
|
@@ -821,10 +801,9 @@ declare global {
|
|
|
821
801
|
* @returns clipping mode
|
|
822
802
|
*
|
|
823
803
|
* - `gui.CLIPPING_MODE_NONE`
|
|
824
|
-
*
|
|
825
804
|
* - `gui.CLIPPING_MODE_STENCIL`
|
|
826
805
|
*/
|
|
827
|
-
function get_clipping_mode(node: Opaque<"node">): gui.
|
|
806
|
+
function get_clipping_mode(node: Opaque<"node">): gui.CLIPPING_MODE;
|
|
828
807
|
/**
|
|
829
808
|
* If node is set as visible clipping node, it will be shown as well as clipping. Otherwise, it will only clip but not show visually.
|
|
830
809
|
*
|
|
@@ -944,7 +923,7 @@ declare global {
|
|
|
944
923
|
* Higher index means the node is drawn on top of lower indexed nodes.
|
|
945
924
|
*
|
|
946
925
|
* @param node - the node to retrieve the id from
|
|
947
|
-
* @returns the index of the node
|
|
926
|
+
* @returns the index of the node. **0️⃣ 0-based; passed to Defold unchanged.**
|
|
948
927
|
* @example
|
|
949
928
|
* ```ts
|
|
950
929
|
* // Compare the index order of two sibling nodes:
|
|
@@ -987,6 +966,15 @@ declare global {
|
|
|
987
966
|
* @returns layout id
|
|
988
967
|
*/
|
|
989
968
|
function get_layout(): Hash;
|
|
969
|
+
/**
|
|
970
|
+
* Returns the sprites and links found in the text node's current layout.
|
|
971
|
+
* Each object's `x` and `y` identify its lower-left corner relative to the
|
|
972
|
+
* text node's upper-left layout origin.
|
|
973
|
+
*
|
|
974
|
+
* @param node - text node to inspect
|
|
975
|
+
* @returns layout objects in source order. **0️⃣ `text_offset` is 0-based; passed to Defold unchanged.**
|
|
976
|
+
*/
|
|
977
|
+
function get_layout_objects(node: Opaque<"node">): gui.layout_object[];
|
|
990
978
|
/**
|
|
991
979
|
* Returns a table mapping each layout id hash to a vector3(width, height, 0). For the default layout,
|
|
992
980
|
* the current scene resolution is returned. If a layout name is not present in the Display Profiles (or when
|
|
@@ -994,7 +982,7 @@ declare global {
|
|
|
994
982
|
*
|
|
995
983
|
* @returns layout_id_hash -> vmath.vector3(width, height, 0)
|
|
996
984
|
*/
|
|
997
|
-
function get_layouts():
|
|
985
|
+
function get_layouts(): LuaTable<Hash, Vector3>;
|
|
998
986
|
/**
|
|
999
987
|
* Returns the leading value for a text node.
|
|
1000
988
|
*
|
|
@@ -1044,13 +1032,9 @@ declare global {
|
|
|
1044
1032
|
* Returns the outer bounds mode for a pie node.
|
|
1045
1033
|
*
|
|
1046
1034
|
* @param node - node from where to get the outer bounds mode
|
|
1047
|
-
* @returns the outer bounds mode of the pie node
|
|
1048
|
-
*
|
|
1049
|
-
* - `gui.PIEBOUNDS_RECTANGLE`
|
|
1050
|
-
*
|
|
1051
|
-
* - `gui.PIEBOUNDS_ELLIPSE`
|
|
1035
|
+
* @returns the outer bounds mode of the pie node
|
|
1052
1036
|
*/
|
|
1053
|
-
function get_outer_bounds(node: Opaque<"node">): gui.
|
|
1037
|
+
function get_outer_bounds(node: Opaque<"node">): gui.PIEBOUNDS;
|
|
1054
1038
|
/**
|
|
1055
1039
|
* Returns the outline color of the supplied node.
|
|
1056
1040
|
* See gui.get_color for info how vectors encode color values.
|
|
@@ -1089,24 +1073,16 @@ declare global {
|
|
|
1089
1073
|
* @returns pivot constant
|
|
1090
1074
|
*
|
|
1091
1075
|
* - `gui.PIVOT_CENTER`
|
|
1092
|
-
*
|
|
1093
1076
|
* - `gui.PIVOT_N`
|
|
1094
|
-
*
|
|
1095
1077
|
* - `gui.PIVOT_NE`
|
|
1096
|
-
*
|
|
1097
1078
|
* - `gui.PIVOT_E`
|
|
1098
|
-
*
|
|
1099
1079
|
* - `gui.PIVOT_SE`
|
|
1100
|
-
*
|
|
1101
1080
|
* - `gui.PIVOT_S`
|
|
1102
|
-
*
|
|
1103
1081
|
* - `gui.PIVOT_SW`
|
|
1104
|
-
*
|
|
1105
1082
|
* - `gui.PIVOT_W`
|
|
1106
|
-
*
|
|
1107
1083
|
* - `gui.PIVOT_NW`
|
|
1108
1084
|
*/
|
|
1109
|
-
function get_pivot(node: Opaque<"node">): gui.
|
|
1085
|
+
function get_pivot(node: Opaque<"node">): gui.PIVOT;
|
|
1110
1086
|
/**
|
|
1111
1087
|
* Returns the position of the supplied node.
|
|
1112
1088
|
*
|
|
@@ -1163,12 +1139,8 @@ declare global {
|
|
|
1163
1139
|
*
|
|
1164
1140
|
* @param node - node from which to get the size mode (node)
|
|
1165
1141
|
* @returns the current size mode
|
|
1166
|
-
*
|
|
1167
|
-
* - `gui.SIZE_MODE_MANUAL`
|
|
1168
|
-
*
|
|
1169
|
-
* - `gui.SIZE_MODE_AUTO`
|
|
1170
1142
|
*/
|
|
1171
|
-
function get_size_mode(node: Opaque<"node">): gui.
|
|
1143
|
+
function get_size_mode(node: Opaque<"node">): gui.SIZE_MODE;
|
|
1172
1144
|
/**
|
|
1173
1145
|
* Returns the slice9 configuration values for the node.
|
|
1174
1146
|
*
|
|
@@ -1205,13 +1177,13 @@ declare global {
|
|
|
1205
1177
|
* @param node - root node to get node tree from
|
|
1206
1178
|
* @returns a table mapping node ids to the corresponding nodes
|
|
1207
1179
|
*/
|
|
1208
|
-
function get_tree(node: Opaque<"node">):
|
|
1180
|
+
function get_tree(node: Opaque<"node">): LuaTable<Hash, Opaque<"node">>;
|
|
1209
1181
|
/**
|
|
1210
1182
|
* gets the node type
|
|
1211
1183
|
*
|
|
1212
1184
|
* @param node - node from which to get the type
|
|
1213
1185
|
*/
|
|
1214
|
-
function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.
|
|
1186
|
+
function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.TYPE, number | undefined]>;
|
|
1215
1187
|
/**
|
|
1216
1188
|
* Returns `true` if a node is visible and `false` if it's not.
|
|
1217
1189
|
* Invisible nodes are not rendered.
|
|
@@ -1233,12 +1205,10 @@ declare global {
|
|
|
1233
1205
|
* @returns anchor constant
|
|
1234
1206
|
*
|
|
1235
1207
|
* - `gui.ANCHOR_NONE`
|
|
1236
|
-
*
|
|
1237
1208
|
* - `gui.ANCHOR_LEFT`
|
|
1238
|
-
*
|
|
1239
1209
|
* - `gui.ANCHOR_RIGHT`
|
|
1240
1210
|
*/
|
|
1241
|
-
function get_xanchor(node: Opaque<"node">): gui.
|
|
1211
|
+
function get_xanchor(node: Opaque<"node">): gui.ANCHOR;
|
|
1242
1212
|
/**
|
|
1243
1213
|
* The y-anchor specifies how the node is moved when the game is run in a different resolution.
|
|
1244
1214
|
*
|
|
@@ -1246,12 +1216,10 @@ declare global {
|
|
|
1246
1216
|
* @returns anchor constant
|
|
1247
1217
|
*
|
|
1248
1218
|
* - `gui.ANCHOR_NONE`
|
|
1249
|
-
*
|
|
1250
1219
|
* - `gui.ANCHOR_TOP`
|
|
1251
|
-
*
|
|
1252
1220
|
* - `gui.ANCHOR_BOTTOM`
|
|
1253
1221
|
*/
|
|
1254
|
-
function get_yanchor(node: Opaque<"node">): gui.
|
|
1222
|
+
function get_yanchor(node: Opaque<"node">): gui.ANCHOR;
|
|
1255
1223
|
/**
|
|
1256
1224
|
* Hides the on-display touch keyboard on the device.
|
|
1257
1225
|
*/
|
|
@@ -1260,7 +1228,7 @@ declare global {
|
|
|
1260
1228
|
* This is a callback-function, which is called by the engine when a gui component is initialized. It can be used
|
|
1261
1229
|
* to set the initial state of the script and gui scene.
|
|
1262
1230
|
*
|
|
1263
|
-
* @param self -
|
|
1231
|
+
* @param self - script instance used for storing state
|
|
1264
1232
|
* @example
|
|
1265
1233
|
* ```ts
|
|
1266
1234
|
* export default defineScript({
|
|
@@ -1271,7 +1239,7 @@ declare global {
|
|
|
1271
1239
|
* });
|
|
1272
1240
|
* ```
|
|
1273
1241
|
*/
|
|
1274
|
-
function init(self:
|
|
1242
|
+
function init(self: unknown): void;
|
|
1275
1243
|
/**
|
|
1276
1244
|
* Returns `true` if a node is enabled and `false` if it's not.
|
|
1277
1245
|
* Disabled nodes are not rendered and animations acting on them are not evaluated.
|
|
@@ -1289,7 +1257,7 @@ declare global {
|
|
|
1289
1257
|
* @param node - to move
|
|
1290
1258
|
* @param reference - reference node above which the first node should be moved
|
|
1291
1259
|
*/
|
|
1292
|
-
function move_above(node: Opaque<"node">, reference
|
|
1260
|
+
function move_above(node: Opaque<"node">, reference: Opaque<"node"> | undefined): void;
|
|
1293
1261
|
/**
|
|
1294
1262
|
* Alters the ordering of the two supplied nodes by moving the first node
|
|
1295
1263
|
* below the second.
|
|
@@ -1298,7 +1266,7 @@ declare global {
|
|
|
1298
1266
|
* @param node - to move
|
|
1299
1267
|
* @param reference - reference node below which the first node should be moved
|
|
1300
1268
|
*/
|
|
1301
|
-
function move_below(node: Opaque<"node">, reference
|
|
1269
|
+
function move_below(node: Opaque<"node">, reference: Opaque<"node"> | undefined): void;
|
|
1302
1270
|
/**
|
|
1303
1271
|
* Dynamically create a new box node.
|
|
1304
1272
|
*
|
|
@@ -1339,18 +1307,15 @@ declare global {
|
|
|
1339
1307
|
* @param height - texture height
|
|
1340
1308
|
* @param type - texture type
|
|
1341
1309
|
*
|
|
1342
|
-
* - `"rgb"` - RGB
|
|
1343
|
-
*
|
|
1344
|
-
* - `"
|
|
1345
|
-
*
|
|
1346
|
-
* - `"l"` - LUMINANCE
|
|
1347
|
-
*
|
|
1310
|
+
* - `"rgb"` or `image.TYPE_RGB` - RGB
|
|
1311
|
+
* - `"rgba"` or `image.TYPE_RGBA` - RGBA
|
|
1312
|
+
* - `"l"` or `image.TYPE_LUMINANCE` - LUMINANCE
|
|
1348
1313
|
* - `"astc"` - ASTC compressed format
|
|
1349
1314
|
* @param buffer - texture data
|
|
1350
1315
|
* @param flip - flip texture vertically
|
|
1351
1316
|
* @example
|
|
1317
|
+
* How to create a texture and apply it to a new box node:
|
|
1352
1318
|
* ```ts
|
|
1353
|
-
* // How to create a texture and apply it to a new box node:
|
|
1354
1319
|
* export default defineGuiScript({
|
|
1355
1320
|
* init(self) {
|
|
1356
1321
|
* const w = 200;
|
|
@@ -1375,20 +1340,24 @@ declare global {
|
|
|
1375
1340
|
* }
|
|
1376
1341
|
* },
|
|
1377
1342
|
* });
|
|
1378
|
-
*
|
|
1379
|
-
*
|
|
1343
|
+
* ```
|
|
1344
|
+
* @example
|
|
1345
|
+
* How to create a texture using .astc format
|
|
1346
|
+
* ```ts
|
|
1380
1347
|
* const size = 4;
|
|
1381
1348
|
* const pos = vmath.vector3(200, 200, 0);
|
|
1382
1349
|
* const path = "/assets/images/logo_4x4.astc";
|
|
1383
|
-
* const
|
|
1384
|
-
*
|
|
1385
|
-
*
|
|
1386
|
-
*
|
|
1387
|
-
*
|
|
1388
|
-
*
|
|
1350
|
+
* const [data] = sys.load_resource(path);
|
|
1351
|
+
* if (data !== undefined) {
|
|
1352
|
+
* const n = gui.new_box_node(pos, vmath.vector3(size, size, 0));
|
|
1353
|
+
* // size is read from the .astc buffer
|
|
1354
|
+
* // flip is not supported
|
|
1355
|
+
* gui.new_texture(path, 0, 0, "astc", data, false);
|
|
1356
|
+
* gui.set_texture(n, path);
|
|
1357
|
+
* }
|
|
1389
1358
|
* ```
|
|
1390
1359
|
*/
|
|
1391
|
-
function new_texture(texture_id: string | Hash, width: number, height: number, type: string |
|
|
1360
|
+
function new_texture(texture_id: string | Hash, width: number, height: number, type: string | image.TYPE, buffer: string, flip?: boolean): LuaMultiReturn<[boolean, gui.RESULT | undefined]>;
|
|
1392
1361
|
/**
|
|
1393
1362
|
* This is a callback-function, which is called by the engine when user input is sent to the instance of the gui component.
|
|
1394
1363
|
* It can be used to take action on the input, e.g. modify the gui according to the input.
|
|
@@ -1400,136 +1369,18 @@ declare global {
|
|
|
1400
1369
|
* to signal that it wants input to be consumed.
|
|
1401
1370
|
* See the documentation of acquire_input_focus for more
|
|
1402
1371
|
* information.
|
|
1403
|
-
* The `action` parameter is a table containing data about the input mapped to the
|
|
1404
|
-
* `action_id`.
|
|
1405
|
-
* For mapped actions it specifies the value of the input and if it was just pressed or released.
|
|
1406
|
-
* Actions are mapped to input in an input_binding-file.
|
|
1407
|
-
* Mouse movement is specifically handled and uses `nil` as its `action_id`.
|
|
1408
|
-
* The `action` only contains positional parameters in this case, such as x and y of the pointer.
|
|
1409
|
-
* Here is a brief description of the available table fields:
|
|
1410
|
-
*
|
|
1411
|
-
* Field
|
|
1412
|
-
* Description
|
|
1413
|
-
*
|
|
1414
|
-
* `value`
|
|
1415
|
-
* 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.
|
|
1416
|
-
*
|
|
1417
|
-
* `pressed`
|
|
1418
|
-
* If the input was pressed this frame. This is not present for mouse movement and text input.
|
|
1419
|
-
*
|
|
1420
|
-
* `released`
|
|
1421
|
-
* If the input was released this frame. This is not present for mouse movement and text input.
|
|
1422
|
-
*
|
|
1423
|
-
* `repeated`
|
|
1424
|
-
* 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.
|
|
1425
|
-
*
|
|
1426
|
-
* `x`
|
|
1427
|
-
* The x value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1428
|
-
*
|
|
1429
|
-
* `y`
|
|
1430
|
-
* The y value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1431
|
-
*
|
|
1432
|
-
* `screen_x`
|
|
1433
|
-
* The screen space x value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1434
|
-
*
|
|
1435
|
-
* `screen_y`
|
|
1436
|
-
* The screen space y value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1437
|
-
*
|
|
1438
|
-
* `dx`
|
|
1439
|
-
* The change in x value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1440
|
-
*
|
|
1441
|
-
* `dy`
|
|
1442
|
-
* The change in y value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1443
|
-
*
|
|
1444
|
-
* `screen_dx`
|
|
1445
|
-
* The change in screen space x value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1446
|
-
*
|
|
1447
|
-
* `screen_dy`
|
|
1448
|
-
* The change in screen space y value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1449
|
-
*
|
|
1450
|
-
* `gamepad`
|
|
1451
|
-
* The index of the gamepad device that provided the input. See table below about gamepad input.
|
|
1452
|
-
*
|
|
1453
|
-
* `touch`
|
|
1454
|
-
* List of touch input, one element per finger, if present. See table below about touch input
|
|
1455
|
-
*
|
|
1456
|
-
* `text`
|
|
1457
|
-
* Text input from a (virtual) keyboard or similar.
|
|
1458
|
-
*
|
|
1459
|
-
* `marked_text`
|
|
1460
|
-
* Sequence of entered symbols while entering a symbol combination, for example Japanese Kana.
|
|
1461
|
-
*
|
|
1462
|
-
* Gamepad specific fields:
|
|
1463
|
-
*
|
|
1464
|
-
* Field
|
|
1465
|
-
* Description
|
|
1466
|
-
*
|
|
1467
|
-
* `gamepad`
|
|
1468
|
-
* The index of the gamepad device that provided the input.
|
|
1469
|
-
*
|
|
1470
|
-
* `userid`
|
|
1471
|
-
* Id of the user associated with the controller. Usually only relevant on consoles.
|
|
1472
|
-
*
|
|
1473
|
-
* `gamepad_unknown`
|
|
1474
|
-
* True if the inout originated from an unknown/unmapped gamepad.
|
|
1475
|
-
*
|
|
1476
|
-
* `gamepad_name`
|
|
1477
|
-
* Name of the gamepad
|
|
1478
|
-
*
|
|
1479
|
-
* `gamepad_axis`
|
|
1480
|
-
* List of gamepad axis values. For raw gamepad input only.
|
|
1481
|
-
*
|
|
1482
|
-
* `gamepadhats`
|
|
1483
|
-
* List of gamepad hat values. For raw gamepad input only.
|
|
1484
|
-
*
|
|
1485
|
-
* `gamepad_buttons`
|
|
1486
|
-
* List of gamepad button values. For raw gamepad input only.
|
|
1487
1372
|
*
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1490
|
-
*
|
|
1491
|
-
* Description
|
|
1492
|
-
*
|
|
1493
|
-
* `id`
|
|
1494
|
-
* A number identifying the touch input during its duration.
|
|
1495
|
-
*
|
|
1496
|
-
* `pressed`
|
|
1497
|
-
* True if the finger was pressed this frame.
|
|
1498
|
-
*
|
|
1499
|
-
* `released`
|
|
1500
|
-
* True if the finger was released this frame.
|
|
1501
|
-
*
|
|
1502
|
-
* `tap_count`
|
|
1503
|
-
* Number of taps, one for single, two for double-tap, etc
|
|
1504
|
-
*
|
|
1505
|
-
* `x`
|
|
1506
|
-
* The x touch location.
|
|
1507
|
-
*
|
|
1508
|
-
* `y`
|
|
1509
|
-
* The y touch location.
|
|
1510
|
-
*
|
|
1511
|
-
* `dx`
|
|
1512
|
-
* The change in x value.
|
|
1513
|
-
*
|
|
1514
|
-
* `dy`
|
|
1515
|
-
* The change in y value.
|
|
1516
|
-
*
|
|
1517
|
-
* `acc_x`
|
|
1518
|
-
* Accelerometer x value (if present).
|
|
1519
|
-
*
|
|
1520
|
-
* `acc_y`
|
|
1521
|
-
* Accelerometer y value (if present).
|
|
1522
|
-
*
|
|
1523
|
-
* `acc_z`
|
|
1524
|
-
* Accelerometer z value (if present).
|
|
1525
|
-
*
|
|
1526
|
-
* @param self - reference to the script state to be used for storing data
|
|
1527
|
-
* @param action_id - id of the received input action, as mapped in the input_binding-file
|
|
1528
|
-
* @param action - a table containing the input data, see above for a description
|
|
1373
|
+
* @param self - script instance used for storing state
|
|
1374
|
+
* @param action_id - id of the received input action, as mapped in the input_binding-file, or `nil` for mouse movement
|
|
1375
|
+
* @param action - input data for the action. **0️⃣ `gamepad` is 0-based; passed to Defold unchanged.**
|
|
1529
1376
|
* @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
|
|
1530
1377
|
* @example
|
|
1531
1378
|
* ```ts
|
|
1532
1379
|
* export default defineGuiScript({
|
|
1380
|
+
* init(): { my_value: number | undefined } {
|
|
1381
|
+
* return { my_value: undefined };
|
|
1382
|
+
* },
|
|
1383
|
+
*
|
|
1533
1384
|
* on_input(self, action_id, action) {
|
|
1534
1385
|
* // check for input
|
|
1535
1386
|
* if (action_id === hash("my_action")) {
|
|
@@ -1542,7 +1393,7 @@ declare global {
|
|
|
1542
1393
|
* });
|
|
1543
1394
|
* ```
|
|
1544
1395
|
*/
|
|
1545
|
-
function on_input(self:
|
|
1396
|
+
function on_input(self: unknown, action_id: Hash | undefined, action: go.on_input.action): boolean | undefined;
|
|
1546
1397
|
/**
|
|
1547
1398
|
* This is a callback-function, which is called by the engine whenever a message has been sent to the gui component.
|
|
1548
1399
|
* It can be used to take action on the message, e.g. update the gui or send a response back to the sender of the message.
|
|
@@ -1550,19 +1401,24 @@ declare global {
|
|
|
1550
1401
|
* documentation of the message specifies which data is supplied.
|
|
1551
1402
|
* See the update function for examples on how to use this callback-function.
|
|
1552
1403
|
*
|
|
1553
|
-
* @param self -
|
|
1404
|
+
* @param self - script instance used for storing state
|
|
1554
1405
|
* @param message_id - id of the received message
|
|
1555
1406
|
* @param message - a table containing the message data
|
|
1407
|
+
* @param sender - address of the sender
|
|
1556
1408
|
*/
|
|
1557
|
-
function on_message(self:
|
|
1409
|
+
function on_message(self: unknown, message_id: Hash, message: LuaMap<AnyNotNil, unknown> | Record<string, unknown>, sender: Url): void;
|
|
1558
1410
|
/**
|
|
1559
1411
|
* This is a callback-function, which is called by the engine when the gui script is reloaded, e.g. from the editor.
|
|
1560
1412
|
* It can be used for live development, e.g. to tweak constants or set up the state properly for the script.
|
|
1561
1413
|
*
|
|
1562
|
-
* @param self -
|
|
1414
|
+
* @param self - script instance used for storing state
|
|
1563
1415
|
* @example
|
|
1564
1416
|
* ```ts
|
|
1565
1417
|
* export default defineGuiScript({
|
|
1418
|
+
* init() {
|
|
1419
|
+
* return { my_original_color: gui.get_color(gui.get_node("my_node")) };
|
|
1420
|
+
* },
|
|
1421
|
+
*
|
|
1566
1422
|
* on_reload(self) {
|
|
1567
1423
|
* // restore some color (or similar)
|
|
1568
1424
|
* gui.set_color(gui.get_node("my_node"), self.my_original_color);
|
|
@@ -1570,7 +1426,7 @@ declare global {
|
|
|
1570
1426
|
* });
|
|
1571
1427
|
* ```
|
|
1572
1428
|
*/
|
|
1573
|
-
function on_reload(self:
|
|
1429
|
+
function on_reload(self: unknown): void;
|
|
1574
1430
|
/**
|
|
1575
1431
|
* Tests whether a coordinate is within the bounding box of a
|
|
1576
1432
|
* node.
|
|
@@ -1592,20 +1448,15 @@ declare global {
|
|
|
1592
1448
|
*
|
|
1593
1449
|
* `self`
|
|
1594
1450
|
*
|
|
1595
|
-
*
|
|
1451
|
+
* script_instance The current script instance.
|
|
1596
1452
|
*
|
|
1597
1453
|
* `node`
|
|
1598
1454
|
*
|
|
1599
1455
|
* node The node that is animated.
|
|
1600
|
-
* @param play_properties - optional
|
|
1601
|
-
*
|
|
1602
|
-
* `offset`
|
|
1603
|
-
* number The normalized initial value of the animation cursor when the animation starts playing
|
|
1604
|
-
* `playback_rate`
|
|
1605
|
-
* number The rate with which the animation will be played. Must be positive
|
|
1456
|
+
* @param play_properties - optional playback properties
|
|
1606
1457
|
* @example
|
|
1458
|
+
* Set the texture of a node to a flipbook animation from an atlas:
|
|
1607
1459
|
* ```ts
|
|
1608
|
-
* // Set the texture of a node to a flipbook animation from an atlas:
|
|
1609
1460
|
* function anim_callback(self: unknown, node: unknown) {
|
|
1610
1461
|
* // Take action after animation has played.
|
|
1611
1462
|
* }
|
|
@@ -1618,37 +1469,22 @@ declare global {
|
|
|
1618
1469
|
* gui.play_flipbook(node, "animated_button");
|
|
1619
1470
|
* },
|
|
1620
1471
|
* });
|
|
1621
|
-
*
|
|
1622
|
-
*
|
|
1472
|
+
* ```
|
|
1473
|
+
* @example
|
|
1474
|
+
* Set the texture of a node to an image from an atlas:
|
|
1475
|
+
* ```ts
|
|
1623
1476
|
* // Create a new node and set the texture to a "button.png" from atlas
|
|
1624
1477
|
* const node = gui.get_node("button_node");
|
|
1625
1478
|
* gui.set_texture(node, "gui_sprites");
|
|
1626
1479
|
* gui.play_flipbook(node, "button");
|
|
1627
1480
|
* ```
|
|
1628
1481
|
*/
|
|
1629
|
-
function play_flipbook(node: Opaque<"node">, animation: string | Hash, complete_function?: (self: unknown, node:
|
|
1482
|
+
function play_flipbook(node: Opaque<"node">, animation: string | Hash, complete_function?: (self: unknown, node: Opaque<"node">) => void, play_properties?: gui.play_properties): void;
|
|
1630
1483
|
/**
|
|
1631
1484
|
* Plays the paricle fx for a gui node
|
|
1632
1485
|
*
|
|
1633
1486
|
* @param node - node to play particle fx for
|
|
1634
1487
|
* @param emitter_state_function - optional callback function that will be called when an emitter attached to this particlefx changes state.
|
|
1635
|
-
*
|
|
1636
|
-
* `self`
|
|
1637
|
-
* object The current object
|
|
1638
|
-
* `node`
|
|
1639
|
-
* hash The particle fx node, or `nil` if the node was deleted
|
|
1640
|
-
* `emitter`
|
|
1641
|
-
* hash The id of the emitter
|
|
1642
|
-
* `state`
|
|
1643
|
-
* constant the new state of the emitter:
|
|
1644
|
-
*
|
|
1645
|
-
* - `particlefx.EMITTER_STATE_SLEEPING`
|
|
1646
|
-
*
|
|
1647
|
-
* - `particlefx.EMITTER_STATE_PRESPAWN`
|
|
1648
|
-
*
|
|
1649
|
-
* - `particlefx.EMITTER_STATE_SPAWNING`
|
|
1650
|
-
*
|
|
1651
|
-
* - `particlefx.EMITTER_STATE_POSTSPAWN`
|
|
1652
1488
|
* @example
|
|
1653
1489
|
* ```ts
|
|
1654
1490
|
* // How to play a particle fx when a gui node is created.
|
|
@@ -1667,7 +1503,7 @@ declare global {
|
|
|
1667
1503
|
* });
|
|
1668
1504
|
* ```
|
|
1669
1505
|
*/
|
|
1670
|
-
function play_particlefx(node: Opaque<"node">, emitter_state_function?: (self: unknown, node:
|
|
1506
|
+
function play_particlefx(node: Opaque<"node">, emitter_state_function?: (self: unknown, node: Opaque<"node"> | undefined, emitter: Hash, state: particlefx.EMITTER_STATE) => void): void;
|
|
1671
1507
|
/**
|
|
1672
1508
|
* Resets the input context of keyboard. This will clear marked text.
|
|
1673
1509
|
*/
|
|
@@ -1707,7 +1543,12 @@ declare global {
|
|
|
1707
1543
|
* },
|
|
1708
1544
|
*
|
|
1709
1545
|
* on_input(self, action_id, action) {
|
|
1710
|
-
* if (
|
|
1546
|
+
* if (
|
|
1547
|
+
* action_id === hash("touch") &&
|
|
1548
|
+
* action.pressed &&
|
|
1549
|
+
* action.screen_x !== undefined &&
|
|
1550
|
+
* action.screen_y !== undefined
|
|
1551
|
+
* ) {
|
|
1711
1552
|
* const screen_position = vmath.vector3(action.screen_x, action.screen_y, 0);
|
|
1712
1553
|
* const target_position = gui.screen_to_local(self.marker, screen_position);
|
|
1713
1554
|
* gui.animate(self.marker, gui.PROP_POSITION, target_position, gui.EASING_OUTQUAD, 0.2);
|
|
@@ -1717,7 +1558,7 @@ declare global {
|
|
|
1717
1558
|
* });
|
|
1718
1559
|
* ```
|
|
1719
1560
|
*/
|
|
1720
|
-
function screen_to_local(node: Opaque<"node">, screen_position: Vector3): Vector3;
|
|
1561
|
+
function screen_to_local(node: Opaque<"node">, screen_position: Vector3 | Vector4): Vector3;
|
|
1721
1562
|
/**
|
|
1722
1563
|
* Instead of using specific setteres such as gui.set_position or gui.set_scale,
|
|
1723
1564
|
* you can use gui.set instead and supply the property as a string or a hash.
|
|
@@ -1725,29 +1566,17 @@ declare global {
|
|
|
1725
1566
|
* when operating in the gui namespace. Most notably, only these named properties identifiers are supported:
|
|
1726
1567
|
*
|
|
1727
1568
|
* - `"position"`
|
|
1728
|
-
*
|
|
1729
1569
|
* - `"rotation"`
|
|
1730
|
-
*
|
|
1731
1570
|
* - `"euler"`
|
|
1732
|
-
*
|
|
1733
1571
|
* - `"scale"`
|
|
1734
|
-
*
|
|
1735
1572
|
* - `"color"`
|
|
1736
|
-
*
|
|
1737
1573
|
* - `"outline"`
|
|
1738
|
-
*
|
|
1739
1574
|
* - `"shadow"`
|
|
1740
|
-
*
|
|
1741
1575
|
* - `"size"`
|
|
1742
|
-
*
|
|
1743
1576
|
* - `"fill_angle"` (pie)
|
|
1744
|
-
*
|
|
1745
1577
|
* - `"inner_radius"` (pie)
|
|
1746
|
-
*
|
|
1747
1578
|
* - `"leading"` (text)
|
|
1748
|
-
*
|
|
1749
1579
|
* - `"tracking"` (text)
|
|
1750
|
-
*
|
|
1751
1580
|
* - `"slice9"` (slice9)
|
|
1752
1581
|
*
|
|
1753
1582
|
* 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.
|
|
@@ -1764,17 +1593,18 @@ declare global {
|
|
|
1764
1593
|
* @param node - node to set the property for, or msg.url() to the gui itself
|
|
1765
1594
|
* @param property - the property to set
|
|
1766
1595
|
* @param value - the property to set. `nil` is only supported for removing runtime texture mappings with `gui.set(msg.url(), "textures", nil, {key = ...})`.
|
|
1767
|
-
* @param options - optional options
|
|
1768
|
-
* - `index` number index into array property (1 based)
|
|
1769
|
-
* - `key` hash name of internal property
|
|
1596
|
+
* @param options - optional material-constant options. **⚠️ `index` is 1-based; passed to Defold unchanged.**
|
|
1770
1597
|
* @example
|
|
1598
|
+
* Updates the position property on an existing node:
|
|
1771
1599
|
* ```ts
|
|
1772
|
-
* // Updates the position property on an existing node:
|
|
1773
1600
|
* const node = gui.get_node("my_box_node");
|
|
1774
|
-
* const node_position = gui.get(node, "position");
|
|
1601
|
+
* const node_position = gui.get(node, "position") as Vector3;
|
|
1775
1602
|
* gui.set(node, "position.x", node_position.x + 128);
|
|
1776
|
-
*
|
|
1777
|
-
*
|
|
1603
|
+
* ```
|
|
1604
|
+
* @example
|
|
1605
|
+
* Updates the rotation property on an existing node:
|
|
1606
|
+
* ```ts
|
|
1607
|
+
* const node = gui.get_node("my_box_node");
|
|
1778
1608
|
* gui.set(node, "rotation", vmath.quat_rotation_z(math.rad(45)));
|
|
1779
1609
|
* // this is equivalent to:
|
|
1780
1610
|
* gui.set(node, "euler.z", 45);
|
|
@@ -1782,8 +1612,11 @@ declare global {
|
|
|
1782
1612
|
* gui.set(node, "euler", vmath.vector3(0, 0, 45));
|
|
1783
1613
|
* // or using the set_rotation
|
|
1784
1614
|
* gui.set_rotation(node, vmath.vector3(0, 0, 45));
|
|
1785
|
-
*
|
|
1786
|
-
*
|
|
1615
|
+
* ```
|
|
1616
|
+
* @example
|
|
1617
|
+
* Sets various material constants for a node:
|
|
1618
|
+
* ```ts
|
|
1619
|
+
* const node = gui.get_node("my_box_node");
|
|
1787
1620
|
* gui.set(node, "tint", vmath.vector4(1, 0, 0, 1));
|
|
1788
1621
|
* // matrix4 is also supported
|
|
1789
1622
|
* gui.set(node, "light_matrix", vmath.matrix4());
|
|
@@ -1797,23 +1630,31 @@ declare global {
|
|
|
1797
1630
|
* gui.set(node, "tint.x", 1);
|
|
1798
1631
|
* // update a sub-element in an array constant at position 4
|
|
1799
1632
|
* gui.set(node, "tint_array.x", 1, { index: 4 });
|
|
1800
|
-
*
|
|
1801
|
-
*
|
|
1633
|
+
* ```
|
|
1634
|
+
* @example
|
|
1635
|
+
* Set a named property
|
|
1636
|
+
* ```ts
|
|
1802
1637
|
* export default defineGuiScript({
|
|
1803
1638
|
* on_message(self, message_id, message) {
|
|
1804
|
-
* if (message_id === hash("set_font")) {
|
|
1639
|
+
* if (message_id === hash("set_font") && types.is_hash(message.font)) {
|
|
1805
1640
|
* gui.set(msg.url(), "fonts", message.font, { key: "my_font_name" });
|
|
1806
1641
|
* gui.set_font(gui.get_node("text"), "my_font_name");
|
|
1807
|
-
* } else if (message_id === hash("set_texture")) {
|
|
1642
|
+
* } else if (message_id === hash("set_texture") && types.is_hash(message.texture)) {
|
|
1808
1643
|
* gui.set(msg.url(), "textures", message.texture, { key: "my_texture" });
|
|
1809
1644
|
* gui.set_texture(gui.get_node("box"), "my_texture");
|
|
1810
1645
|
* gui.play_flipbook(gui.get_node("box"), "logo_256");
|
|
1811
1646
|
* }
|
|
1812
1647
|
* },
|
|
1813
1648
|
* });
|
|
1814
|
-
*
|
|
1815
|
-
*
|
|
1816
|
-
*
|
|
1649
|
+
* ```
|
|
1650
|
+
* @example
|
|
1651
|
+
* Remove a named runtime texture resource mapping:
|
|
1652
|
+
* ```ts
|
|
1653
|
+
* const atlas_params = {
|
|
1654
|
+
* texture: "/runtime.texturec",
|
|
1655
|
+
* animations: [{ id: "runtime", width: 1, height: 1, frames: [1] }],
|
|
1656
|
+
* geometries: [{ vertices: [0, 0, 0, 1, 1, 1, 1, 0], uvs: [0, 0, 0, 1, 1, 1, 1, 0], indices: [0, 1, 2, 0, 2, 3] }],
|
|
1657
|
+
* } satisfies Parameters<typeof resource.create_atlas>[1];
|
|
1817
1658
|
* const atlas_id = resource.create_atlas("/runtime.texturesetc", atlas_params);
|
|
1818
1659
|
* gui.set(msg.url(), "textures", atlas_id, { key: "runtime_texture" });
|
|
1819
1660
|
* gui.set_texture(gui.get_node("box"), "runtime_texture");
|
|
@@ -1823,7 +1664,7 @@ declare global {
|
|
|
1823
1664
|
* resource.release(atlas_id);
|
|
1824
1665
|
* ```
|
|
1825
1666
|
*/
|
|
1826
|
-
function set(node: Opaque<"node"> | Url, property: string | Hash | gui.
|
|
1667
|
+
function set(node: Opaque<"node"> | Url, property: string | Hash | gui.PROP, value: number | Vector4 | Vector3 | Quaternion | Matrix4 | Hash | undefined, options?: { index?: number; key?: string | Hash; keys?: (Hash | string)[] }): void;
|
|
1827
1668
|
/**
|
|
1828
1669
|
* Sets the adjust mode on a node.
|
|
1829
1670
|
* The adjust mode defines how the node will adjust itself to screen
|
|
@@ -1831,14 +1672,8 @@ declare global {
|
|
|
1831
1672
|
*
|
|
1832
1673
|
* @param node - node to set adjust mode for
|
|
1833
1674
|
* @param adjust_mode - adjust mode to set
|
|
1834
|
-
*
|
|
1835
|
-
* - `gui.ADJUST_FIT`
|
|
1836
|
-
*
|
|
1837
|
-
* - `gui.ADJUST_ZOOM`
|
|
1838
|
-
*
|
|
1839
|
-
* - `gui.ADJUST_STRETCH`
|
|
1840
1675
|
*/
|
|
1841
|
-
function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.
|
|
1676
|
+
function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.ADJUST): void;
|
|
1842
1677
|
/**
|
|
1843
1678
|
* sets the node alpha
|
|
1844
1679
|
*
|
|
@@ -1852,18 +1687,8 @@ declare global {
|
|
|
1852
1687
|
*
|
|
1853
1688
|
* @param node - node to set blend mode for
|
|
1854
1689
|
* @param blend_mode - blend mode to set
|
|
1855
|
-
*
|
|
1856
|
-
* - `gui.BLEND_ALPHA`
|
|
1857
|
-
*
|
|
1858
|
-
* - `gui.BLEND_ADD`
|
|
1859
|
-
*
|
|
1860
|
-
* - `gui.BLEND_ADD_ALPHA`
|
|
1861
|
-
*
|
|
1862
|
-
* - `gui.BLEND_MULT`
|
|
1863
|
-
*
|
|
1864
|
-
* - `gui.BLEND_SCREEN`
|
|
1865
1690
|
*/
|
|
1866
|
-
function set_blend_mode(node: Opaque<"node">, blend_mode: gui.
|
|
1691
|
+
function set_blend_mode(node: Opaque<"node">, blend_mode: gui.BLEND): void;
|
|
1867
1692
|
/**
|
|
1868
1693
|
* If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
|
|
1869
1694
|
*
|
|
@@ -1878,10 +1703,9 @@ declare global {
|
|
|
1878
1703
|
* @param clipping_mode - clipping mode to set
|
|
1879
1704
|
*
|
|
1880
1705
|
* - `gui.CLIPPING_MODE_NONE`
|
|
1881
|
-
*
|
|
1882
1706
|
* - `gui.CLIPPING_MODE_STENCIL`
|
|
1883
1707
|
*/
|
|
1884
|
-
function set_clipping_mode(node: Opaque<"node">, clipping_mode: gui.
|
|
1708
|
+
function set_clipping_mode(node: Opaque<"node">, clipping_mode: gui.CLIPPING_MODE): void;
|
|
1885
1709
|
/**
|
|
1886
1710
|
* 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.
|
|
1887
1711
|
*
|
|
@@ -2043,13 +1867,9 @@ declare global {
|
|
|
2043
1867
|
* Sets the outer bounds mode for a pie node.
|
|
2044
1868
|
*
|
|
2045
1869
|
* @param node - node for which to set the outer bounds mode
|
|
2046
|
-
* @param bounds_mode - the outer bounds mode of the pie node
|
|
2047
|
-
*
|
|
2048
|
-
* - `gui.PIEBOUNDS_RECTANGLE`
|
|
2049
|
-
*
|
|
2050
|
-
* - `gui.PIEBOUNDS_ELLIPSE`
|
|
1870
|
+
* @param bounds_mode - the outer bounds mode of the pie node
|
|
2051
1871
|
*/
|
|
2052
|
-
function set_outer_bounds(node: Opaque<"node">, bounds_mode: gui.
|
|
1872
|
+
function set_outer_bounds(node: Opaque<"node">, bounds_mode: gui.PIEBOUNDS): void;
|
|
2053
1873
|
/**
|
|
2054
1874
|
* Sets the outline color of the supplied node.
|
|
2055
1875
|
* See gui.set_color for info how vectors encode color values.
|
|
@@ -2065,7 +1885,7 @@ declare global {
|
|
|
2065
1885
|
* @param parent - parent node to set, pass `nil` to remove parent
|
|
2066
1886
|
* @param keep_scene_transform - optional flag to make the scene position being perserved
|
|
2067
1887
|
*/
|
|
2068
|
-
function set_parent(node: Opaque<"node">, parent
|
|
1888
|
+
function set_parent(node: Opaque<"node">, parent: Opaque<"node"> | undefined, keep_scene_transform?: boolean): void;
|
|
2069
1889
|
/**
|
|
2070
1890
|
* Set the paricle fx for a gui node
|
|
2071
1891
|
*
|
|
@@ -2087,24 +1907,16 @@ declare global {
|
|
|
2087
1907
|
* @param pivot - pivot constant
|
|
2088
1908
|
*
|
|
2089
1909
|
* - `gui.PIVOT_CENTER`
|
|
2090
|
-
*
|
|
2091
1910
|
* - `gui.PIVOT_N`
|
|
2092
|
-
*
|
|
2093
1911
|
* - `gui.PIVOT_NE`
|
|
2094
|
-
*
|
|
2095
1912
|
* - `gui.PIVOT_E`
|
|
2096
|
-
*
|
|
2097
1913
|
* - `gui.PIVOT_SE`
|
|
2098
|
-
*
|
|
2099
1914
|
* - `gui.PIVOT_S`
|
|
2100
|
-
*
|
|
2101
1915
|
* - `gui.PIVOT_SW`
|
|
2102
|
-
*
|
|
2103
1916
|
* - `gui.PIVOT_W`
|
|
2104
|
-
*
|
|
2105
1917
|
* - `gui.PIVOT_NW`
|
|
2106
1918
|
*/
|
|
2107
|
-
function set_pivot(node: Opaque<"node">, pivot: gui.
|
|
1919
|
+
function set_pivot(node: Opaque<"node">, pivot: gui.PIVOT): void;
|
|
2108
1920
|
/**
|
|
2109
1921
|
* Sets the position of the supplied node.
|
|
2110
1922
|
*
|
|
@@ -2129,21 +1941,13 @@ declare global {
|
|
|
2129
1941
|
* @param node - node to set the rotation for
|
|
2130
1942
|
* @param rotation - new rotation
|
|
2131
1943
|
*/
|
|
2132
|
-
function set_rotation(node: Opaque<"node">, rotation: Quaternion | Vector4): void;
|
|
1944
|
+
function set_rotation(node: Opaque<"node">, rotation: Quaternion | Vector4 | Vector3): void;
|
|
2133
1945
|
/**
|
|
2134
1946
|
* Sets how the safe area is applied to this gui scene.
|
|
2135
1947
|
*
|
|
2136
1948
|
* @param mode - safe area mode
|
|
2137
|
-
*
|
|
2138
|
-
* - `gui.SAFE_AREA_NONE`
|
|
2139
|
-
*
|
|
2140
|
-
* - `gui.SAFE_AREA_LONG`
|
|
2141
|
-
*
|
|
2142
|
-
* - `gui.SAFE_AREA_SHORT`
|
|
2143
|
-
*
|
|
2144
|
-
* - `gui.SAFE_AREA_BOTH`
|
|
2145
1949
|
*/
|
|
2146
|
-
function set_safe_area_mode(mode: gui.
|
|
1950
|
+
function set_safe_area_mode(mode: gui.SAFE_AREA): void;
|
|
2147
1951
|
/**
|
|
2148
1952
|
* Sets the scaling of the supplied node.
|
|
2149
1953
|
*
|
|
@@ -2157,7 +1961,7 @@ declare global {
|
|
|
2157
1961
|
* @param node - node to set the screen position to
|
|
2158
1962
|
* @param screen_position - screen position
|
|
2159
1963
|
*/
|
|
2160
|
-
function set_screen_position(node: Opaque<"node">, screen_position: Vector3): void;
|
|
1964
|
+
function set_screen_position(node: Opaque<"node">, screen_position: Vector3 | Vector4): void;
|
|
2161
1965
|
/**
|
|
2162
1966
|
* Sets the shadow color of the supplied node.
|
|
2163
1967
|
* See gui.set_color for info how vectors encode color values.
|
|
@@ -2184,12 +1988,8 @@ declare global {
|
|
|
2184
1988
|
*
|
|
2185
1989
|
* @param node - node to set size mode for
|
|
2186
1990
|
* @param size_mode - size mode to set
|
|
2187
|
-
*
|
|
2188
|
-
* - `gui.SIZE_MODE_MANUAL`
|
|
2189
|
-
*
|
|
2190
|
-
* - `gui.SIZE_MODE_AUTO`
|
|
2191
1991
|
*/
|
|
2192
|
-
function set_size_mode(node: Opaque<"node">, size_mode: gui.
|
|
1992
|
+
function set_size_mode(node: Opaque<"node">, size_mode: gui.SIZE_MODE): void;
|
|
2193
1993
|
/**
|
|
2194
1994
|
* Set the slice9 configuration values for the node.
|
|
2195
1995
|
*
|
|
@@ -2215,20 +2015,25 @@ declare global {
|
|
|
2215
2015
|
* @param node - node to set texture for
|
|
2216
2016
|
* @param texture - texture id
|
|
2217
2017
|
* @example
|
|
2018
|
+
* To set a texture (or animation) from an atlas:
|
|
2218
2019
|
* ```ts
|
|
2219
|
-
* // To set a texture (or animation) from an atlas:
|
|
2220
2020
|
* const node = gui.get_node("box_node");
|
|
2221
2021
|
* gui.set_texture(node, "my_atlas");
|
|
2222
2022
|
* gui.play_flipbook(node, "image");
|
|
2223
|
-
*
|
|
2224
|
-
*
|
|
2225
|
-
*
|
|
2023
|
+
* ```
|
|
2024
|
+
* @example
|
|
2025
|
+
* Set a dynamically created texture to a node. Note that there is only
|
|
2026
|
+
* one texture image in this case so `gui.set_texture()` is
|
|
2027
|
+
* sufficient.
|
|
2028
|
+
* ```ts
|
|
2226
2029
|
* const w = 200;
|
|
2227
2030
|
* const h = 300;
|
|
2228
2031
|
* // A nice orange. String with the RGB values.
|
|
2229
2032
|
* const orange = String.fromCharCode(0xff, 0x80, 0x10);
|
|
2230
2033
|
* // Create the texture. Repeat the color string for each pixel.
|
|
2231
|
-
*
|
|
2034
|
+
* const [ok] = gui.new_texture("orange_tx", w, h, "rgb", orange.repeat(w * h));
|
|
2035
|
+
* if (ok) {
|
|
2036
|
+
* const node = gui.get_node("box_node");
|
|
2232
2037
|
* gui.set_texture(node, "orange_tx");
|
|
2233
2038
|
* }
|
|
2234
2039
|
* ```
|
|
@@ -2242,12 +2047,9 @@ declare global {
|
|
|
2242
2047
|
* @param height - texture height
|
|
2243
2048
|
* @param type - texture type
|
|
2244
2049
|
*
|
|
2245
|
-
* - `"rgb"` - RGB
|
|
2246
|
-
*
|
|
2247
|
-
* - `"
|
|
2248
|
-
*
|
|
2249
|
-
* - `"l"` - LUMINANCE
|
|
2250
|
-
*
|
|
2050
|
+
* - `"rgb"` or `image.TYPE_RGB` - RGB
|
|
2051
|
+
* - `"rgba"` or `image.TYPE_RGBA` - RGBA
|
|
2052
|
+
* - `"l"` or `image.TYPE_LUMINANCE` - LUMINANCE
|
|
2251
2053
|
* - `"astc"` - ASTC compressed format
|
|
2252
2054
|
* @param buffer - texture data
|
|
2253
2055
|
* @param flip - flip texture vertically
|
|
@@ -2281,7 +2083,7 @@ declare global {
|
|
|
2281
2083
|
* });
|
|
2282
2084
|
* ```
|
|
2283
2085
|
*/
|
|
2284
|
-
function set_texture_data(texture: string | Hash, width: number, height: number, type: string |
|
|
2086
|
+
function set_texture_data(texture: string | Hash, width: number, height: number, type: string | image.TYPE, buffer: string, flip?: boolean): boolean;
|
|
2285
2087
|
/**
|
|
2286
2088
|
* Sets the tracking value of a text node. This value is used to
|
|
2287
2089
|
* adjust the vertical spacing of characters in the text.
|
|
@@ -2304,12 +2106,10 @@ declare global {
|
|
|
2304
2106
|
* @param anchor - anchor constant
|
|
2305
2107
|
*
|
|
2306
2108
|
* - `gui.ANCHOR_NONE`
|
|
2307
|
-
*
|
|
2308
2109
|
* - `gui.ANCHOR_LEFT`
|
|
2309
|
-
*
|
|
2310
2110
|
* - `gui.ANCHOR_RIGHT`
|
|
2311
2111
|
*/
|
|
2312
|
-
function set_xanchor(node: Opaque<"node">, anchor: gui.
|
|
2112
|
+
function set_xanchor(node: Opaque<"node">, anchor: gui.ANCHOR): void;
|
|
2313
2113
|
/**
|
|
2314
2114
|
* The y-anchor specifies how the node is moved when the game is run in a different resolution.
|
|
2315
2115
|
*
|
|
@@ -2317,12 +2117,10 @@ declare global {
|
|
|
2317
2117
|
* @param anchor - anchor constant
|
|
2318
2118
|
*
|
|
2319
2119
|
* - `gui.ANCHOR_NONE`
|
|
2320
|
-
*
|
|
2321
2120
|
* - `gui.ANCHOR_TOP`
|
|
2322
|
-
*
|
|
2323
2121
|
* - `gui.ANCHOR_BOTTOM`
|
|
2324
2122
|
*/
|
|
2325
|
-
function set_yanchor(node: Opaque<"node">, anchor: gui.
|
|
2123
|
+
function set_yanchor(node: Opaque<"node">, anchor: gui.ANCHOR): void;
|
|
2326
2124
|
/**
|
|
2327
2125
|
* Shows the on-display touch keyboard.
|
|
2328
2126
|
* The specified type of keyboard is displayed if it is available on
|
|
@@ -2330,31 +2128,21 @@ declare global {
|
|
|
2330
2128
|
* This function is only available on iOS and Android. .
|
|
2331
2129
|
*
|
|
2332
2130
|
* @param type - keyboard type
|
|
2333
|
-
*
|
|
2334
|
-
* - `gui.KEYBOARD_TYPE_DEFAULT`
|
|
2335
|
-
*
|
|
2336
|
-
* - `gui.KEYBOARD_TYPE_EMAIL`
|
|
2337
|
-
*
|
|
2338
|
-
* - `gui.KEYBOARD_TYPE_NUMBER_PAD`
|
|
2339
|
-
*
|
|
2340
|
-
* - `gui.KEYBOARD_TYPE_PASSWORD`
|
|
2341
2131
|
* @param autoclose - if the keyboard should automatically close when clicking outside
|
|
2342
2132
|
*/
|
|
2343
|
-
function show_keyboard(type: gui.
|
|
2133
|
+
function show_keyboard(type: gui.KEYBOARD_TYPE, autoclose: boolean): void;
|
|
2344
2134
|
/**
|
|
2345
2135
|
* Stops the particle fx for a gui node
|
|
2346
2136
|
*
|
|
2347
2137
|
* @param node - node to stop particle fx for
|
|
2348
|
-
* @param options - options when stopping the particle fx
|
|
2349
|
-
*
|
|
2350
|
-
* - boolean `clear`: instantly clear spawned particles
|
|
2138
|
+
* @param options - options used when stopping the particle fx
|
|
2351
2139
|
*/
|
|
2352
|
-
function stop_particlefx(node: Opaque<"node">, options?:
|
|
2140
|
+
function stop_particlefx(node: Opaque<"node">, options?: particlefx.stop_options): void;
|
|
2353
2141
|
/**
|
|
2354
2142
|
* This is a callback-function, which is called by the engine every frame to update the state of a gui component.
|
|
2355
2143
|
* It can be used to perform any kind of gui related tasks, e.g. animating nodes.
|
|
2356
2144
|
*
|
|
2357
|
-
* @param self -
|
|
2145
|
+
* @param self - script instance used for storing state
|
|
2358
2146
|
* @param dt - the time-step of the frame update
|
|
2359
2147
|
* @example
|
|
2360
2148
|
* ```ts
|
|
@@ -2362,15 +2150,17 @@ declare global {
|
|
|
2362
2150
|
* // in a counting fashion. It is assumed that the gui component receives messages
|
|
2363
2151
|
* // from the game when a new score is to be shown.
|
|
2364
2152
|
* export default defineGuiScript({
|
|
2365
|
-
* init(
|
|
2366
|
-
*
|
|
2367
|
-
*
|
|
2368
|
-
*
|
|
2369
|
-
*
|
|
2370
|
-
*
|
|
2371
|
-
*
|
|
2372
|
-
*
|
|
2373
|
-
*
|
|
2153
|
+
* init() {
|
|
2154
|
+
* return {
|
|
2155
|
+
* // fetch the score text node for later use (assumes it is called "score")
|
|
2156
|
+
* score_node: gui.get_node("score"),
|
|
2157
|
+
* // keep track of the current score counted up so far
|
|
2158
|
+
* current_score: 0,
|
|
2159
|
+
* // keep track of the target score we should count up to
|
|
2160
|
+
* target_score: 0,
|
|
2161
|
+
* // how fast we will update the score, in score/second
|
|
2162
|
+
* score_update_speed: 1,
|
|
2163
|
+
* };
|
|
2374
2164
|
* },
|
|
2375
2165
|
*
|
|
2376
2166
|
* update(self, dt) {
|
|
@@ -2389,14 +2179,14 @@ declare global {
|
|
|
2389
2179
|
*
|
|
2390
2180
|
* on_message(self, message_id, message) {
|
|
2391
2181
|
* // check the message
|
|
2392
|
-
* if (message_id === hash("set_score")) {
|
|
2182
|
+
* if (message_id === hash("set_score") && typeof message.score === "number") {
|
|
2393
2183
|
* self.target_score = message.score;
|
|
2394
2184
|
* }
|
|
2395
2185
|
* },
|
|
2396
2186
|
* });
|
|
2397
2187
|
* ```
|
|
2398
2188
|
*/
|
|
2399
|
-
function update(self:
|
|
2189
|
+
function update(self: unknown, dt: number): void;
|
|
2400
2190
|
interface properties {
|
|
2401
2191
|
/**
|
|
2402
2192
|
* The fonts used in the gui. The type of the property is hash.
|