@defold-typescript/types 0.37.0 → 0.39.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/api-signatures.json +348 -267
- package/examples/translations.json +323 -147
- package/generated/b2d_body.d.ts +7 -4
- package/generated/buffer.d.ts +16 -4
- package/generated/camera.d.ts +1 -0
- package/generated/collectionfactory.d.ts +5 -2
- package/generated/collectionproxy.d.ts +1 -1
- package/generated/factory.d.ts +2 -1
- package/generated/go.d.ts +141 -86
- package/generated/graphics.d.ts +2 -0
- package/generated/gui.d.ts +65 -40
- package/generated/html5.d.ts +1 -1
- package/generated/http.d.ts +4 -0
- package/generated/model.d.ts +9 -4
- package/generated/particlefx.d.ts +1 -1
- package/generated/physics.d.ts +16 -9
- package/generated/profiler.d.ts +9 -2
- package/generated/render.d.ts +224 -99
- package/generated/resource.d.ts +143 -157
- package/generated/socket.d.ts +13 -8
- package/generated/sound.d.ts +3 -2
- package/generated/sys.d.ts +16 -10
- package/generated/tilemap.d.ts +25 -19
- package/generated/timer.d.ts +33 -24
- package/generated/versions/defold-1.12.4/buffer.d.ts +16 -4
- package/generated/versions/defold-1.12.4/camera.d.ts +1 -0
- package/generated/versions/defold-1.12.4/collectionfactory.d.ts +5 -2
- package/generated/versions/defold-1.12.4/collectionproxy.d.ts +1 -1
- package/generated/versions/defold-1.12.4/factory.d.ts +2 -1
- package/generated/versions/defold-1.12.4/go.d.ts +141 -86
- package/generated/versions/defold-1.12.4/graphics.d.ts +2 -0
- package/generated/versions/defold-1.12.4/gui.d.ts +63 -39
- package/generated/versions/defold-1.12.4/html5.d.ts +1 -1
- package/generated/versions/defold-1.12.4/http.d.ts +4 -0
- package/generated/versions/defold-1.12.4/model.d.ts +9 -4
- package/generated/versions/defold-1.12.4/particlefx.d.ts +1 -1
- package/generated/versions/defold-1.12.4/physics.d.ts +16 -9
- package/generated/versions/defold-1.12.4/profiler.d.ts +9 -2
- package/generated/versions/defold-1.12.4/render.d.ts +223 -98
- package/generated/versions/defold-1.12.4/resource.d.ts +143 -157
- package/generated/versions/defold-1.12.4/socket.d.ts +13 -8
- package/generated/versions/defold-1.12.4/sound.d.ts +3 -2
- package/generated/versions/defold-1.12.4/sys.d.ts +16 -10
- package/generated/versions/defold-1.12.4/tilemap.d.ts +25 -19
- package/generated/versions/defold-1.12.4/timer.d.ts +33 -24
- package/generated/versions/defold-1.12.4/vmath.d.ts +13 -5
- package/generated/versions/defold-1.12.4/window.d.ts +5 -3
- package/generated/versions/defold-1.13.0/b2d_body.d.ts +7 -4
- package/generated/versions/defold-1.13.0/buffer.d.ts +16 -4
- package/generated/versions/defold-1.13.0/camera.d.ts +1 -0
- package/generated/versions/defold-1.13.0/collectionfactory.d.ts +5 -2
- package/generated/versions/defold-1.13.0/collectionproxy.d.ts +1 -1
- package/generated/versions/defold-1.13.0/factory.d.ts +2 -1
- package/generated/versions/defold-1.13.0/go.d.ts +141 -86
- package/generated/versions/defold-1.13.0/graphics.d.ts +2 -0
- package/generated/versions/defold-1.13.0/gui.d.ts +63 -39
- package/generated/versions/defold-1.13.0/html5.d.ts +1 -1
- package/generated/versions/defold-1.13.0/http.d.ts +4 -0
- package/generated/versions/defold-1.13.0/model.d.ts +9 -4
- package/generated/versions/defold-1.13.0/particlefx.d.ts +1 -1
- package/generated/versions/defold-1.13.0/physics.d.ts +16 -9
- package/generated/versions/defold-1.13.0/profiler.d.ts +9 -2
- package/generated/versions/defold-1.13.0/render.d.ts +224 -99
- package/generated/versions/defold-1.13.0/resource.d.ts +143 -157
- package/generated/versions/defold-1.13.0/socket.d.ts +13 -8
- package/generated/versions/defold-1.13.0/sound.d.ts +3 -2
- package/generated/versions/defold-1.13.0/sys.d.ts +16 -10
- package/generated/versions/defold-1.13.0/tilemap.d.ts +25 -19
- package/generated/versions/defold-1.13.0/timer.d.ts +33 -24
- package/generated/versions/defold-1.13.0/vmath.d.ts +13 -5
- package/generated/versions/defold-1.13.0/window.d.ts +5 -3
- package/generated/vmath.d.ts +13 -5
- package/generated/window.d.ts +5 -3
- package/package.json +2 -1
- package/src/api-doc.ts +8 -0
- package/src/doc-comment.ts +213 -32
- package/src/emit-dts.ts +501 -10
- package/src/example-store.ts +26 -0
- package/src/index.ts +5 -0
- package/src/lifecycle.ts +31 -8
- package/src/message-dispatch.d.ts +55 -13
- package/src/msg-overloads.d.ts +73 -3
- package/src/render-overloads.d.ts +0 -17
package/generated/b2d_body.d.ts
CHANGED
|
@@ -105,10 +105,13 @@ declare global {
|
|
|
105
105
|
* @param definition - the chain definition
|
|
106
106
|
* @example
|
|
107
107
|
* ```ts
|
|
108
|
-
* const
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
108
|
+
* const body = b2d.get_body("#collisionobject");
|
|
109
|
+
* if (body !== undefined) {
|
|
110
|
+
* const [chain, segments] = b2d.body.create_chain(body, {
|
|
111
|
+
* vertices: [vmath.vector3(-64, 0, 0), vmath.vector3(0, 16, 0), vmath.vector3(64, 0, 0)],
|
|
112
|
+
* prev_vertex: vmath.vector3(-96, 0, 0), next_vertex: vmath.vector3(96, 0, 0), friction: 0.6,
|
|
113
|
+
* });
|
|
114
|
+
* }
|
|
112
115
|
* ```
|
|
113
116
|
*/
|
|
114
117
|
function create_chain(body: Opaque<"b2Body">, definition: Record<string | number, unknown>): LuaMultiReturn<[Opaque<"b2Chain">, { shape_id: number }[]]>;
|
package/generated/buffer.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ declare global {
|
|
|
6
6
|
* Functions for manipulating buffers and streams
|
|
7
7
|
*/
|
|
8
8
|
namespace buffer {
|
|
9
|
+
type ValueType = typeof buffer.VALUE_TYPE_FLOAT32 | typeof buffer.VALUE_TYPE_INT16 | typeof buffer.VALUE_TYPE_INT32 | typeof buffer.VALUE_TYPE_INT64 | typeof buffer.VALUE_TYPE_INT8 | typeof buffer.VALUE_TYPE_UINT16 | typeof buffer.VALUE_TYPE_UINT32 | typeof buffer.VALUE_TYPE_UINT64 | typeof buffer.VALUE_TYPE_UINT8;
|
|
9
10
|
/**
|
|
10
11
|
* Float, single precision, 4 bytes
|
|
11
12
|
*/
|
|
@@ -56,11 +57,15 @@ declare global {
|
|
|
56
57
|
* @example
|
|
57
58
|
* ```ts
|
|
58
59
|
* // How to copy elements (e.g. vertices) from one buffer to another
|
|
60
|
+
* const element_count = 64;
|
|
61
|
+
* const srcbuffer = resource.get_buffer("/src.bufferc");
|
|
62
|
+
* const dstbuffer = resource.get_buffer("/dst.bufferc");
|
|
63
|
+
*
|
|
59
64
|
* // copy entire buffer
|
|
60
|
-
* buffer.copy_buffer(dstbuffer, 0, srcbuffer, 0,
|
|
65
|
+
* buffer.copy_buffer(dstbuffer, 0, srcbuffer, 0, element_count);
|
|
61
66
|
*
|
|
62
67
|
* // copy last 10 elements to the front of another buffer
|
|
63
|
-
* buffer.copy_buffer(dstbuffer, 0, srcbuffer,
|
|
68
|
+
* buffer.copy_buffer(dstbuffer, 0, srcbuffer, element_count - 10, 10);
|
|
64
69
|
* ```
|
|
65
70
|
*/
|
|
66
71
|
function copy_buffer(dst: Opaque<"buffer">, dstoffset: number, src: Opaque<"buffer">, srcoffset: number, count: number): void;
|
|
@@ -77,6 +82,9 @@ declare global {
|
|
|
77
82
|
* @example
|
|
78
83
|
* ```ts
|
|
79
84
|
* // How to update a texture of a sprite:
|
|
85
|
+
* const srcbuffer = resource.get_buffer("/src.bufferc");
|
|
86
|
+
* const dstbuffer = resource.get_buffer("/dst.bufferc");
|
|
87
|
+
*
|
|
80
88
|
* // copy entire stream
|
|
81
89
|
* const srcstream = buffer.get_stream(srcbuffer, hash("xyz"));
|
|
82
90
|
* const dststream = buffer.get_stream(dstbuffer, hash("xyz"));
|
|
@@ -137,12 +145,14 @@ declare global {
|
|
|
137
145
|
* @example
|
|
138
146
|
* ```ts
|
|
139
147
|
* // How to get a metadata entry from a buffer
|
|
148
|
+
* const buf = resource.get_buffer("/my.bufferc");
|
|
149
|
+
*
|
|
140
150
|
* // retrieve a metadata entry named "somefloats" and its numeric type
|
|
141
151
|
* const [values, type] = buffer.get_metadata(buf, hash("somefloats"));
|
|
142
152
|
* if (values) print(`${values.length} values in 'somefloats'`);
|
|
143
153
|
* ```
|
|
144
154
|
*/
|
|
145
|
-
function get_metadata(buf: Opaque<"buffer">, metadata_name: Hash | string): LuaMultiReturn<[number[] | undefined,
|
|
155
|
+
function get_metadata(buf: Opaque<"buffer">, metadata_name: Hash | string): LuaMultiReturn<[number[] | undefined, buffer.ValueType | undefined]>;
|
|
146
156
|
/**
|
|
147
157
|
* Get a specified stream from a buffer.
|
|
148
158
|
*
|
|
@@ -162,6 +172,8 @@ declare global {
|
|
|
162
172
|
* @example
|
|
163
173
|
* ```ts
|
|
164
174
|
* // How to set a metadata entry on a buffer
|
|
175
|
+
* const buf = resource.get_buffer("/my.bufferc");
|
|
176
|
+
*
|
|
165
177
|
* // create a new metadata entry with three floats
|
|
166
178
|
* buffer.set_metadata(buf, hash("somefloats"), [1.5, 3.2, 7.9], buffer.VALUE_TYPE_FLOAT32);
|
|
167
179
|
* // ...
|
|
@@ -169,7 +181,7 @@ declare global {
|
|
|
169
181
|
* buffer.set_metadata(buf, hash("somefloats"), [-2.5, 10.0, 32.2], buffer.VALUE_TYPE_FLOAT32);
|
|
170
182
|
* ```
|
|
171
183
|
*/
|
|
172
|
-
function set_metadata(buf: Opaque<"buffer">, metadata_name: Hash | string, values: number[], value_type:
|
|
184
|
+
function set_metadata(buf: Opaque<"buffer">, metadata_name: Hash | string, values: number[], value_type: buffer.ValueType): void;
|
|
173
185
|
}
|
|
174
186
|
}
|
|
175
187
|
|
package/generated/camera.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ declare global {
|
|
|
7
7
|
* used to dynamically spawn collections into the runtime.
|
|
8
8
|
*/
|
|
9
9
|
namespace collectionfactory {
|
|
10
|
+
type Status = typeof collectionfactory.STATUS_UNLOADED | typeof collectionfactory.STATUS_LOADING | typeof collectionfactory.STATUS_LOADED;
|
|
10
11
|
/**
|
|
11
12
|
* loaded
|
|
12
13
|
*/
|
|
@@ -75,7 +76,9 @@ declare global {
|
|
|
75
76
|
* });
|
|
76
77
|
*
|
|
77
78
|
* // How to delete a spawned collection:
|
|
78
|
-
*
|
|
79
|
+
* function delete_enemies(self: { enemy_ids: Hash[] }) {
|
|
80
|
+
* go.delete(self.enemy_ids);
|
|
81
|
+
* }
|
|
79
82
|
* ```
|
|
80
83
|
*/
|
|
81
84
|
function create(url: string | Hash | Url, position?: Vector3, rotation?: Quaternion, properties?: Record<string | number, unknown>, scale?: number | Vector3): LuaMap<Hash, Hash>;
|
|
@@ -92,7 +95,7 @@ declare global {
|
|
|
92
95
|
*
|
|
93
96
|
* - `collectionfactory.STATUS_LOADED`
|
|
94
97
|
*/
|
|
95
|
-
function get_status(url?: string | Hash | Url):
|
|
98
|
+
function get_status(url?: string | Hash | Url): collectionfactory.Status;
|
|
96
99
|
/**
|
|
97
100
|
* Resources loaded are referenced by the collection factory component until the existing (parent) collection is destroyed or collectionfactory.unload is called.
|
|
98
101
|
* Calling this function when the factory is not marked as dynamic loading does nothing.
|
|
@@ -32,7 +32,7 @@ declare global {
|
|
|
32
32
|
* collection was not excluded.
|
|
33
33
|
* @example
|
|
34
34
|
* ```ts
|
|
35
|
-
* function print_resources(self, cproxy) {
|
|
35
|
+
* function print_resources(self: unknown, cproxy: Url) {
|
|
36
36
|
* const resources = collectionproxy.get_resources(cproxy);
|
|
37
37
|
* for (const v of resources) {
|
|
38
38
|
* print(`Resource: ${v}`);
|
package/generated/factory.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ declare global {
|
|
|
7
7
|
* dynamically spawn game objects into the runtime.
|
|
8
8
|
*/
|
|
9
9
|
namespace factory {
|
|
10
|
+
type Status = typeof factory.STATUS_UNLOADED | typeof factory.STATUS_LOADING | typeof factory.STATUS_LOADED;
|
|
10
11
|
/**
|
|
11
12
|
* loaded
|
|
12
13
|
*/
|
|
@@ -71,7 +72,7 @@ declare global {
|
|
|
71
72
|
*
|
|
72
73
|
* - `factory.STATUS_LOADED`
|
|
73
74
|
*/
|
|
74
|
-
function get_status(url?: string | Hash | Url):
|
|
75
|
+
function get_status(url?: string | Hash | Url): factory.Status;
|
|
75
76
|
/**
|
|
76
77
|
* Resources are referenced by the factory component until the existing (parent) collection is destroyed or factory.unload is called.
|
|
77
78
|
* Calling this function when the factory is not marked as dynamic loading does nothing.
|
package/generated/go.d.ts
CHANGED
|
@@ -6,6 +6,8 @@ declare global {
|
|
|
6
6
|
* Game object API documentation
|
|
7
7
|
*/
|
|
8
8
|
namespace go {
|
|
9
|
+
export type Easing = typeof go.EASING_INBACK | typeof go.EASING_INBOUNCE | typeof go.EASING_INCIRC | typeof go.EASING_INCUBIC | typeof go.EASING_INELASTIC | typeof go.EASING_INEXPO | typeof go.EASING_INOUTBACK | typeof go.EASING_INOUTBOUNCE | typeof go.EASING_INOUTCIRC | typeof go.EASING_INOUTCUBIC | typeof go.EASING_INOUTELASTIC | typeof go.EASING_INOUTEXPO | typeof go.EASING_INOUTQUAD | typeof go.EASING_INOUTQUART | typeof go.EASING_INOUTQUINT | typeof go.EASING_INOUTSINE | typeof go.EASING_INQUAD | typeof go.EASING_INQUART | typeof go.EASING_INQUINT | typeof go.EASING_INSINE | typeof go.EASING_LINEAR | typeof go.EASING_OUTBACK | typeof go.EASING_OUTBOUNCE | typeof go.EASING_OUTCIRC | typeof go.EASING_OUTCUBIC | typeof go.EASING_OUTELASTIC | typeof go.EASING_OUTEXPO | typeof go.EASING_OUTINBACK | typeof go.EASING_OUTINBOUNCE | typeof go.EASING_OUTINCIRC | typeof go.EASING_OUTINCUBIC | typeof go.EASING_OUTINELASTIC | typeof go.EASING_OUTINEXPO | typeof go.EASING_OUTINQUAD | typeof go.EASING_OUTINQUART | typeof go.EASING_OUTINQUINT | typeof go.EASING_OUTINSINE | typeof go.EASING_OUTQUAD | typeof go.EASING_OUTQUART | typeof go.EASING_OUTQUINT | typeof go.EASING_OUTSINE;
|
|
10
|
+
export type Playback = typeof go.PLAYBACK_ONCE_FORWARD | typeof go.PLAYBACK_ONCE_BACKWARD | typeof go.PLAYBACK_ONCE_PINGPONG | typeof go.PLAYBACK_LOOP_FORWARD | typeof go.PLAYBACK_LOOP_BACKWARD | typeof go.PLAYBACK_LOOP_PINGPONG;
|
|
9
11
|
/**
|
|
10
12
|
* in-back
|
|
11
13
|
*/
|
|
@@ -241,14 +243,15 @@ declare global {
|
|
|
241
243
|
*
|
|
242
244
|
* hash The id of the animated property.
|
|
243
245
|
* @example
|
|
246
|
+
* Animate the position of a game object to x = 10 during 1 second, then y = 20 during 1 second:
|
|
244
247
|
* ```ts
|
|
245
|
-
* // Animate the position of a game object to x = 10 during 1 second, then
|
|
246
|
-
* // y = 20 during 1 second:
|
|
247
248
|
* go.animate(go.get_id(), "position.x", go.PLAYBACK_ONCE_FORWARD, 10, go.EASING_LINEAR, 1, 0, () => {
|
|
248
249
|
* go.animate(go.get_id(), "position.y", go.PLAYBACK_ONCE_FORWARD, 20, go.EASING_LINEAR, 1);
|
|
249
250
|
* });
|
|
250
|
-
*
|
|
251
|
-
*
|
|
251
|
+
* ```
|
|
252
|
+
* @example
|
|
253
|
+
* Animate the y position of a game object using a crazy custom easing curve:
|
|
254
|
+
* ```ts
|
|
252
255
|
* const values = [
|
|
253
256
|
* 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
254
257
|
* 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
|
|
@@ -259,7 +262,7 @@ declare global {
|
|
|
259
262
|
* go.animate("go", "position.y", go.PLAYBACK_LOOP_PINGPONG, 100, vec, 2.0);
|
|
260
263
|
* ```
|
|
261
264
|
*/
|
|
262
|
-
export function animate(url: SceneAddress | Hash | Url, property: string | Hash, playback:
|
|
265
|
+
export function animate(url: SceneAddress | Hash | Url, property: string | Hash, playback: go.Playback, to: number | Vector3 | Vector4 | Quaternion, easing: Vector | go.Easing, duration: number, delay?: number, complete_function?: (self: unknown, url: unknown, property: unknown) => void): void;
|
|
263
266
|
/**
|
|
264
267
|
* By calling this function, all or specified stored property animations of the game object or component will be canceled.
|
|
265
268
|
* See the properties guide for which properties can be animated and the animation guide for how to animate them.
|
|
@@ -267,14 +270,18 @@ declare global {
|
|
|
267
270
|
* @param url - url of the game object or component
|
|
268
271
|
* @param property - optional id of the property to cancel
|
|
269
272
|
* @example
|
|
273
|
+
* Cancel the animation of the position of a game object:
|
|
270
274
|
* ```ts
|
|
271
|
-
* // Cancel the animation of the position of a game object:
|
|
272
275
|
* go.cancel_animations(go.get_id(), "position");
|
|
273
|
-
*
|
|
274
|
-
*
|
|
276
|
+
* ```
|
|
277
|
+
* @example
|
|
278
|
+
* Cancel all property animations of the current game object:
|
|
279
|
+
* ```ts
|
|
275
280
|
* go.cancel_animations(".");
|
|
276
|
-
*
|
|
277
|
-
*
|
|
281
|
+
* ```
|
|
282
|
+
* @example
|
|
283
|
+
* Cancel all property animations of the sprite component of the current game object:
|
|
284
|
+
* ```ts
|
|
278
285
|
* go.cancel_animations("#sprite");
|
|
279
286
|
* ```
|
|
280
287
|
*/
|
|
@@ -290,8 +297,8 @@ declare global {
|
|
|
290
297
|
* @param id - optional id or table of id's of the instance(s) to delete, the instance of the calling script is deleted by default
|
|
291
298
|
* @param recursive - optional boolean, set to true to recursively delete child hiearchy in child to parent order
|
|
292
299
|
* @example
|
|
300
|
+
* This example demonstrates how to delete game objects
|
|
293
301
|
* ```ts
|
|
294
|
-
* // This example demonstrates how to delete game objects:
|
|
295
302
|
* // Delete the script's own game object.
|
|
296
303
|
* go.delete();
|
|
297
304
|
* // Delete a game object with the id "my_game_object".
|
|
@@ -300,17 +307,18 @@ declare global {
|
|
|
300
307
|
* // Delete a list of game objects.
|
|
301
308
|
* const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
|
|
302
309
|
* go.delete(ids);
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
310
|
+
* ```
|
|
311
|
+
* @example
|
|
312
|
+
* This example demonstrates how to delete a game objects and their children (child to parent order)
|
|
313
|
+
* ```ts
|
|
306
314
|
* // Delete the script's own game object and its children.
|
|
307
315
|
* go.delete(true);
|
|
308
316
|
* // Delete a game object with the id "my_game_object" and its children.
|
|
309
|
-
* const
|
|
310
|
-
* go.delete(
|
|
317
|
+
* const id = go.get_id("my_game_object");
|
|
318
|
+
* go.delete(id, true);
|
|
311
319
|
* // Delete a list of game objects and their children.
|
|
312
|
-
* const
|
|
313
|
-
* go.delete(
|
|
320
|
+
* const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
|
|
321
|
+
* go.delete(ids, true);
|
|
314
322
|
* ```
|
|
315
323
|
*/
|
|
316
324
|
function _delete(id?: SceneGameObjectAddress | Hash | Url | (SceneGameObjectAddress | Hash | Url)[], recursive?: boolean): void;
|
|
@@ -321,11 +329,13 @@ declare global {
|
|
|
321
329
|
* @param url - url of the game object to check
|
|
322
330
|
* @returns true if the game object exists
|
|
323
331
|
* @example
|
|
332
|
+
* Check if game object "my_game_object" exists in the current collection
|
|
324
333
|
* ```ts
|
|
325
|
-
* // Check if game object "my_game_object" exists in the current collection:
|
|
326
334
|
* go.exists("/my_game_object");
|
|
327
|
-
*
|
|
328
|
-
*
|
|
335
|
+
* ```
|
|
336
|
+
* @example
|
|
337
|
+
* Check if game object exists in another collection
|
|
338
|
+
* ```ts
|
|
329
339
|
* go.exists("other_collection:/my_game_object");
|
|
330
340
|
* ```
|
|
331
341
|
*/
|
|
@@ -388,12 +398,14 @@ declare global {
|
|
|
388
398
|
* @param id - optional id of the game object instance to get parent for, defaults to the instance containing the calling script
|
|
389
399
|
* @returns parent instance or `nil`
|
|
390
400
|
* @example
|
|
401
|
+
* Get parent of the instance containing the calling script:
|
|
391
402
|
* ```ts
|
|
392
|
-
* // Get parent of the instance containing the calling script:
|
|
393
403
|
* const parent_id = go.get_parent();
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
404
|
+
* ```
|
|
405
|
+
* @example
|
|
406
|
+
* Get parent of the instance with id "x":
|
|
407
|
+
* ```ts
|
|
408
|
+
* const parent_id = go.get_parent("x");
|
|
397
409
|
* ```
|
|
398
410
|
*/
|
|
399
411
|
export function get_parent(id?: SceneGameObjectAddress | Hash | Url): Hash | undefined;
|
|
@@ -403,11 +415,13 @@ declare global {
|
|
|
403
415
|
* @param id - optional id of the game object instance to get the position for, by default the instance of the calling script
|
|
404
416
|
* @returns instance position
|
|
405
417
|
* @example
|
|
418
|
+
* Get the position of the game object instance the script is attached to:
|
|
406
419
|
* ```ts
|
|
407
|
-
* // Get the position of the game object the script is attached to:
|
|
408
420
|
* const p = go.get_position();
|
|
409
|
-
*
|
|
410
|
-
*
|
|
421
|
+
* ```
|
|
422
|
+
* @example
|
|
423
|
+
* Get the position of another game object instance "my_gameobject":
|
|
424
|
+
* ```ts
|
|
411
425
|
* const pos = go.get_position("my_gameobject");
|
|
412
426
|
* ```
|
|
413
427
|
*/
|
|
@@ -418,12 +432,14 @@ declare global {
|
|
|
418
432
|
* @param id - optional id of the game object instance to get the rotation for, by default the instance of the calling script
|
|
419
433
|
* @returns instance rotation
|
|
420
434
|
* @example
|
|
435
|
+
* Get the rotation of the game object instance the script is attached to:
|
|
421
436
|
* ```ts
|
|
422
|
-
* // Get the rotation of the game object the script is attached to:
|
|
423
437
|
* const r = go.get_rotation();
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
438
|
+
* ```
|
|
439
|
+
* @example
|
|
440
|
+
* Get the rotation of another game object instance with id "x":
|
|
441
|
+
* ```ts
|
|
442
|
+
* const r = go.get_rotation("x");
|
|
427
443
|
* ```
|
|
428
444
|
*/
|
|
429
445
|
export function get_rotation(id?: SceneGameObjectAddress | Hash | Url): Quaternion;
|
|
@@ -433,12 +449,14 @@ declare global {
|
|
|
433
449
|
* @param id - optional id of the game object instance to get the scale for, by default the instance of the calling script
|
|
434
450
|
* @returns instance scale factor
|
|
435
451
|
* @example
|
|
452
|
+
* Get the scale of the game object instance the script is attached to:
|
|
436
453
|
* ```ts
|
|
437
|
-
* // Get the scale of the game object the script is attached to:
|
|
438
454
|
* const s = go.get_scale();
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
455
|
+
* ```
|
|
456
|
+
* @example
|
|
457
|
+
* Get the scale of another game object instance with id "x":
|
|
458
|
+
* ```ts
|
|
459
|
+
* const s = go.get_scale("x");
|
|
442
460
|
* ```
|
|
443
461
|
*/
|
|
444
462
|
export function get_scale(id?: SceneGameObjectAddress | Hash | Url): Vector3;
|
|
@@ -448,12 +466,14 @@ declare global {
|
|
|
448
466
|
* @param id - optional id of the game object instance to get the uniform scale for, by default the instance of the calling script
|
|
449
467
|
* @returns uniform instance scale factor
|
|
450
468
|
* @example
|
|
469
|
+
* Get the scale of the game object instance the script is attached to:
|
|
451
470
|
* ```ts
|
|
452
|
-
* // Get the uniform scale of the game object the script is attached to:
|
|
453
471
|
* const s = go.get_scale_uniform();
|
|
454
|
-
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
472
|
+
* ```
|
|
473
|
+
* @example
|
|
474
|
+
* Get the uniform scale of another game object instance with id "x":
|
|
475
|
+
* ```ts
|
|
476
|
+
* const s = go.get_scale_uniform("x");
|
|
457
477
|
* ```
|
|
458
478
|
*/
|
|
459
479
|
export function get_scale_uniform(id?: SceneGameObjectAddress | Hash | Url): number;
|
|
@@ -465,12 +485,15 @@ declare global {
|
|
|
465
485
|
* @param id - optional id of the game object instance to get the world position for, by default the instance of the calling script
|
|
466
486
|
* @returns instance world position
|
|
467
487
|
* @example
|
|
488
|
+
* Get the world position of the game object instance the script is attached to:
|
|
468
489
|
* ```ts
|
|
469
|
-
* // Get the world position of the game object the script is attached to:
|
|
470
490
|
* const p = go.get_world_position();
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
*
|
|
491
|
+
* ```
|
|
492
|
+
* @example
|
|
493
|
+
* Get the world position of another game object instance with id "x":
|
|
494
|
+
* ```ts
|
|
495
|
+
* // Relative addressing by id — no socket prefix:
|
|
496
|
+
* const p = go.get_world_position("x");
|
|
474
497
|
* ```
|
|
475
498
|
*/
|
|
476
499
|
export function get_world_position(id?: SceneGameObjectAddress | Hash | Url): Vector3;
|
|
@@ -482,12 +505,14 @@ declare global {
|
|
|
482
505
|
* @param id - optional id of the game object instance to get the world rotation for, by default the instance of the calling script
|
|
483
506
|
* @returns instance world rotation
|
|
484
507
|
* @example
|
|
508
|
+
* Get the world rotation of the game object instance the script is attached to:
|
|
485
509
|
* ```ts
|
|
486
|
-
* // Get the world rotation of the game object the script is attached to:
|
|
487
510
|
* const r = go.get_world_rotation();
|
|
488
|
-
*
|
|
489
|
-
*
|
|
490
|
-
*
|
|
511
|
+
* ```
|
|
512
|
+
* @example
|
|
513
|
+
* Get the world rotation of another game object instance with id "x":
|
|
514
|
+
* ```ts
|
|
515
|
+
* const r = go.get_world_rotation("x");
|
|
491
516
|
* ```
|
|
492
517
|
*/
|
|
493
518
|
export function get_world_rotation(id?: SceneGameObjectAddress | Hash | Url): Quaternion;
|
|
@@ -501,12 +526,14 @@ declare global {
|
|
|
501
526
|
* @param id - optional id of the game object instance to get the world scale for, by default the instance of the calling script
|
|
502
527
|
* @returns instance world 3D scale factor
|
|
503
528
|
* @example
|
|
529
|
+
* Get the world 3D scale of the game object instance the script is attached to:
|
|
504
530
|
* ```ts
|
|
505
|
-
* // Get the world 3D scale of the game object the script is attached to:
|
|
506
531
|
* const s = go.get_world_scale();
|
|
507
|
-
*
|
|
508
|
-
*
|
|
509
|
-
*
|
|
532
|
+
* ```
|
|
533
|
+
* @example
|
|
534
|
+
* Get the world scale of another game object instance "x":
|
|
535
|
+
* ```ts
|
|
536
|
+
* const s = go.get_world_scale("x");
|
|
510
537
|
* ```
|
|
511
538
|
*/
|
|
512
539
|
export function get_world_scale(id?: SceneGameObjectAddress | Hash | Url): Vector3;
|
|
@@ -518,12 +545,14 @@ declare global {
|
|
|
518
545
|
* @param id - optional id of the game object instance to get the world scale for, by default the instance of the calling script
|
|
519
546
|
* @returns instance world scale factor
|
|
520
547
|
* @example
|
|
548
|
+
* Get the world scale of the game object instance the script is attached to:
|
|
521
549
|
* ```ts
|
|
522
|
-
* // Get the world uniform scale of the game object the script is attached to:
|
|
523
550
|
* const s = go.get_world_scale_uniform();
|
|
524
|
-
*
|
|
525
|
-
*
|
|
526
|
-
*
|
|
551
|
+
* ```
|
|
552
|
+
* @example
|
|
553
|
+
* Get the world scale of another game object instance with id "x":
|
|
554
|
+
* ```ts
|
|
555
|
+
* const s = go.get_world_scale_uniform("x");
|
|
527
556
|
* ```
|
|
528
557
|
*/
|
|
529
558
|
export function get_world_scale_uniform(id?: SceneGameObjectAddress | Hash | Url): number;
|
|
@@ -534,12 +563,14 @@ declare global {
|
|
|
534
563
|
* @param id - optional id of the game object instance to get the world transform for, by default the instance of the calling script
|
|
535
564
|
* @returns instance world transform
|
|
536
565
|
* @example
|
|
566
|
+
* Get the world transform of the game object instance the script is attached to:
|
|
537
567
|
* ```ts
|
|
538
|
-
* // Get the world transform of the game object the script is attached to:
|
|
539
568
|
* const m = go.get_world_transform();
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
569
|
+
* ```
|
|
570
|
+
* @example
|
|
571
|
+
* Get the world transform of another game object instance with id "x":
|
|
572
|
+
* ```ts
|
|
573
|
+
* const m = go.get_world_transform("x");
|
|
543
574
|
* ```
|
|
544
575
|
*/
|
|
545
576
|
export function get_world_transform(id?: SceneGameObjectAddress | Hash | Url): Matrix4;
|
|
@@ -779,6 +810,9 @@ declare global {
|
|
|
779
810
|
* @param message - a table containing the message data
|
|
780
811
|
* @param sender - address of the sender
|
|
781
812
|
* @example
|
|
813
|
+
* This example demonstrates how a game object instance, called "a", can communicate with another instance, called "b". It
|
|
814
|
+
* is assumed that both script components of the instances has id "script".
|
|
815
|
+
* Script of instance "a":
|
|
782
816
|
* ```ts
|
|
783
817
|
* // This example demonstrates how a game object instance, called "a", can communicate with another instance, called "b". It
|
|
784
818
|
* // is assumed that both script components of the instances has id "script".
|
|
@@ -790,7 +824,10 @@ declare global {
|
|
|
790
824
|
* msg.post("b#script", "my_data", { important_value: 1 });
|
|
791
825
|
* },
|
|
792
826
|
* });
|
|
793
|
-
*
|
|
827
|
+
* ```
|
|
828
|
+
* @example
|
|
829
|
+
* Script of instance "b":
|
|
830
|
+
* ```ts
|
|
794
831
|
* // b.script — Script of instance "b":
|
|
795
832
|
* export default defineScript({
|
|
796
833
|
* init() {
|
|
@@ -868,14 +905,18 @@ declare global {
|
|
|
868
905
|
* @param parent_id - optional id of the new parent game object, defaults to detaching game object from its parent
|
|
869
906
|
* @param keep_world_transform - optional boolean, set to true to maintain the world transform when changing spaces. Defaults to false.
|
|
870
907
|
* @example
|
|
908
|
+
* Attach myself to another instance "my_parent":
|
|
871
909
|
* ```ts
|
|
872
|
-
* // Attach myself to another instance "my_parent":
|
|
873
910
|
* go.set_parent(go.get_id(), go.get_id("my_parent"));
|
|
874
|
-
*
|
|
875
|
-
*
|
|
911
|
+
* ```
|
|
912
|
+
* @example
|
|
913
|
+
* Attach an instance "my_instance" to another instance "my_parent":
|
|
914
|
+
* ```ts
|
|
876
915
|
* go.set_parent(go.get_id("my_instance"), go.get_id("my_parent"));
|
|
877
|
-
*
|
|
878
|
-
*
|
|
916
|
+
* ```
|
|
917
|
+
* @example
|
|
918
|
+
* Detach an instance "my_instance" from its parent (if any):
|
|
919
|
+
* ```ts
|
|
879
920
|
* go.set_parent(go.get_id("my_instance"));
|
|
880
921
|
* ```
|
|
881
922
|
*/
|
|
@@ -886,14 +927,19 @@ declare global {
|
|
|
886
927
|
* @param position - position to set
|
|
887
928
|
* @param id - optional id of the game object instance to set the position for, by default the instance of the calling script
|
|
888
929
|
* @example
|
|
930
|
+
* Set the position of the game object instance the script is attached to:
|
|
889
931
|
* ```ts
|
|
890
932
|
* // `p` is the desired position (a Vector3).
|
|
891
933
|
* const p = vmath.vector3();
|
|
892
|
-
*
|
|
893
|
-
* // Set the position of the game object the script is attached to:
|
|
894
934
|
* go.set_position(p);
|
|
935
|
+
* ```
|
|
936
|
+
* @example
|
|
937
|
+
* Set the position of another game object instance with id "x":
|
|
938
|
+
* ```ts
|
|
939
|
+
* // `p` is the desired position (a Vector3).
|
|
940
|
+
* const p = vmath.vector3();
|
|
895
941
|
*
|
|
896
|
-
* //
|
|
942
|
+
* // Relative addressing by id — no socket prefix:
|
|
897
943
|
* go.set_position(p, "x");
|
|
898
944
|
* ```
|
|
899
945
|
*/
|
|
@@ -904,14 +950,17 @@ declare global {
|
|
|
904
950
|
* @param rotation - rotation to set
|
|
905
951
|
* @param id - optional id of the game object instance to get the rotation for, by default the instance of the calling script
|
|
906
952
|
* @example
|
|
953
|
+
* Set the rotation of the game object instance the script is attached to:
|
|
907
954
|
* ```ts
|
|
908
955
|
* // `r` is the desired rotation (a Quaternion).
|
|
909
956
|
* const r = vmath.quat();
|
|
910
|
-
*
|
|
911
|
-
* // Set the rotation of the game object the script is attached to:
|
|
912
957
|
* go.set_rotation(r);
|
|
913
|
-
*
|
|
914
|
-
*
|
|
958
|
+
* ```
|
|
959
|
+
* @example
|
|
960
|
+
* Set the rotation of another game object instance with id "x":
|
|
961
|
+
* ```ts
|
|
962
|
+
* // `r` is the desired rotation (a Quaternion).
|
|
963
|
+
* const r = vmath.quat();
|
|
915
964
|
* go.set_rotation(r, "x");
|
|
916
965
|
* ```
|
|
917
966
|
*/
|
|
@@ -923,14 +972,16 @@ declare global {
|
|
|
923
972
|
* @param scale - vector or uniform scale factor, must be greater than 0
|
|
924
973
|
* @param id - optional id of the game object instance to get the scale for, by default the instance of the calling script
|
|
925
974
|
* @example
|
|
975
|
+
* Set the scale of the game object instance the script is attached to:
|
|
926
976
|
* ```ts
|
|
927
|
-
* // Set the scale of the game object the script is attached to:
|
|
928
977
|
* const s = vmath.vector3(2.0, 1.0, 1.0);
|
|
929
978
|
* go.set_scale(s);
|
|
930
|
-
*
|
|
931
|
-
*
|
|
932
|
-
*
|
|
933
|
-
*
|
|
979
|
+
* ```
|
|
980
|
+
* @example
|
|
981
|
+
* Set the scale of another game object instance with id "obj_id":
|
|
982
|
+
* ```ts
|
|
983
|
+
* const s = 1.2;
|
|
984
|
+
* go.set_scale(s, "obj_id");
|
|
934
985
|
* ```
|
|
935
986
|
*/
|
|
936
987
|
export function set_scale(scale: number | Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
|
|
@@ -941,14 +992,16 @@ declare global {
|
|
|
941
992
|
* @param scale - vector or uniform scale factor, must be greater than 0
|
|
942
993
|
* @param id - optional id of the game object instance to get the scale for, by default the instance of the calling script
|
|
943
994
|
* @example
|
|
995
|
+
* Set the scale of the game object instance the script is attached to:
|
|
944
996
|
* ```ts
|
|
945
|
-
* // Set the scale of the game object the script is attached to:
|
|
946
997
|
* const s = vmath.vector3(2.0, 1.0, 5.0);
|
|
947
998
|
* go.set_scale_xy(s); // z will not be set here, only x and y
|
|
948
|
-
*
|
|
949
|
-
*
|
|
950
|
-
*
|
|
951
|
-
*
|
|
999
|
+
* ```
|
|
1000
|
+
* @example
|
|
1001
|
+
* Set the scale of another game object instance with id "obj_id":
|
|
1002
|
+
* ```ts
|
|
1003
|
+
* const s = 1.2;
|
|
1004
|
+
* go.set_scale_xy(s, "obj_id"); // z will not be set here, only x and y
|
|
952
1005
|
* ```
|
|
953
1006
|
*/
|
|
954
1007
|
export function set_scale_xy(scale: number | Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
|
|
@@ -986,11 +1039,13 @@ declare global {
|
|
|
986
1039
|
*
|
|
987
1040
|
* @param id - optional id of the game object instance to update
|
|
988
1041
|
* @example
|
|
1042
|
+
* Update this game object's world transform:
|
|
989
1043
|
* ```ts
|
|
990
|
-
* // Update this game object's world transform:
|
|
991
1044
|
* go.update_world_transform();
|
|
992
|
-
*
|
|
993
|
-
*
|
|
1045
|
+
* ```
|
|
1046
|
+
* @example
|
|
1047
|
+
* Update another game object's world transform:
|
|
1048
|
+
* ```ts
|
|
994
1049
|
* go.update_world_transform("/other");
|
|
995
1050
|
* ```
|
|
996
1051
|
*/
|
package/generated/graphics.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ declare global {
|
|
|
4
4
|
* Graphics functions and constants.
|
|
5
5
|
*/
|
|
6
6
|
namespace graphics {
|
|
7
|
+
type BufferType = typeof graphics.BUFFER_TYPE_COLOR0_BIT | typeof graphics.BUFFER_TYPE_COLOR1_BIT | typeof graphics.BUFFER_TYPE_COLOR2_BIT | typeof graphics.BUFFER_TYPE_COLOR3_BIT | typeof graphics.BUFFER_TYPE_DEPTH_BIT | typeof graphics.BUFFER_TYPE_STENCIL_BIT;
|
|
8
|
+
type State = typeof graphics.STATE_DEPTH_TEST | typeof graphics.STATE_STENCIL_TEST | typeof graphics.STATE_BLEND | typeof graphics.STATE_ALPHA_TEST | typeof graphics.STATE_CULL_FACE | typeof graphics.STATE_POLYGON_OFFSET_FILL;
|
|
7
9
|
const BLEND_EQUATION_ADD: number & { readonly __brand: "graphics.BLEND_EQUATION_ADD" };
|
|
8
10
|
const BLEND_EQUATION_MAX: number & { readonly __brand: "graphics.BLEND_EQUATION_MAX" };
|
|
9
11
|
const BLEND_EQUATION_MIN: number & { readonly __brand: "graphics.BLEND_EQUATION_MIN" };
|