@defold-typescript/types 0.38.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 +336 -255
- 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/render-overloads.d.ts +0 -17
|
@@ -8,6 +8,20 @@ declare global {
|
|
|
8
8
|
* accessible only from gui scripts.
|
|
9
9
|
*/
|
|
10
10
|
namespace gui {
|
|
11
|
+
type AdjustMode = typeof gui.ADJUST_FIT | typeof gui.ADJUST_ZOOM | typeof gui.ADJUST_STRETCH;
|
|
12
|
+
type BlendMode = typeof gui.BLEND_ALPHA | typeof gui.BLEND_ADD | typeof gui.BLEND_ADD_ALPHA | typeof gui.BLEND_MULT | typeof gui.BLEND_SCREEN;
|
|
13
|
+
type ClippingMode = typeof gui.CLIPPING_MODE_NONE | typeof gui.CLIPPING_MODE_STENCIL;
|
|
14
|
+
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;
|
|
15
|
+
type KeyboardType = typeof gui.KEYBOARD_TYPE_DEFAULT | typeof gui.KEYBOARD_TYPE_EMAIL | typeof gui.KEYBOARD_TYPE_NUMBER_PAD | typeof gui.KEYBOARD_TYPE_PASSWORD;
|
|
16
|
+
type NodeType = typeof gui.TYPE_BOX | typeof gui.TYPE_TEXT | typeof gui.TYPE_PIE | typeof gui.TYPE_PARTICLEFX | typeof gui.TYPE_CUSTOM;
|
|
17
|
+
type PieBounds = typeof gui.PIEBOUNDS_RECTANGLE | typeof gui.PIEBOUNDS_ELLIPSE;
|
|
18
|
+
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;
|
|
19
|
+
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;
|
|
20
|
+
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;
|
|
21
|
+
type SafeAreaMode = typeof gui.SAFE_AREA_NONE | typeof gui.SAFE_AREA_LONG | typeof gui.SAFE_AREA_SHORT | typeof gui.SAFE_AREA_BOTH;
|
|
22
|
+
type SizeMode = typeof gui.SIZE_MODE_MANUAL | typeof gui.SIZE_MODE_AUTO;
|
|
23
|
+
type XAnchor = typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_LEFT | typeof gui.ANCHOR_RIGHT;
|
|
24
|
+
type YAnchor = typeof gui.ANCHOR_NONE | typeof gui.ANCHOR_TOP | typeof gui.ANCHOR_BOTTOM;
|
|
11
25
|
/**
|
|
12
26
|
* Adjust mode is used when the screen resolution differs from the project settings.
|
|
13
27
|
* The fit mode ensures that the entire node is visible in the adjusted gui scene.
|
|
@@ -524,19 +538,24 @@ declare global {
|
|
|
524
538
|
*
|
|
525
539
|
* - `gui.PLAYBACK_LOOP_PINGPONG`
|
|
526
540
|
* @example
|
|
541
|
+
* How to start a simple color animation, where the node fades in to white during 0.5 seconds:
|
|
527
542
|
* ```ts
|
|
528
543
|
* // How to start a simple color animation, where the node fades in to white during 0.5 seconds:
|
|
544
|
+
* const node = gui.get_node("my_node");
|
|
529
545
|
* gui.set_color(node, vmath.vector4(0, 0, 0, 0)); // node is fully transparent
|
|
530
546
|
* gui.animate(node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5); // start animation
|
|
531
|
-
*
|
|
547
|
+
* ```
|
|
548
|
+
* @example
|
|
549
|
+
* 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:
|
|
550
|
+
* ```ts
|
|
532
551
|
* // How to start a sequenced animation where the node fades in to white during 0.5
|
|
533
552
|
* // seconds, stays visible for 2 seconds and then fades out:
|
|
534
|
-
* function on_animation_done(self, node) {
|
|
553
|
+
* function on_animation_done(self: unknown, node: unknown) {
|
|
535
554
|
* // fade out node, but wait 2 seconds before the animation starts
|
|
536
|
-
* gui.animate(node
|
|
555
|
+
* gui.animate(node as Opaque<"node">, gui.PROP_COLOR, vmath.vector4(0, 0, 0, 0), gui.EASING_OUTQUAD, 0.5, 2.0);
|
|
537
556
|
* }
|
|
538
557
|
*
|
|
539
|
-
* export default
|
|
558
|
+
* export default defineGuiScript({
|
|
540
559
|
* init(self) {
|
|
541
560
|
* // fetch the node we want to animate
|
|
542
561
|
* const my_node = gui.get_node("my_node");
|
|
@@ -546,9 +565,12 @@ declare global {
|
|
|
546
565
|
* gui.animate(my_node, gui.PROP_COLOR, vmath.vector4(1, 1, 1, 1), gui.EASING_INOUTQUAD, 0.5, 0.0, on_animation_done);
|
|
547
566
|
* },
|
|
548
567
|
* });
|
|
549
|
-
*
|
|
568
|
+
* ```
|
|
569
|
+
* @example
|
|
570
|
+
* How to animate a node's y position using a crazy custom easing curve:
|
|
571
|
+
* ```ts
|
|
550
572
|
* // How to animate a node's y position using a crazy custom easing curve:
|
|
551
|
-
* export default
|
|
573
|
+
* export default defineGuiScript({
|
|
552
574
|
* init(self) {
|
|
553
575
|
* const values = [
|
|
554
576
|
* 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
@@ -563,7 +585,7 @@ declare global {
|
|
|
563
585
|
* });
|
|
564
586
|
* ```
|
|
565
587
|
*/
|
|
566
|
-
function animate(node: Opaque<"node">, property: string |
|
|
588
|
+
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;
|
|
567
589
|
/**
|
|
568
590
|
* If one or more animations of the specified node is currently running (started by `gui.animate`), they will immediately be canceled.
|
|
569
591
|
*
|
|
@@ -616,7 +638,7 @@ declare global {
|
|
|
616
638
|
* gui.cancel_animations(node);
|
|
617
639
|
* ```
|
|
618
640
|
*/
|
|
619
|
-
function cancel_animations(node: Opaque<"node">, property?: string |
|
|
641
|
+
function cancel_animations(node: Opaque<"node">, property?: string | gui.Property): void;
|
|
620
642
|
/**
|
|
621
643
|
* Cancels any running flipbook animation on the specified node.
|
|
622
644
|
*
|
|
@@ -666,7 +688,7 @@ declare global {
|
|
|
666
688
|
* @param texture - texture id
|
|
667
689
|
* @example
|
|
668
690
|
* ```ts
|
|
669
|
-
* export default
|
|
691
|
+
* export default defineGuiScript({
|
|
670
692
|
* init(self) {
|
|
671
693
|
* // Create a texture.
|
|
672
694
|
* if (gui.new_texture("temp_tx", 10, 10, "rgb", "\0".repeat(10 * 10 * 3))) {
|
|
@@ -746,7 +768,7 @@ declare global {
|
|
|
746
768
|
* const node_position = gui.get(node, "position");
|
|
747
769
|
* ```
|
|
748
770
|
*/
|
|
749
|
-
function get(node: Opaque<"node">, property: string | Hash |
|
|
771
|
+
function get(node: Opaque<"node">, property: string | Hash | gui.Property, options?: { index?: number }): unknown;
|
|
750
772
|
/**
|
|
751
773
|
* Returns the adjust mode of a node.
|
|
752
774
|
* The adjust mode defines how the node will adjust itself to screen
|
|
@@ -761,7 +783,7 @@ declare global {
|
|
|
761
783
|
*
|
|
762
784
|
* - `gui.ADJUST_STRETCH`
|
|
763
785
|
*/
|
|
764
|
-
function get_adjust_mode(node: Opaque<"node">):
|
|
786
|
+
function get_adjust_mode(node: Opaque<"node">): gui.AdjustMode;
|
|
765
787
|
/**
|
|
766
788
|
* gets the node alpha
|
|
767
789
|
*
|
|
@@ -786,7 +808,7 @@ declare global {
|
|
|
786
808
|
*
|
|
787
809
|
* - `gui.BLEND_SCREEN`
|
|
788
810
|
*/
|
|
789
|
-
function get_blend_mode(node: Opaque<"node">):
|
|
811
|
+
function get_blend_mode(node: Opaque<"node">): gui.BlendMode;
|
|
790
812
|
/**
|
|
791
813
|
* If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
|
|
792
814
|
*
|
|
@@ -804,7 +826,7 @@ declare global {
|
|
|
804
826
|
*
|
|
805
827
|
* - `gui.CLIPPING_MODE_STENCIL`
|
|
806
828
|
*/
|
|
807
|
-
function get_clipping_mode(node: Opaque<"node">):
|
|
829
|
+
function get_clipping_mode(node: Opaque<"node">): gui.ClippingMode;
|
|
808
830
|
/**
|
|
809
831
|
* If node is set as visible clipping node, it will be shown as well as clipping. Otherwise, it will only clip but not show visually.
|
|
810
832
|
*
|
|
@@ -886,7 +908,7 @@ declare global {
|
|
|
886
908
|
* @example
|
|
887
909
|
* ```ts
|
|
888
910
|
* // Get the text metrics for a text
|
|
889
|
-
* export default
|
|
911
|
+
* export default defineGuiScript({
|
|
890
912
|
* init(self) {
|
|
891
913
|
* const node = gui.get_node("name");
|
|
892
914
|
* const font_name = gui.get_font(node);
|
|
@@ -1030,7 +1052,7 @@ declare global {
|
|
|
1030
1052
|
*
|
|
1031
1053
|
* - `gui.PIEBOUNDS_ELLIPSE`
|
|
1032
1054
|
*/
|
|
1033
|
-
function get_outer_bounds(node: Opaque<"node">):
|
|
1055
|
+
function get_outer_bounds(node: Opaque<"node">): gui.PieBounds;
|
|
1034
1056
|
/**
|
|
1035
1057
|
* Returns the outline color of the supplied node.
|
|
1036
1058
|
* See gui.get_color for info how vectors encode color values.
|
|
@@ -1086,7 +1108,7 @@ declare global {
|
|
|
1086
1108
|
*
|
|
1087
1109
|
* - `gui.PIVOT_NW`
|
|
1088
1110
|
*/
|
|
1089
|
-
function get_pivot(node: Opaque<"node">):
|
|
1111
|
+
function get_pivot(node: Opaque<"node">): gui.Pivot;
|
|
1090
1112
|
/**
|
|
1091
1113
|
* Returns the position of the supplied node.
|
|
1092
1114
|
*
|
|
@@ -1148,7 +1170,7 @@ declare global {
|
|
|
1148
1170
|
*
|
|
1149
1171
|
* - `gui.SIZE_MODE_AUTO`
|
|
1150
1172
|
*/
|
|
1151
|
-
function get_size_mode(node: Opaque<"node">):
|
|
1173
|
+
function get_size_mode(node: Opaque<"node">): gui.SizeMode;
|
|
1152
1174
|
/**
|
|
1153
1175
|
* Returns the slice9 configuration values for the node.
|
|
1154
1176
|
*
|
|
@@ -1191,7 +1213,7 @@ declare global {
|
|
|
1191
1213
|
*
|
|
1192
1214
|
* @param node - node from which to get the type
|
|
1193
1215
|
*/
|
|
1194
|
-
function get_type(node: Opaque<"node">): LuaMultiReturn<[
|
|
1216
|
+
function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.NodeType, number | undefined]>;
|
|
1195
1217
|
/**
|
|
1196
1218
|
* Returns `true` if a node is visible and `false` if it's not.
|
|
1197
1219
|
* Invisible nodes are not rendered.
|
|
@@ -1218,7 +1240,7 @@ declare global {
|
|
|
1218
1240
|
*
|
|
1219
1241
|
* - `gui.ANCHOR_RIGHT`
|
|
1220
1242
|
*/
|
|
1221
|
-
function get_xanchor(node: Opaque<"node">):
|
|
1243
|
+
function get_xanchor(node: Opaque<"node">): gui.XAnchor;
|
|
1222
1244
|
/**
|
|
1223
1245
|
* The y-anchor specifies how the node is moved when the game is run in a different resolution.
|
|
1224
1246
|
*
|
|
@@ -1231,7 +1253,7 @@ declare global {
|
|
|
1231
1253
|
*
|
|
1232
1254
|
* - `gui.ANCHOR_BOTTOM`
|
|
1233
1255
|
*/
|
|
1234
|
-
function get_yanchor(node: Opaque<"node">):
|
|
1256
|
+
function get_yanchor(node: Opaque<"node">): gui.YAnchor;
|
|
1235
1257
|
/**
|
|
1236
1258
|
* Hides the on-display touch keyboard on the device.
|
|
1237
1259
|
*/
|
|
@@ -1331,7 +1353,7 @@ declare global {
|
|
|
1331
1353
|
* @example
|
|
1332
1354
|
* ```ts
|
|
1333
1355
|
* // How to create a texture and apply it to a new box node:
|
|
1334
|
-
* export default
|
|
1356
|
+
* export default defineGuiScript({
|
|
1335
1357
|
* init(self) {
|
|
1336
1358
|
* const w = 200;
|
|
1337
1359
|
* const h = 300;
|
|
@@ -1357,6 +1379,8 @@ declare global {
|
|
|
1357
1379
|
* });
|
|
1358
1380
|
*
|
|
1359
1381
|
* // How to create a texture using .astc format
|
|
1382
|
+
* const size = 4;
|
|
1383
|
+
* const pos = vmath.vector3(200, 200, 0);
|
|
1360
1384
|
* const path = "/assets/images/logo_4x4.astc";
|
|
1361
1385
|
* const buffer = sys.load_resource(path);
|
|
1362
1386
|
* const n = gui.new_box_node(pos, vmath.vector3(size, size, 0));
|
|
@@ -1507,7 +1531,7 @@ declare global {
|
|
|
1507
1531
|
* @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
|
|
1508
1532
|
* @example
|
|
1509
1533
|
* ```ts
|
|
1510
|
-
* export default
|
|
1534
|
+
* export default defineGuiScript({
|
|
1511
1535
|
* on_input(self, action_id, action) {
|
|
1512
1536
|
* // check for input
|
|
1513
1537
|
* if (action_id === hash("my_action")) {
|
|
@@ -1584,11 +1608,11 @@ declare global {
|
|
|
1584
1608
|
* @example
|
|
1585
1609
|
* ```ts
|
|
1586
1610
|
* // Set the texture of a node to a flipbook animation from an atlas:
|
|
1587
|
-
* function anim_callback(self, node) {
|
|
1611
|
+
* function anim_callback(self: unknown, node: unknown) {
|
|
1588
1612
|
* // Take action after animation has played.
|
|
1589
1613
|
* }
|
|
1590
1614
|
*
|
|
1591
|
-
* export default
|
|
1615
|
+
* export default defineGuiScript({
|
|
1592
1616
|
* init(self) {
|
|
1593
1617
|
* // Create a new node and set the texture to a flipbook animation
|
|
1594
1618
|
* const node = gui.get_node("button_node");
|
|
@@ -1632,13 +1656,13 @@ declare global {
|
|
|
1632
1656
|
* // How to play a particle fx when a gui node is created.
|
|
1633
1657
|
* // The callback receives the gui node, the hash of the id
|
|
1634
1658
|
* // of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
|
|
1635
|
-
* function emitter_state_change(self, node, emitter, state) {
|
|
1659
|
+
* function emitter_state_change(self: unknown, node: unknown, emitter: unknown, state: unknown) {
|
|
1636
1660
|
* if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
|
|
1637
1661
|
* // exhaust is done spawning particles...
|
|
1638
1662
|
* }
|
|
1639
1663
|
* }
|
|
1640
1664
|
*
|
|
1641
|
-
* export default
|
|
1665
|
+
* export default defineGuiScript({
|
|
1642
1666
|
* init(self) {
|
|
1643
1667
|
* gui.play_particlefx(gui.get_node("particlefx"), emitter_state_change);
|
|
1644
1668
|
* },
|
|
@@ -1757,7 +1781,7 @@ declare global {
|
|
|
1757
1781
|
* gui.set(node, "tint_array.x", 1, { index: 4 });
|
|
1758
1782
|
*
|
|
1759
1783
|
* // Set a named property
|
|
1760
|
-
* export default
|
|
1784
|
+
* export default defineGuiScript({
|
|
1761
1785
|
* on_message(self, message_id, message) {
|
|
1762
1786
|
* if (message_id === hash("set_font")) {
|
|
1763
1787
|
* gui.set(msg.url(), "fonts", message.font, { key: "my_font_name" });
|
|
@@ -1771,7 +1795,7 @@ declare global {
|
|
|
1771
1795
|
* });
|
|
1772
1796
|
* ```
|
|
1773
1797
|
*/
|
|
1774
|
-
function set(node: Opaque<"node"> | Url, property: string | Hash |
|
|
1798
|
+
function set(node: Opaque<"node"> | Url, property: string | Hash | gui.Property, value: number | Vector4 | Vector3 | Quaternion, options?: { index?: number; key?: Hash }): void;
|
|
1775
1799
|
/**
|
|
1776
1800
|
* Sets the adjust mode on a node.
|
|
1777
1801
|
* The adjust mode defines how the node will adjust itself to screen
|
|
@@ -1786,7 +1810,7 @@ declare global {
|
|
|
1786
1810
|
*
|
|
1787
1811
|
* - `gui.ADJUST_STRETCH`
|
|
1788
1812
|
*/
|
|
1789
|
-
function set_adjust_mode(node: Opaque<"node">, adjust_mode:
|
|
1813
|
+
function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.AdjustMode): void;
|
|
1790
1814
|
/**
|
|
1791
1815
|
* sets the node alpha
|
|
1792
1816
|
*
|
|
@@ -1811,7 +1835,7 @@ declare global {
|
|
|
1811
1835
|
*
|
|
1812
1836
|
* - `gui.BLEND_SCREEN`
|
|
1813
1837
|
*/
|
|
1814
|
-
function set_blend_mode(node: Opaque<"node">, blend_mode:
|
|
1838
|
+
function set_blend_mode(node: Opaque<"node">, blend_mode: gui.BlendMode): void;
|
|
1815
1839
|
/**
|
|
1816
1840
|
* If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
|
|
1817
1841
|
*
|
|
@@ -1829,7 +1853,7 @@ declare global {
|
|
|
1829
1853
|
*
|
|
1830
1854
|
* - `gui.CLIPPING_MODE_STENCIL`
|
|
1831
1855
|
*/
|
|
1832
|
-
function set_clipping_mode(node: Opaque<"node">, clipping_mode:
|
|
1856
|
+
function set_clipping_mode(node: Opaque<"node">, clipping_mode: gui.ClippingMode): void;
|
|
1833
1857
|
/**
|
|
1834
1858
|
* If node is set as an visible clipping node, it will be shown as well as clipping. Otherwise, it will only clip but not show visually.
|
|
1835
1859
|
*
|
|
@@ -1997,7 +2021,7 @@ declare global {
|
|
|
1997
2021
|
*
|
|
1998
2022
|
* - `gui.PIEBOUNDS_ELLIPSE`
|
|
1999
2023
|
*/
|
|
2000
|
-
function set_outer_bounds(node: Opaque<"node">, bounds_mode:
|
|
2024
|
+
function set_outer_bounds(node: Opaque<"node">, bounds_mode: gui.PieBounds): void;
|
|
2001
2025
|
/**
|
|
2002
2026
|
* Sets the outline color of the supplied node.
|
|
2003
2027
|
* See gui.set_color for info how vectors encode color values.
|
|
@@ -2052,7 +2076,7 @@ declare global {
|
|
|
2052
2076
|
*
|
|
2053
2077
|
* - `gui.PIVOT_NW`
|
|
2054
2078
|
*/
|
|
2055
|
-
function set_pivot(node: Opaque<"node">, pivot:
|
|
2079
|
+
function set_pivot(node: Opaque<"node">, pivot: gui.Pivot): void;
|
|
2056
2080
|
/**
|
|
2057
2081
|
* Sets the position of the supplied node.
|
|
2058
2082
|
*
|
|
@@ -2091,7 +2115,7 @@ declare global {
|
|
|
2091
2115
|
*
|
|
2092
2116
|
* - `gui.SAFE_AREA_BOTH`
|
|
2093
2117
|
*/
|
|
2094
|
-
function set_safe_area_mode(mode:
|
|
2118
|
+
function set_safe_area_mode(mode: gui.SafeAreaMode): void;
|
|
2095
2119
|
/**
|
|
2096
2120
|
* Sets the scaling of the supplied node.
|
|
2097
2121
|
*
|
|
@@ -2137,7 +2161,7 @@ declare global {
|
|
|
2137
2161
|
*
|
|
2138
2162
|
* - `gui.SIZE_MODE_AUTO`
|
|
2139
2163
|
*/
|
|
2140
|
-
function set_size_mode(node: Opaque<"node">, size_mode:
|
|
2164
|
+
function set_size_mode(node: Opaque<"node">, size_mode: gui.SizeMode): void;
|
|
2141
2165
|
/**
|
|
2142
2166
|
* Set the slice9 configuration values for the node.
|
|
2143
2167
|
*
|
|
@@ -2202,7 +2226,7 @@ declare global {
|
|
|
2202
2226
|
* @returns setting the data was successful
|
|
2203
2227
|
* @example
|
|
2204
2228
|
* ```ts
|
|
2205
|
-
* export default
|
|
2229
|
+
* export default defineGuiScript({
|
|
2206
2230
|
* init(self) {
|
|
2207
2231
|
* const w = 200;
|
|
2208
2232
|
* const h = 300;
|
|
@@ -2257,7 +2281,7 @@ declare global {
|
|
|
2257
2281
|
*
|
|
2258
2282
|
* - `gui.ANCHOR_RIGHT`
|
|
2259
2283
|
*/
|
|
2260
|
-
function set_xanchor(node: Opaque<"node">, anchor:
|
|
2284
|
+
function set_xanchor(node: Opaque<"node">, anchor: gui.XAnchor): void;
|
|
2261
2285
|
/**
|
|
2262
2286
|
* The y-anchor specifies how the node is moved when the game is run in a different resolution.
|
|
2263
2287
|
*
|
|
@@ -2270,7 +2294,7 @@ declare global {
|
|
|
2270
2294
|
*
|
|
2271
2295
|
* - `gui.ANCHOR_BOTTOM`
|
|
2272
2296
|
*/
|
|
2273
|
-
function set_yanchor(node: Opaque<"node">, anchor:
|
|
2297
|
+
function set_yanchor(node: Opaque<"node">, anchor: gui.YAnchor): void;
|
|
2274
2298
|
/**
|
|
2275
2299
|
* Shows the on-display touch keyboard.
|
|
2276
2300
|
* The specified type of keyboard is displayed if it is available on
|
|
@@ -2288,7 +2312,7 @@ declare global {
|
|
|
2288
2312
|
* - `gui.KEYBOARD_TYPE_PASSWORD`
|
|
2289
2313
|
* @param autoclose - if the keyboard should automatically close when clicking outside
|
|
2290
2314
|
*/
|
|
2291
|
-
function show_keyboard(type:
|
|
2315
|
+
function show_keyboard(type: gui.KeyboardType, autoclose: boolean): void;
|
|
2292
2316
|
/**
|
|
2293
2317
|
* Stops the particle fx for a gui node
|
|
2294
2318
|
*
|
|
@@ -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({
|
|
@@ -68,6 +68,9 @@ declare global {
|
|
|
68
68
|
* @returns true if the mesh is visible, false otherwise
|
|
69
69
|
* @example
|
|
70
70
|
* ```ts
|
|
71
|
+
* // shared weapon data, e.g. required from your own module
|
|
72
|
+
* const game = { data: { weapons: { Sword: { damage: 10 } } } };
|
|
73
|
+
*
|
|
71
74
|
* export default defineScript({
|
|
72
75
|
* init(self) {
|
|
73
76
|
* if (model.get_mesh_enabled("#model", "Sword")) {
|
|
@@ -138,9 +141,12 @@ declare global {
|
|
|
138
141
|
* ```ts
|
|
139
142
|
* // The following examples assume that the model has id "model".
|
|
140
143
|
* // How to play the "jump" animation followed by the "run" animation:
|
|
141
|
-
*
|
|
144
|
+
* const url = msg.url("#model");
|
|
145
|
+
*
|
|
146
|
+
* function anim_done(self: unknown, message_id: unknown, message: unknown, sender: unknown) {
|
|
142
147
|
* if (message_id === hash("model_animation_done")) {
|
|
143
|
-
*
|
|
148
|
+
* const { animation_id } = message as { animation_id: Hash };
|
|
149
|
+
* if (animation_id === hash("jump")) {
|
|
144
150
|
* // open animation done, chain with "run"
|
|
145
151
|
* const properties = { blend_duration: 0.2 };
|
|
146
152
|
* model.play_anim(url, "run", go.PLAYBACK_LOOP_FORWARD, properties, anim_done);
|
|
@@ -150,7 +156,6 @@ declare global {
|
|
|
150
156
|
*
|
|
151
157
|
* export default defineScript({
|
|
152
158
|
* init(self) {
|
|
153
|
-
* const url = msg.url("#model");
|
|
154
159
|
* const play_properties = { blend_duration: 0.1 };
|
|
155
160
|
* // first blend during 0.1 sec into the jump, then during 0.2 s into the run animation
|
|
156
161
|
* model.play_anim(url, "jump", go.PLAYBACK_ONCE_FORWARD, play_properties, anim_done);
|
|
@@ -158,7 +163,7 @@ declare global {
|
|
|
158
163
|
* });
|
|
159
164
|
* ```
|
|
160
165
|
*/
|
|
161
|
-
function play_anim(url: string | Hash | Url, anim_id: string | Hash, playback:
|
|
166
|
+
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;
|
|
162
167
|
/**
|
|
163
168
|
* Enable or disable visibility of a mesh
|
|
164
169
|
*
|
|
@@ -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
|
* }
|
|
@@ -202,6 +202,10 @@ declare global {
|
|
|
202
202
|
* @returns It returns a list. If missed it returns `nil`. See ray_cast_response for details on the returned values.
|
|
203
203
|
* @example
|
|
204
204
|
* ```ts
|
|
205
|
+
* function handle_result(hit: { fraction: number; position: Vector3; normal: Vector3; id: Hash; group: Hash; request_id: number }) {
|
|
206
|
+
* // act on the hit (see 'ray_cast_response')
|
|
207
|
+
* }
|
|
208
|
+
*
|
|
205
209
|
* // How to perform a ray cast synchronously:
|
|
206
210
|
* export default defineScript({
|
|
207
211
|
* init(self) {
|
|
@@ -210,9 +214,10 @@ declare global {
|
|
|
210
214
|
*
|
|
211
215
|
* update(self, dt) {
|
|
212
216
|
* // request ray cast
|
|
213
|
-
* const
|
|
214
|
-
*
|
|
215
|
-
*
|
|
217
|
+
* const from = go.get_world_position();
|
|
218
|
+
* const to = vmath.vector3(from.x, from.y - 100, from.z);
|
|
219
|
+
* const results = physics.raycast(from, to, self.groups, { all: true });
|
|
220
|
+
* if (results !== undefined) {
|
|
216
221
|
* for (const result of results) {
|
|
217
222
|
* handle_result(result);
|
|
218
223
|
* }
|
|
@@ -250,6 +255,8 @@ declare global {
|
|
|
250
255
|
*
|
|
251
256
|
* update(self, dt) {
|
|
252
257
|
* // request ray cast
|
|
258
|
+
* const my_start = go.get_world_position();
|
|
259
|
+
* const my_end = vmath.vector3(my_start.x, my_start.y - 100, my_start.z);
|
|
253
260
|
* physics.raycast_async(my_start, my_end, self.my_groups);
|
|
254
261
|
* },
|
|
255
262
|
*
|
|
@@ -289,8 +296,8 @@ declare global {
|
|
|
289
296
|
* table The callback value data is a table that contains event-related data. See the documentation for details on the messages.
|
|
290
297
|
* @example
|
|
291
298
|
* ```ts
|
|
292
|
-
* function physics_world_listener(self, events) {
|
|
293
|
-
* for (const event of events) {
|
|
299
|
+
* function physics_world_listener(self: unknown, events: unknown) {
|
|
300
|
+
* for (const event of events as Record<string, unknown>[]) {
|
|
294
301
|
* const event_type = event["type"];
|
|
295
302
|
* if (event_type === hash("contact_point_event")) {
|
|
296
303
|
* pprint(event);
|
|
@@ -316,7 +323,7 @@ declare global {
|
|
|
316
323
|
* // relative_velocity = vmath.vector3(0, 0, 0),
|
|
317
324
|
* // },
|
|
318
325
|
* // }
|
|
319
|
-
* } else if (
|
|
326
|
+
* } else if (event_type === hash("collision_event")) {
|
|
320
327
|
* pprint(event);
|
|
321
328
|
* // {
|
|
322
329
|
* // a = {
|
|
@@ -330,7 +337,7 @@ declare global {
|
|
|
330
337
|
* // id = hash: [/go2]
|
|
331
338
|
* // }
|
|
332
339
|
* // }
|
|
333
|
-
* } else if (
|
|
340
|
+
* } else if (event_type === hash("trigger_event")) {
|
|
334
341
|
* pprint(event);
|
|
335
342
|
* // {
|
|
336
343
|
* // enter = true,
|
|
@@ -343,7 +350,7 @@ declare global {
|
|
|
343
350
|
* // id = hash: [/go1]
|
|
344
351
|
* // }
|
|
345
352
|
* // },
|
|
346
|
-
* } else if (
|
|
353
|
+
* } else if (event_type === hash("ray_cast_response")) {
|
|
347
354
|
* pprint(event);
|
|
348
355
|
* // {
|
|
349
356
|
* // group = hash: [default],
|
|
@@ -353,7 +360,7 @@ declare global {
|
|
|
353
360
|
* // normal = vmath.vector3(0, 1, 0),
|
|
354
361
|
* // id = hash: [/go]
|
|
355
362
|
* // }
|
|
356
|
-
* } else if (
|
|
363
|
+
* } else if (event_type === hash("ray_cast_missed")) {
|
|
357
364
|
* pprint(event);
|
|
358
365
|
* // {
|
|
359
366
|
* // request_id = 0
|
|
@@ -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
|
*/
|
|
@@ -114,6 +116,7 @@ declare global {
|
|
|
114
116
|
* @param text - the string to send to the connected profiler
|
|
115
117
|
* @example
|
|
116
118
|
* ```ts
|
|
119
|
+
* const name = "my_event";
|
|
117
120
|
* profiler.log_text(`Event: ${name}`);
|
|
118
121
|
* ```
|
|
119
122
|
*/
|
|
@@ -136,6 +139,10 @@ declare global {
|
|
|
136
139
|
* @param name - The name of the scope
|
|
137
140
|
* @example
|
|
138
141
|
* ```ts
|
|
142
|
+
* function test_function() {
|
|
143
|
+
* // the work being measured
|
|
144
|
+
* }
|
|
145
|
+
*
|
|
139
146
|
* // Go back one frame
|
|
140
147
|
* profiler.scope_begin("test_function");
|
|
141
148
|
* test_function();
|
|
@@ -174,7 +181,7 @@ declare global {
|
|
|
174
181
|
* }
|
|
175
182
|
* ```
|
|
176
183
|
*/
|
|
177
|
-
function set_ui_mode(mode:
|
|
184
|
+
function set_ui_mode(mode: profiler.Mode): void;
|
|
178
185
|
/**
|
|
179
186
|
* Set the on-screen profile view mode - minimized or expanded
|
|
180
187
|
*
|
|
@@ -189,7 +196,7 @@ declare global {
|
|
|
189
196
|
* profiler.set_ui_view_mode(profiler.VIEW_MODE_MINIMIZED);
|
|
190
197
|
* ```
|
|
191
198
|
*/
|
|
192
|
-
function set_ui_view_mode(mode:
|
|
199
|
+
function set_ui_view_mode(mode: profiler.ViewMode): void;
|
|
193
200
|
/**
|
|
194
201
|
* Shows or hides the time the engine waits for vsync in the on-screen profiler
|
|
195
202
|
* Each frame the engine waits for vsync and depending on your vsync settings and how much time
|