@defold-typescript/types 0.4.3 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/generated/b2d.d.ts +11 -0
- package/generated/buffer.d.ts +142 -0
- package/generated/collectionfactory.d.ts +118 -0
- package/generated/collectionproxy.d.ts +52 -0
- package/generated/crash.d.ts +109 -0
- package/generated/factory.d.ts +94 -0
- package/generated/go.d.ts +880 -0
- package/generated/graphics.d.ts +108 -0
- package/generated/gui.d.ts +1892 -0
- package/generated/http.d.ts +50 -0
- package/generated/iac.d.ts +7 -0
- package/generated/iap.d.ts +41 -0
- package/generated/image.d.ts +95 -0
- package/generated/json.d.ts +59 -0
- package/generated/label.d.ts +64 -0
- package/generated/liveupdate.d.ts +96 -0
- package/generated/model.d.ts +156 -0
- package/generated/msg.d.ts +56 -0
- package/generated/particlefx.d.ts +122 -0
- package/generated/physics.d.ts +451 -0
- package/generated/profiler.d.ts +188 -0
- package/generated/push.d.ts +48 -0
- package/generated/render.d.ts +944 -0
- package/generated/resource.d.ts +1227 -0
- package/generated/socket.d.ts +125 -0
- package/generated/sound.d.ts +246 -0
- package/generated/sprite.d.ts +111 -0
- package/generated/sys.d.ts +513 -0
- package/generated/tilemap.d.ts +151 -0
- package/generated/timer.d.ts +93 -0
- package/generated/vmath.d.ts +914 -0
- package/generated/webview.d.ts +50 -0
- package/generated/window.d.ts +141 -0
- package/generated/zlib.d.ts +28 -0
- package/package.json +1 -1
- package/src/api-doc.ts +10 -1
- package/src/doc-comment.ts +119 -0
- package/src/emit-dts.ts +63 -2
- package/src/index.ts +1 -0
- package/src/lifecycle.ts +28 -7
package/generated/msg.d.ts
CHANGED
|
@@ -3,8 +3,64 @@ import type { Hash, Url } from "../src/core-types";
|
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
5
|
namespace msg {
|
|
6
|
+
/**
|
|
7
|
+
* This is equivalent to `msg.url(nil)` or `msg.url("#")`, which creates an url to the current
|
|
8
|
+
* script component.
|
|
9
|
+
*
|
|
10
|
+
* @returns a new URL
|
|
11
|
+
* @example
|
|
12
|
+
* ```lua
|
|
13
|
+
* Create a new URL which will address the current script:
|
|
14
|
+
* local my_url = msg.url()
|
|
15
|
+
* print(my_url) --> url: [current_collection:/my_instance#my_component]
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
6
18
|
function url(): Url;
|
|
19
|
+
/**
|
|
20
|
+
* The format of the string must be `[socket:][path][#fragment]`, which is similar to a HTTP URL.
|
|
21
|
+
* When addressing instances:
|
|
22
|
+
* - `socket` is the name of a valid world (a collection)
|
|
23
|
+
* - `path` is the id of the instance, which can either be relative the instance of the calling script or global
|
|
24
|
+
* - `fragment` would be the id of the desired component
|
|
25
|
+
* In addition, the following shorthands are available:
|
|
26
|
+
* - `"."` the current game object
|
|
27
|
+
* - `"#"` the current component
|
|
28
|
+
*
|
|
29
|
+
* @param urlstring - string to create the url from
|
|
30
|
+
* @returns a new URL
|
|
31
|
+
* @example
|
|
32
|
+
* ```lua
|
|
33
|
+
* local my_url = msg.url("#my_component")
|
|
34
|
+
* print(my_url) --> url: [current_collection:/my_instance#my_component]
|
|
35
|
+
*
|
|
36
|
+
* local my_url = msg.url("my_collection:/my_sub_collection/my_instance#my_component")
|
|
37
|
+
* print(my_url) --> url: [my_collection:/my_sub_collection/my_instance#my_component]
|
|
38
|
+
*
|
|
39
|
+
* local my_url = msg.url("my_socket:")
|
|
40
|
+
* print(my_url) --> url: [my_collection:]
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
7
43
|
function url(urlstring: string): Url;
|
|
44
|
+
/**
|
|
45
|
+
* creates a new URL from separate arguments
|
|
46
|
+
*
|
|
47
|
+
* @param socket - socket of the URL
|
|
48
|
+
* @param path - path of the URL
|
|
49
|
+
* @param fragment - fragment of the URL
|
|
50
|
+
* @returns a new URL
|
|
51
|
+
* @example
|
|
52
|
+
* ```lua
|
|
53
|
+
* local my_socket = "main" -- specify by valid name
|
|
54
|
+
* local my_path = hash("/my_collection/my_gameobject") -- specify as string or hash
|
|
55
|
+
* local my_fragment = "component" -- specify as string or hash
|
|
56
|
+
* local my_url = msg.url(my_socket, my_path, my_fragment)
|
|
57
|
+
*
|
|
58
|
+
* print(my_url) --> url: [main:/my_collection/my_gameobject#component]
|
|
59
|
+
* print(my_url.socket) --> 786443 (internal numeric value)
|
|
60
|
+
* print(my_url.path) --> hash: [/my_collection/my_gameobject]
|
|
61
|
+
* print(my_url.fragment) --> hash: [component]
|
|
62
|
+
* ```
|
|
63
|
+
*/
|
|
8
64
|
function url(socket?: string | Hash, path?: string | Hash, fragment?: string | Hash): Url;
|
|
9
65
|
}
|
|
10
66
|
}
|
|
@@ -3,17 +3,139 @@ import type { Hash, Url, Vector4 } from "../src/core-types";
|
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
5
|
namespace particlefx {
|
|
6
|
+
/**
|
|
7
|
+
* The emitter is not spawning any particles, but has particles that are still alive.
|
|
8
|
+
*/
|
|
6
9
|
const EMITTER_STATE_POSTSPAWN: number & { readonly __brand: "particlefx.EMITTER_STATE_POSTSPAWN" };
|
|
10
|
+
/**
|
|
11
|
+
* The emitter will be in this state when it has been started but before spawning any particles. Normally the emitter is in this state for a short time, depending on if a start delay has been set for this emitter or not.
|
|
12
|
+
*/
|
|
7
13
|
const EMITTER_STATE_PRESPAWN: number & { readonly __brand: "particlefx.EMITTER_STATE_PRESPAWN" };
|
|
14
|
+
/**
|
|
15
|
+
* The emitter does not have any living particles and will not spawn any particles in this state.
|
|
16
|
+
*/
|
|
8
17
|
const EMITTER_STATE_SLEEPING: number & { readonly __brand: "particlefx.EMITTER_STATE_SLEEPING" };
|
|
18
|
+
/**
|
|
19
|
+
* The emitter is spawning particles.
|
|
20
|
+
*/
|
|
9
21
|
const EMITTER_STATE_SPAWNING: number & { readonly __brand: "particlefx.EMITTER_STATE_SPAWNING" };
|
|
22
|
+
/**
|
|
23
|
+
* Starts playing a particle FX component.
|
|
24
|
+
* Particle FX started this way need to be manually stopped through `particlefx.stop()`.
|
|
25
|
+
* Which particle FX to play is identified by the URL.
|
|
26
|
+
* A particle FX will continue to emit particles even if the game object the particle FX component belonged to is deleted. You can call `particlefx.stop()` to stop it from emitting more particles.
|
|
27
|
+
*
|
|
28
|
+
* @param url - the particle fx that should start playing.
|
|
29
|
+
* @param emitter_state_function - optional callback function that will be called when an emitter attached to this particlefx changes state.
|
|
30
|
+
`self`
|
|
31
|
+
object The current object
|
|
32
|
+
`id`
|
|
33
|
+
hash The id of the particle fx component
|
|
34
|
+
`emitter`
|
|
35
|
+
hash The id of the emitter
|
|
36
|
+
`state`
|
|
37
|
+
constant the new state of the emitter:
|
|
38
|
+
- `particlefx.EMITTER_STATE_SLEEPING`
|
|
39
|
+
- `particlefx.EMITTER_STATE_PRESPAWN`
|
|
40
|
+
- `particlefx.EMITTER_STATE_SPAWNING`
|
|
41
|
+
- `particlefx.EMITTER_STATE_POSTSPAWN`
|
|
42
|
+
* @example
|
|
43
|
+
* ```lua
|
|
44
|
+
* How to play a particle fx when a game object is created.
|
|
45
|
+
* The callback receives the hash of the path to the particlefx, the hash of the id
|
|
46
|
+
* of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
|
|
47
|
+
* local function emitter_state_change(self, id, emitter, state)
|
|
48
|
+
* if emitter == hash("exhaust") and state == particlefx.EMITTER_STATE_POSTSPAWN then
|
|
49
|
+
* -- exhaust is done spawning particles...
|
|
50
|
+
* end
|
|
51
|
+
* end
|
|
52
|
+
*
|
|
53
|
+
* function init(self)
|
|
54
|
+
* particlefx.play("#particlefx", emitter_state_change)
|
|
55
|
+
* end
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
10
58
|
function play(url: string | Hash | Url, emitter_state_function?: (self: unknown, id: unknown, emitter: unknown, state: unknown) => void): void;
|
|
59
|
+
/**
|
|
60
|
+
* Resets a shader constant for a particle FX component emitter.
|
|
61
|
+
* The constant must be defined in the material assigned to the emitter.
|
|
62
|
+
* Resetting a constant through this function implies that the value defined in the material will be used.
|
|
63
|
+
* Which particle FX to reset a constant for is identified by the URL.
|
|
64
|
+
*
|
|
65
|
+
* @param url - the particle FX that should have a constant reset
|
|
66
|
+
* @param emitter - the id of the emitter
|
|
67
|
+
* @param constant - the name of the constant
|
|
68
|
+
* @example
|
|
69
|
+
* ```lua
|
|
70
|
+
* The following examples assumes that the particle FX has id "particlefx", it
|
|
71
|
+
* contains an emitter with the id "emitter" and that the default-material in builtins is used, which defines the constant "tint".
|
|
72
|
+
* If you assign a custom material to the sprite, you can reset the constants defined there in the same manner.
|
|
73
|
+
* How to reset the tinting of particles from an emitter:
|
|
74
|
+
* function init(self)
|
|
75
|
+
* particlefx.reset_constant("#particlefx", "emitter", "tint")
|
|
76
|
+
* end
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
11
79
|
function reset_constant(url: string | Hash | Url, emitter: string | Hash, constant: string | Hash): void;
|
|
80
|
+
/**
|
|
81
|
+
* Sets a shader constant for a particle FX component emitter.
|
|
82
|
+
* The constant must be defined in the material assigned to the emitter.
|
|
83
|
+
* Setting a constant through this function will override the value set for that constant in the material.
|
|
84
|
+
* The value will be overridden until particlefx.reset_constant is called.
|
|
85
|
+
* Which particle FX to set a constant for is identified by the URL.
|
|
86
|
+
*
|
|
87
|
+
* @param url - the particle FX that should have a constant set
|
|
88
|
+
* @param emitter - the id of the emitter
|
|
89
|
+
* @param constant - the name of the constant
|
|
90
|
+
* @param value - the value of the constant
|
|
91
|
+
* @example
|
|
92
|
+
* ```lua
|
|
93
|
+
* The following examples assumes that the particle FX has id "particlefx", it
|
|
94
|
+
* contains an emitter with the id "emitter" and that the default-material in builtins is used, which defines the constant "tint".
|
|
95
|
+
* If you assign a custom material to the sprite, you can reset the constants defined there in the same manner.
|
|
96
|
+
* How to tint particles from an emitter red:
|
|
97
|
+
* function init(self)
|
|
98
|
+
* particlefx.set_constant("#particlefx", "emitter", "tint", vmath.vector4(1, 0, 0, 1))
|
|
99
|
+
* end
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
12
102
|
function set_constant(url: string | Hash | Url, emitter: string | Hash, constant: string | Hash, value: Vector4): void;
|
|
103
|
+
/**
|
|
104
|
+
* Stops a particle FX component from playing.
|
|
105
|
+
* Stopping a particle FX does not remove already spawned particles.
|
|
106
|
+
* Which particle FX to stop is identified by the URL.
|
|
107
|
+
*
|
|
108
|
+
* @param url - the particle fx that should stop playing
|
|
109
|
+
* @param options - Options when stopping the particle fx. Supported options:
|
|
110
|
+
- boolean `clear`: instantly clear spawned particles
|
|
111
|
+
* @example
|
|
112
|
+
* ```lua
|
|
113
|
+
* How to stop a particle fx when a game object is deleted and immediately also clear
|
|
114
|
+
* any spawned particles:
|
|
115
|
+
* function final(self)
|
|
116
|
+
* particlefx.stop("#particlefx", { clear = true })
|
|
117
|
+
* end
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
13
120
|
function stop(url: string | Hash | Url, options?: { clear?: boolean }): void;
|
|
14
121
|
interface properties {
|
|
122
|
+
/**
|
|
123
|
+
* The animation used during rendering by an emitter in a particle FX component.
|
|
124
|
+
* The property type is a hash and refers to a valid animation in an atlas or a tile source resource.
|
|
125
|
+
* If the animation isn't found, and error will be thrown.
|
|
126
|
+
*/
|
|
15
127
|
animation: Hash;
|
|
128
|
+
/**
|
|
129
|
+
* The image used during rendering by an emitter in a particle FX component.
|
|
130
|
+
* The property type is a hash and refers to an image resource (atlas or tile source).
|
|
131
|
+
* Note: When setting the image, if the currently playing animation of the emitter
|
|
132
|
+
* isn't found in the new image, the animation will be set to the first animation found.
|
|
133
|
+
*/
|
|
16
134
|
image: Hash;
|
|
135
|
+
/**
|
|
136
|
+
* The material used during rendering by an emitter in a particle FX component.
|
|
137
|
+
* The property type is a hash and refers to a material resource.
|
|
138
|
+
*/
|
|
17
139
|
material: Hash;
|
|
18
140
|
}
|
|
19
141
|
}
|