@defold-typescript/types 0.37.0 → 0.39.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-signatures.json +348 -267
- package/examples/translations.json +323 -147
- package/generated/b2d_body.d.ts +7 -4
- package/generated/buffer.d.ts +16 -4
- package/generated/camera.d.ts +1 -0
- package/generated/collectionfactory.d.ts +5 -2
- package/generated/collectionproxy.d.ts +1 -1
- package/generated/factory.d.ts +2 -1
- package/generated/go.d.ts +141 -86
- package/generated/graphics.d.ts +2 -0
- package/generated/gui.d.ts +65 -40
- package/generated/html5.d.ts +1 -1
- package/generated/http.d.ts +4 -0
- package/generated/model.d.ts +9 -4
- package/generated/particlefx.d.ts +1 -1
- package/generated/physics.d.ts +16 -9
- package/generated/profiler.d.ts +9 -2
- package/generated/render.d.ts +224 -99
- package/generated/resource.d.ts +143 -157
- package/generated/socket.d.ts +13 -8
- package/generated/sound.d.ts +3 -2
- package/generated/sys.d.ts +16 -10
- package/generated/tilemap.d.ts +25 -19
- package/generated/timer.d.ts +33 -24
- package/generated/versions/defold-1.12.4/buffer.d.ts +16 -4
- package/generated/versions/defold-1.12.4/camera.d.ts +1 -0
- package/generated/versions/defold-1.12.4/collectionfactory.d.ts +5 -2
- package/generated/versions/defold-1.12.4/collectionproxy.d.ts +1 -1
- package/generated/versions/defold-1.12.4/factory.d.ts +2 -1
- package/generated/versions/defold-1.12.4/go.d.ts +141 -86
- package/generated/versions/defold-1.12.4/graphics.d.ts +2 -0
- package/generated/versions/defold-1.12.4/gui.d.ts +63 -39
- package/generated/versions/defold-1.12.4/html5.d.ts +1 -1
- package/generated/versions/defold-1.12.4/http.d.ts +4 -0
- package/generated/versions/defold-1.12.4/model.d.ts +9 -4
- package/generated/versions/defold-1.12.4/particlefx.d.ts +1 -1
- package/generated/versions/defold-1.12.4/physics.d.ts +16 -9
- package/generated/versions/defold-1.12.4/profiler.d.ts +9 -2
- package/generated/versions/defold-1.12.4/render.d.ts +223 -98
- package/generated/versions/defold-1.12.4/resource.d.ts +143 -157
- package/generated/versions/defold-1.12.4/socket.d.ts +13 -8
- package/generated/versions/defold-1.12.4/sound.d.ts +3 -2
- package/generated/versions/defold-1.12.4/sys.d.ts +16 -10
- package/generated/versions/defold-1.12.4/tilemap.d.ts +25 -19
- package/generated/versions/defold-1.12.4/timer.d.ts +33 -24
- package/generated/versions/defold-1.12.4/vmath.d.ts +13 -5
- package/generated/versions/defold-1.12.4/window.d.ts +5 -3
- package/generated/versions/defold-1.13.0/b2d_body.d.ts +7 -4
- package/generated/versions/defold-1.13.0/buffer.d.ts +16 -4
- package/generated/versions/defold-1.13.0/camera.d.ts +1 -0
- package/generated/versions/defold-1.13.0/collectionfactory.d.ts +5 -2
- package/generated/versions/defold-1.13.0/collectionproxy.d.ts +1 -1
- package/generated/versions/defold-1.13.0/factory.d.ts +2 -1
- package/generated/versions/defold-1.13.0/go.d.ts +141 -86
- package/generated/versions/defold-1.13.0/graphics.d.ts +2 -0
- package/generated/versions/defold-1.13.0/gui.d.ts +63 -39
- package/generated/versions/defold-1.13.0/html5.d.ts +1 -1
- package/generated/versions/defold-1.13.0/http.d.ts +4 -0
- package/generated/versions/defold-1.13.0/model.d.ts +9 -4
- package/generated/versions/defold-1.13.0/particlefx.d.ts +1 -1
- package/generated/versions/defold-1.13.0/physics.d.ts +16 -9
- package/generated/versions/defold-1.13.0/profiler.d.ts +9 -2
- package/generated/versions/defold-1.13.0/render.d.ts +224 -99
- package/generated/versions/defold-1.13.0/resource.d.ts +143 -157
- package/generated/versions/defold-1.13.0/socket.d.ts +13 -8
- package/generated/versions/defold-1.13.0/sound.d.ts +3 -2
- package/generated/versions/defold-1.13.0/sys.d.ts +16 -10
- package/generated/versions/defold-1.13.0/tilemap.d.ts +25 -19
- package/generated/versions/defold-1.13.0/timer.d.ts +33 -24
- package/generated/versions/defold-1.13.0/vmath.d.ts +13 -5
- package/generated/versions/defold-1.13.0/window.d.ts +5 -3
- package/generated/vmath.d.ts +13 -5
- package/generated/window.d.ts +5 -3
- package/package.json +2 -1
- package/src/api-doc.ts +8 -0
- package/src/doc-comment.ts +213 -32
- package/src/emit-dts.ts +501 -10
- package/src/example-store.ts +26 -0
- package/src/index.ts +5 -0
- package/src/lifecycle.ts +31 -8
- package/src/message-dispatch.d.ts +55 -13
- package/src/msg-overloads.d.ts +73 -3
- package/src/render-overloads.d.ts +0 -17
package/generated/gui.d.ts
CHANGED
|
@@ -6,6 +6,20 @@ declare global {
|
|
|
6
6
|
* GUI API documentation
|
|
7
7
|
*/
|
|
8
8
|
namespace gui {
|
|
9
|
+
type AdjustMode = typeof gui.ADJUST_FIT | typeof gui.ADJUST_ZOOM | typeof gui.ADJUST_STRETCH;
|
|
10
|
+
type BlendMode = typeof gui.BLEND_ALPHA | typeof gui.BLEND_ADD | typeof gui.BLEND_ADD_ALPHA | typeof gui.BLEND_MULT | typeof gui.BLEND_SCREEN;
|
|
11
|
+
type ClippingMode = typeof gui.CLIPPING_MODE_NONE | typeof gui.CLIPPING_MODE_STENCIL;
|
|
12
|
+
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;
|
|
13
|
+
type KeyboardType = typeof gui.KEYBOARD_TYPE_DEFAULT | typeof gui.KEYBOARD_TYPE_EMAIL | typeof gui.KEYBOARD_TYPE_NUMBER_PAD | typeof gui.KEYBOARD_TYPE_PASSWORD;
|
|
14
|
+
type NodeType = typeof gui.TYPE_BOX | typeof gui.TYPE_TEXT | typeof gui.TYPE_PIE | typeof gui.TYPE_PARTICLEFX | typeof gui.TYPE_CUSTOM;
|
|
15
|
+
type PieBounds = typeof gui.PIEBOUNDS_RECTANGLE | typeof gui.PIEBOUNDS_ELLIPSE;
|
|
16
|
+
type Pivot = typeof gui.PIVOT_CENTER | typeof gui.PIVOT_N | typeof gui.PIVOT_NE | typeof gui.PIVOT_E | typeof gui.PIVOT_SE | typeof gui.PIVOT_S | typeof gui.PIVOT_SW | typeof gui.PIVOT_W | typeof gui.PIVOT_NW;
|
|
17
|
+
type Playback = typeof gui.PLAYBACK_ONCE_FORWARD | typeof gui.PLAYBACK_ONCE_BACKWARD | typeof gui.PLAYBACK_ONCE_PINGPONG | typeof gui.PLAYBACK_LOOP_FORWARD | typeof gui.PLAYBACK_LOOP_BACKWARD | typeof gui.PLAYBACK_LOOP_PINGPONG;
|
|
18
|
+
type Property = typeof gui.PROP_POSITION | typeof gui.PROP_ROTATION | typeof gui.PROP_EULER | typeof gui.PROP_SCALE | typeof gui.PROP_COLOR | typeof gui.PROP_OUTLINE | typeof gui.PROP_SHADOW | typeof gui.PROP_SIZE | typeof gui.PROP_FILL_ANGLE | typeof gui.PROP_INNER_RADIUS | typeof gui.PROP_LEADING | typeof gui.PROP_TRACKING | typeof gui.PROP_SLICE9;
|
|
19
|
+
type SafeAreaMode = typeof gui.SAFE_AREA_NONE | typeof gui.SAFE_AREA_LONG | typeof gui.SAFE_AREA_SHORT | typeof gui.SAFE_AREA_BOTH;
|
|
20
|
+
type SizeMode = typeof gui.SIZE_MODE_MANUAL | typeof gui.SIZE_MODE_AUTO;
|
|
21
|
+
type XAnchor = typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT;
|
|
22
|
+
type YAnchor = typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_TOP | typeof gui.ANCHOR_BOTTOM;
|
|
9
23
|
/**
|
|
10
24
|
* Adjust mode is used when the screen resolution differs from the project settings.
|
|
11
25
|
* The fit mode ensures that the entire node is visible in the adjusted gui scene.
|
|
@@ -522,19 +536,24 @@ declare global {
|
|
|
522
536
|
*
|
|
523
537
|
* - `gui.PLAYBACK_LOOP_PINGPONG`
|
|
524
538
|
* @example
|
|
539
|
+
* How to start a simple color animation, where the node fades in to white during 0.5 seconds:
|
|
525
540
|
* ```ts
|
|
526
541
|
* // How to start a simple color animation, where the node fades in to white during 0.5 seconds:
|
|
542
|
+
* const node = gui.get_node("my_node");
|
|
527
543
|
* gui.set_color(node, vmath.vector4(0, 0, 0, 0)); // node is fully transparent
|
|
528
544
|
* gui.animate(node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5); // start animation
|
|
529
|
-
*
|
|
545
|
+
* ```
|
|
546
|
+
* @example
|
|
547
|
+
* 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:
|
|
548
|
+
* ```ts
|
|
530
549
|
* // How to start a sequenced animation where the node fades in to white during 0.5
|
|
531
550
|
* // seconds, stays visible for 2 seconds and then fades out:
|
|
532
|
-
* function on_animation_done(self, node) {
|
|
551
|
+
* function on_animation_done(self: unknown, node: unknown) {
|
|
533
552
|
* // fade out node, but wait 2 seconds before the animation starts
|
|
534
|
-
* gui.animate(node
|
|
553
|
+
* gui.animate(node as Opaque<"node">, gui.PROP_COLOR, vmath.vector4(0, 0, 0, 0), gui.EASING_OUTQUAD, 0.5, 2.0);
|
|
535
554
|
* }
|
|
536
555
|
*
|
|
537
|
-
* export default
|
|
556
|
+
* export default defineGuiScript({
|
|
538
557
|
* init(self) {
|
|
539
558
|
* // fetch the node we want to animate
|
|
540
559
|
* const my_node = gui.get_node("my_node");
|
|
@@ -544,9 +563,12 @@ declare global {
|
|
|
544
563
|
* gui.animate(my_node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5, 0.0, on_animation_done);
|
|
545
564
|
* },
|
|
546
565
|
* });
|
|
547
|
-
*
|
|
566
|
+
* ```
|
|
567
|
+
* @example
|
|
568
|
+
* How to animate a node's y position using a crazy custom easing curve:
|
|
569
|
+
* ```ts
|
|
548
570
|
* // How to animate a node's y position using a crazy custom easing curve:
|
|
549
|
-
* export default
|
|
571
|
+
* export default defineGuiScript({
|
|
550
572
|
* init(self) {
|
|
551
573
|
* const values = [
|
|
552
574
|
* 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
@@ -561,7 +583,7 @@ declare global {
|
|
|
561
583
|
* });
|
|
562
584
|
* ```
|
|
563
585
|
*/
|
|
564
|
-
function animate(node: Opaque<"node">, property: string |
|
|
586
|
+
function animate(node: Opaque<"node">, property: string | gui.Property, to: number | Vector3 | Vector4 | Quaternion, easing: gui.Easing | Vector, duration: number, delay?: number, complete_function?: (self: unknown, node: unknown) => void, playback?: gui.Playback): void;
|
|
565
587
|
/**
|
|
566
588
|
* If one or more animations of the specified node is currently running (started by `gui.animate`), they will immediately be canceled.
|
|
567
589
|
*
|
|
@@ -614,7 +636,7 @@ declare global {
|
|
|
614
636
|
* gui.cancel_animations(node);
|
|
615
637
|
* ```
|
|
616
638
|
*/
|
|
617
|
-
function cancel_animations(node: Opaque<"node">, property?: string |
|
|
639
|
+
function cancel_animations(node: Opaque<"node">, property?: string | gui.Property): void;
|
|
618
640
|
/**
|
|
619
641
|
* Cancels any running flipbook animation on the specified node.
|
|
620
642
|
*
|
|
@@ -664,7 +686,7 @@ declare global {
|
|
|
664
686
|
* @param texture - texture id
|
|
665
687
|
* @example
|
|
666
688
|
* ```ts
|
|
667
|
-
* export default
|
|
689
|
+
* export default defineGuiScript({
|
|
668
690
|
* init(self) {
|
|
669
691
|
* // Create a texture.
|
|
670
692
|
* if (gui.new_texture("temp_tx", 10, 10, "rgb", "\0".repeat(10 * 10 * 3))) {
|
|
@@ -744,7 +766,7 @@ declare global {
|
|
|
744
766
|
* const node_position = gui.get(node, "position");
|
|
745
767
|
* ```
|
|
746
768
|
*/
|
|
747
|
-
function get(node: Opaque<"node">, property: string | Hash |
|
|
769
|
+
function get(node: Opaque<"node">, property: string | Hash | gui.Property, options?: { index?: number }): unknown;
|
|
748
770
|
/**
|
|
749
771
|
* Returns the adjust mode of a node.
|
|
750
772
|
* The adjust mode defines how the node will adjust itself to screen
|
|
@@ -759,7 +781,7 @@ declare global {
|
|
|
759
781
|
*
|
|
760
782
|
* - `gui.ADJUST_STRETCH`
|
|
761
783
|
*/
|
|
762
|
-
function get_adjust_mode(node: Opaque<"node">):
|
|
784
|
+
function get_adjust_mode(node: Opaque<"node">): gui.AdjustMode;
|
|
763
785
|
/**
|
|
764
786
|
* gets the node alpha
|
|
765
787
|
*
|
|
@@ -784,7 +806,7 @@ declare global {
|
|
|
784
806
|
*
|
|
785
807
|
* - `gui.BLEND_SCREEN`
|
|
786
808
|
*/
|
|
787
|
-
function get_blend_mode(node: Opaque<"node">):
|
|
809
|
+
function get_blend_mode(node: Opaque<"node">): gui.BlendMode;
|
|
788
810
|
/**
|
|
789
811
|
* If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
|
|
790
812
|
*
|
|
@@ -802,7 +824,7 @@ declare global {
|
|
|
802
824
|
*
|
|
803
825
|
* - `gui.CLIPPING_MODE_STENCIL`
|
|
804
826
|
*/
|
|
805
|
-
function get_clipping_mode(node: Opaque<"node">):
|
|
827
|
+
function get_clipping_mode(node: Opaque<"node">): gui.ClippingMode;
|
|
806
828
|
/**
|
|
807
829
|
* If node is set as visible clipping node, it will be shown as well as clipping. Otherwise, it will only clip but not show visually.
|
|
808
830
|
*
|
|
@@ -884,7 +906,7 @@ declare global {
|
|
|
884
906
|
* @example
|
|
885
907
|
* ```ts
|
|
886
908
|
* // Get the text metrics for a text
|
|
887
|
-
* export default
|
|
909
|
+
* export default defineGuiScript({
|
|
888
910
|
* init(self) {
|
|
889
911
|
* const node = gui.get_node("name");
|
|
890
912
|
* const font_name = gui.get_font(node);
|
|
@@ -1028,7 +1050,7 @@ declare global {
|
|
|
1028
1050
|
*
|
|
1029
1051
|
* - `gui.PIEBOUNDS_ELLIPSE`
|
|
1030
1052
|
*/
|
|
1031
|
-
function get_outer_bounds(node: Opaque<"node">):
|
|
1053
|
+
function get_outer_bounds(node: Opaque<"node">): gui.PieBounds;
|
|
1032
1054
|
/**
|
|
1033
1055
|
* Returns the outline color of the supplied node.
|
|
1034
1056
|
* See gui.get_color for info how vectors encode color values.
|
|
@@ -1084,7 +1106,7 @@ declare global {
|
|
|
1084
1106
|
*
|
|
1085
1107
|
* - `gui.PIVOT_NW`
|
|
1086
1108
|
*/
|
|
1087
|
-
function get_pivot(node: Opaque<"node">):
|
|
1109
|
+
function get_pivot(node: Opaque<"node">): gui.Pivot;
|
|
1088
1110
|
/**
|
|
1089
1111
|
* Returns the position of the supplied node.
|
|
1090
1112
|
*
|
|
@@ -1146,7 +1168,7 @@ declare global {
|
|
|
1146
1168
|
*
|
|
1147
1169
|
* - `gui.SIZE_MODE_AUTO`
|
|
1148
1170
|
*/
|
|
1149
|
-
function get_size_mode(node: Opaque<"node">):
|
|
1171
|
+
function get_size_mode(node: Opaque<"node">): gui.SizeMode;
|
|
1150
1172
|
/**
|
|
1151
1173
|
* Returns the slice9 configuration values for the node.
|
|
1152
1174
|
*
|
|
@@ -1189,7 +1211,7 @@ declare global {
|
|
|
1189
1211
|
*
|
|
1190
1212
|
* @param node - node from which to get the type
|
|
1191
1213
|
*/
|
|
1192
|
-
function get_type(node: Opaque<"node">): LuaMultiReturn<[
|
|
1214
|
+
function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.NodeType, number | undefined]>;
|
|
1193
1215
|
/**
|
|
1194
1216
|
* Returns `true` if a node is visible and `false` if it's not.
|
|
1195
1217
|
* Invisible nodes are not rendered.
|
|
@@ -1216,7 +1238,7 @@ declare global {
|
|
|
1216
1238
|
*
|
|
1217
1239
|
* - `gui.ANCHOR_RIGHT`
|
|
1218
1240
|
*/
|
|
1219
|
-
function get_xanchor(node: Opaque<"node">):
|
|
1241
|
+
function get_xanchor(node: Opaque<"node">): gui.XAnchor;
|
|
1220
1242
|
/**
|
|
1221
1243
|
* The y-anchor specifies how the node is moved when the game is run in a different resolution.
|
|
1222
1244
|
*
|
|
@@ -1229,7 +1251,7 @@ declare global {
|
|
|
1229
1251
|
*
|
|
1230
1252
|
* - `gui.ANCHOR_BOTTOM`
|
|
1231
1253
|
*/
|
|
1232
|
-
function get_yanchor(node: Opaque<"node">):
|
|
1254
|
+
function get_yanchor(node: Opaque<"node">): gui.YAnchor;
|
|
1233
1255
|
/**
|
|
1234
1256
|
* Hides the on-display touch keyboard on the device.
|
|
1235
1257
|
*/
|
|
@@ -1329,7 +1351,7 @@ declare global {
|
|
|
1329
1351
|
* @example
|
|
1330
1352
|
* ```ts
|
|
1331
1353
|
* // How to create a texture and apply it to a new box node:
|
|
1332
|
-
* export default
|
|
1354
|
+
* export default defineGuiScript({
|
|
1333
1355
|
* init(self) {
|
|
1334
1356
|
* const w = 200;
|
|
1335
1357
|
* const h = 300;
|
|
@@ -1355,6 +1377,8 @@ declare global {
|
|
|
1355
1377
|
* });
|
|
1356
1378
|
*
|
|
1357
1379
|
* // How to create a texture using .astc format
|
|
1380
|
+
* const size = 4;
|
|
1381
|
+
* const pos = vmath.vector3(200, 200, 0);
|
|
1358
1382
|
* const path = "/assets/images/logo_4x4.astc";
|
|
1359
1383
|
* const buffer = sys.load_resource(path);
|
|
1360
1384
|
* const n = gui.new_box_node(pos, vmath.vector3(size, size, 0));
|
|
@@ -1505,7 +1529,7 @@ declare global {
|
|
|
1505
1529
|
* @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
|
|
1506
1530
|
* @example
|
|
1507
1531
|
* ```ts
|
|
1508
|
-
* export default
|
|
1532
|
+
* export default defineGuiScript({
|
|
1509
1533
|
* on_input(self, action_id, action) {
|
|
1510
1534
|
* // check for input
|
|
1511
1535
|
* if (action_id === hash("my_action")) {
|
|
@@ -1582,11 +1606,11 @@ declare global {
|
|
|
1582
1606
|
* @example
|
|
1583
1607
|
* ```ts
|
|
1584
1608
|
* // Set the texture of a node to a flipbook animation from an atlas:
|
|
1585
|
-
* function anim_callback(self, node) {
|
|
1609
|
+
* function anim_callback(self: unknown, node: unknown) {
|
|
1586
1610
|
* // Take action after animation has played.
|
|
1587
1611
|
* }
|
|
1588
1612
|
*
|
|
1589
|
-
* export default
|
|
1613
|
+
* export default defineGuiScript({
|
|
1590
1614
|
* init(self) {
|
|
1591
1615
|
* // Create a new node and set the texture to a flipbook animation
|
|
1592
1616
|
* const node = gui.get_node("button_node");
|
|
@@ -1630,13 +1654,13 @@ declare global {
|
|
|
1630
1654
|
* // How to play a particle fx when a gui node is created.
|
|
1631
1655
|
* // The callback receives the gui node, the hash of the id
|
|
1632
1656
|
* // of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
|
|
1633
|
-
* function emitter_state_change(self, node, emitter, state) {
|
|
1657
|
+
* function emitter_state_change(self: unknown, node: unknown, emitter: unknown, state: unknown) {
|
|
1634
1658
|
* if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
|
|
1635
1659
|
* // exhaust is done spawning particles...
|
|
1636
1660
|
* }
|
|
1637
1661
|
* }
|
|
1638
1662
|
*
|
|
1639
|
-
* export default
|
|
1663
|
+
* export default defineGuiScript({
|
|
1640
1664
|
* init(self) {
|
|
1641
1665
|
* gui.play_particlefx(gui.get_node("particlefx"), emitter_state_change);
|
|
1642
1666
|
* },
|
|
@@ -1676,7 +1700,7 @@ declare global {
|
|
|
1676
1700
|
* @example
|
|
1677
1701
|
* ```ts
|
|
1678
1702
|
* // Animate a node to the pressed pointer position:
|
|
1679
|
-
* export default
|
|
1703
|
+
* export default defineGuiScript({
|
|
1680
1704
|
* init() {
|
|
1681
1705
|
* msg.post(".", "acquire_input_focus");
|
|
1682
1706
|
* return { marker: gui.get_node("marker") };
|
|
@@ -1775,7 +1799,7 @@ declare global {
|
|
|
1775
1799
|
* gui.set(node, "tint_array.x", 1, { index: 4 });
|
|
1776
1800
|
*
|
|
1777
1801
|
* // Set a named property
|
|
1778
|
-
* export default
|
|
1802
|
+
* export default defineGuiScript({
|
|
1779
1803
|
* on_message(self, message_id, message) {
|
|
1780
1804
|
* if (message_id === hash("set_font")) {
|
|
1781
1805
|
* gui.set(msg.url(), "fonts", message.font, { key: "my_font_name" });
|
|
@@ -1789,6 +1813,7 @@ declare global {
|
|
|
1789
1813
|
* });
|
|
1790
1814
|
*
|
|
1791
1815
|
* // Remove a named runtime texture resource mapping:
|
|
1816
|
+
* const atlas_params = { texture: "/runtime.texturec", animations: [], geometries: [] };
|
|
1792
1817
|
* const atlas_id = resource.create_atlas("/runtime.texturesetc", atlas_params);
|
|
1793
1818
|
* gui.set(msg.url(), "textures", atlas_id, { key: "runtime_texture" });
|
|
1794
1819
|
* gui.set_texture(gui.get_node("box"), "runtime_texture");
|
|
@@ -1798,7 +1823,7 @@ declare global {
|
|
|
1798
1823
|
* resource.release(atlas_id);
|
|
1799
1824
|
* ```
|
|
1800
1825
|
*/
|
|
1801
|
-
function set(node: Opaque<"node"> | Url, property: string | Hash |
|
|
1826
|
+
function set(node: Opaque<"node"> | Url, property: string | Hash | gui.Property, value?: number | Vector4 | Vector3 | Quaternion, options?: { index?: number; key?: Hash }): void;
|
|
1802
1827
|
/**
|
|
1803
1828
|
* Sets the adjust mode on a node.
|
|
1804
1829
|
* The adjust mode defines how the node will adjust itself to screen
|
|
@@ -1813,7 +1838,7 @@ declare global {
|
|
|
1813
1838
|
*
|
|
1814
1839
|
* - `gui.ADJUST_STRETCH`
|
|
1815
1840
|
*/
|
|
1816
|
-
function set_adjust_mode(node: Opaque<"node">, adjust_mode:
|
|
1841
|
+
function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.AdjustMode): void;
|
|
1817
1842
|
/**
|
|
1818
1843
|
* sets the node alpha
|
|
1819
1844
|
*
|
|
@@ -1838,7 +1863,7 @@ declare global {
|
|
|
1838
1863
|
*
|
|
1839
1864
|
* - `gui.BLEND_SCREEN`
|
|
1840
1865
|
*/
|
|
1841
|
-
function set_blend_mode(node: Opaque<"node">, blend_mode:
|
|
1866
|
+
function set_blend_mode(node: Opaque<"node">, blend_mode: gui.BlendMode): void;
|
|
1842
1867
|
/**
|
|
1843
1868
|
* If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
|
|
1844
1869
|
*
|
|
@@ -1856,7 +1881,7 @@ declare global {
|
|
|
1856
1881
|
*
|
|
1857
1882
|
* - `gui.CLIPPING_MODE_STENCIL`
|
|
1858
1883
|
*/
|
|
1859
|
-
function set_clipping_mode(node: Opaque<"node">, clipping_mode:
|
|
1884
|
+
function set_clipping_mode(node: Opaque<"node">, clipping_mode: gui.ClippingMode): void;
|
|
1860
1885
|
/**
|
|
1861
1886
|
* 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.
|
|
1862
1887
|
*
|
|
@@ -2024,7 +2049,7 @@ declare global {
|
|
|
2024
2049
|
*
|
|
2025
2050
|
* - `gui.PIEBOUNDS_ELLIPSE`
|
|
2026
2051
|
*/
|
|
2027
|
-
function set_outer_bounds(node: Opaque<"node">, bounds_mode:
|
|
2052
|
+
function set_outer_bounds(node: Opaque<"node">, bounds_mode: gui.PieBounds): void;
|
|
2028
2053
|
/**
|
|
2029
2054
|
* Sets the outline color of the supplied node.
|
|
2030
2055
|
* See gui.set_color for info how vectors encode color values.
|
|
@@ -2079,7 +2104,7 @@ declare global {
|
|
|
2079
2104
|
*
|
|
2080
2105
|
* - `gui.PIVOT_NW`
|
|
2081
2106
|
*/
|
|
2082
|
-
function set_pivot(node: Opaque<"node">, pivot:
|
|
2107
|
+
function set_pivot(node: Opaque<"node">, pivot: gui.Pivot): void;
|
|
2083
2108
|
/**
|
|
2084
2109
|
* Sets the position of the supplied node.
|
|
2085
2110
|
*
|
|
@@ -2118,7 +2143,7 @@ declare global {
|
|
|
2118
2143
|
*
|
|
2119
2144
|
* - `gui.SAFE_AREA_BOTH`
|
|
2120
2145
|
*/
|
|
2121
|
-
function set_safe_area_mode(mode:
|
|
2146
|
+
function set_safe_area_mode(mode: gui.SafeAreaMode): void;
|
|
2122
2147
|
/**
|
|
2123
2148
|
* Sets the scaling of the supplied node.
|
|
2124
2149
|
*
|
|
@@ -2164,7 +2189,7 @@ declare global {
|
|
|
2164
2189
|
*
|
|
2165
2190
|
* - `gui.SIZE_MODE_AUTO`
|
|
2166
2191
|
*/
|
|
2167
|
-
function set_size_mode(node: Opaque<"node">, size_mode:
|
|
2192
|
+
function set_size_mode(node: Opaque<"node">, size_mode: gui.SizeMode): void;
|
|
2168
2193
|
/**
|
|
2169
2194
|
* Set the slice9 configuration values for the node.
|
|
2170
2195
|
*
|
|
@@ -2229,7 +2254,7 @@ declare global {
|
|
|
2229
2254
|
* @returns setting the data was successful
|
|
2230
2255
|
* @example
|
|
2231
2256
|
* ```ts
|
|
2232
|
-
* export default
|
|
2257
|
+
* export default defineGuiScript({
|
|
2233
2258
|
* init(self) {
|
|
2234
2259
|
* const w = 200;
|
|
2235
2260
|
* const h = 300;
|
|
@@ -2284,7 +2309,7 @@ declare global {
|
|
|
2284
2309
|
*
|
|
2285
2310
|
* - `gui.ANCHOR_RIGHT`
|
|
2286
2311
|
*/
|
|
2287
|
-
function set_xanchor(node: Opaque<"node">, anchor:
|
|
2312
|
+
function set_xanchor(node: Opaque<"node">, anchor: gui.XAnchor): void;
|
|
2288
2313
|
/**
|
|
2289
2314
|
* The y-anchor specifies how the node is moved when the game is run in a different resolution.
|
|
2290
2315
|
*
|
|
@@ -2297,7 +2322,7 @@ declare global {
|
|
|
2297
2322
|
*
|
|
2298
2323
|
* - `gui.ANCHOR_BOTTOM`
|
|
2299
2324
|
*/
|
|
2300
|
-
function set_yanchor(node: Opaque<"node">, anchor:
|
|
2325
|
+
function set_yanchor(node: Opaque<"node">, anchor: gui.YAnchor): void;
|
|
2301
2326
|
/**
|
|
2302
2327
|
* Shows the on-display touch keyboard.
|
|
2303
2328
|
* The specified type of keyboard is displayed if it is available on
|
|
@@ -2315,7 +2340,7 @@ declare global {
|
|
|
2315
2340
|
* - `gui.KEYBOARD_TYPE_PASSWORD`
|
|
2316
2341
|
* @param autoclose - if the keyboard should automatically close when clicking outside
|
|
2317
2342
|
*/
|
|
2318
|
-
function show_keyboard(type:
|
|
2343
|
+
function show_keyboard(type: gui.KeyboardType, autoclose: boolean): void;
|
|
2319
2344
|
/**
|
|
2320
2345
|
* Stops the particle fx for a gui node
|
|
2321
2346
|
*
|
package/generated/html5.d.ts
CHANGED
package/generated/http.d.ts
CHANGED
|
@@ -53,6 +53,10 @@ declare global {
|
|
|
53
53
|
* - boolean `report_progress`: when it is true, the amount of bytes sent and/or received for a request will be passed into the callback function
|
|
54
54
|
* @example
|
|
55
55
|
* ```ts
|
|
56
|
+
* function update_my_progress_bar(self: unknown, fraction: number) {
|
|
57
|
+
* // draw the progress bar at the given fraction
|
|
58
|
+
* }
|
|
59
|
+
*
|
|
56
60
|
* // Basic HTTP-GET request. The callback receives a table with the response
|
|
57
61
|
* // in the fields status, the response (the data) and headers (a table).
|
|
58
62
|
* export default defineScript({
|
package/generated/model.d.ts
CHANGED
|
@@ -83,6 +83,9 @@ declare global {
|
|
|
83
83
|
* @returns true if the mesh is visible, false otherwise
|
|
84
84
|
* @example
|
|
85
85
|
* ```ts
|
|
86
|
+
* // shared weapon data, e.g. required from your own module
|
|
87
|
+
* const game = { data: { weapons: { Sword: { damage: 10 } } } };
|
|
88
|
+
*
|
|
86
89
|
* export default defineScript({
|
|
87
90
|
* init(self) {
|
|
88
91
|
* if (model.get_mesh_enabled("#model", "Sword")) {
|
|
@@ -153,9 +156,12 @@ declare global {
|
|
|
153
156
|
* ```ts
|
|
154
157
|
* // The following examples assume that the model has id "model".
|
|
155
158
|
* // How to play the "jump" animation followed by the "run" animation:
|
|
156
|
-
*
|
|
159
|
+
* const url = msg.url("#model");
|
|
160
|
+
*
|
|
161
|
+
* function anim_done(self: unknown, message_id: unknown, message: unknown, sender: unknown) {
|
|
157
162
|
* if (message_id === hash("model_animation_done")) {
|
|
158
|
-
*
|
|
163
|
+
* const { animation_id } = message as { animation_id: Hash };
|
|
164
|
+
* if (animation_id === hash("jump")) {
|
|
159
165
|
* // open animation done, chain with "run"
|
|
160
166
|
* const properties = { blend_duration: 0.2 };
|
|
161
167
|
* model.play_anim(url, "run", go.PLAYBACK_LOOP_FORWARD, properties, anim_done);
|
|
@@ -165,7 +171,6 @@ declare global {
|
|
|
165
171
|
*
|
|
166
172
|
* export default defineScript({
|
|
167
173
|
* init(self) {
|
|
168
|
-
* const url = msg.url("#model");
|
|
169
174
|
* const play_properties = { blend_duration: 0.1 };
|
|
170
175
|
* // first blend during 0.1 sec into the jump, then during 0.2 s into the run animation
|
|
171
176
|
* model.play_anim(url, "jump", go.PLAYBACK_ONCE_FORWARD, play_properties, anim_done);
|
|
@@ -173,7 +178,7 @@ declare global {
|
|
|
173
178
|
* });
|
|
174
179
|
* ```
|
|
175
180
|
*/
|
|
176
|
-
function play_anim(url: string | Hash | Url, anim_id: string | Hash, playback:
|
|
181
|
+
function play_anim(url: string | Hash | Url, anim_id: string | Hash, playback: go.Playback, play_properties?: { blend_duration?: number; offset?: number; playback_rate?: number }, complete_function?: (self: unknown, message_id: unknown, message: unknown, sender: unknown) => void): void;
|
|
177
182
|
/**
|
|
178
183
|
* Resets a shader constant for a model component.
|
|
179
184
|
* The constant must be defined in the material assigned to the model.
|
|
@@ -53,7 +53,7 @@ declare global {
|
|
|
53
53
|
* // How to play a particle fx when a game object is created.
|
|
54
54
|
* // The callback receives the hash of the path to the particlefx, the hash of the id
|
|
55
55
|
* // of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
|
|
56
|
-
* function emitter_state_change(self, id, emitter, state) {
|
|
56
|
+
* function emitter_state_change(self: unknown, id: unknown, emitter: unknown, state: unknown) {
|
|
57
57
|
* if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
|
|
58
58
|
* // exhaust is done spawning particles...
|
|
59
59
|
* }
|
package/generated/physics.d.ts
CHANGED
|
@@ -200,6 +200,10 @@ declare global {
|
|
|
200
200
|
* @returns It returns a list. If missed it returns `nil`. See ray_cast_response for details on the returned values.
|
|
201
201
|
* @example
|
|
202
202
|
* ```ts
|
|
203
|
+
* function handle_result(hit: { fraction: number; position: Vector3; normal: Vector3; id: Hash; group: Hash; request_id: number }) {
|
|
204
|
+
* // act on the hit (see 'ray_cast_response')
|
|
205
|
+
* }
|
|
206
|
+
*
|
|
203
207
|
* // How to perform a ray cast synchronously:
|
|
204
208
|
* export default defineScript({
|
|
205
209
|
* init(self) {
|
|
@@ -208,9 +212,10 @@ declare global {
|
|
|
208
212
|
*
|
|
209
213
|
* update(self, dt) {
|
|
210
214
|
* // request ray cast
|
|
211
|
-
* const
|
|
212
|
-
*
|
|
213
|
-
*
|
|
215
|
+
* const from = go.get_world_position();
|
|
216
|
+
* const to = vmath.vector3(from.x, from.y - 100, from.z);
|
|
217
|
+
* const results = physics.raycast(from, to, self.groups, { all: true });
|
|
218
|
+
* if (results !== undefined) {
|
|
214
219
|
* for (const result of results) {
|
|
215
220
|
* handle_result(result);
|
|
216
221
|
* }
|
|
@@ -248,6 +253,8 @@ declare global {
|
|
|
248
253
|
*
|
|
249
254
|
* update(self, dt) {
|
|
250
255
|
* // request ray cast
|
|
256
|
+
* const my_start = go.get_world_position();
|
|
257
|
+
* const my_end = vmath.vector3(my_start.x, my_start.y - 100, my_start.z);
|
|
251
258
|
* physics.raycast_async(my_start, my_end, self.my_groups);
|
|
252
259
|
* },
|
|
253
260
|
*
|
|
@@ -287,8 +294,8 @@ declare global {
|
|
|
287
294
|
* table The callback value data is a table that contains event-related data. See the documentation for details on the messages.
|
|
288
295
|
* @example
|
|
289
296
|
* ```ts
|
|
290
|
-
* function physics_world_listener(self, events) {
|
|
291
|
-
* for (const event of events) {
|
|
297
|
+
* function physics_world_listener(self: unknown, events: unknown) {
|
|
298
|
+
* for (const event of events as Record<string, unknown>[]) {
|
|
292
299
|
* const event_type = event["type"];
|
|
293
300
|
* if (event_type === hash("contact_point_event")) {
|
|
294
301
|
* pprint(event);
|
|
@@ -314,7 +321,7 @@ declare global {
|
|
|
314
321
|
* // relative_velocity = vmath.vector3(0, 0, 0),
|
|
315
322
|
* // },
|
|
316
323
|
* // }
|
|
317
|
-
* } else if (
|
|
324
|
+
* } else if (event_type === hash("collision_event")) {
|
|
318
325
|
* pprint(event);
|
|
319
326
|
* // {
|
|
320
327
|
* // a = {
|
|
@@ -328,7 +335,7 @@ declare global {
|
|
|
328
335
|
* // id = hash: [/go2]
|
|
329
336
|
* // }
|
|
330
337
|
* // }
|
|
331
|
-
* } else if (
|
|
338
|
+
* } else if (event_type === hash("trigger_event")) {
|
|
332
339
|
* pprint(event);
|
|
333
340
|
* // {
|
|
334
341
|
* // enter = true,
|
|
@@ -341,7 +348,7 @@ declare global {
|
|
|
341
348
|
* // id = hash: [/go1]
|
|
342
349
|
* // }
|
|
343
350
|
* // },
|
|
344
|
-
* } else if (
|
|
351
|
+
* } else if (event_type === hash("ray_cast_response")) {
|
|
345
352
|
* pprint(event);
|
|
346
353
|
* // {
|
|
347
354
|
* // group = hash: [default],
|
|
@@ -351,7 +358,7 @@ declare global {
|
|
|
351
358
|
* // normal = vmath.vector3(0, 1, 0),
|
|
352
359
|
* // id = hash: [/go]
|
|
353
360
|
* // }
|
|
354
|
-
* } else if (
|
|
361
|
+
* } else if (event_type === hash("ray_cast_missed")) {
|
|
355
362
|
* pprint(event);
|
|
356
363
|
* // {
|
|
357
364
|
* // request_id = 0
|
package/generated/profiler.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ declare global {
|
|
|
5
5
|
* More detailed [profiling](https://www.defold.com/manuals/profiling/) and [debugging](http://www.defold.com/manuals/debugging/) information available in the manuals.
|
|
6
6
|
*/
|
|
7
7
|
namespace profiler {
|
|
8
|
+
type Mode = typeof profiler.MODE_RUN | typeof profiler.MODE_PAUSE | typeof profiler.MODE_SHOW_PEAK_FRAME | typeof profiler.MODE_RECORD;
|
|
9
|
+
type ViewMode = typeof profiler.VIEW_MODE_FULL | typeof profiler.VIEW_MODE_MINIMIZED;
|
|
8
10
|
/**
|
|
9
11
|
* pause on current frame
|
|
10
12
|
*/
|
|
@@ -113,6 +115,7 @@ declare global {
|
|
|
113
115
|
* @param text - the string to send to the connected profiler
|
|
114
116
|
* @example
|
|
115
117
|
* ```ts
|
|
118
|
+
* const name = "my_event";
|
|
116
119
|
* profiler.log_text(`Event: ${name}`);
|
|
117
120
|
* ```
|
|
118
121
|
*/
|
|
@@ -135,6 +138,10 @@ declare global {
|
|
|
135
138
|
* @param name - The name of the scope
|
|
136
139
|
* @example
|
|
137
140
|
* ```ts
|
|
141
|
+
* function test_function() {
|
|
142
|
+
* // the work being measured
|
|
143
|
+
* }
|
|
144
|
+
*
|
|
138
145
|
* // Go back one frame
|
|
139
146
|
* profiler.scope_begin("test_function");
|
|
140
147
|
* test_function();
|
|
@@ -173,7 +180,7 @@ declare global {
|
|
|
173
180
|
* }
|
|
174
181
|
* ```
|
|
175
182
|
*/
|
|
176
|
-
function set_ui_mode(mode:
|
|
183
|
+
function set_ui_mode(mode: profiler.Mode): void;
|
|
177
184
|
/**
|
|
178
185
|
* Set the on-screen profile view mode - minimized or expanded
|
|
179
186
|
*
|
|
@@ -188,7 +195,7 @@ declare global {
|
|
|
188
195
|
* profiler.set_ui_view_mode(profiler.VIEW_MODE_MINIMIZED);
|
|
189
196
|
* ```
|
|
190
197
|
*/
|
|
191
|
-
function set_ui_view_mode(mode:
|
|
198
|
+
function set_ui_view_mode(mode: profiler.ViewMode): void;
|
|
192
199
|
/**
|
|
193
200
|
* Shows or hides the time the engine waits for vsync in the on-screen profiler
|
|
194
201
|
* Each frame the engine waits for vsync and depending on your vsync settings and how much time
|