@defold-typescript/types 0.8.3 → 0.9.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 (47) hide show
  1. package/README.md +1 -1
  2. package/api-targets.json +18 -0
  3. package/generated/b2d_body.d.ts +348 -0
  4. package/generated/buffer.d.ts +3 -0
  5. package/generated/camera.d.ts +236 -1
  6. package/generated/collectionfactory.d.ts +4 -0
  7. package/generated/factory.d.ts +4 -0
  8. package/generated/font.d.ts +81 -0
  9. package/generated/go.d.ts +53 -0
  10. package/generated/gui.d.ts +264 -49
  11. package/generated/html5.d.ts +17 -13
  12. package/generated/http.d.ts +16 -0
  13. package/generated/image.d.ts +24 -0
  14. package/generated/json.d.ts +2 -0
  15. package/generated/kinds/gui-script.d.ts +3 -0
  16. package/generated/kinds/render-script.d.ts +3 -0
  17. package/generated/kinds/script.d.ts +3 -0
  18. package/generated/model.d.ts +14 -0
  19. package/generated/msg.d.ts +17 -11
  20. package/generated/particlefx.d.ts +6 -0
  21. package/generated/physics.d.ts +32 -0
  22. package/generated/profiler.d.ts +14 -0
  23. package/generated/render.d.ts +109 -0
  24. package/generated/resource.d.ts +223 -0
  25. package/generated/socket.d.ts +4 -0
  26. package/generated/sound.d.ts +6 -0
  27. package/generated/sprite.d.ts +5 -0
  28. package/generated/sys.d.ts +136 -0
  29. package/generated/tilemap.d.ts +2 -0
  30. package/generated/timer.d.ts +3 -0
  31. package/generated/vmath.d.ts +109 -93
  32. package/generated/window.d.ts +24 -1
  33. package/index.d.ts +8 -0
  34. package/package.json +1 -1
  35. package/scripts/fidelity-baseline.json +18 -2
  36. package/scripts/regen.ts +5 -0
  37. package/scripts/signature-store-io.ts +18 -0
  38. package/scripts/sync-api-docs.ts +208 -12
  39. package/src/core-types.ts +4 -2
  40. package/src/doc-comment.ts +42 -5
  41. package/src/emit-dts.ts +20 -1
  42. package/src/engine-globals.d.ts +2 -0
  43. package/src/example-store.ts +11 -7
  44. package/src/index.ts +18 -1
  45. package/src/msg-overloads.d.ts +3 -0
  46. package/src/signature-store.ts +20 -0
  47. package/src/window-event-guard.d.ts +52 -0
@@ -0,0 +1,81 @@
1
+ /** @noSelfInFile */
2
+ import type { Hash } from "../src/core-types";
3
+
4
+ declare global {
5
+ /**
6
+ * Functions, messages and properties used to manipulate font resources.
7
+ */
8
+ namespace font {
9
+ /**
10
+ * associates a ttf resource to a .fontc file.
11
+ *
12
+ * @param fontc - The path to the .fontc resource
13
+ * @param ttf - The path to the .ttf resource
14
+ * @example
15
+ * ```ts
16
+ * const font_hash = hash("/assets/fonts/roboto.fontc");
17
+ * const ttf_hash = hash("/assets/fonts/Roboto/Roboto-Bold.ttf");
18
+ * font.add_font(font_hash, ttf_hash);
19
+ * ```
20
+ */
21
+ function add_font(fontc: string | Hash, ttf: string | Hash): void;
22
+ /**
23
+ * Gets information about a font, such as the associated font files
24
+ *
25
+ * @param fontc - The path to the .fontc resource
26
+ * @returns the information table contains these fields:
27
+ *
28
+ * `path`
29
+ * hash The path hash of the current file.
30
+ * `fonts`
31
+ *
32
+ * table An array of associated font (e.g. .ttf) files. Each item is a table that contains:
33
+ *
34
+ * `path`
35
+ * string The path of the font file
36
+ * `path_hash`
37
+ * hash The path of the font file
38
+ */
39
+ function get_info(fontc: string | Hash): { path: Hash; fonts: Record<string | number, unknown>; path: string; path_hash: Hash };
40
+ /**
41
+ * prepopulates the font glyph cache with rasterised glyphs
42
+ *
43
+ * @param fontc - The path to the .fontc resource
44
+ * @param text - The text to layout
45
+ * @param callback - (optional) A callback function that is called after the request is finished
46
+ *
47
+ * `self`
48
+ * object The current object.
49
+ * `request_id`
50
+ * number The request id
51
+ * `result`
52
+ * boolean True if request was succesful
53
+ * `errstring`
54
+ * string `nil` if the request was successful
55
+ * @returns Returns the asynchronous request id
56
+ * @example
57
+ * ```ts
58
+ * const font_hash = hash("/assets/fonts/roboto.fontc");
59
+ * font.prewarm_text(font_hash, "Some text", (self, request_id, result, errstring) => {
60
+ * // cache is warm, show the text!
61
+ * });
62
+ * ```
63
+ */
64
+ function prewarm_text(fontc: string | Hash, text: string, callback?: (self: unknown, request_id: unknown, result: unknown, errstring: unknown) => void): number;
65
+ /**
66
+ * associates a ttf resource to a .fontc file
67
+ *
68
+ * @param fontc - The path to the .fontc resource
69
+ * @param ttf - The path to the .ttf resource
70
+ * @example
71
+ * ```ts
72
+ * const font_hash = hash("/assets/fonts/roboto.fontc");
73
+ * const ttf_hash = hash("/assets/fonts/Roboto/Roboto-Bold.ttf");
74
+ * font.remove_font(font_hash, ttf_hash);
75
+ * ```
76
+ */
77
+ function remove_font(fontc: string | Hash, ttf: string | Hash): void;
78
+ }
79
+ }
80
+
81
+ export {};
package/generated/go.d.ts CHANGED
@@ -213,22 +213,34 @@ declare global {
213
213
  * @param url - url of the game object or component having the property
214
214
  * @param property - id of the property to animate
215
215
  * @param playback - playback mode of the animation
216
+ *
216
217
  * - `go.PLAYBACK_ONCE_FORWARD`
218
+ *
217
219
  * - `go.PLAYBACK_ONCE_BACKWARD`
220
+ *
218
221
  * - `go.PLAYBACK_ONCE_PINGPONG`
222
+ *
219
223
  * - `go.PLAYBACK_LOOP_FORWARD`
224
+ *
220
225
  * - `go.PLAYBACK_LOOP_BACKWARD`
226
+ *
221
227
  * - `go.PLAYBACK_LOOP_PINGPONG`
222
228
  * @param to - target property value
223
229
  * @param easing - easing to use during animation. Either specify a constant, see the animation guide for a complete list, or a vmath.vector with a curve
224
230
  * @param duration - duration of the animation in seconds
225
231
  * @param delay - delay before the animation starts in seconds
226
232
  * @param complete_function - optional function to call when the animation has completed
233
+ *
227
234
  * `self`
235
+ *
228
236
  * object The current object.
237
+ *
229
238
  * `url`
239
+ *
230
240
  * url The game object or component instance for which the property is animated.
241
+ *
231
242
  * `property`
243
+ *
232
244
  * hash The id of the animated property.
233
245
  * @example
234
246
  * ```ts
@@ -350,7 +362,9 @@ declare global {
350
362
  /**
351
363
  * Returns or constructs an instance identifier. The instance id is a hash
352
364
  * of the absolute path to the instance.
365
+ *
353
366
  * - If `path` is specified, it can either be absolute or relative to the instance of the calling script.
367
+ *
354
368
  * - If `path` is not specified, the id of the game object instance the script is attached to will be returned.
355
369
  *
356
370
  * @param path - path of the instance for which to return the id
@@ -573,80 +587,119 @@ declare global {
573
587
  * Mouse movement is specifically handled and uses `nil` as its `action_id`.
574
588
  * The `action` only contains positional parameters in this case, such as x and y of the pointer.
575
589
  * Here is a brief description of the available table fields:
590
+ *
576
591
  * Field
577
592
  * Description
593
+ *
578
594
  * `value`
579
595
  * The amount of input given by the user. This is usually 1 for buttons and 0-1 for analogue inputs. This is not present for mouse movement and text input.
596
+ *
580
597
  * `pressed`
581
598
  * If the input was pressed this frame. This is not present for mouse movement and text input.
599
+ *
582
600
  * `released`
583
601
  * If the input was released this frame. This is not present for mouse movement and text input.
602
+ *
584
603
  * `repeated`
585
604
  * If the input was repeated this frame. This is similar to how a key on a keyboard is repeated when you hold it down. This is not present for mouse movement and text input.
605
+ *
586
606
  * `x`
587
607
  * The x value of a pointer device, if present. This is not present for gamepad, key and text input.
608
+ *
588
609
  * `y`
589
610
  * The y value of a pointer device, if present. This is not present for gamepad, key and text input.
611
+ *
590
612
  * `screen_x`
591
613
  * The screen space x value of a pointer device, if present. This is not present for gamepad, key and text input.
614
+ *
592
615
  * `screen_y`
593
616
  * The screen space y value of a pointer device, if present. This is not present for gamepad, key and text input.
617
+ *
594
618
  * `dx`
595
619
  * The change in x value of a pointer device, if present. This is not present for gamepad, key and text input.
620
+ *
596
621
  * `dy`
597
622
  * The change in y value of a pointer device, if present. This is not present for gamepad, key and text input.
623
+ *
598
624
  * `screen_dx`
599
625
  * The change in screen space x value of a pointer device, if present. This is not present for gamepad, key and text input.
626
+ *
600
627
  * `screen_dy`
601
628
  * The change in screen space y value of a pointer device, if present. This is not present for gamepad, key and text input.
629
+ *
602
630
  * `gamepad`
603
631
  * The index of the gamepad device that provided the input. See table below about gamepad input.
632
+ *
604
633
  * `touch`
605
634
  * List of touch input, one element per finger, if present. See table below about touch input
635
+ *
606
636
  * `text`
607
637
  * Text input from a (virtual) keyboard or similar.
638
+ *
608
639
  * `marked_text`
609
640
  * Sequence of entered symbols while entering a symbol combination, for example Japanese Kana.
641
+ *
610
642
  * Gamepad specific fields:
643
+ *
611
644
  * Field
612
645
  * Description
646
+ *
613
647
  * `gamepad`
614
648
  * The index of the gamepad device that provided the input.
649
+ *
615
650
  * `userid`
616
651
  * Id of the user associated with the controller. Usually only relevant on consoles.
652
+ *
617
653
  * `gamepad_unknown`
618
654
  * True if the inout originated from an unknown/unmapped gamepad.
655
+ *
619
656
  * `gamepad_name`
620
657
  * Name of the gamepad
658
+ *
621
659
  * `gamepad_axis`
622
660
  * List of gamepad axis values. For raw gamepad input only.
661
+ *
623
662
  * `gamepadhats`
624
663
  * List of gamepad hat values. For raw gamepad input only.
664
+ *
625
665
  * `gamepad_buttons`
626
666
  * List of gamepad button values. For raw gamepad input only.
667
+ *
627
668
  * Touch input table:
669
+ *
628
670
  * Field
629
671
  * Description
672
+ *
630
673
  * `id`
631
674
  * A number identifying the touch input during its duration.
675
+ *
632
676
  * `pressed`
633
677
  * True if the finger was pressed this frame.
678
+ *
634
679
  * `released`
635
680
  * True if the finger was released this frame.
681
+ *
636
682
  * `tap_count`
637
683
  * Number of taps, one for single, two for double-tap, etc
684
+ *
638
685
  * `x`
639
686
  * The x touch location.
687
+ *
640
688
  * `y`
641
689
  * The y touch location.
690
+ *
642
691
  * `dx`
643
692
  * The change in x value.
693
+ *
644
694
  * `dy`
645
695
  * The change in y value.
696
+ *
646
697
  * `acc_x`
647
698
  * Accelerometer x value (if present).
699
+ *
648
700
  * `acc_y`
649
701
  * Accelerometer y value (if present).
702
+ *
650
703
  * `acc_z`
651
704
  * Accelerometer z value (if present).
652
705
  *