@defold-typescript/types 0.51.0 → 0.53.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 (228) hide show
  1. package/api-availability.json +4 -58
  2. package/api-signatures.json +2804 -3172
  3. package/api-targets.json +15 -5
  4. package/examples/translations.json +19 -71
  5. package/generated/b2d.d.ts +39 -39
  6. package/generated/b2d_body.d.ts +11 -11
  7. package/generated/b2d_chain.d.ts +3 -3
  8. package/generated/b2d_fixture.d.ts +5 -5
  9. package/generated/b2d_joint.d.ts +29 -29
  10. package/generated/b2d_shape.d.ts +13 -13
  11. package/generated/b2d_world.d.ts +15 -15
  12. package/generated/buffer.d.ts +10 -11
  13. package/generated/bullet3d.d.ts +6 -6
  14. package/generated/bullet3d_collision_object.d.ts +10 -10
  15. package/generated/bullet3d_constraint.d.ts +173 -71
  16. package/generated/bullet3d_rigid_body.d.ts +3 -3
  17. package/generated/bullet3d_shape.d.ts +11 -11
  18. package/generated/bullet3d_world.d.ts +20 -20
  19. package/generated/camera.d.ts +4 -4
  20. package/generated/collectionfactory.d.ts +2 -3
  21. package/generated/collectionproxy.d.ts +5 -5
  22. package/generated/compute.d.ts +5 -5
  23. package/generated/crash.d.ts +7 -7
  24. package/generated/editor-vm/http.d.ts +13 -13
  25. package/generated/editor-vm/image.d.ts +4 -4
  26. package/generated/editor-vm/json.d.ts +1 -1
  27. package/generated/editor-vm/tilemap_tiles.d.ts +9 -9
  28. package/generated/editor-vm/zip.d.ts +4 -4
  29. package/generated/editor.d.ts +183 -183
  30. package/generated/factory.d.ts +2 -3
  31. package/generated/font.d.ts +4 -4
  32. package/generated/go.d.ts +122 -230
  33. package/generated/graphics.d.ts +23 -25
  34. package/generated/gui.d.ts +186 -423
  35. package/generated/http.d.ts +3 -3
  36. package/generated/image.d.ts +63 -11
  37. package/generated/json.d.ts +4 -4
  38. package/generated/kinds/gui-script.d.ts +2 -0
  39. package/generated/kinds/render-script.d.ts +14 -15
  40. package/generated/label.d.ts +5 -5
  41. package/generated/liveupdate.d.ts +7 -3
  42. package/generated/material.d.ts +49 -49
  43. package/generated/model.d.ts +46 -14
  44. package/generated/particlefx.d.ts +24 -5
  45. package/generated/physics.d.ts +64 -20
  46. package/generated/profiler.d.ts +3 -5
  47. package/generated/render-script-modules/b2d.d.ts +711 -0
  48. package/generated/render-script-modules/bullet3d.d.ts +73 -0
  49. package/generated/render-script-modules/collectionfactory.d.ts +24 -0
  50. package/generated/render-script-modules/collectionproxy.d.ts +39 -0
  51. package/generated/render-script-modules/factory.d.ts +24 -0
  52. package/generated/render-script-modules/go.d.ts +434 -0
  53. package/generated/render-script-modules/label.d.ts +105 -0
  54. package/generated/render-script-modules/model.d.ts +121 -0
  55. package/generated/render-script-modules/particlefx.d.ts +59 -0
  56. package/generated/render-script-modules/physics.d.ts +333 -0
  57. package/generated/render-script-modules/resource.d.ts +1232 -0
  58. package/generated/render-script-modules/sound.d.ts +227 -0
  59. package/generated/render-script-modules/sprite.d.ts +68 -0
  60. package/generated/render-script-modules/tilemap.d.ts +43 -0
  61. package/generated/render.d.ts +172 -47
  62. package/generated/resource.d.ts +81 -61
  63. package/generated/socket.d.ts +18 -23
  64. package/generated/sound.d.ts +6 -6
  65. package/generated/sprite.d.ts +51 -3
  66. package/generated/sys.d.ts +87 -24
  67. package/generated/tilemap.d.ts +3 -3
  68. package/generated/timer.d.ts +3 -3
  69. package/generated/versions/defold-1.12.4/b2d.d.ts +2 -2
  70. package/generated/versions/defold-1.12.4/b2d_body.d.ts +2 -2
  71. package/generated/versions/defold-1.12.4/buffer.d.ts +8 -8
  72. package/generated/versions/defold-1.12.4/go.d.ts +117 -345
  73. package/generated/versions/defold-1.12.4/graphics.d.ts +2 -1
  74. package/generated/versions/defold-1.12.4/gui.d.ts +169 -532
  75. package/generated/versions/defold-1.12.4/http.d.ts +2 -2
  76. package/generated/versions/defold-1.12.4/image.d.ts +82 -2
  77. package/generated/versions/defold-1.12.4/index.d.ts +1 -0
  78. package/generated/versions/defold-1.12.4/label.d.ts +1 -1
  79. package/generated/versions/defold-1.12.4/liveupdate.d.ts +4 -0
  80. package/generated/versions/defold-1.12.4/model.d.ts +42 -10
  81. package/generated/versions/defold-1.12.4/particlefx.d.ts +23 -2
  82. package/generated/versions/defold-1.12.4/physics.d.ts +46 -2
  83. package/generated/versions/defold-1.12.4/render.d.ts +83 -7
  84. package/generated/versions/defold-1.12.4/resource.d.ts +50 -17
  85. package/generated/versions/defold-1.12.4/socket.d.ts +12 -12
  86. package/generated/versions/defold-1.12.4/sound.d.ts +1 -1
  87. package/generated/versions/defold-1.12.4/sprite.d.ts +59 -2
  88. package/generated/versions/defold-1.12.4/sys.d.ts +103 -8
  89. package/generated/versions/defold-1.12.4/tilemap.d.ts +1 -1
  90. package/generated/versions/defold-1.12.4/vmath.d.ts +0 -24
  91. package/generated/versions/defold-1.12.4/window.d.ts +3 -4
  92. package/generated/versions/defold-1.13.0/b2d.d.ts +2 -2
  93. package/generated/versions/defold-1.13.0/b2d_body.d.ts +2 -2
  94. package/generated/versions/defold-1.13.0/b2d_chain.d.ts +1 -1
  95. package/generated/versions/defold-1.13.0/b2d_joint.d.ts +1 -1
  96. package/generated/versions/defold-1.13.0/b2d_shape.d.ts +1 -1
  97. package/generated/versions/defold-1.13.0/buffer.d.ts +8 -8
  98. package/generated/versions/defold-1.13.0/camera.d.ts +1 -1
  99. package/generated/versions/defold-1.13.0/go.d.ts +117 -372
  100. package/generated/versions/defold-1.13.0/graphics.d.ts +2 -1
  101. package/generated/versions/defold-1.13.0/gui.d.ts +169 -532
  102. package/generated/versions/defold-1.13.0/http.d.ts +2 -2
  103. package/generated/versions/defold-1.13.0/image.d.ts +82 -2
  104. package/generated/versions/defold-1.13.0/index.d.ts +1 -0
  105. package/generated/versions/defold-1.13.0/label.d.ts +1 -1
  106. package/generated/versions/defold-1.13.0/liveupdate.d.ts +4 -0
  107. package/generated/versions/defold-1.13.0/material.d.ts +3 -1
  108. package/generated/versions/defold-1.13.0/model.d.ts +42 -10
  109. package/generated/versions/defold-1.13.0/particlefx.d.ts +23 -2
  110. package/generated/versions/defold-1.13.0/physics.d.ts +46 -2
  111. package/generated/versions/defold-1.13.0/render.d.ts +147 -9
  112. package/generated/versions/defold-1.13.0/resource.d.ts +50 -17
  113. package/generated/versions/defold-1.13.0/socket.d.ts +12 -12
  114. package/generated/versions/defold-1.13.0/sound.d.ts +1 -1
  115. package/generated/versions/defold-1.13.0/sprite.d.ts +59 -2
  116. package/generated/versions/defold-1.13.0/sys.d.ts +103 -8
  117. package/generated/versions/defold-1.13.0/tilemap.d.ts +1 -1
  118. package/generated/versions/defold-1.13.0/vmath.d.ts +0 -24
  119. package/generated/versions/defold-1.13.0/window.d.ts +3 -4
  120. package/generated/versions/defold-1.13.1/b2d.d.ts +2 -2
  121. package/generated/versions/defold-1.13.1/b2d_body.d.ts +2 -2
  122. package/generated/versions/defold-1.13.1/b2d_chain.d.ts +1 -1
  123. package/generated/versions/defold-1.13.1/b2d_joint.d.ts +1 -1
  124. package/generated/versions/defold-1.13.1/b2d_shape.d.ts +1 -1
  125. package/generated/versions/defold-1.13.1/buffer.d.ts +8 -8
  126. package/generated/versions/defold-1.13.1/camera.d.ts +1 -1
  127. package/generated/versions/defold-1.13.1/go.d.ts +117 -372
  128. package/generated/versions/defold-1.13.1/graphics.d.ts +2 -1
  129. package/generated/versions/defold-1.13.1/gui.d.ts +169 -548
  130. package/generated/versions/defold-1.13.1/http.d.ts +2 -2
  131. package/generated/versions/defold-1.13.1/image.d.ts +82 -2
  132. package/generated/versions/defold-1.13.1/index.d.ts +2 -0
  133. package/generated/versions/defold-1.13.1/label.d.ts +1 -1
  134. package/generated/versions/defold-1.13.1/liveupdate.d.ts +4 -0
  135. package/generated/versions/defold-1.13.1/material.d.ts +3 -1
  136. package/generated/versions/defold-1.13.1/model.d.ts +42 -10
  137. package/generated/versions/defold-1.13.1/particlefx.d.ts +23 -2
  138. package/generated/versions/defold-1.13.1/physics.d.ts +46 -2
  139. package/generated/versions/defold-1.13.1/render.d.ts +147 -9
  140. package/generated/versions/defold-1.13.1/resource.d.ts +50 -17
  141. package/generated/versions/defold-1.13.1/socket.d.ts +12 -12
  142. package/generated/versions/defold-1.13.1/sound.d.ts +1 -1
  143. package/generated/versions/defold-1.13.1/sprite.d.ts +59 -2
  144. package/generated/versions/defold-1.13.1/sys.d.ts +103 -8
  145. package/generated/versions/defold-1.13.1/tilemap.d.ts +1 -1
  146. package/generated/versions/defold-1.13.1/vmath.d.ts +0 -24
  147. package/generated/versions/defold-1.13.1/window.d.ts +3 -4
  148. package/generated/versions/defold-1.13.2/b2d.d.ts +39 -39
  149. package/generated/versions/defold-1.13.2/b2d_body.d.ts +11 -11
  150. package/generated/versions/defold-1.13.2/b2d_chain.d.ts +3 -3
  151. package/generated/versions/defold-1.13.2/b2d_fixture.d.ts +5 -5
  152. package/generated/versions/defold-1.13.2/b2d_joint.d.ts +29 -29
  153. package/generated/versions/defold-1.13.2/b2d_shape.d.ts +13 -13
  154. package/generated/versions/defold-1.13.2/b2d_world.d.ts +15 -15
  155. package/generated/versions/defold-1.13.2/buffer.d.ts +10 -11
  156. package/generated/versions/defold-1.13.2/bullet3d.d.ts +6 -6
  157. package/generated/versions/defold-1.13.2/bullet3d_collision_object.d.ts +10 -10
  158. package/generated/versions/defold-1.13.2/bullet3d_constraint.d.ts +173 -71
  159. package/generated/versions/defold-1.13.2/bullet3d_rigid_body.d.ts +3 -3
  160. package/generated/versions/defold-1.13.2/bullet3d_shape.d.ts +11 -11
  161. package/generated/versions/defold-1.13.2/bullet3d_world.d.ts +20 -20
  162. package/generated/versions/defold-1.13.2/camera.d.ts +4 -4
  163. package/generated/versions/defold-1.13.2/collectionfactory.d.ts +2 -3
  164. package/generated/versions/defold-1.13.2/collectionproxy.d.ts +5 -5
  165. package/generated/versions/defold-1.13.2/compute.d.ts +5 -5
  166. package/generated/versions/defold-1.13.2/crash.d.ts +7 -7
  167. package/generated/versions/defold-1.13.2/editor-vm/http.d.ts +13 -13
  168. package/generated/versions/defold-1.13.2/editor-vm/image.d.ts +4 -4
  169. package/generated/versions/defold-1.13.2/editor-vm/json.d.ts +1 -1
  170. package/generated/versions/defold-1.13.2/editor-vm/tilemap_tiles.d.ts +9 -9
  171. package/generated/versions/defold-1.13.2/editor-vm/zip.d.ts +4 -4
  172. package/generated/versions/defold-1.13.2/editor.d.ts +183 -183
  173. package/generated/versions/defold-1.13.2/factory.d.ts +2 -3
  174. package/generated/versions/defold-1.13.2/font.d.ts +4 -4
  175. package/generated/versions/defold-1.13.2/go.d.ts +122 -230
  176. package/generated/versions/defold-1.13.2/graphics.d.ts +22 -24
  177. package/generated/versions/defold-1.13.2/gui.d.ts +186 -423
  178. package/generated/versions/defold-1.13.2/http.d.ts +3 -3
  179. package/generated/versions/defold-1.13.2/image.d.ts +63 -11
  180. package/generated/versions/defold-1.13.2/index.d.ts +2 -0
  181. package/generated/versions/defold-1.13.2/json.d.ts +4 -4
  182. package/generated/versions/defold-1.13.2/label.d.ts +5 -5
  183. package/generated/versions/defold-1.13.2/liveupdate.d.ts +7 -3
  184. package/generated/versions/defold-1.13.2/material.d.ts +49 -49
  185. package/generated/versions/defold-1.13.2/model.d.ts +46 -14
  186. package/generated/versions/defold-1.13.2/particlefx.d.ts +24 -5
  187. package/generated/versions/defold-1.13.2/physics.d.ts +64 -20
  188. package/generated/versions/defold-1.13.2/profiler.d.ts +3 -5
  189. package/generated/versions/defold-1.13.2/render.d.ts +161 -46
  190. package/generated/versions/defold-1.13.2/resource.d.ts +81 -61
  191. package/generated/versions/defold-1.13.2/socket.d.ts +18 -23
  192. package/generated/versions/defold-1.13.2/sound.d.ts +6 -6
  193. package/generated/versions/defold-1.13.2/sprite.d.ts +51 -3
  194. package/generated/versions/defold-1.13.2/sys.d.ts +87 -24
  195. package/generated/versions/defold-1.13.2/tilemap.d.ts +3 -3
  196. package/generated/versions/defold-1.13.2/timer.d.ts +3 -3
  197. package/generated/versions/defold-1.13.2/vmath.d.ts +0 -25
  198. package/generated/versions/defold-1.13.2/window.d.ts +8 -10
  199. package/generated/vmath.d.ts +0 -25
  200. package/generated/window.d.ts +8 -10
  201. package/identity-vocabulary.json +86 -34
  202. package/index.d.ts +2 -0
  203. package/package.json +3 -1
  204. package/scripts/generate-api-availability.ts +10 -24
  205. package/scripts/generate-api-signatures.ts +75 -14
  206. package/scripts/materialize-version.ts +48 -7
  207. package/scripts/regen.ts +214 -19
  208. package/scripts/shared-handle-methods.ts +3 -2
  209. package/scripts/signature-store-fs.ts +1 -0
  210. package/scripts/target-version.ts +26 -0
  211. package/src/api-doc.ts +34 -0
  212. package/src/api-identity.ts +32 -1
  213. package/src/component-properties.d.ts +96 -7
  214. package/src/core-types.ts +71 -28
  215. package/src/doc-corrections.ts +62 -5
  216. package/src/emit-dts.ts +1423 -401
  217. package/src/engine-globals.d.ts +5 -1
  218. package/src/engine-type-name.ts +33 -0
  219. package/src/go-overloads.d.ts +74 -19
  220. package/src/gui-overloads.d.ts +489 -0
  221. package/src/gui-texture-removal.d.ts +41 -0
  222. package/src/index.ts +3 -0
  223. package/src/lifecycle.ts +32 -23
  224. package/src/msg-overloads.d.ts +25 -13
  225. package/src/signature-store.ts +50 -0
  226. package/src/socket-types.d.ts +3 -3
  227. package/src/timers.d.ts +2 -1
  228. package/src/vmath-overloads.d.ts +26 -0
@@ -277,7 +277,7 @@ declare global {
277
277
  * });
278
278
  * ```
279
279
  */
280
- function create_buffer(path: string, table: { buffer: Opaque<"buffer">; transfer_ownership?: boolean }): Hash;
280
+ function create_buffer(path: string, table: { buffer: Opaque<"buffer"> & { length: LuaLengthMethod<number> }; transfer_ownership?: boolean }): Hash;
281
281
  /**
282
282
  * Creates a sound data resource
283
283
  * Supported formats are .oggc, .opusc and .wavc
@@ -310,7 +310,7 @@ declare global {
310
310
  * });
311
311
  * ```
312
312
  */
313
- function create_sound_data(path: string, options: { data: string | Opaque<"buffer">; filesize?: number; partial?: boolean }): Hash;
313
+ function create_sound_data(path: string, options: { data: string | Opaque<"buffer">; filesize?: number; partial?: boolean } & ({ partial?: false } | ({ partial: true } & Required<Pick<{ data: string | Opaque<"buffer">; filesize?: number; partial?: boolean }, "filesize">>))): Hash;
314
314
  /**
315
315
  * Creates a new texture resource that can be used in the same way as any texture created during build time.
316
316
  * The path used for creating the texture must be unique, trying to create a resource at a path that is already
@@ -500,7 +500,7 @@ declare global {
500
500
  * }
501
501
  * ```
502
502
  */
503
- function create_texture(path: string, table: { type: number; width: number; height: number; depth?: number; format: number; flags?: number; max_mipmaps?: number; compression_type?: number; page_count?: number }, buffer?: Opaque<"buffer">): Hash;
503
+ function create_texture(path: string, table: { type: number; width: number; height: number; depth?: number; format: number; flags?: number; max_mipmaps?: number; compression_type?: number; page_count?: number }, buffer?: Opaque<"buffer"> & { length: LuaLengthMethod<number> }): Hash;
504
504
  /**
505
505
  * Creates a new texture resource that can be used in the same way as any texture created during build time.
506
506
  * The path used for creating the texture must be unique, trying to create a resource at a path that is already
@@ -670,7 +670,7 @@ declare global {
670
670
  * });
671
671
  * ```
672
672
  */
673
- function create_texture_async(path: string, table: { type: number; width: number; height: number; depth?: number; format: number; flags?: number; max_mipmaps?: number; compression_type?: number }, buffer: Opaque<"buffer"> | undefined, callback: (...args: unknown[]) => unknown): LuaMultiReturn<[Hash, number]>;
673
+ function create_texture_async(path: string, table: { type: number; width: number; height: number; depth?: number; format: number; flags?: number; max_mipmaps?: number; compression_type?: number }, buffer: Opaque<"buffer"> & { length: LuaLengthMethod<number> } | undefined, callback: (...args: unknown[]) => unknown): LuaMultiReturn<[Hash, number]>;
674
674
  /**
675
675
  * Constructor-like function with two purposes:
676
676
  *
@@ -738,7 +738,7 @@ declare global {
738
738
  * // How to get the data from a buffer
739
739
  * export default defineScript({
740
740
  * init() {
741
- * const res_path = go.get<mesh.properties>()("#mesh", "vertices");
741
+ * const res_path = go.get<mesh.Properties>()("#mesh", "vertices");
742
742
  * const buf = resource.get_buffer(res_path);
743
743
  * const stream_positions = buffer.get_stream(buf, "position");
744
744
  *
@@ -749,7 +749,7 @@ declare global {
749
749
  * });
750
750
  * ```
751
751
  */
752
- function get_buffer(path: Hash | string): Opaque<"buffer">;
752
+ function get_buffer(path: Hash | string): Opaque<"buffer"> & { length: LuaLengthMethod<number> };
753
753
  /**
754
754
  * Gets render target info from a render target resource path or a render target handle
755
755
  *
@@ -841,14 +841,47 @@ declare global {
841
841
  * ```ts
842
842
  * export default defineScript({
843
843
  * init() {
844
- * const font = go.get<label.properties>()("#label", "font");
844
+ * const font = go.get<label.Properties>()("#label", "font");
845
845
  * const metrics = resource.get_text_metrics(font, "The quick brown fox\n jumps over the lazy dog");
846
846
  * pprint(metrics);
847
847
  * },
848
848
  * });
849
849
  * ```
850
850
  */
851
- function get_text_metrics(url: Hash | string, text: string, options?: { width?: number; leading?: number; tracking?: number; line_break?: boolean }): { width: number; height: number; max_ascent: number; max_descent: number };
851
+ function get_text_metrics(url: Hash | string, text: string): { width: number; height: number; max_ascent: number; max_descent: number };
852
+ /**
853
+ * Gets the text metrics from a font
854
+ *
855
+ * @param url - the font to get the (unscaled) metrics from
856
+ * @param text - text to measure
857
+ * @param options - A table containing parameters for the text. Supported entries:
858
+ *
859
+ * `width`
860
+ * number The width of the text field. Not used if `line_break` is false.
861
+ * `leading`
862
+ * number The leading (default 1.0)
863
+ * `tracking`
864
+ * number The tracking (default 0.0)
865
+ * `line_break`
866
+ * boolean If the calculation should consider line breaks (default false)
867
+ * @returns a table with the following fields:
868
+ *
869
+ * - width
870
+ * - height
871
+ * - max_ascent
872
+ * - max_descent
873
+ * @example
874
+ * ```ts
875
+ * export default defineScript({
876
+ * init() {
877
+ * const font = go.get<label.Properties>()("#label", "font");
878
+ * const metrics = resource.get_text_metrics(font, "The quick brown fox\n jumps over the lazy dog");
879
+ * pprint(metrics);
880
+ * },
881
+ * });
882
+ * ```
883
+ */
884
+ function get_text_metrics(url: Hash | string, text: string, options: { width?: number; leading?: number; tracking?: number; line_break?: boolean }): { width: number; height: number; max_ascent: number; max_descent: number };
852
885
  /**
853
886
  * Gets texture info from a texture resource path or a texture handle
854
887
  *
@@ -947,7 +980,7 @@ declare global {
947
980
  * // custom_resources = resources/,assets/level_data.json
948
981
  * ```
949
982
  */
950
- function load(path: string): Opaque<"buffer">;
983
+ function load(path: string): Opaque<"buffer"> & { length: LuaLengthMethod<number> };
951
984
  /**
952
985
  * Constructor-like function with two purposes:
953
986
  *
@@ -1031,10 +1064,10 @@ declare global {
1031
1064
  * // Assuming the folder "/res" is added to the project custom resources:
1032
1065
  * // load a texture resource and set it on a sprite
1033
1066
  * const buffer = resource.load("/res/new.texturec");
1034
- * resource.set(go.get<sprite.properties>()("#sprite", "texture0"), buffer);
1067
+ * resource.set(go.get<sprite.Properties>()("#sprite", "texture0"), buffer);
1035
1068
  * ```
1036
1069
  */
1037
- function set(path: string | Hash, buffer: Opaque<"buffer">): void;
1070
+ function set(path: string | Hash, buffer: Opaque<"buffer"> & { length: LuaLengthMethod<number> }): void;
1038
1071
  /**
1039
1072
  * Sets the data for a specific atlas resource. Setting new atlas data is specified by passing in
1040
1073
  * a texture path for the backing texture of the atlas, a list of geometries and a list of animations
@@ -1190,7 +1223,7 @@ declare global {
1190
1223
  *
1191
1224
  * export default defineScript({
1192
1225
  * init() {
1193
- * const res_path = go.get<mesh.properties>()("#mesh", "vertices");
1226
+ * const res_path = go.get<mesh.Properties>()("#mesh", "vertices");
1194
1227
  *
1195
1228
  * const positions = [
1196
1229
  * 1, -1, 0,
@@ -1213,7 +1246,7 @@ declare global {
1213
1246
  * });
1214
1247
  * ```
1215
1248
  */
1216
- function set_buffer(path: Hash | string, buffer: Opaque<"buffer">, table?: { transfer_ownership?: boolean }): void;
1249
+ function set_buffer(path: Hash | string, buffer: Opaque<"buffer"> & { length: LuaLengthMethod<number> }, table?: { transfer_ownership?: boolean }): void;
1217
1250
  /**
1218
1251
  * Update internal sound resource (wavc/oggc/opusc) with new data
1219
1252
  *
@@ -1324,7 +1357,7 @@ declare global {
1324
1357
  * // the engine registers a texture format only when the driver supports it
1325
1358
  * const format = graphics.TEXTURE_FORMAT_RGB;
1326
1359
  * if (format !== undefined) {
1327
- * const resource_path = go.get<model.properties>()("#model", "texture0");
1360
+ * const resource_path = go.get<model.Properties>()("#model", "texture0");
1328
1361
  * const args = { width, height, type: graphics.TEXTURE_TYPE_2D, format, num_mip_maps: 1 };
1329
1362
  * resource.set_texture(resource_path, args, buf);
1330
1363
  * }
@@ -1357,7 +1390,7 @@ declare global {
1357
1390
  * // the engine registers a texture format only when the driver supports it
1358
1391
  * const format = graphics.TEXTURE_FORMAT_RGB;
1359
1392
  * if (format !== undefined) {
1360
- * const resource_path = go.get<model.properties>()("#model", "texture0");
1393
+ * const resource_path = go.get<model.Properties>()("#model", "texture0");
1361
1394
  * const args = { width, height, x, y, type: graphics.TEXTURE_TYPE_2D, format, num_mip_maps: 1 };
1362
1395
  * resource.set_texture(resource_path, args, buf);
1363
1396
  * }
@@ -1378,7 +1411,7 @@ declare global {
1378
1411
  * // the engine registers a texture format only when the driver supports it
1379
1412
  * const format = graphics.TEXTURE_FORMAT_RGB;
1380
1413
  * if (format === undefined) return;
1381
- * const resource_path = go.get<model.properties>()("#model", "texture0");
1414
+ * const resource_path = go.get<model.Properties>()("#model", "texture0");
1382
1415
  * // the "my_buffer" resource is expected to hold 128 * 128 * 3 bytes!
1383
1416
  * const args = {
1384
1417
  * width: 128,
@@ -1466,7 +1499,7 @@ declare global {
1466
1499
  * }
1467
1500
  * ```
1468
1501
  */
1469
- function set_texture(path: Hash | string, table: { type: number; width: number; height: number; format: number; x?: number; y?: number; z?: number; page?: number; mipmap?: number; compression_type?: number }, buffer: Opaque<"buffer">): void;
1502
+ function set_texture(path: Hash | string, table: { type: number; width: number; height: number; format: number; x?: number; y?: number; z?: number; page?: number; mipmap?: number; compression_type?: number }, buffer: Opaque<"buffer"> & { length: LuaLengthMethod<number> }): void;
1470
1503
  /**
1471
1504
  * Constructor-like function with two purposes:
1472
1505
  *
@@ -21,7 +21,7 @@ declare global {
21
21
  * LuaSocket is free software, released under the MIT license (same license as the Lua core).
22
22
  */
23
23
  namespace socket {
24
- interface client {
24
+ interface SocketClient {
25
25
  /**
26
26
  * Closes the TCP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
27
27
  * It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
@@ -167,7 +167,7 @@ declare global {
167
167
  */
168
168
  shutdown(mode: string): number;
169
169
  }
170
- interface connected {
170
+ interface SocketConnected {
171
171
  /**
172
172
  * Closes a UDP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
173
173
  * It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
@@ -268,7 +268,7 @@ declare global {
268
268
  */
269
269
  settimeout(value: number): void;
270
270
  }
271
- interface master {
271
+ interface SocketMaster {
272
272
  /**
273
273
  * Binds a master object to address and port on the local host.
274
274
  *
@@ -351,12 +351,12 @@ declare global {
351
351
  */
352
352
  settimeout(value: number, mode?: string): void;
353
353
  }
354
- interface server {
354
+ interface SocketServer {
355
355
  /**
356
356
  * Waits for a remote connection on the server object and returns a client object representing that connection.
357
357
  * Calling `socket.select` with a server object in the `recvt` parameter before a call to accept does not guarantee accept will return immediately. Use the `settimeout` method or accept might block until another client shows up.
358
358
  */
359
- accept(): LuaMultiReturn<[client | undefined, string | undefined]>;
359
+ accept(): LuaMultiReturn<[SocketClient | undefined, string | undefined]>;
360
360
  /**
361
361
  * Closes the TCP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
362
362
  * It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
@@ -453,7 +453,7 @@ declare global {
453
453
  */
454
454
  settimeout(value: number, mode?: string): void;
455
455
  }
456
- interface unconnected {
456
+ interface SocketUnconnected {
457
457
  /**
458
458
  * Closes a UDP object. The internal socket used by the object is closed and the local address to which the object was bound is made available to other applications. No further operations (except for further calls to the close method) are allowed on a closed socket.
459
459
  * It is important to close all used sockets once they are not needed, since, in many systems, each socket uses a file descriptor, which are limited system resources. Garbage-collected objects are automatically closed before destruction, though.
@@ -585,7 +585,7 @@ declare global {
585
585
  * @param locport - optional local port to bind to.
586
586
  * @param family - optional socket family to use, `"inet"` or `"inet6"`.
587
587
  */
588
- function connect(address: string, port: number, locaddr?: string, locport?: number, family?: string): LuaMultiReturn<[client | undefined, string | undefined]>;
588
+ function connect(address: string, port: number, locaddr?: string, locport?: number, family?: string): LuaMultiReturn<[SocketClient | undefined, string | undefined]>;
589
589
  /**
590
590
  * Returns the time in seconds, relative to the system epoch (Unix epoch time since January 1, 1970 (UTC) or Windows file time since January 1, 1601 (UTC)).
591
591
  * You should use the values returned by this function for relative measurements only.
@@ -664,7 +664,7 @@ declare global {
664
664
  * @param sendt - array with sockets that are watched to see if it is OK to immediately write on them.
665
665
  * @param timeout - the maximum amount of time (in seconds) to wait for a change in status. Nil, negative or omitted timeout value allows the function to block indefinitely.
666
666
  */
667
- function select(recvt: (client | master | unconnected)[], sendt: (client | master | unconnected)[], timeout?: number): LuaMultiReturn<[(client | master | unconnected)[], (client | master | unconnected)[], string | undefined]>;
667
+ function select(recvt: (SocketClient | SocketMaster | SocketUnconnected)[], sendt: (SocketClient | SocketMaster | SocketUnconnected)[], timeout?: number): LuaMultiReturn<[(SocketClient | SocketMaster | SocketUnconnected)[], (SocketClient | SocketMaster | SocketUnconnected)[], string | undefined]>;
668
668
  /**
669
669
  * This function drops a number of arguments and returns the remaining.
670
670
  * It is useful to avoid creation of dummy variables:
@@ -700,21 +700,21 @@ declare global {
700
700
  /**
701
701
  * Creates and returns an IPv4 TCP master object. A master object can be transformed into a server object with the method `listen` (after a call to `bind`) or into a client object with the method `connect`. The only other method supported by a master object is the `close` method.
702
702
  */
703
- function tcp(): LuaMultiReturn<[master | undefined, string | undefined]>;
703
+ function tcp(): LuaMultiReturn<[SocketMaster | undefined, string | undefined]>;
704
704
  /**
705
705
  * Creates and returns an IPv6 TCP master object. A master object can be transformed into a server object with the method `listen` (after a call to `bind`) or into a client object with the method connect. The only other method supported by a master object is the close method.
706
706
  * Note: The TCP object returned will have the option "ipv6-v6only" set to true.
707
707
  */
708
- function tcp6(): LuaMultiReturn<[master | undefined, string | undefined]>;
708
+ function tcp6(): LuaMultiReturn<[SocketMaster | undefined, string | undefined]>;
709
709
  /**
710
710
  * Creates and returns an unconnected IPv4 UDP object. Unconnected objects support the `sendto`, `receive`, `receivefrom`, `getoption`, `getsockname`, `setoption`, `settimeout`, `setpeername`, `setsockname`, and `close` methods. The `setpeername` method is used to connect the object.
711
711
  */
712
- function udp(): LuaMultiReturn<[unconnected | undefined, string | undefined]>;
712
+ function udp(): LuaMultiReturn<[SocketUnconnected | undefined, string | undefined]>;
713
713
  /**
714
714
  * Creates and returns an unconnected IPv6 UDP object. Unconnected objects support the `sendto`, `receive`, `receivefrom`, `getoption`, `getsockname`, `setoption`, `settimeout`, `setpeername`, `setsockname`, and `close` methods. The `setpeername` method is used to connect the object.
715
715
  * Note: The UDP object returned will have the option "ipv6-v6only" set to true.
716
716
  */
717
- function udp6(): LuaMultiReturn<[unconnected | undefined, string | undefined]>;
717
+ function udp6(): LuaMultiReturn<[SocketUnconnected | undefined, string | undefined]>;
718
718
  namespace dns {
719
719
  /**
720
720
  * This function converts a host name to IPv4 or IPv6 address.
@@ -265,7 +265,7 @@ declare global {
265
265
  * ```
266
266
  */
267
267
  function stop(url: string | Hash | Url, stop_properties?: { play_id?: number }): void;
268
- interface properties {
268
+ interface Properties {
269
269
  /**
270
270
  * The gain on the sound-component. Note that gain is in linear scale,
271
271
  * between 0 and 1.
@@ -62,7 +62,64 @@ declare global {
62
62
  * });
63
63
  * ```
64
64
  */
65
- function play_flipbook(url: string | Hash | Url, id: string | Hash, complete_function?: (self: unknown, message_id: Hash, message: { current_tile: number; id: Hash }, sender: Url) => void, play_properties?: { offset?: number; playback_rate?: number }): void;
65
+ function play_flipbook(url: string | Hash | Url, id: string | Hash, complete_function?: (self: unknown, message_id: Hash, message: { current_tile: number; id: Hash }, sender: Url) => void): void;
66
+ /**
67
+ * Play an animation on a sprite component from its tile set
68
+ * An optional completion callback function can be provided that will be called when
69
+ * the animation has completed playing. If no function is provided,
70
+ * a animation_done message is sent to the script that started the animation.
71
+ *
72
+ * @param url - the sprite that should play the animation
73
+ * @param id - hashed id of the animation to play
74
+ * @param complete_function - function to call when the animation has completed.
75
+ *
76
+ * `self`
77
+ * object The current object.
78
+ * `message_id`
79
+ * hash The name of the completion message, `"animation_done"`.
80
+ * `message`
81
+ * table Information about the completion:
82
+ *
83
+ * - number `current_tile` - the current tile of the sprite.
84
+ * - hash `id` - id of the animation that was completed.
85
+ *
86
+ * `sender`
87
+ * url The invoker of the callback: the sprite component.
88
+ * @param play_properties - optional table with properties:
89
+ *
90
+ * `offset`
91
+ * number the normalized initial value of the animation cursor when the animation starts playing.
92
+ * `playback_rate`
93
+ * number the rate with which the animation will be played. Must be positive.
94
+ * @example
95
+ * The following examples assumes that the model has id "sprite".
96
+ * How to play the "jump" animation followed by the "run" animation:
97
+ * ```ts
98
+ * const url = msg.url("#sprite");
99
+ *
100
+ * function anim_done(self: unknown, message_id: Hash, message: { id: Hash }) {
101
+ * if (message_id === hash("animation_done") && message.id === hash("jump")) {
102
+ * // jump animation done, chain with "run"
103
+ * sprite.play_flipbook(url, "run");
104
+ * }
105
+ * }
106
+ * ```
107
+ * @example
108
+ * ```ts
109
+ * export default defineScript({
110
+ * init() {
111
+ * const url = msg.url("#sprite");
112
+ * sprite.play_flipbook(url, "jump", (self, message_id, message) => {
113
+ * if (message_id === hash("animation_done") && message.id === hash("jump")) {
114
+ * // jump animation done, chain with "run"
115
+ * sprite.play_flipbook(url, "run");
116
+ * }
117
+ * });
118
+ * },
119
+ * });
120
+ * ```
121
+ */
122
+ function play_flipbook(url: string | Hash | Url, id: string | Hash, complete_function: ((self: unknown, message_id: Hash, message: { current_tile: number; id: Hash }, sender: Url) => void) | undefined, play_properties: { offset?: number; playback_rate?: number }): void;
66
123
  /**
67
124
  * Resets a shader constant for a sprite component.
68
125
  * The constant must be defined in the material assigned to the sprite.
@@ -126,7 +183,7 @@ declare global {
126
183
  * ```
127
184
  */
128
185
  function set_vflip(url: string | Hash | Url, flip: boolean): void;
129
- interface properties {
186
+ interface Properties {
130
187
  /**
131
188
  * READ ONLY The current animation id. An animation that plays currently for the sprite. The type of the property is hash.
132
189
  */
@@ -7,7 +7,7 @@ declare global {
7
7
  * error handling and debugging.
8
8
  */
9
9
  namespace sys {
10
- type NetworkConnectivity = typeof sys.NETWORK_DISCONNECTED | typeof sys.NETWORK_CONNECTED_CELLULAR | typeof sys.NETWORK_CONNECTED;
10
+ type Network = typeof sys.NETWORK_DISCONNECTED | typeof sys.NETWORK_CONNECTED_CELLULAR | typeof sys.NETWORK_CONNECTED;
11
11
  /**
12
12
  * network connected through other, non cellular, connection
13
13
  */
@@ -183,7 +183,40 @@ declare global {
183
183
  * }
184
184
  * ```
185
185
  */
186
- function get_config_int(key: string, default_value?: number): number;
186
+ function get_config_int(key: string): number;
187
+ /**
188
+ * Get integer config value from the game.project configuration file with optional default value
189
+ *
190
+ * @param key - key to get value for. The syntax is SECTION.KEY
191
+ * @param default_value - (optional) default value to return if the value does not exist
192
+ * @returns config value as an integer. default_value if the config key does not exist. 0 if no default value was supplied.
193
+ * @example
194
+ * Get user config value
195
+ * ```ts
196
+ * const speed = sys.get_config_int("my_game.speed", 20); // with default value
197
+ * ```
198
+ * @example
199
+ * ```ts
200
+ * const testmode = sys.get_config_int("my_game.testmode"); // without default value
201
+ * if (testmode !== undefined) {
202
+ * // do stuff
203
+ * }
204
+ * ```
205
+ */
206
+ function get_config_int(key: string, default_value: number): number;
207
+ /**
208
+ * Get number config value from the game.project configuration file with optional default value
209
+ *
210
+ * @param key - key to get value for. The syntax is SECTION.KEY
211
+ * @param default_value - (optional) default value to return if the value does not exist
212
+ * @returns config value as an number. default_value if the config key does not exist. 0 if no default value was supplied.
213
+ * @example
214
+ * ```ts
215
+ * // Get user config value
216
+ * const speed = sys.get_config_number("my_game.speed", 20.0);
217
+ * ```
218
+ */
219
+ function get_config_number(key: string): number;
187
220
  /**
188
221
  * Get number config value from the game.project configuration file with optional default value
189
222
  *
@@ -196,7 +229,7 @@ declare global {
196
229
  * const speed = sys.get_config_number("my_game.speed", 20.0);
197
230
  * ```
198
231
  */
199
- function get_config_number(key: string, default_value?: number): number;
232
+ function get_config_number(key: string, default_value: number): number;
200
233
  /**
201
234
  * Returns the current network connectivity status
202
235
  * on mobile platforms.
@@ -215,7 +248,7 @@ declare global {
215
248
  * }
216
249
  * ```
217
250
  */
218
- function get_connectivity(): sys.NetworkConnectivity;
251
+ function get_connectivity(): sys.Network;
219
252
  /**
220
253
  * Returns a table with engine information.
221
254
  *
@@ -355,7 +388,46 @@ declare global {
355
388
  * }
356
389
  * ```
357
390
  */
358
- function get_sys_info(options?: { ignore_secure?: boolean }): { device_model: string; manufacturer: string; system_name: string; system_version: string; api_version: string; language: string; device_language: string; territory: string; gmt_offset: number; device_ident: string; user_agent: string };
391
+ function get_sys_info(): { device_model: string; manufacturer: string; system_name: string; system_version: string; api_version: string; language: string; device_language: string; territory: string; gmt_offset: number; device_ident: string; user_agent: string };
392
+ /**
393
+ * Returns a table with system information.
394
+ *
395
+ * @param options - optional options table
396
+ * - ignore_secure boolean this flag ignores values might be secured by OS e.g. `device_ident`
397
+ * @returns table with system information in the following fields:
398
+ *
399
+ * `device_model`
400
+ * string Only available on iOS and Android.
401
+ * `manufacturer`
402
+ * string Only available on iOS and Android.
403
+ * `system_name`
404
+ * string The system name: "Darwin", "Linux", "Windows", "HTML5", "Android" or "iPhone OS"
405
+ * `system_version`
406
+ * string The system OS version.
407
+ * `api_version`
408
+ * string The API version on the system.
409
+ * `language`
410
+ * string Two character ISO-639 format, i.e. "en".
411
+ * `device_language`
412
+ * string Two character ISO-639 format (i.e. "sr") and, if applicable, followed by a dash (-) and an ISO 15924 script code (i.e. "sr-Cyrl" or "sr-Latn"). Reflects the device preferred language.
413
+ * `territory`
414
+ * string Two character ISO-3166 format, i.e. "US".
415
+ * `gmt_offset`
416
+ * number The current offset from GMT (Greenwich Mean Time), in minutes.
417
+ * `device_ident`
418
+ * string This value secured by OS. "identifierForVendor" on iOS. "android_id" on Android. On Android, you need to add `READ_PHONE_STATE` permission to be able to get this data. We don't use this permission in Defold.
419
+ * `user_agent`
420
+ * string The HTTP user agent, i.e. "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 (KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
421
+ * @example
422
+ * ```ts
423
+ * // How to get system information:
424
+ * const info = sys.get_sys_info();
425
+ * if (info.system_name === "HTML5") {
426
+ * // We are running in a browser.
427
+ * }
428
+ * ```
429
+ */
430
+ function get_sys_info(options: { ignore_secure?: boolean }): { device_model: string; manufacturer: string; system_name: string; system_version: string; api_version: string; language: string; device_language: string; territory: string; gmt_offset: number; device_ident: string; user_agent: string };
359
431
  /**
360
432
  * If the file exists, it must have been created by `sys.save` to be loaded.
361
433
  * This function will raise a Lua error if an error occurs while loading the file.
@@ -401,7 +473,7 @@ declare global {
401
473
  * const asset_2 = sys.load_buffer("/my/absolute/path");
402
474
  * ```
403
475
  */
404
- function load_buffer(path: string): Opaque<"buffer">;
476
+ function load_buffer(path: string): Opaque<"buffer"> & { length: LuaLengthMethod<number> };
405
477
  /**
406
478
  * The sys.load_buffer function will first try to load the resource
407
479
  * from any of the mounted resource locations and return the data if
@@ -434,7 +506,7 @@ declare global {
434
506
  * Load binary data from a custom project resource and update a texture resource:
435
507
  * ```ts
436
508
  * function my_callback(self: unknown, request_id: unknown, result: unknown) {
437
- * const { status, buf } = result as { status: number; buf: Opaque<"buffer"> };
509
+ * const { status, buf } = result as { status: number; buf: ReturnType<typeof sys.load_buffer> };
438
510
  * if (status === sys.REQUEST_STATUS_FINISHED) {
439
511
  * resource.set_texture("/my_texture", { type: graphics.TEXTURE_TYPE_2D, width: 128, height: 128, format: graphics.TEXTURE_FORMAT_RGBA }, buf);
440
512
  * }
@@ -519,7 +591,30 @@ declare global {
519
591
  * }
520
592
  * ```
521
593
  */
522
- function open_url(url: string, attributes?: { target?: string }): boolean;
594
+ function open_url(url: string): boolean;
595
+ /**
596
+ * Open URL in default application, typically a browser
597
+ *
598
+ * @param url - url to open
599
+ * @param attributes - table with attributes
600
+ * `target`
601
+ * - string : Optional. Specifies the target attribute or the name of the window. The following values are supported:
602
+ * - `_self` - (default value) URL replaces the current page.
603
+ * - `_blank` - URL is loaded into a new window, or tab.
604
+ * - `_parent` - URL is loaded into the parent frame.
605
+ * - `_top` - URL replaces any framesets that may be loaded.
606
+ * - `name` - The name of the window (Note: the name does not specify the title of the new window).
607
+ * @returns a boolean indicating if the url could be opened or not
608
+ * @example
609
+ * ```ts
610
+ * // Open an URL:
611
+ * const success = sys.open_url("http://www.defold.com", { target: "_blank" });
612
+ * if (!success) {
613
+ * // could not open the url...
614
+ * }
615
+ * ```
616
+ */
617
+ function open_url(url: string, attributes: { target?: string }): boolean;
523
618
  /**
524
619
  * Reboots the game engine with a specified set of arguments.
525
620
  * Arguments will be translated into command line arguments. Calling reboot
@@ -192,7 +192,7 @@ declare global {
192
192
  * ```
193
193
  */
194
194
  function set_visible(url: string | Hash | Url, layer: string | Hash, visible: boolean): void;
195
- interface properties {
195
+ interface Properties {
196
196
  /**
197
197
  * The material used when rendering the tile map. The type of the property is hash.
198
198
  */
@@ -68,30 +68,6 @@ declare global {
68
68
  * ```
69
69
  */
70
70
  function cross(v1: Vector3, v2: Vector3): Vector3;
71
- /**
72
- * The returned value is a scalar defined as:
73
- * `P ⋅ Q = |P| |Q| cos θ`
74
- * where θ is the angle between the vectors P and Q.
75
- *
76
- * - If the dot product is positive then the angle between the vectors is below 90 degrees.
77
- * - If the dot product is zero the vectors are perpendicular (at right-angles to each other).
78
- * - If the dot product is negative then the angle between the vectors is more than 90 degrees.
79
- *
80
- * @param v1 - first vector
81
- * @param v2 - second vector
82
- * @returns dot product
83
- * @example
84
- * ```ts
85
- * const vector1 = vmath.vector3(1, 0, 0);
86
- * const vector2 = vmath.vector3(0, 1, 0);
87
- *
88
- * if (vmath.dot(vector1, vector2) === 0) {
89
- * // The two vectors are perpendicular (at right-angles to each other)
90
- * // ...
91
- * }
92
- * ```
93
- */
94
- function dot(v1: Vector3 | Vector4, v2: Vector3 | Vector4): number;
95
71
  /**
96
72
  * The resulting matrix is the inverse of the supplied matrix.
97
73
  * For ortho-normal matrices, e.g. regular object transformation,
@@ -5,8 +5,7 @@ declare global {
5
5
  * and screen dimming.
6
6
  */
7
7
  namespace window {
8
- type DimModeState = typeof window.DIMMING_UNKNOWN | typeof window.DIMMING_ON | typeof window.DIMMING_OFF;
9
- type DimModeStateSettable = typeof window.DIMMING_ON | typeof window.DIMMING_OFF;
8
+ type Dimming = typeof window.DIMMING_UNKNOWN | typeof window.DIMMING_ON | typeof window.DIMMING_OFF;
10
9
  /**
11
10
  * Dimming mode is used to control whether or not a mobile device should dim the screen after a period without user interaction.
12
11
  */
@@ -56,7 +55,7 @@ declare global {
56
55
  * - `window.DIMMING_ON`
57
56
  * - `window.DIMMING_OFF`
58
57
  */
59
- function get_dim_mode(): window.DimModeState;
58
+ function get_dim_mode(): window.Dimming;
60
59
  /**
61
60
  * This returns the content scale of the current display.
62
61
  *
@@ -103,7 +102,7 @@ declare global {
103
102
  * - `window.DIMMING_ON`
104
103
  * - `window.DIMMING_OFF`
105
104
  */
106
- function set_dim_mode(mode: window.DimModeStateSettable): void;
105
+ function set_dim_mode(mode: Exclude<window.Dimming, typeof window.DIMMING_UNKNOWN>): void;
107
106
  /**
108
107
  * Sets a window event listener. Only one window event listener can be set at a time.
109
108
  *
@@ -6,8 +6,8 @@ declare global {
6
6
  * Functions for interacting with Box2D.
7
7
  */
8
8
  namespace b2d {
9
- type b2Body = Opaque<"b2Body">;
10
- type b2World = Opaque<"b2World">;
9
+ type B2Body = Opaque<"b2Body">;
10
+ type B2World = Opaque<"b2World">;
11
11
  /**
12
12
  * Get the Box2D body from a collision object
13
13
  *
@@ -6,8 +6,8 @@ declare global {
6
6
  * Functions for interacting with Box2D bodies.
7
7
  */
8
8
  namespace b2d.body {
9
- type b2Body = Opaque<"b2Body">;
10
- type b2World = Opaque<"b2World">;
9
+ type B2Body = Opaque<"b2Body">;
10
+ type B2World = Opaque<"b2World">;
11
11
  /**
12
12
  * Dynamic body
13
13
  */
@@ -7,7 +7,7 @@ declare global {
7
7
  * shapes, so it is represented by a separate `b2Chain` handle.
8
8
  */
9
9
  namespace b2d.chain {
10
- type b2Chain = Opaque<"b2Chain">;
10
+ type B2Chain = Opaque<"b2Chain">;
11
11
  /**
12
12
  * Destroying a chain removes all segment shapes owned by the chain. Destroying
13
13
  * any segment shape through `b2d.body.destroy_shape` also destroys its parent chain.
@@ -6,7 +6,7 @@ declare global {
6
6
  * Functions for interacting with native Box2D joints.
7
7
  */
8
8
  namespace b2d.joint {
9
- type b2Joint = Opaque<"b2Joint">;
9
+ type B2Joint = Opaque<"b2Joint">;
10
10
  /**
11
11
  * Distance joint type.
12
12
  */
@@ -7,7 +7,7 @@ declare global {
7
7
  * and returned from `b2d.fixture.get_shape`.
8
8
  */
9
9
  namespace b2d.shape {
10
- type b2Shape = Opaque<"b2Shape">;
10
+ type B2Shape = Opaque<"b2Shape">;
11
11
  /**
12
12
  * Uses the polygon enum value, but indicates the `hx`/`hy` box convenience format.
13
13
  */