@defold-typescript/types 0.5.5 → 0.7.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/README.md +2 -2
- package/api-targets.json +1 -1
- package/generated/b2d.d.ts +3 -0
- package/generated/buffer.d.ts +44 -38
- package/generated/builtin-messages.d.ts +1 -1
- package/generated/camera.d.ts +3 -0
- package/generated/collectionfactory.d.ts +47 -40
- package/generated/collectionproxy.d.ts +23 -18
- package/generated/crash.d.ts +3 -0
- package/generated/factory.d.ts +32 -24
- package/generated/go.d.ts +123 -124
- package/generated/graphics.d.ts +3 -0
- package/generated/gui.d.ts +303 -283
- package/generated/http.d.ts +26 -16
- package/generated/iac.d.ts +3 -0
- package/generated/iap.d.ts +6 -3
- package/generated/image.d.ts +30 -26
- package/generated/json.d.ts +36 -32
- package/generated/kinds/gui-script.d.ts +7 -5
- package/generated/kinds/render-script.d.ts +7 -5
- package/generated/kinds/script.d.ts +7 -5
- package/generated/label.d.ts +16 -9
- package/generated/liveupdate.d.ts +29 -26
- package/generated/model.d.ts +57 -45
- package/generated/msg.d.ts +3 -0
- package/generated/particlefx.d.ts +50 -34
- package/generated/physics.d.ts +153 -133
- package/generated/profiler.d.ts +45 -41
- package/generated/push.d.ts +5 -2
- package/generated/render.d.ts +410 -349
- package/generated/resource.d.ts +619 -572
- package/generated/socket.d.ts +49 -33
- package/generated/sound.d.ts +83 -72
- package/generated/sprite.d.ts +3 -0
- package/generated/sys.d.ts +198 -189
- package/generated/tilemap.d.ts +43 -39
- package/generated/timer.d.ts +42 -36
- package/generated/vmath.d.ts +22 -0
- package/generated/webview.d.ts +3 -0
- package/generated/window.d.ts +23 -17
- package/generated/zlib.d.ts +15 -12
- package/index.d.ts +3 -1
- package/package.json +13 -2
- package/scripts/fidelity-audit.ts +61 -1
- package/scripts/fidelity-baseline.json +10 -10
- package/scripts/ref-doc-delta.ts +143 -0
- package/scripts/regen.ts +18 -9
- package/src/core-types.ts +14 -0
- package/src/emit-dts.ts +219 -13
- package/src/engine-globals.d.ts +2 -0
- package/src/go-overloads.d.ts +43 -0
- package/src/index.ts +5 -0
- package/src/lifecycle.ts +157 -16
- package/src/publish-dts.ts +1 -1
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
import type { Hash, Url, Vector4 } from "../src/core-types";
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Functions and properties for controlling particle effect component playback and
|
|
7
|
+
* shader constants.
|
|
8
|
+
*/
|
|
5
9
|
namespace particlefx {
|
|
6
10
|
/**
|
|
7
11
|
* The emitter is not spawning any particles, but has particles that are still alive.
|
|
@@ -40,19 +44,21 @@ declare global {
|
|
|
40
44
|
* - `particlefx.EMITTER_STATE_SPAWNING`
|
|
41
45
|
* - `particlefx.EMITTER_STATE_POSTSPAWN`
|
|
42
46
|
* @example
|
|
43
|
-
* ```
|
|
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
|
-
*
|
|
48
|
-
* if emitter
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
47
|
+
* ```ts
|
|
48
|
+
* // How to play a particle fx when a game object is created.
|
|
49
|
+
* // The callback receives the hash of the path to the particlefx, the hash of the id
|
|
50
|
+
* // of the emitter, and the new state of the emitter as particlefx.EMITTER_STATE_.
|
|
51
|
+
* function emitter_state_change(self, id, emitter, state) {
|
|
52
|
+
* if (emitter === hash("exhaust") && state === particlefx.EMITTER_STATE_POSTSPAWN) {
|
|
53
|
+
* // exhaust is done spawning particles...
|
|
54
|
+
* }
|
|
55
|
+
* }
|
|
52
56
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
57
|
+
* export default defineScript({
|
|
58
|
+
* init(self) {
|
|
59
|
+
* particlefx.play("#particlefx", emitter_state_change);
|
|
60
|
+
* },
|
|
61
|
+
* });
|
|
56
62
|
* ```
|
|
57
63
|
*/
|
|
58
64
|
function play(url: string | Hash | Url, emitter_state_function?: (self: unknown, id: unknown, emitter: unknown, state: unknown) => void): void;
|
|
@@ -66,14 +72,18 @@ declare global {
|
|
|
66
72
|
* @param emitter - the id of the emitter
|
|
67
73
|
* @param constant - the name of the constant
|
|
68
74
|
* @example
|
|
69
|
-
* ```
|
|
70
|
-
* The following examples
|
|
71
|
-
* contains an emitter with the id "emitter" and that the default-material in
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
75
|
+
* ```ts
|
|
76
|
+
* // The following examples assume that the particle FX has id "particlefx", it
|
|
77
|
+
* // contains an emitter with the id "emitter" and that the default-material in
|
|
78
|
+
* // builtins is used, which defines the constant "tint".
|
|
79
|
+
* // If you assign a custom material to the sprite, you can reset the constants
|
|
80
|
+
* // defined there in the same manner.
|
|
81
|
+
* // How to reset the tinting of particles from an emitter:
|
|
82
|
+
* export default defineScript({
|
|
83
|
+
* init(self) {
|
|
84
|
+
* particlefx.reset_constant("#particlefx", "emitter", "tint");
|
|
85
|
+
* },
|
|
86
|
+
* });
|
|
77
87
|
* ```
|
|
78
88
|
*/
|
|
79
89
|
function reset_constant(url: string | Hash | Url, emitter: string | Hash, constant: string | Hash): void;
|
|
@@ -89,14 +99,18 @@ declare global {
|
|
|
89
99
|
* @param constant - the name of the constant
|
|
90
100
|
* @param value - the value of the constant
|
|
91
101
|
* @example
|
|
92
|
-
* ```
|
|
93
|
-
* The following examples
|
|
94
|
-
* contains an emitter with the id "emitter" and that the default-material in
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
102
|
+
* ```ts
|
|
103
|
+
* // The following examples assume that the particle FX has id "particlefx", it
|
|
104
|
+
* // contains an emitter with the id "emitter" and that the default-material in
|
|
105
|
+
* // builtins is used, which defines the constant "tint".
|
|
106
|
+
* // If you assign a custom material to the sprite, you can reset the constants
|
|
107
|
+
* // defined there in the same manner.
|
|
108
|
+
* // How to tint particles from an emitter red:
|
|
109
|
+
* export default defineScript({
|
|
110
|
+
* init(self) {
|
|
111
|
+
* particlefx.set_constant("#particlefx", "emitter", "tint", vmath.vector4(1, 0, 0, 1));
|
|
112
|
+
* },
|
|
113
|
+
* });
|
|
100
114
|
* ```
|
|
101
115
|
*/
|
|
102
116
|
function set_constant(url: string | Hash | Url, emitter: string | Hash, constant: string | Hash, value: Vector4): void;
|
|
@@ -109,12 +123,14 @@ declare global {
|
|
|
109
123
|
* @param options - Options when stopping the particle fx. Supported options:
|
|
110
124
|
* - boolean `clear`: instantly clear spawned particles
|
|
111
125
|
* @example
|
|
112
|
-
* ```
|
|
113
|
-
* How to stop a particle fx when a game object is deleted and immediately also
|
|
114
|
-
* any spawned particles:
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
126
|
+
* ```ts
|
|
127
|
+
* // How to stop a particle fx when a game object is deleted and immediately also
|
|
128
|
+
* // clear any spawned particles:
|
|
129
|
+
* export default defineScript({
|
|
130
|
+
* final(self) {
|
|
131
|
+
* particlefx.stop("#particlefx", { clear: true });
|
|
132
|
+
* },
|
|
133
|
+
* });
|
|
118
134
|
* ```
|
|
119
135
|
*/
|
|
120
136
|
function stop(url: string | Hash | Url, options?: { clear?: boolean }): void;
|
package/generated/physics.d.ts
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import type { Hash, Url, Vector3 } from "../src/core-types";
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Functions and messages for collision object physics interaction
|
|
7
|
+
* with other objects (collisions and ray-casting) and control of
|
|
8
|
+
* physical behaviors.
|
|
9
|
+
*/
|
|
5
10
|
namespace physics {
|
|
6
11
|
/**
|
|
7
12
|
* The following properties are available when connecting a joint of `JOINT_TYPE_FIXED` type:
|
|
@@ -62,13 +67,15 @@ declare global {
|
|
|
62
67
|
*
|
|
63
68
|
* @returns gravity vector of collection
|
|
64
69
|
* @example
|
|
65
|
-
* ```
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
70
|
+
* ```ts
|
|
71
|
+
* export default defineScript({
|
|
72
|
+
* init(self) {
|
|
73
|
+
* let gravity = physics.get_gravity();
|
|
74
|
+
* // Inverse gravity!
|
|
75
|
+
* gravity = -gravity;
|
|
76
|
+
* physics.set_gravity(gravity);
|
|
77
|
+
* },
|
|
78
|
+
* });
|
|
72
79
|
* ```
|
|
73
80
|
*/
|
|
74
81
|
function get_gravity(): Vector3;
|
|
@@ -178,25 +185,27 @@ declare global {
|
|
|
178
185
|
* boolean Set to `true` to return all ray cast hits. If `false`, it will only return the closest hit.
|
|
179
186
|
* @returns It returns a list. If missed it returns `nil`. See ray_cast_response for details on the returned values.
|
|
180
187
|
* @example
|
|
181
|
-
* ```
|
|
182
|
-
* How to perform a ray cast synchronously:
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
188
|
+
* ```ts
|
|
189
|
+
* // How to perform a ray cast synchronously:
|
|
190
|
+
* export default defineScript({
|
|
191
|
+
* init(self) {
|
|
192
|
+
* self.groups = [hash("world"), hash("enemy")];
|
|
193
|
+
* },
|
|
186
194
|
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
* if result
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
196
|
-
*
|
|
195
|
+
* update(self, dt) {
|
|
196
|
+
* // request ray cast
|
|
197
|
+
* const result = physics.raycast(from, to, self.groups, { all: true });
|
|
198
|
+
* if (result !== undefined) {
|
|
199
|
+
* // act on the hit (see 'ray_cast_response')
|
|
200
|
+
* for (const result of results) {
|
|
201
|
+
* handle_result(result);
|
|
202
|
+
* }
|
|
203
|
+
* }
|
|
204
|
+
* },
|
|
205
|
+
* });
|
|
197
206
|
* ```
|
|
198
207
|
*/
|
|
199
|
-
function raycast(from: Vector3, to: Vector3, groups:
|
|
208
|
+
function raycast(from: Vector3, to: Vector3, groups: Hash[], options?: { all?: boolean }): Record<string | number, unknown> | unknown;
|
|
200
209
|
/**
|
|
201
210
|
* Ray casts are used to test for intersections against collision objects in the physics world.
|
|
202
211
|
* Collision objects of types kinematic, dynamic and static are tested against. Trigger objects
|
|
@@ -213,28 +222,30 @@ declare global {
|
|
|
213
222
|
* @param groups - a lua table containing the hashed groups for which to test collisions against
|
|
214
223
|
* @param request_id - a number in range [0,255]. It will be sent back in the response for identification, 0 by default
|
|
215
224
|
* @example
|
|
216
|
-
* ```
|
|
217
|
-
* How to perform a ray cast asynchronously:
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
225
|
+
* ```ts
|
|
226
|
+
* // How to perform a ray cast asynchronously:
|
|
227
|
+
* export default defineScript({
|
|
228
|
+
* init(self) {
|
|
229
|
+
* self.my_groups = [hash("my_group1"), hash("my_group2")];
|
|
230
|
+
* },
|
|
221
231
|
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* physics.raycast_async(my_start, my_end, self.my_groups)
|
|
225
|
-
*
|
|
232
|
+
* update(self, dt) {
|
|
233
|
+
* // request ray cast
|
|
234
|
+
* physics.raycast_async(my_start, my_end, self.my_groups);
|
|
235
|
+
* },
|
|
226
236
|
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* if message_id
|
|
230
|
-
*
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
237
|
+
* on_message(self, message_id, message, sender) {
|
|
238
|
+
* // check for the response
|
|
239
|
+
* if (message_id === hash("ray_cast_response")) {
|
|
240
|
+
* // act on the hit
|
|
241
|
+
* } else if (message_id === hash("ray_cast_missed")) {
|
|
242
|
+
* // act on the miss
|
|
243
|
+
* }
|
|
244
|
+
* },
|
|
245
|
+
* });
|
|
235
246
|
* ```
|
|
236
247
|
*/
|
|
237
|
-
function raycast_async(from: Vector3, to: Vector3, groups:
|
|
248
|
+
function raycast_async(from: Vector3, to: Vector3, groups: Hash[], request_id?: number): void;
|
|
238
249
|
/**
|
|
239
250
|
* Only one physics world event listener can be set at a time.
|
|
240
251
|
*
|
|
@@ -251,82 +262,85 @@ declare global {
|
|
|
251
262
|
* `data`
|
|
252
263
|
* table The callback value data is a table that contains event-related data. See the documentation for details on the messages.
|
|
253
264
|
* @example
|
|
254
|
-
* ```
|
|
255
|
-
*
|
|
256
|
-
* for
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
293
|
-
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
265
|
+
* ```ts
|
|
266
|
+
* function physics_world_listener(self, events) {
|
|
267
|
+
* for (const event of events) {
|
|
268
|
+
* const event_type = event["type"];
|
|
269
|
+
* if (event_type === hash("contact_point_event")) {
|
|
270
|
+
* pprint(event);
|
|
271
|
+
* // {
|
|
272
|
+
* // distance = 2.1490633487701,
|
|
273
|
+
* // applied_impulse = 0
|
|
274
|
+
* // a = { --[[0x113f7c6c0]]
|
|
275
|
+
* // group = hash: [box],
|
|
276
|
+
* // id = hash: [/box]
|
|
277
|
+
* // mass = 0,
|
|
278
|
+
* // normal = vmath.vector3(0.379, 0.925, -0),
|
|
279
|
+
* // position = vmath.vector3(517.337, 235.068, 0),
|
|
280
|
+
* // instance_position = vmath.vector3(480, 144, 0),
|
|
281
|
+
* // relative_velocity = vmath.vector3(-0, -0, -0),
|
|
282
|
+
* // },
|
|
283
|
+
* // b = { --[[0x113f7c840]]
|
|
284
|
+
* // group = hash: [circle],
|
|
285
|
+
* // id = hash: [/circle]
|
|
286
|
+
* // mass = 0,
|
|
287
|
+
* // normal = vmath.vector3(-0.379, -0.925, 0),
|
|
288
|
+
* // position = vmath.vector3(517.337, 235.068, 0),
|
|
289
|
+
* // instance_position = vmath.vector3(-0.0021, 0, -0.0022),
|
|
290
|
+
* // relative_velocity = vmath.vector3(0, 0, 0),
|
|
291
|
+
* // },
|
|
292
|
+
* // }
|
|
293
|
+
* } else if (event === hash("collision_event")) {
|
|
294
|
+
* pprint(event);
|
|
295
|
+
* // {
|
|
296
|
+
* // a = {
|
|
297
|
+
* // group = hash: [default],
|
|
298
|
+
* // position = vmath.vector3(183, 666, 0),
|
|
299
|
+
* // id = hash: [/go1]
|
|
300
|
+
* // },
|
|
301
|
+
* // b = {
|
|
302
|
+
* // group = hash: [default],
|
|
303
|
+
* // position = vmath.vector3(185, 704.05865478516, 0),
|
|
304
|
+
* // id = hash: [/go2]
|
|
305
|
+
* // }
|
|
306
|
+
* // }
|
|
307
|
+
* } else if (event === hash("trigger_event")) {
|
|
308
|
+
* pprint(event);
|
|
309
|
+
* // {
|
|
310
|
+
* // enter = true,
|
|
311
|
+
* // b = {
|
|
312
|
+
* // group = hash: [default],
|
|
313
|
+
* // id = hash: [/go2]
|
|
314
|
+
* // },
|
|
315
|
+
* // a = {
|
|
316
|
+
* // group = hash: [default],
|
|
317
|
+
* // id = hash: [/go1]
|
|
318
|
+
* // }
|
|
319
|
+
* // },
|
|
320
|
+
* } else if (event === hash("ray_cast_response")) {
|
|
321
|
+
* pprint(event);
|
|
322
|
+
* // {
|
|
323
|
+
* // group = hash: [default],
|
|
324
|
+
* // request_id = 0,
|
|
325
|
+
* // position = vmath.vector3(249.92222595215, 249.92222595215, 0),
|
|
326
|
+
* // fraction = 0.68759721517563,
|
|
327
|
+
* // normal = vmath.vector3(0, 1, 0),
|
|
328
|
+
* // id = hash: [/go]
|
|
329
|
+
* // }
|
|
330
|
+
* } else if (event === hash("ray_cast_missed")) {
|
|
331
|
+
* pprint(event);
|
|
332
|
+
* // {
|
|
333
|
+
* // request_id = 0
|
|
334
|
+
* // },
|
|
335
|
+
* }
|
|
336
|
+
* }
|
|
337
|
+
* }
|
|
326
338
|
*
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
339
|
+
* export default defineScript({
|
|
340
|
+
* init(self) {
|
|
341
|
+
* physics.set_event_listener(physics_world_listener);
|
|
342
|
+
* },
|
|
343
|
+
* });
|
|
330
344
|
* ```
|
|
331
345
|
*/
|
|
332
346
|
function set_event_listener(callback?: (self: unknown, events: unknown) => void): void;
|
|
@@ -337,11 +351,13 @@ declare global {
|
|
|
337
351
|
*
|
|
338
352
|
* @param gravity - the new gravity vector
|
|
339
353
|
* @example
|
|
340
|
-
* ```
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
*
|
|
354
|
+
* ```ts
|
|
355
|
+
* export default defineScript({
|
|
356
|
+
* init(self) {
|
|
357
|
+
* // Set "upside down" gravity for this collection.
|
|
358
|
+
* physics.set_gravity(vmath.vector3(0, 10.0, 0));
|
|
359
|
+
* },
|
|
360
|
+
* });
|
|
345
361
|
* ```
|
|
346
362
|
*/
|
|
347
363
|
function set_gravity(gravity: Vector3): void;
|
|
@@ -364,11 +380,13 @@ declare global {
|
|
|
364
380
|
* @param url - the collision object that should flip its shapes
|
|
365
381
|
* @param flip - `true` if the collision object should flip its shapes, `false` if not
|
|
366
382
|
* @example
|
|
367
|
-
* ```
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
383
|
+
* ```ts
|
|
384
|
+
* export default defineScript({
|
|
385
|
+
* init(self) {
|
|
386
|
+
* self.fliph = true; // set on some condition
|
|
387
|
+
* physics.set_hflip("#collisionobject", self.fliph);
|
|
388
|
+
* },
|
|
389
|
+
* });
|
|
372
390
|
* ```
|
|
373
391
|
*/
|
|
374
392
|
function set_hflip(url: string | Hash | Url, flip: boolean): void;
|
|
@@ -432,11 +450,13 @@ declare global {
|
|
|
432
450
|
* @param url - the collision object that should flip its shapes
|
|
433
451
|
* @param flip - `true` if the collision object should flip its shapes, `false` if not
|
|
434
452
|
* @example
|
|
435
|
-
* ```
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
*
|
|
439
|
-
*
|
|
453
|
+
* ```ts
|
|
454
|
+
* export default defineScript({
|
|
455
|
+
* init(self) {
|
|
456
|
+
* self.flipv = true; // set on some condition
|
|
457
|
+
* physics.set_vflip("#collisionobject", self.flipv);
|
|
458
|
+
* },
|
|
459
|
+
* });
|
|
440
460
|
* ```
|
|
441
461
|
*/
|
|
442
462
|
function set_vflip(url: string | Hash | Url, flip: boolean): void;
|
|
@@ -447,8 +467,8 @@ declare global {
|
|
|
447
467
|
* @param collisionobject - the collision object whose mass needs to be updated.
|
|
448
468
|
* @param mass - the new mass value to set for the collision object.
|
|
449
469
|
* @example
|
|
450
|
-
* ```
|
|
451
|
-
*
|
|
470
|
+
* ```ts
|
|
471
|
+
* physics.update_mass("#collisionobject", 14);
|
|
452
472
|
* ```
|
|
453
473
|
*/
|
|
454
474
|
function update_mass(collisionobject: string | Hash | Url, mass: number): void;
|
package/generated/profiler.d.ts
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
import type { Opaque } from "../src/core-types";
|
|
3
3
|
|
|
4
4
|
declare global {
|
|
5
|
+
/**
|
|
6
|
+
* Functions for getting profiling data in runtime.
|
|
7
|
+
* More detailed [profiling](https://www.defold.com/manuals/profiling/) and [debugging](http://www.defold.com/manuals/debugging/) information available in the manuals.
|
|
8
|
+
*/
|
|
5
9
|
namespace profiler {
|
|
6
10
|
/**
|
|
7
11
|
* pause on current frame
|
|
@@ -31,8 +35,8 @@ declare global {
|
|
|
31
35
|
* logs the current frame to the console
|
|
32
36
|
*
|
|
33
37
|
* @example
|
|
34
|
-
* ```
|
|
35
|
-
* profiler.dump_frame()
|
|
38
|
+
* ```ts
|
|
39
|
+
* profiler.dump_frame();
|
|
36
40
|
* ```
|
|
37
41
|
*/
|
|
38
42
|
function dump_frame(): void;
|
|
@@ -43,9 +47,9 @@ declare global {
|
|
|
43
47
|
*
|
|
44
48
|
* @param enabled - true to enable, false to disable
|
|
45
49
|
* @example
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* profiler.enable(true)
|
|
50
|
+
* ```ts
|
|
51
|
+
* // Show the profiler UI
|
|
52
|
+
* profiler.enable(true);
|
|
49
53
|
* ```
|
|
50
54
|
*/
|
|
51
55
|
function enable(enabled: boolean): void;
|
|
@@ -57,9 +61,9 @@ declare global {
|
|
|
57
61
|
*
|
|
58
62
|
* @param enabled - true to enable, false to disable
|
|
59
63
|
* @example
|
|
60
|
-
* ```
|
|
61
|
-
*
|
|
62
|
-
* profiler.enable_ui(true)
|
|
64
|
+
* ```ts
|
|
65
|
+
* // Show the profiler UI
|
|
66
|
+
* profiler.enable_ui(true);
|
|
63
67
|
* ```
|
|
64
68
|
*/
|
|
65
69
|
function enable_ui(enabled: boolean): void;
|
|
@@ -92,12 +96,12 @@ declare global {
|
|
|
92
96
|
*
|
|
93
97
|
* @returns used by the application
|
|
94
98
|
* @example
|
|
95
|
-
* ```
|
|
96
|
-
* Get memory usage before and after loading a collection:
|
|
97
|
-
* print(profiler.get_memory_usage())
|
|
98
|
-
* msg.post("#collectionproxy", "load")
|
|
99
|
-
* ...
|
|
100
|
-
* print(profiler.get_memory_usage())
|
|
99
|
+
* ```ts
|
|
100
|
+
* // Get memory usage before and after loading a collection:
|
|
101
|
+
* print(profiler.get_memory_usage());
|
|
102
|
+
* msg.post("#collectionproxy", "load");
|
|
103
|
+
* // ...
|
|
104
|
+
* print(profiler.get_memory_usage()); // will report a higher number than the initial call
|
|
101
105
|
* ```
|
|
102
106
|
*/
|
|
103
107
|
function get_memory_usage(): number;
|
|
@@ -106,8 +110,8 @@ declare global {
|
|
|
106
110
|
*
|
|
107
111
|
* @param text - the string to send to the connected profiler
|
|
108
112
|
* @example
|
|
109
|
-
* ```
|
|
110
|
-
* profiler.log_text(
|
|
113
|
+
* ```ts
|
|
114
|
+
* profiler.log_text(`Event: ${name}`);
|
|
111
115
|
* ```
|
|
112
116
|
*/
|
|
113
117
|
function log_text(text: string): void;
|
|
@@ -116,10 +120,10 @@ declare global {
|
|
|
116
120
|
*
|
|
117
121
|
* @returns the number of recorded frames, zero if on-screen profiler is disabled
|
|
118
122
|
* @example
|
|
119
|
-
* ```
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
* profiler.view_recorded_frame(recorded_frame_count)
|
|
123
|
+
* ```ts
|
|
124
|
+
* // Show the last recorded frame
|
|
125
|
+
* const recorded_frame_count = profiler.recorded_frame_count();
|
|
126
|
+
* profiler.view_recorded_frame(recorded_frame_count);
|
|
123
127
|
* ```
|
|
124
128
|
*/
|
|
125
129
|
function recorded_frame_count(): number;
|
|
@@ -128,11 +132,11 @@ declare global {
|
|
|
128
132
|
*
|
|
129
133
|
* @param name - The name of the scope
|
|
130
134
|
* @example
|
|
131
|
-
* ```
|
|
132
|
-
*
|
|
133
|
-
* profiler.scope_begin("test_function")
|
|
134
|
-
*
|
|
135
|
-
* profiler.scope_end()
|
|
135
|
+
* ```ts
|
|
136
|
+
* // Go back one frame
|
|
137
|
+
* profiler.scope_begin("test_function");
|
|
138
|
+
* test_function();
|
|
139
|
+
* profiler.scope_end();
|
|
136
140
|
* ```
|
|
137
141
|
*/
|
|
138
142
|
function scope_begin(name: string): void;
|
|
@@ -152,14 +156,14 @@ declare global {
|
|
|
152
156
|
* You can also use the `view_recorded_frame` function to display a recorded frame. Doing so stops the recording as well.
|
|
153
157
|
* Every time you switch to recording mode the recording buffer is cleared.
|
|
154
158
|
* @example
|
|
155
|
-
* ```
|
|
156
|
-
* function start_recording()
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
+
* ```ts
|
|
160
|
+
* function start_recording() {
|
|
161
|
+
* profiler.set_ui_mode(profiler.MODE_RECORD);
|
|
162
|
+
* }
|
|
159
163
|
*
|
|
160
|
-
* function stop_recording()
|
|
161
|
-
*
|
|
162
|
-
*
|
|
164
|
+
* function stop_recording() {
|
|
165
|
+
* profiler.set_ui_mode(profiler.MODE_PAUSE);
|
|
166
|
+
* }
|
|
163
167
|
* ```
|
|
164
168
|
*/
|
|
165
169
|
function set_ui_mode(mode: Opaque<"constant">): void;
|
|
@@ -170,9 +174,9 @@ declare global {
|
|
|
170
174
|
* - `profiler.VIEW_MODE_FULL` The default mode which displays all the ui profiler details
|
|
171
175
|
* - `profiler.VIEW_MODE_MINIMIZED` Minimized mode which only shows the top header (fps counters and ui profiler mode)
|
|
172
176
|
* @example
|
|
173
|
-
* ```
|
|
174
|
-
*
|
|
175
|
-
* profiler.set_ui_view_mode(profiler.VIEW_MODE_MINIMIZED)
|
|
177
|
+
* ```ts
|
|
178
|
+
* // Minimize the profiler view
|
|
179
|
+
* profiler.set_ui_view_mode(profiler.VIEW_MODE_MINIMIZED);
|
|
176
180
|
* ```
|
|
177
181
|
*/
|
|
178
182
|
function set_ui_view_mode(mode: Opaque<"constant">): void;
|
|
@@ -190,9 +194,9 @@ declare global {
|
|
|
190
194
|
*
|
|
191
195
|
* @param visible - true to include it in the display, false to hide it.
|
|
192
196
|
* @example
|
|
193
|
-
* ```
|
|
194
|
-
*
|
|
195
|
-
* profiler.set_ui_vsync_wait_visible(false)
|
|
197
|
+
* ```ts
|
|
198
|
+
* // Exclude frame wait time from the profiler ui
|
|
199
|
+
* profiler.set_ui_vsync_wait_visible(false);
|
|
196
200
|
* ```
|
|
197
201
|
*/
|
|
198
202
|
function set_ui_vsync_wait_visible(visible: boolean): void;
|
|
@@ -204,9 +208,9 @@ declare global {
|
|
|
204
208
|
* - `distance` The offset from the currently displayed frame (this is truncated between zero and the number of recorded frames)
|
|
205
209
|
* - `frame` The frame index in the recording buffer (1 is first recorded frame)
|
|
206
210
|
* @example
|
|
207
|
-
* ```
|
|
208
|
-
*
|
|
209
|
-
* profiler.view_recorded_frame({distance
|
|
211
|
+
* ```ts
|
|
212
|
+
* // Go back one frame
|
|
213
|
+
* profiler.view_recorded_frame({ distance: -1 });
|
|
210
214
|
* ```
|
|
211
215
|
*/
|
|
212
216
|
function view_recorded_frame(frame_index: Record<string | number, unknown>): void;
|