@ts-defold/types 1.2.3 → 1.2.7
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/index.d.ts +85 -185
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Defold Types
|
|
2
|
-
<a href="https://discord.gg/eukcq5m"><img alt="Chat with us!" src="https://img.shields.io/discord/766898804896038942.svg?colorB=7581dc&logo=discord&logoColor=white"></a>
|
|
3
2
|
<a href="https://www.npmjs.com/package/@ts-defold/type-gen"><img alt="npm install" src="https://img.shields.io/npm/dt/@ts-defold/types?color=%23CA0000&label=npm&logo=npm"></a>
|
|
3
|
+
<a href="https://discord.gg/eukcq5m"><img alt="Chat with us!" src="https://img.shields.io/discord/766898804896038942.svg?colorB=7581dc&logo=discord&logoColor=white"></a>
|
|
4
4
|
> TypeScript definitions for [Defold](https://defold.com/)
|
|
5
5
|
|
|
6
6
|
## Installation
|
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.2.
|
|
5
|
+
// DEFOLD. stable version 1.2.190 (d31d6397a72178541a5ef6e7ef2bed090d828f58)
|
|
6
6
|
// =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
|
|
7
7
|
|
|
8
8
|
|
|
@@ -682,7 +682,8 @@ declare namespace go {
|
|
|
682
682
|
* By starting a new animation in that function, several animations can be sequenced together. See the examples for more information.
|
|
683
683
|
* ⚠ If you call `go.animate()` from a game object's `final()` function,
|
|
684
684
|
* any passed `complete_function` will be ignored and never called upon animation completion.
|
|
685
|
-
* See the properties guide for which properties can be animated and the animation guide for how
|
|
685
|
+
* See the properties guide for which properties can be animated and the animation guide for how
|
|
686
|
+
* them.
|
|
686
687
|
* @param url url of the game object or component having the property
|
|
687
688
|
* @param property id of the property to animate
|
|
688
689
|
* @param playback playback mode of the animation
|
|
@@ -720,7 +721,7 @@ The id of the animated property.
|
|
|
720
721
|
* By calling this function, all stored animations of the given property will be canceled.
|
|
721
722
|
* See the properties guide for which properties can be animated and the animation guide for how to animate them.
|
|
722
723
|
* @param url url of the game object or component having the property
|
|
723
|
-
* @param property
|
|
724
|
+
* @param property id of the property to cancel
|
|
724
725
|
*/
|
|
725
726
|
export function cancel_animations(url: string | hash | url, property: string | hash): void
|
|
726
727
|
|
|
@@ -741,9 +742,12 @@ The id of the animated property.
|
|
|
741
742
|
* gets a named property of the specified game object or component
|
|
742
743
|
* @param url url of the game object or component having the property
|
|
743
744
|
* @param property id of the property to retrieve
|
|
745
|
+
* @param options (optional) options table
|
|
746
|
+
index into array property (1 based)
|
|
747
|
+
name of internal property
|
|
744
748
|
* @return value the value of the specified property
|
|
745
749
|
*/
|
|
746
|
-
export function get(url: string | hash | url, property: string | hash): any
|
|
750
|
+
export function get(url: string | hash | url, property: string | hash, options: any): any
|
|
747
751
|
|
|
748
752
|
/**
|
|
749
753
|
* Returns or constructs an instance identifier. The instance id is a hash
|
|
@@ -847,8 +851,11 @@ The id of the animated property.
|
|
|
847
851
|
* @param url url of the game object or component having the property
|
|
848
852
|
* @param property id of the property to set
|
|
849
853
|
* @param value the value to set
|
|
854
|
+
* @param options (optional) options table
|
|
855
|
+
index into array property (1 based)
|
|
856
|
+
name of internal property
|
|
850
857
|
*/
|
|
851
|
-
export function set(url: string | hash | url, property: string | hash, value: any): void
|
|
858
|
+
export function set(url: string | hash | url, property: string | hash, value: any, options: any): void
|
|
852
859
|
|
|
853
860
|
/**
|
|
854
861
|
* Sets the parent for a game object instance. This means that the instance will exist in the geometrical space of its parent,
|
|
@@ -929,6 +936,12 @@ The id of the animated property.
|
|
|
929
936
|
declare namespace gui {
|
|
930
937
|
|
|
931
938
|
|
|
939
|
+
/**
|
|
940
|
+
* The fonts used in the gui. The type of the property is hash.
|
|
941
|
+
* Key must be specified in options table.
|
|
942
|
+
*/
|
|
943
|
+
export let fonts: any
|
|
944
|
+
|
|
932
945
|
/**
|
|
933
946
|
* fit adjust mode
|
|
934
947
|
*/
|
|
@@ -1522,6 +1535,12 @@ with a custom curve. See the animation guide for more information.
|
|
|
1522
1535
|
*/
|
|
1523
1536
|
export function get_adjust_mode(node: node): any
|
|
1524
1537
|
|
|
1538
|
+
/**
|
|
1539
|
+
* gets the node alpha
|
|
1540
|
+
* @param node node from which to get alpha
|
|
1541
|
+
*/
|
|
1542
|
+
export function get_alpha(node: node): void
|
|
1543
|
+
|
|
1525
1544
|
/**
|
|
1526
1545
|
* Returns the blend mode of a node.
|
|
1527
1546
|
* Blend mode defines how the node will be blended with the background.
|
|
@@ -1630,6 +1649,13 @@ with a custom curve. See the animation guide for more information.
|
|
|
1630
1649
|
*/
|
|
1631
1650
|
export function get_font(node: node): hash
|
|
1632
1651
|
|
|
1652
|
+
/**
|
|
1653
|
+
* This is only useful for text nodes. The font must be mapped to the gui scene in the gui editor.
|
|
1654
|
+
* @param font_name font of which to get the path hash
|
|
1655
|
+
* @return hash path hash to resource
|
|
1656
|
+
*/
|
|
1657
|
+
export function get_font_resource(font_name: hash | string): hash
|
|
1658
|
+
|
|
1633
1659
|
/**
|
|
1634
1660
|
* Returns the scene height.
|
|
1635
1661
|
* @return height scene height
|
|
@@ -1883,37 +1909,6 @@ with a custom curve. See the animation guide for more information.
|
|
|
1883
1909
|
*/
|
|
1884
1910
|
export function get_text(node: node): string
|
|
1885
1911
|
|
|
1886
|
-
/**
|
|
1887
|
-
* Get text metrics given the provided font, text and parameters.
|
|
1888
|
-
* @param font font id
|
|
1889
|
-
* @param text text to measure
|
|
1890
|
-
* @param width max-width. Use for line-breaks (default=FLT_MAX)
|
|
1891
|
-
* @param line_break true to break lines accordingly to width (default=false)
|
|
1892
|
-
* @param leading scale value for line spacing (default=1)
|
|
1893
|
-
* @param tracking scale value for letter spacing (default=0)
|
|
1894
|
-
* @return metrics a table with the following fields:
|
|
1895
|
-
|
|
1896
|
-
- width
|
|
1897
|
-
- height
|
|
1898
|
-
- max_ascent
|
|
1899
|
-
- max_descent
|
|
1900
|
-
|
|
1901
|
-
*/
|
|
1902
|
-
export function get_text_metrics(font: string | hash, text: string, width: number, line_break: boolean, leading: number, tracking: number): any
|
|
1903
|
-
|
|
1904
|
-
/**
|
|
1905
|
-
* Get the text metrics from a text node.
|
|
1906
|
-
* @param node text node to measure text from
|
|
1907
|
-
* @return metrics a table with the following fields:
|
|
1908
|
-
|
|
1909
|
-
- width
|
|
1910
|
-
- height
|
|
1911
|
-
- max_ascent
|
|
1912
|
-
- max_descent
|
|
1913
|
-
|
|
1914
|
-
*/
|
|
1915
|
-
export function get_text_metrics_from_node(node: node): any
|
|
1916
|
-
|
|
1917
1912
|
/**
|
|
1918
1913
|
* Returns the texture of a node.
|
|
1919
1914
|
* This is currently only useful for box or pie nodes.
|
|
@@ -2162,6 +2157,13 @@ The rate with which the animation will be played. Must be positive
|
|
|
2162
2157
|
*/
|
|
2163
2158
|
export function set_adjust_mode(node: node, adjust_mode: any): void
|
|
2164
2159
|
|
|
2160
|
+
/**
|
|
2161
|
+
* sets the node alpha
|
|
2162
|
+
* @param node node for which to set alpha
|
|
2163
|
+
* @param alpha 0..1 alpha color
|
|
2164
|
+
*/
|
|
2165
|
+
export function set_alpha(node: node, alpha: number): void
|
|
2166
|
+
|
|
2165
2167
|
/**
|
|
2166
2168
|
* Set the blend mode of a node.
|
|
2167
2169
|
* Blend mode defines how the node will be blended with the background.
|
|
@@ -2586,6 +2588,12 @@ The rate with which the animation will be played. Must be positive
|
|
|
2586
2588
|
|
|
2587
2589
|
|
|
2588
2590
|
|
|
2591
|
+
/**
|
|
2592
|
+
* The textures used in the gui. The type of the property is hash.
|
|
2593
|
+
* Key must be specified in options table.
|
|
2594
|
+
*/
|
|
2595
|
+
export let textures: any
|
|
2596
|
+
|
|
2589
2597
|
|
|
2590
2598
|
}
|
|
2591
2599
|
// =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= //
|
|
@@ -3945,6 +3953,30 @@ declare namespace resource {
|
|
|
3945
3953
|
*/
|
|
3946
3954
|
export function get_current_manifest(): number
|
|
3947
3955
|
|
|
3956
|
+
/**
|
|
3957
|
+
* Gets the text metrics from a font
|
|
3958
|
+
* @param url the font to get the (unscaled) metrics from
|
|
3959
|
+
* @param options A table containing parameters for the text. Supported entries:
|
|
3960
|
+
|
|
3961
|
+
`width`
|
|
3962
|
+
The width of the text field. Not used if `line_break` is false.
|
|
3963
|
+
`leading`
|
|
3964
|
+
The leading (default 1.0)
|
|
3965
|
+
`tracking`
|
|
3966
|
+
The leading (default 0.0)
|
|
3967
|
+
`line_break`
|
|
3968
|
+
If the calculation should consider line breaks (default false)
|
|
3969
|
+
|
|
3970
|
+
* @return metrics a table with the following fields:
|
|
3971
|
+
|
|
3972
|
+
- width
|
|
3973
|
+
- height
|
|
3974
|
+
- max_ascent
|
|
3975
|
+
- max_descent
|
|
3976
|
+
|
|
3977
|
+
*/
|
|
3978
|
+
export function get_text_metrics(url: hash, options: any): any
|
|
3979
|
+
|
|
3948
3980
|
/**
|
|
3949
3981
|
* Is any liveupdate data mounted and currently in use?
|
|
3950
3982
|
* This can be used to determine if a new manifest or zip file should be downloaded.
|
|
@@ -4192,6 +4224,13 @@ declare namespace sys {
|
|
|
4192
4224
|
*/
|
|
4193
4225
|
export let NETWORK_DISCONNECTED: any
|
|
4194
4226
|
|
|
4227
|
+
/**
|
|
4228
|
+
* deserializes buffer into a lua table
|
|
4229
|
+
* @param buffer buffer to deserialize from
|
|
4230
|
+
* @return table lua table with deserialized data
|
|
4231
|
+
*/
|
|
4232
|
+
export function deserialize(buffer: string): any
|
|
4233
|
+
|
|
4195
4234
|
/**
|
|
4196
4235
|
* Terminates the game application and reports the specified `code` to the OS.
|
|
4197
4236
|
* @param code exit code to report to the OS, 0 means clean exit
|
|
@@ -4387,6 +4426,14 @@ The HTTP user agent, i.e. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) Apple
|
|
|
4387
4426
|
*/
|
|
4388
4427
|
export function save(filename: string, table: any): boolean
|
|
4389
4428
|
|
|
4429
|
+
/**
|
|
4430
|
+
* The buffer can later deserialized by `sys.deserialize`.
|
|
4431
|
+
* This method has all the same limitations as `sys.save`.
|
|
4432
|
+
* @param table lua table to serialize
|
|
4433
|
+
* @return buffer serialized data buffer
|
|
4434
|
+
*/
|
|
4435
|
+
export function serialize(table: any): string
|
|
4436
|
+
|
|
4390
4437
|
/**
|
|
4391
4438
|
* Sets the host that is used to check for network connectivity against.
|
|
4392
4439
|
* @param host hostname to check against
|
|
@@ -5658,19 +5705,6 @@ declare namespace label {
|
|
|
5658
5705
|
*/
|
|
5659
5706
|
export function get_text(url: string | hash | url): string
|
|
5660
5707
|
|
|
5661
|
-
/**
|
|
5662
|
-
* Gets the text metrics from a label component
|
|
5663
|
-
* @param url the label to get the (unscaled) metrics from
|
|
5664
|
-
* @return metrics a table with the following fields:
|
|
5665
|
-
|
|
5666
|
-
- width
|
|
5667
|
-
- height
|
|
5668
|
-
- max_ascent
|
|
5669
|
-
- max_descent
|
|
5670
|
-
|
|
5671
|
-
*/
|
|
5672
|
-
export function get_text_metrics(url: string | hash | url): any
|
|
5673
|
-
|
|
5674
5708
|
/**
|
|
5675
5709
|
* Sets the text of a label component
|
|
5676
5710
|
* ⚠ This method uses the message passing that means the value will be set after `dispatch messages` step.
|
|
@@ -6079,8 +6113,9 @@ Information about the completion:
|
|
|
6079
6113
|
`sender`
|
|
6080
6114
|
The invoker of the callback: the sound component.
|
|
6081
6115
|
|
|
6116
|
+
* @return id The identifier for the sound voice
|
|
6082
6117
|
*/
|
|
6083
|
-
export function play(url: string | hash | url, play_properties?: any, complete_function?: any):
|
|
6118
|
+
export function play(url: string | hash | url, play_properties?: any, complete_function?: any): number
|
|
6084
6119
|
|
|
6085
6120
|
/**
|
|
6086
6121
|
* Set gain on all active playing voices of a sound.
|
|
@@ -6141,141 +6176,6 @@ The invoker of the callback: the sound component.
|
|
|
6141
6176
|
|
|
6142
6177
|
declare namespace spine {
|
|
6143
6178
|
|
|
6144
|
-
/**
|
|
6145
|
-
* READ ONLY The current animation set on the component.
|
|
6146
|
-
* hash.
|
|
6147
|
-
*/
|
|
6148
|
-
export let animation: any
|
|
6149
|
-
|
|
6150
|
-
/**
|
|
6151
|
-
* The normalized animation cursor. The type of the property is number.
|
|
6152
|
-
* ⚠ Please note that spine events may not fire as expected when the cursor is manipulated directly.
|
|
6153
|
-
*/
|
|
6154
|
-
export let cursor: any
|
|
6155
|
-
|
|
6156
|
-
/**
|
|
6157
|
-
* The material used when rendering the spine model. The type of the property is hash.
|
|
6158
|
-
*/
|
|
6159
|
-
export let material: any
|
|
6160
|
-
|
|
6161
|
-
/**
|
|
6162
|
-
* number.
|
|
6163
|
-
* The playback_rate is a non-negative number, a negative value will be clamped to 0.
|
|
6164
|
-
*/
|
|
6165
|
-
export let playback_rate: any
|
|
6166
|
-
|
|
6167
|
-
/**
|
|
6168
|
-
* The current skin on the component. The type of the property is hash.
|
|
6169
|
-
* If setting the skin property the skin must be present on the spine
|
|
6170
|
-
* model or a runtime error is signalled.
|
|
6171
|
-
*/
|
|
6172
|
-
export let skin: any
|
|
6173
|
-
|
|
6174
|
-
/**
|
|
6175
|
-
* Cancels all running animations on a specified spine model component.
|
|
6176
|
-
* @param url the spine model for which to cancel the animation
|
|
6177
|
-
*/
|
|
6178
|
-
export function cancel(url: string | hash | url): void
|
|
6179
|
-
|
|
6180
|
-
/**
|
|
6181
|
-
* Returns the id of the game object that corresponds to a specified skeleton bone.
|
|
6182
|
-
* The returned game object can be used for parenting and transform queries.
|
|
6183
|
-
* This function has complexity `O(n)`, where `n` is the number of bones in the spine model skeleton.
|
|
6184
|
-
* Game objects corresponding to a spine model skeleton bone can not be individually deleted.
|
|
6185
|
-
* @param url the spine model to query
|
|
6186
|
-
* @param bone_id id of the corresponding bone
|
|
6187
|
-
* @return id id of the game object
|
|
6188
|
-
*/
|
|
6189
|
-
export function get_go(url: string | hash | url, bone_id: string | hash): hash
|
|
6190
|
-
|
|
6191
|
-
/**
|
|
6192
|
-
* Plays a specified animation on a spine model component with specified playback
|
|
6193
|
-
* mode and parameters.
|
|
6194
|
-
* An optional completion callback function can be provided that will be called when
|
|
6195
|
-
* the animation has completed playing. If no function is provided,
|
|
6196
|
-
* a spine_animation_done message is sent to the script that started the animation.
|
|
6197
|
-
* ⚠ The callback is not called (or message sent) if the animation is
|
|
6198
|
-
* cancelled with spine.cancel. The callback is called (or message sent) only for
|
|
6199
|
-
* animations that play with the following playback modes:
|
|
6200
|
-
*
|
|
6201
|
-
* - `go.PLAYBACK_ONCE_FORWARD`
|
|
6202
|
-
* - `go.PLAYBACK_ONCE_BACKWARD`
|
|
6203
|
-
* - `go.PLAYBACK_ONCE_PINGPONG`
|
|
6204
|
-
*
|
|
6205
|
-
* @param url the spine model for which to play the animation
|
|
6206
|
-
* @param anim_id id of the animation to play
|
|
6207
|
-
* @param playback playback mode of the animation
|
|
6208
|
-
|
|
6209
|
-
- `go.PLAYBACK_ONCE_FORWARD`
|
|
6210
|
-
- `go.PLAYBACK_ONCE_BACKWARD`
|
|
6211
|
-
- `go.PLAYBACK_ONCE_PINGPONG`
|
|
6212
|
-
- `go.PLAYBACK_LOOP_FORWARD`
|
|
6213
|
-
- `go.PLAYBACK_LOOP_BACKWARD`
|
|
6214
|
-
- `go.PLAYBACK_LOOP_PINGPONG`
|
|
6215
|
-
|
|
6216
|
-
* @param play_properties optional table with properties:
|
|
6217
|
-
|
|
6218
|
-
`blend_duration`
|
|
6219
|
-
duration of a linear blend between the current and new animation.
|
|
6220
|
-
`offset`
|
|
6221
|
-
the normalized initial value of the animation cursor when the animation starts playing.
|
|
6222
|
-
`playback_rate`
|
|
6223
|
-
the rate with which the animation will be played. Must be positive.
|
|
6224
|
-
|
|
6225
|
-
* @param complete_function function to call when the animation has completed.
|
|
6226
|
-
|
|
6227
|
-
`self`
|
|
6228
|
-
The current object.
|
|
6229
|
-
`message_id`
|
|
6230
|
-
The name of the completion message, `"spine_animation_done"`.
|
|
6231
|
-
`message`
|
|
6232
|
-
Information about the completion:
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
`animation_id` - the animation that was completed.
|
|
6236
|
-
`playback` - the playback mode for the animation.
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
`sender`
|
|
6240
|
-
The invoker of the callback: the spine model component.
|
|
6241
|
-
|
|
6242
|
-
*/
|
|
6243
|
-
export function play_anim(url: string | hash | url, anim_id: string | hash, playback: any, play_properties?: any, complete_function?: any): void
|
|
6244
|
-
|
|
6245
|
-
/**
|
|
6246
|
-
* Resets any previously set IK target of a spine model, the position will be reset
|
|
6247
|
-
* to the original position from the spine scene.
|
|
6248
|
-
* @param url the spine model containing the object
|
|
6249
|
-
* @param ik_constraint_id id of the corresponding IK constraint object
|
|
6250
|
-
*/
|
|
6251
|
-
export function reset_ik_target(url: string | hash | url, ik_constraint_id: string | hash): void
|
|
6252
|
-
|
|
6253
|
-
/**
|
|
6254
|
-
* Sets a game object as target position of an inverse kinematic (IK) object. As the
|
|
6255
|
-
* target game object's position is updated, the constraint object is updated with the
|
|
6256
|
-
* new position.
|
|
6257
|
-
* @param url the spine model containing the object
|
|
6258
|
-
* @param ik_constraint_id id of the corresponding IK constraint object
|
|
6259
|
-
* @param target_url target game object
|
|
6260
|
-
*/
|
|
6261
|
-
export function set_ik_target(url: string | hash | url, ik_constraint_id: string | hash, target_url: string | hash | url): void
|
|
6262
|
-
|
|
6263
|
-
/**
|
|
6264
|
-
* Sets a static (vector3) target position of an inverse kinematic (IK) object.
|
|
6265
|
-
* @param url the spine model containing the object
|
|
6266
|
-
* @param ik_constraint_id id of the corresponding IK constraint object
|
|
6267
|
-
* @param position target position
|
|
6268
|
-
*/
|
|
6269
|
-
export function set_ik_target_position(url: string | hash | url, ik_constraint_id: string | hash, position: vmath.vector3): void
|
|
6270
|
-
|
|
6271
|
-
/**
|
|
6272
|
-
* Sets the spine skin on a spine model.
|
|
6273
|
-
* @param url the spine model for which to set skin
|
|
6274
|
-
* @param spine_skin spine skin id
|
|
6275
|
-
* @param spine_slot optional slot id to only change a specific slot
|
|
6276
|
-
*/
|
|
6277
|
-
export function set_skin(url: string | hash | url, spine_skin: string | hash, spine_slot?: string | hash): void
|
|
6278
|
-
|
|
6279
6179
|
/**
|
|
6280
6180
|
* This message is sent when a Spine animation has finished playing back to the script
|
|
6281
6181
|
* that started the animation.
|