@ts-defold/types 1.2.40 → 1.2.41
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 +131 -27
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// <reference types="lua-types/5.1" />
|
|
3
3
|
/// <reference types="@typescript-to-lua/language-extensions" />
|
|
4
4
|
|
|
5
|
-
// DEFOLD. stable version 1.
|
|
5
|
+
// DEFOLD. stable version 1.7.0 (bf4dc66ab5fbbafd4294d32c2797c08b630c0be5)
|
|
6
6
|
// =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
|
|
7
7
|
|
|
8
8
|
|
|
@@ -912,6 +912,22 @@ name of internal property
|
|
|
912
912
|
*/
|
|
913
913
|
export function set_scale(scale: number | vmath.vector3, id?: string | hash | url): void
|
|
914
914
|
|
|
915
|
+
/**
|
|
916
|
+
* ⚠ The function uses world transformation calculated at the end of previous frame.
|
|
917
|
+
* @param position position which need to be converted
|
|
918
|
+
* @param url url of the game object which coordinate system convert to
|
|
919
|
+
* @return converted_postion converted position
|
|
920
|
+
*/
|
|
921
|
+
export function world_to_local_position(position: vmath.vector3, url: string | hash | url): vmath.vector3
|
|
922
|
+
|
|
923
|
+
/**
|
|
924
|
+
* ⚠ The function uses world transformation calculated at the end of previous frame.
|
|
925
|
+
* @param transformation transformation which need to be converted
|
|
926
|
+
* @param url url of the game object which coordinate system convert to
|
|
927
|
+
* @return converted_transform converted transformation
|
|
928
|
+
*/
|
|
929
|
+
export function world_to_local_transform(transformation: vmath.matrix4, url: string | hash | url): vmath.matrix4
|
|
930
|
+
|
|
915
931
|
|
|
916
932
|
|
|
917
933
|
|
|
@@ -1022,6 +1038,11 @@ declare namespace gui {
|
|
|
1022
1038
|
*/
|
|
1023
1039
|
export let BLEND_MULT: any
|
|
1024
1040
|
|
|
1041
|
+
/**
|
|
1042
|
+
* screen blending
|
|
1043
|
+
*/
|
|
1044
|
+
export let BLEND_SCREEN: any
|
|
1045
|
+
|
|
1025
1046
|
/**
|
|
1026
1047
|
* clipping mode none
|
|
1027
1048
|
*/
|
|
@@ -1567,6 +1588,7 @@ with a custom curve. See the animation guide for more information.
|
|
|
1567
1588
|
- `gui.BLEND_ADD`
|
|
1568
1589
|
- `gui.BLEND_ADD_ALPHA`
|
|
1569
1590
|
- `gui.BLEND_MULT`
|
|
1591
|
+
- `gui.BLEND_SCREEN`
|
|
1570
1592
|
|
|
1571
1593
|
*/
|
|
1572
1594
|
export function get_blend_mode(node: node): any
|
|
@@ -2013,7 +2035,7 @@ with a custom curve. See the animation guide for more information.
|
|
|
2013
2035
|
|
|
2014
2036
|
/**
|
|
2015
2037
|
* Dynamically create a new texture.
|
|
2016
|
-
* @param
|
|
2038
|
+
* @param texture_id texture id
|
|
2017
2039
|
* @param width texture width
|
|
2018
2040
|
* @param height texture height
|
|
2019
2041
|
* @param type texture type
|
|
@@ -2027,7 +2049,7 @@ with a custom curve. See the animation guide for more information.
|
|
|
2027
2049
|
* @return success texture creation was successful
|
|
2028
2050
|
* @return code one of the gui.RESULT_* codes if unsuccessful
|
|
2029
2051
|
*/
|
|
2030
|
-
export function new_texture(
|
|
2052
|
+
export function new_texture(texture_id: string | hash, width: number, height: number, type: any, buffer: string, flip: boolean): LuaMultiReturn<[boolean, number]>
|
|
2031
2053
|
|
|
2032
2054
|
/**
|
|
2033
2055
|
* Tests whether a coordinate is within the bounding box of a
|
|
@@ -2146,6 +2168,7 @@ the new state of the emitter:
|
|
|
2146
2168
|
- `gui.BLEND_ADD`
|
|
2147
2169
|
- `gui.BLEND_ADD_ALPHA`
|
|
2148
2170
|
- `gui.BLEND_MULT`
|
|
2171
|
+
- `gui.BLEND_SCREEN`
|
|
2149
2172
|
|
|
2150
2173
|
*/
|
|
2151
2174
|
export function set_blend_mode(node: node, blend_mode: any): void
|
|
@@ -3562,7 +3585,8 @@ declare namespace render {
|
|
|
3562
3585
|
export function constant_buffer(): any
|
|
3563
3586
|
|
|
3564
3587
|
/**
|
|
3565
|
-
* Deletes a
|
|
3588
|
+
* Deletes a render target created by a render script.
|
|
3589
|
+
* You cannot delete a render target resource.
|
|
3566
3590
|
* @param render_target render target to delete
|
|
3567
3591
|
*/
|
|
3568
3592
|
export function delete_render_target(render_target: any): void
|
|
@@ -3589,10 +3613,10 @@ declare namespace render {
|
|
|
3589
3613
|
export function disable_state(state: any): void
|
|
3590
3614
|
|
|
3591
3615
|
/**
|
|
3592
|
-
* Disables a texture
|
|
3593
|
-
* @param
|
|
3616
|
+
* Disables a texture that has previourly been enabled.
|
|
3617
|
+
* @param binding texture binding, either by texture unit, string or hash that should be disabled
|
|
3594
3618
|
*/
|
|
3595
|
-
export function disable_texture(
|
|
3619
|
+
export function disable_texture(binding: number | string | hash): void
|
|
3596
3620
|
|
|
3597
3621
|
/**
|
|
3598
3622
|
* Draws all objects that match a specified predicate. An optional constant buffer can be
|
|
@@ -3658,11 +3682,19 @@ Determines which sides of the frustum will be used. Default is render.FRUSTUM_PL
|
|
|
3658
3682
|
export function enable_state(state: any): void
|
|
3659
3683
|
|
|
3660
3684
|
/**
|
|
3661
|
-
* Sets the specified render target
|
|
3662
|
-
* used
|
|
3663
|
-
*
|
|
3664
|
-
*
|
|
3665
|
-
*
|
|
3685
|
+
* Sets the specified texture handle for a render target attachment or a regular texture
|
|
3686
|
+
* that should be used for rendering. The texture can be bound to either a texture unit
|
|
3687
|
+
* or to a sampler name by a hash or a string.
|
|
3688
|
+
* A texture can be bound to multiple units and sampler names at the same time,
|
|
3689
|
+
* the actual binding will be applied to the shaders when a shader program is bound.
|
|
3690
|
+
* When mixing binding using both units and sampler names, you might end up in situations
|
|
3691
|
+
* where two different textures will be applied to the same bind location in the shader.
|
|
3692
|
+
* In this case, the texture set to the named sampler will take precedence over the unit.
|
|
3693
|
+
* Note that you can bind multiple sampler names to the same texture, in case you want to reuse
|
|
3694
|
+
* the same texture for differnt use-cases. It is however recommended that you use the same name
|
|
3695
|
+
* everywhere for the textures that should be shared across different materials.
|
|
3696
|
+
* @param binding texture binding, either by texture unit, string or hash for the sampler name that the texture should be bound to
|
|
3697
|
+
* @param handle_or_name render target or texture handle that should be bound, or a named resource in the "Render Resource" table in the currently assigned .render file
|
|
3666
3698
|
* @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`. These values are supported:
|
|
3667
3699
|
|
|
3668
3700
|
- `render.BUFFER_COLOR_BIT`
|
|
@@ -3681,7 +3713,7 @@ to enable those textures as well. Currently 4 color attachments are supported:
|
|
|
3681
3713
|
- `render.BUFFER_COLOR3_BIT`
|
|
3682
3714
|
|
|
3683
3715
|
*/
|
|
3684
|
-
export function enable_texture(
|
|
3716
|
+
export function enable_texture(binding: number | string | hash, handle_or_name: any, buffer_type?: any): void
|
|
3685
3717
|
|
|
3686
3718
|
/**
|
|
3687
3719
|
* Returns the logical window height that is set in the "game.project" settings.
|
|
@@ -4004,6 +4036,7 @@ to enable those textures as well. Currently 4 color attachments are supported:
|
|
|
4004
4036
|
/**
|
|
4005
4037
|
* Sets a render target. Subsequent draw operations will be to the
|
|
4006
4038
|
* render target until it is replaced by a subsequent call to set_render_target.
|
|
4039
|
+
* This function supports render targets created by a render script, or a render target resource.
|
|
4007
4040
|
* @param render_target render target to set. render.RENDER_TARGET_DEFAULT to set the default render target
|
|
4008
4041
|
* @param options optional table with behaviour parameters
|
|
4009
4042
|
|
|
@@ -4021,7 +4054,8 @@ Transient frame buffer types are only valid while the render target is active, i
|
|
|
4021
4054
|
export function set_render_target(render_target: any, options?: any): void
|
|
4022
4055
|
|
|
4023
4056
|
/**
|
|
4024
|
-
*
|
|
4057
|
+
* Sets the render target size for a render target created from
|
|
4058
|
+
* either a render script, or from a render target resource.
|
|
4025
4059
|
* @param render_target render target to set size for
|
|
4026
4060
|
* @param width new render target width
|
|
4027
4061
|
* @param height new render target height
|
|
@@ -4439,6 +4473,7 @@ optional flag to determine wether or not the resource should take over ownership
|
|
|
4439
4473
|
* registered will trigger an error. If the intention is to instead modify an existing texture, use the resource.set_texture
|
|
4440
4474
|
* function. Also note that the path to the new texture resource must have a '.texturec' extension,
|
|
4441
4475
|
* meaning "/path/my_texture" is not a valid path but "/path/my_texture.texturec" is.
|
|
4476
|
+
* If the texture is created without a buffer, the pixel data will be blank.
|
|
4442
4477
|
* @param path The path to the resource.
|
|
4443
4478
|
* @param table A table containing info about how to create the texture. Supported entries:
|
|
4444
4479
|
|
|
@@ -4451,9 +4486,9 @@ The texture type. Supported values:
|
|
|
4451
4486
|
|
|
4452
4487
|
|
|
4453
4488
|
`width`
|
|
4454
|
-
The width of the texture (in pixels)
|
|
4489
|
+
The width of the texture (in pixels). Must be larger than 0.
|
|
4455
4490
|
`height`
|
|
4456
|
-
The width of the texture (in pixels)
|
|
4491
|
+
The width of the texture (in pixels). Must be larger than 0.
|
|
4457
4492
|
`format`
|
|
4458
4493
|
The texture format, note that some of these formats might not be supported by the running device. Supported values:
|
|
4459
4494
|
|
|
@@ -4463,6 +4498,7 @@ The texture format, note that some of these formats might not be supported by th
|
|
|
4463
4498
|
- `resource.TEXTURE_FORMAT_RGBA`
|
|
4464
4499
|
|
|
4465
4500
|
These constants might not be available on the device:
|
|
4501
|
+
|
|
4466
4502
|
- `resource.TEXTURE_FORMAT_RGB_PVRTC_2BPPV1`
|
|
4467
4503
|
- `resource.TEXTURE_FORMAT_RGB_PVRTC_4BPPV1`
|
|
4468
4504
|
- `resource.TEXTURE_FORMAT_RGBA_PVRTC_2BPPV1`
|
|
@@ -4483,6 +4519,7 @@ These constants might not be available on the device:
|
|
|
4483
4519
|
- `resource.TEXTURE_FORMAT_RG16F`
|
|
4484
4520
|
- `resource.TEXTURE_FORMAT_R32F`
|
|
4485
4521
|
- `resource.TEXTURE_FORMAT_RG32F`
|
|
4522
|
+
|
|
4486
4523
|
You can test if the device supports these values by checking if a specific enum is nil or not:
|
|
4487
4524
|
`if resource.TEXTURE_FORMAT_RGBA16F ~= nil then
|
|
4488
4525
|
-- it is safe to use this format
|
|
@@ -4537,6 +4574,48 @@ See resource.set_atlas for a detailed description of each field
|
|
|
4537
4574
|
*/
|
|
4538
4575
|
export function get_buffer(path: hash | string): buffer
|
|
4539
4576
|
|
|
4577
|
+
/**
|
|
4578
|
+
* Gets render target info from a render target resource path or a render target handle
|
|
4579
|
+
* @param path The path to the resource or a render target handle
|
|
4580
|
+
* @return table A table containing info about the render target:
|
|
4581
|
+
|
|
4582
|
+
`handle`
|
|
4583
|
+
the opaque handle to the texture resource
|
|
4584
|
+
'attachments'
|
|
4585
|
+
a table of attachments, where each attachment contains the following entries:
|
|
4586
|
+
`handle`
|
|
4587
|
+
the opaque handle to the texture resource
|
|
4588
|
+
`width`
|
|
4589
|
+
width of the texture
|
|
4590
|
+
`height`
|
|
4591
|
+
height of the texture
|
|
4592
|
+
`depth`
|
|
4593
|
+
depth of the texture (i.e 1 for a 2D texture and 6 for a cube map)
|
|
4594
|
+
`mipmaps`
|
|
4595
|
+
number of mipmaps of the texture
|
|
4596
|
+
`type`
|
|
4597
|
+
The texture type. Supported values:
|
|
4598
|
+
|
|
4599
|
+
|
|
4600
|
+
- `resource.TEXTURE_TYPE_2D`
|
|
4601
|
+
- `resource.TEXTURE_TYPE_CUBE_MAP`
|
|
4602
|
+
- `resource.TEXTURE_TYPE_2D_ARRAY`
|
|
4603
|
+
|
|
4604
|
+
|
|
4605
|
+
`buffer_type`
|
|
4606
|
+
The attachment buffer type. Supported values:
|
|
4607
|
+
|
|
4608
|
+
|
|
4609
|
+
- `resource.BUFFER_TYPE_COLOR0`
|
|
4610
|
+
- `resource.BUFFER_TYPE_COLOR1`
|
|
4611
|
+
- `resource.BUFFER_TYPE_COLOR2`
|
|
4612
|
+
- `resource.BUFFER_TYPE_COLOR3`
|
|
4613
|
+
- `resource.BUFFER_TYPE_DEPTH`
|
|
4614
|
+
- `resource.BUFFER_TYPE_STENCIL`
|
|
4615
|
+
|
|
4616
|
+
*/
|
|
4617
|
+
export function get_render_target_info(path: any): any
|
|
4618
|
+
|
|
4540
4619
|
/**
|
|
4541
4620
|
* Gets the text metrics from a font
|
|
4542
4621
|
* @param url the font to get the (unscaled) metrics from
|
|
@@ -5609,9 +5688,9 @@ The response data. Contains the fields:
|
|
|
5609
5688
|
* @param options optional table with request parameters. Supported entries:
|
|
5610
5689
|
|
|
5611
5690
|
`timeout`: timeout in seconds
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5691
|
+
Not available in HTML5 build
|
|
5692
|
+
Not available in HTML5 build
|
|
5693
|
+
Not available in HTML5 build
|
|
5615
5694
|
|
|
5616
5695
|
*/
|
|
5617
5696
|
export function request(url: string, method: string, callback: any, headers?: any, post_data?: string, options?: any): void
|
|
@@ -5645,7 +5724,13 @@ declare namespace image {
|
|
|
5645
5724
|
/**
|
|
5646
5725
|
* Load image (PNG or JPEG) from buffer.
|
|
5647
5726
|
* @param buffer image data buffer
|
|
5648
|
-
* @param
|
|
5727
|
+
* @param options An optional table containing parameters for loading the image. Supported entries:
|
|
5728
|
+
|
|
5729
|
+
`premultiply_alpha`
|
|
5730
|
+
True if alpha should be premultiplied into the color components. Defaults to `false`.
|
|
5731
|
+
`flip_vertically`
|
|
5732
|
+
True if the image contents should be flipped vertically. Defaults to `false`.
|
|
5733
|
+
|
|
5649
5734
|
* @return image object or `nil` if loading fails. The object is a table with the following fields:
|
|
5650
5735
|
|
|
5651
5736
|
`width`: image width
|
|
@@ -5660,12 +5745,18 @@ declare namespace image {
|
|
|
5660
5745
|
`buffer`: the raw image data
|
|
5661
5746
|
|
|
5662
5747
|
*/
|
|
5663
|
-
export function load(buffer: string,
|
|
5748
|
+
export function load(buffer: string, options?: any): LuaMultiReturn<[any, any]>
|
|
5664
5749
|
|
|
5665
5750
|
/**
|
|
5666
5751
|
* Load image (PNG or JPEG) from a string buffer.
|
|
5667
5752
|
* @param buffer image data buffer
|
|
5668
|
-
* @param
|
|
5753
|
+
* @param options An optional table containing parameters for loading the image. Supported entries:
|
|
5754
|
+
|
|
5755
|
+
`premultiply_alpha`
|
|
5756
|
+
True if alpha should be premultiplied into the color components. Defaults to `false`.
|
|
5757
|
+
`flip_vertically`
|
|
5758
|
+
True if the image contents should be flipped vertically. Defaults to `false`.
|
|
5759
|
+
|
|
5669
5760
|
* @return image object or `nil` if loading fails. The object is a table with the following fields:
|
|
5670
5761
|
|
|
5671
5762
|
`width`: image width
|
|
@@ -5680,7 +5771,7 @@ declare namespace image {
|
|
|
5680
5771
|
`buffer`: the script buffer that holds the decompressed image data. See buffer.create how to use the buffer.
|
|
5681
5772
|
|
|
5682
5773
|
*/
|
|
5683
|
-
export function load_buffer(buffer: string,
|
|
5774
|
+
export function load_buffer(buffer: string, options?: any): LuaMultiReturn<[any, any]>
|
|
5684
5775
|
|
|
5685
5776
|
}
|
|
5686
5777
|
// =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
|
|
@@ -6350,6 +6441,18 @@ declare namespace camera {
|
|
|
6350
6441
|
*/
|
|
6351
6442
|
export let aspect_ratio: any
|
|
6352
6443
|
|
|
6444
|
+
/**
|
|
6445
|
+
* makes camera active
|
|
6446
|
+
* @param url url of camera component
|
|
6447
|
+
*/
|
|
6448
|
+
export function acquire_focus(url: string | hash | url): void
|
|
6449
|
+
|
|
6450
|
+
/**
|
|
6451
|
+
* deactivate camera
|
|
6452
|
+
* @param url url of camera component
|
|
6453
|
+
*/
|
|
6454
|
+
export function release_focus(url: string | hash | url): void
|
|
6455
|
+
|
|
6353
6456
|
/**
|
|
6354
6457
|
* Camera frustum far plane.
|
|
6355
6458
|
* The type of the property is float.
|
|
@@ -6996,6 +7099,7 @@ declare namespace sound {
|
|
|
6996
7099
|
* Inversely, to find the linear value from a dB value, use the formula
|
|
6997
7100
|
* `10db/20`.
|
|
6998
7101
|
* ⚠ A sound will continue to play even if the game object the sound component belonged to is deleted. You can send a `stop_sound` to stop the sound.
|
|
7102
|
+
* ⚠ `play_id` should be specified in case you want to receive `sound_done` or `sound_stopped` in `on_message()`.
|
|
6999
7103
|
*/
|
|
7000
7104
|
export type play_sound = "play_sound"
|
|
7001
7105
|
|
|
@@ -7140,7 +7244,7 @@ Information about the completion:
|
|
|
7140
7244
|
`sender`
|
|
7141
7245
|
The invoker of the callback: the sound component.
|
|
7142
7246
|
|
|
7143
|
-
* @return
|
|
7247
|
+
* @return play_id The identifier for the sound voice
|
|
7144
7248
|
*/
|
|
7145
7249
|
export function play(url: string | hash | url, play_properties?: any, complete_function?: any): number
|
|
7146
7250
|
|
|
@@ -7186,14 +7290,14 @@ the sequential play identifier that should be stopped (was given by the sound.pl
|
|
|
7186
7290
|
export function stop(url: string | hash | url, stop_properties?: any): void
|
|
7187
7291
|
|
|
7188
7292
|
/**
|
|
7189
|
-
* This message is sent back to the sender of a `play_sound` message
|
|
7190
|
-
* could be played to completion.
|
|
7293
|
+
* This message is sent back to the sender of a `play_sound` message
|
|
7294
|
+
* if the sound could be played to completion and a `play_id` was provided with the `play_sound` message.
|
|
7191
7295
|
*/
|
|
7192
7296
|
export type sound_done = "sound_done"
|
|
7193
7297
|
|
|
7194
7298
|
/**
|
|
7195
7299
|
* This message is sent back to the sender of a `play_sound` message, if the sound
|
|
7196
|
-
* has been manually stopped.
|
|
7300
|
+
* has been manually stopped and a `play_id` was provided with the `play_sound` message.
|
|
7197
7301
|
*/
|
|
7198
7302
|
export type sound_stopped = "sound_stopped"
|
|
7199
7303
|
|