@defold-typescript/types 0.51.0 → 0.53.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 +4 -58
- package/api-signatures.json +2804 -3172
- package/api-targets.json +15 -5
- package/examples/translations.json +19 -71
- package/generated/b2d.d.ts +39 -39
- package/generated/b2d_body.d.ts +11 -11
- package/generated/b2d_chain.d.ts +3 -3
- package/generated/b2d_fixture.d.ts +5 -5
- package/generated/b2d_joint.d.ts +29 -29
- package/generated/b2d_shape.d.ts +13 -13
- package/generated/b2d_world.d.ts +15 -15
- package/generated/buffer.d.ts +10 -11
- package/generated/bullet3d.d.ts +6 -6
- package/generated/bullet3d_collision_object.d.ts +10 -10
- package/generated/bullet3d_constraint.d.ts +173 -71
- package/generated/bullet3d_rigid_body.d.ts +3 -3
- package/generated/bullet3d_shape.d.ts +11 -11
- package/generated/bullet3d_world.d.ts +20 -20
- package/generated/camera.d.ts +4 -4
- package/generated/collectionfactory.d.ts +2 -3
- package/generated/collectionproxy.d.ts +5 -5
- package/generated/compute.d.ts +5 -5
- package/generated/crash.d.ts +7 -7
- package/generated/editor-vm/http.d.ts +13 -13
- package/generated/editor-vm/image.d.ts +4 -4
- package/generated/editor-vm/json.d.ts +1 -1
- package/generated/editor-vm/tilemap_tiles.d.ts +9 -9
- package/generated/editor-vm/zip.d.ts +4 -4
- package/generated/editor.d.ts +183 -183
- package/generated/factory.d.ts +2 -3
- package/generated/font.d.ts +4 -4
- package/generated/go.d.ts +122 -230
- package/generated/graphics.d.ts +23 -25
- package/generated/gui.d.ts +186 -423
- package/generated/http.d.ts +3 -3
- package/generated/image.d.ts +63 -11
- package/generated/json.d.ts +4 -4
- package/generated/kinds/gui-script.d.ts +2 -0
- package/generated/kinds/render-script.d.ts +14 -15
- package/generated/label.d.ts +5 -5
- package/generated/liveupdate.d.ts +7 -3
- package/generated/material.d.ts +49 -49
- package/generated/model.d.ts +46 -14
- package/generated/particlefx.d.ts +24 -5
- package/generated/physics.d.ts +64 -20
- package/generated/profiler.d.ts +3 -5
- package/generated/render-script-modules/b2d.d.ts +711 -0
- package/generated/render-script-modules/bullet3d.d.ts +73 -0
- package/generated/render-script-modules/collectionfactory.d.ts +24 -0
- package/generated/render-script-modules/collectionproxy.d.ts +39 -0
- package/generated/render-script-modules/factory.d.ts +24 -0
- package/generated/render-script-modules/go.d.ts +434 -0
- package/generated/render-script-modules/label.d.ts +105 -0
- package/generated/render-script-modules/model.d.ts +121 -0
- package/generated/render-script-modules/particlefx.d.ts +59 -0
- package/generated/render-script-modules/physics.d.ts +333 -0
- package/generated/render-script-modules/resource.d.ts +1232 -0
- package/generated/render-script-modules/sound.d.ts +227 -0
- package/generated/render-script-modules/sprite.d.ts +68 -0
- package/generated/render-script-modules/tilemap.d.ts +43 -0
- package/generated/render.d.ts +172 -47
- package/generated/resource.d.ts +81 -61
- package/generated/socket.d.ts +18 -23
- package/generated/sound.d.ts +6 -6
- package/generated/sprite.d.ts +51 -3
- package/generated/sys.d.ts +87 -24
- package/generated/tilemap.d.ts +3 -3
- package/generated/timer.d.ts +3 -3
- package/generated/versions/defold-1.12.4/b2d.d.ts +2 -2
- package/generated/versions/defold-1.12.4/b2d_body.d.ts +2 -2
- package/generated/versions/defold-1.12.4/buffer.d.ts +8 -8
- package/generated/versions/defold-1.12.4/go.d.ts +117 -345
- package/generated/versions/defold-1.12.4/graphics.d.ts +2 -1
- package/generated/versions/defold-1.12.4/gui.d.ts +169 -532
- package/generated/versions/defold-1.12.4/http.d.ts +2 -2
- package/generated/versions/defold-1.12.4/image.d.ts +82 -2
- package/generated/versions/defold-1.12.4/index.d.ts +1 -0
- package/generated/versions/defold-1.12.4/label.d.ts +1 -1
- package/generated/versions/defold-1.12.4/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.12.4/model.d.ts +42 -10
- package/generated/versions/defold-1.12.4/particlefx.d.ts +23 -2
- package/generated/versions/defold-1.12.4/physics.d.ts +46 -2
- package/generated/versions/defold-1.12.4/render.d.ts +83 -7
- package/generated/versions/defold-1.12.4/resource.d.ts +50 -17
- package/generated/versions/defold-1.12.4/socket.d.ts +12 -12
- package/generated/versions/defold-1.12.4/sound.d.ts +1 -1
- package/generated/versions/defold-1.12.4/sprite.d.ts +59 -2
- package/generated/versions/defold-1.12.4/sys.d.ts +103 -8
- package/generated/versions/defold-1.12.4/tilemap.d.ts +1 -1
- package/generated/versions/defold-1.12.4/vmath.d.ts +0 -24
- package/generated/versions/defold-1.12.4/window.d.ts +3 -4
- package/generated/versions/defold-1.13.0/b2d.d.ts +2 -2
- package/generated/versions/defold-1.13.0/b2d_body.d.ts +2 -2
- package/generated/versions/defold-1.13.0/b2d_chain.d.ts +1 -1
- package/generated/versions/defold-1.13.0/b2d_joint.d.ts +1 -1
- package/generated/versions/defold-1.13.0/b2d_shape.d.ts +1 -1
- package/generated/versions/defold-1.13.0/buffer.d.ts +8 -8
- package/generated/versions/defold-1.13.0/camera.d.ts +1 -1
- package/generated/versions/defold-1.13.0/go.d.ts +117 -372
- package/generated/versions/defold-1.13.0/graphics.d.ts +2 -1
- package/generated/versions/defold-1.13.0/gui.d.ts +169 -532
- package/generated/versions/defold-1.13.0/http.d.ts +2 -2
- package/generated/versions/defold-1.13.0/image.d.ts +82 -2
- package/generated/versions/defold-1.13.0/index.d.ts +1 -0
- package/generated/versions/defold-1.13.0/label.d.ts +1 -1
- package/generated/versions/defold-1.13.0/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.13.0/material.d.ts +3 -1
- package/generated/versions/defold-1.13.0/model.d.ts +42 -10
- package/generated/versions/defold-1.13.0/particlefx.d.ts +23 -2
- package/generated/versions/defold-1.13.0/physics.d.ts +46 -2
- package/generated/versions/defold-1.13.0/render.d.ts +147 -9
- package/generated/versions/defold-1.13.0/resource.d.ts +50 -17
- package/generated/versions/defold-1.13.0/socket.d.ts +12 -12
- package/generated/versions/defold-1.13.0/sound.d.ts +1 -1
- package/generated/versions/defold-1.13.0/sprite.d.ts +59 -2
- package/generated/versions/defold-1.13.0/sys.d.ts +103 -8
- package/generated/versions/defold-1.13.0/tilemap.d.ts +1 -1
- package/generated/versions/defold-1.13.0/vmath.d.ts +0 -24
- package/generated/versions/defold-1.13.0/window.d.ts +3 -4
- package/generated/versions/defold-1.13.1/b2d.d.ts +2 -2
- package/generated/versions/defold-1.13.1/b2d_body.d.ts +2 -2
- package/generated/versions/defold-1.13.1/b2d_chain.d.ts +1 -1
- package/generated/versions/defold-1.13.1/b2d_joint.d.ts +1 -1
- package/generated/versions/defold-1.13.1/b2d_shape.d.ts +1 -1
- package/generated/versions/defold-1.13.1/buffer.d.ts +8 -8
- package/generated/versions/defold-1.13.1/camera.d.ts +1 -1
- package/generated/versions/defold-1.13.1/go.d.ts +117 -372
- package/generated/versions/defold-1.13.1/graphics.d.ts +2 -1
- package/generated/versions/defold-1.13.1/gui.d.ts +169 -548
- package/generated/versions/defold-1.13.1/http.d.ts +2 -2
- package/generated/versions/defold-1.13.1/image.d.ts +82 -2
- package/generated/versions/defold-1.13.1/index.d.ts +2 -0
- package/generated/versions/defold-1.13.1/label.d.ts +1 -1
- package/generated/versions/defold-1.13.1/liveupdate.d.ts +4 -0
- package/generated/versions/defold-1.13.1/material.d.ts +3 -1
- package/generated/versions/defold-1.13.1/model.d.ts +42 -10
- package/generated/versions/defold-1.13.1/particlefx.d.ts +23 -2
- package/generated/versions/defold-1.13.1/physics.d.ts +46 -2
- package/generated/versions/defold-1.13.1/render.d.ts +147 -9
- package/generated/versions/defold-1.13.1/resource.d.ts +50 -17
- package/generated/versions/defold-1.13.1/socket.d.ts +12 -12
- package/generated/versions/defold-1.13.1/sound.d.ts +1 -1
- package/generated/versions/defold-1.13.1/sprite.d.ts +59 -2
- package/generated/versions/defold-1.13.1/sys.d.ts +103 -8
- package/generated/versions/defold-1.13.1/tilemap.d.ts +1 -1
- package/generated/versions/defold-1.13.1/vmath.d.ts +0 -24
- package/generated/versions/defold-1.13.1/window.d.ts +3 -4
- package/generated/versions/defold-1.13.2/b2d.d.ts +39 -39
- package/generated/versions/defold-1.13.2/b2d_body.d.ts +11 -11
- package/generated/versions/defold-1.13.2/b2d_chain.d.ts +3 -3
- package/generated/versions/defold-1.13.2/b2d_fixture.d.ts +5 -5
- package/generated/versions/defold-1.13.2/b2d_joint.d.ts +29 -29
- package/generated/versions/defold-1.13.2/b2d_shape.d.ts +13 -13
- package/generated/versions/defold-1.13.2/b2d_world.d.ts +15 -15
- package/generated/versions/defold-1.13.2/buffer.d.ts +10 -11
- package/generated/versions/defold-1.13.2/bullet3d.d.ts +6 -6
- package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +10 -10
- package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +173 -71
- package/generated/versions/defold-1.13.2/bullet3d_rigid_body.d.ts +3 -3
- package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +11 -11
- package/generated/versions/defold-1.13.2/bullet3d_world.d.ts +20 -20
- package/generated/versions/defold-1.13.2/camera.d.ts +4 -4
- package/generated/versions/defold-1.13.2/collectionfactory.d.ts +2 -3
- package/generated/versions/defold-1.13.2/collectionproxy.d.ts +5 -5
- package/generated/versions/defold-1.13.2/compute.d.ts +5 -5
- package/generated/versions/defold-1.13.2/crash.d.ts +7 -7
- package/generated/versions/defold-1.13.2/editor-vm/http.d.ts +13 -13
- package/generated/versions/defold-1.13.2/editor-vm/image.d.ts +4 -4
- package/generated/versions/defold-1.13.2/editor-vm/json.d.ts +1 -1
- package/generated/versions/defold-1.13.2/editor-vm/tilemap_tiles.d.ts +9 -9
- package/generated/versions/defold-1.13.2/editor-vm/zip.d.ts +4 -4
- package/generated/versions/defold-1.13.2/editor.d.ts +183 -183
- package/generated/versions/defold-1.13.2/factory.d.ts +2 -3
- package/generated/versions/defold-1.13.2/font.d.ts +4 -4
- package/generated/versions/defold-1.13.2/go.d.ts +122 -230
- package/generated/versions/defold-1.13.2/graphics.d.ts +22 -24
- package/generated/versions/defold-1.13.2/gui.d.ts +186 -423
- package/generated/versions/defold-1.13.2/http.d.ts +3 -3
- package/generated/versions/defold-1.13.2/image.d.ts +63 -11
- package/generated/versions/defold-1.13.2/index.d.ts +2 -0
- package/generated/versions/defold-1.13.2/json.d.ts +4 -4
- package/generated/versions/defold-1.13.2/label.d.ts +5 -5
- package/generated/versions/defold-1.13.2/liveupdate.d.ts +7 -3
- package/generated/versions/defold-1.13.2/material.d.ts +49 -49
- package/generated/versions/defold-1.13.2/model.d.ts +46 -14
- package/generated/versions/defold-1.13.2/particlefx.d.ts +24 -5
- package/generated/versions/defold-1.13.2/physics.d.ts +64 -20
- package/generated/versions/defold-1.13.2/profiler.d.ts +3 -5
- package/generated/versions/defold-1.13.2/render.d.ts +161 -46
- package/generated/versions/defold-1.13.2/resource.d.ts +81 -61
- package/generated/versions/defold-1.13.2/socket.d.ts +18 -23
- package/generated/versions/defold-1.13.2/sound.d.ts +6 -6
- package/generated/versions/defold-1.13.2/sprite.d.ts +51 -3
- package/generated/versions/defold-1.13.2/sys.d.ts +87 -24
- package/generated/versions/defold-1.13.2/tilemap.d.ts +3 -3
- package/generated/versions/defold-1.13.2/timer.d.ts +3 -3
- package/generated/versions/defold-1.13.2/vmath.d.ts +0 -25
- package/generated/versions/defold-1.13.2/window.d.ts +8 -10
- package/generated/vmath.d.ts +0 -25
- package/generated/window.d.ts +8 -10
- package/identity-vocabulary.json +86 -34
- package/index.d.ts +2 -0
- package/package.json +3 -1
- package/scripts/generate-api-availability.ts +10 -24
- package/scripts/generate-api-signatures.ts +75 -14
- package/scripts/materialize-version.ts +48 -7
- package/scripts/regen.ts +214 -19
- package/scripts/shared-handle-methods.ts +3 -2
- package/scripts/signature-store-fs.ts +1 -0
- package/scripts/target-version.ts +26 -0
- package/src/api-doc.ts +34 -0
- package/src/api-identity.ts +32 -1
- package/src/component-properties.d.ts +96 -7
- package/src/core-types.ts +71 -28
- package/src/doc-corrections.ts +62 -5
- package/src/emit-dts.ts +1423 -401
- package/src/engine-globals.d.ts +5 -1
- package/src/engine-type-name.ts +33 -0
- package/src/go-overloads.d.ts +74 -19
- package/src/gui-overloads.d.ts +489 -0
- package/src/gui-texture-removal.d.ts +41 -0
- package/src/index.ts +3 -0
- package/src/lifecycle.ts +32 -23
- package/src/msg-overloads.d.ts +25 -13
- package/src/signature-store.ts +50 -0
- package/src/socket-types.d.ts +3 -3
- package/src/timers.d.ts +2 -1
- package/src/vmath-overloads.d.ts +26 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
-
import type { Hash,
|
|
2
|
+
import type { Hash, Opaque, Quaternion, Vector3, Vector4 } from "../../../src/core-types";
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
5
|
/**
|
|
@@ -9,7 +9,7 @@ declare global {
|
|
|
9
9
|
/**
|
|
10
10
|
* Rich-text layout object
|
|
11
11
|
*/
|
|
12
|
-
interface
|
|
12
|
+
interface LayoutObject {
|
|
13
13
|
/**
|
|
14
14
|
* object type, currently `link` or `sprite`
|
|
15
15
|
*/
|
|
@@ -47,11 +47,11 @@ declare global {
|
|
|
47
47
|
*/
|
|
48
48
|
attributes: LuaTable<string, string>;
|
|
49
49
|
}
|
|
50
|
-
type
|
|
50
|
+
type Node = Opaque<"node">;
|
|
51
51
|
/**
|
|
52
52
|
* GUI flipbook playback properties
|
|
53
53
|
*/
|
|
54
|
-
interface
|
|
54
|
+
interface PlayProperties {
|
|
55
55
|
/**
|
|
56
56
|
* Normalized initial animation cursor.
|
|
57
57
|
*/
|
|
@@ -64,7 +64,7 @@ declare global {
|
|
|
64
64
|
/**
|
|
65
65
|
* Generic GUI property options
|
|
66
66
|
*/
|
|
67
|
-
interface
|
|
67
|
+
interface SetOptions {
|
|
68
68
|
/**
|
|
69
69
|
* One-based material-constant array index.
|
|
70
70
|
*/
|
|
@@ -74,34 +74,20 @@ declare global {
|
|
|
74
74
|
*/
|
|
75
75
|
key?: string | Hash;
|
|
76
76
|
}
|
|
77
|
-
type
|
|
78
|
-
type
|
|
77
|
+
type Adjust = typeof gui.ADJUST_FIT | typeof gui.ADJUST_STRETCH | typeof gui.ADJUST_ZOOM;
|
|
78
|
+
type Anchor = typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_RIGHT | typeof gui.ANCHOR_TOP;
|
|
79
|
+
type Blend = typeof gui.BLEND_ADD | typeof gui.BLEND_ADD_ALPHA | typeof gui.BLEND_ALPHA | typeof gui.BLEND_MULT | typeof gui.BLEND_SCREEN;
|
|
79
80
|
type ClippingMode = typeof gui.CLIPPING_MODE_NONE | typeof gui.CLIPPING_MODE_STENCIL;
|
|
80
81
|
type Easing = typeof gui.EASING_INBACK | typeof gui.EASING_INBOUNCE | typeof gui.EASING_INCIRC | typeof gui.EASING_INCUBIC | typeof gui.EASING_INELASTIC | typeof gui.EASING_INEXPO | typeof gui.EASING_INOUTBACK | typeof gui.EASING_INOUTBOUNCE | typeof gui.EASING_INOUTCIRC | typeof gui.EASING_INOUTCUBIC | typeof gui.EASING_INOUTELASTIC | typeof gui.EASING_INOUTEXPO | typeof gui.EASING_INOUTQUAD | typeof gui.EASING_INOUTQUART | typeof gui.EASING_INOUTQUINT | typeof gui.EASING_INOUTSINE | typeof gui.EASING_INQUAD | typeof gui.EASING_INQUART | typeof gui.EASING_INQUINT | typeof gui.EASING_INSINE | typeof gui.EASING_LINEAR | typeof gui.EASING_OUTBACK | typeof gui.EASING_OUTBOUNCE | typeof gui.EASING_OUTCIRC | typeof gui.EASING_OUTCUBIC | typeof gui.EASING_OUTELASTIC | typeof gui.EASING_OUTEXPO | typeof gui.EASING_OUTINBACK | typeof gui.EASING_OUTINBOUNCE | typeof gui.EASING_OUTINCIRC | typeof gui.EASING_OUTINCUBIC | typeof gui.EASING_OUTINELASTIC | typeof gui.EASING_OUTINEXPO | typeof gui.EASING_OUTINQUAD | typeof gui.EASING_OUTINQUART | typeof gui.EASING_OUTINQUINT | typeof gui.EASING_OUTINSINE | typeof gui.EASING_OUTQUAD | typeof gui.EASING_OUTQUART | typeof gui.EASING_OUTQUINT | typeof gui.EASING_OUTSINE;
|
|
81
82
|
type KeyboardType = typeof gui.KEYBOARD_TYPE_DEFAULT | typeof gui.KEYBOARD_TYPE_EMAIL | typeof gui.KEYBOARD_TYPE_NUMBER_PAD | typeof gui.KEYBOARD_TYPE_PASSWORD;
|
|
82
|
-
type
|
|
83
|
-
type
|
|
84
|
-
type
|
|
85
|
-
type
|
|
86
|
-
type
|
|
87
|
-
type
|
|
88
|
-
type SizeMode = typeof gui.
|
|
89
|
-
type
|
|
90
|
-
type YAnchor = typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_TOP | typeof gui.ANCHOR_BOTTOM;
|
|
91
|
-
type ADJUST = typeof gui.ADJUST_FIT | typeof gui.ADJUST_STRETCH | typeof gui.ADJUST_ZOOM;
|
|
92
|
-
type ANCHOR = typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_RIGHT | typeof gui.ANCHOR_TOP;
|
|
93
|
-
type BLEND = typeof gui.BLEND_ADD | typeof gui.BLEND_ADD_ALPHA | typeof gui.BLEND_ALPHA | typeof gui.BLEND_MULT | typeof gui.BLEND_SCREEN;
|
|
94
|
-
type CLIPPING_MODE = typeof gui.CLIPPING_MODE_NONE | typeof gui.CLIPPING_MODE_STENCIL;
|
|
95
|
-
type EASING = typeof gui.EASING_INBACK | typeof gui.EASING_INBOUNCE | typeof gui.EASING_INCIRC | typeof gui.EASING_INCUBIC | typeof gui.EASING_INELASTIC | typeof gui.EASING_INEXPO | typeof gui.EASING_INOUTBACK | typeof gui.EASING_INOUTBOUNCE | typeof gui.EASING_INOUTCIRC | typeof gui.EASING_INOUTCUBIC | typeof gui.EASING_INOUTELASTIC | typeof gui.EASING_INOUTEXPO | typeof gui.EASING_INOUTQUAD | typeof gui.EASING_INOUTQUART | typeof gui.EASING_INOUTQUINT | typeof gui.EASING_INOUTSINE | typeof gui.EASING_INQUAD | typeof gui.EASING_INQUART | typeof gui.EASING_INQUINT | typeof gui.EASING_INSINE | typeof gui.EASING_LINEAR | typeof gui.EASING_OUTBACK | typeof gui.EASING_OUTBOUNCE | typeof gui.EASING_OUTCIRC | typeof gui.EASING_OUTCUBIC | typeof gui.EASING_OUTELASTIC | typeof gui.EASING_OUTEXPO | typeof gui.EASING_OUTINBACK | typeof gui.EASING_OUTINBOUNCE | typeof gui.EASING_OUTINCIRC | typeof gui.EASING_OUTINCUBIC | typeof gui.EASING_OUTINELASTIC | typeof gui.EASING_OUTINEXPO | typeof gui.EASING_OUTINQUAD | typeof gui.EASING_OUTINQUART | typeof gui.EASING_OUTINQUINT | typeof gui.EASING_OUTINSINE | typeof gui.EASING_OUTQUAD | typeof gui.EASING_OUTQUART | typeof gui.EASING_OUTQUINT | typeof gui.EASING_OUTSINE;
|
|
96
|
-
type KEYBOARD_TYPE = typeof gui.KEYBOARD_TYPE_DEFAULT | typeof gui.KEYBOARD_TYPE_EMAIL | typeof gui.KEYBOARD_TYPE_NUMBER_PAD | typeof gui.KEYBOARD_TYPE_PASSWORD;
|
|
97
|
-
type PIEBOUNDS = typeof gui.PIEBOUNDS_ELLIPSE | typeof gui.PIEBOUNDS_RECTANGLE;
|
|
98
|
-
type PIVOT = typeof gui.PIVOT_CENTER | typeof gui.PIVOT_E | typeof gui.PIVOT_N | typeof gui.PIVOT_NE | typeof gui.PIVOT_NW | typeof gui.PIVOT_S | typeof gui.PIVOT_SE | typeof gui.PIVOT_SW | typeof gui.PIVOT_W;
|
|
99
|
-
type PLAYBACK = typeof gui.PLAYBACK_LOOP_BACKWARD | typeof gui.PLAYBACK_LOOP_FORWARD | typeof gui.PLAYBACK_LOOP_PINGPONG | typeof gui.PLAYBACK_ONCE_BACKWARD | typeof gui.PLAYBACK_ONCE_FORWARD | typeof gui.PLAYBACK_ONCE_PINGPONG;
|
|
100
|
-
type PROP = typeof gui.PROP_COLOR | typeof gui.PROP_EULER | typeof gui.PROP_FILL_ANGLE | typeof gui.PROP_INNER_RADIUS | typeof gui.PROP_LEADING | typeof gui.PROP_OUTLINE | typeof gui.PROP_POSITION | typeof gui.PROP_ROTATION | typeof gui.PROP_SCALE | typeof gui.PROP_SHADOW | typeof gui.PROP_SIZE | typeof gui.PROP_SLICE9 | typeof gui.PROP_TRACKING;
|
|
101
|
-
type RESULT = typeof gui.RESULT_DATA_ERROR | typeof gui.RESULT_OUT_OF_RESOURCES | typeof gui.RESULT_TEXTURE_ALREADY_EXISTS;
|
|
102
|
-
type SAFE_AREA = typeof gui.SAFE_AREA_BOTH | typeof gui.SAFE_AREA_LONG | typeof gui.SAFE_AREA_NONE | typeof gui.SAFE_AREA_SHORT;
|
|
103
|
-
type SIZE_MODE = typeof gui.SIZE_MODE_AUTO | typeof gui.SIZE_MODE_MANUAL;
|
|
104
|
-
type TYPE = typeof gui.TYPE_BOX | typeof gui.TYPE_CUSTOM | typeof gui.TYPE_PARTICLEFX | typeof gui.TYPE_PIE | typeof gui.TYPE_TEXT;
|
|
83
|
+
type PieBounds = typeof gui.PIEBOUNDS_ELLIPSE | typeof gui.PIEBOUNDS_RECTANGLE;
|
|
84
|
+
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;
|
|
85
|
+
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;
|
|
86
|
+
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;
|
|
87
|
+
type Result = typeof gui.RESULT_DATA_ERROR | typeof gui.RESULT_OUT_OF_RESOURCES | typeof gui.RESULT_TEXTURE_ALREADY_EXISTS;
|
|
88
|
+
type SafeArea = typeof gui.SAFE_AREA_BOTH | typeof gui.SAFE_AREA_LONG | typeof gui.SAFE_AREA_NONE | typeof gui.SAFE_AREA_SHORT;
|
|
89
|
+
type SizeMode = typeof gui.SIZE_MODE_AUTO | typeof gui.SIZE_MODE_MANUAL;
|
|
90
|
+
type Type = typeof gui.TYPE_BOX | typeof gui.TYPE_CUSTOM | typeof gui.TYPE_PARTICLEFX | typeof gui.TYPE_PIE | typeof gui.TYPE_TEXT;
|
|
105
91
|
/**
|
|
106
92
|
* fit adjust mode Adjust mode is used when the screen resolution differs from the project settings. The fit mode ensures that the entire node is visible in the adjusted gui scene.
|
|
107
93
|
*/
|
|
@@ -518,83 +504,6 @@ declare global {
|
|
|
518
504
|
* text type
|
|
519
505
|
*/
|
|
520
506
|
const TYPE_TEXT: number & { readonly __brand: "gui.TYPE_TEXT" };
|
|
521
|
-
/**
|
|
522
|
-
* This starts an animation of a node property according to the specified parameters.
|
|
523
|
-
* If the node property is already being animated, that animation will be canceled and
|
|
524
|
-
* replaced by the new one. Note however that several different node properties
|
|
525
|
-
* can be animated simultaneously. Use `gui.cancel_animations` to stop the animation
|
|
526
|
-
* before it has completed.
|
|
527
|
-
* Composite properties of type vector3, vector4 or quaternion
|
|
528
|
-
* also expose their sub-components (x, y, z and w).
|
|
529
|
-
* You can address the components individually by suffixing the name with a dot '.'
|
|
530
|
-
* and the name of the component.
|
|
531
|
-
* For instance, `"position.x"` (the position x coordinate) or `"color.w"`
|
|
532
|
-
* (the color alpha value).
|
|
533
|
-
* If a `complete_function` (Lua function) is specified, that function will be called
|
|
534
|
-
* when the animation has completed.
|
|
535
|
-
* By starting a new animation in that function, several animations can be sequenced
|
|
536
|
-
* together. See the examples below for more information.
|
|
537
|
-
*
|
|
538
|
-
* @param node - node to animate
|
|
539
|
-
* @param property - property to animate; each gui.PROP member equals its corresponding property name string
|
|
540
|
-
* @param to - target property value
|
|
541
|
-
* @param easing - easing to use during animation.
|
|
542
|
-
* Either specify one of the `gui.EASING_*` constants or provide a
|
|
543
|
-
* vector with a custom curve. See the animation guide for more information.
|
|
544
|
-
* @param duration - duration of the animation in seconds.
|
|
545
|
-
* @param delay - delay before the animation starts in seconds.
|
|
546
|
-
* @param complete_function - function to call when the
|
|
547
|
-
* animation has completed
|
|
548
|
-
* @param playback - playback mode
|
|
549
|
-
* @example
|
|
550
|
-
* How to start a simple color animation, where the node fades in to white during 0.5 seconds:
|
|
551
|
-
* ```ts
|
|
552
|
-
* // How to start a simple color animation, where the node fades in to white during 0.5 seconds:
|
|
553
|
-
* const node = gui.get_node("my_node");
|
|
554
|
-
* gui.set_color(node, vmath.vector4(0, 0, 0, 0)); // node is fully transparent
|
|
555
|
-
* gui.animate(node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5); // start animation
|
|
556
|
-
* ```
|
|
557
|
-
* @example
|
|
558
|
-
* How to start a sequenced animation where the node fades in to white during 0.5 seconds, stays visible for 2 seconds and then fades out:
|
|
559
|
-
* ```ts
|
|
560
|
-
* // How to start a sequenced animation where the node fades in to white during 0.5
|
|
561
|
-
* // seconds, stays visible for 2 seconds and then fades out:
|
|
562
|
-
* function on_animation_done(self: unknown, node: unknown) {
|
|
563
|
-
* // fade out node, but wait 2 seconds before the animation starts
|
|
564
|
-
* gui.animate(node as Opaque<"node">, gui.PROP_COLOR, vmath.vector4(0, 0, 0, 0), gui.EASING_OUTQUAD, 0.5, 2.0);
|
|
565
|
-
* }
|
|
566
|
-
*
|
|
567
|
-
* export default defineGuiScript({
|
|
568
|
-
* init(self) {
|
|
569
|
-
* // fetch the node we want to animate
|
|
570
|
-
* const my_node = gui.get_node("my_node");
|
|
571
|
-
* // node is initially set to fully transparent
|
|
572
|
-
* gui.set_color(my_node, vmath.vector4(0, 0, 0, 0));
|
|
573
|
-
* // animate the node immediately and call on_animation_done when the animation has completed
|
|
574
|
-
* gui.animate(my_node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5, 0.0, on_animation_done);
|
|
575
|
-
* },
|
|
576
|
-
* });
|
|
577
|
-
* ```
|
|
578
|
-
* @example
|
|
579
|
-
* How to animate a node's y position using a crazy custom easing curve:
|
|
580
|
-
* ```ts
|
|
581
|
-
* // How to animate a node's y position using a crazy custom easing curve:
|
|
582
|
-
* export default defineGuiScript({
|
|
583
|
-
* init(self) {
|
|
584
|
-
* const values = [
|
|
585
|
-
* 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
586
|
-
* 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
587
|
-
* 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
588
|
-
* 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
589
|
-
* ];
|
|
590
|
-
* const vec = vmath.vector(values);
|
|
591
|
-
* const node = gui.get_node("box");
|
|
592
|
-
* gui.animate(node, "position.y", 100, vec, 4.0, 0, undefined, gui.PLAYBACK_LOOP_PINGPONG);
|
|
593
|
-
* },
|
|
594
|
-
* });
|
|
595
|
-
* ```
|
|
596
|
-
*/
|
|
597
|
-
function animate(node: Opaque<"node">, property: string | Hash | gui.PROP, to: number | Vector3 | Vector4 | Quaternion, easing: gui.EASING | Vector, duration: number, delay?: number, complete_function?: (self: unknown, node: Opaque<"node">) => void, playback?: gui.PLAYBACK): void;
|
|
598
507
|
/**
|
|
599
508
|
* If one or more animations of the specified node is currently running (started by `gui.animate`), they will immediately be canceled.
|
|
600
509
|
*
|
|
@@ -638,7 +547,7 @@ declare global {
|
|
|
638
547
|
* gui.cancel_animations(node);
|
|
639
548
|
* ```
|
|
640
549
|
*/
|
|
641
|
-
function cancel_animations(node: Opaque<"node">, property?: string | Hash | gui.
|
|
550
|
+
function cancel_animations(node: Opaque<"node">, property?: string | Hash | gui.Prop): void;
|
|
642
551
|
/**
|
|
643
552
|
* Cancels any running flipbook animation on the specified node.
|
|
644
553
|
*
|
|
@@ -665,10 +574,10 @@ declare global {
|
|
|
665
574
|
* Make a clone instance of a node and all its children.
|
|
666
575
|
* Use gui.clone to clone a node excluding its children.
|
|
667
576
|
*
|
|
668
|
-
* @param node - root node to clone
|
|
577
|
+
* @param node - root node to clone, or `nil` to clone the whole scene; leaving the argument out raises an error
|
|
669
578
|
* @returns a table mapping node ids to the corresponding cloned nodes
|
|
670
579
|
*/
|
|
671
|
-
function clone_tree(node: Opaque<"node">): LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> };
|
|
580
|
+
function clone_tree(node: Opaque<"node"> | undefined): LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> };
|
|
672
581
|
/**
|
|
673
582
|
* Deletes the specified node. Any child nodes of the specified node will be
|
|
674
583
|
* recursively deleted.
|
|
@@ -703,66 +612,6 @@ declare global {
|
|
|
703
612
|
* ```
|
|
704
613
|
*/
|
|
705
614
|
function delete_texture(texture: string | Hash): void;
|
|
706
|
-
/**
|
|
707
|
-
* This is a callback-function, which is called by the engine when a gui component is finalized (destroyed). It can
|
|
708
|
-
* be used to e.g. take some last action, report the finalization to other game object instances
|
|
709
|
-
* or release user input focus (see `release_input_focus`). There is no use in starting any animations or similar
|
|
710
|
-
* from this function since the gui component is about to be destroyed.
|
|
711
|
-
*
|
|
712
|
-
* @param self - script instance used for storing state
|
|
713
|
-
* @example
|
|
714
|
-
* ```ts
|
|
715
|
-
* export default defineScript({
|
|
716
|
-
* init() {
|
|
717
|
-
* return { some_value: 0 };
|
|
718
|
-
* },
|
|
719
|
-
*
|
|
720
|
-
* final(self) {
|
|
721
|
-
* // report finalization
|
|
722
|
-
* msg.post("my_friend_instance", "im_dead", { my_stats: self.some_value });
|
|
723
|
-
* },
|
|
724
|
-
* });
|
|
725
|
-
* ```
|
|
726
|
-
*/
|
|
727
|
-
function final(self: unknown): void;
|
|
728
|
-
/**
|
|
729
|
-
* Instead of using specific getters such as gui.get_position or gui.get_scale,
|
|
730
|
-
* you can use gui.get instead and supply the property as a string or a hash.
|
|
731
|
-
* While this function is similar to go.get, there are a few more restrictions
|
|
732
|
-
* when operating in the gui namespace. Most notably, only these explicitly named properties are supported:
|
|
733
|
-
*
|
|
734
|
-
* - `"position"`
|
|
735
|
-
* - `"rotation"`
|
|
736
|
-
* - `"euler"`
|
|
737
|
-
* - `"scale"`
|
|
738
|
-
* - `"color"`
|
|
739
|
-
* - `"outline"`
|
|
740
|
-
* - `"shadow"`
|
|
741
|
-
* - `"size"`
|
|
742
|
-
* - `"fill_angle"` (pie)
|
|
743
|
-
* - `"inner_radius"` (pie)
|
|
744
|
-
* - `"leading"` (text)
|
|
745
|
-
* - `"tracking"` (text)
|
|
746
|
-
* - `"slice9"` (slice9)
|
|
747
|
-
*
|
|
748
|
-
* The value returned will either be a vmath.vector4 or a single number, i.e getting the "position"
|
|
749
|
-
* property will return a vec4 while getting the "position.x" property will return a single value.
|
|
750
|
-
* You can also use this function to get material constants.
|
|
751
|
-
*
|
|
752
|
-
* @param node - node to get the property for
|
|
753
|
-
* @param property - the property to retrieve
|
|
754
|
-
* @param options - optional options table (only applicable for material constants)
|
|
755
|
-
* - `index` integer index into array property (1 based)
|
|
756
|
-
*
|
|
757
|
-
* **⚠️ `index` is 1-based; passed to Defold unchanged.**
|
|
758
|
-
* @example
|
|
759
|
-
* ```ts
|
|
760
|
-
* // Get properties on existing nodes:
|
|
761
|
-
* const node = gui.get_node("my_box_node");
|
|
762
|
-
* const node_position = gui.get(node, "position");
|
|
763
|
-
* ```
|
|
764
|
-
*/
|
|
765
|
-
function get(node: Opaque<"node">, property: string | Hash | gui.PROP, options?: { index?: number; key?: string | Hash; keys?: (Hash | string)[] }): unknown;
|
|
766
615
|
/**
|
|
767
616
|
* Returns the adjust mode of a node.
|
|
768
617
|
* The adjust mode defines how the node will adjust itself to screen
|
|
@@ -771,7 +620,7 @@ declare global {
|
|
|
771
620
|
* @param node - node from which to get the adjust mode (node)
|
|
772
621
|
* @returns the current adjust mode
|
|
773
622
|
*/
|
|
774
|
-
function get_adjust_mode(node: Opaque<"node">): gui.
|
|
623
|
+
function get_adjust_mode(node: Opaque<"node">): gui.Adjust;
|
|
775
624
|
/**
|
|
776
625
|
* gets the node alpha
|
|
777
626
|
*
|
|
@@ -786,7 +635,7 @@ declare global {
|
|
|
786
635
|
* @param node - node from which to get the blend mode
|
|
787
636
|
* @returns blend mode
|
|
788
637
|
*/
|
|
789
|
-
function get_blend_mode(node: Opaque<"node">): gui.
|
|
638
|
+
function get_blend_mode(node: Opaque<"node">): gui.Blend;
|
|
790
639
|
/**
|
|
791
640
|
* If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
|
|
792
641
|
*
|
|
@@ -803,7 +652,7 @@ declare global {
|
|
|
803
652
|
* - `gui.CLIPPING_MODE_NONE`
|
|
804
653
|
* - `gui.CLIPPING_MODE_STENCIL`
|
|
805
654
|
*/
|
|
806
|
-
function get_clipping_mode(node: Opaque<"node">): gui.
|
|
655
|
+
function get_clipping_mode(node: Opaque<"node">): gui.ClippingMode;
|
|
807
656
|
/**
|
|
808
657
|
* If node is set as visible clipping node, it will be shown as well as clipping. Otherwise, it will only clip but not show visually.
|
|
809
658
|
*
|
|
@@ -974,7 +823,7 @@ declare global {
|
|
|
974
823
|
* @param node - text node to inspect
|
|
975
824
|
* @returns layout objects in source order. **0️⃣ `text_offset` is 0-based; passed to Defold unchanged.**
|
|
976
825
|
*/
|
|
977
|
-
function get_layout_objects(node: Opaque<"node">): gui.
|
|
826
|
+
function get_layout_objects(node: Opaque<"node">): gui.LayoutObject[];
|
|
978
827
|
/**
|
|
979
828
|
* Returns a table mapping each layout id hash to a vector3(width, height, 0). For the default layout,
|
|
980
829
|
* the current scene resolution is returned. If a layout name is not present in the Display Profiles (or when
|
|
@@ -1034,7 +883,7 @@ declare global {
|
|
|
1034
883
|
* @param node - node from where to get the outer bounds mode
|
|
1035
884
|
* @returns the outer bounds mode of the pie node
|
|
1036
885
|
*/
|
|
1037
|
-
function get_outer_bounds(node: Opaque<"node">): gui.
|
|
886
|
+
function get_outer_bounds(node: Opaque<"node">): gui.PieBounds;
|
|
1038
887
|
/**
|
|
1039
888
|
* Returns the outline color of the supplied node.
|
|
1040
889
|
* See gui.get_color for info how vectors encode color values.
|
|
@@ -1082,7 +931,7 @@ declare global {
|
|
|
1082
931
|
* - `gui.PIVOT_W`
|
|
1083
932
|
* - `gui.PIVOT_NW`
|
|
1084
933
|
*/
|
|
1085
|
-
function get_pivot(node: Opaque<"node">): gui.
|
|
934
|
+
function get_pivot(node: Opaque<"node">): gui.Pivot;
|
|
1086
935
|
/**
|
|
1087
936
|
* Returns the position of the supplied node.
|
|
1088
937
|
*
|
|
@@ -1140,7 +989,7 @@ declare global {
|
|
|
1140
989
|
* @param node - node from which to get the size mode (node)
|
|
1141
990
|
* @returns the current size mode
|
|
1142
991
|
*/
|
|
1143
|
-
function get_size_mode(node: Opaque<"node">): gui.
|
|
992
|
+
function get_size_mode(node: Opaque<"node">): gui.SizeMode;
|
|
1144
993
|
/**
|
|
1145
994
|
* Returns the slice9 configuration values for the node.
|
|
1146
995
|
*
|
|
@@ -1174,16 +1023,16 @@ declare global {
|
|
|
1174
1023
|
/**
|
|
1175
1024
|
* Get a node and all its children as a Lua table.
|
|
1176
1025
|
*
|
|
1177
|
-
* @param node - root node to get node tree from
|
|
1026
|
+
* @param node - root node to get node tree from, or `nil` to get the whole scene; leaving the argument out raises an error
|
|
1178
1027
|
* @returns a table mapping node ids to the corresponding nodes
|
|
1179
1028
|
*/
|
|
1180
|
-
function get_tree(node: Opaque<"node">): LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> };
|
|
1029
|
+
function get_tree(node: Opaque<"node"> | undefined): LuaTable<Hash, Opaque<"node">> & { get: LuaTableGetMethod<string, Opaque<"node">> };
|
|
1181
1030
|
/**
|
|
1182
1031
|
* gets the node type
|
|
1183
1032
|
*
|
|
1184
1033
|
* @param node - node from which to get the type
|
|
1185
1034
|
*/
|
|
1186
|
-
function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.
|
|
1035
|
+
function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.Type, number | undefined]>;
|
|
1187
1036
|
/**
|
|
1188
1037
|
* Returns `true` if a node is visible and `false` if it's not.
|
|
1189
1038
|
* Invisible nodes are not rendered.
|
|
@@ -1208,7 +1057,7 @@ declare global {
|
|
|
1208
1057
|
* - `gui.ANCHOR_LEFT`
|
|
1209
1058
|
* - `gui.ANCHOR_RIGHT`
|
|
1210
1059
|
*/
|
|
1211
|
-
function get_xanchor(node: Opaque<"node">): gui.
|
|
1060
|
+
function get_xanchor(node: Opaque<"node">): Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>;
|
|
1212
1061
|
/**
|
|
1213
1062
|
* The y-anchor specifies how the node is moved when the game is run in a different resolution.
|
|
1214
1063
|
*
|
|
@@ -1219,27 +1068,11 @@ declare global {
|
|
|
1219
1068
|
* - `gui.ANCHOR_TOP`
|
|
1220
1069
|
* - `gui.ANCHOR_BOTTOM`
|
|
1221
1070
|
*/
|
|
1222
|
-
function get_yanchor(node: Opaque<"node">): gui.
|
|
1071
|
+
function get_yanchor(node: Opaque<"node">): Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>;
|
|
1223
1072
|
/**
|
|
1224
1073
|
* Hides the on-display touch keyboard on the device.
|
|
1225
1074
|
*/
|
|
1226
1075
|
function hide_keyboard(): void;
|
|
1227
|
-
/**
|
|
1228
|
-
* This is a callback-function, which is called by the engine when a gui component is initialized. It can be used
|
|
1229
|
-
* to set the initial state of the script and gui scene.
|
|
1230
|
-
*
|
|
1231
|
-
* @param self - script instance used for storing state
|
|
1232
|
-
* @example
|
|
1233
|
-
* ```ts
|
|
1234
|
-
* export default defineScript({
|
|
1235
|
-
* init() {
|
|
1236
|
-
* // set up useful data
|
|
1237
|
-
* return { my_value: 1 };
|
|
1238
|
-
* },
|
|
1239
|
-
* });
|
|
1240
|
-
* ```
|
|
1241
|
-
*/
|
|
1242
|
-
function init(self: unknown): void;
|
|
1243
1076
|
/**
|
|
1244
1077
|
* Returns `true` if a node is enabled and `false` if it's not.
|
|
1245
1078
|
* Disabled nodes are not rendered and animations acting on them are not evaluated.
|
|
@@ -1357,76 +1190,66 @@ declare global {
|
|
|
1357
1190
|
* }
|
|
1358
1191
|
* ```
|
|
1359
1192
|
*/
|
|
1360
|
-
function new_texture(texture_id: string | Hash, width: number, height: number, type: string | image.
|
|
1361
|
-
/**
|
|
1362
|
-
*
|
|
1363
|
-
*
|
|
1364
|
-
*
|
|
1365
|
-
*
|
|
1366
|
-
*
|
|
1367
|
-
*
|
|
1368
|
-
*
|
|
1369
|
-
*
|
|
1370
|
-
*
|
|
1371
|
-
*
|
|
1372
|
-
*
|
|
1373
|
-
* @param
|
|
1374
|
-
* @param
|
|
1375
|
-
* @param action - input data for the action. **0️⃣ `gamepad` is 0-based; passed to Defold unchanged.**
|
|
1376
|
-
* @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
|
|
1193
|
+
function new_texture(texture_id: string | Hash, width: number, height: number, type: string | image.Type, buffer: string): LuaMultiReturn<[boolean, gui.Result | undefined]>;
|
|
1194
|
+
/**
|
|
1195
|
+
* Dynamically create a new texture.
|
|
1196
|
+
*
|
|
1197
|
+
* @param texture_id - texture id
|
|
1198
|
+
* @param width - texture width
|
|
1199
|
+
* @param height - texture height
|
|
1200
|
+
* @param type - texture type
|
|
1201
|
+
*
|
|
1202
|
+
* - `"rgb"` or `image.TYPE_RGB` - RGB
|
|
1203
|
+
* - `"rgba"` or `image.TYPE_RGBA` - RGBA
|
|
1204
|
+
* - `"l"` or `image.TYPE_LUMINANCE` - LUMINANCE
|
|
1205
|
+
* - `"astc"` - ASTC compressed format
|
|
1206
|
+
* @param buffer - texture data
|
|
1207
|
+
* @param flip - flip texture vertically
|
|
1377
1208
|
* @example
|
|
1209
|
+
* How to create a texture and apply it to a new box node:
|
|
1378
1210
|
* ```ts
|
|
1379
1211
|
* export default defineGuiScript({
|
|
1380
|
-
* init()
|
|
1381
|
-
*
|
|
1382
|
-
*
|
|
1212
|
+
* init(self) {
|
|
1213
|
+
* const w = 200;
|
|
1214
|
+
* const h = 300;
|
|
1383
1215
|
*
|
|
1384
|
-
*
|
|
1385
|
-
*
|
|
1386
|
-
*
|
|
1387
|
-
*
|
|
1388
|
-
*
|
|
1216
|
+
* // A nice orange. String with the RGB values.
|
|
1217
|
+
* const orange = String.fromCharCode(0xff, 0x80, 0x10);
|
|
1218
|
+
*
|
|
1219
|
+
* // Create the texture. Repeat the color string for each pixel.
|
|
1220
|
+
* const [ok, reason] = gui.new_texture("orange_tx", w, h, "rgb", orange.repeat(w * h));
|
|
1221
|
+
* if (ok) {
|
|
1222
|
+
* // Create a box node and apply the texture to it.
|
|
1223
|
+
* const n = gui.new_box_node(vmath.vector3(200, 200, 0), vmath.vector3(w, h, 0));
|
|
1224
|
+
* gui.set_texture(n, "orange_tx");
|
|
1225
|
+
* } else {
|
|
1226
|
+
* // Could not create texture for some reason...
|
|
1227
|
+
* if (reason === gui.RESULT_TEXTURE_ALREADY_EXISTS) {
|
|
1228
|
+
* // ...
|
|
1229
|
+
* } else {
|
|
1230
|
+
* // ...
|
|
1231
|
+
* }
|
|
1389
1232
|
* }
|
|
1390
|
-
* // consume input
|
|
1391
|
-
* return true;
|
|
1392
1233
|
* },
|
|
1393
1234
|
* });
|
|
1394
1235
|
* ```
|
|
1395
|
-
*/
|
|
1396
|
-
function on_input(self: unknown, action_id: Hash | undefined, action: go.on_input.action): boolean | undefined;
|
|
1397
|
-
/**
|
|
1398
|
-
* This is a callback-function, which is called by the engine whenever a message has been sent to the gui component.
|
|
1399
|
-
* It can be used to take action on the message, e.g. update the gui or send a response back to the sender of the message.
|
|
1400
|
-
* The `message` parameter is a table containing the message data. If the message is sent from the engine, the
|
|
1401
|
-
* documentation of the message specifies which data is supplied.
|
|
1402
|
-
* See the update function for examples on how to use this callback-function.
|
|
1403
|
-
*
|
|
1404
|
-
* @param self - script instance used for storing state
|
|
1405
|
-
* @param message_id - id of the received message
|
|
1406
|
-
* @param message - a table containing the message data
|
|
1407
|
-
* @param sender - address of the sender
|
|
1408
|
-
*/
|
|
1409
|
-
function on_message(self: unknown, message_id: Hash, message: LuaMap<AnyNotNil, unknown> | Record<string, unknown>, sender: Url): void;
|
|
1410
|
-
/**
|
|
1411
|
-
* This is a callback-function, which is called by the engine when the gui script is reloaded, e.g. from the editor.
|
|
1412
|
-
* It can be used for live development, e.g. to tweak constants or set up the state properly for the script.
|
|
1413
|
-
*
|
|
1414
|
-
* @param self - script instance used for storing state
|
|
1415
1236
|
* @example
|
|
1237
|
+
* How to create a texture using .astc format
|
|
1416
1238
|
* ```ts
|
|
1417
|
-
*
|
|
1418
|
-
*
|
|
1419
|
-
*
|
|
1420
|
-
*
|
|
1421
|
-
*
|
|
1422
|
-
*
|
|
1423
|
-
*
|
|
1424
|
-
*
|
|
1425
|
-
*
|
|
1426
|
-
*
|
|
1239
|
+
* const size = 4;
|
|
1240
|
+
* const pos = vmath.vector3(200, 200, 0);
|
|
1241
|
+
* const path = "/assets/images/logo_4x4.astc";
|
|
1242
|
+
* const [data] = sys.load_resource(path);
|
|
1243
|
+
* if (data !== undefined) {
|
|
1244
|
+
* const n = gui.new_box_node(pos, vmath.vector3(size, size, 0));
|
|
1245
|
+
* // size is read from the .astc buffer
|
|
1246
|
+
* // flip is not supported
|
|
1247
|
+
* gui.new_texture(path, 0, 0, "astc", data, false);
|
|
1248
|
+
* gui.set_texture(n, path);
|
|
1249
|
+
* }
|
|
1427
1250
|
* ```
|
|
1428
1251
|
*/
|
|
1429
|
-
function
|
|
1252
|
+
function new_texture(texture_id: string | Hash, width: number, height: number, type: string | image.Type, buffer: string, flip: boolean): LuaMultiReturn<[boolean, gui.Result | undefined]>;
|
|
1430
1253
|
/**
|
|
1431
1254
|
* Tests whether a coordinate is within the bounding box of a
|
|
1432
1255
|
* node.
|
|
@@ -1479,7 +1302,50 @@ declare global {
|
|
|
1479
1302
|
* gui.play_flipbook(node, "button");
|
|
1480
1303
|
* ```
|
|
1481
1304
|
*/
|
|
1482
|
-
function play_flipbook(node: Opaque<"node">, animation: string | Hash, complete_function?: (self: unknown, node: Opaque<"node">) => void
|
|
1305
|
+
function play_flipbook(node: Opaque<"node">, animation: string | Hash, complete_function?: (self: unknown, node: Opaque<"node">) => void): void;
|
|
1306
|
+
/**
|
|
1307
|
+
* Play flipbook animation on a box or pie node.
|
|
1308
|
+
* The current node texture must contain the animation.
|
|
1309
|
+
* Use this function to set one-frame still images on the node.
|
|
1310
|
+
*
|
|
1311
|
+
* @param node - node to set animation for
|
|
1312
|
+
* @param animation - animation id
|
|
1313
|
+
* @param complete_function - optional function to call when the animation has completed
|
|
1314
|
+
*
|
|
1315
|
+
* `self`
|
|
1316
|
+
*
|
|
1317
|
+
* script_instance The current script instance.
|
|
1318
|
+
*
|
|
1319
|
+
* `node`
|
|
1320
|
+
*
|
|
1321
|
+
* node The node that is animated.
|
|
1322
|
+
* @param play_properties - optional playback properties
|
|
1323
|
+
* @example
|
|
1324
|
+
* Set the texture of a node to a flipbook animation from an atlas:
|
|
1325
|
+
* ```ts
|
|
1326
|
+
* function anim_callback(self: unknown, node: unknown) {
|
|
1327
|
+
* // Take action after animation has played.
|
|
1328
|
+
* }
|
|
1329
|
+
*
|
|
1330
|
+
* export default defineGuiScript({
|
|
1331
|
+
* init(self) {
|
|
1332
|
+
* // Create a new node and set the texture to a flipbook animation
|
|
1333
|
+
* const node = gui.get_node("button_node");
|
|
1334
|
+
* gui.set_texture(node, "gui_sprites");
|
|
1335
|
+
* gui.play_flipbook(node, "animated_button");
|
|
1336
|
+
* },
|
|
1337
|
+
* });
|
|
1338
|
+
* ```
|
|
1339
|
+
* @example
|
|
1340
|
+
* Set the texture of a node to an image from an atlas:
|
|
1341
|
+
* ```ts
|
|
1342
|
+
* // Create a new node and set the texture to a "button.png" from atlas
|
|
1343
|
+
* const node = gui.get_node("button_node");
|
|
1344
|
+
* gui.set_texture(node, "gui_sprites");
|
|
1345
|
+
* gui.play_flipbook(node, "button");
|
|
1346
|
+
* ```
|
|
1347
|
+
*/
|
|
1348
|
+
function play_flipbook(node: Opaque<"node">, animation: string | Hash, complete_function: ((self: unknown, node: Opaque<"node">) => void) | undefined, play_properties: gui.PlayProperties): void;
|
|
1483
1349
|
/**
|
|
1484
1350
|
* Plays the paricle fx for a gui node
|
|
1485
1351
|
*
|
|
@@ -1501,7 +1367,7 @@ declare global {
|
|
|
1501
1367
|
* });
|
|
1502
1368
|
* ```
|
|
1503
1369
|
*/
|
|
1504
|
-
function play_particlefx(node: Opaque<"node">, emitter_state_function?: (self: unknown, node: Opaque<"node"> | undefined, emitter: Hash, state: particlefx.
|
|
1370
|
+
function play_particlefx(node: Opaque<"node">, emitter_state_function?: (self: unknown, node: Opaque<"node"> | undefined, emitter: Hash, state: particlefx.EmitterState) => void): void;
|
|
1505
1371
|
/**
|
|
1506
1372
|
* Resets the input context of keyboard. This will clear marked text.
|
|
1507
1373
|
*/
|
|
@@ -1557,112 +1423,6 @@ declare global {
|
|
|
1557
1423
|
* ```
|
|
1558
1424
|
*/
|
|
1559
1425
|
function screen_to_local(node: Opaque<"node">, screen_position: Vector3 | Vector4): Vector3;
|
|
1560
|
-
/**
|
|
1561
|
-
* Instead of using specific setteres such as gui.set_position or gui.set_scale,
|
|
1562
|
-
* you can use gui.set instead and supply the property as a string or a hash.
|
|
1563
|
-
* While this function is similar to go.get and go.set, there are a few more restrictions
|
|
1564
|
-
* when operating in the gui namespace. Most notably, only these named properties identifiers are supported:
|
|
1565
|
-
*
|
|
1566
|
-
* - `"position"`
|
|
1567
|
-
* - `"rotation"`
|
|
1568
|
-
* - `"euler"`
|
|
1569
|
-
* - `"scale"`
|
|
1570
|
-
* - `"color"`
|
|
1571
|
-
* - `"outline"`
|
|
1572
|
-
* - `"shadow"`
|
|
1573
|
-
* - `"size"`
|
|
1574
|
-
* - `"fill_angle"` (pie)
|
|
1575
|
-
* - `"inner_radius"` (pie)
|
|
1576
|
-
* - `"leading"` (text)
|
|
1577
|
-
* - `"tracking"` (text)
|
|
1578
|
-
* - `"slice9"` (slice9)
|
|
1579
|
-
*
|
|
1580
|
-
* The value to set must either be a vmath.vector4, vmath.vector3, vmath.quat or a single number and depends on the property name you want to set.
|
|
1581
|
-
* I.e when setting the "position" property, you need to use a vmath.vector4 and when setting a single component of the property,
|
|
1582
|
-
* such as "position.x", you need to use a single value.
|
|
1583
|
-
* Note: When setting the rotation using the "rotation" property, you need to pass in a vmath.quat. This behaviour is different than from the gui.set_rotation function,
|
|
1584
|
-
* the intention is to move new functionality closer to go namespace so that migrating between gui and go is easier. To set the rotation using degrees instead,
|
|
1585
|
-
* use the "euler" property instead. The rotation and euler properties are linked, changing one of them will change the backing data of the other.
|
|
1586
|
-
* Similar to go.set, you can also use gui.set for setting material constant values on a node. E.g if a material has specified a constant called `tint` in
|
|
1587
|
-
* the .material file, you can use gui.set to set the value of that constant by calling `gui.set(node, "tint", vmath.vec4(1,0,0,1))`, or `gui.set(node, "matrix", vmath.matrix4())`
|
|
1588
|
-
* if the constant is a matrix. Arrays are also supported by gui.set - to set an array constant, you need to pass in an options table with the 'index' key set.
|
|
1589
|
-
* If the material has a constant array called 'tint_array' specified in the material, you can use `gui.set(node, "tint_array", vmath.vec4(1,0,0,1), { index = 4})` to set the fourth array element to a different value.
|
|
1590
|
-
*
|
|
1591
|
-
* @param node - node to set the property for, or msg.url() to the gui itself
|
|
1592
|
-
* @param property - the property to set
|
|
1593
|
-
* @param value - the property to set. `nil` is only supported for removing runtime texture mappings with `gui.set(msg.url(), "textures", nil, {key = ...})`.
|
|
1594
|
-
* @param options - optional material-constant options. **⚠️ `index` is 1-based; passed to Defold unchanged.**
|
|
1595
|
-
* @example
|
|
1596
|
-
* Updates the position property on an existing node:
|
|
1597
|
-
* ```ts
|
|
1598
|
-
* const node = gui.get_node("my_box_node");
|
|
1599
|
-
* const node_position = gui.get(node, "position") as Vector3;
|
|
1600
|
-
* gui.set(node, "position.x", node_position.x + 128);
|
|
1601
|
-
* ```
|
|
1602
|
-
* @example
|
|
1603
|
-
* Updates the rotation property on an existing node:
|
|
1604
|
-
* ```ts
|
|
1605
|
-
* const node = gui.get_node("my_box_node");
|
|
1606
|
-
* gui.set(node, "rotation", vmath.quat_rotation_z(math.rad(45)));
|
|
1607
|
-
* // this is equivalent to:
|
|
1608
|
-
* gui.set(node, "euler.z", 45);
|
|
1609
|
-
* // or using the entire vector:
|
|
1610
|
-
* gui.set(node, "euler", vmath.vector3(0, 0, 45));
|
|
1611
|
-
* // or using the set_rotation
|
|
1612
|
-
* gui.set_rotation(node, vmath.vector3(0, 0, 45));
|
|
1613
|
-
* ```
|
|
1614
|
-
* @example
|
|
1615
|
-
* Sets various material constants for a node:
|
|
1616
|
-
* ```ts
|
|
1617
|
-
* const node = gui.get_node("my_box_node");
|
|
1618
|
-
* gui.set(node, "tint", vmath.vector4(1, 0, 0, 1));
|
|
1619
|
-
* // matrix4 is also supported
|
|
1620
|
-
* gui.set(node, "light_matrix", vmath.matrix4());
|
|
1621
|
-
* // update a constant in an array at position 4. the array is specified in the shader as:
|
|
1622
|
-
* // uniform vec4 tint_array[4]; // lua is 1 based, shader is 0 based
|
|
1623
|
-
* gui.set(node, "tint_array", vmath.vector4(1, 0, 0, 1), { index: 4 });
|
|
1624
|
-
* // update a matrix constant in an array at position 4. the array is specified in the shader as:
|
|
1625
|
-
* // uniform mat4 light_matrix_array[4];
|
|
1626
|
-
* gui.set(node, "light_matrix_array", vmath.matrix4(), { index: 4 });
|
|
1627
|
-
* // update a sub-element in a constant
|
|
1628
|
-
* gui.set(node, "tint.x", 1);
|
|
1629
|
-
* // update a sub-element in an array constant at position 4
|
|
1630
|
-
* gui.set(node, "tint_array.x", 1, { index: 4 });
|
|
1631
|
-
* ```
|
|
1632
|
-
* @example
|
|
1633
|
-
* Set a named property
|
|
1634
|
-
* ```ts
|
|
1635
|
-
* export default defineGuiScript({
|
|
1636
|
-
* on_message(self, message_id, message) {
|
|
1637
|
-
* if (message_id === hash("set_font") && types.is_hash(message.font)) {
|
|
1638
|
-
* gui.set(msg.url(), "fonts", message.font, { key: "my_font_name" });
|
|
1639
|
-
* gui.set_font(gui.get_node("text"), "my_font_name");
|
|
1640
|
-
* } else if (message_id === hash("set_texture") && types.is_hash(message.texture)) {
|
|
1641
|
-
* gui.set(msg.url(), "textures", message.texture, { key: "my_texture" });
|
|
1642
|
-
* gui.set_texture(gui.get_node("box"), "my_texture");
|
|
1643
|
-
* gui.play_flipbook(gui.get_node("box"), "logo_256");
|
|
1644
|
-
* }
|
|
1645
|
-
* },
|
|
1646
|
-
* });
|
|
1647
|
-
* ```
|
|
1648
|
-
* @example
|
|
1649
|
-
* Remove a named runtime texture resource mapping:
|
|
1650
|
-
* ```ts
|
|
1651
|
-
* const atlas_params = {
|
|
1652
|
-
* texture: "/runtime.texturec",
|
|
1653
|
-
* animations: [{ id: "runtime", width: 1, height: 1, frames: [1] }],
|
|
1654
|
-
* geometries: [{ vertices: [0, 0, 0, 1, 1, 1, 1, 0], uvs: [0, 0, 0, 1, 1, 1, 1, 0], indices: [0, 1, 2, 0, 2, 3] }],
|
|
1655
|
-
* } satisfies Parameters<typeof resource.create_atlas>[1];
|
|
1656
|
-
* const atlas_id = resource.create_atlas("/runtime.texturesetc", atlas_params);
|
|
1657
|
-
* gui.set(msg.url(), "textures", atlas_id, { key: "runtime_texture" });
|
|
1658
|
-
* gui.set_texture(gui.get_node("box"), "runtime_texture");
|
|
1659
|
-
*
|
|
1660
|
-
* // Later, remove the GUI mapping before releasing the atlas resource.
|
|
1661
|
-
* gui.set(msg.url(), "textures", undefined, { key: "runtime_texture" });
|
|
1662
|
-
* resource.release(atlas_id);
|
|
1663
|
-
* ```
|
|
1664
|
-
*/
|
|
1665
|
-
function set(node: Opaque<"node"> | Url, property: string | Hash | gui.PROP, value: number | Vector4 | Vector3 | Quaternion | Matrix4 | Hash | undefined, options?: { index?: number; key?: string | Hash; keys?: (Hash | string)[] }): void;
|
|
1666
1426
|
/**
|
|
1667
1427
|
* Sets the adjust mode on a node.
|
|
1668
1428
|
* The adjust mode defines how the node will adjust itself to screen
|
|
@@ -1671,7 +1431,7 @@ declare global {
|
|
|
1671
1431
|
* @param node - node to set adjust mode for
|
|
1672
1432
|
* @param adjust_mode - adjust mode to set
|
|
1673
1433
|
*/
|
|
1674
|
-
function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.
|
|
1434
|
+
function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.Adjust): void;
|
|
1675
1435
|
/**
|
|
1676
1436
|
* sets the node alpha
|
|
1677
1437
|
*
|
|
@@ -1686,7 +1446,7 @@ declare global {
|
|
|
1686
1446
|
* @param node - node to set blend mode for
|
|
1687
1447
|
* @param blend_mode - blend mode to set
|
|
1688
1448
|
*/
|
|
1689
|
-
function set_blend_mode(node: Opaque<"node">, blend_mode: gui.
|
|
1449
|
+
function set_blend_mode(node: Opaque<"node">, blend_mode: gui.Blend): void;
|
|
1690
1450
|
/**
|
|
1691
1451
|
* If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
|
|
1692
1452
|
*
|
|
@@ -1703,7 +1463,7 @@ declare global {
|
|
|
1703
1463
|
* - `gui.CLIPPING_MODE_NONE`
|
|
1704
1464
|
* - `gui.CLIPPING_MODE_STENCIL`
|
|
1705
1465
|
*/
|
|
1706
|
-
function set_clipping_mode(node: Opaque<"node">, clipping_mode: gui.
|
|
1466
|
+
function set_clipping_mode(node: Opaque<"node">, clipping_mode: gui.ClippingMode): void;
|
|
1707
1467
|
/**
|
|
1708
1468
|
* If node is set as an visible clipping node, it will be shown as well as clipping. Otherwise, it will only clip but not show visually.
|
|
1709
1469
|
*
|
|
@@ -1867,7 +1627,7 @@ declare global {
|
|
|
1867
1627
|
* @param node - node for which to set the outer bounds mode
|
|
1868
1628
|
* @param bounds_mode - the outer bounds mode of the pie node
|
|
1869
1629
|
*/
|
|
1870
|
-
function set_outer_bounds(node: Opaque<"node">, bounds_mode: gui.
|
|
1630
|
+
function set_outer_bounds(node: Opaque<"node">, bounds_mode: gui.PieBounds): void;
|
|
1871
1631
|
/**
|
|
1872
1632
|
* Sets the outline color of the supplied node.
|
|
1873
1633
|
* See gui.set_color for info how vectors encode color values.
|
|
@@ -1914,7 +1674,7 @@ declare global {
|
|
|
1914
1674
|
* - `gui.PIVOT_W`
|
|
1915
1675
|
* - `gui.PIVOT_NW`
|
|
1916
1676
|
*/
|
|
1917
|
-
function set_pivot(node: Opaque<"node">, pivot: gui.
|
|
1677
|
+
function set_pivot(node: Opaque<"node">, pivot: gui.Pivot): void;
|
|
1918
1678
|
/**
|
|
1919
1679
|
* Sets the position of the supplied node.
|
|
1920
1680
|
*
|
|
@@ -1945,7 +1705,7 @@ declare global {
|
|
|
1945
1705
|
*
|
|
1946
1706
|
* @param mode - safe area mode
|
|
1947
1707
|
*/
|
|
1948
|
-
function set_safe_area_mode(mode: gui.
|
|
1708
|
+
function set_safe_area_mode(mode: gui.SafeArea): void;
|
|
1949
1709
|
/**
|
|
1950
1710
|
* Sets the scaling of the supplied node.
|
|
1951
1711
|
*
|
|
@@ -1987,7 +1747,7 @@ declare global {
|
|
|
1987
1747
|
* @param node - node to set size mode for
|
|
1988
1748
|
* @param size_mode - size mode to set
|
|
1989
1749
|
*/
|
|
1990
|
-
function set_size_mode(node: Opaque<"node">, size_mode: gui.
|
|
1750
|
+
function set_size_mode(node: Opaque<"node">, size_mode: gui.SizeMode): void;
|
|
1991
1751
|
/**
|
|
1992
1752
|
* Set the slice9 configuration values for the node.
|
|
1993
1753
|
*
|
|
@@ -2081,7 +1841,52 @@ declare global {
|
|
|
2081
1841
|
* });
|
|
2082
1842
|
* ```
|
|
2083
1843
|
*/
|
|
2084
|
-
function set_texture_data(texture: string | Hash, width: number, height: number, type: string | image.
|
|
1844
|
+
function set_texture_data(texture: string | Hash, width: number, height: number, type: string | image.Type, buffer: string): boolean;
|
|
1845
|
+
/**
|
|
1846
|
+
* Set the texture buffer data for a dynamically created texture.
|
|
1847
|
+
*
|
|
1848
|
+
* @param texture - texture id
|
|
1849
|
+
* @param width - texture width
|
|
1850
|
+
* @param height - texture height
|
|
1851
|
+
* @param type - texture type
|
|
1852
|
+
*
|
|
1853
|
+
* - `"rgb"` or `image.TYPE_RGB` - RGB
|
|
1854
|
+
* - `"rgba"` or `image.TYPE_RGBA` - RGBA
|
|
1855
|
+
* - `"l"` or `image.TYPE_LUMINANCE` - LUMINANCE
|
|
1856
|
+
* - `"astc"` - ASTC compressed format
|
|
1857
|
+
* @param buffer - texture data
|
|
1858
|
+
* @param flip - flip texture vertically
|
|
1859
|
+
* @returns setting the data was successful
|
|
1860
|
+
* @example
|
|
1861
|
+
* ```ts
|
|
1862
|
+
* export default defineGuiScript({
|
|
1863
|
+
* init(self) {
|
|
1864
|
+
* const w = 200;
|
|
1865
|
+
* const h = 300;
|
|
1866
|
+
*
|
|
1867
|
+
* // Create a dynamic texture, all white.
|
|
1868
|
+
* if (gui.new_texture("dynamic_tx", w, h, "rgb", String.fromCharCode(0xff).repeat(w * h * 3))) {
|
|
1869
|
+
* // Create a box node and apply the texture to it.
|
|
1870
|
+
* const n = gui.new_box_node(vmath.vector3(200, 200, 0), vmath.vector3(w, h, 0));
|
|
1871
|
+
* gui.set_texture(n, "dynamic_tx");
|
|
1872
|
+
*
|
|
1873
|
+
* // ...
|
|
1874
|
+
*
|
|
1875
|
+
* // Change the data in the texture to a nice orange.
|
|
1876
|
+
* const orange = String.fromCharCode(0xff, 0x80, 0x10);
|
|
1877
|
+
* if (gui.set_texture_data("dynamic_tx", w, h, "rgb", orange.repeat(w * h))) {
|
|
1878
|
+
* // Go on and to more stuff
|
|
1879
|
+
* // ...
|
|
1880
|
+
* }
|
|
1881
|
+
* } else {
|
|
1882
|
+
* // Something went wrong
|
|
1883
|
+
* // ...
|
|
1884
|
+
* }
|
|
1885
|
+
* },
|
|
1886
|
+
* });
|
|
1887
|
+
* ```
|
|
1888
|
+
*/
|
|
1889
|
+
function set_texture_data(texture: string | Hash, width: number, height: number, type: string | image.Type, buffer: string, flip: boolean): boolean;
|
|
2085
1890
|
/**
|
|
2086
1891
|
* Sets the tracking value of a text node. This value is used to
|
|
2087
1892
|
* adjust the vertical spacing of characters in the text.
|
|
@@ -2107,7 +1912,7 @@ declare global {
|
|
|
2107
1912
|
* - `gui.ANCHOR_LEFT`
|
|
2108
1913
|
* - `gui.ANCHOR_RIGHT`
|
|
2109
1914
|
*/
|
|
2110
|
-
function set_xanchor(node: Opaque<"node">, anchor: gui.
|
|
1915
|
+
function set_xanchor(node: Opaque<"node">, anchor: Exclude<gui.Anchor, typeof gui.ANCHOR_BOTTOM | typeof gui.ANCHOR_TOP>): void;
|
|
2111
1916
|
/**
|
|
2112
1917
|
* The y-anchor specifies how the node is moved when the game is run in a different resolution.
|
|
2113
1918
|
*
|
|
@@ -2118,7 +1923,7 @@ declare global {
|
|
|
2118
1923
|
* - `gui.ANCHOR_TOP`
|
|
2119
1924
|
* - `gui.ANCHOR_BOTTOM`
|
|
2120
1925
|
*/
|
|
2121
|
-
function set_yanchor(node: Opaque<"node">, anchor: gui.
|
|
1926
|
+
function set_yanchor(node: Opaque<"node">, anchor: Exclude<gui.Anchor, typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT>): void;
|
|
2122
1927
|
/**
|
|
2123
1928
|
* Shows the on-display touch keyboard.
|
|
2124
1929
|
* The specified type of keyboard is displayed if it is available on
|
|
@@ -2128,64 +1933,22 @@ declare global {
|
|
|
2128
1933
|
* @param type - keyboard type
|
|
2129
1934
|
* @param autoclose - if the keyboard should automatically close when clicking outside
|
|
2130
1935
|
*/
|
|
2131
|
-
function show_keyboard(type: gui.
|
|
1936
|
+
function show_keyboard(type: gui.KeyboardType, autoclose: boolean): void;
|
|
2132
1937
|
/**
|
|
2133
1938
|
* Stops the particle fx for a gui node
|
|
2134
1939
|
*
|
|
2135
1940
|
* @param node - node to stop particle fx for
|
|
2136
1941
|
* @param options - options used when stopping the particle fx
|
|
2137
1942
|
*/
|
|
2138
|
-
function stop_particlefx(node: Opaque<"node"
|
|
1943
|
+
function stop_particlefx(node: Opaque<"node">): void;
|
|
2139
1944
|
/**
|
|
2140
|
-
*
|
|
2141
|
-
* It can be used to perform any kind of gui related tasks, e.g. animating nodes.
|
|
2142
|
-
*
|
|
2143
|
-
* @param self - script instance used for storing state
|
|
2144
|
-
* @param dt - the time-step of the frame update
|
|
2145
|
-
* @example
|
|
2146
|
-
* ```ts
|
|
2147
|
-
* // This example demonstrates how to update a text node that displays game score
|
|
2148
|
-
* // in a counting fashion. It is assumed that the gui component receives messages
|
|
2149
|
-
* // from the game when a new score is to be shown.
|
|
2150
|
-
* export default defineGuiScript({
|
|
2151
|
-
* init() {
|
|
2152
|
-
* return {
|
|
2153
|
-
* // fetch the score text node for later use (assumes it is called "score")
|
|
2154
|
-
* score_node: gui.get_node("score"),
|
|
2155
|
-
* // keep track of the current score counted up so far
|
|
2156
|
-
* current_score: 0,
|
|
2157
|
-
* // keep track of the target score we should count up to
|
|
2158
|
-
* target_score: 0,
|
|
2159
|
-
* // how fast we will update the score, in score/second
|
|
2160
|
-
* score_update_speed: 1,
|
|
2161
|
-
* };
|
|
2162
|
-
* },
|
|
2163
|
-
*
|
|
2164
|
-
* update(self, dt) {
|
|
2165
|
-
* // check if target score is more than current score
|
|
2166
|
-
* if (self.current_score < self.target_score) {
|
|
2167
|
-
* // increment current score according to the speed
|
|
2168
|
-
* self.current_score = self.current_score + dt * self.score_update_speed;
|
|
2169
|
-
* // check if we went past the target score, clamp current score in that case
|
|
2170
|
-
* if (self.current_score > self.target_score) {
|
|
2171
|
-
* self.current_score = self.target_score;
|
|
2172
|
-
* }
|
|
2173
|
-
* // update the score text node
|
|
2174
|
-
* gui.set_text(self.score_node, "" + math.floor(self.current_score));
|
|
2175
|
-
* }
|
|
2176
|
-
* },
|
|
1945
|
+
* Stops the particle fx for a gui node
|
|
2177
1946
|
*
|
|
2178
|
-
*
|
|
2179
|
-
*
|
|
2180
|
-
* if (message_id === hash("set_score") && typeof message.score === "number") {
|
|
2181
|
-
* self.target_score = message.score;
|
|
2182
|
-
* }
|
|
2183
|
-
* },
|
|
2184
|
-
* });
|
|
2185
|
-
* ```
|
|
1947
|
+
* @param node - node to stop particle fx for
|
|
1948
|
+
* @param options - options used when stopping the particle fx
|
|
2186
1949
|
*/
|
|
2187
|
-
function
|
|
2188
|
-
interface
|
|
1950
|
+
function stop_particlefx(node: Opaque<"node">, options: particlefx.StopOptions): void;
|
|
1951
|
+
interface Properties {
|
|
2189
1952
|
/**
|
|
2190
1953
|
* The fonts used in the gui. The type of the property is hash.
|
|
2191
1954
|
* Key must be specified in options table.
|