@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.
Files changed (83) hide show
  1. package/api-signatures.json +348 -267
  2. package/examples/translations.json +323 -147
  3. package/generated/b2d_body.d.ts +7 -4
  4. package/generated/buffer.d.ts +16 -4
  5. package/generated/camera.d.ts +1 -0
  6. package/generated/collectionfactory.d.ts +5 -2
  7. package/generated/collectionproxy.d.ts +1 -1
  8. package/generated/factory.d.ts +2 -1
  9. package/generated/go.d.ts +141 -86
  10. package/generated/graphics.d.ts +2 -0
  11. package/generated/gui.d.ts +65 -40
  12. package/generated/html5.d.ts +1 -1
  13. package/generated/http.d.ts +4 -0
  14. package/generated/model.d.ts +9 -4
  15. package/generated/particlefx.d.ts +1 -1
  16. package/generated/physics.d.ts +16 -9
  17. package/generated/profiler.d.ts +9 -2
  18. package/generated/render.d.ts +224 -99
  19. package/generated/resource.d.ts +143 -157
  20. package/generated/socket.d.ts +13 -8
  21. package/generated/sound.d.ts +3 -2
  22. package/generated/sys.d.ts +16 -10
  23. package/generated/tilemap.d.ts +25 -19
  24. package/generated/timer.d.ts +33 -24
  25. package/generated/versions/defold-1.12.4/buffer.d.ts +16 -4
  26. package/generated/versions/defold-1.12.4/camera.d.ts +1 -0
  27. package/generated/versions/defold-1.12.4/collectionfactory.d.ts +5 -2
  28. package/generated/versions/defold-1.12.4/collectionproxy.d.ts +1 -1
  29. package/generated/versions/defold-1.12.4/factory.d.ts +2 -1
  30. package/generated/versions/defold-1.12.4/go.d.ts +141 -86
  31. package/generated/versions/defold-1.12.4/graphics.d.ts +2 -0
  32. package/generated/versions/defold-1.12.4/gui.d.ts +63 -39
  33. package/generated/versions/defold-1.12.4/html5.d.ts +1 -1
  34. package/generated/versions/defold-1.12.4/http.d.ts +4 -0
  35. package/generated/versions/defold-1.12.4/model.d.ts +9 -4
  36. package/generated/versions/defold-1.12.4/particlefx.d.ts +1 -1
  37. package/generated/versions/defold-1.12.4/physics.d.ts +16 -9
  38. package/generated/versions/defold-1.12.4/profiler.d.ts +9 -2
  39. package/generated/versions/defold-1.12.4/render.d.ts +223 -98
  40. package/generated/versions/defold-1.12.4/resource.d.ts +143 -157
  41. package/generated/versions/defold-1.12.4/socket.d.ts +13 -8
  42. package/generated/versions/defold-1.12.4/sound.d.ts +3 -2
  43. package/generated/versions/defold-1.12.4/sys.d.ts +16 -10
  44. package/generated/versions/defold-1.12.4/tilemap.d.ts +25 -19
  45. package/generated/versions/defold-1.12.4/timer.d.ts +33 -24
  46. package/generated/versions/defold-1.12.4/vmath.d.ts +13 -5
  47. package/generated/versions/defold-1.12.4/window.d.ts +5 -3
  48. package/generated/versions/defold-1.13.0/b2d_body.d.ts +7 -4
  49. package/generated/versions/defold-1.13.0/buffer.d.ts +16 -4
  50. package/generated/versions/defold-1.13.0/camera.d.ts +1 -0
  51. package/generated/versions/defold-1.13.0/collectionfactory.d.ts +5 -2
  52. package/generated/versions/defold-1.13.0/collectionproxy.d.ts +1 -1
  53. package/generated/versions/defold-1.13.0/factory.d.ts +2 -1
  54. package/generated/versions/defold-1.13.0/go.d.ts +141 -86
  55. package/generated/versions/defold-1.13.0/graphics.d.ts +2 -0
  56. package/generated/versions/defold-1.13.0/gui.d.ts +63 -39
  57. package/generated/versions/defold-1.13.0/html5.d.ts +1 -1
  58. package/generated/versions/defold-1.13.0/http.d.ts +4 -0
  59. package/generated/versions/defold-1.13.0/model.d.ts +9 -4
  60. package/generated/versions/defold-1.13.0/particlefx.d.ts +1 -1
  61. package/generated/versions/defold-1.13.0/physics.d.ts +16 -9
  62. package/generated/versions/defold-1.13.0/profiler.d.ts +9 -2
  63. package/generated/versions/defold-1.13.0/render.d.ts +224 -99
  64. package/generated/versions/defold-1.13.0/resource.d.ts +143 -157
  65. package/generated/versions/defold-1.13.0/socket.d.ts +13 -8
  66. package/generated/versions/defold-1.13.0/sound.d.ts +3 -2
  67. package/generated/versions/defold-1.13.0/sys.d.ts +16 -10
  68. package/generated/versions/defold-1.13.0/tilemap.d.ts +25 -19
  69. package/generated/versions/defold-1.13.0/timer.d.ts +33 -24
  70. package/generated/versions/defold-1.13.0/vmath.d.ts +13 -5
  71. package/generated/versions/defold-1.13.0/window.d.ts +5 -3
  72. package/generated/vmath.d.ts +13 -5
  73. package/generated/window.d.ts +5 -3
  74. package/package.json +2 -1
  75. package/src/api-doc.ts +8 -0
  76. package/src/doc-comment.ts +213 -32
  77. package/src/emit-dts.ts +501 -10
  78. package/src/example-store.ts +26 -0
  79. package/src/index.ts +5 -0
  80. package/src/lifecycle.ts +31 -8
  81. package/src/message-dispatch.d.ts +55 -13
  82. package/src/msg-overloads.d.ts +73 -3
  83. package/src/render-overloads.d.ts +0 -17
@@ -8,6 +8,8 @@ declare global {
8
8
  * files.
9
9
  */
10
10
  namespace go {
11
+ 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;
12
+ 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;
11
13
  /**
12
14
  * in-back
13
15
  */
@@ -243,14 +245,15 @@ declare global {
243
245
  *
244
246
  * hash The id of the animated property.
245
247
  * @example
248
+ * Animate the position of a game object to x = 10 during 1 second, then y = 20 during 1 second:
246
249
  * ```ts
247
- * // Animate the position of a game object to x = 10 during 1 second, then
248
- * // y = 20 during 1 second:
249
250
  * go.animate(go.get_id(), "position.x", go.PLAYBACK_ONCE_FORWARD, 10, go.EASING_LINEAR, 1, 0, () => {
250
251
  * go.animate(go.get_id(), "position.y", go.PLAYBACK_ONCE_FORWARD, 20, go.EASING_LINEAR, 1);
251
252
  * });
252
- *
253
- * // Animate the y position of a game object using a crazy custom easing curve:
253
+ * ```
254
+ * @example
255
+ * Animate the y position of a game object using a crazy custom easing curve:
256
+ * ```ts
254
257
  * const values = [
255
258
  * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
256
259
  * 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -261,7 +264,7 @@ declare global {
261
264
  * go.animate("go", "position.y", go.PLAYBACK_LOOP_PINGPONG, 100, vec, 2.0);
262
265
  * ```
263
266
  */
264
- export function animate(url: SceneAddress | Hash | Url, property: string | Hash, playback: number & { readonly __brand: "go.PLAYBACK_ONCE_FORWARD" } | number & { readonly __brand: "go.PLAYBACK_ONCE_BACKWARD" } | number & { readonly __brand: "go.PLAYBACK_ONCE_PINGPONG" } | number & { readonly __brand: "go.PLAYBACK_LOOP_FORWARD" } | number & { readonly __brand: "go.PLAYBACK_LOOP_BACKWARD" } | number & { readonly __brand: "go.PLAYBACK_LOOP_PINGPONG" }, to: number | Vector3 | Vector4 | Quaternion, easing: Vector | number & { readonly __brand: "go.EASING_INBACK" } | number & { readonly __brand: "go.EASING_INBOUNCE" } | number & { readonly __brand: "go.EASING_INCIRC" } | number & { readonly __brand: "go.EASING_INCUBIC" } | number & { readonly __brand: "go.EASING_INELASTIC" } | number & { readonly __brand: "go.EASING_INEXPO" } | number & { readonly __brand: "go.EASING_INOUTBACK" } | number & { readonly __brand: "go.EASING_INOUTBOUNCE" } | number & { readonly __brand: "go.EASING_INOUTCIRC" } | number & { readonly __brand: "go.EASING_INOUTCUBIC" } | number & { readonly __brand: "go.EASING_INOUTELASTIC" } | number & { readonly __brand: "go.EASING_INOUTEXPO" } | number & { readonly __brand: "go.EASING_INOUTQUAD" } | number & { readonly __brand: "go.EASING_INOUTQUART" } | number & { readonly __brand: "go.EASING_INOUTQUINT" } | number & { readonly __brand: "go.EASING_INOUTSINE" } | number & { readonly __brand: "go.EASING_INQUAD" } | number & { readonly __brand: "go.EASING_INQUART" } | number & { readonly __brand: "go.EASING_INQUINT" } | number & { readonly __brand: "go.EASING_INSINE" } | number & { readonly __brand: "go.EASING_LINEAR" } | number & { readonly __brand: "go.EASING_OUTBACK" } | number & { readonly __brand: "go.EASING_OUTBOUNCE" } | number & { readonly __brand: "go.EASING_OUTCIRC" } | number & { readonly __brand: "go.EASING_OUTCUBIC" } | number & { readonly __brand: "go.EASING_OUTELASTIC" } | number & { readonly __brand: "go.EASING_OUTEXPO" } | number & { readonly __brand: "go.EASING_OUTINBACK" } | number & { readonly __brand: "go.EASING_OUTINBOUNCE" } | number & { readonly __brand: "go.EASING_OUTINCIRC" } | number & { readonly __brand: "go.EASING_OUTINCUBIC" } | number & { readonly __brand: "go.EASING_OUTINELASTIC" } | number & { readonly __brand: "go.EASING_OUTINEXPO" } | number & { readonly __brand: "go.EASING_OUTINQUAD" } | number & { readonly __brand: "go.EASING_OUTINQUART" } | number & { readonly __brand: "go.EASING_OUTINQUINT" } | number & { readonly __brand: "go.EASING_OUTINSINE" } | number & { readonly __brand: "go.EASING_OUTQUAD" } | number & { readonly __brand: "go.EASING_OUTQUART" } | number & { readonly __brand: "go.EASING_OUTQUINT" } | number & { readonly __brand: "go.EASING_OUTSINE" }, duration: number, delay?: number, complete_function?: (self: unknown, url: unknown, property: unknown) => void): void;
267
+ 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;
265
268
  /**
266
269
  * By calling this function, all or specified stored property animations of the game object or component will be canceled.
267
270
  * See the properties guide for which properties can be animated and the animation guide for how to animate them.
@@ -269,14 +272,18 @@ declare global {
269
272
  * @param url - url of the game object or component
270
273
  * @param property - optional id of the property to cancel
271
274
  * @example
275
+ * Cancel the animation of the position of a game object:
272
276
  * ```ts
273
- * // Cancel the animation of the position of a game object:
274
277
  * go.cancel_animations(go.get_id(), "position");
275
- *
276
- * // Cancel all property animations of the current game object:
278
+ * ```
279
+ * @example
280
+ * Cancel all property animations of the current game object:
281
+ * ```ts
277
282
  * go.cancel_animations(".");
278
- *
279
- * // Cancel all property animations of the sprite component of the current game object:
283
+ * ```
284
+ * @example
285
+ * Cancel all property animations of the sprite component of the current game object:
286
+ * ```ts
280
287
  * go.cancel_animations("#sprite");
281
288
  * ```
282
289
  */
@@ -292,8 +299,8 @@ declare global {
292
299
  * @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
293
300
  * @param recursive - optional boolean, set to true to recursively delete child hiearchy in child to parent order
294
301
  * @example
302
+ * This example demonstrates how to delete game objects
295
303
  * ```ts
296
- * // This example demonstrates how to delete game objects:
297
304
  * // Delete the script's own game object.
298
305
  * go.delete();
299
306
  * // Delete a game object with the id "my_game_object".
@@ -302,17 +309,18 @@ declare global {
302
309
  * // Delete a list of game objects.
303
310
  * const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
304
311
  * go.delete(ids);
305
- *
306
- * // This example demonstrates how to delete game objects and their children
307
- * // (child-to-parent order):
312
+ * ```
313
+ * @example
314
+ * This example demonstrates how to delete a game objects and their children (child to parent order)
315
+ * ```ts
308
316
  * // Delete the script's own game object and its children.
309
317
  * go.delete(true);
310
318
  * // Delete a game object with the id "my_game_object" and its children.
311
- * const id2 = go.get_id("my_game_object");
312
- * go.delete(id2, true);
319
+ * const id = go.get_id("my_game_object");
320
+ * go.delete(id, true);
313
321
  * // Delete a list of game objects and their children.
314
- * const ids2 = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
315
- * go.delete(ids2, true);
322
+ * const ids = [hash("/my_object_1"), hash("/my_object_2"), hash("/my_object_3")];
323
+ * go.delete(ids, true);
316
324
  * ```
317
325
  */
318
326
  function _delete(id?: SceneGameObjectAddress | Hash | Url | (SceneGameObjectAddress | Hash | Url)[], recursive?: boolean): void;
@@ -323,11 +331,13 @@ declare global {
323
331
  * @param url - url of the game object to check
324
332
  * @returns true if the game object exists
325
333
  * @example
334
+ * Check if game object "my_game_object" exists in the current collection
326
335
  * ```ts
327
- * // Check if game object "my_game_object" exists in the current collection:
328
336
  * go.exists("/my_game_object");
329
- *
330
- * // Check if game object exists in another collection:
337
+ * ```
338
+ * @example
339
+ * Check if game object exists in another collection
340
+ * ```ts
331
341
  * go.exists("other_collection:/my_game_object");
332
342
  * ```
333
343
  */
@@ -390,12 +400,14 @@ declare global {
390
400
  * @param id - optional id of the game object instance to get parent for, defaults to the instance containing the calling script
391
401
  * @returns parent instance or `nil`
392
402
  * @example
403
+ * Get parent of the instance containing the calling script:
393
404
  * ```ts
394
- * // Get parent of the instance containing the calling script:
395
405
  * const parent_id = go.get_parent();
396
- *
397
- * // Get parent of the instance with id "x":
398
- * const parent_id2 = go.get_parent("x");
406
+ * ```
407
+ * @example
408
+ * Get parent of the instance with id "x":
409
+ * ```ts
410
+ * const parent_id = go.get_parent("x");
399
411
  * ```
400
412
  */
401
413
  export function get_parent(id?: SceneGameObjectAddress | Hash | Url): Hash | undefined;
@@ -405,11 +417,13 @@ declare global {
405
417
  * @param id - optional id of the game object instance to get the position for, by default the instance of the calling script
406
418
  * @returns instance position
407
419
  * @example
420
+ * Get the position of the game object instance the script is attached to:
408
421
  * ```ts
409
- * // Get the position of the game object the script is attached to:
410
422
  * const p = go.get_position();
411
- *
412
- * // Get the position of another game object "my_gameobject":
423
+ * ```
424
+ * @example
425
+ * Get the position of another game object instance "my_gameobject":
426
+ * ```ts
413
427
  * const pos = go.get_position("my_gameobject");
414
428
  * ```
415
429
  */
@@ -420,12 +434,14 @@ declare global {
420
434
  * @param id - optional id of the game object instance to get the rotation for, by default the instance of the calling script
421
435
  * @returns instance rotation
422
436
  * @example
437
+ * Get the rotation of the game object instance the script is attached to:
423
438
  * ```ts
424
- * // Get the rotation of the game object the script is attached to:
425
439
  * const r = go.get_rotation();
426
- *
427
- * // Get the rotation of another game object with id "x":
428
- * const r2 = go.get_rotation("x");
440
+ * ```
441
+ * @example
442
+ * Get the rotation of another game object instance with id "x":
443
+ * ```ts
444
+ * const r = go.get_rotation("x");
429
445
  * ```
430
446
  */
431
447
  export function get_rotation(id?: SceneGameObjectAddress | Hash | Url): Quaternion;
@@ -435,12 +451,14 @@ declare global {
435
451
  * @param id - optional id of the game object instance to get the scale for, by default the instance of the calling script
436
452
  * @returns instance scale factor
437
453
  * @example
454
+ * Get the scale of the game object instance the script is attached to:
438
455
  * ```ts
439
- * // Get the scale of the game object the script is attached to:
440
456
  * const s = go.get_scale();
441
- *
442
- * // Get the scale of another game object with id "x":
443
- * const s2 = go.get_scale("x");
457
+ * ```
458
+ * @example
459
+ * Get the scale of another game object instance with id "x":
460
+ * ```ts
461
+ * const s = go.get_scale("x");
444
462
  * ```
445
463
  */
446
464
  export function get_scale(id?: SceneGameObjectAddress | Hash | Url): Vector3;
@@ -450,12 +468,14 @@ declare global {
450
468
  * @param id - optional id of the game object instance to get the uniform scale for, by default the instance of the calling script
451
469
  * @returns uniform instance scale factor
452
470
  * @example
471
+ * Get the scale of the game object instance the script is attached to:
453
472
  * ```ts
454
- * // Get the uniform scale of the game object the script is attached to:
455
473
  * const s = go.get_scale_uniform();
456
- *
457
- * // Get the uniform scale of another game object with id "x":
458
- * const s2 = go.get_scale_uniform("x");
474
+ * ```
475
+ * @example
476
+ * Get the uniform scale of another game object instance with id "x":
477
+ * ```ts
478
+ * const s = go.get_scale_uniform("x");
459
479
  * ```
460
480
  */
461
481
  export function get_scale_uniform(id?: SceneGameObjectAddress | Hash | Url): number;
@@ -467,12 +487,15 @@ declare global {
467
487
  * @param id - optional id of the game object instance to get the world position for, by default the instance of the calling script
468
488
  * @returns instance world position
469
489
  * @example
490
+ * Get the world position of the game object instance the script is attached to:
470
491
  * ```ts
471
- * // Get the world position of the game object the script is attached to:
472
492
  * const p = go.get_world_position();
473
- *
474
- * // Reach a sibling game object by its id — relative addressing, no socket prefix:
475
- * const p2 = go.get_world_position("x");
493
+ * ```
494
+ * @example
495
+ * Get the world position of another game object instance with id "x":
496
+ * ```ts
497
+ * // Relative addressing by id — no socket prefix:
498
+ * const p = go.get_world_position("x");
476
499
  * ```
477
500
  */
478
501
  export function get_world_position(id?: SceneGameObjectAddress | Hash | Url): Vector3;
@@ -484,12 +507,14 @@ declare global {
484
507
  * @param id - optional id of the game object instance to get the world rotation for, by default the instance of the calling script
485
508
  * @returns instance world rotation
486
509
  * @example
510
+ * Get the world rotation of the game object instance the script is attached to:
487
511
  * ```ts
488
- * // Get the world rotation of the game object the script is attached to:
489
512
  * const r = go.get_world_rotation();
490
- *
491
- * // Get the world rotation of another game object with id "x":
492
- * const r2 = go.get_world_rotation("x");
513
+ * ```
514
+ * @example
515
+ * Get the world rotation of another game object instance with id "x":
516
+ * ```ts
517
+ * const r = go.get_world_rotation("x");
493
518
  * ```
494
519
  */
495
520
  export function get_world_rotation(id?: SceneGameObjectAddress | Hash | Url): Quaternion;
@@ -503,12 +528,14 @@ declare global {
503
528
  * @param id - optional id of the game object instance to get the world scale for, by default the instance of the calling script
504
529
  * @returns instance world 3D scale factor
505
530
  * @example
531
+ * Get the world 3D scale of the game object instance the script is attached to:
506
532
  * ```ts
507
- * // Get the world 3D scale of the game object the script is attached to:
508
533
  * const s = go.get_world_scale();
509
- *
510
- * // Get the world scale of another game object "x":
511
- * const s2 = go.get_world_scale("x");
534
+ * ```
535
+ * @example
536
+ * Get the world scale of another game object instance "x":
537
+ * ```ts
538
+ * const s = go.get_world_scale("x");
512
539
  * ```
513
540
  */
514
541
  export function get_world_scale(id?: SceneGameObjectAddress | Hash | Url): Vector3;
@@ -520,12 +547,14 @@ declare global {
520
547
  * @param id - optional id of the game object instance to get the world scale for, by default the instance of the calling script
521
548
  * @returns instance world scale factor
522
549
  * @example
550
+ * Get the world scale of the game object instance the script is attached to:
523
551
  * ```ts
524
- * // Get the world uniform scale of the game object the script is attached to:
525
552
  * const s = go.get_world_scale_uniform();
526
- *
527
- * // Get the world uniform scale of another game object with id "x":
528
- * const s2 = go.get_world_scale_uniform("x");
553
+ * ```
554
+ * @example
555
+ * Get the world scale of another game object instance with id "x":
556
+ * ```ts
557
+ * const s = go.get_world_scale_uniform("x");
529
558
  * ```
530
559
  */
531
560
  export function get_world_scale_uniform(id?: SceneGameObjectAddress | Hash | Url): number;
@@ -536,12 +565,14 @@ declare global {
536
565
  * @param id - optional id of the game object instance to get the world transform for, by default the instance of the calling script
537
566
  * @returns instance world transform
538
567
  * @example
568
+ * Get the world transform of the game object instance the script is attached to:
539
569
  * ```ts
540
- * // Get the world transform of the game object the script is attached to:
541
570
  * const m = go.get_world_transform();
542
- *
543
- * // Get the world transform of another game object with id "x":
544
- * const m2 = go.get_world_transform("x");
571
+ * ```
572
+ * @example
573
+ * Get the world transform of another game object instance with id "x":
574
+ * ```ts
575
+ * const m = go.get_world_transform("x");
545
576
  * ```
546
577
  */
547
578
  export function get_world_transform(id?: SceneGameObjectAddress | Hash | Url): Matrix4;
@@ -754,6 +785,9 @@ declare global {
754
785
  * @param message - a table containing the message data
755
786
  * @param sender - address of the sender
756
787
  * @example
788
+ * This example demonstrates how a game object instance, called "a", can communicate with another instance, called "b". It
789
+ * is assumed that both script components of the instances has id "script".
790
+ * Script of instance "a":
757
791
  * ```ts
758
792
  * // This example demonstrates how a game object instance, called "a", can communicate with another instance, called "b". It
759
793
  * // is assumed that both script components of the instances has id "script".
@@ -765,7 +799,10 @@ declare global {
765
799
  * msg.post("b#script", "my_data", { important_value: 1 });
766
800
  * },
767
801
  * });
768
- *
802
+ * ```
803
+ * @example
804
+ * Script of instance "b":
805
+ * ```ts
769
806
  * // b.script — Script of instance "b":
770
807
  * export default defineScript({
771
808
  * init() {
@@ -843,14 +880,18 @@ declare global {
843
880
  * @param parent_id - optional id of the new parent game object, defaults to detaching game object from its parent
844
881
  * @param keep_world_transform - optional boolean, set to true to maintain the world transform when changing spaces. Defaults to false.
845
882
  * @example
883
+ * Attach myself to another instance "my_parent":
846
884
  * ```ts
847
- * // Attach myself to another instance "my_parent":
848
885
  * go.set_parent(go.get_id(), go.get_id("my_parent"));
849
- *
850
- * // Attach an instance "my_instance" to another instance "my_parent":
886
+ * ```
887
+ * @example
888
+ * Attach an instance "my_instance" to another instance "my_parent":
889
+ * ```ts
851
890
  * go.set_parent(go.get_id("my_instance"), go.get_id("my_parent"));
852
- *
853
- * // Detach an instance "my_instance" from its parent (if any):
891
+ * ```
892
+ * @example
893
+ * Detach an instance "my_instance" from its parent (if any):
894
+ * ```ts
854
895
  * go.set_parent(go.get_id("my_instance"));
855
896
  * ```
856
897
  */
@@ -861,14 +902,19 @@ declare global {
861
902
  * @param position - position to set
862
903
  * @param id - optional id of the game object instance to set the position for, by default the instance of the calling script
863
904
  * @example
905
+ * Set the position of the game object instance the script is attached to:
864
906
  * ```ts
865
907
  * // `p` is the desired position (a Vector3).
866
908
  * const p = vmath.vector3();
867
- *
868
- * // Set the position of the game object the script is attached to:
869
909
  * go.set_position(p);
910
+ * ```
911
+ * @example
912
+ * Set the position of another game object instance with id "x":
913
+ * ```ts
914
+ * // `p` is the desired position (a Vector3).
915
+ * const p = vmath.vector3();
870
916
  *
871
- * // Reach a sibling game object by its id — relative addressing, no socket prefix:
917
+ * // Relative addressing by id — no socket prefix:
872
918
  * go.set_position(p, "x");
873
919
  * ```
874
920
  */
@@ -879,14 +925,17 @@ declare global {
879
925
  * @param rotation - rotation to set
880
926
  * @param id - optional id of the game object instance to get the rotation for, by default the instance of the calling script
881
927
  * @example
928
+ * Set the rotation of the game object instance the script is attached to:
882
929
  * ```ts
883
930
  * // `r` is the desired rotation (a Quaternion).
884
931
  * const r = vmath.quat();
885
- *
886
- * // Set the rotation of the game object the script is attached to:
887
932
  * go.set_rotation(r);
888
- *
889
- * // Set the rotation of another game object with id "x":
933
+ * ```
934
+ * @example
935
+ * Set the rotation of another game object instance with id "x":
936
+ * ```ts
937
+ * // `r` is the desired rotation (a Quaternion).
938
+ * const r = vmath.quat();
890
939
  * go.set_rotation(r, "x");
891
940
  * ```
892
941
  */
@@ -898,14 +947,16 @@ declare global {
898
947
  * @param scale - vector or uniform scale factor, must be greater than 0
899
948
  * @param id - optional id of the game object instance to get the scale for, by default the instance of the calling script
900
949
  * @example
950
+ * Set the scale of the game object instance the script is attached to:
901
951
  * ```ts
902
- * // Set the scale of the game object the script is attached to:
903
952
  * const s = vmath.vector3(2.0, 1.0, 1.0);
904
953
  * go.set_scale(s);
905
- *
906
- * // Set the scale of another game object with id "obj_id":
907
- * const s2 = 1.2;
908
- * go.set_scale(s2, "obj_id");
954
+ * ```
955
+ * @example
956
+ * Set the scale of another game object instance with id "obj_id":
957
+ * ```ts
958
+ * const s = 1.2;
959
+ * go.set_scale(s, "obj_id");
909
960
  * ```
910
961
  */
911
962
  export function set_scale(scale: number | Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
@@ -916,14 +967,16 @@ declare global {
916
967
  * @param scale - vector or uniform scale factor, must be greater than 0
917
968
  * @param id - optional id of the game object instance to get the scale for, by default the instance of the calling script
918
969
  * @example
970
+ * Set the scale of the game object instance the script is attached to:
919
971
  * ```ts
920
- * // Set the scale of the game object the script is attached to:
921
972
  * const s = vmath.vector3(2.0, 1.0, 5.0);
922
973
  * go.set_scale_xy(s); // z will not be set here, only x and y
923
- *
924
- * // Set the scale of another game object with id "obj_id":
925
- * const s2 = 1.2;
926
- * go.set_scale_xy(s2, "obj_id"); // z will not be set here, only x and y
974
+ * ```
975
+ * @example
976
+ * Set the scale of another game object instance with id "obj_id":
977
+ * ```ts
978
+ * const s = 1.2;
979
+ * go.set_scale_xy(s, "obj_id"); // z will not be set here, only x and y
927
980
  * ```
928
981
  */
929
982
  export function set_scale_xy(scale: number | Vector3, id?: SceneGameObjectAddress | Hash | Url): void;
@@ -961,11 +1014,13 @@ declare global {
961
1014
  *
962
1015
  * @param id - optional id of the game object instance to update
963
1016
  * @example
1017
+ * Update this game object's world transform:
964
1018
  * ```ts
965
- * // Update this game object's world transform:
966
1019
  * go.update_world_transform();
967
- *
968
- * // Update another game object's world transform:
1020
+ * ```
1021
+ * @example
1022
+ * Update another game object's world transform:
1023
+ * ```ts
969
1024
  * go.update_world_transform("/other");
970
1025
  * ```
971
1026
  */
@@ -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_FACTOR_CONSTANT_ALPHA: number & { readonly __brand: "graphics.BLEND_FACTOR_CONSTANT_ALPHA" };
8
10
  const BLEND_FACTOR_CONSTANT_COLOR: number & { readonly __brand: "graphics.BLEND_FACTOR_CONSTANT_COLOR" };
9
11
  const BLEND_FACTOR_DST_ALPHA: number & { readonly __brand: "graphics.BLEND_FACTOR_DST_ALPHA" };