@defold-typescript/types 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-availability.json +117 -0
- package/api-signatures.json +586 -480
- package/examples/translations.json +356 -180
- package/generated/b2d_body.d.ts +7 -4
- package/generated/b2d_shape.d.ts +23 -1
- package/generated/buffer.d.ts +34 -19
- package/generated/camera.d.ts +3 -2
- package/generated/collectionfactory.d.ts +17 -12
- package/generated/collectionproxy.d.ts +2 -2
- package/generated/compute.d.ts +1 -1
- package/generated/factory.d.ts +2 -1
- package/generated/go.d.ts +150 -91
- package/generated/graphics.d.ts +54 -0
- package/generated/gui.d.ts +117 -71
- package/generated/html5.d.ts +4 -2
- package/generated/http.d.ts +8 -2
- package/generated/image.d.ts +24 -15
- package/generated/kinds/gui-script.d.ts +1 -0
- package/generated/kinds/render-script.d.ts +1 -0
- package/generated/kinds/script.d.ts +1 -0
- package/generated/material.d.ts +1 -1
- package/generated/model.d.ts +41 -7
- package/generated/particlefx.d.ts +1 -1
- package/generated/physics.d.ts +29 -20
- package/generated/profiler.d.ts +10 -3
- package/generated/render.d.ts +293 -111
- package/generated/resource.d.ts +243 -226
- package/generated/socket.d.ts +33 -18
- package/generated/sound.d.ts +6 -5
- package/generated/sprite.d.ts +9 -1
- package/generated/sys.d.ts +44 -27
- package/generated/tilemap.d.ts +25 -19
- package/generated/timer.d.ts +33 -24
- package/generated/versions/defold-1.12.4/buffer.d.ts +34 -19
- package/generated/versions/defold-1.12.4/camera.d.ts +3 -2
- package/generated/versions/defold-1.12.4/collectionfactory.d.ts +17 -12
- 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 +150 -91
- package/generated/versions/defold-1.12.4/graphics.d.ts +2 -0
- package/generated/versions/defold-1.12.4/gui.d.ts +109 -69
- package/generated/versions/defold-1.12.4/html5.d.ts +4 -2
- package/generated/versions/defold-1.12.4/http.d.ts +8 -2
- package/generated/versions/defold-1.12.4/image.d.ts +24 -15
- package/generated/versions/defold-1.12.4/index.d.ts +1 -0
- package/generated/versions/defold-1.12.4/model.d.ts +41 -7
- package/generated/versions/defold-1.12.4/particlefx.d.ts +1 -1
- package/generated/versions/defold-1.12.4/physics.d.ts +29 -20
- package/generated/versions/defold-1.12.4/profiler.d.ts +10 -3
- package/generated/versions/defold-1.12.4/render.d.ts +292 -110
- package/generated/versions/defold-1.12.4/resource.d.ts +243 -226
- package/generated/versions/defold-1.12.4/socket.d.ts +33 -18
- package/generated/versions/defold-1.12.4/sound.d.ts +6 -5
- package/generated/versions/defold-1.12.4/sprite.d.ts +9 -1
- package/generated/versions/defold-1.12.4/sys.d.ts +44 -27
- 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 +18 -10
- 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/b2d_shape.d.ts +23 -1
- package/generated/versions/defold-1.13.0/buffer.d.ts +34 -19
- package/generated/versions/defold-1.13.0/camera.d.ts +3 -2
- package/generated/versions/defold-1.13.0/collectionfactory.d.ts +17 -12
- package/generated/versions/defold-1.13.0/collectionproxy.d.ts +1 -1
- package/generated/versions/defold-1.13.0/compute.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 +150 -91
- package/generated/versions/defold-1.13.0/graphics.d.ts +50 -0
- package/generated/versions/defold-1.13.0/gui.d.ts +109 -69
- package/generated/versions/defold-1.13.0/html5.d.ts +4 -2
- package/generated/versions/defold-1.13.0/http.d.ts +8 -2
- package/generated/versions/defold-1.13.0/image.d.ts +24 -15
- package/generated/versions/defold-1.13.0/index.d.ts +1 -0
- package/generated/versions/defold-1.13.0/material.d.ts +1 -1
- package/generated/versions/defold-1.13.0/model.d.ts +41 -7
- package/generated/versions/defold-1.13.0/particlefx.d.ts +1 -1
- package/generated/versions/defold-1.13.0/physics.d.ts +29 -20
- package/generated/versions/defold-1.13.0/profiler.d.ts +10 -3
- package/generated/versions/defold-1.13.0/render.d.ts +293 -111
- package/generated/versions/defold-1.13.0/resource.d.ts +243 -226
- package/generated/versions/defold-1.13.0/socket.d.ts +33 -18
- package/generated/versions/defold-1.13.0/sound.d.ts +6 -5
- package/generated/versions/defold-1.13.0/sprite.d.ts +9 -1
- package/generated/versions/defold-1.13.0/sys.d.ts +44 -27
- 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 +18 -10
- package/generated/versions/defold-1.13.0/window.d.ts +5 -3
- package/generated/vmath.d.ts +18 -10
- package/generated/window.d.ts +5 -3
- package/index.d.ts +1 -0
- package/package.json +2 -1
- package/scripts/generate-api-signatures.ts +2 -1
- package/scripts/prose-constants.ts +96 -0
- package/scripts/regen.ts +6 -2
- package/src/api-doc.ts +8 -0
- package/src/component-properties.d.ts +33 -0
- package/src/core-types.ts +4 -2
- package/src/custom-messages.d.ts +4 -3
- package/src/doc-comment.ts +247 -43
- package/src/emit-dts.ts +958 -57
- package/src/engine-globals.d.ts +2 -2
- package/src/example-store.ts +26 -0
- package/src/go-overloads.d.ts +11 -10
- package/src/index.ts +9 -0
- package/src/param-correction-provenance.ts +67 -0
- package/src/render-overloads.d.ts +15 -17
- package/src/script-api.ts +3 -1
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
-
import type { Hash, Opaque, Quaternion, Url, Vector, Vector3, Vector4 } from "../../../src/core-types";
|
|
2
|
+
import type { Hash, Matrix4, Opaque, Quaternion, Url, Vector, Vector3, Vector4 } from "../../../src/core-types";
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
5
|
/**
|
|
6
6
|
* GUI API documentation
|
|
7
7
|
*/
|
|
8
8
|
namespace gui {
|
|
9
|
+
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
|
*
|
|
@@ -600,21 +622,21 @@ declare global {
|
|
|
600
622
|
* const node = gui.get_node("my_node");
|
|
601
623
|
* // animate to new position
|
|
602
624
|
* const pos = vmath.vector3(100, 100, 0);
|
|
603
|
-
* gui.animate(node, "position", pos,
|
|
625
|
+
* gui.animate(node, "position", pos, gui.EASING_LINEAR, 2);
|
|
604
626
|
* // ...
|
|
605
627
|
* // cancel animation of the x component.
|
|
606
628
|
* gui.cancel_animations(node, "position.x");
|
|
607
629
|
*
|
|
608
630
|
* // Cancels all property animations on a node in a single call:
|
|
609
631
|
* // animate to new position and scale
|
|
610
|
-
* gui.animate(node, "position", vmath.vector3(100, 100, 0),
|
|
611
|
-
* gui.animate(node, "scale", vmath.vector3(0.5),
|
|
632
|
+
* gui.animate(node, "position", vmath.vector3(100, 100, 0), gui.EASING_LINEAR, 5);
|
|
633
|
+
* gui.animate(node, "scale", vmath.vector3(0.5), gui.EASING_LINEAR, 5);
|
|
612
634
|
* // ...
|
|
613
635
|
* // cancel positioning and scaling at once
|
|
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))) {
|
|
@@ -689,6 +711,10 @@ declare global {
|
|
|
689
711
|
* @example
|
|
690
712
|
* ```ts
|
|
691
713
|
* export default defineScript({
|
|
714
|
+
* init() {
|
|
715
|
+
* return { some_value: 0 };
|
|
716
|
+
* },
|
|
717
|
+
*
|
|
692
718
|
* final(self) {
|
|
693
719
|
* // report finalization
|
|
694
720
|
* msg.post("my_friend_instance", "im_dead", { my_stats: self.some_value });
|
|
@@ -736,7 +762,7 @@ declare global {
|
|
|
736
762
|
* @param node - node to get the property for
|
|
737
763
|
* @param property - the property to retrieve
|
|
738
764
|
* @param options - optional options table (only applicable for material constants)
|
|
739
|
-
* - `index` number index into array property
|
|
765
|
+
* - `index` number zero-based index into array property; the transpiler emits Defold's 1-based index
|
|
740
766
|
* @example
|
|
741
767
|
* ```ts
|
|
742
768
|
* // Get properties on existing nodes:
|
|
@@ -744,7 +770,7 @@ declare global {
|
|
|
744
770
|
* const node_position = gui.get(node, "position");
|
|
745
771
|
* ```
|
|
746
772
|
*/
|
|
747
|
-
function get(node: Opaque<"node">, property: string | Hash |
|
|
773
|
+
function get(node: Opaque<"node">, property: string | Hash | gui.Property, options?: { index?: number }): unknown;
|
|
748
774
|
/**
|
|
749
775
|
* Returns the adjust mode of a node.
|
|
750
776
|
* The adjust mode defines how the node will adjust itself to screen
|
|
@@ -759,7 +785,7 @@ declare global {
|
|
|
759
785
|
*
|
|
760
786
|
* - `gui.ADJUST_STRETCH`
|
|
761
787
|
*/
|
|
762
|
-
function get_adjust_mode(node: Opaque<"node">):
|
|
788
|
+
function get_adjust_mode(node: Opaque<"node">): gui.AdjustMode;
|
|
763
789
|
/**
|
|
764
790
|
* gets the node alpha
|
|
765
791
|
*
|
|
@@ -784,7 +810,7 @@ declare global {
|
|
|
784
810
|
*
|
|
785
811
|
* - `gui.BLEND_SCREEN`
|
|
786
812
|
*/
|
|
787
|
-
function get_blend_mode(node: Opaque<"node">):
|
|
813
|
+
function get_blend_mode(node: Opaque<"node">): gui.BlendMode;
|
|
788
814
|
/**
|
|
789
815
|
* If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
|
|
790
816
|
*
|
|
@@ -802,7 +828,7 @@ declare global {
|
|
|
802
828
|
*
|
|
803
829
|
* - `gui.CLIPPING_MODE_STENCIL`
|
|
804
830
|
*/
|
|
805
|
-
function get_clipping_mode(node: Opaque<"node">):
|
|
831
|
+
function get_clipping_mode(node: Opaque<"node">): gui.ClippingMode;
|
|
806
832
|
/**
|
|
807
833
|
* 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
834
|
*
|
|
@@ -884,7 +910,7 @@ declare global {
|
|
|
884
910
|
* @example
|
|
885
911
|
* ```ts
|
|
886
912
|
* // Get the text metrics for a text
|
|
887
|
-
* export default
|
|
913
|
+
* export default defineGuiScript({
|
|
888
914
|
* init(self) {
|
|
889
915
|
* const node = gui.get_node("name");
|
|
890
916
|
* const font_name = gui.get_font(node);
|
|
@@ -1028,7 +1054,7 @@ declare global {
|
|
|
1028
1054
|
*
|
|
1029
1055
|
* - `gui.PIEBOUNDS_ELLIPSE`
|
|
1030
1056
|
*/
|
|
1031
|
-
function get_outer_bounds(node: Opaque<"node">):
|
|
1057
|
+
function get_outer_bounds(node: Opaque<"node">): gui.PieBounds;
|
|
1032
1058
|
/**
|
|
1033
1059
|
* Returns the outline color of the supplied node.
|
|
1034
1060
|
* See gui.get_color for info how vectors encode color values.
|
|
@@ -1084,7 +1110,7 @@ declare global {
|
|
|
1084
1110
|
*
|
|
1085
1111
|
* - `gui.PIVOT_NW`
|
|
1086
1112
|
*/
|
|
1087
|
-
function get_pivot(node: Opaque<"node">):
|
|
1113
|
+
function get_pivot(node: Opaque<"node">): gui.Pivot;
|
|
1088
1114
|
/**
|
|
1089
1115
|
* Returns the position of the supplied node.
|
|
1090
1116
|
*
|
|
@@ -1146,7 +1172,7 @@ declare global {
|
|
|
1146
1172
|
*
|
|
1147
1173
|
* - `gui.SIZE_MODE_AUTO`
|
|
1148
1174
|
*/
|
|
1149
|
-
function get_size_mode(node: Opaque<"node">):
|
|
1175
|
+
function get_size_mode(node: Opaque<"node">): gui.SizeMode;
|
|
1150
1176
|
/**
|
|
1151
1177
|
* Returns the slice9 configuration values for the node.
|
|
1152
1178
|
*
|
|
@@ -1189,7 +1215,7 @@ declare global {
|
|
|
1189
1215
|
*
|
|
1190
1216
|
* @param node - node from which to get the type
|
|
1191
1217
|
*/
|
|
1192
|
-
function get_type(node: Opaque<"node">): LuaMultiReturn<[
|
|
1218
|
+
function get_type(node: Opaque<"node">): LuaMultiReturn<[gui.NodeType, number | undefined]>;
|
|
1193
1219
|
/**
|
|
1194
1220
|
* Returns `true` if a node is visible and `false` if it's not.
|
|
1195
1221
|
* Invisible nodes are not rendered.
|
|
@@ -1216,7 +1242,7 @@ declare global {
|
|
|
1216
1242
|
*
|
|
1217
1243
|
* - `gui.ANCHOR_RIGHT`
|
|
1218
1244
|
*/
|
|
1219
|
-
function get_xanchor(node: Opaque<"node">):
|
|
1245
|
+
function get_xanchor(node: Opaque<"node">): gui.XAnchor;
|
|
1220
1246
|
/**
|
|
1221
1247
|
* The y-anchor specifies how the node is moved when the game is run in a different resolution.
|
|
1222
1248
|
*
|
|
@@ -1229,7 +1255,7 @@ declare global {
|
|
|
1229
1255
|
*
|
|
1230
1256
|
* - `gui.ANCHOR_BOTTOM`
|
|
1231
1257
|
*/
|
|
1232
|
-
function get_yanchor(node: Opaque<"node">):
|
|
1258
|
+
function get_yanchor(node: Opaque<"node">): gui.YAnchor;
|
|
1233
1259
|
/**
|
|
1234
1260
|
* Hides the on-display touch keyboard on the device.
|
|
1235
1261
|
*/
|
|
@@ -1329,7 +1355,7 @@ declare global {
|
|
|
1329
1355
|
* @example
|
|
1330
1356
|
* ```ts
|
|
1331
1357
|
* // How to create a texture and apply it to a new box node:
|
|
1332
|
-
* export default
|
|
1358
|
+
* export default defineGuiScript({
|
|
1333
1359
|
* init(self) {
|
|
1334
1360
|
* const w = 200;
|
|
1335
1361
|
* const h = 300;
|
|
@@ -1355,13 +1381,17 @@ declare global {
|
|
|
1355
1381
|
* });
|
|
1356
1382
|
*
|
|
1357
1383
|
* // How to create a texture using .astc format
|
|
1384
|
+
* const size = 4;
|
|
1385
|
+
* const pos = vmath.vector3(200, 200, 0);
|
|
1358
1386
|
* const path = "/assets/images/logo_4x4.astc";
|
|
1359
|
-
* const
|
|
1360
|
-
*
|
|
1361
|
-
*
|
|
1362
|
-
*
|
|
1363
|
-
*
|
|
1364
|
-
*
|
|
1387
|
+
* const [data] = sys.load_resource(path);
|
|
1388
|
+
* if (data !== undefined) {
|
|
1389
|
+
* const n = gui.new_box_node(pos, vmath.vector3(size, size, 0));
|
|
1390
|
+
* // size is read from the .astc buffer
|
|
1391
|
+
* // flip is not supported
|
|
1392
|
+
* gui.new_texture(path, 0, 0, "astc", data, false);
|
|
1393
|
+
* gui.set_texture(n, path);
|
|
1394
|
+
* }
|
|
1365
1395
|
* ```
|
|
1366
1396
|
*/
|
|
1367
1397
|
function new_texture(texture_id: string | Hash, width: number, height: number, type: string | Opaque<"constant">, buffer: string, flip?: boolean): LuaMultiReturn<[boolean, number]>;
|
|
@@ -1505,7 +1535,11 @@ declare global {
|
|
|
1505
1535
|
* @returns optional boolean to signal if the input should be consumed (not passed on to others) or not, default is false
|
|
1506
1536
|
* @example
|
|
1507
1537
|
* ```ts
|
|
1508
|
-
* export default
|
|
1538
|
+
* export default defineGuiScript({
|
|
1539
|
+
* init(): { my_value: number | undefined } {
|
|
1540
|
+
* return { my_value: undefined };
|
|
1541
|
+
* },
|
|
1542
|
+
*
|
|
1509
1543
|
* on_input(self, action_id, action) {
|
|
1510
1544
|
* // check for input
|
|
1511
1545
|
* if (action_id === hash("my_action")) {
|
|
@@ -1539,6 +1573,10 @@ declare global {
|
|
|
1539
1573
|
* @example
|
|
1540
1574
|
* ```ts
|
|
1541
1575
|
* export default defineGuiScript({
|
|
1576
|
+
* init() {
|
|
1577
|
+
* return { my_original_color: gui.get_color(gui.get_node("my_node")) };
|
|
1578
|
+
* },
|
|
1579
|
+
*
|
|
1542
1580
|
* on_reload(self) {
|
|
1543
1581
|
* // restore some color (or similar)
|
|
1544
1582
|
* gui.set_color(gui.get_node("my_node"), self.my_original_color);
|
|
@@ -1582,11 +1620,11 @@ declare global {
|
|
|
1582
1620
|
* @example
|
|
1583
1621
|
* ```ts
|
|
1584
1622
|
* // Set the texture of a node to a flipbook animation from an atlas:
|
|
1585
|
-
* function anim_callback(self, node) {
|
|
1623
|
+
* function anim_callback(self: unknown, node: unknown) {
|
|
1586
1624
|
* // Take action after animation has played.
|
|
1587
1625
|
* }
|
|
1588
1626
|
*
|
|
1589
|
-
* export default
|
|
1627
|
+
* export default defineGuiScript({
|
|
1590
1628
|
* init(self) {
|
|
1591
1629
|
* // Create a new node and set the texture to a flipbook animation
|
|
1592
1630
|
* const node = gui.get_node("button_node");
|
|
@@ -1630,13 +1668,13 @@ declare global {
|
|
|
1630
1668
|
* // How to play a particle fx when a gui node is created.
|
|
1631
1669
|
* // The callback receives the gui node, the hash of the id
|
|
1632
1670
|
* // of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
|
|
1633
|
-
* function emitter_state_change(self, node, emitter, state) {
|
|
1671
|
+
* function emitter_state_change(self: unknown, node: unknown, emitter: unknown, state: unknown) {
|
|
1634
1672
|
* if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
|
|
1635
1673
|
* // exhaust is done spawning particles...
|
|
1636
1674
|
* }
|
|
1637
1675
|
* }
|
|
1638
1676
|
*
|
|
1639
|
-
* export default
|
|
1677
|
+
* export default defineGuiScript({
|
|
1640
1678
|
* init(self) {
|
|
1641
1679
|
* gui.play_particlefx(gui.get_node("particlefx"), emitter_state_change);
|
|
1642
1680
|
* },
|
|
@@ -1721,13 +1759,13 @@ declare global {
|
|
|
1721
1759
|
* @param property - the property to set
|
|
1722
1760
|
* @param value - the property to set
|
|
1723
1761
|
* @param options - optional options table (only applicable for material constants)
|
|
1724
|
-
* - `index` number index into array property
|
|
1762
|
+
* - `index` number zero-based index into array property; the transpiler emits Defold's 1-based index
|
|
1725
1763
|
* - `key` hash name of internal property
|
|
1726
1764
|
* @example
|
|
1727
1765
|
* ```ts
|
|
1728
1766
|
* // Updates the position property on an existing node:
|
|
1729
1767
|
* const node = gui.get_node("my_box_node");
|
|
1730
|
-
* const node_position = gui.get(node, "position");
|
|
1768
|
+
* const node_position = gui.get(node, "position") as Vector3;
|
|
1731
1769
|
* gui.set(node, "position.x", node_position.x + 128);
|
|
1732
1770
|
*
|
|
1733
1771
|
* // Updates the rotation property on an existing node:
|
|
@@ -1744,23 +1782,23 @@ declare global {
|
|
|
1744
1782
|
* // matrix4 is also supported
|
|
1745
1783
|
* gui.set(node, "light_matrix", vmath.matrix4());
|
|
1746
1784
|
* // update a constant in an array at position 4. the array is specified in the shader as:
|
|
1747
|
-
* // uniform vec4 tint_array[4]; //
|
|
1748
|
-
* gui.set(node, "tint_array", vmath.vector4(1, 0, 0, 1), { index:
|
|
1785
|
+
* // uniform vec4 tint_array[4]; // TypeScript and the shader are both 0 based
|
|
1786
|
+
* gui.set(node, "tint_array", vmath.vector4(1, 0, 0, 1), { index: 3 });
|
|
1749
1787
|
* // update a matrix constant in an array at position 4. the array is specified in the shader as:
|
|
1750
1788
|
* // uniform mat4 light_matrix_array[4];
|
|
1751
|
-
* gui.set(node, "light_matrix_array", vmath.matrix4(), { index:
|
|
1789
|
+
* gui.set(node, "light_matrix_array", vmath.matrix4(), { index: 3 });
|
|
1752
1790
|
* // update a sub-element in a constant
|
|
1753
1791
|
* gui.set(node, "tint.x", 1);
|
|
1754
1792
|
* // update a sub-element in an array constant at position 4
|
|
1755
|
-
* gui.set(node, "tint_array.x", 1, { index:
|
|
1793
|
+
* gui.set(node, "tint_array.x", 1, { index: 3 });
|
|
1756
1794
|
*
|
|
1757
1795
|
* // Set a named property
|
|
1758
|
-
* export default
|
|
1796
|
+
* export default defineGuiScript({
|
|
1759
1797
|
* on_message(self, message_id, message) {
|
|
1760
|
-
* if (message_id === hash("set_font")) {
|
|
1798
|
+
* if (message_id === hash("set_font") && types.is_hash(message.font)) {
|
|
1761
1799
|
* gui.set(msg.url(), "fonts", message.font, { key: "my_font_name" });
|
|
1762
1800
|
* gui.set_font(gui.get_node("text"), "my_font_name");
|
|
1763
|
-
* } else if (message_id === hash("set_texture")) {
|
|
1801
|
+
* } else if (message_id === hash("set_texture") && types.is_hash(message.texture)) {
|
|
1764
1802
|
* gui.set(msg.url(), "textures", message.texture, { key: "my_texture" });
|
|
1765
1803
|
* gui.set_texture(gui.get_node("box"), "my_texture");
|
|
1766
1804
|
* gui.play_flipbook(gui.get_node("box"), "logo_256");
|
|
@@ -1769,7 +1807,7 @@ declare global {
|
|
|
1769
1807
|
* });
|
|
1770
1808
|
* ```
|
|
1771
1809
|
*/
|
|
1772
|
-
function set(node: Opaque<"node"> | Url, property: string | Hash |
|
|
1810
|
+
function set(node: Opaque<"node"> | Url, property: string | Hash | gui.Property, value: number | Vector4 | Vector3 | Quaternion | Matrix4 | Hash, options?: { index?: number; key?: string | Hash }): void;
|
|
1773
1811
|
/**
|
|
1774
1812
|
* Sets the adjust mode on a node.
|
|
1775
1813
|
* The adjust mode defines how the node will adjust itself to screen
|
|
@@ -1784,7 +1822,7 @@ declare global {
|
|
|
1784
1822
|
*
|
|
1785
1823
|
* - `gui.ADJUST_STRETCH`
|
|
1786
1824
|
*/
|
|
1787
|
-
function set_adjust_mode(node: Opaque<"node">, adjust_mode:
|
|
1825
|
+
function set_adjust_mode(node: Opaque<"node">, adjust_mode: gui.AdjustMode): void;
|
|
1788
1826
|
/**
|
|
1789
1827
|
* sets the node alpha
|
|
1790
1828
|
*
|
|
@@ -1809,7 +1847,7 @@ declare global {
|
|
|
1809
1847
|
*
|
|
1810
1848
|
* - `gui.BLEND_SCREEN`
|
|
1811
1849
|
*/
|
|
1812
|
-
function set_blend_mode(node: Opaque<"node">, blend_mode:
|
|
1850
|
+
function set_blend_mode(node: Opaque<"node">, blend_mode: gui.BlendMode): void;
|
|
1813
1851
|
/**
|
|
1814
1852
|
* If node is set as an inverted clipping node, it will clip anything inside as opposed to outside.
|
|
1815
1853
|
*
|
|
@@ -1827,7 +1865,7 @@ declare global {
|
|
|
1827
1865
|
*
|
|
1828
1866
|
* - `gui.CLIPPING_MODE_STENCIL`
|
|
1829
1867
|
*/
|
|
1830
|
-
function set_clipping_mode(node: Opaque<"node">, clipping_mode:
|
|
1868
|
+
function set_clipping_mode(node: Opaque<"node">, clipping_mode: gui.ClippingMode): void;
|
|
1831
1869
|
/**
|
|
1832
1870
|
* 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.
|
|
1833
1871
|
*
|
|
@@ -1995,7 +2033,7 @@ declare global {
|
|
|
1995
2033
|
*
|
|
1996
2034
|
* - `gui.PIEBOUNDS_ELLIPSE`
|
|
1997
2035
|
*/
|
|
1998
|
-
function set_outer_bounds(node: Opaque<"node">, bounds_mode:
|
|
2036
|
+
function set_outer_bounds(node: Opaque<"node">, bounds_mode: gui.PieBounds): void;
|
|
1999
2037
|
/**
|
|
2000
2038
|
* Sets the outline color of the supplied node.
|
|
2001
2039
|
* See gui.set_color for info how vectors encode color values.
|
|
@@ -2050,7 +2088,7 @@ declare global {
|
|
|
2050
2088
|
*
|
|
2051
2089
|
* - `gui.PIVOT_NW`
|
|
2052
2090
|
*/
|
|
2053
|
-
function set_pivot(node: Opaque<"node">, pivot:
|
|
2091
|
+
function set_pivot(node: Opaque<"node">, pivot: gui.Pivot): void;
|
|
2054
2092
|
/**
|
|
2055
2093
|
* Sets the position of the supplied node.
|
|
2056
2094
|
*
|
|
@@ -2075,7 +2113,7 @@ declare global {
|
|
|
2075
2113
|
* @param node - node to set the rotation for
|
|
2076
2114
|
* @param rotation - new rotation
|
|
2077
2115
|
*/
|
|
2078
|
-
function set_rotation(node: Opaque<"node">, rotation: Quaternion | Vector4): void;
|
|
2116
|
+
function set_rotation(node: Opaque<"node">, rotation: Quaternion | Vector4 | Vector3): void;
|
|
2079
2117
|
/**
|
|
2080
2118
|
* Sets how the safe area is applied to this gui scene.
|
|
2081
2119
|
*
|
|
@@ -2089,7 +2127,7 @@ declare global {
|
|
|
2089
2127
|
*
|
|
2090
2128
|
* - `gui.SAFE_AREA_BOTH`
|
|
2091
2129
|
*/
|
|
2092
|
-
function set_safe_area_mode(mode:
|
|
2130
|
+
function set_safe_area_mode(mode: gui.SafeAreaMode): void;
|
|
2093
2131
|
/**
|
|
2094
2132
|
* Sets the scaling of the supplied node.
|
|
2095
2133
|
*
|
|
@@ -2135,7 +2173,7 @@ declare global {
|
|
|
2135
2173
|
*
|
|
2136
2174
|
* - `gui.SIZE_MODE_AUTO`
|
|
2137
2175
|
*/
|
|
2138
|
-
function set_size_mode(node: Opaque<"node">, size_mode:
|
|
2176
|
+
function set_size_mode(node: Opaque<"node">, size_mode: gui.SizeMode): void;
|
|
2139
2177
|
/**
|
|
2140
2178
|
* Set the slice9 configuration values for the node.
|
|
2141
2179
|
*
|
|
@@ -2200,7 +2238,7 @@ declare global {
|
|
|
2200
2238
|
* @returns setting the data was successful
|
|
2201
2239
|
* @example
|
|
2202
2240
|
* ```ts
|
|
2203
|
-
* export default
|
|
2241
|
+
* export default defineGuiScript({
|
|
2204
2242
|
* init(self) {
|
|
2205
2243
|
* const w = 200;
|
|
2206
2244
|
* const h = 300;
|
|
@@ -2255,7 +2293,7 @@ declare global {
|
|
|
2255
2293
|
*
|
|
2256
2294
|
* - `gui.ANCHOR_RIGHT`
|
|
2257
2295
|
*/
|
|
2258
|
-
function set_xanchor(node: Opaque<"node">, anchor:
|
|
2296
|
+
function set_xanchor(node: Opaque<"node">, anchor: gui.XAnchor): void;
|
|
2259
2297
|
/**
|
|
2260
2298
|
* The y-anchor specifies how the node is moved when the game is run in a different resolution.
|
|
2261
2299
|
*
|
|
@@ -2268,7 +2306,7 @@ declare global {
|
|
|
2268
2306
|
*
|
|
2269
2307
|
* - `gui.ANCHOR_BOTTOM`
|
|
2270
2308
|
*/
|
|
2271
|
-
function set_yanchor(node: Opaque<"node">, anchor:
|
|
2309
|
+
function set_yanchor(node: Opaque<"node">, anchor: gui.YAnchor): void;
|
|
2272
2310
|
/**
|
|
2273
2311
|
* Shows the on-display touch keyboard.
|
|
2274
2312
|
* The specified type of keyboard is displayed if it is available on
|
|
@@ -2286,7 +2324,7 @@ declare global {
|
|
|
2286
2324
|
* - `gui.KEYBOARD_TYPE_PASSWORD`
|
|
2287
2325
|
* @param autoclose - if the keyboard should automatically close when clicking outside
|
|
2288
2326
|
*/
|
|
2289
|
-
function show_keyboard(type:
|
|
2327
|
+
function show_keyboard(type: gui.KeyboardType, autoclose: boolean): void;
|
|
2290
2328
|
/**
|
|
2291
2329
|
* Stops the particle fx for a gui node
|
|
2292
2330
|
*
|
|
@@ -2308,15 +2346,17 @@ declare global {
|
|
|
2308
2346
|
* // in a counting fashion. It is assumed that the gui component receives messages
|
|
2309
2347
|
* // from the game when a new score is to be shown.
|
|
2310
2348
|
* export default defineGuiScript({
|
|
2311
|
-
* init(
|
|
2312
|
-
*
|
|
2313
|
-
*
|
|
2314
|
-
*
|
|
2315
|
-
*
|
|
2316
|
-
*
|
|
2317
|
-
*
|
|
2318
|
-
*
|
|
2319
|
-
*
|
|
2349
|
+
* init() {
|
|
2350
|
+
* return {
|
|
2351
|
+
* // fetch the score text node for later use (assumes it is called "score")
|
|
2352
|
+
* score_node: gui.get_node("score"),
|
|
2353
|
+
* // keep track of the current score counted up so far
|
|
2354
|
+
* current_score: 0,
|
|
2355
|
+
* // keep track of the target score we should count up to
|
|
2356
|
+
* target_score: 0,
|
|
2357
|
+
* // how fast we will update the score, in score/second
|
|
2358
|
+
* score_update_speed: 1,
|
|
2359
|
+
* };
|
|
2320
2360
|
* },
|
|
2321
2361
|
*
|
|
2322
2362
|
* update(self, dt) {
|
|
@@ -2335,7 +2375,7 @@ declare global {
|
|
|
2335
2375
|
*
|
|
2336
2376
|
* on_message(self, message_id, message) {
|
|
2337
2377
|
* // check the message
|
|
2338
|
-
* if (message_id === hash("set_score")) {
|
|
2378
|
+
* if (message_id === hash("set_score") && typeof message.score === "number") {
|
|
2339
2379
|
* self.target_score = message.score;
|
|
2340
2380
|
* }
|
|
2341
2381
|
* },
|
|
@@ -18,7 +18,9 @@ declare global {
|
|
|
18
18
|
* const res = html5.run("10 + 20"); // returns the string "30"
|
|
19
19
|
* print(res);
|
|
20
20
|
* const res_num = tonumber(res); // convert to number
|
|
21
|
-
*
|
|
21
|
+
* if (res_num !== undefined) {
|
|
22
|
+
* print(res_num - 20); // prints 10
|
|
23
|
+
* }
|
|
22
24
|
* ```
|
|
23
25
|
*/
|
|
24
26
|
function run(code: string): string;
|
|
@@ -34,7 +36,7 @@ declare global {
|
|
|
34
36
|
* object The calling script
|
|
35
37
|
* @example
|
|
36
38
|
* ```ts
|
|
37
|
-
* function on_interaction(self) {
|
|
39
|
+
* function on_interaction(self: unknown) {
|
|
38
40
|
* print("on_interaction called");
|
|
39
41
|
* html5.set_interaction_listener(undefined);
|
|
40
42
|
* }
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
|
+
import type { Hash } from "../../../src/core-types";
|
|
3
|
+
|
|
2
4
|
declare global {
|
|
3
5
|
/**
|
|
4
6
|
* Functions for performing HTTP and HTTPS requests.
|
|
@@ -53,6 +55,10 @@ declare global {
|
|
|
53
55
|
* - 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
56
|
* @example
|
|
55
57
|
* ```ts
|
|
58
|
+
* function update_my_progress_bar(self: unknown, fraction: number) {
|
|
59
|
+
* // draw the progress bar at the given fraction
|
|
60
|
+
* }
|
|
61
|
+
*
|
|
56
62
|
* // Basic HTTP-GET request. The callback receives a table with the response
|
|
57
63
|
* // in the fields status, the response (the data) and headers (a table).
|
|
58
64
|
* export default defineScript({
|
|
@@ -61,7 +67,7 @@ declare global {
|
|
|
61
67
|
* "http://www.google.com",
|
|
62
68
|
* "GET",
|
|
63
69
|
* (self, _id, response) => {
|
|
64
|
-
* if (response.bytes_total !== undefined) {
|
|
70
|
+
* if (response.bytes_received !== undefined && response.bytes_total !== undefined) {
|
|
65
71
|
* update_my_progress_bar(self, response.bytes_received / response.bytes_total);
|
|
66
72
|
* } else {
|
|
67
73
|
* print(response.status);
|
|
@@ -77,7 +83,7 @@ declare global {
|
|
|
77
83
|
* });
|
|
78
84
|
* ```
|
|
79
85
|
*/
|
|
80
|
-
function request(url: string, method: string, callback: (self: unknown, id:
|
|
86
|
+
function request(url: string, method: string, callback: (self: unknown, id: Hash, response: { status: number; response?: string; headers?: LuaMap<string, string>; path?: string; error?: string; bytes_received?: number; bytes_total?: number; range_start?: number; range_end?: number; document_size?: number }) => void, headers?: LuaMap<string, string> | Record<string, string>, post_data?: string, options?: { timeout?: number; path?: string; ignore_cache?: boolean; chunked_transfer?: boolean; report_progress?: boolean }): void;
|
|
81
87
|
}
|
|
82
88
|
}
|
|
83
89
|
|
|
@@ -43,8 +43,10 @@ declare global {
|
|
|
43
43
|
* ```ts
|
|
44
44
|
* // How to get the block size and dimensions from a .astc file
|
|
45
45
|
* const [s] = sys.load_resource("/assets/cat.astc");
|
|
46
|
-
*
|
|
47
|
-
*
|
|
46
|
+
* if (s !== undefined) {
|
|
47
|
+
* const header = image.get_astc_header(s);
|
|
48
|
+
* pprint(s);
|
|
49
|
+
* }
|
|
48
50
|
* ```
|
|
49
51
|
*/
|
|
50
52
|
function get_astc_header(buffer: string): { width: number; height: number; depth: number; block_size_x: number; block_size_y: number; block_size_z: number } | undefined;
|
|
@@ -80,8 +82,10 @@ declare global {
|
|
|
80
82
|
* // How to load an image from an URL and create a GUI texture from it:
|
|
81
83
|
* const imgurl = "http://www.site.com/image.png";
|
|
82
84
|
* http.request(imgurl, "GET", (self, id, response) => {
|
|
83
|
-
* const img = image.load(response.response);
|
|
84
|
-
*
|
|
85
|
+
* const img = response.response !== undefined ? image.load(response.response) : undefined;
|
|
86
|
+
* if (img !== undefined) {
|
|
87
|
+
* const tx = gui.new_texture("image_node", img.width, img.height, img.type, img.buffer);
|
|
88
|
+
* }
|
|
85
89
|
* });
|
|
86
90
|
* ```
|
|
87
91
|
*/
|
|
@@ -118,17 +122,22 @@ declare global {
|
|
|
118
122
|
* // Load an image from an URL as a buffer and create a texture resource from it:
|
|
119
123
|
* const imgurl = "http://www.site.com/image.png";
|
|
120
124
|
* http.request(imgurl, "GET", (self, id, response) => {
|
|
121
|
-
* const img =
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
125
|
+
* const img =
|
|
126
|
+
* response.response !== undefined
|
|
127
|
+
* ? image.load_buffer(response.response, { flip_vertically: true })
|
|
128
|
+
* : undefined;
|
|
129
|
+
* if (img !== undefined) {
|
|
130
|
+
* const tparams = {
|
|
131
|
+
* width: img.width,
|
|
132
|
+
* height: img.height,
|
|
133
|
+
* type: graphics.TEXTURE_TYPE_2D,
|
|
134
|
+
* format: graphics.TEXTURE_FORMAT_RGBA,
|
|
135
|
+
* };
|
|
136
|
+
*
|
|
137
|
+
* const my_texture_id = resource.create_texture("/my_custom_texture.texturec", tparams, img.buffer);
|
|
138
|
+
* // Apply the texture to a model
|
|
139
|
+
* go.set("/go1#model", "texture0", my_texture_id);
|
|
140
|
+
* }
|
|
132
141
|
* });
|
|
133
142
|
* ```
|
|
134
143
|
*/
|