@defold-typescript/types 0.5.1 → 0.5.3
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/generated/buffer.d.ts +3 -3
- package/generated/collectionfactory.d.ts +9 -9
- package/generated/collectionproxy.d.ts +1 -1
- package/generated/factory.d.ts +9 -9
- package/generated/go.d.ts +12 -12
- package/generated/gui.d.ts +147 -147
- package/generated/http.d.ts +21 -21
- package/generated/iac.d.ts +1 -1
- package/generated/iap.d.ts +4 -4
- package/generated/image.d.ts +30 -30
- package/generated/json.d.ts +2 -2
- 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/model.d.ts +23 -23
- package/generated/particlefx.d.ts +13 -13
- package/generated/physics.d.ts +87 -87
- package/generated/profiler.d.ts +11 -11
- package/generated/render.d.ts +67 -67
- package/generated/resource.d.ts +372 -372
- package/generated/sound.d.ts +23 -23
- package/generated/sprite.d.ts +14 -14
- package/generated/sys.d.ts +57 -57
- package/generated/timer.d.ts +12 -12
- package/generated/window.d.ts +28 -28
- package/index.d.ts +4 -0
- package/package.json +1 -1
- package/scripts/regen.ts +1 -0
- package/src/doc-comment.ts +10 -2
- package/src/index.ts +2 -0
- package/src/message-dispatch.d.ts +23 -0
- package/src/message-guard.d.ts +16 -0
package/generated/resource.d.ts
CHANGED
|
@@ -59,69 +59,69 @@ declare global {
|
|
|
59
59
|
*
|
|
60
60
|
* @param path - The path to the resource.
|
|
61
61
|
* @param table - A table containing info about how to create the atlas. Supported entries:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
62
|
+
* -
|
|
63
|
+
* `texture`
|
|
64
|
+
* string | hash the path to the texture resource, e.g "/main/my_texture.texturec"
|
|
65
|
+
* -
|
|
66
|
+
* `animations`
|
|
67
|
+
* table a list of the animations in the atlas. Supports the following fields:
|
|
68
|
+
* -
|
|
69
|
+
* `id`
|
|
70
|
+
* string the id of the animation, used in e.g sprite.play_animation
|
|
71
|
+
* -
|
|
72
|
+
* `width`
|
|
73
|
+
* number the width of the animation
|
|
74
|
+
* -
|
|
75
|
+
* `height`
|
|
76
|
+
* number the height of the animation
|
|
77
|
+
* -
|
|
78
|
+
* `frame_start`
|
|
79
|
+
* number index to the first geometry of the animation. Indices are lua based and must be in the range of 1 .. in atlas.
|
|
80
|
+
* -
|
|
81
|
+
* `frame_end`
|
|
82
|
+
* 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.
|
|
83
|
+
* -
|
|
84
|
+
* `playback`
|
|
85
|
+
* constant optional playback mode of the animation, the default value is go.PLAYBACK_ONCE_FORWARD
|
|
86
|
+
* -
|
|
87
|
+
* `fps`
|
|
88
|
+
* number optional fps of the animation, the default value is 30
|
|
89
|
+
* -
|
|
90
|
+
* `flip_vertical`
|
|
91
|
+
* boolean optional flip the animation vertically, the default value is false
|
|
92
|
+
* -
|
|
93
|
+
* `flip_horizontal`
|
|
94
|
+
* boolean optional flip the animation horizontally, the default value is false
|
|
95
|
+
* -
|
|
96
|
+
* `geometries`
|
|
97
|
+
* table A list of the geometries that should map to the texture data. Supports the following fields:
|
|
98
|
+
* -
|
|
99
|
+
* `id`
|
|
100
|
+
* string The name of the geometry. Used when matching animations between multiple atlases
|
|
101
|
+
* -
|
|
102
|
+
* `width`
|
|
103
|
+
* number The width of the image the sprite geometry represents
|
|
104
|
+
* -
|
|
105
|
+
* `height`
|
|
106
|
+
* number The height of the image the sprite geometry represents
|
|
107
|
+
* -
|
|
108
|
+
* `pivot_x`
|
|
109
|
+
* 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.
|
|
110
|
+
* -
|
|
111
|
+
* `pivot_y`
|
|
112
|
+
* 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.
|
|
113
|
+
* -
|
|
114
|
+
* `rotated`
|
|
115
|
+
* boolean Whether the image is rotated 90 degrees counter-clockwise in the atlas. This affects UV coordinate generation for proper rendering. Default is false.
|
|
116
|
+
* -
|
|
117
|
+
* `vertices`
|
|
118
|
+
* table a list of the vertices in image space of the geometry in the form {px0, py0, px1, py1, ..., pxn, pyn}
|
|
119
|
+
* -
|
|
120
|
+
* `uvs`
|
|
121
|
+
* table a list of the uv coordinates in image space of the geometry in the form of {u0, v0, u1, v1, ..., un, vn}.
|
|
122
|
+
* -
|
|
123
|
+
* `indices`
|
|
124
|
+
* table a list of the indices of the geometry in the form {i0, i1, i2, ..., in}. Each tripe in the list represents a triangle.
|
|
125
125
|
* @returns Returns the atlas resource path
|
|
126
126
|
* @example
|
|
127
127
|
* ```lua
|
|
@@ -194,12 +194,12 @@ declare global {
|
|
|
194
194
|
*
|
|
195
195
|
* @param path - The path to the resource.
|
|
196
196
|
* @param table - A table containing info about how to create the buffer. Supported entries:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
* -
|
|
198
|
+
* `buffer`
|
|
199
|
+
* buffer the buffer to bind to this resource
|
|
200
|
+
* -
|
|
201
|
+
* `transfer_ownership`
|
|
202
|
+
* boolean optional flag to determine wether or not the resource should take over ownership of the buffer object (default true)
|
|
203
203
|
* @returns Returns the buffer resource path
|
|
204
204
|
* @example
|
|
205
205
|
* ```lua
|
|
@@ -254,12 +254,12 @@ declare global {
|
|
|
254
254
|
*
|
|
255
255
|
* @param path - the path to the resource. Must not already exist.
|
|
256
256
|
* @param options - A table containing parameters for the text. Supported entries:
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
257
|
+
* `data`
|
|
258
|
+
* string The raw data of the file. May be partial, but must include the header of the file
|
|
259
|
+
* `filesize`
|
|
260
|
+
* number If the file is partial, it must also specify the full size of the complete file.
|
|
261
|
+
* `partial`
|
|
262
|
+
* boolean Is the data not representing the full file, but just the initial chunk?
|
|
263
263
|
* @returns the resulting path hash to the resource
|
|
264
264
|
* @example
|
|
265
265
|
* ```lua
|
|
@@ -283,70 +283,70 @@ declare global {
|
|
|
283
283
|
*
|
|
284
284
|
* @param path - The path to the resource.
|
|
285
285
|
* @param table - A table containing info about how to create the texture. Supported entries:
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
286
|
+
* `type`
|
|
287
|
+
* number The texture type. Supported values:
|
|
288
|
+
* - `graphics.TEXTURE_TYPE_2D`
|
|
289
|
+
* - `graphics.TEXTURE_TYPE_IMAGE_2D`
|
|
290
|
+
* - `graphics.TEXTURE_TYPE_3D`
|
|
291
|
+
* - `graphics.TEXTURE_TYPE_IMAGE_3D`
|
|
292
|
+
* - `graphics.TEXTURE_TYPE_CUBE_MAP`
|
|
293
|
+
* `width`
|
|
294
|
+
* number The width of the texture (in pixels). Must be larger than 0.
|
|
295
|
+
* `height`
|
|
296
|
+
* number The width of the texture (in pixels). Must be larger than 0.
|
|
297
|
+
* `depth`
|
|
298
|
+
* number The depth of the texture (in pixels). Must be larger than 0. Only used when `type` is `graphics.TEXTURE_TYPE_3D` or `graphics.TEXTURE_TYPE_IMAGE_3D`.
|
|
299
|
+
* `format`
|
|
300
|
+
* number The texture format, note that some of these formats might not be supported by the running device. Supported values:
|
|
301
|
+
* - `graphics.TEXTURE_FORMAT_LUMINANCE`
|
|
302
|
+
* - `graphics.TEXTURE_FORMAT_RGB`
|
|
303
|
+
* - `graphics.TEXTURE_FORMAT_RGBA`
|
|
304
|
+
* These constants might not be available on the device:
|
|
305
|
+
* - `graphics.TEXTURE_FORMAT_RGB_PVRTC_2BPPV1`
|
|
306
|
+
* - `graphics.TEXTURE_FORMAT_RGB_PVRTC_4BPPV1`
|
|
307
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_PVRTC_2BPPV1`
|
|
308
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_PVRTC_4BPPV1`
|
|
309
|
+
* - `graphics.TEXTURE_FORMAT_RGB_ETC1`
|
|
310
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_ETC2`
|
|
311
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_ASTC_4X4`
|
|
312
|
+
* - `graphics.TEXTURE_FORMAT_RGB_BC1`
|
|
313
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_BC3`
|
|
314
|
+
* - `graphics.TEXTURE_FORMAT_R_BC4`
|
|
315
|
+
* - `graphics.TEXTURE_FORMAT_RG_BC5`
|
|
316
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_BC7`
|
|
317
|
+
* - `graphics.TEXTURE_FORMAT_RGB16F`
|
|
318
|
+
* - `graphics.TEXTURE_FORMAT_RGB32F`
|
|
319
|
+
* - `graphics.TEXTURE_FORMAT_RGBA16F`
|
|
320
|
+
* - `graphics.TEXTURE_FORMAT_RGBA32F`
|
|
321
|
+
* - `graphics.TEXTURE_FORMAT_R16F`
|
|
322
|
+
* - `graphics.TEXTURE_FORMAT_RG16F`
|
|
323
|
+
* - `graphics.TEXTURE_FORMAT_R32F`
|
|
324
|
+
* - `graphics.TEXTURE_FORMAT_RG32F`
|
|
325
|
+
* You can test if the device supports these values by checking if a specific enum is nil or not:
|
|
326
|
+
* `if graphics.TEXTURE_FORMAT_RGBA16F ~= nil then
|
|
327
|
+
* -- it is safe to use this format
|
|
328
|
+
* end
|
|
329
|
+
* `
|
|
330
|
+
* `flags`
|
|
331
|
+
* number Texture creation flags that can be used to dictate how the texture is created. The default value is graphics.TEXTURE_USAGE_FLAG_SAMPLE, which means that the texture can be sampled from a shader.
|
|
332
|
+
* These flags may or may not be supported on the running device and/or the underlying graphics API and is simply used internally as a 'hint' when creating the texture. There is no guarantee that any of these will have any effect. Supported values:
|
|
333
|
+
* - `graphics.TEXTURE_USAGE_FLAG_SAMPLE` - The texture can be sampled from a shader (default)
|
|
334
|
+
* - `graphics.TEXTURE_USAGE_FLAG_MEMORYLESS` - The texture can be used as a memoryless texture, i.e only transient memory for the texture is used during rendering
|
|
335
|
+
* - `graphics.TEXTURE_USAGE_FLAG_STORAGE` - The texture can be used as a storage texture, which is required for a shader to write to the texture
|
|
336
|
+
* `max_mipmaps`
|
|
337
|
+
* number optional max number of mipmaps. Defaults to zero, i.e no mipmap support
|
|
338
|
+
* `compression_type`
|
|
339
|
+
* number optional specify the compression type for the data in the buffer object that holds the texture data. Will only be used when a compressed buffer has been passed into the function.
|
|
340
|
+
* Creating an empty texture with no buffer data is not supported as a core feature. Defaults to graphics.COMPRESSION_TYPE_DEFAULT, i.e no compression. Supported values:
|
|
341
|
+
* - `COMPRESSION_TYPE_DEFAULT`
|
|
342
|
+
* - `COMPRESSION_TYPE_BASIS_UASTC`
|
|
343
343
|
* @param buffer - optional buffer of precreated pixel data
|
|
344
344
|
* @returns The path to the resource.
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
345
|
+
* 3D Textures are currently only supported on OpenGL and Vulkan adapters. To check if your device supports 3D textures, use:
|
|
346
|
+
* ```lua
|
|
347
|
+
* if graphics.TEXTURE_TYPE_3D ~= nil then
|
|
348
|
+
* -- Device and graphics adapter support 3D textures
|
|
349
|
+
* end
|
|
350
350
|
* @example
|
|
351
351
|
* ```lua
|
|
352
352
|
* How to create an 128x128 RGBA texture resource and assign it to a model
|
|
@@ -436,62 +436,62 @@ declare global {
|
|
|
436
436
|
*
|
|
437
437
|
* @param path - The path to the resource.
|
|
438
438
|
* @param table - A table containing info about how to create the texture. Supported entries:
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
439
|
+
* `type`
|
|
440
|
+
* number The texture type. Supported values:
|
|
441
|
+
* - `graphics.TEXTURE_TYPE_2D`
|
|
442
|
+
* - `graphics.TEXTURE_TYPE_IMAGE_2D`
|
|
443
|
+
* - `graphics.TEXTURE_TYPE_3D`
|
|
444
|
+
* - `graphics.TEXTURE_TYPE_IMAGE_3D`
|
|
445
|
+
* - `graphics.TEXTURE_TYPE_CUBE_MAP`
|
|
446
|
+
* `width`
|
|
447
|
+
* number The width of the texture (in pixels). Must be larger than 0.
|
|
448
|
+
* `height`
|
|
449
|
+
* number The width of the texture (in pixels). Must be larger than 0.
|
|
450
|
+
* `depth`
|
|
451
|
+
* number The depth of the texture (in pixels). Must be larger than 0. Only used when `type` is `graphics.TEXTURE_TYPE_3D` or `graphics.TEXTURE_TYPE_IMAGE_3D`.
|
|
452
|
+
* `format`
|
|
453
|
+
* number The texture format, note that some of these formats might not be supported by the running device. Supported values:
|
|
454
|
+
* - `graphics.TEXTURE_FORMAT_LUMINANCE`
|
|
455
|
+
* - `graphics.TEXTURE_FORMAT_RGB`
|
|
456
|
+
* - `graphics.TEXTURE_FORMAT_RGBA`
|
|
457
|
+
* These constants might not be available on the device:
|
|
458
|
+
* - `graphics.TEXTURE_FORMAT_RGB_PVRTC_2BPPV1`
|
|
459
|
+
* - `graphics.TEXTURE_FORMAT_RGB_PVRTC_4BPPV1`
|
|
460
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_PVRTC_2BPPV1`
|
|
461
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_PVRTC_4BPPV1`
|
|
462
|
+
* - `graphics.TEXTURE_FORMAT_RGB_ETC1`
|
|
463
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_ETC2`
|
|
464
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_ASTC_4X4`
|
|
465
|
+
* - `graphics.TEXTURE_FORMAT_RGB_BC1`
|
|
466
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_BC3`
|
|
467
|
+
* - `graphics.TEXTURE_FORMAT_R_BC4`
|
|
468
|
+
* - `graphics.TEXTURE_FORMAT_RG_BC5`
|
|
469
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_BC7`
|
|
470
|
+
* - `graphics.TEXTURE_FORMAT_RGB16F`
|
|
471
|
+
* - `graphics.TEXTURE_FORMAT_RGB32F`
|
|
472
|
+
* - `graphics.TEXTURE_FORMAT_RGBA16F`
|
|
473
|
+
* - `graphics.TEXTURE_FORMAT_RGBA32F`
|
|
474
|
+
* - `graphics.TEXTURE_FORMAT_R16F`
|
|
475
|
+
* - `graphics.TEXTURE_FORMAT_RG16F`
|
|
476
|
+
* - `graphics.TEXTURE_FORMAT_R32F`
|
|
477
|
+
* - `graphics.TEXTURE_FORMAT_RG32F`
|
|
478
|
+
* You can test if the device supports these values by checking if a specific enum is nil or not:
|
|
479
|
+
* `if graphics.TEXTURE_FORMAT_RGBA16F ~= nil then
|
|
480
|
+
* -- it is safe to use this format
|
|
481
|
+
* end
|
|
482
|
+
* `
|
|
483
|
+
* `flags`
|
|
484
|
+
* number Texture creation flags that can be used to dictate how the texture is created. Supported values:
|
|
485
|
+
* - `graphics.TEXTURE_USAGE_FLAG_SAMPLE` - The texture can be sampled from a shader (default)
|
|
486
|
+
* - `graphics.TEXTURE_USAGE_FLAG_MEMORYLESS` - The texture can be used as a memoryless texture, i.e only transient memory for the texture is used during rendering
|
|
487
|
+
* - `graphics.TEXTURE_USAGE_FLAG_STORAGE` - The texture can be used as a storage texture, which is required for a shader to write to the texture
|
|
488
|
+
* `max_mipmaps`
|
|
489
|
+
* number optional max number of mipmaps. Defaults to zero, i.e no mipmap support
|
|
490
|
+
* `compression_type`
|
|
491
|
+
* number optional specify the compression type for the data in the buffer object that holds the texture data. Will only be used when a compressed buffer has been passed into the function.
|
|
492
|
+
* Creating an empty texture with no buffer data is not supported as a core feature. Defaults to graphics.COMPRESSION_TYPE_DEFAULT, i.e no compression. Supported values:
|
|
493
|
+
* - `COMPRESSION_TYPE_DEFAULT`
|
|
494
|
+
* - `COMPRESSION_TYPE_BASIS_UASTC`
|
|
495
495
|
* @param buffer - optional buffer of precreated pixel data
|
|
496
496
|
* @param callback - callback function when texture is created (self, request_id, resource)
|
|
497
497
|
* @example
|
|
@@ -597,12 +597,12 @@ declare global {
|
|
|
597
597
|
*
|
|
598
598
|
* @param path - The path to the atlas resource
|
|
599
599
|
* @returns A table with the following entries:
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
600
|
+
* - texture
|
|
601
|
+
* - geometries
|
|
602
|
+
* - animations
|
|
603
|
+
* Each animation entry also contains a `frames` table with indices into
|
|
604
|
+
* `geometries`, preserving the frame-to-geometry mapping used by the atlas.
|
|
605
|
+
* See resource.set_atlas for a detailed description of each field
|
|
606
606
|
*/
|
|
607
607
|
function get_atlas(path: Hash | string): { texture: string | Hash; animations: { id: string; width: number; height: number; frame_start: number; frame_end: number; playback: Opaque<"constant">; fps: number; flip_vertical: boolean; flip_horizontal: boolean }[]; geometries: Record<string | number, unknown> };
|
|
608
608
|
/**
|
|
@@ -631,35 +631,35 @@ declare global {
|
|
|
631
631
|
*
|
|
632
632
|
* @param path - The path to the resource or a render target handle
|
|
633
633
|
* @returns A table containing info about the render target:
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
634
|
+
* `handle`
|
|
635
|
+
* number the opaque handle to the texture resource
|
|
636
|
+
* 'attachments'
|
|
637
|
+
* table a table of attachments, where each attachment contains the following entries:
|
|
638
|
+
* `width`
|
|
639
|
+
* number width of the texture
|
|
640
|
+
* `height`
|
|
641
|
+
* number height of the texture
|
|
642
|
+
* `depth`
|
|
643
|
+
* number depth of the texture (i.e 1 for a 2D texture and 6 for a cube map)
|
|
644
|
+
* `mipmaps`
|
|
645
|
+
* number number of mipmaps of the texture
|
|
646
|
+
* `type`
|
|
647
|
+
* number The texture type. Supported values:
|
|
648
|
+
* - `graphics.TEXTURE_TYPE_2D`
|
|
649
|
+
* - `graphics.TEXTURE_TYPE_CUBE_MAP`
|
|
650
|
+
* - `graphics.TEXTURE_TYPE_2D_ARRAY`
|
|
651
|
+
* `buffer_type`
|
|
652
|
+
* number The attachment buffer type. Supported values:
|
|
653
|
+
* - `resource.BUFFER_TYPE_COLOR0`
|
|
654
|
+
* - `resource.BUFFER_TYPE_COLOR1`
|
|
655
|
+
* - `resource.BUFFER_TYPE_COLOR2`
|
|
656
|
+
* - `resource.BUFFER_TYPE_COLOR3`
|
|
657
|
+
* - `resource.BUFFER_TYPE_DEPTH`
|
|
658
|
+
* -
|
|
659
|
+
* `resource.BUFFER_TYPE_STENCIL`
|
|
660
|
+
* -
|
|
661
|
+
* `texture`
|
|
662
|
+
* hash The hashed path to the attachment texture resource. This field is only available if the render target passed in is a resource.
|
|
663
663
|
* @example
|
|
664
664
|
* ```lua
|
|
665
665
|
* Get the metadata from a render target resource
|
|
@@ -689,19 +689,19 @@ declare global {
|
|
|
689
689
|
* @param url - the font to get the (unscaled) metrics from
|
|
690
690
|
* @param text - text to measure
|
|
691
691
|
* @param options - A table containing parameters for the text. Supported entries:
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
692
|
+
* `width`
|
|
693
|
+
* number The width of the text field. Not used if `line_break` is false.
|
|
694
|
+
* `leading`
|
|
695
|
+
* number The leading (default 1.0)
|
|
696
|
+
* `tracking`
|
|
697
|
+
* number The tracking (default 0.0)
|
|
698
|
+
* `line_break`
|
|
699
|
+
* boolean If the calculation should consider line breaks (default false)
|
|
700
700
|
* @returns a table with the following fields:
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
701
|
+
* - width
|
|
702
|
+
* - height
|
|
703
|
+
* - max_ascent
|
|
704
|
+
* - max_descent
|
|
705
705
|
* @example
|
|
706
706
|
* ```lua
|
|
707
707
|
* function init(self)
|
|
@@ -717,28 +717,28 @@ declare global {
|
|
|
717
717
|
*
|
|
718
718
|
* @param path - The path to the resource or a texture handle
|
|
719
719
|
* @returns A table containing info about the texture:
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
720
|
+
* `handle`
|
|
721
|
+
* number the opaque handle to the texture resource
|
|
722
|
+
* `width`
|
|
723
|
+
* number width of the texture
|
|
724
|
+
* `height`
|
|
725
|
+
* number height of the texture
|
|
726
|
+
* `depth`
|
|
727
|
+
* number depth of the texture (i.e 1 for a 2D texture, 6 for a cube map, the actual depth of a 3D texture)
|
|
728
|
+
* `page_count`
|
|
729
|
+
* number number of pages of the texture array. For 2D texture value is 1. For cube map - 6
|
|
730
|
+
* `mipmaps`
|
|
731
|
+
* number number of mipmaps of the texture
|
|
732
|
+
* `flags`
|
|
733
|
+
* number usage hints of the texture.
|
|
734
|
+
* `type`
|
|
735
|
+
* number The texture type. Supported values:
|
|
736
|
+
* - `graphics.TEXTURE_TYPE_2D`
|
|
737
|
+
* - `graphics.TEXTURE_TYPE_2D_ARRAY`
|
|
738
|
+
* - `graphics.TEXTURE_TYPE_IMAGE_2D`
|
|
739
|
+
* - `graphics.TEXTURE_TYPE_3D`
|
|
740
|
+
* - `graphics.TEXTURE_TYPE_IMAGE_3D`
|
|
741
|
+
* - `graphics.TEXTURE_TYPE_CUBE_MAP`
|
|
742
742
|
* @example
|
|
743
743
|
* ```lua
|
|
744
744
|
* Create a new texture and get the metadata from it
|
|
@@ -876,51 +876,51 @@ declare global {
|
|
|
876
876
|
*
|
|
877
877
|
* @param path - The path to the atlas resource
|
|
878
878
|
* @param table - A table containing info about the atlas. Supported entries:
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
879
|
+
* -
|
|
880
|
+
* `texture`
|
|
881
|
+
* string | hash the path to the texture resource, e.g "/main/my_texture.texturec"
|
|
882
|
+
* -
|
|
883
|
+
* `animations`
|
|
884
|
+
* table a list of the animations in the atlas. Supports the following fields:
|
|
885
|
+
* -
|
|
886
|
+
* `id`
|
|
887
|
+
* string the id of the animation, used in e.g sprite.play_animation
|
|
888
|
+
* -
|
|
889
|
+
* `width`
|
|
890
|
+
* number the width of the animation
|
|
891
|
+
* -
|
|
892
|
+
* `height`
|
|
893
|
+
* number the height of the animation
|
|
894
|
+
* -
|
|
895
|
+
* `frame_start`
|
|
896
|
+
* number index to the first geometry of the animation. Indices are lua based and must be in the range of 1 .. in atlas.
|
|
897
|
+
* -
|
|
898
|
+
* `frame_end`
|
|
899
|
+
* 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.
|
|
900
|
+
* -
|
|
901
|
+
* `playback`
|
|
902
|
+
* constant optional playback mode of the animation, the default value is go.PLAYBACK_ONCE_FORWARD
|
|
903
|
+
* -
|
|
904
|
+
* `fps`
|
|
905
|
+
* number optional fps of the animation, the default value is 30
|
|
906
|
+
* -
|
|
907
|
+
* `flip_vertical`
|
|
908
|
+
* boolean optional flip the animation vertically, the default value is false
|
|
909
|
+
* -
|
|
910
|
+
* `flip_horizontal`
|
|
911
|
+
* boolean optional flip the animation horizontally, the default value is false
|
|
912
|
+
* -
|
|
913
|
+
* `geometries`
|
|
914
|
+
* table A list of the geometries that should map to the texture data. Supports the following fields:
|
|
915
|
+
* -
|
|
916
|
+
* `vertices`
|
|
917
|
+
* table a list of the vertices in texture space of the geometry in the form {px0, py0, px1, py1, ..., pxn, pyn}
|
|
918
|
+
* -
|
|
919
|
+
* `uvs`
|
|
920
|
+
* table a list of the uv coordinates in texture space of the geometry in the form of {u0, v0, u1, v1, ..., un, vn}
|
|
921
|
+
* -
|
|
922
|
+
* `indices`
|
|
923
|
+
* table a list of the indices of the geometry in the form {i0, i1, i2, ..., in}. Each tripe in the list represents a triangle.
|
|
924
924
|
* @example
|
|
925
925
|
* ```lua
|
|
926
926
|
* Add a new animation to an existing atlas
|
|
@@ -987,9 +987,9 @@ declare global {
|
|
|
987
987
|
* @param path - The path to the resource
|
|
988
988
|
* @param buffer - The resource buffer
|
|
989
989
|
* @param table - A table containing info about how to set the buffer. Supported entries:
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
990
|
+
* -
|
|
991
|
+
* `transfer_ownership`
|
|
992
|
+
* boolean optional flag to determine wether or not the resource should take over ownership of the buffer object (default false)
|
|
993
993
|
* @example
|
|
994
994
|
* ```lua
|
|
995
995
|
* How to set the data from a buffer
|
|
@@ -1038,69 +1038,69 @@ declare global {
|
|
|
1038
1038
|
*
|
|
1039
1039
|
* @param path - The path to the resource
|
|
1040
1040
|
* @param table - A table containing info about the texture. Supported entries:
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1041
|
+
* `type`
|
|
1042
|
+
* number The texture type. Supported values:
|
|
1043
|
+
* - `graphics.TEXTURE_TYPE_2D`
|
|
1044
|
+
* - `graphics.TEXTURE_TYPE_IMAGE_2D`
|
|
1045
|
+
* - `graphics.TEXTURE_TYPE_3D`
|
|
1046
|
+
* - `graphics.TEXTURE_TYPE_IMAGE_3D`
|
|
1047
|
+
* - `graphics.TEXTURE_TYPE_CUBE_MAP`
|
|
1048
|
+
* `width`
|
|
1049
|
+
* number The width of the texture (in pixels)
|
|
1050
|
+
* `height`
|
|
1051
|
+
* number The width of the texture (in pixels)
|
|
1052
|
+
* `format`
|
|
1053
|
+
* number The texture format, note that some of these formats are platform specific. Supported values:
|
|
1054
|
+
* - `graphics.TEXTURE_FORMAT_LUMINANCE`
|
|
1055
|
+
* - `graphics.TEXTURE_FORMAT_RGB`
|
|
1056
|
+
* - `graphics.TEXTURE_FORMAT_RGBA`
|
|
1057
|
+
* These constants might not be available on the device:
|
|
1058
|
+
* - `graphics.TEXTURE_FORMAT_RGB_PVRTC_2BPPV1`
|
|
1059
|
+
* - `graphics.TEXTURE_FORMAT_RGB_PVRTC_4BPPV1`
|
|
1060
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_PVRTC_2BPPV1`
|
|
1061
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_PVRTC_4BPPV1`
|
|
1062
|
+
* - `graphics.TEXTURE_FORMAT_RGB_ETC1`
|
|
1063
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_ETC2`
|
|
1064
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_ASTC_4X4`
|
|
1065
|
+
* - `graphics.TEXTURE_FORMAT_RGB_BC1`
|
|
1066
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_BC3`
|
|
1067
|
+
* - `graphics.TEXTURE_FORMAT_R_BC4`
|
|
1068
|
+
* - `graphics.TEXTURE_FORMAT_RG_BC5`
|
|
1069
|
+
* - `graphics.TEXTURE_FORMAT_RGBA_BC7`
|
|
1070
|
+
* - `graphics.TEXTURE_FORMAT_RGB16F`
|
|
1071
|
+
* - `graphics.TEXTURE_FORMAT_RGB32F`
|
|
1072
|
+
* - `graphics.TEXTURE_FORMAT_RGBA16F`
|
|
1073
|
+
* - `graphics.TEXTURE_FORMAT_RGBA32F`
|
|
1074
|
+
* - `graphics.TEXTURE_FORMAT_R16F`
|
|
1075
|
+
* - `graphics.TEXTURE_FORMAT_RG16F`
|
|
1076
|
+
* - `graphics.TEXTURE_FORMAT_R32F`
|
|
1077
|
+
* - `graphics.TEXTURE_FORMAT_RG32F`
|
|
1078
|
+
* You can test if the device supports these values by checking if a specific enum is nil or not:
|
|
1079
|
+
* `if graphics.TEXTURE_FORMAT_RGBA16F ~= nil then
|
|
1080
|
+
* -- it is safe to use this format
|
|
1081
|
+
* end
|
|
1082
|
+
* `
|
|
1083
|
+
* `x`
|
|
1084
|
+
* number optional x offset of the texture (in pixels)
|
|
1085
|
+
* `y`
|
|
1086
|
+
* number optional y offset of the texture (in pixels)
|
|
1087
|
+
* `z`
|
|
1088
|
+
* number optional z offset of the texture (in pixels). Only applies to 3D textures
|
|
1089
|
+
* `page`
|
|
1090
|
+
* number optional slice of the array texture. Only applies to 2D texture arrays. Zero-based
|
|
1091
|
+
* `mipmap`
|
|
1092
|
+
* number optional mipmap to upload the data to
|
|
1093
|
+
* `compression_type`
|
|
1094
|
+
* number optional specify the compression type for the data in the buffer object that holds the texture data. Defaults to graphics.COMPRESSION_TYPE_DEFAULT, i.e no compression. Supported values:
|
|
1095
|
+
* - `COMPRESSION_TYPE_DEFAULT`
|
|
1096
|
+
* - `COMPRESSION_TYPE_BASIS_UASTC`
|
|
1097
1097
|
* @param buffer - The buffer of precreated pixel data
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1098
|
+
* To update a cube map texture you need to pass in six times the amount of data via the buffer, since a cube map has six sides!
|
|
1099
|
+
* 3D Textures are currently only supported on OpenGL and Vulkan adapters. To check if your device supports 3D textures, use:
|
|
1100
|
+
* ```lua
|
|
1101
|
+
* if graphics.TEXTURE_TYPE_3D ~= nil then
|
|
1102
|
+
* -- Device and graphics adapter support 3D textures
|
|
1103
|
+
* end
|
|
1104
1104
|
* @example
|
|
1105
1105
|
* ```lua
|
|
1106
1106
|
* How to set all pixels of an atlas
|