@defold-typescript/types 0.8.4 → 0.9.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/README.md +1 -1
- package/api-targets.json +18 -0
- package/generated/b2d_body.d.ts +348 -0
- package/generated/buffer.d.ts +3 -0
- package/generated/camera.d.ts +236 -1
- package/generated/collectionfactory.d.ts +4 -0
- package/generated/factory.d.ts +4 -0
- package/generated/font.d.ts +81 -0
- package/generated/go.d.ts +53 -0
- package/generated/gui.d.ts +264 -49
- package/generated/html5.d.ts +17 -13
- package/generated/http.d.ts +16 -0
- package/generated/image.d.ts +24 -0
- package/generated/json.d.ts +2 -0
- package/generated/kinds/gui-script.d.ts +2 -0
- package/generated/kinds/render-script.d.ts +2 -0
- package/generated/kinds/script.d.ts +2 -0
- package/generated/model.d.ts +14 -0
- package/generated/msg.d.ts +17 -11
- package/generated/particlefx.d.ts +6 -0
- package/generated/physics.d.ts +32 -0
- package/generated/profiler.d.ts +14 -0
- package/generated/render.d.ts +109 -0
- package/generated/resource.d.ts +223 -0
- package/generated/socket.d.ts +4 -0
- package/generated/sound.d.ts +6 -0
- package/generated/sprite.d.ts +5 -0
- package/generated/sys.d.ts +136 -0
- package/generated/tilemap.d.ts +2 -0
- package/generated/timer.d.ts +3 -0
- package/generated/vmath.d.ts +109 -93
- package/generated/window.d.ts +23 -0
- package/index.d.ts +7 -0
- package/package.json +1 -1
- package/scripts/fidelity-baseline.json +18 -2
- package/scripts/regen.ts +4 -0
- package/scripts/signature-store-io.ts +18 -0
- package/scripts/sync-api-docs.ts +208 -12
- package/src/core-types.ts +4 -2
- package/src/doc-comment.ts +42 -5
- package/src/engine-globals.d.ts +2 -0
- package/src/example-store.ts +11 -7
- package/src/index.ts +18 -1
- package/src/msg-overloads.d.ts +3 -0
- package/src/signature-store.ts +20 -0
package/generated/gui.d.ts
CHANGED
|
@@ -448,32 +448,59 @@ declare global {
|
|
|
448
448
|
*
|
|
449
449
|
* @param node - node to animate
|
|
450
450
|
* @param property - property to animate
|
|
451
|
+
*
|
|
451
452
|
* - `"position"`
|
|
453
|
+
*
|
|
452
454
|
* - `"rotation"`
|
|
455
|
+
*
|
|
453
456
|
* - `"euler"`
|
|
457
|
+
*
|
|
454
458
|
* - `"scale"`
|
|
459
|
+
*
|
|
455
460
|
* - `"color"`
|
|
461
|
+
*
|
|
456
462
|
* - `"outline"`
|
|
463
|
+
*
|
|
457
464
|
* - `"shadow"`
|
|
465
|
+
*
|
|
458
466
|
* - `"size"`
|
|
467
|
+
*
|
|
459
468
|
* - `"fill_angle"` (pie)
|
|
469
|
+
*
|
|
460
470
|
* - `"inner_radius"` (pie)
|
|
471
|
+
*
|
|
461
472
|
* - `"leading"` (text)
|
|
473
|
+
*
|
|
462
474
|
* - `"tracking"` (text)
|
|
475
|
+
*
|
|
463
476
|
* - `"slice9"` (slice9)
|
|
477
|
+
*
|
|
464
478
|
* The following property constants are defined equaling the corresponding property string names.
|
|
479
|
+
*
|
|
465
480
|
* - `gui.PROP_POSITION`
|
|
481
|
+
*
|
|
466
482
|
* - `gui.PROP_ROTATION`
|
|
483
|
+
*
|
|
467
484
|
* - `gui.PROP_EULER`
|
|
485
|
+
*
|
|
468
486
|
* - `gui.PROP_SCALE`
|
|
487
|
+
*
|
|
469
488
|
* - `gui.PROP_COLOR`
|
|
489
|
+
*
|
|
470
490
|
* - `gui.PROP_OUTLINE`
|
|
491
|
+
*
|
|
471
492
|
* - `gui.PROP_SHADOW`
|
|
493
|
+
*
|
|
472
494
|
* - `gui.PROP_SIZE`
|
|
495
|
+
*
|
|
473
496
|
* - `gui.PROP_FILL_ANGLE`
|
|
497
|
+
*
|
|
474
498
|
* - `gui.PROP_INNER_RADIUS`
|
|
499
|
+
*
|
|
475
500
|
* - `gui.PROP_LEADING`
|
|
501
|
+
*
|
|
476
502
|
* - `gui.PROP_TRACKING`
|
|
503
|
+
*
|
|
477
504
|
* - `gui.PROP_SLICE9`
|
|
478
505
|
* @param to - target property value
|
|
479
506
|
* @param easing - easing to use during animation.
|
|
@@ -484,11 +511,17 @@ declare global {
|
|
|
484
511
|
* @param complete_function - function to call when the
|
|
485
512
|
* animation has completed
|
|
486
513
|
* @param playback - playback mode
|
|
514
|
+
*
|
|
487
515
|
* - `gui.PLAYBACK_ONCE_FORWARD`
|
|
516
|
+
*
|
|
488
517
|
* - `gui.PLAYBACK_ONCE_BACKWARD`
|
|
518
|
+
*
|
|
489
519
|
* - `gui.PLAYBACK_ONCE_PINGPONG`
|
|
520
|
+
*
|
|
490
521
|
* - `gui.PLAYBACK_LOOP_FORWARD`
|
|
522
|
+
*
|
|
491
523
|
* - `gui.PLAYBACK_LOOP_BACKWARD`
|
|
524
|
+
*
|
|
492
525
|
* - `gui.PLAYBACK_LOOP_PINGPONG`
|
|
493
526
|
* @example
|
|
494
527
|
* ```ts
|
|
@@ -536,18 +569,31 @@ declare global {
|
|
|
536
569
|
*
|
|
537
570
|
* @param node - node that should have its animation canceled
|
|
538
571
|
* @param property - optional property for which the animation should be canceled
|
|
572
|
+
*
|
|
539
573
|
* - `"position"`
|
|
574
|
+
*
|
|
540
575
|
* - `"rotation"`
|
|
576
|
+
*
|
|
541
577
|
* - `"euler"`
|
|
578
|
+
*
|
|
542
579
|
* - `"scale"`
|
|
580
|
+
*
|
|
543
581
|
* - `"color"`
|
|
582
|
+
*
|
|
544
583
|
* - `"outline"`
|
|
584
|
+
*
|
|
545
585
|
* - `"shadow"`
|
|
586
|
+
*
|
|
546
587
|
* - `"size"`
|
|
588
|
+
*
|
|
547
589
|
* - `"fill_angle"` (pie)
|
|
590
|
+
*
|
|
548
591
|
* - `"inner_radius"` (pie)
|
|
592
|
+
*
|
|
549
593
|
* - `"leading"` (text)
|
|
594
|
+
*
|
|
550
595
|
* - `"tracking"` (text)
|
|
596
|
+
*
|
|
551
597
|
* - `"slice9"` (slice9)
|
|
552
598
|
* @example
|
|
553
599
|
* ```ts
|
|
@@ -658,19 +704,33 @@ declare global {
|
|
|
658
704
|
* you can use gui.get instead and supply the property as a string or a hash.
|
|
659
705
|
* While this function is similar to go.get, there are a few more restrictions
|
|
660
706
|
* when operating in the gui namespace. Most notably, only these explicitly named properties are supported:
|
|
707
|
+
*
|
|
661
708
|
* - `"position"`
|
|
709
|
+
*
|
|
662
710
|
* - `"rotation"`
|
|
711
|
+
*
|
|
663
712
|
* - `"euler"`
|
|
713
|
+
*
|
|
664
714
|
* - `"scale"`
|
|
715
|
+
*
|
|
665
716
|
* - `"color"`
|
|
717
|
+
*
|
|
666
718
|
* - `"outline"`
|
|
719
|
+
*
|
|
667
720
|
* - `"shadow"`
|
|
721
|
+
*
|
|
668
722
|
* - `"size"`
|
|
723
|
+
*
|
|
669
724
|
* - `"fill_angle"` (pie)
|
|
725
|
+
*
|
|
670
726
|
* - `"inner_radius"` (pie)
|
|
727
|
+
*
|
|
671
728
|
* - `"leading"` (text)
|
|
729
|
+
*
|
|
672
730
|
* - `"tracking"` (text)
|
|
731
|
+
*
|
|
673
732
|
* - `"slice9"` (slice9)
|
|
733
|
+
*
|
|
674
734
|
* The value returned will either be a vmath.vector4 or a single number, i.e getting the "position"
|
|
675
735
|
* property will return a vec4 while getting the "position.x" property will return a single value.
|
|
676
736
|
* You can also use this function to get material constants.
|
|
@@ -694,8 +754,11 @@ declare global {
|
|
|
694
754
|
*
|
|
695
755
|
* @param node - node from which to get the adjust mode (node)
|
|
696
756
|
* @returns the current adjust mode
|
|
757
|
+
*
|
|
697
758
|
* - `gui.ADJUST_FIT`
|
|
759
|
+
*
|
|
698
760
|
* - `gui.ADJUST_ZOOM`
|
|
761
|
+
*
|
|
699
762
|
* - `gui.ADJUST_STRETCH`
|
|
700
763
|
*/
|
|
701
764
|
function get_adjust_mode(node: Opaque<"node">): Opaque<"constant">;
|
|
@@ -712,10 +775,15 @@ declare global {
|
|
|
712
775
|
*
|
|
713
776
|
* @param node - node from which to get the blend mode
|
|
714
777
|
* @returns blend mode
|
|
778
|
+
*
|
|
715
779
|
* - `gui.BLEND_ALPHA`
|
|
780
|
+
*
|
|
716
781
|
* - `gui.BLEND_ADD`
|
|
782
|
+
*
|
|
717
783
|
* - `gui.BLEND_ADD_ALPHA`
|
|
784
|
+
*
|
|
718
785
|
* - `gui.BLEND_MULT`
|
|
786
|
+
*
|
|
719
787
|
* - `gui.BLEND_SCREEN`
|
|
720
788
|
*/
|
|
721
789
|
function get_blend_mode(node: Opaque<"node">): Opaque<"constant">;
|
|
@@ -731,7 +799,9 @@ declare global {
|
|
|
731
799
|
*
|
|
732
800
|
* @param node - node from which to get the clipping mode
|
|
733
801
|
* @returns clipping mode
|
|
802
|
+
*
|
|
734
803
|
* - `gui.CLIPPING_MODE_NONE`
|
|
804
|
+
*
|
|
735
805
|
* - `gui.CLIPPING_MODE_STENCIL`
|
|
736
806
|
*/
|
|
737
807
|
function get_clipping_mode(node: Opaque<"node">): Opaque<"constant">;
|
|
@@ -745,14 +815,19 @@ declare global {
|
|
|
745
815
|
/**
|
|
746
816
|
* Returns the color of the supplied node. The components
|
|
747
817
|
* of the returned vector4 contains the color channel values:
|
|
818
|
+
*
|
|
748
819
|
* Component
|
|
749
820
|
* Color value
|
|
821
|
+
*
|
|
750
822
|
* x
|
|
751
823
|
* Red value
|
|
824
|
+
*
|
|
752
825
|
* y
|
|
753
826
|
* Green value
|
|
827
|
+
*
|
|
754
828
|
* z
|
|
755
829
|
* Blue value
|
|
830
|
+
*
|
|
756
831
|
* w
|
|
757
832
|
* Alpha value
|
|
758
833
|
*
|
|
@@ -950,7 +1025,9 @@ declare global {
|
|
|
950
1025
|
*
|
|
951
1026
|
* @param node - node from where to get the outer bounds mode
|
|
952
1027
|
* @returns the outer bounds mode of the pie node:
|
|
1028
|
+
*
|
|
953
1029
|
* - `gui.PIEBOUNDS_RECTANGLE`
|
|
1030
|
+
*
|
|
954
1031
|
* - `gui.PIEBOUNDS_ELLIPSE`
|
|
955
1032
|
*/
|
|
956
1033
|
function get_outer_bounds(node: Opaque<"node">): Opaque<"constant">;
|
|
@@ -990,14 +1067,23 @@ declare global {
|
|
|
990
1067
|
*
|
|
991
1068
|
* @param node - node to get pivot from
|
|
992
1069
|
* @returns pivot constant
|
|
1070
|
+
*
|
|
993
1071
|
* - `gui.PIVOT_CENTER`
|
|
1072
|
+
*
|
|
994
1073
|
* - `gui.PIVOT_N`
|
|
1074
|
+
*
|
|
995
1075
|
* - `gui.PIVOT_NE`
|
|
1076
|
+
*
|
|
996
1077
|
* - `gui.PIVOT_E`
|
|
1078
|
+
*
|
|
997
1079
|
* - `gui.PIVOT_SE`
|
|
1080
|
+
*
|
|
998
1081
|
* - `gui.PIVOT_S`
|
|
1082
|
+
*
|
|
999
1083
|
* - `gui.PIVOT_SW`
|
|
1084
|
+
*
|
|
1000
1085
|
* - `gui.PIVOT_W`
|
|
1086
|
+
*
|
|
1001
1087
|
* - `gui.PIVOT_NW`
|
|
1002
1088
|
*/
|
|
1003
1089
|
function get_pivot(node: Opaque<"node">): Opaque<"constant">;
|
|
@@ -1057,7 +1143,9 @@ declare global {
|
|
|
1057
1143
|
*
|
|
1058
1144
|
* @param node - node from which to get the size mode (node)
|
|
1059
1145
|
* @returns the current size mode
|
|
1146
|
+
*
|
|
1060
1147
|
* - `gui.SIZE_MODE_MANUAL`
|
|
1148
|
+
*
|
|
1061
1149
|
* - `gui.SIZE_MODE_AUTO`
|
|
1062
1150
|
*/
|
|
1063
1151
|
function get_size_mode(node: Opaque<"node">): Opaque<"constant">;
|
|
@@ -1123,8 +1211,11 @@ declare global {
|
|
|
1123
1211
|
*
|
|
1124
1212
|
* @param node - node to get x-anchor from
|
|
1125
1213
|
* @returns anchor constant
|
|
1214
|
+
*
|
|
1126
1215
|
* - `gui.ANCHOR_NONE`
|
|
1216
|
+
*
|
|
1127
1217
|
* - `gui.ANCHOR_LEFT`
|
|
1218
|
+
*
|
|
1128
1219
|
* - `gui.ANCHOR_RIGHT`
|
|
1129
1220
|
*/
|
|
1130
1221
|
function get_xanchor(node: Opaque<"node">): Opaque<"constant">;
|
|
@@ -1133,8 +1224,11 @@ declare global {
|
|
|
1133
1224
|
*
|
|
1134
1225
|
* @param node - node to get y-anchor from
|
|
1135
1226
|
* @returns anchor constant
|
|
1227
|
+
*
|
|
1136
1228
|
* - `gui.ANCHOR_NONE`
|
|
1229
|
+
*
|
|
1137
1230
|
* - `gui.ANCHOR_TOP`
|
|
1231
|
+
*
|
|
1138
1232
|
* - `gui.ANCHOR_BOTTOM`
|
|
1139
1233
|
*/
|
|
1140
1234
|
function get_yanchor(node: Opaque<"node">): Opaque<"constant">;
|
|
@@ -1224,9 +1318,13 @@ declare global {
|
|
|
1224
1318
|
* @param width - texture width
|
|
1225
1319
|
* @param height - texture height
|
|
1226
1320
|
* @param type - texture type
|
|
1321
|
+
*
|
|
1227
1322
|
* - `"rgb"` - RGB
|
|
1323
|
+
*
|
|
1228
1324
|
* - `"rgba"` - RGBA
|
|
1325
|
+
*
|
|
1229
1326
|
* - `"l"` - LUMINANCE
|
|
1327
|
+
*
|
|
1230
1328
|
* - `"astc"` - ASTC compressed format
|
|
1231
1329
|
* @param buffer - texture data
|
|
1232
1330
|
* @param flip - flip texture vertically
|
|
@@ -1287,80 +1385,119 @@ declare global {
|
|
|
1287
1385
|
* Mouse movement is specifically handled and uses `nil` as its `action_id`.
|
|
1288
1386
|
* The `action` only contains positional parameters in this case, such as x and y of the pointer.
|
|
1289
1387
|
* Here is a brief description of the available table fields:
|
|
1388
|
+
*
|
|
1290
1389
|
* Field
|
|
1291
1390
|
* Description
|
|
1391
|
+
*
|
|
1292
1392
|
* `value`
|
|
1293
1393
|
* The amount of input given by the user. This is usually 1 for buttons and 0-1 for analogue inputs. This is not present for mouse movement and text input.
|
|
1394
|
+
*
|
|
1294
1395
|
* `pressed`
|
|
1295
1396
|
* If the input was pressed this frame. This is not present for mouse movement and text input.
|
|
1397
|
+
*
|
|
1296
1398
|
* `released`
|
|
1297
1399
|
* If the input was released this frame. This is not present for mouse movement and text input.
|
|
1400
|
+
*
|
|
1298
1401
|
* `repeated`
|
|
1299
1402
|
* If the input was repeated this frame. This is similar to how a key on a keyboard is repeated when you hold it down. This is not present for mouse movement and text input.
|
|
1403
|
+
*
|
|
1300
1404
|
* `x`
|
|
1301
1405
|
* The x value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1406
|
+
*
|
|
1302
1407
|
* `y`
|
|
1303
1408
|
* The y value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1409
|
+
*
|
|
1304
1410
|
* `screen_x`
|
|
1305
1411
|
* The screen space x value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1412
|
+
*
|
|
1306
1413
|
* `screen_y`
|
|
1307
1414
|
* The screen space y value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1415
|
+
*
|
|
1308
1416
|
* `dx`
|
|
1309
1417
|
* The change in x value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1418
|
+
*
|
|
1310
1419
|
* `dy`
|
|
1311
1420
|
* The change in y value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1421
|
+
*
|
|
1312
1422
|
* `screen_dx`
|
|
1313
1423
|
* The change in screen space x value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1424
|
+
*
|
|
1314
1425
|
* `screen_dy`
|
|
1315
1426
|
* The change in screen space y value of a pointer device, if present. This is not present for gamepad, key and text input.
|
|
1427
|
+
*
|
|
1316
1428
|
* `gamepad`
|
|
1317
1429
|
* The index of the gamepad device that provided the input. See table below about gamepad input.
|
|
1430
|
+
*
|
|
1318
1431
|
* `touch`
|
|
1319
1432
|
* List of touch input, one element per finger, if present. See table below about touch input
|
|
1433
|
+
*
|
|
1320
1434
|
* `text`
|
|
1321
1435
|
* Text input from a (virtual) keyboard or similar.
|
|
1436
|
+
*
|
|
1322
1437
|
* `marked_text`
|
|
1323
1438
|
* Sequence of entered symbols while entering a symbol combination, for example Japanese Kana.
|
|
1439
|
+
*
|
|
1324
1440
|
* Gamepad specific fields:
|
|
1441
|
+
*
|
|
1325
1442
|
* Field
|
|
1326
1443
|
* Description
|
|
1444
|
+
*
|
|
1327
1445
|
* `gamepad`
|
|
1328
1446
|
* The index of the gamepad device that provided the input.
|
|
1447
|
+
*
|
|
1329
1448
|
* `userid`
|
|
1330
1449
|
* Id of the user associated with the controller. Usually only relevant on consoles.
|
|
1450
|
+
*
|
|
1331
1451
|
* `gamepad_unknown`
|
|
1332
1452
|
* True if the inout originated from an unknown/unmapped gamepad.
|
|
1453
|
+
*
|
|
1333
1454
|
* `gamepad_name`
|
|
1334
1455
|
* Name of the gamepad
|
|
1456
|
+
*
|
|
1335
1457
|
* `gamepad_axis`
|
|
1336
1458
|
* List of gamepad axis values. For raw gamepad input only.
|
|
1459
|
+
*
|
|
1337
1460
|
* `gamepadhats`
|
|
1338
1461
|
* List of gamepad hat values. For raw gamepad input only.
|
|
1462
|
+
*
|
|
1339
1463
|
* `gamepad_buttons`
|
|
1340
1464
|
* List of gamepad button values. For raw gamepad input only.
|
|
1465
|
+
*
|
|
1341
1466
|
* Touch input table:
|
|
1467
|
+
*
|
|
1342
1468
|
* Field
|
|
1343
1469
|
* Description
|
|
1470
|
+
*
|
|
1344
1471
|
* `id`
|
|
1345
1472
|
* A number identifying the touch input during its duration.
|
|
1473
|
+
*
|
|
1346
1474
|
* `pressed`
|
|
1347
1475
|
* True if the finger was pressed this frame.
|
|
1476
|
+
*
|
|
1348
1477
|
* `released`
|
|
1349
1478
|
* True if the finger was released this frame.
|
|
1479
|
+
*
|
|
1350
1480
|
* `tap_count`
|
|
1351
1481
|
* Number of taps, one for single, two for double-tap, etc
|
|
1482
|
+
*
|
|
1352
1483
|
* `x`
|
|
1353
1484
|
* The x touch location.
|
|
1485
|
+
*
|
|
1354
1486
|
* `y`
|
|
1355
1487
|
* The y touch location.
|
|
1488
|
+
*
|
|
1356
1489
|
* `dx`
|
|
1357
1490
|
* The change in x value.
|
|
1491
|
+
*
|
|
1358
1492
|
* `dy`
|
|
1359
1493
|
* The change in y value.
|
|
1494
|
+
*
|
|
1360
1495
|
* `acc_x`
|
|
1361
1496
|
* Accelerometer x value (if present).
|
|
1497
|
+
*
|
|
1362
1498
|
* `acc_y`
|
|
1363
1499
|
* Accelerometer y value (if present).
|
|
1500
|
+
*
|
|
1364
1501
|
* `acc_z`
|
|
1365
1502
|
* Accelerometer z value (if present).
|
|
1366
1503
|
*
|
|
@@ -1369,16 +1506,18 @@ declare global {
|
|
|
1369
1506
|
* @param action - a table containing the input data, see above for a description
|
|
1370
1507
|
* @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
|
|
1371
1508
|
* @example
|
|
1372
|
-
* ```
|
|
1373
|
-
*
|
|
1374
|
-
*
|
|
1375
|
-
*
|
|
1376
|
-
*
|
|
1377
|
-
*
|
|
1378
|
-
*
|
|
1379
|
-
*
|
|
1380
|
-
*
|
|
1381
|
-
*
|
|
1509
|
+
* ```ts
|
|
1510
|
+
* export default defineScript({
|
|
1511
|
+
* on_input(self, action_id, action) {
|
|
1512
|
+
* // check for input
|
|
1513
|
+
* if (action_id === hash("my_action")) {
|
|
1514
|
+
* // take appropriate action
|
|
1515
|
+
* self.my_value = action.value;
|
|
1516
|
+
* }
|
|
1517
|
+
* // consume input
|
|
1518
|
+
* return true;
|
|
1519
|
+
* },
|
|
1520
|
+
* });
|
|
1382
1521
|
* ```
|
|
1383
1522
|
*/
|
|
1384
1523
|
function on_input(self: Opaque<"userdata">, action_id: Hash, action: { value?: number; pressed?: boolean; released?: boolean; repeated?: boolean; x?: number; y?: number; screen_x?: number; screen_y?: number; dx?: number; dy?: number; screen_dx?: number; screen_dy?: number; gamepad?: number; gamepad_axis?: Vector3; touch?: { id?: number; pressed?: boolean; released?: boolean; tap_count?: number; x?: number; y?: number; dx?: number; dy?: number; acc_x?: number; acc_y?: number; acc_z?: number }[]; text?: string }): boolean | unknown;
|
|
@@ -1400,11 +1539,13 @@ declare global {
|
|
|
1400
1539
|
*
|
|
1401
1540
|
* @param self - reference to the script state to be used for storing data
|
|
1402
1541
|
* @example
|
|
1403
|
-
* ```
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1406
|
-
*
|
|
1407
|
-
*
|
|
1542
|
+
* ```ts
|
|
1543
|
+
* export default defineGuiScript({
|
|
1544
|
+
* on_reload(self) {
|
|
1545
|
+
* // restore some color (or similar)
|
|
1546
|
+
* gui.set_color(gui.get_node("my_node"), self.my_original_color);
|
|
1547
|
+
* },
|
|
1548
|
+
* });
|
|
1408
1549
|
* ```
|
|
1409
1550
|
*/
|
|
1410
1551
|
function on_reload(self: Opaque<"userdata">): void;
|
|
@@ -1426,11 +1567,16 @@ declare global {
|
|
|
1426
1567
|
* @param node - node to set animation for
|
|
1427
1568
|
* @param animation - animation id
|
|
1428
1569
|
* @param complete_function - optional function to call when the animation has completed
|
|
1570
|
+
*
|
|
1429
1571
|
* `self`
|
|
1572
|
+
*
|
|
1430
1573
|
* object The current object.
|
|
1574
|
+
*
|
|
1431
1575
|
* `node`
|
|
1576
|
+
*
|
|
1432
1577
|
* node The node that is animated.
|
|
1433
1578
|
* @param play_properties - optional table with properties
|
|
1579
|
+
*
|
|
1434
1580
|
* `offset`
|
|
1435
1581
|
* number The normalized initial value of the animation cursor when the animation starts playing
|
|
1436
1582
|
* `playback_rate`
|
|
@@ -1464,6 +1610,7 @@ declare global {
|
|
|
1464
1610
|
*
|
|
1465
1611
|
* @param node - node to play particle fx for
|
|
1466
1612
|
* @param emitter_state_function - optional callback function that will be called when an emitter attached to this particlefx changes state.
|
|
1613
|
+
*
|
|
1467
1614
|
* `self`
|
|
1468
1615
|
* object The current object
|
|
1469
1616
|
* `node`
|
|
@@ -1472,9 +1619,13 @@ declare global {
|
|
|
1472
1619
|
* hash The id of the emitter
|
|
1473
1620
|
* `state`
|
|
1474
1621
|
* constant the new state of the emitter:
|
|
1622
|
+
*
|
|
1475
1623
|
* - `particlefx.EMITTER_STATE_SLEEPING`
|
|
1624
|
+
*
|
|
1476
1625
|
* - `particlefx.EMITTER_STATE_PRESPAWN`
|
|
1626
|
+
*
|
|
1477
1627
|
* - `particlefx.EMITTER_STATE_SPAWNING`
|
|
1628
|
+
*
|
|
1478
1629
|
* - `particlefx.EMITTER_STATE_POSTSPAWN`
|
|
1479
1630
|
* @example
|
|
1480
1631
|
* ```ts
|
|
@@ -1530,19 +1681,33 @@ declare global {
|
|
|
1530
1681
|
* you can use gui.set instead and supply the property as a string or a hash.
|
|
1531
1682
|
* While this function is similar to go.get and go.set, there are a few more restrictions
|
|
1532
1683
|
* when operating in the gui namespace. Most notably, only these named properties identifiers are supported:
|
|
1684
|
+
*
|
|
1533
1685
|
* - `"position"`
|
|
1686
|
+
*
|
|
1534
1687
|
* - `"rotation"`
|
|
1688
|
+
*
|
|
1535
1689
|
* - `"euler"`
|
|
1690
|
+
*
|
|
1536
1691
|
* - `"scale"`
|
|
1692
|
+
*
|
|
1537
1693
|
* - `"color"`
|
|
1694
|
+
*
|
|
1538
1695
|
* - `"outline"`
|
|
1696
|
+
*
|
|
1539
1697
|
* - `"shadow"`
|
|
1698
|
+
*
|
|
1540
1699
|
* - `"size"`
|
|
1700
|
+
*
|
|
1541
1701
|
* - `"fill_angle"` (pie)
|
|
1702
|
+
*
|
|
1542
1703
|
* - `"inner_radius"` (pie)
|
|
1704
|
+
*
|
|
1543
1705
|
* - `"leading"` (text)
|
|
1706
|
+
*
|
|
1544
1707
|
* - `"tracking"` (text)
|
|
1708
|
+
*
|
|
1545
1709
|
* - `"slice9"` (slice9)
|
|
1710
|
+
*
|
|
1546
1711
|
* 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.
|
|
1547
1712
|
* I.e when setting the "position" property, you need to use a vmath.vector4 and when setting a single component of the property,
|
|
1548
1713
|
* such as "position.x", you need to use a single value.
|
|
@@ -1614,8 +1779,11 @@ declare global {
|
|
|
1614
1779
|
*
|
|
1615
1780
|
* @param node - node to set adjust mode for
|
|
1616
1781
|
* @param adjust_mode - adjust mode to set
|
|
1782
|
+
*
|
|
1617
1783
|
* - `gui.ADJUST_FIT`
|
|
1784
|
+
*
|
|
1618
1785
|
* - `gui.ADJUST_ZOOM`
|
|
1786
|
+
*
|
|
1619
1787
|
* - `gui.ADJUST_STRETCH`
|
|
1620
1788
|
*/
|
|
1621
1789
|
function set_adjust_mode(node: Opaque<"node">, adjust_mode: Opaque<"constant">): void;
|
|
@@ -1632,10 +1800,15 @@ declare global {
|
|
|
1632
1800
|
*
|
|
1633
1801
|
* @param node - node to set blend mode for
|
|
1634
1802
|
* @param blend_mode - blend mode to set
|
|
1803
|
+
*
|
|
1635
1804
|
* - `gui.BLEND_ALPHA`
|
|
1805
|
+
*
|
|
1636
1806
|
* - `gui.BLEND_ADD`
|
|
1807
|
+
*
|
|
1637
1808
|
* - `gui.BLEND_ADD_ALPHA`
|
|
1809
|
+
*
|
|
1638
1810
|
* - `gui.BLEND_MULT`
|
|
1811
|
+
*
|
|
1639
1812
|
* - `gui.BLEND_SCREEN`
|
|
1640
1813
|
*/
|
|
1641
1814
|
function set_blend_mode(node: Opaque<"node">, blend_mode: Opaque<"constant">): void;
|
|
@@ -1651,7 +1824,9 @@ declare global {
|
|
|
1651
1824
|
*
|
|
1652
1825
|
* @param node - node to set clipping mode for
|
|
1653
1826
|
* @param clipping_mode - clipping mode to set
|
|
1827
|
+
*
|
|
1654
1828
|
* - `gui.CLIPPING_MODE_NONE`
|
|
1829
|
+
*
|
|
1655
1830
|
* - `gui.CLIPPING_MODE_STENCIL`
|
|
1656
1831
|
*/
|
|
1657
1832
|
function set_clipping_mode(node: Opaque<"node">, clipping_mode: Opaque<"constant">): void;
|
|
@@ -1665,14 +1840,19 @@ declare global {
|
|
|
1665
1840
|
/**
|
|
1666
1841
|
* Sets the color of the supplied node. The components
|
|
1667
1842
|
* of the supplied vector3 or vector4 should contain the color channel values:
|
|
1843
|
+
*
|
|
1668
1844
|
* Component
|
|
1669
1845
|
* Color value
|
|
1846
|
+
*
|
|
1670
1847
|
* x
|
|
1671
1848
|
* Red value
|
|
1849
|
+
*
|
|
1672
1850
|
* y
|
|
1673
1851
|
* Green value
|
|
1852
|
+
*
|
|
1674
1853
|
* z
|
|
1675
1854
|
* Blue value
|
|
1855
|
+
*
|
|
1676
1856
|
* w vector4
|
|
1677
1857
|
* Alpha value
|
|
1678
1858
|
*
|
|
@@ -1812,7 +1992,9 @@ declare global {
|
|
|
1812
1992
|
*
|
|
1813
1993
|
* @param node - node for which to set the outer bounds mode
|
|
1814
1994
|
* @param bounds_mode - the outer bounds mode of the pie node:
|
|
1995
|
+
*
|
|
1815
1996
|
* - `gui.PIEBOUNDS_RECTANGLE`
|
|
1997
|
+
*
|
|
1816
1998
|
* - `gui.PIEBOUNDS_ELLIPSE`
|
|
1817
1999
|
*/
|
|
1818
2000
|
function set_outer_bounds(node: Opaque<"node">, bounds_mode: Opaque<"constant">): void;
|
|
@@ -1851,14 +2033,23 @@ declare global {
|
|
|
1851
2033
|
*
|
|
1852
2034
|
* @param node - node to set pivot for
|
|
1853
2035
|
* @param pivot - pivot constant
|
|
2036
|
+
*
|
|
1854
2037
|
* - `gui.PIVOT_CENTER`
|
|
2038
|
+
*
|
|
1855
2039
|
* - `gui.PIVOT_N`
|
|
2040
|
+
*
|
|
1856
2041
|
* - `gui.PIVOT_NE`
|
|
2042
|
+
*
|
|
1857
2043
|
* - `gui.PIVOT_E`
|
|
2044
|
+
*
|
|
1858
2045
|
* - `gui.PIVOT_SE`
|
|
2046
|
+
*
|
|
1859
2047
|
* - `gui.PIVOT_S`
|
|
2048
|
+
*
|
|
1860
2049
|
* - `gui.PIVOT_SW`
|
|
2050
|
+
*
|
|
1861
2051
|
* - `gui.PIVOT_W`
|
|
2052
|
+
*
|
|
1862
2053
|
* - `gui.PIVOT_NW`
|
|
1863
2054
|
*/
|
|
1864
2055
|
function set_pivot(node: Opaque<"node">, pivot: Opaque<"constant">): void;
|
|
@@ -1891,9 +2082,13 @@ declare global {
|
|
|
1891
2082
|
* Sets how the safe area is applied to this gui scene.
|
|
1892
2083
|
*
|
|
1893
2084
|
* @param mode - safe area mode
|
|
2085
|
+
*
|
|
1894
2086
|
* - `gui.SAFE_AREA_NONE`
|
|
2087
|
+
*
|
|
1895
2088
|
* - `gui.SAFE_AREA_LONG`
|
|
2089
|
+
*
|
|
1896
2090
|
* - `gui.SAFE_AREA_SHORT`
|
|
2091
|
+
*
|
|
1897
2092
|
* - `gui.SAFE_AREA_BOTH`
|
|
1898
2093
|
*/
|
|
1899
2094
|
function set_safe_area_mode(mode: Opaque<"constant">): void;
|
|
@@ -1937,7 +2132,9 @@ declare global {
|
|
|
1937
2132
|
*
|
|
1938
2133
|
* @param node - node to set size mode for
|
|
1939
2134
|
* @param size_mode - size mode to set
|
|
2135
|
+
*
|
|
1940
2136
|
* - `gui.SIZE_MODE_MANUAL`
|
|
2137
|
+
*
|
|
1941
2138
|
* - `gui.SIZE_MODE_AUTO`
|
|
1942
2139
|
*/
|
|
1943
2140
|
function set_size_mode(node: Opaque<"node">, size_mode: Opaque<"constant">): void;
|
|
@@ -1992,9 +2189,13 @@ declare global {
|
|
|
1992
2189
|
* @param width - texture width
|
|
1993
2190
|
* @param height - texture height
|
|
1994
2191
|
* @param type - texture type
|
|
2192
|
+
*
|
|
1995
2193
|
* - `"rgb"` - RGB
|
|
2194
|
+
*
|
|
1996
2195
|
* - `"rgba"` - RGBA
|
|
2196
|
+
*
|
|
1997
2197
|
* - `"l"` - LUMINANCE
|
|
2198
|
+
*
|
|
1998
2199
|
* - `"astc"` - ASTC compressed format
|
|
1999
2200
|
* @param buffer - texture data
|
|
2000
2201
|
* @param flip - flip texture vertically
|
|
@@ -2049,8 +2250,11 @@ declare global {
|
|
|
2049
2250
|
*
|
|
2050
2251
|
* @param node - node to set x-anchor for
|
|
2051
2252
|
* @param anchor - anchor constant
|
|
2253
|
+
*
|
|
2052
2254
|
* - `gui.ANCHOR_NONE`
|
|
2255
|
+
*
|
|
2053
2256
|
* - `gui.ANCHOR_LEFT`
|
|
2257
|
+
*
|
|
2054
2258
|
* - `gui.ANCHOR_RIGHT`
|
|
2055
2259
|
*/
|
|
2056
2260
|
function set_xanchor(node: Opaque<"node">, anchor: Opaque<"constant">): void;
|
|
@@ -2059,8 +2263,11 @@ declare global {
|
|
|
2059
2263
|
*
|
|
2060
2264
|
* @param node - node to set y-anchor for
|
|
2061
2265
|
* @param anchor - anchor constant
|
|
2266
|
+
*
|
|
2062
2267
|
* - `gui.ANCHOR_NONE`
|
|
2268
|
+
*
|
|
2063
2269
|
* - `gui.ANCHOR_TOP`
|
|
2270
|
+
*
|
|
2064
2271
|
* - `gui.ANCHOR_BOTTOM`
|
|
2065
2272
|
*/
|
|
2066
2273
|
function set_yanchor(node: Opaque<"node">, anchor: Opaque<"constant">): void;
|
|
@@ -2071,9 +2278,13 @@ declare global {
|
|
|
2071
2278
|
* This function is only available on iOS and Android. .
|
|
2072
2279
|
*
|
|
2073
2280
|
* @param type - keyboard type
|
|
2281
|
+
*
|
|
2074
2282
|
* - `gui.KEYBOARD_TYPE_DEFAULT`
|
|
2283
|
+
*
|
|
2075
2284
|
* - `gui.KEYBOARD_TYPE_EMAIL`
|
|
2285
|
+
*
|
|
2076
2286
|
* - `gui.KEYBOARD_TYPE_NUMBER_PAD`
|
|
2287
|
+
*
|
|
2077
2288
|
* - `gui.KEYBOARD_TYPE_PASSWORD`
|
|
2078
2289
|
* @param autoclose - if the keyboard should automatically close when clicking outside
|
|
2079
2290
|
*/
|
|
@@ -2083,6 +2294,7 @@ declare global {
|
|
|
2083
2294
|
*
|
|
2084
2295
|
* @param node - node to stop particle fx for
|
|
2085
2296
|
* @param options - options when stopping the particle fx. Supported options:
|
|
2297
|
+
*
|
|
2086
2298
|
* - boolean `clear`: instantly clear spawned particles
|
|
2087
2299
|
*/
|
|
2088
2300
|
function stop_particlefx(node: Opaque<"node">, options?: { clear?: boolean }): void;
|
|
@@ -2093,40 +2305,43 @@ declare global {
|
|
|
2093
2305
|
* @param self - reference to the script state to be used for storing data
|
|
2094
2306
|
* @param dt - the time-step of the frame update
|
|
2095
2307
|
* @example
|
|
2096
|
-
* ```
|
|
2097
|
-
* This example demonstrates how to update a text node that displays game score
|
|
2098
|
-
* It is assumed that the gui component receives messages
|
|
2099
|
-
*
|
|
2100
|
-
*
|
|
2101
|
-
*
|
|
2102
|
-
*
|
|
2103
|
-
* self.
|
|
2104
|
-
*
|
|
2105
|
-
* self.
|
|
2106
|
-
*
|
|
2107
|
-
* self.
|
|
2108
|
-
*
|
|
2109
|
-
*
|
|
2110
|
-
*
|
|
2111
|
-
*
|
|
2112
|
-
*
|
|
2113
|
-
*
|
|
2114
|
-
*
|
|
2115
|
-
*
|
|
2116
|
-
*
|
|
2117
|
-
*
|
|
2118
|
-
*
|
|
2119
|
-
*
|
|
2120
|
-
*
|
|
2121
|
-
*
|
|
2122
|
-
*
|
|
2123
|
-
*
|
|
2124
|
-
*
|
|
2125
|
-
*
|
|
2126
|
-
*
|
|
2127
|
-
*
|
|
2128
|
-
*
|
|
2129
|
-
*
|
|
2308
|
+
* ```ts
|
|
2309
|
+
* // This example demonstrates how to update a text node that displays game score
|
|
2310
|
+
* // in a counting fashion. It is assumed that the gui component receives messages
|
|
2311
|
+
* // from the game when a new score is to be shown.
|
|
2312
|
+
* export default defineGuiScript({
|
|
2313
|
+
* init(self) {
|
|
2314
|
+
* // fetch the score text node for later use (assumes it is called "score")
|
|
2315
|
+
* self.score_node = gui.get_node("score");
|
|
2316
|
+
* // keep track of the current score counted up so far
|
|
2317
|
+
* self.current_score = 0;
|
|
2318
|
+
* // keep track of the target score we should count up to
|
|
2319
|
+
* self.target_score = 0;
|
|
2320
|
+
* // how fast we will update the score, in score/second
|
|
2321
|
+
* self.score_update_speed = 1;
|
|
2322
|
+
* },
|
|
2323
|
+
*
|
|
2324
|
+
* update(self, dt) {
|
|
2325
|
+
* // check if target score is more than current score
|
|
2326
|
+
* if (self.current_score < self.target_score) {
|
|
2327
|
+
* // increment current score according to the speed
|
|
2328
|
+
* self.current_score = self.current_score + dt * self.score_update_speed;
|
|
2329
|
+
* // check if we went past the target score, clamp current score in that case
|
|
2330
|
+
* if (self.current_score > self.target_score) {
|
|
2331
|
+
* self.current_score = self.target_score;
|
|
2332
|
+
* }
|
|
2333
|
+
* // update the score text node
|
|
2334
|
+
* gui.set_text(self.score_node, "" + math.floor(self.current_score));
|
|
2335
|
+
* }
|
|
2336
|
+
* },
|
|
2337
|
+
*
|
|
2338
|
+
* on_message(self, message_id, message) {
|
|
2339
|
+
* // check the message
|
|
2340
|
+
* if (message_id === hash("set_score")) {
|
|
2341
|
+
* self.target_score = message.score;
|
|
2342
|
+
* }
|
|
2343
|
+
* },
|
|
2344
|
+
* });
|
|
2130
2345
|
* ```
|
|
2131
2346
|
*/
|
|
2132
2347
|
function update(self: Opaque<"userdata">, dt: number): void;
|