@ts-defold/types 1.2.19 → 1.2.21
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/index.d.ts +694 -130
- package/package.json +5 -5
package/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/** @noSelfInFile */
|
|
2
2
|
/// <reference types="lua-types/5.1" />
|
|
3
|
-
/// <reference types="typescript-to-lua/language-extensions" />
|
|
3
|
+
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
4
4
|
|
|
5
|
-
// DEFOLD. stable version 1.
|
|
5
|
+
// DEFOLD. stable version 1.4.7 (7a608d3ce6ed895d484956c1e76110ed8b78422a)
|
|
6
6
|
// =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
|
|
7
7
|
|
|
8
8
|
|
|
@@ -323,10 +323,10 @@ declare namespace crash {
|
|
|
323
323
|
/**
|
|
324
324
|
* reads a system field from a loaded crash dump
|
|
325
325
|
* @param handle crash dump handle
|
|
326
|
-
* @param index
|
|
326
|
+
* @param index system field enum. Must be less than crash.SYSFIELD_MAX
|
|
327
327
|
* @return value value recorded in the crash dump, or nil if it didn't exist
|
|
328
328
|
*/
|
|
329
|
-
export function get_sys_field(handle: number, index:
|
|
329
|
+
export function get_sys_field(handle: number, index: number): string
|
|
330
330
|
|
|
331
331
|
/**
|
|
332
332
|
* reads user field from a loaded crash dump
|
|
@@ -740,11 +740,18 @@ The id of the animated property.
|
|
|
740
740
|
function delete$(id?: any, recursive?: boolean): void
|
|
741
741
|
export { delete$ as delete }
|
|
742
742
|
|
|
743
|
+
/**
|
|
744
|
+
* check if the specified game object exists
|
|
745
|
+
* @param url url of the game object to check
|
|
746
|
+
* @return exists true if the game object exists
|
|
747
|
+
*/
|
|
748
|
+
export function exists(url: string | hash | url): any
|
|
749
|
+
|
|
743
750
|
/**
|
|
744
751
|
* gets a named property of the specified game object or component
|
|
745
752
|
* @param url url of the game object or component having the property
|
|
746
753
|
* @param property id of the property to retrieve
|
|
747
|
-
* @param options
|
|
754
|
+
* @param options optional options table
|
|
748
755
|
index into array property (1 based)
|
|
749
756
|
name of internal property
|
|
750
757
|
* @return value the value of the specified property
|
|
@@ -853,7 +860,7 @@ name of internal property
|
|
|
853
860
|
* @param url url of the game object or component having the property
|
|
854
861
|
* @param property id of the property to set
|
|
855
862
|
* @param value the value to set
|
|
856
|
-
* @param options
|
|
863
|
+
* @param options optional options table
|
|
857
864
|
index into array property (1 based)
|
|
858
865
|
name of internal property
|
|
859
866
|
*/
|
|
@@ -1460,7 +1467,7 @@ with a custom curve. See the animation guide for more information.
|
|
|
1460
1467
|
- `gui.PLAYBACK_LOOP_PINGPONG`
|
|
1461
1468
|
|
|
1462
1469
|
*/
|
|
1463
|
-
export function animate(node: node, property: any, to: vmath.vector3 | vmath.vector4, easing: any, duration: number, delay?: number, complete_function?: any, playback?: any): void
|
|
1470
|
+
export function animate(node: node, property: any, to: number | vmath.vector3 | vmath.vector4 | vmath.quaternion, easing: any, duration: number, delay?: number, complete_function?: any, playback?: any): void
|
|
1464
1471
|
|
|
1465
1472
|
/**
|
|
1466
1473
|
* If an animation of the specified node is currently running (started by `gui.animate`), it will immediately be canceled.
|
|
@@ -2729,9 +2736,9 @@ Set to `true` to return all ray cast hits. If `false`, it will only return the c
|
|
|
2729
2736
|
* @param from the world position of the start of the ray
|
|
2730
2737
|
* @param to the world position of the end of the ray
|
|
2731
2738
|
* @param groups a lua table containing the hashed groups for which to test collisions against
|
|
2732
|
-
* @param request_id . It will be sent back in the response for identification, 0 by default
|
|
2739
|
+
* @param request_id a number between [0,-255]. It will be sent back in the response for identification, 0 by default
|
|
2733
2740
|
*/
|
|
2734
|
-
export function raycast_async(from: vmath.vector3, to: vmath.vector3, groups: any, request_id?:
|
|
2741
|
+
export function raycast_async(from: vmath.vector3, to: vmath.vector3, groups: any, request_id?: number): void
|
|
2735
2742
|
|
|
2736
2743
|
/**
|
|
2737
2744
|
* Set the gravity in runtime. The gravity change is not global, it will only affect
|
|
@@ -3446,15 +3453,15 @@ A frustum matrix used to cull renderable items. (E.g. `local frustum = proj * vi
|
|
|
3446
3453
|
* used as texture with the specified unit.
|
|
3447
3454
|
* A material shader can then use the texture to sample from.
|
|
3448
3455
|
* @param unit texture unit to enable texture for
|
|
3449
|
-
* @param render_target render target from which to enable the specified texture unit
|
|
3450
|
-
* @param buffer_type buffer type from which to enable the texture
|
|
3456
|
+
* @param render_target render target or texture from which to enable the specified texture unit
|
|
3457
|
+
* @param buffer_type optional buffer type from which to enable the texture. Note that this argument only applies to render targets. Defaults to render.BUFFER_COLOR_BIT
|
|
3451
3458
|
|
|
3452
3459
|
- `render.BUFFER_COLOR_BIT`
|
|
3453
3460
|
- `render.BUFFER_DEPTH_BIT`
|
|
3454
3461
|
- `render.BUFFER_STENCIL_BIT`
|
|
3455
3462
|
|
|
3456
3463
|
If the render target has been created with multiple color attachments, these buffer types can be used
|
|
3457
|
-
to enable those textures as well. Currently
|
|
3464
|
+
to enable those textures as well. Currently 4 color attachments are supported:
|
|
3458
3465
|
|
|
3459
3466
|
- `render.BUFFER_COLOR0_BIT`
|
|
3460
3467
|
- `render.BUFFER_COLOR1_BIT`
|
|
@@ -3462,7 +3469,7 @@ to enable those textures as well. Currently only 4 color attachments are support
|
|
|
3462
3469
|
- `render.BUFFER_COLOR3_BIT`
|
|
3463
3470
|
|
|
3464
3471
|
*/
|
|
3465
|
-
export function enable_texture(unit: number, render_target: any, buffer_type
|
|
3472
|
+
export function enable_texture(unit: number, render_target: any, buffer_type?: any): void
|
|
3466
3473
|
|
|
3467
3474
|
/**
|
|
3468
3475
|
* Returns the logical window height that is set in the "game.project" settings.
|
|
@@ -3580,6 +3587,14 @@ to enable those textures as well. Currently only 4 color attachments are support
|
|
|
3580
3587
|
* The render target can be created to support multiple color attachments. Each attachment can have different format settings and texture filters,
|
|
3581
3588
|
* but attachments must be added in sequence, meaning you cannot create a render target at slot 0 and 3.
|
|
3582
3589
|
* Instead it has to be created with all four buffer types ranging from [0..3] (as denoted by render.BUFFER_COLORX_BIT where 'X' is the attachment you want to create).
|
|
3590
|
+
* It is not guaranteed that the device running the script can support creating render targets with multiple color attachments. To check if the device can support multiple attachments,
|
|
3591
|
+
* you can check if the `render` table contains any of the `BUFFER_COLOR1_BIT`, `BUFFER_COLOR2_BIT` or `BUFFER_COLOR3_BIT` constants:
|
|
3592
|
+
* `function init(self)
|
|
3593
|
+
* if render.BUFFER_COLOR1_BIT == nil then
|
|
3594
|
+
* -- this devices does not support multiple color attachments
|
|
3595
|
+
* end
|
|
3596
|
+
* end
|
|
3597
|
+
* `
|
|
3583
3598
|
* @param name render target name
|
|
3584
3599
|
* @param parameters table of buffer parameters, see the description for available keys and values
|
|
3585
3600
|
* @return render_target new render target
|
|
@@ -3900,65 +3915,145 @@ Transient frame buffer types are only valid while the render target is active, i
|
|
|
3900
3915
|
declare namespace resource {
|
|
3901
3916
|
|
|
3902
3917
|
/**
|
|
3903
|
-
*
|
|
3918
|
+
* BASIS_UASTC compression type
|
|
3904
3919
|
*/
|
|
3905
|
-
export let
|
|
3920
|
+
export let COMPRESSION_TYPE_BASIS_UASTC: any
|
|
3906
3921
|
|
|
3907
3922
|
/**
|
|
3908
|
-
*
|
|
3923
|
+
* COMPRESSION_TYPE_DEFAULT compression type
|
|
3909
3924
|
*/
|
|
3910
|
-
export let
|
|
3925
|
+
export let COMPRESSION_TYPE_DEFAULT: any
|
|
3911
3926
|
|
|
3912
3927
|
/**
|
|
3913
|
-
*
|
|
3928
|
+
* luminance type texture format
|
|
3914
3929
|
*/
|
|
3915
|
-
export let
|
|
3930
|
+
export let TEXTURE_FORMAT_LUMINANCE: any
|
|
3916
3931
|
|
|
3917
3932
|
/**
|
|
3918
|
-
*
|
|
3933
|
+
* R16F type texture format
|
|
3919
3934
|
*/
|
|
3920
|
-
export let
|
|
3935
|
+
export let TEXTURE_FORMAT_R16F: any
|
|
3921
3936
|
|
|
3922
3937
|
/**
|
|
3923
|
-
*
|
|
3938
|
+
* R32F type texture format
|
|
3924
3939
|
*/
|
|
3925
|
-
export let
|
|
3940
|
+
export let TEXTURE_FORMAT_R32F: any
|
|
3926
3941
|
|
|
3927
3942
|
/**
|
|
3928
|
-
*
|
|
3943
|
+
* RG16F type texture format
|
|
3929
3944
|
*/
|
|
3930
|
-
export let
|
|
3945
|
+
export let TEXTURE_FORMAT_RG16F: any
|
|
3931
3946
|
|
|
3932
3947
|
/**
|
|
3933
|
-
*
|
|
3948
|
+
* RG32F type texture format
|
|
3934
3949
|
*/
|
|
3935
|
-
export let
|
|
3950
|
+
export let TEXTURE_FORMAT_RG32F: any
|
|
3936
3951
|
|
|
3937
3952
|
/**
|
|
3938
|
-
*
|
|
3953
|
+
* RGB type texture format
|
|
3939
3954
|
*/
|
|
3940
|
-
export let
|
|
3955
|
+
export let TEXTURE_FORMAT_RGB: any
|
|
3941
3956
|
|
|
3942
3957
|
/**
|
|
3943
|
-
*
|
|
3958
|
+
* RGB16F type texture format
|
|
3944
3959
|
*/
|
|
3945
|
-
export let
|
|
3960
|
+
export let TEXTURE_FORMAT_RGB16F: any
|
|
3946
3961
|
|
|
3947
3962
|
/**
|
|
3948
|
-
*
|
|
3963
|
+
* RGB32F type texture format
|
|
3949
3964
|
*/
|
|
3950
|
-
export let
|
|
3965
|
+
export let TEXTURE_FORMAT_RGB32F: any
|
|
3951
3966
|
|
|
3952
3967
|
/**
|
|
3953
3968
|
* RGBA type texture format
|
|
3954
3969
|
*/
|
|
3955
3970
|
export let TEXTURE_FORMAT_RGBA: any
|
|
3956
3971
|
|
|
3972
|
+
/**
|
|
3973
|
+
* RGBA16F type texture format
|
|
3974
|
+
*/
|
|
3975
|
+
export let TEXTURE_FORMAT_RGBA16F: any
|
|
3976
|
+
|
|
3977
|
+
/**
|
|
3978
|
+
* RGBA32F type texture format
|
|
3979
|
+
*/
|
|
3980
|
+
export let TEXTURE_FORMAT_RGBA32F: any
|
|
3981
|
+
|
|
3982
|
+
/**
|
|
3983
|
+
* RGBA_ASTC_4x4 type texture format
|
|
3984
|
+
*/
|
|
3985
|
+
export let TEXTURE_FORMAT_RGBA_ASTC_4x4: any
|
|
3986
|
+
|
|
3987
|
+
/**
|
|
3988
|
+
* RGBA_BC3 type texture format
|
|
3989
|
+
*/
|
|
3990
|
+
export let TEXTURE_FORMAT_RGBA_BC3: any
|
|
3991
|
+
|
|
3992
|
+
/**
|
|
3993
|
+
* RGBA_BC7 type texture format
|
|
3994
|
+
*/
|
|
3995
|
+
export let TEXTURE_FORMAT_RGBA_BC7: any
|
|
3996
|
+
|
|
3997
|
+
/**
|
|
3998
|
+
* RGBA_ETC2 type texture format
|
|
3999
|
+
*/
|
|
4000
|
+
export let TEXTURE_FORMAT_RGBA_ETC2: any
|
|
4001
|
+
|
|
4002
|
+
/**
|
|
4003
|
+
* RGBA_PVRTC_2BPPV1 type texture format
|
|
4004
|
+
*/
|
|
4005
|
+
export let TEXTURE_FORMAT_RGBA_PVRTC_2BPPV1: any
|
|
4006
|
+
|
|
4007
|
+
/**
|
|
4008
|
+
* RGBA_PVRTC_4BPPV1 type texture format
|
|
4009
|
+
*/
|
|
4010
|
+
export let TEXTURE_FORMAT_RGBA_PVRTC_4BPPV1: any
|
|
4011
|
+
|
|
4012
|
+
/**
|
|
4013
|
+
* RGB_BC1 type texture format
|
|
4014
|
+
*/
|
|
4015
|
+
export let TEXTURE_FORMAT_RGB_BC1: any
|
|
4016
|
+
|
|
4017
|
+
/**
|
|
4018
|
+
* RGB_ETC1 type texture format
|
|
4019
|
+
*/
|
|
4020
|
+
export let TEXTURE_FORMAT_RGB_ETC1: any
|
|
4021
|
+
|
|
4022
|
+
/**
|
|
4023
|
+
* RGB_PVRTC_2BPPV1 type texture format
|
|
4024
|
+
*/
|
|
4025
|
+
export let TEXTURE_FORMAT_RGB_PVRTC_2BPPV1: any
|
|
4026
|
+
|
|
4027
|
+
/**
|
|
4028
|
+
* RGB_PVRTC_4BPPV1 type texture format
|
|
4029
|
+
*/
|
|
4030
|
+
export let TEXTURE_FORMAT_RGB_PVRTC_4BPPV1: any
|
|
4031
|
+
|
|
4032
|
+
/**
|
|
4033
|
+
* RG_BC5 type texture format
|
|
4034
|
+
*/
|
|
4035
|
+
export let TEXTURE_FORMAT_RG_BC5: any
|
|
4036
|
+
|
|
4037
|
+
/**
|
|
4038
|
+
* R_BC4 type texture format
|
|
4039
|
+
*/
|
|
4040
|
+
export let TEXTURE_FORMAT_R_BC4: any
|
|
4041
|
+
|
|
3957
4042
|
/**
|
|
3958
4043
|
* 2D texture type
|
|
3959
4044
|
*/
|
|
3960
4045
|
export let TEXTURE_TYPE_2D: any
|
|
3961
4046
|
|
|
4047
|
+
/**
|
|
4048
|
+
* 2D Array texture type
|
|
4049
|
+
*/
|
|
4050
|
+
export let TEXTURE_TYPE_2D_ARRAY: any
|
|
4051
|
+
|
|
4052
|
+
/**
|
|
4053
|
+
* Cube map texture type
|
|
4054
|
+
*/
|
|
4055
|
+
export let TEXTURE_TYPE_CUBE_MAP: any
|
|
4056
|
+
|
|
3962
4057
|
/**
|
|
3963
4058
|
* Constructor-like function with two purposes:
|
|
3964
4059
|
*
|
|
@@ -3983,6 +4078,216 @@ declare namespace resource {
|
|
|
3983
4078
|
*/
|
|
3984
4079
|
export function buffer(path?: string): hash
|
|
3985
4080
|
|
|
4081
|
+
/**
|
|
4082
|
+
* This function creates a new atlas resource that can be used in the same way as any atlas created during build time.
|
|
4083
|
+
* The path used for creating the atlas must be unique, trying to create a resource at a path that is already
|
|
4084
|
+
* registered will trigger an error. If the intention is to instead modify an existing atlas, use the resource.set_atlas
|
|
4085
|
+
* function. Also note that the path to the new atlas resource must have a '.texturesetc' extension,
|
|
4086
|
+
* meaning "/path/my_atlas" is not a valid path but "/path/my_atlas.texturesetc" is.
|
|
4087
|
+
* When creating the atlas, at least one geometry and one animation is required, and an error will be
|
|
4088
|
+
* raised if these requirements are not met. A reference to the resource will be held by the collection
|
|
4089
|
+
* that created the resource and will automatically be released when that collection is destroyed.
|
|
4090
|
+
* Note that releasing a resource essentially means decreasing the reference count of that resource,
|
|
4091
|
+
* and not necessarily that it will be deleted.
|
|
4092
|
+
* @param path The path to the resource.
|
|
4093
|
+
* @param table A table containing info about how to create the texture. Supported entries:
|
|
4094
|
+
|
|
4095
|
+
|
|
4096
|
+
|
|
4097
|
+
`texture`
|
|
4098
|
+
the path to the texture resource, e.g "/main/my_texture.texturec"
|
|
4099
|
+
|
|
4100
|
+
|
|
4101
|
+
|
|
4102
|
+
|
|
4103
|
+
`animations`
|
|
4104
|
+
a list of the animations in the atlas. Supports the following fields:
|
|
4105
|
+
|
|
4106
|
+
|
|
4107
|
+
|
|
4108
|
+
|
|
4109
|
+
`id`
|
|
4110
|
+
the id of the animation, used in e.g sprite.play_animation
|
|
4111
|
+
|
|
4112
|
+
|
|
4113
|
+
|
|
4114
|
+
|
|
4115
|
+
`width`
|
|
4116
|
+
the width of the animation
|
|
4117
|
+
|
|
4118
|
+
|
|
4119
|
+
|
|
4120
|
+
|
|
4121
|
+
`height`
|
|
4122
|
+
the height of the animation
|
|
4123
|
+
|
|
4124
|
+
|
|
4125
|
+
|
|
4126
|
+
|
|
4127
|
+
`frame_start`
|
|
4128
|
+
index to the first geometry of the animation. Indices are lua based and must be in the range of 1 .. in atlas.
|
|
4129
|
+
|
|
4130
|
+
|
|
4131
|
+
|
|
4132
|
+
|
|
4133
|
+
`frame_end`
|
|
4134
|
+
index to the last geometry of the animation (non-inclusive). Indices are lua based and must be in the range of 1 .. in atlas.
|
|
4135
|
+
|
|
4136
|
+
|
|
4137
|
+
|
|
4138
|
+
|
|
4139
|
+
`playback`
|
|
4140
|
+
optional playback mode of the animation, the default value is go.PLAYBACK_ONCE_FORWARD
|
|
4141
|
+
|
|
4142
|
+
|
|
4143
|
+
|
|
4144
|
+
|
|
4145
|
+
`fps`
|
|
4146
|
+
optional fps of the animation, the default value is 30
|
|
4147
|
+
|
|
4148
|
+
|
|
4149
|
+
|
|
4150
|
+
|
|
4151
|
+
`flip_vertical`
|
|
4152
|
+
optional flip the animation vertically, the default value is false
|
|
4153
|
+
|
|
4154
|
+
|
|
4155
|
+
|
|
4156
|
+
|
|
4157
|
+
`flip_horizontal`
|
|
4158
|
+
optional flip the animation horizontally, the default value is false
|
|
4159
|
+
|
|
4160
|
+
|
|
4161
|
+
|
|
4162
|
+
|
|
4163
|
+
`geometries`
|
|
4164
|
+
A list of the geometries that should map to the texture data. Supports the following fields:
|
|
4165
|
+
|
|
4166
|
+
|
|
4167
|
+
|
|
4168
|
+
|
|
4169
|
+
`vertices`
|
|
4170
|
+
a list of the vertices in texture space of the geometry in the form {px0, py0, px1, py1, ..., pxn, pyn}
|
|
4171
|
+
|
|
4172
|
+
|
|
4173
|
+
|
|
4174
|
+
|
|
4175
|
+
`uvs`
|
|
4176
|
+
a list of the uv coordinates in texture space of the geometry in the form of {u0, v0, u1, v1, ..., un, vn}
|
|
4177
|
+
|
|
4178
|
+
|
|
4179
|
+
|
|
4180
|
+
|
|
4181
|
+
`indices`
|
|
4182
|
+
a list of the indices of the geometry in the form {i0, i1, i2, ..., in}. Each tripe in the list represents a triangle.
|
|
4183
|
+
|
|
4184
|
+
|
|
4185
|
+
|
|
4186
|
+
* @return path Returns the atlas resource path
|
|
4187
|
+
*/
|
|
4188
|
+
export function create_atlas(path: string, table: any): hash
|
|
4189
|
+
|
|
4190
|
+
/**
|
|
4191
|
+
* This function creates a new buffer resource that can be used in the same way as any buffer created during build time.
|
|
4192
|
+
* The function requires a valid buffer created from either buffer.create or another pre-existing buffer resource.
|
|
4193
|
+
* By default, the new resource will take ownership of the buffer lua reference, meaning the buffer will not automatically be removed
|
|
4194
|
+
* when the lua reference to the buffer is garbage collected. This behaviour can be overruled by specifying 'transfer_ownership = false'
|
|
4195
|
+
* in the argument table. If the new buffer resource is created from a buffer object that is created by another resource,
|
|
4196
|
+
* the buffer object will be copied and the new resource will effectively own a copy of the buffer instead.
|
|
4197
|
+
* Note that the path to the new resource must have the '.bufferc' extension, "/path/my_buffer" is not a valid path but "/path/my_buffer.bufferc" is.
|
|
4198
|
+
* The path must also be unique, attempting to create a buffer with the same name as an existing resource will raise an error.
|
|
4199
|
+
* @param path The path to the resource.
|
|
4200
|
+
* @param table A table containing info about how to create the buffer. Supported entries:
|
|
4201
|
+
|
|
4202
|
+
|
|
4203
|
+
|
|
4204
|
+
`buffer`
|
|
4205
|
+
the buffer to bind to this resource
|
|
4206
|
+
|
|
4207
|
+
|
|
4208
|
+
|
|
4209
|
+
|
|
4210
|
+
`transfer_ownership`
|
|
4211
|
+
optional flag to determine wether or not the resource should take over ownership of the buffer object (default true)
|
|
4212
|
+
|
|
4213
|
+
|
|
4214
|
+
|
|
4215
|
+
* @return path Returns the buffer resource path
|
|
4216
|
+
*/
|
|
4217
|
+
export function create_buffer(path: string, table: any): hash
|
|
4218
|
+
|
|
4219
|
+
/**
|
|
4220
|
+
* Creates a new texture resource that can be used in the same way as any texture created during build time.
|
|
4221
|
+
* The path used for creating the texture must be unique, trying to create a resource at a path that is already
|
|
4222
|
+
* registered will trigger an error. If the intention is to instead modify an existing texture, use the resource.set_texture
|
|
4223
|
+
* function. Also note that the path to the new texture resource must have a '.texturec' extension,
|
|
4224
|
+
* meaning "/path/my_texture" is not a valid path but "/path/my_texture.texturec" is.
|
|
4225
|
+
* @param path The path to the resource.
|
|
4226
|
+
* @param table A table containing info about how to create the texture. Supported entries:
|
|
4227
|
+
|
|
4228
|
+
`type`
|
|
4229
|
+
The texture type. Supported values:
|
|
4230
|
+
|
|
4231
|
+
|
|
4232
|
+
- `resource.TEXTURE_TYPE_2D`
|
|
4233
|
+
- `resource.TEXTURE_TYPE_CUBE_MAP`
|
|
4234
|
+
|
|
4235
|
+
|
|
4236
|
+
`width`
|
|
4237
|
+
The width of the texture (in pixels)
|
|
4238
|
+
`height`
|
|
4239
|
+
The width of the texture (in pixels)
|
|
4240
|
+
`format`
|
|
4241
|
+
The texture format, note that some of these formats might not be supported by the running device. Supported values:
|
|
4242
|
+
|
|
4243
|
+
|
|
4244
|
+
- `resource.TEXTURE_FORMAT_LUMINANCE`
|
|
4245
|
+
- `resource.TEXTURE_FORMAT_RGB`
|
|
4246
|
+
- `resource.TEXTURE_FORMAT_RGBA`
|
|
4247
|
+
|
|
4248
|
+
These constants might not be available on the device:
|
|
4249
|
+
- `resource.TEXTURE_FORMAT_RGB_PVRTC_2BPPV1`
|
|
4250
|
+
- `resource.TEXTURE_FORMAT_RGB_PVRTC_4BPPV1`
|
|
4251
|
+
- `resource.TEXTURE_FORMAT_RGBA_PVRTC_2BPPV1`
|
|
4252
|
+
- `resource.TEXTURE_FORMAT_RGBA_PVRTC_4BPPV1`
|
|
4253
|
+
- `resource.TEXTURE_FORMAT_RGB_ETC1`
|
|
4254
|
+
- `resource.TEXTURE_FORMAT_RGBA_ETC2`
|
|
4255
|
+
- `resource.TEXTURE_FORMAT_RGBA_ASTC_4x4`
|
|
4256
|
+
- `resource.TEXTURE_FORMAT_RGB_BC1`
|
|
4257
|
+
- `resource.TEXTURE_FORMAT_RGBA_BC3`
|
|
4258
|
+
- `resource.TEXTURE_FORMAT_R_BC4`
|
|
4259
|
+
- `resource.TEXTURE_FORMAT_RG_BC5`
|
|
4260
|
+
- `resource.TEXTURE_FORMAT_RGBA_BC7`
|
|
4261
|
+
- `resource.TEXTURE_FORMAT_RGB16F`
|
|
4262
|
+
- `resource.TEXTURE_FORMAT_RGB32F`
|
|
4263
|
+
- `resource.TEXTURE_FORMAT_RGBA16F`
|
|
4264
|
+
- `resource.TEXTURE_FORMAT_RGBA32F`
|
|
4265
|
+
- `resource.TEXTURE_FORMAT_R16F`
|
|
4266
|
+
- `resource.TEXTURE_FORMAT_RG16F`
|
|
4267
|
+
- `resource.TEXTURE_FORMAT_R32F`
|
|
4268
|
+
- `resource.TEXTURE_FORMAT_RG32F`
|
|
4269
|
+
You can test if the device supports these values by checking if a specific enum is nil or not:
|
|
4270
|
+
`if resource.TEXTURE_FORMAT_RGBA16F ~= nil then
|
|
4271
|
+
-- it is safe to use this format
|
|
4272
|
+
end
|
|
4273
|
+
`
|
|
4274
|
+
|
|
4275
|
+
|
|
4276
|
+
`max_mipmaps`
|
|
4277
|
+
optional max number of mipmaps. Defaults to zero, i.e no mipmap support
|
|
4278
|
+
`compression_type`
|
|
4279
|
+
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.
|
|
4280
|
+
Creating an empty texture with no buffer data is not supported as a core feature. Defaults to resource.COMPRESSION_TYPE_DEFAULT, i.e no compression. Supported values:
|
|
4281
|
+
|
|
4282
|
+
|
|
4283
|
+
- `COMPRESSION_TYPE_DEFAULT`
|
|
4284
|
+
- `COMPRESSION_TYPE_BASIS_UASTC`
|
|
4285
|
+
|
|
4286
|
+
* @param buffer optional buffer of precreated pixel data
|
|
4287
|
+
* @return path The path to the resource.
|
|
4288
|
+
*/
|
|
4289
|
+
export function create_texture(path: string, table: any, buffer?: buffer): hash
|
|
4290
|
+
|
|
3986
4291
|
/**
|
|
3987
4292
|
* Constructor-like function with two purposes:
|
|
3988
4293
|
*
|
|
@@ -3995,6 +4300,19 @@ declare namespace resource {
|
|
|
3995
4300
|
*/
|
|
3996
4301
|
export function font(path?: string): hash
|
|
3997
4302
|
|
|
4303
|
+
/**
|
|
4304
|
+
* Returns the atlas data for an atlas
|
|
4305
|
+
* @param path The path to the atlas resource
|
|
4306
|
+
* @return data A table with the following entries:
|
|
4307
|
+
|
|
4308
|
+
- texture
|
|
4309
|
+
- geometries
|
|
4310
|
+
- animations
|
|
4311
|
+
|
|
4312
|
+
See resource.set_atlas for a detailed description of each field
|
|
4313
|
+
*/
|
|
4314
|
+
export function get_atlas(path: hash | string): any
|
|
4315
|
+
|
|
3998
4316
|
/**
|
|
3999
4317
|
* gets the buffer from a resource
|
|
4000
4318
|
* @param path The path to the resource
|
|
@@ -4002,12 +4320,6 @@ declare namespace resource {
|
|
|
4002
4320
|
*/
|
|
4003
4321
|
export function get_buffer(path: hash | string): buffer
|
|
4004
4322
|
|
|
4005
|
-
/**
|
|
4006
|
-
* Return a reference to the Manifest that is currently loaded.
|
|
4007
|
-
* @return manifest_reference reference to the Manifest that is currently loaded
|
|
4008
|
-
*/
|
|
4009
|
-
export function get_current_manifest(): number
|
|
4010
|
-
|
|
4011
4323
|
/**
|
|
4012
4324
|
* Gets the text metrics from a font
|
|
4013
4325
|
* @param url the font to get the (unscaled) metrics from
|
|
@@ -4019,7 +4331,7 @@ The width of the text field. Not used if `line_break` is false.
|
|
|
4019
4331
|
`leading`
|
|
4020
4332
|
The leading (default 1.0)
|
|
4021
4333
|
`tracking`
|
|
4022
|
-
The
|
|
4334
|
+
The tracking (default 0.0)
|
|
4023
4335
|
`line_break`
|
|
4024
4336
|
If the calculation should consider line breaks (default false)
|
|
4025
4337
|
|
|
@@ -4034,11 +4346,30 @@ If the calculation should consider line breaks (default false)
|
|
|
4034
4346
|
export function get_text_metrics(url: hash, text: string, options?: any): any
|
|
4035
4347
|
|
|
4036
4348
|
/**
|
|
4037
|
-
*
|
|
4038
|
-
*
|
|
4039
|
-
* @return
|
|
4349
|
+
* Gets texture info from a texture resource path or a texture handle
|
|
4350
|
+
* @param path The path to the resource or a texture handle
|
|
4351
|
+
* @return table A table containing info about the texture:
|
|
4352
|
+
|
|
4353
|
+
`handle`
|
|
4354
|
+
the opaque handle to the texture resource
|
|
4355
|
+
`width`
|
|
4356
|
+
width of the texture
|
|
4357
|
+
`height`
|
|
4358
|
+
height of the texture
|
|
4359
|
+
`depth`
|
|
4360
|
+
depth of the texture (i.e 1 for a 2D texture and 6 for a cube map)
|
|
4361
|
+
`mipmaps`
|
|
4362
|
+
number of mipmaps of the texture
|
|
4363
|
+
`type`
|
|
4364
|
+
The texture type. Supported values:
|
|
4365
|
+
|
|
4366
|
+
|
|
4367
|
+
- `resource.TEXTURE_TYPE_2D`
|
|
4368
|
+
- `resource.TEXTURE_TYPE_CUBE_MAP`
|
|
4369
|
+
- `resource.TEXTURE_TYPE_2D_ARRAY`
|
|
4370
|
+
|
|
4040
4371
|
*/
|
|
4041
|
-
export function
|
|
4372
|
+
export function get_texture_info(path: any): any
|
|
4042
4373
|
|
|
4043
4374
|
/**
|
|
4044
4375
|
* Loads the resource data for a specific resource.
|
|
@@ -4059,6 +4390,13 @@ If the calculation should consider line breaks (default false)
|
|
|
4059
4390
|
*/
|
|
4060
4391
|
export function material(path?: string): hash
|
|
4061
4392
|
|
|
4393
|
+
/**
|
|
4394
|
+
* Release a resource.
|
|
4395
|
+
* ⚠ This is a potentially dangerous operation, releasing resources currently being used can cause unexpected behaviour.
|
|
4396
|
+
* @param path The path to the resource.
|
|
4397
|
+
*/
|
|
4398
|
+
export function release(path: hash | string): void
|
|
4399
|
+
|
|
4062
4400
|
/**
|
|
4063
4401
|
* Sets the resource data for a specific resource
|
|
4064
4402
|
* @param path The path to the resource
|
|
@@ -4066,6 +4404,115 @@ If the calculation should consider line breaks (default false)
|
|
|
4066
4404
|
*/
|
|
4067
4405
|
export function set(path: string | hash, buffer: buffer): void
|
|
4068
4406
|
|
|
4407
|
+
/**
|
|
4408
|
+
* Sets the data for a specific atlas resource. Setting new atlas data is specified by passing in
|
|
4409
|
+
* a texture path for the backing texture of the atlas, a list of geometries and a list of animations
|
|
4410
|
+
* that map to the entries in the geometry list. The geometry entries are represented by three lists:
|
|
4411
|
+
* vertices, uvs and indices that together represent triangles that are used in other parts of the
|
|
4412
|
+
* engine to produce render objects from.
|
|
4413
|
+
* Vertex and uv coordinates for the geometries are expected to be
|
|
4414
|
+
* in pixel coordinates where 0,0 is the top left corner of the texture.
|
|
4415
|
+
* There is no automatic padding or margin support when setting custom data,
|
|
4416
|
+
* which could potentially cause filtering artifacts if used with a material sampler that has linear filtering.
|
|
4417
|
+
* If that is an issue, you need to calculate padding and margins manually before passing in the geometry data to
|
|
4418
|
+
* this function.
|
|
4419
|
+
* @param path The path to the atlas resource
|
|
4420
|
+
* @param table A table containing info about the atlas. Supported entries:
|
|
4421
|
+
|
|
4422
|
+
|
|
4423
|
+
|
|
4424
|
+
`texture`
|
|
4425
|
+
the path to the texture resource, e.g "/main/my_texture.texturec"
|
|
4426
|
+
|
|
4427
|
+
|
|
4428
|
+
|
|
4429
|
+
|
|
4430
|
+
`animations`
|
|
4431
|
+
a list of the animations in the atlas. Supports the following fields:
|
|
4432
|
+
|
|
4433
|
+
|
|
4434
|
+
|
|
4435
|
+
|
|
4436
|
+
`id`
|
|
4437
|
+
the id of the animation, used in e.g sprite.play_animation
|
|
4438
|
+
|
|
4439
|
+
|
|
4440
|
+
|
|
4441
|
+
|
|
4442
|
+
`width`
|
|
4443
|
+
the width of the animation
|
|
4444
|
+
|
|
4445
|
+
|
|
4446
|
+
|
|
4447
|
+
|
|
4448
|
+
`height`
|
|
4449
|
+
the height of the animation
|
|
4450
|
+
|
|
4451
|
+
|
|
4452
|
+
|
|
4453
|
+
|
|
4454
|
+
`frame_start`
|
|
4455
|
+
index to the first geometry of the animation. Indices are lua based and must be in the range of 1 .. in atlas.
|
|
4456
|
+
|
|
4457
|
+
|
|
4458
|
+
|
|
4459
|
+
|
|
4460
|
+
`frame_end`
|
|
4461
|
+
index to the last geometry of the animation (non-inclusive). Indices are lua based and must be in the range of 1 .. in atlas.
|
|
4462
|
+
|
|
4463
|
+
|
|
4464
|
+
|
|
4465
|
+
|
|
4466
|
+
`playback`
|
|
4467
|
+
optional playback mode of the animation, the default value is go.PLAYBACK_ONCE_FORWARD
|
|
4468
|
+
|
|
4469
|
+
|
|
4470
|
+
|
|
4471
|
+
|
|
4472
|
+
`fps`
|
|
4473
|
+
optional fps of the animation, the default value is 30
|
|
4474
|
+
|
|
4475
|
+
|
|
4476
|
+
|
|
4477
|
+
|
|
4478
|
+
`flip_vertical`
|
|
4479
|
+
optional flip the animation vertically, the default value is false
|
|
4480
|
+
|
|
4481
|
+
|
|
4482
|
+
|
|
4483
|
+
|
|
4484
|
+
`flip_horizontal`
|
|
4485
|
+
optional flip the animation horizontally, the default value is false
|
|
4486
|
+
|
|
4487
|
+
|
|
4488
|
+
|
|
4489
|
+
|
|
4490
|
+
`geometries`
|
|
4491
|
+
A list of the geometries that should map to the texture data. Supports the following fields:
|
|
4492
|
+
|
|
4493
|
+
|
|
4494
|
+
|
|
4495
|
+
|
|
4496
|
+
`vertices`
|
|
4497
|
+
a list of the vertices in texture space of the geometry in the form {px0, py0, px1, py1, ..., pxn, pyn}
|
|
4498
|
+
|
|
4499
|
+
|
|
4500
|
+
|
|
4501
|
+
|
|
4502
|
+
`uvs`
|
|
4503
|
+
a list of the uv coordinates in texture space of the geometry in the form of {u0, v0, u1, v1, ..., un, vn}
|
|
4504
|
+
|
|
4505
|
+
|
|
4506
|
+
|
|
4507
|
+
|
|
4508
|
+
`indices`
|
|
4509
|
+
a list of the indices of the geometry in the form {i0, i1, i2, ..., in}. Each tripe in the list represents a triangle.
|
|
4510
|
+
|
|
4511
|
+
|
|
4512
|
+
|
|
4513
|
+
*/
|
|
4514
|
+
export function set_atlas(path: hash | string, table: any): void
|
|
4515
|
+
|
|
4069
4516
|
/**
|
|
4070
4517
|
* sets the buffer of a resource
|
|
4071
4518
|
* @param path The path to the resource
|
|
@@ -4090,6 +4537,7 @@ The texture type. Supported values:
|
|
|
4090
4537
|
|
|
4091
4538
|
|
|
4092
4539
|
- `resource.TEXTURE_TYPE_2D`
|
|
4540
|
+
- `resource.TEXTURE_TYPE_CUBE_MAP`
|
|
4093
4541
|
|
|
4094
4542
|
|
|
4095
4543
|
`width`
|
|
@@ -4097,90 +4545,58 @@ The width of the texture (in pixels)
|
|
|
4097
4545
|
`height`
|
|
4098
4546
|
The width of the texture (in pixels)
|
|
4099
4547
|
`format`
|
|
4100
|
-
The texture format. Supported values:
|
|
4548
|
+
The texture format, note that some of these formats are platform specific. Supported values:
|
|
4101
4549
|
|
|
4102
4550
|
|
|
4103
4551
|
- `resource.TEXTURE_FORMAT_LUMINANCE`
|
|
4104
4552
|
- `resource.TEXTURE_FORMAT_RGB`
|
|
4105
4553
|
- `resource.TEXTURE_FORMAT_RGBA`
|
|
4106
4554
|
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
`
|
|
4123
|
-
|
|
4124
|
-
`
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
`
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
/**
|
|
4135
|
-
* Create a new manifest from a buffer. The created manifest is verified
|
|
4136
|
-
* by ensuring that the manifest was signed using the bundled public/private
|
|
4137
|
-
* key-pair during the bundle process and that the manifest supports the current
|
|
4138
|
-
* running engine version. Once the manifest is verified it is stored on device.
|
|
4139
|
-
* The next time the engine starts (or is rebooted) it will look for the stored
|
|
4140
|
-
* manifest before loading resources. Storing a new manifest allows the
|
|
4141
|
-
* developer to update the game, modify existing resources, or add new
|
|
4142
|
-
* resources to the game through LiveUpdate.
|
|
4143
|
-
* @param manifest_buffer the binary data that represents the manifest
|
|
4144
|
-
* @param callback the callback function
|
|
4145
|
-
executed once the engine has attempted to store the manifest.
|
|
4146
|
-
|
|
4147
|
-
`self`
|
|
4148
|
-
The current object.
|
|
4149
|
-
`status`
|
|
4150
|
-
the status of the store operation:
|
|
4151
|
-
|
|
4555
|
+
These constants might not be available on the device:
|
|
4556
|
+
- `resource.TEXTURE_FORMAT_RGB_PVRTC_2BPPV1`
|
|
4557
|
+
- `resource.TEXTURE_FORMAT_RGB_PVRTC_4BPPV1`
|
|
4558
|
+
- `resource.TEXTURE_FORMAT_RGBA_PVRTC_2BPPV1`
|
|
4559
|
+
- `resource.TEXTURE_FORMAT_RGBA_PVRTC_4BPPV1`
|
|
4560
|
+
- `resource.TEXTURE_FORMAT_RGB_ETC1`
|
|
4561
|
+
- `resource.TEXTURE_FORMAT_RGBA_ETC2`
|
|
4562
|
+
- `resource.TEXTURE_FORMAT_RGBA_ASTC_4x4`
|
|
4563
|
+
- `resource.TEXTURE_FORMAT_RGB_BC1`
|
|
4564
|
+
- `resource.TEXTURE_FORMAT_RGBA_BC3`
|
|
4565
|
+
- `resource.TEXTURE_FORMAT_R_BC4`
|
|
4566
|
+
- `resource.TEXTURE_FORMAT_RG_BC5`
|
|
4567
|
+
- `resource.TEXTURE_FORMAT_RGBA_BC7`
|
|
4568
|
+
- `resource.TEXTURE_FORMAT_RGB16F`
|
|
4569
|
+
- `resource.TEXTURE_FORMAT_RGB32F`
|
|
4570
|
+
- `resource.TEXTURE_FORMAT_RGBA16F`
|
|
4571
|
+
- `resource.TEXTURE_FORMAT_RGBA32F`
|
|
4572
|
+
- `resource.TEXTURE_FORMAT_R16F`
|
|
4573
|
+
- `resource.TEXTURE_FORMAT_RG16F`
|
|
4574
|
+
- `resource.TEXTURE_FORMAT_R32F`
|
|
4575
|
+
- `resource.TEXTURE_FORMAT_RG32F`
|
|
4576
|
+
You can test if the device supports these values by checking if a specific enum is nil or not:
|
|
4577
|
+
`if resource.TEXTURE_FORMAT_RGBA16F ~= nil then
|
|
4578
|
+
-- it is safe to use this format
|
|
4579
|
+
end
|
|
4580
|
+
`
|
|
4152
4581
|
|
|
4153
|
-
- `resource.LIVEUPATE_OK`
|
|
4154
|
-
- `resource.LIVEUPATE_INVALID_RESOURCE`
|
|
4155
|
-
- `resource.LIVEUPATE_VERSION_MISMATCH`
|
|
4156
|
-
- `resource.LIVEUPATE_ENGINE_VERSION_MISMATCH`
|
|
4157
|
-
- `resource.LIVEUPATE_SIGNATURE_MISMATCH`
|
|
4158
|
-
- `resource.LIVEUPDATE_BUNDLED_RESOURCE_MISMATCH`
|
|
4159
|
-
- `resource.LIVEUPDATE_FORMAT_ERROR`
|
|
4160
4582
|
|
|
4161
|
-
|
|
4162
|
-
|
|
4583
|
+
`x`
|
|
4584
|
+
optional x offset of the texture (in pixels)
|
|
4585
|
+
`y`
|
|
4586
|
+
optional y offset of the texture (in pixels)
|
|
4587
|
+
`mipmap`
|
|
4588
|
+
optional mipmap to upload the data to
|
|
4589
|
+
`compression_type`
|
|
4590
|
+
optional specify the compression type for the data in the buffer object that holds the texture data. Defaults to resource.COMPRESSION_TYPE_DEFAULT, i.e no compression. Supported values:
|
|
4163
4591
|
|
|
4164
|
-
/**
|
|
4165
|
-
* add a resource to the data archive and runtime index. The resource will be verified
|
|
4166
|
-
* internally before being added to the data archive.
|
|
4167
|
-
* @param manifest_reference The manifest to check against.
|
|
4168
|
-
* @param data The resource data that should be stored.
|
|
4169
|
-
* @param hexdigest The expected hash for the resource,
|
|
4170
|
-
retrieved through collectionproxy.missing_resources.
|
|
4171
|
-
* @param callback The callback
|
|
4172
|
-
function that is executed once the engine has been attempted to store
|
|
4173
|
-
the resource.
|
|
4174
4592
|
|
|
4175
|
-
`
|
|
4176
|
-
|
|
4177
|
-
`hexdigest`
|
|
4178
|
-
The hexdigest of the resource.
|
|
4179
|
-
`status`
|
|
4180
|
-
Whether or not the resource was successfully stored.
|
|
4593
|
+
- `COMPRESSION_TYPE_DEFAULT`
|
|
4594
|
+
- `COMPRESSION_TYPE_BASIS_UASTC`
|
|
4181
4595
|
|
|
4596
|
+
* @param buffer The buffer of precreated pixel data
|
|
4597
|
+
⚠ 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!
|
|
4182
4598
|
*/
|
|
4183
|
-
export function
|
|
4599
|
+
export function set_texture(path: hash | string, table: any, buffer: buffer): void
|
|
4184
4600
|
|
|
4185
4601
|
/**
|
|
4186
4602
|
* Constructor-like function with two purposes:
|
|
@@ -4322,21 +4738,28 @@ declare namespace sys {
|
|
|
4322
4738
|
export function get_application_path(): string
|
|
4323
4739
|
|
|
4324
4740
|
/**
|
|
4325
|
-
* Get config value from the game.project configuration file
|
|
4326
|
-
*
|
|
4327
|
-
*
|
|
4741
|
+
* Get integer config value from the game.project configuration file with optional default value
|
|
4742
|
+
* @param key key to get value for. The syntax is SECTION.KEY
|
|
4743
|
+
* @param default_value (optional) default value to return if the value does not exist
|
|
4744
|
+
* @return value config value as an integer. default_value if the config key does not exist. 0 if no default value was supplied.
|
|
4745
|
+
*/
|
|
4746
|
+
export function get_config_int(key: string, default_value?: any): any
|
|
4747
|
+
|
|
4748
|
+
/**
|
|
4749
|
+
* Get number config value from the game.project configuration file with optional default value
|
|
4328
4750
|
* @param key key to get value for. The syntax is SECTION.KEY
|
|
4329
|
-
* @
|
|
4751
|
+
* @param default_value (optional) default value to return if the value does not exist
|
|
4752
|
+
* @return value config value as an number. default_value if the config key does not exist. 0 if no default value was supplied.
|
|
4330
4753
|
*/
|
|
4331
|
-
export function
|
|
4754
|
+
export function get_config_number(key: string, default_value?: number): number
|
|
4332
4755
|
|
|
4333
4756
|
/**
|
|
4334
|
-
* Get config value from the game.project configuration file with default value
|
|
4757
|
+
* Get string config value from the game.project configuration file with optional default value
|
|
4335
4758
|
* @param key key to get value for. The syntax is SECTION.KEY
|
|
4336
|
-
* @param default_value default value to return if the value does not exist
|
|
4337
|
-
* @return value config value as a string. default_value if the config key does not exist
|
|
4759
|
+
* @param default_value (optional) default value to return if the value does not exist
|
|
4760
|
+
* @return value config value as a string. default_value if the config key does not exist. nil if no default value was supplied.
|
|
4338
4761
|
*/
|
|
4339
|
-
export function
|
|
4762
|
+
export function get_config_string(key: string, default_value?: string): string
|
|
4340
4763
|
|
|
4341
4764
|
/**
|
|
4342
4765
|
* 🤖 Returns the current network connectivity status
|
|
@@ -4393,7 +4816,7 @@ might be nil if not available.
|
|
|
4393
4816
|
|
|
4394
4817
|
/**
|
|
4395
4818
|
* Returns a table with system information.
|
|
4396
|
-
* @param options
|
|
4819
|
+
* @param options optional options table
|
|
4397
4820
|
this flag ignores values might be secured by OS e.g. `device_ident`
|
|
4398
4821
|
* @return sys_info table with system information in the following fields:
|
|
4399
4822
|
|
|
@@ -4452,7 +4875,7 @@ The HTTP user agent, i.e. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) Apple
|
|
|
4452
4875
|
* @param attributes table with attributes
|
|
4453
4876
|
`target`
|
|
4454
4877
|
: Optional. Specifies the target attribute or the name of the window. The following values are supported:
|
|
4455
|
-
- `_self` - URL replaces the current page.
|
|
4878
|
+
- `_self` - (default value) URL replaces the current page.
|
|
4456
4879
|
- `_blank` - URL is loaded into a new window, or tab.
|
|
4457
4880
|
- `_parent` - URL is loaded into the parent frame.
|
|
4458
4881
|
- `_top` - URL replaces any framesets that may be loaded.
|
|
@@ -4626,6 +5049,12 @@ declare namespace window {
|
|
|
4626
5049
|
*/
|
|
4627
5050
|
export function get_dim_mode(): any
|
|
4628
5051
|
|
|
5052
|
+
/**
|
|
5053
|
+
* This returns the current lock state of the mouse cursor
|
|
5054
|
+
* @return state The lock state
|
|
5055
|
+
*/
|
|
5056
|
+
export function get_mouse_lock(): boolean
|
|
5057
|
+
|
|
4629
5058
|
/**
|
|
4630
5059
|
* This returns the current window size (width and height).
|
|
4631
5060
|
* @return width The window width
|
|
@@ -4672,6 +5101,14 @@ The callback value `data` is a table which currently holds these values
|
|
|
4672
5101
|
*/
|
|
4673
5102
|
export function set_listener(callback: any): void
|
|
4674
5103
|
|
|
5104
|
+
/**
|
|
5105
|
+
* Set the locking state for current mouse cursor on a PC platform.
|
|
5106
|
+
* This function locks or unlocks the mouse cursor to the center point of the window. While the cursor is locked,
|
|
5107
|
+
* mouse position updates will still be sent to the scripts as usual.
|
|
5108
|
+
* @param flag The lock state for the mouse cursor
|
|
5109
|
+
*/
|
|
5110
|
+
export function set_mouse_lock(flag: boolean): void
|
|
5111
|
+
|
|
4675
5112
|
}
|
|
4676
5113
|
// =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
|
|
4677
5114
|
|
|
@@ -4772,6 +5209,15 @@ declare namespace buffer {
|
|
|
4772
5209
|
*/
|
|
4773
5210
|
export function get_bytes(buffer: buffer, stream_name: hash): string
|
|
4774
5211
|
|
|
5212
|
+
/**
|
|
5213
|
+
* Get a named metadata entry from a buffer along with its type.
|
|
5214
|
+
* @param buf the buffer to get the metadata from
|
|
5215
|
+
* @param metadata_name name of the metadata entry
|
|
5216
|
+
* @return values table of metadata values or nil if the entry does not exist
|
|
5217
|
+
* @return value_type numeric type of values or nil
|
|
5218
|
+
*/
|
|
5219
|
+
export function get_metadata(buf: buffer, metadata_name: hash | string): LuaMultiReturn<[any, any]>
|
|
5220
|
+
|
|
4775
5221
|
/**
|
|
4776
5222
|
* Get a specified stream from a buffer.
|
|
4777
5223
|
* @param buffer the buffer to get the stream from
|
|
@@ -4780,6 +5226,16 @@ declare namespace buffer {
|
|
|
4780
5226
|
*/
|
|
4781
5227
|
export function get_stream(buffer: buffer, stream_name: hash | string): bufferstream
|
|
4782
5228
|
|
|
5229
|
+
/**
|
|
5230
|
+
* Creates or updates a metadata array entry on a buffer.
|
|
5231
|
+
* ⚠ The value type and count given when updating the entry should match those used when first creating it.
|
|
5232
|
+
* @param buf the buffer to set the metadata on
|
|
5233
|
+
* @param metadata_name name of the metadata entry
|
|
5234
|
+
* @param values actual metadata, an array of numeric values
|
|
5235
|
+
* @param value_type type of values when stored
|
|
5236
|
+
*/
|
|
5237
|
+
export function set_metadata(buf: buffer, metadata_name: hash | string, values: any, value_type: any): void
|
|
5238
|
+
|
|
4783
5239
|
}
|
|
4784
5240
|
// =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
|
|
4785
5241
|
|
|
@@ -4795,6 +5251,19 @@ declare namespace html5 {
|
|
|
4795
5251
|
*/
|
|
4796
5252
|
export function run(code: string): string
|
|
4797
5253
|
|
|
5254
|
+
/**
|
|
5255
|
+
* Set a JavaScript interaction listener callaback from lua that will be
|
|
5256
|
+
* invoked when a user interacts with the web page by clicking, touching or typing.
|
|
5257
|
+
* The callback can then call DOM restricted actions like requesting a pointer lock,
|
|
5258
|
+
* or start playing sounds the first time the callback is invoked.
|
|
5259
|
+
* @param callback The interaction callback. Pass an empty function or nil if you no longer wish to receive callbacks.
|
|
5260
|
+
|
|
5261
|
+
`self`
|
|
5262
|
+
The calling script
|
|
5263
|
+
|
|
5264
|
+
*/
|
|
5265
|
+
export function set_interaction_listener(callback: any): void
|
|
5266
|
+
|
|
4798
5267
|
}
|
|
4799
5268
|
// =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
|
|
4800
5269
|
|
|
@@ -4888,6 +5357,20 @@ declare namespace json {
|
|
|
4888
5357
|
*/
|
|
4889
5358
|
export function decode(json: string): any
|
|
4890
5359
|
|
|
5360
|
+
/**
|
|
5361
|
+
* Encode a lua table to a JSON string.
|
|
5362
|
+
* A Lua error is raised for syntax errors.
|
|
5363
|
+
* @param tbl lua table to encode
|
|
5364
|
+
* @return json encoded json
|
|
5365
|
+
*/
|
|
5366
|
+
export function encode(tbl: any): string
|
|
5367
|
+
|
|
5368
|
+
/**
|
|
5369
|
+
* null
|
|
5370
|
+
*/
|
|
5371
|
+
let null$: any
|
|
5372
|
+
export { null$ as null }
|
|
5373
|
+
|
|
4891
5374
|
}
|
|
4892
5375
|
// =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
|
|
4893
5376
|
|
|
@@ -4981,10 +5464,25 @@ The handle of the timer
|
|
|
4981
5464
|
`time_elapsed`
|
|
4982
5465
|
The elapsed time - on first trigger it is time since timer.delay call, otherwise time since last trigger
|
|
4983
5466
|
|
|
4984
|
-
* @return
|
|
5467
|
+
* @return handle identifier for the create timer, returns timer.INVALID_TIMER_HANDLE if the timer can not be created
|
|
4985
5468
|
*/
|
|
4986
5469
|
export function delay(delay: number, repeat: boolean, callback: any): hash
|
|
4987
5470
|
|
|
5471
|
+
/**
|
|
5472
|
+
* Get information about timer.
|
|
5473
|
+
* @param handle the timer handle returned by timer.delay()
|
|
5474
|
+
* @return data or nil if timer is cancelled/completed. table with data in the following fields:
|
|
5475
|
+
|
|
5476
|
+
`time_remaining`
|
|
5477
|
+
Time remaining until the next time a timer.delay() fires.
|
|
5478
|
+
`delay`
|
|
5479
|
+
Time interval.
|
|
5480
|
+
`repeating`
|
|
5481
|
+
true = repeat timer until cancel, false = one-shot timer.
|
|
5482
|
+
|
|
5483
|
+
*/
|
|
5484
|
+
export function get_info(handle: hash): any
|
|
5485
|
+
|
|
4988
5486
|
/**
|
|
4989
5487
|
* Manual triggering a callback for a timer.
|
|
4990
5488
|
* @param handle the timer handle returned by timer.delay()
|
|
@@ -5611,6 +6109,14 @@ True if resource were loaded successfully
|
|
|
5611
6109
|
*/
|
|
5612
6110
|
export function load(url?: string | hash | url, complete_function?: any): void
|
|
5613
6111
|
|
|
6112
|
+
/**
|
|
6113
|
+
* Changes the prototype for the collection factory.
|
|
6114
|
+
* Setting the prototype to "nil" will revert back to the original prototype.
|
|
6115
|
+
* @param url the collection factory component
|
|
6116
|
+
* @param prototype the path to the new prototype, or nil
|
|
6117
|
+
*/
|
|
6118
|
+
export function set_prototype(url?: string | hash | url, prototype?: any): void
|
|
6119
|
+
|
|
5614
6120
|
/**
|
|
5615
6121
|
* This decreases the reference count for each resource loaded with collectionfactory.load. If reference is zero, the resource is destroyed.
|
|
5616
6122
|
* Calling this function when the factory is not marked as dynamic loading does nothing.
|
|
@@ -5631,6 +6137,31 @@ declare namespace collectionproxy {
|
|
|
5631
6137
|
*/
|
|
5632
6138
|
export type async_load = "async_load"
|
|
5633
6139
|
|
|
6140
|
+
/**
|
|
6141
|
+
* return an indexed table of resources for a collection proxy. Each
|
|
6142
|
+
* entry is a hexadecimal string that represents the data of the specific
|
|
6143
|
+
* resource. This representation corresponds with the filename for each
|
|
6144
|
+
* individual resource that is exported when you bundle an application with
|
|
6145
|
+
* LiveUpdate functionality.
|
|
6146
|
+
* @param collectionproxy the collectionproxy to check for resources.
|
|
6147
|
+
* @return resources the resources
|
|
6148
|
+
*/
|
|
6149
|
+
export function get_resources(collectionproxy: url): any
|
|
6150
|
+
|
|
6151
|
+
/**
|
|
6152
|
+
* return an array of missing resources for a collection proxy. Each
|
|
6153
|
+
* entry is a hexadecimal string that represents the data of the specific
|
|
6154
|
+
* resource. This representation corresponds with the filename for each
|
|
6155
|
+
* individual resource that is exported when you bundle an application with
|
|
6156
|
+
* LiveUpdate functionality. It should be considered good practise to always
|
|
6157
|
+
* check whether or not there are any missing resources in a collection proxy
|
|
6158
|
+
* before attempting to load the collection proxy.
|
|
6159
|
+
* @param collectionproxy the collectionproxy to check for missing
|
|
6160
|
+
resources.
|
|
6161
|
+
* @return resources the missing resources
|
|
6162
|
+
*/
|
|
6163
|
+
export function missing_resources(collectionproxy: url): any
|
|
6164
|
+
|
|
5634
6165
|
/**
|
|
5635
6166
|
* Post this message to a collection-proxy-component to disable the referenced collection, which in turn disables the contained game objects and components.
|
|
5636
6167
|
*/
|
|
@@ -5758,6 +6289,13 @@ True if resources were loaded successfully
|
|
|
5758
6289
|
*/
|
|
5759
6290
|
export function load(url?: string | hash | url, complete_function?: any): void
|
|
5760
6291
|
|
|
6292
|
+
/**
|
|
6293
|
+
* Changes the prototype for the factory.
|
|
6294
|
+
* @param url the factory component
|
|
6295
|
+
* @param prototype the path to the new prototype, or nil
|
|
6296
|
+
*/
|
|
6297
|
+
export function set_prototype(url?: string | hash | url, prototype?: any): void
|
|
6298
|
+
|
|
5761
6299
|
/**
|
|
5762
6300
|
* This decreases the reference count for each resource loaded with factory.load. If reference is zero, the resource is destroyed.
|
|
5763
6301
|
* Calling this function when the factory is not marked as dynamic loading does nothing.
|
|
@@ -5797,6 +6335,19 @@ declare namespace label {
|
|
|
5797
6335
|
*/
|
|
5798
6336
|
export function set_text(url: string | hash | url, text: string): void
|
|
5799
6337
|
|
|
6338
|
+
/**
|
|
6339
|
+
* The leading of the label. This value is used to scale the line spacing of text.
|
|
6340
|
+
* The type of the property is number.
|
|
6341
|
+
*/
|
|
6342
|
+
export let leading: any
|
|
6343
|
+
|
|
6344
|
+
/**
|
|
6345
|
+
* The line break of the label.
|
|
6346
|
+
* This value is used to adjust the vertical spacing of characters in the text.
|
|
6347
|
+
* The type of the property is boolean.
|
|
6348
|
+
*/
|
|
6349
|
+
export let line_break: any
|
|
6350
|
+
|
|
5800
6351
|
/**
|
|
5801
6352
|
* The material used when rendering the label. The type of the property is hash.
|
|
5802
6353
|
*/
|
|
@@ -5824,6 +6375,13 @@ declare namespace label {
|
|
|
5824
6375
|
*/
|
|
5825
6376
|
export let size: any
|
|
5826
6377
|
|
|
6378
|
+
/**
|
|
6379
|
+
* The tracking of the label.
|
|
6380
|
+
* This value is used to adjust the vertical spacing of characters in the text.
|
|
6381
|
+
* The type of the property is number.
|
|
6382
|
+
*/
|
|
6383
|
+
export let tracking: any
|
|
6384
|
+
|
|
5827
6385
|
}
|
|
5828
6386
|
// =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
|
|
5829
6387
|
|
|
@@ -6288,6 +6846,11 @@ declare namespace sprite {
|
|
|
6288
6846
|
*/
|
|
6289
6847
|
export let cursor: any
|
|
6290
6848
|
|
|
6849
|
+
/**
|
|
6850
|
+
* READ ONLY The frame count of the currently playing animation.
|
|
6851
|
+
*/
|
|
6852
|
+
export let frame_count: any
|
|
6853
|
+
|
|
6291
6854
|
/**
|
|
6292
6855
|
* The image used when rendering the sprite. The type of the property is hash.
|
|
6293
6856
|
*/
|
|
@@ -6315,8 +6878,9 @@ declare namespace sprite {
|
|
|
6315
6878
|
export let scale: any
|
|
6316
6879
|
|
|
6317
6880
|
/**
|
|
6318
|
-
*
|
|
6319
|
-
* The type of the property is vector3.
|
|
6881
|
+
* The size of the sprite, not allowing for any additional scaling that may be applied.
|
|
6882
|
+
* The type of the property is vector3. It is not possible to set the size if the size mode
|
|
6883
|
+
* of the sprite is set to auto.
|
|
6320
6884
|
*/
|
|
6321
6885
|
export let size: any
|
|
6322
6886
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-defold/types",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.21",
|
|
4
4
|
"description": "TypeScript definitions for Defold",
|
|
5
5
|
"repository": "github:ts-defold/types",
|
|
6
6
|
"keywords": [
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"lua-types": "^2.10.1"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@ts-defold/type-gen": "^0.5.
|
|
31
|
-
"typescript": "
|
|
32
|
-
"typescript-to-lua": "
|
|
30
|
+
"@ts-defold/type-gen": "^0.5.3",
|
|
31
|
+
"typescript": "~5.1.0",
|
|
32
|
+
"typescript-to-lua": "~1.16.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"typescript-to-lua": "^1.0
|
|
35
|
+
"typescript-to-lua": "^1.10.0"
|
|
36
36
|
}
|
|
37
37
|
}
|