@defold-typescript/types 0.37.0 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api-signatures.json +348 -267
- package/examples/translations.json +323 -147
- package/generated/b2d_body.d.ts +7 -4
- package/generated/buffer.d.ts +16 -4
- package/generated/camera.d.ts +1 -0
- package/generated/collectionfactory.d.ts +5 -2
- package/generated/collectionproxy.d.ts +1 -1
- package/generated/factory.d.ts +2 -1
- package/generated/go.d.ts +141 -86
- package/generated/graphics.d.ts +2 -0
- package/generated/gui.d.ts +65 -40
- package/generated/html5.d.ts +1 -1
- package/generated/http.d.ts +4 -0
- package/generated/model.d.ts +9 -4
- package/generated/particlefx.d.ts +1 -1
- package/generated/physics.d.ts +16 -9
- package/generated/profiler.d.ts +9 -2
- package/generated/render.d.ts +224 -99
- package/generated/resource.d.ts +143 -157
- package/generated/socket.d.ts +13 -8
- package/generated/sound.d.ts +3 -2
- package/generated/sys.d.ts +16 -10
- package/generated/tilemap.d.ts +25 -19
- package/generated/timer.d.ts +33 -24
- package/generated/versions/defold-1.12.4/buffer.d.ts +16 -4
- package/generated/versions/defold-1.12.4/camera.d.ts +1 -0
- package/generated/versions/defold-1.12.4/collectionfactory.d.ts +5 -2
- package/generated/versions/defold-1.12.4/collectionproxy.d.ts +1 -1
- package/generated/versions/defold-1.12.4/factory.d.ts +2 -1
- package/generated/versions/defold-1.12.4/go.d.ts +141 -86
- package/generated/versions/defold-1.12.4/graphics.d.ts +2 -0
- package/generated/versions/defold-1.12.4/gui.d.ts +63 -39
- package/generated/versions/defold-1.12.4/html5.d.ts +1 -1
- package/generated/versions/defold-1.12.4/http.d.ts +4 -0
- package/generated/versions/defold-1.12.4/model.d.ts +9 -4
- package/generated/versions/defold-1.12.4/particlefx.d.ts +1 -1
- package/generated/versions/defold-1.12.4/physics.d.ts +16 -9
- package/generated/versions/defold-1.12.4/profiler.d.ts +9 -2
- package/generated/versions/defold-1.12.4/render.d.ts +223 -98
- package/generated/versions/defold-1.12.4/resource.d.ts +143 -157
- package/generated/versions/defold-1.12.4/socket.d.ts +13 -8
- package/generated/versions/defold-1.12.4/sound.d.ts +3 -2
- package/generated/versions/defold-1.12.4/sys.d.ts +16 -10
- package/generated/versions/defold-1.12.4/tilemap.d.ts +25 -19
- package/generated/versions/defold-1.12.4/timer.d.ts +33 -24
- package/generated/versions/defold-1.12.4/vmath.d.ts +13 -5
- package/generated/versions/defold-1.12.4/window.d.ts +5 -3
- package/generated/versions/defold-1.13.0/b2d_body.d.ts +7 -4
- package/generated/versions/defold-1.13.0/buffer.d.ts +16 -4
- package/generated/versions/defold-1.13.0/camera.d.ts +1 -0
- package/generated/versions/defold-1.13.0/collectionfactory.d.ts +5 -2
- package/generated/versions/defold-1.13.0/collectionproxy.d.ts +1 -1
- package/generated/versions/defold-1.13.0/factory.d.ts +2 -1
- package/generated/versions/defold-1.13.0/go.d.ts +141 -86
- package/generated/versions/defold-1.13.0/graphics.d.ts +2 -0
- package/generated/versions/defold-1.13.0/gui.d.ts +63 -39
- package/generated/versions/defold-1.13.0/html5.d.ts +1 -1
- package/generated/versions/defold-1.13.0/http.d.ts +4 -0
- package/generated/versions/defold-1.13.0/model.d.ts +9 -4
- package/generated/versions/defold-1.13.0/particlefx.d.ts +1 -1
- package/generated/versions/defold-1.13.0/physics.d.ts +16 -9
- package/generated/versions/defold-1.13.0/profiler.d.ts +9 -2
- package/generated/versions/defold-1.13.0/render.d.ts +224 -99
- package/generated/versions/defold-1.13.0/resource.d.ts +143 -157
- package/generated/versions/defold-1.13.0/socket.d.ts +13 -8
- package/generated/versions/defold-1.13.0/sound.d.ts +3 -2
- package/generated/versions/defold-1.13.0/sys.d.ts +16 -10
- package/generated/versions/defold-1.13.0/tilemap.d.ts +25 -19
- package/generated/versions/defold-1.13.0/timer.d.ts +33 -24
- package/generated/versions/defold-1.13.0/vmath.d.ts +13 -5
- package/generated/versions/defold-1.13.0/window.d.ts +5 -3
- package/generated/vmath.d.ts +13 -5
- package/generated/window.d.ts +5 -3
- package/package.json +2 -1
- package/src/api-doc.ts +8 -0
- package/src/doc-comment.ts +213 -32
- package/src/emit-dts.ts +501 -10
- package/src/example-store.ts +26 -0
- package/src/index.ts +5 -0
- package/src/lifecycle.ts +31 -8
- package/src/message-dispatch.d.ts +55 -13
- package/src/msg-overloads.d.ts +73 -3
- package/src/render-overloads.d.ts +0 -17
package/generated/resource.d.ts
CHANGED
|
@@ -18,6 +18,7 @@ declare global {
|
|
|
18
18
|
* @param path - optional resource path string to the resource
|
|
19
19
|
* @returns a path hash to the binary version of the resource
|
|
20
20
|
* @example
|
|
21
|
+
* Load an atlas and set it to a sprite:
|
|
21
22
|
* ```ts
|
|
22
23
|
* // Load an atlas and set it to a sprite:
|
|
23
24
|
* go.property("my_atlas", resource.atlas("/atlas.atlas"));
|
|
@@ -27,7 +28,10 @@ declare global {
|
|
|
27
28
|
* go.set("#sprite", "image", self.my_atlas);
|
|
28
29
|
* },
|
|
29
30
|
* });
|
|
30
|
-
*
|
|
31
|
+
* ```
|
|
32
|
+
* @example
|
|
33
|
+
* Load an atlas and set it to a gui:
|
|
34
|
+
* ```ts
|
|
31
35
|
* // Load an atlas and set it to a gui:
|
|
32
36
|
* go.property("my_atlas", resource.atlas("/atlas.atlas"));
|
|
33
37
|
*
|
|
@@ -78,109 +82,67 @@ declare global {
|
|
|
78
82
|
* @param path - The path to the resource.
|
|
79
83
|
* @param table - A table containing info about how to create the atlas. Supported entries:
|
|
80
84
|
*
|
|
81
|
-
* -
|
|
82
|
-
*
|
|
83
|
-
* `texture`
|
|
85
|
+
* - `texture`
|
|
84
86
|
* string | hash the path to the texture resource, e.g "/main/my_texture.texturec"
|
|
85
87
|
*
|
|
86
|
-
* -
|
|
87
|
-
*
|
|
88
|
-
* `animations`
|
|
88
|
+
* - `animations`
|
|
89
89
|
* table a list of the animations in the atlas. Supports the following fields:
|
|
90
90
|
*
|
|
91
|
-
* -
|
|
92
|
-
*
|
|
93
|
-
* `id`
|
|
91
|
+
* - `id`
|
|
94
92
|
* string the id of the animation, used in e.g sprite.play_animation
|
|
95
93
|
*
|
|
96
|
-
* -
|
|
97
|
-
*
|
|
98
|
-
* `width`
|
|
94
|
+
* - `width`
|
|
99
95
|
* number the width of the animation
|
|
100
96
|
*
|
|
101
|
-
* -
|
|
102
|
-
*
|
|
103
|
-
* `height`
|
|
97
|
+
* - `height`
|
|
104
98
|
* number the height of the animation
|
|
105
99
|
*
|
|
106
|
-
* -
|
|
107
|
-
*
|
|
108
|
-
* `frame_start`
|
|
100
|
+
* - `frame_start`
|
|
109
101
|
* number index to the first geometry of the animation. Indices are lua based and must be in the range of 1 .. in atlas.
|
|
110
102
|
*
|
|
111
|
-
* -
|
|
112
|
-
*
|
|
113
|
-
* `frame_end`
|
|
103
|
+
* - `frame_end`
|
|
114
104
|
* number index to the last geometry of the animation (non-inclusive). Indices are lua based and must be in the range of 1 .. in atlas.
|
|
115
105
|
*
|
|
116
|
-
* -
|
|
117
|
-
*
|
|
118
|
-
* `playback`
|
|
106
|
+
* - `playback`
|
|
119
107
|
* constant optional playback mode of the animation, the default value is go.PLAYBACK_ONCE_FORWARD
|
|
120
108
|
*
|
|
121
|
-
* -
|
|
122
|
-
*
|
|
123
|
-
* `fps`
|
|
109
|
+
* - `fps`
|
|
124
110
|
* number optional fps of the animation, the default value is 30
|
|
125
111
|
*
|
|
126
|
-
* -
|
|
127
|
-
*
|
|
128
|
-
* `flip_vertical`
|
|
112
|
+
* - `flip_vertical`
|
|
129
113
|
* boolean optional flip the animation vertically, the default value is false
|
|
130
114
|
*
|
|
131
|
-
* -
|
|
132
|
-
*
|
|
133
|
-
* `flip_horizontal`
|
|
115
|
+
* - `flip_horizontal`
|
|
134
116
|
* boolean optional flip the animation horizontally, the default value is false
|
|
135
117
|
*
|
|
136
|
-
* -
|
|
137
|
-
*
|
|
138
|
-
* `geometries`
|
|
118
|
+
* - `geometries`
|
|
139
119
|
* table A list of the geometries that should map to the texture data. Supports the following fields:
|
|
140
120
|
*
|
|
141
|
-
* -
|
|
142
|
-
*
|
|
143
|
-
* `id`
|
|
121
|
+
* - `id`
|
|
144
122
|
* string The name of the geometry. Used when matching animations between multiple atlases
|
|
145
123
|
*
|
|
146
|
-
* -
|
|
147
|
-
*
|
|
148
|
-
* `width`
|
|
124
|
+
* - `width`
|
|
149
125
|
* number The width of the image the sprite geometry represents
|
|
150
126
|
*
|
|
151
|
-
* -
|
|
152
|
-
*
|
|
153
|
-
* `height`
|
|
127
|
+
* - `height`
|
|
154
128
|
* number The height of the image the sprite geometry represents
|
|
155
129
|
*
|
|
156
|
-
* -
|
|
157
|
-
*
|
|
158
|
-
* `pivot_x`
|
|
130
|
+
* - `pivot_x`
|
|
159
131
|
* number The pivot x value of the image in unit coords. (0,0) is upper left corner, (1,1) is bottom right. Default is 0.5.
|
|
160
132
|
*
|
|
161
|
-
* -
|
|
162
|
-
*
|
|
163
|
-
* `pivot_y`
|
|
133
|
+
* - `pivot_y`
|
|
164
134
|
* number The pivot y value of the image in unit coords. (0,0) is upper left corner, (1,1) is bottom right. Default is 0.5.
|
|
165
135
|
*
|
|
166
|
-
* -
|
|
167
|
-
*
|
|
168
|
-
* `rotated`
|
|
136
|
+
* - `rotated`
|
|
169
137
|
* boolean Whether the image is rotated 90 degrees counter-clockwise in the atlas. This affects UV coordinate generation for proper rendering. Default is false.
|
|
170
138
|
*
|
|
171
|
-
* -
|
|
172
|
-
*
|
|
173
|
-
* `vertices`
|
|
139
|
+
* - `vertices`
|
|
174
140
|
* table a list of the vertices in image space of the geometry in the form {px0, py0, px1, py1, ..., pxn, pyn}
|
|
175
141
|
*
|
|
176
|
-
* -
|
|
177
|
-
*
|
|
178
|
-
* `uvs`
|
|
142
|
+
* - `uvs`
|
|
179
143
|
* table a list of the uv coordinates in image space of the geometry in the form of {u0, v0, u1, v1, ..., un, vn}.
|
|
180
144
|
*
|
|
181
|
-
* -
|
|
182
|
-
*
|
|
183
|
-
* `indices`
|
|
145
|
+
* - `indices`
|
|
184
146
|
* table a list of the indices of the geometry in the form {i0, i1, i2, ..., in}. Each tripe in the list represents a triangle.
|
|
185
147
|
* @returns Returns the atlas resource path
|
|
186
148
|
* @example
|
|
@@ -247,17 +209,14 @@ declare global {
|
|
|
247
209
|
* @param path - The path to the resource.
|
|
248
210
|
* @param table - A table containing info about how to create the buffer. Supported entries:
|
|
249
211
|
*
|
|
250
|
-
* -
|
|
251
|
-
*
|
|
252
|
-
* `buffer`
|
|
212
|
+
* - `buffer`
|
|
253
213
|
* buffer the buffer to bind to this resource
|
|
254
214
|
*
|
|
255
|
-
* -
|
|
256
|
-
*
|
|
257
|
-
* `transfer_ownership`
|
|
215
|
+
* - `transfer_ownership`
|
|
258
216
|
* boolean optional flag to determine whether or not the resource should take over ownership of the buffer object (default true)
|
|
259
217
|
* @returns Returns the buffer resource path
|
|
260
218
|
* @example
|
|
219
|
+
* Create a buffer object and bind it to a buffer resource
|
|
261
220
|
* ```ts
|
|
262
221
|
* // Create a buffer object and bind it to a buffer resource
|
|
263
222
|
* export default defineScript({
|
|
@@ -293,7 +252,10 @@ declare global {
|
|
|
293
252
|
* go.set("/go#mesh", "vertices", my_buffer);
|
|
294
253
|
* },
|
|
295
254
|
* });
|
|
296
|
-
*
|
|
255
|
+
* ```
|
|
256
|
+
* @example
|
|
257
|
+
* Create a buffer resource from existing resource
|
|
258
|
+
* ```ts
|
|
297
259
|
* // Create a buffer resource from existing resource
|
|
298
260
|
* export default defineScript({
|
|
299
261
|
* init() {
|
|
@@ -449,7 +411,9 @@ declare global {
|
|
|
449
411
|
* if graphics.TEXTURE_TYPE_3D ~= nil then
|
|
450
412
|
* -- Device and graphics adapter support 3D textures
|
|
451
413
|
* end
|
|
414
|
+
* ```
|
|
452
415
|
* @example
|
|
416
|
+
* How to create an 128x128 RGBA texture resource and assign it to a model
|
|
453
417
|
* ```ts
|
|
454
418
|
* // How to create an 128x128 RGBA texture resource and assign it to a model
|
|
455
419
|
* export default defineScript({
|
|
@@ -464,7 +428,10 @@ declare global {
|
|
|
464
428
|
* go.set("#model", "texture0", my_texture_id);
|
|
465
429
|
* },
|
|
466
430
|
* });
|
|
467
|
-
*
|
|
431
|
+
* ```
|
|
432
|
+
* @example
|
|
433
|
+
* How to create an 128x128 floating point texture (RGBA32F) resource from a buffer object
|
|
434
|
+
* ```ts
|
|
468
435
|
* // How to create an 128x128 floating point texture (RGBA32F) resource from a buffer object
|
|
469
436
|
* export default defineScript({
|
|
470
437
|
* init() {
|
|
@@ -498,7 +465,10 @@ declare global {
|
|
|
498
465
|
* go.set("#model", "texture0", my_texture_id);
|
|
499
466
|
* },
|
|
500
467
|
* });
|
|
501
|
-
*
|
|
468
|
+
* ```
|
|
469
|
+
* @example
|
|
470
|
+
* How to create a 32x32x32 floating point 3D texture that can be used to generate volumetric data in a compute shader
|
|
471
|
+
* ```ts
|
|
502
472
|
* // How to create a 32x32x32 floating point 3D texture that can be used to generate volumetric data in a compute shader
|
|
503
473
|
* export default defineScript({
|
|
504
474
|
* init() {
|
|
@@ -515,7 +485,10 @@ declare global {
|
|
|
515
485
|
* msg.post("@render:", "add_textures", [t_volume]);
|
|
516
486
|
* },
|
|
517
487
|
* });
|
|
518
|
-
*
|
|
488
|
+
* ```
|
|
489
|
+
* @example
|
|
490
|
+
* How to create 512x512 texture array with 5 pages.
|
|
491
|
+
* ```ts
|
|
519
492
|
* // How to create 512x512 texture array with 5 pages.
|
|
520
493
|
* const new_tex = resource.create_texture("/runtime/example_array.texturec", {
|
|
521
494
|
* type: graphics.TEXTURE_TYPE_2D_ARRAY,
|
|
@@ -526,7 +499,7 @@ declare global {
|
|
|
526
499
|
* });
|
|
527
500
|
* ```
|
|
528
501
|
*/
|
|
529
|
-
function create_texture(path: string, table: { type?: number; width?: number; height?: number; depth?: number; format?: number; flags?: number; max_mipmaps?: number; compression_type?: number }, buffer?: Opaque<"buffer">): Hash;
|
|
502
|
+
function create_texture(path: string, table: { type?: number; width?: number; height?: number; depth?: number; format?: number; flags?: number; max_mipmaps?: number; compression_type?: number; page_count?: number }, buffer?: Opaque<"buffer">): Hash;
|
|
530
503
|
/**
|
|
531
504
|
* Creates a new texture resource that can be used in the same way as any texture created during build time.
|
|
532
505
|
* The path used for creating the texture must be unique, trying to create a resource at a path that is already
|
|
@@ -639,14 +612,15 @@ declare global {
|
|
|
639
612
|
* @param buffer - optional buffer of precreated pixel data
|
|
640
613
|
* @param callback - callback function when texture is created (self, request_id, resource)
|
|
641
614
|
* @example
|
|
615
|
+
* Create a texture resource asyncronously with a buffer and a callback
|
|
642
616
|
* ```ts
|
|
643
617
|
* // Create a texture resource asyncronously with a buffer and a callback
|
|
644
|
-
* function callback(self, request_id,
|
|
618
|
+
* function callback(self: unknown, request_id: unknown, texture_path: unknown) {
|
|
645
619
|
* // The resource has been updated with a new texture,
|
|
646
620
|
* // so we can update other systems with the new handle,
|
|
647
621
|
* // or update components to use the resource if we want
|
|
648
|
-
* const tinfo = resource.get_texture_info(
|
|
649
|
-
* msg.post("@render:", "set_backing_texture", tinfo.handle);
|
|
622
|
+
* const tinfo = resource.get_texture_info(texture_path as Hash);
|
|
623
|
+
* msg.post("@render:", "set_backing_texture", { handle: tinfo.handle });
|
|
650
624
|
* }
|
|
651
625
|
*
|
|
652
626
|
* export default defineScript({
|
|
@@ -680,7 +654,10 @@ declare global {
|
|
|
680
654
|
* go.set("#model", "texture0", tpath);
|
|
681
655
|
* },
|
|
682
656
|
* });
|
|
683
|
-
*
|
|
657
|
+
* ```
|
|
658
|
+
* @example
|
|
659
|
+
* Create a texture resource asyncronously without a callback
|
|
660
|
+
* ```ts
|
|
684
661
|
* // Create a texture resource asyncronously without a callback
|
|
685
662
|
* export default defineScript({
|
|
686
663
|
* init() {
|
|
@@ -728,6 +705,7 @@ declare global {
|
|
|
728
705
|
* @param path - optional resource path string to the resource
|
|
729
706
|
* @returns a path hash to the binary version of the resource
|
|
730
707
|
* @example
|
|
708
|
+
* Load a font and set it to a label:
|
|
731
709
|
* ```ts
|
|
732
710
|
* // Load a font and set it to a label:
|
|
733
711
|
* go.property("my_font", resource.font("/font.font"));
|
|
@@ -737,7 +715,10 @@ declare global {
|
|
|
737
715
|
* go.set("#label", "font", self.my_font);
|
|
738
716
|
* },
|
|
739
717
|
* });
|
|
740
|
-
*
|
|
718
|
+
* ```
|
|
719
|
+
* @example
|
|
720
|
+
* Load a font and set it to a gui:
|
|
721
|
+
* ```ts
|
|
741
722
|
* // Load a font and set it to a gui:
|
|
742
723
|
* go.property("my_font", resource.font("/font.font"));
|
|
743
724
|
*
|
|
@@ -828,14 +809,12 @@ declare global {
|
|
|
828
809
|
*
|
|
829
810
|
* - `resource.BUFFER_TYPE_DEPTH`
|
|
830
811
|
*
|
|
831
|
-
* -
|
|
832
|
-
* `resource.BUFFER_TYPE_STENCIL`
|
|
833
|
-
*
|
|
834
|
-
* -
|
|
812
|
+
* - `resource.BUFFER_TYPE_STENCIL`
|
|
835
813
|
*
|
|
836
|
-
* `texture`
|
|
814
|
+
* - `texture`
|
|
837
815
|
* hash The hashed path to the attachment texture resource. This field is only available if the render target passed in is a resource.
|
|
838
816
|
* @example
|
|
817
|
+
* Get the metadata from a render target resource
|
|
839
818
|
* ```ts
|
|
840
819
|
* // Get the metadata from a render target resource
|
|
841
820
|
* export default defineScript({
|
|
@@ -847,7 +826,10 @@ declare global {
|
|
|
847
826
|
* const info_attachment_1 = resource.get_texture_info(info.attachments[0]!.handle);
|
|
848
827
|
* },
|
|
849
828
|
* });
|
|
850
|
-
*
|
|
829
|
+
* ```
|
|
830
|
+
* @example
|
|
831
|
+
* Get a texture attachment from a render target and set it on a model component
|
|
832
|
+
* ```ts
|
|
851
833
|
* // Get a texture attachment from a render target and set it on a model component
|
|
852
834
|
* export default defineScript({
|
|
853
835
|
* init() {
|
|
@@ -932,6 +914,7 @@ declare global {
|
|
|
932
914
|
*
|
|
933
915
|
* - `graphics.TEXTURE_TYPE_CUBE_MAP`
|
|
934
916
|
* @example
|
|
917
|
+
* Create a new texture and get the metadata from it
|
|
935
918
|
* ```ts
|
|
936
919
|
* // Create a new texture and get the metadata from it
|
|
937
920
|
* export default defineScript({
|
|
@@ -960,7 +943,10 @@ declare global {
|
|
|
960
943
|
* // }
|
|
961
944
|
* },
|
|
962
945
|
* });
|
|
963
|
-
*
|
|
946
|
+
* ```
|
|
947
|
+
* @example
|
|
948
|
+
* Get the meta data from an atlas resource
|
|
949
|
+
* ```ts
|
|
964
950
|
* // Get the meta data from an atlas resource
|
|
965
951
|
* export default defineScript({
|
|
966
952
|
* init() {
|
|
@@ -1004,6 +990,7 @@ declare global {
|
|
|
1004
990
|
* @param path - optional resource path string to the resource
|
|
1005
991
|
* @returns a path hash to the binary version of the resource
|
|
1006
992
|
* @example
|
|
993
|
+
* Load a material and set it to a sprite:
|
|
1007
994
|
* ```ts
|
|
1008
995
|
* // Load a material and set it to a sprite:
|
|
1009
996
|
* go.property("my_material", resource.material("/material.material"));
|
|
@@ -1013,7 +1000,10 @@ declare global {
|
|
|
1013
1000
|
* go.set("#sprite", "material", self.my_material);
|
|
1014
1001
|
* },
|
|
1015
1002
|
* });
|
|
1016
|
-
*
|
|
1003
|
+
* ```
|
|
1004
|
+
* @example
|
|
1005
|
+
* Load a material resource and update a named material with the resource:
|
|
1006
|
+
* ```ts
|
|
1017
1007
|
* // Load a material resource and update a named material with the resource:
|
|
1018
1008
|
* go.property("my_material", resource.material("/material.material"));
|
|
1019
1009
|
*
|
|
@@ -1087,81 +1077,52 @@ declare global {
|
|
|
1087
1077
|
* @param path - The path to the atlas resource
|
|
1088
1078
|
* @param table - A table containing info about the atlas. Supported entries:
|
|
1089
1079
|
*
|
|
1090
|
-
* -
|
|
1091
|
-
*
|
|
1092
|
-
* `texture`
|
|
1080
|
+
* - `texture`
|
|
1093
1081
|
* string | hash the path to the texture resource, e.g "/main/my_texture.texturec"
|
|
1094
1082
|
*
|
|
1095
|
-
* -
|
|
1096
|
-
*
|
|
1097
|
-
* `animations`
|
|
1083
|
+
* - `animations`
|
|
1098
1084
|
* table a list of the animations in the atlas. Supports the following fields:
|
|
1099
1085
|
*
|
|
1100
|
-
* -
|
|
1101
|
-
*
|
|
1102
|
-
* `id`
|
|
1086
|
+
* - `id`
|
|
1103
1087
|
* string the id of the animation, used in e.g sprite.play_animation
|
|
1104
1088
|
*
|
|
1105
|
-
* -
|
|
1106
|
-
*
|
|
1107
|
-
* `width`
|
|
1089
|
+
* - `width`
|
|
1108
1090
|
* number the width of the animation
|
|
1109
1091
|
*
|
|
1110
|
-
* -
|
|
1111
|
-
*
|
|
1112
|
-
* `height`
|
|
1092
|
+
* - `height`
|
|
1113
1093
|
* number the height of the animation
|
|
1114
1094
|
*
|
|
1115
|
-
* -
|
|
1116
|
-
*
|
|
1117
|
-
* `frame_start`
|
|
1095
|
+
* - `frame_start`
|
|
1118
1096
|
* number index to the first geometry of the animation. Indices are lua based and must be in the range of 1 .. in atlas.
|
|
1119
1097
|
*
|
|
1120
|
-
* -
|
|
1121
|
-
*
|
|
1122
|
-
* `frame_end`
|
|
1098
|
+
* - `frame_end`
|
|
1123
1099
|
* number index to the last geometry of the animation (non-inclusive). Indices are lua based and must be in the range of 1 .. in atlas.
|
|
1124
1100
|
*
|
|
1125
|
-
* -
|
|
1126
|
-
*
|
|
1127
|
-
* `playback`
|
|
1101
|
+
* - `playback`
|
|
1128
1102
|
* constant optional playback mode of the animation, the default value is go.PLAYBACK_ONCE_FORWARD
|
|
1129
1103
|
*
|
|
1130
|
-
* -
|
|
1131
|
-
*
|
|
1132
|
-
* `fps`
|
|
1104
|
+
* - `fps`
|
|
1133
1105
|
* number optional fps of the animation, the default value is 30
|
|
1134
1106
|
*
|
|
1135
|
-
* -
|
|
1136
|
-
*
|
|
1137
|
-
* `flip_vertical`
|
|
1107
|
+
* - `flip_vertical`
|
|
1138
1108
|
* boolean optional flip the animation vertically, the default value is false
|
|
1139
1109
|
*
|
|
1140
|
-
* -
|
|
1141
|
-
*
|
|
1142
|
-
* `flip_horizontal`
|
|
1110
|
+
* - `flip_horizontal`
|
|
1143
1111
|
* boolean optional flip the animation horizontally, the default value is false
|
|
1144
1112
|
*
|
|
1145
|
-
* -
|
|
1146
|
-
*
|
|
1147
|
-
* `geometries`
|
|
1113
|
+
* - `geometries`
|
|
1148
1114
|
* table A list of the geometries that should map to the texture data. Supports the following fields:
|
|
1149
1115
|
*
|
|
1150
|
-
* -
|
|
1151
|
-
*
|
|
1152
|
-
* `vertices`
|
|
1116
|
+
* - `vertices`
|
|
1153
1117
|
* table a list of the vertices in texture space of the geometry in the form {px0, py0, px1, py1, ..., pxn, pyn}
|
|
1154
1118
|
*
|
|
1155
|
-
* -
|
|
1156
|
-
*
|
|
1157
|
-
* `uvs`
|
|
1119
|
+
* - `uvs`
|
|
1158
1120
|
* table a list of the uv coordinates in texture space of the geometry in the form of {u0, v0, u1, v1, ..., un, vn}
|
|
1159
1121
|
*
|
|
1160
|
-
* -
|
|
1161
|
-
*
|
|
1162
|
-
* `indices`
|
|
1122
|
+
* - `indices`
|
|
1163
1123
|
* table a list of the indices of the geometry in the form {i0, i1, i2, ..., in}. Each tripe in the list represents a triangle.
|
|
1164
1124
|
* @example
|
|
1125
|
+
* Add a new animation to an existing atlas
|
|
1165
1126
|
* ```ts
|
|
1166
1127
|
* // Add a new animation to an existing atlas
|
|
1167
1128
|
* export default defineScript({
|
|
@@ -1180,7 +1141,10 @@ declare global {
|
|
|
1180
1141
|
* resource.set_atlas("/main/my_atlas.a.texturesetc", data);
|
|
1181
1142
|
* },
|
|
1182
1143
|
* });
|
|
1183
|
-
*
|
|
1144
|
+
* ```
|
|
1145
|
+
* @example
|
|
1146
|
+
* Sets atlas data for a 256x256 texture with a single animation being rendered as a quad
|
|
1147
|
+
* ```ts
|
|
1184
1148
|
* // Sets atlas data for a 256x256 texture with a single animation being rendered as a quad
|
|
1185
1149
|
* export default defineScript({
|
|
1186
1150
|
* init() {
|
|
@@ -1221,16 +1185,14 @@ declare global {
|
|
|
1221
1185
|
* @param buffer - The resource buffer
|
|
1222
1186
|
* @param table - A table containing info about how to set the buffer. Supported entries:
|
|
1223
1187
|
*
|
|
1224
|
-
* -
|
|
1225
|
-
*
|
|
1226
|
-
* `transfer_ownership`
|
|
1188
|
+
* - `transfer_ownership`
|
|
1227
1189
|
* boolean optional flag to determine whether or not the resource should take over ownership of the buffer object (default false)
|
|
1228
1190
|
* @example
|
|
1229
1191
|
* ```ts
|
|
1230
1192
|
* // How to set the data from a buffer
|
|
1231
|
-
* function fill_stream(stream, verts) {
|
|
1193
|
+
* function fill_stream(stream: { [index: number]: number }, verts: number[]) {
|
|
1232
1194
|
* verts.forEach((value, key) => {
|
|
1233
|
-
* stream[key] =
|
|
1195
|
+
* stream[key] = value;
|
|
1234
1196
|
* });
|
|
1235
1197
|
* }
|
|
1236
1198
|
*
|
|
@@ -1350,7 +1312,9 @@ declare global {
|
|
|
1350
1312
|
* if graphics.TEXTURE_TYPE_3D ~= nil then
|
|
1351
1313
|
* -- Device and graphics adapter support 3D textures
|
|
1352
1314
|
* end
|
|
1315
|
+
* ```
|
|
1353
1316
|
* @example
|
|
1317
|
+
* How to set all pixels of an atlas
|
|
1354
1318
|
* ```ts
|
|
1355
1319
|
* // How to set all pixels of an atlas
|
|
1356
1320
|
* export default defineScript({
|
|
@@ -1374,7 +1338,10 @@ declare global {
|
|
|
1374
1338
|
* resource.set_texture(resource_path, args, self.buffer);
|
|
1375
1339
|
* },
|
|
1376
1340
|
* });
|
|
1377
|
-
*
|
|
1341
|
+
* ```
|
|
1342
|
+
* @example
|
|
1343
|
+
* How to update a specific region of an atlas by using the x,y values. Assumes the already set atlas is a 128x128 texture.
|
|
1344
|
+
* ```ts
|
|
1378
1345
|
* // How to update a specific region of an atlas by using the x,y values. Assumes the already set atlas is a 128x128 texture.
|
|
1379
1346
|
* export default defineScript({
|
|
1380
1347
|
* init(self) {
|
|
@@ -1399,7 +1366,10 @@ declare global {
|
|
|
1399
1366
|
* resource.set_texture(resource_path, args, self.buffer);
|
|
1400
1367
|
* },
|
|
1401
1368
|
* });
|
|
1402
|
-
*
|
|
1369
|
+
* ```
|
|
1370
|
+
* @example
|
|
1371
|
+
* Update a texture from a buffer resource
|
|
1372
|
+
* ```ts
|
|
1403
1373
|
* // Update a texture from a buffer resource
|
|
1404
1374
|
* go.property("my_buffer", resource.buffer("/my_default_buffer.buffer"));
|
|
1405
1375
|
*
|
|
@@ -1419,7 +1389,10 @@ declare global {
|
|
|
1419
1389
|
* resource.set_texture(resource_path, args, resource.get_buffer(self.my_buffer));
|
|
1420
1390
|
* },
|
|
1421
1391
|
* });
|
|
1422
|
-
*
|
|
1392
|
+
* ```
|
|
1393
|
+
* @example
|
|
1394
|
+
* Update an existing 3D texture from a lua buffer
|
|
1395
|
+
* ```ts
|
|
1423
1396
|
* // Update an existing 3D texture from a buffer
|
|
1424
1397
|
* export default defineScript({
|
|
1425
1398
|
* init() {
|
|
@@ -1455,24 +1428,37 @@ declare global {
|
|
|
1455
1428
|
* resource.set_texture("/my_3d_texture.texturec", t_args, tbuffer);
|
|
1456
1429
|
* },
|
|
1457
1430
|
* });
|
|
1458
|
-
*
|
|
1431
|
+
* ```
|
|
1432
|
+
* @example
|
|
1433
|
+
* ```ts
|
|
1459
1434
|
* // Update texture 2nd array page with loaded texture from png
|
|
1460
|
-
* // new_tex is resource handle of texture which was created via resource.create_resource
|
|
1461
1435
|
* const tex_path = "/bundle_resources/page_02.png";
|
|
1462
1436
|
* const [data] = sys.load_resource(tex_path);
|
|
1463
|
-
*
|
|
1464
|
-
*
|
|
1465
|
-
*
|
|
1466
|
-
*
|
|
1467
|
-
*
|
|
1468
|
-
*
|
|
1469
|
-
*
|
|
1470
|
-
*
|
|
1471
|
-
*
|
|
1472
|
-
*
|
|
1473
|
-
*
|
|
1474
|
-
*
|
|
1475
|
-
*
|
|
1437
|
+
* if (data !== undefined) {
|
|
1438
|
+
* const buf = image.load_buffer(data);
|
|
1439
|
+
* if (buf !== undefined) {
|
|
1440
|
+
* // new_tex is the resource handle of a texture created via resource.create_texture
|
|
1441
|
+
* const new_tex = resource.create_texture("/my_array_texture.texturec", {
|
|
1442
|
+
* type: graphics.TEXTURE_TYPE_2D_ARRAY,
|
|
1443
|
+
* width: buf.width,
|
|
1444
|
+
* height: buf.height,
|
|
1445
|
+
* page_count: 2,
|
|
1446
|
+
* format: graphics.TEXTURE_FORMAT_RGB,
|
|
1447
|
+
* });
|
|
1448
|
+
* resource.set_texture(
|
|
1449
|
+
* new_tex,
|
|
1450
|
+
* {
|
|
1451
|
+
* type: graphics.TEXTURE_TYPE_2D_ARRAY,
|
|
1452
|
+
* width: buf.width,
|
|
1453
|
+
* height: buf.height,
|
|
1454
|
+
* page: 1,
|
|
1455
|
+
* format: graphics.TEXTURE_FORMAT_RGB,
|
|
1456
|
+
* },
|
|
1457
|
+
* buf.buffer,
|
|
1458
|
+
* );
|
|
1459
|
+
* go.set("#mesh", "texture0", new_tex);
|
|
1460
|
+
* }
|
|
1461
|
+
* }
|
|
1476
1462
|
* ```
|
|
1477
1463
|
*/
|
|
1478
1464
|
function set_texture(path: Hash | string, table: { type?: number; width?: number; height?: number; format?: number; x?: number; y?: number; z?: number; page?: number; mipmap?: number; compression_type?: number }, buffer: Opaque<"buffer">): void;
|
package/generated/socket.d.ts
CHANGED
|
@@ -635,14 +635,17 @@ declare global {
|
|
|
635
635
|
* @example
|
|
636
636
|
* ```ts
|
|
637
637
|
* // Perform operations on an open socket c:
|
|
638
|
-
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
* try_(c.
|
|
642
|
-
*
|
|
643
|
-
*
|
|
644
|
-
* try_(c.
|
|
645
|
-
*
|
|
638
|
+
* const [c] = socket.connect("localhost", 80);
|
|
639
|
+
* if (c !== undefined) {
|
|
640
|
+
* // create a try function that closes 'c' on error
|
|
641
|
+
* const try_ = socket.newtry(() => c.close());
|
|
642
|
+
* // do everything reassured c will be closed
|
|
643
|
+
* try_(c.send("hello there?\r\n"));
|
|
644
|
+
* const answer = try_(c.receive());
|
|
645
|
+
* // ...
|
|
646
|
+
* try_(c.send("good bye\r\n"));
|
|
647
|
+
* c.close();
|
|
648
|
+
* }
|
|
646
649
|
* ```
|
|
647
650
|
*/
|
|
648
651
|
function newtry(finalizer: () => void): (...args: unknown[]) => unknown;
|
|
@@ -694,6 +697,8 @@ declare global {
|
|
|
694
697
|
* @param retN - argument N.
|
|
695
698
|
* @example
|
|
696
699
|
* ```ts
|
|
700
|
+
* const line = "250 OK";
|
|
701
|
+
*
|
|
697
702
|
* // Instead of doing the following with dummy variables:
|
|
698
703
|
* // get the status code and separator from SMTP server reply
|
|
699
704
|
* const [dummy1, dummy2, code, sep] = string.find(line, "^(%d%d%d)(.?)");
|
package/generated/sound.d.ts
CHANGED
|
@@ -193,9 +193,10 @@ declare global {
|
|
|
193
193
|
* sound.play("#sound", { delay: 1, gain: 0.9, pan: -1.0 });
|
|
194
194
|
*
|
|
195
195
|
* // Using the callback argument, you can chain several sounds together:
|
|
196
|
-
* function sound_done(self, message_id, message, sender) {
|
|
196
|
+
* function sound_done(self: unknown, message_id: unknown, message: unknown, sender: unknown) {
|
|
197
197
|
* // play 'boom' sound fx when the countdown has completed
|
|
198
|
-
*
|
|
198
|
+
* const { play_id } = message as { play_id: number };
|
|
199
|
+
* if (message_id === hash("sound_done") && play_id === (self as { countdown_id: number }).countdown_id) {
|
|
199
200
|
* sound.play("#boom", undefined, sound_done);
|
|
200
201
|
* }
|
|
201
202
|
* }
|