@vpmedia/phaser 1.103.0 → 1.105.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 (298) hide show
  1. package/dist/index.js +997 -403
  2. package/dist/index.js.map +1 -1
  3. package/dist/phaser/core/animation.d.ts +35 -11
  4. package/dist/phaser/core/animation.d.ts.map +1 -1
  5. package/dist/phaser/core/animation_manager.d.ts +20 -10
  6. package/dist/phaser/core/animation_manager.d.ts.map +1 -1
  7. package/dist/phaser/core/animation_parser.d.ts +2 -2
  8. package/dist/phaser/core/animation_parser.d.ts.map +1 -1
  9. package/dist/phaser/core/array_set.d.ts +3 -3
  10. package/dist/phaser/core/array_set.d.ts.map +1 -1
  11. package/dist/phaser/core/cache.d.ts +68 -60
  12. package/dist/phaser/core/cache.d.ts.map +1 -1
  13. package/dist/phaser/core/device.d.ts +23 -0
  14. package/dist/phaser/core/device.d.ts.map +1 -1
  15. package/dist/phaser/core/device_util.d.ts +10 -10
  16. package/dist/phaser/core/device_util.d.ts.map +1 -1
  17. package/dist/phaser/core/dom.d.ts +6 -5
  18. package/dist/phaser/core/dom.d.ts.map +1 -1
  19. package/dist/phaser/core/event_manager.d.ts +49 -158
  20. package/dist/phaser/core/event_manager.d.ts.map +1 -1
  21. package/dist/phaser/core/factory.d.ts +8 -7
  22. package/dist/phaser/core/factory.d.ts.map +1 -1
  23. package/dist/phaser/core/frame.d.ts +27 -48
  24. package/dist/phaser/core/frame.d.ts.map +1 -1
  25. package/dist/phaser/core/frame_data.d.ts +11 -58
  26. package/dist/phaser/core/frame_data.d.ts.map +1 -1
  27. package/dist/phaser/core/frame_util.d.ts +4 -14
  28. package/dist/phaser/core/frame_util.d.ts.map +1 -1
  29. package/dist/phaser/core/game.d.ts +50 -3
  30. package/dist/phaser/core/game.d.ts.map +1 -1
  31. package/dist/phaser/core/input.d.ts +66 -13
  32. package/dist/phaser/core/input.d.ts.map +1 -1
  33. package/dist/phaser/core/input_handler.d.ts +64 -20
  34. package/dist/phaser/core/input_handler.d.ts.map +1 -1
  35. package/dist/phaser/core/input_mouse.d.ts +26 -1
  36. package/dist/phaser/core/input_mouse.d.ts.map +1 -1
  37. package/dist/phaser/core/input_mspointer.d.ts +18 -2
  38. package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
  39. package/dist/phaser/core/input_pointer.d.ts +53 -9
  40. package/dist/phaser/core/input_pointer.d.ts.map +1 -1
  41. package/dist/phaser/core/input_touch.d.ts +19 -1
  42. package/dist/phaser/core/input_touch.d.ts.map +1 -1
  43. package/dist/phaser/core/loader.d.ts +56 -28
  44. package/dist/phaser/core/loader.d.ts.map +1 -1
  45. package/dist/phaser/core/loader_parser.d.ts +4 -4
  46. package/dist/phaser/core/loader_parser.d.ts.map +1 -1
  47. package/dist/phaser/core/raf.d.ts +2 -2
  48. package/dist/phaser/core/raf.d.ts.map +1 -1
  49. package/dist/phaser/core/scale_manager.d.ts +77 -17
  50. package/dist/phaser/core/scale_manager.d.ts.map +1 -1
  51. package/dist/phaser/core/scene.d.ts +3 -1
  52. package/dist/phaser/core/scene.d.ts.map +1 -1
  53. package/dist/phaser/core/scene_manager.d.ts +25 -9
  54. package/dist/phaser/core/scene_manager.d.ts.map +1 -1
  55. package/dist/phaser/core/signal.d.ts +9 -8
  56. package/dist/phaser/core/signal.d.ts.map +1 -1
  57. package/dist/phaser/core/signal_binding.d.ts +2 -2
  58. package/dist/phaser/core/signal_binding.d.ts.map +1 -1
  59. package/dist/phaser/core/sound.d.ts +58 -10
  60. package/dist/phaser/core/sound.d.ts.map +1 -1
  61. package/dist/phaser/core/sound_manager.d.ts +28 -9
  62. package/dist/phaser/core/sound_manager.d.ts.map +1 -1
  63. package/dist/phaser/core/sound_sprite.d.ts +10 -4
  64. package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
  65. package/dist/phaser/core/stage.d.ts +7 -3
  66. package/dist/phaser/core/stage.d.ts.map +1 -1
  67. package/dist/phaser/core/time.d.ts +32 -5
  68. package/dist/phaser/core/time.d.ts.map +1 -1
  69. package/dist/phaser/core/timer.d.ts +30 -10
  70. package/dist/phaser/core/timer.d.ts.map +1 -1
  71. package/dist/phaser/core/timer_event.d.ts +11 -12
  72. package/dist/phaser/core/timer_event.d.ts.map +1 -1
  73. package/dist/phaser/core/tween.d.ts +38 -14
  74. package/dist/phaser/core/tween.d.ts.map +1 -1
  75. package/dist/phaser/core/tween_data.d.ts +30 -5
  76. package/dist/phaser/core/tween_data.d.ts.map +1 -1
  77. package/dist/phaser/core/tween_easing.d.ts +31 -31
  78. package/dist/phaser/core/tween_easing.d.ts.map +1 -1
  79. package/dist/phaser/core/tween_manager.d.ts +8 -4
  80. package/dist/phaser/core/tween_manager.d.ts.map +1 -1
  81. package/dist/phaser/core/world.d.ts +1 -1
  82. package/dist/phaser/core/world.d.ts.map +1 -1
  83. package/dist/phaser/display/bitmap_text.d.ts +35 -20
  84. package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
  85. package/dist/phaser/display/button.d.ts +24 -8
  86. package/dist/phaser/display/button.d.ts.map +1 -1
  87. package/dist/phaser/display/canvas/buffer.d.ts +6 -2
  88. package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
  89. package/dist/phaser/display/canvas/graphics.d.ts +3 -3
  90. package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
  91. package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
  92. package/dist/phaser/display/canvas/pool.d.ts +2 -2
  93. package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
  94. package/dist/phaser/display/canvas/renderer.d.ts +18 -5
  95. package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
  96. package/dist/phaser/display/canvas/tinter.d.ts +3 -3
  97. package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
  98. package/dist/phaser/display/canvas/util.d.ts +9 -9
  99. package/dist/phaser/display/canvas/util.d.ts.map +1 -1
  100. package/dist/phaser/display/display_object.d.ts +82 -23
  101. package/dist/phaser/display/display_object.d.ts.map +1 -1
  102. package/dist/phaser/display/graphics.d.ts +42 -16
  103. package/dist/phaser/display/graphics.d.ts.map +1 -1
  104. package/dist/phaser/display/graphics_data.d.ts +11 -1
  105. package/dist/phaser/display/graphics_data.d.ts.map +1 -1
  106. package/dist/phaser/display/graphics_data_util.d.ts +1 -1
  107. package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
  108. package/dist/phaser/display/group.d.ts +24 -9
  109. package/dist/phaser/display/group.d.ts.map +1 -1
  110. package/dist/phaser/display/image.d.ts +36 -13
  111. package/dist/phaser/display/image.d.ts.map +1 -1
  112. package/dist/phaser/display/sprite_batch.d.ts +1 -1
  113. package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
  114. package/dist/phaser/display/sprite_util.d.ts +5 -5
  115. package/dist/phaser/display/sprite_util.d.ts.map +1 -1
  116. package/dist/phaser/display/text.d.ts +86 -66
  117. package/dist/phaser/display/text.d.ts.map +1 -1
  118. package/dist/phaser/display/webgl/abstract_filter.d.ts +8 -1
  119. package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  120. package/dist/phaser/display/webgl/base_texture.d.ts +14 -2
  121. package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
  122. package/dist/phaser/display/webgl/blend_manager.d.ts +5 -2
  123. package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  124. package/dist/phaser/display/webgl/earcut.d.ts +10 -10
  125. package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
  126. package/dist/phaser/display/webgl/earcut_node.d.ts +1 -1
  127. package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  128. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +17 -1
  129. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  130. package/dist/phaser/display/webgl/filter_manager.d.ts +5 -1
  131. package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  132. package/dist/phaser/display/webgl/filter_texture.d.ts +7 -2
  133. package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  134. package/dist/phaser/display/webgl/graphics.d.ts +11 -10
  135. package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
  136. package/dist/phaser/display/webgl/graphics_data.d.ts +11 -1
  137. package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  138. package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  139. package/dist/phaser/display/webgl/render_texture.d.ts +12 -1
  140. package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
  141. package/dist/phaser/display/webgl/renderer.d.ts +25 -6
  142. package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
  143. package/dist/phaser/display/webgl/shader/complex.d.ts +7 -1
  144. package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  145. package/dist/phaser/display/webgl/shader/fast.d.ts +8 -1
  146. package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  147. package/dist/phaser/display/webgl/shader/normal.d.ts +11 -0
  148. package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  149. package/dist/phaser/display/webgl/shader/primitive.d.ts +7 -1
  150. package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  151. package/dist/phaser/display/webgl/shader/strip.d.ts +7 -1
  152. package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  153. package/dist/phaser/display/webgl/shader_manager.d.ts +14 -2
  154. package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  155. package/dist/phaser/display/webgl/sprite_batch.d.ts +19 -2
  156. package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  157. package/dist/phaser/display/webgl/stencil_manager.d.ts +8 -4
  158. package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  159. package/dist/phaser/display/webgl/texture.d.ts +35 -2
  160. package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
  161. package/dist/phaser/display/webgl/texture_util.d.ts +2 -2
  162. package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
  163. package/dist/phaser/display/webgl/util.d.ts +6 -6
  164. package/dist/phaser/display/webgl/util.d.ts.map +1 -1
  165. package/dist/phaser/geom/circle.d.ts +11 -10
  166. package/dist/phaser/geom/circle.d.ts.map +1 -1
  167. package/dist/phaser/geom/ellipse.d.ts +6 -5
  168. package/dist/phaser/geom/ellipse.d.ts.map +1 -1
  169. package/dist/phaser/geom/line.d.ts +14 -14
  170. package/dist/phaser/geom/line.d.ts.map +1 -1
  171. package/dist/phaser/geom/matrix.d.ts +13 -12
  172. package/dist/phaser/geom/matrix.d.ts.map +1 -1
  173. package/dist/phaser/geom/point.d.ts +19 -19
  174. package/dist/phaser/geom/point.d.ts.map +1 -1
  175. package/dist/phaser/geom/polygon.d.ts +6 -6
  176. package/dist/phaser/geom/polygon.d.ts.map +1 -1
  177. package/dist/phaser/geom/rectangle.d.ts +20 -20
  178. package/dist/phaser/geom/rectangle.d.ts.map +1 -1
  179. package/dist/phaser/geom/rounded_rectangle.d.ts +2 -2
  180. package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  181. package/dist/phaser/geom/util/circle.d.ts +9 -7
  182. package/dist/phaser/geom/util/circle.d.ts.map +1 -1
  183. package/dist/phaser/geom/util/ellipse.d.ts +1 -1
  184. package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
  185. package/dist/phaser/geom/util/line.d.ts +5 -3
  186. package/dist/phaser/geom/util/line.d.ts.map +1 -1
  187. package/dist/phaser/geom/util/matrix.d.ts +2 -1
  188. package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
  189. package/dist/phaser/geom/util/point.d.ts +19 -19
  190. package/dist/phaser/geom/util/point.d.ts.map +1 -1
  191. package/dist/phaser/geom/util/polygon.d.ts +2 -1
  192. package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
  193. package/dist/phaser/geom/util/rectangle.d.ts +17 -15
  194. package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
  195. package/dist/phaser/geom/util/rounded_rectangle.d.ts +2 -1
  196. package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  197. package/dist/phaser/util/math.d.ts +51 -142
  198. package/dist/phaser/util/math.d.ts.map +1 -1
  199. package/package.json +2 -2
  200. package/src/phaser/core/animation.ts +41 -18
  201. package/src/phaser/core/animation_manager.ts +21 -12
  202. package/src/phaser/core/animation_parser.ts +11 -3
  203. package/src/phaser/core/array_set.ts +8 -8
  204. package/src/phaser/core/cache.ts +75 -60
  205. package/src/phaser/core/device.ts +23 -1
  206. package/src/phaser/core/device_util.ts +10 -10
  207. package/src/phaser/core/dom.ts +5 -5
  208. package/src/phaser/core/event_manager.ts +52 -177
  209. package/src/phaser/core/factory.ts +25 -17
  210. package/src/phaser/core/frame.ts +37 -51
  211. package/src/phaser/core/frame_data.ts +29 -74
  212. package/src/phaser/core/frame_util.ts +3 -16
  213. package/src/phaser/core/game.ts +40 -11
  214. package/src/phaser/core/input.ts +68 -17
  215. package/src/phaser/core/input_handler.ts +81 -45
  216. package/src/phaser/core/input_mouse.ts +42 -13
  217. package/src/phaser/core/input_mspointer.ts +24 -9
  218. package/src/phaser/core/input_pointer.ts +55 -12
  219. package/src/phaser/core/input_touch.ts +26 -9
  220. package/src/phaser/core/loader.ts +97 -42
  221. package/src/phaser/core/loader_parser.ts +6 -7
  222. package/src/phaser/core/raf.ts +2 -2
  223. package/src/phaser/core/scale_manager.ts +85 -27
  224. package/src/phaser/core/scene.ts +3 -2
  225. package/src/phaser/core/scene_manager.ts +26 -11
  226. package/src/phaser/core/signal.ts +10 -10
  227. package/src/phaser/core/signal_binding.ts +2 -2
  228. package/src/phaser/core/sound.ts +72 -26
  229. package/src/phaser/core/sound_manager.ts +31 -13
  230. package/src/phaser/core/sound_sprite.ts +10 -5
  231. package/src/phaser/core/stage.ts +8 -4
  232. package/src/phaser/core/time.ts +33 -7
  233. package/src/phaser/core/timer.ts +40 -14
  234. package/src/phaser/core/timer_event.ts +23 -14
  235. package/src/phaser/core/tween.ts +43 -23
  236. package/src/phaser/core/tween_data.ts +31 -7
  237. package/src/phaser/core/tween_easing.ts +31 -31
  238. package/src/phaser/core/tween_manager.ts +10 -7
  239. package/src/phaser/core/world.ts +1 -2
  240. package/src/phaser/display/bitmap_text.ts +41 -18
  241. package/src/phaser/display/button.ts +24 -23
  242. package/src/phaser/display/canvas/buffer.ts +6 -3
  243. package/src/phaser/display/canvas/graphics.ts +3 -4
  244. package/src/phaser/display/canvas/masker.ts +2 -3
  245. package/src/phaser/display/canvas/pool.ts +3 -4
  246. package/src/phaser/display/canvas/renderer.ts +19 -7
  247. package/src/phaser/display/canvas/tinter.ts +4 -5
  248. package/src/phaser/display/canvas/util.ts +9 -9
  249. package/src/phaser/display/display_object.ts +120 -61
  250. package/src/phaser/display/graphics.ts +56 -25
  251. package/src/phaser/display/graphics_data.ts +11 -2
  252. package/src/phaser/display/graphics_data_util.ts +1 -2
  253. package/src/phaser/display/group.ts +32 -14
  254. package/src/phaser/display/image.ts +37 -19
  255. package/src/phaser/display/sprite_batch.ts +1 -2
  256. package/src/phaser/display/sprite_util.ts +5 -6
  257. package/src/phaser/display/text.ts +82 -56
  258. package/src/phaser/display/webgl/abstract_filter.ts +8 -2
  259. package/src/phaser/display/webgl/base_texture.ts +14 -3
  260. package/src/phaser/display/webgl/blend_manager.ts +5 -3
  261. package/src/phaser/display/webgl/earcut.ts +27 -27
  262. package/src/phaser/display/webgl/earcut_node.ts +1 -1
  263. package/src/phaser/display/webgl/fast_sprite_batch.ts +19 -4
  264. package/src/phaser/display/webgl/filter_manager.ts +5 -2
  265. package/src/phaser/display/webgl/filter_texture.ts +7 -3
  266. package/src/phaser/display/webgl/graphics.ts +10 -11
  267. package/src/phaser/display/webgl/graphics_data.ts +11 -2
  268. package/src/phaser/display/webgl/mask_manager.ts +2 -3
  269. package/src/phaser/display/webgl/render_texture.ts +12 -2
  270. package/src/phaser/display/webgl/renderer.ts +24 -7
  271. package/src/phaser/display/webgl/shader/complex.ts +7 -2
  272. package/src/phaser/display/webgl/shader/fast.ts +8 -2
  273. package/src/phaser/display/webgl/shader/normal.ts +12 -2
  274. package/src/phaser/display/webgl/shader/primitive.ts +7 -2
  275. package/src/phaser/display/webgl/shader/strip.ts +7 -2
  276. package/src/phaser/display/webgl/shader_manager.ts +13 -3
  277. package/src/phaser/display/webgl/sprite_batch.ts +20 -4
  278. package/src/phaser/display/webgl/stencil_manager.ts +8 -5
  279. package/src/phaser/display/webgl/texture.ts +35 -4
  280. package/src/phaser/display/webgl/texture_util.ts +2 -3
  281. package/src/phaser/display/webgl/util.ts +6 -6
  282. package/src/phaser/geom/circle.ts +10 -10
  283. package/src/phaser/geom/ellipse.ts +6 -6
  284. package/src/phaser/geom/line.ts +14 -14
  285. package/src/phaser/geom/matrix.ts +12 -12
  286. package/src/phaser/geom/point.ts +19 -19
  287. package/src/phaser/geom/polygon.ts +5 -5
  288. package/src/phaser/geom/rectangle.ts +21 -21
  289. package/src/phaser/geom/rounded_rectangle.ts +2 -2
  290. package/src/phaser/geom/util/circle.ts +7 -7
  291. package/src/phaser/geom/util/ellipse.ts +1 -1
  292. package/src/phaser/geom/util/line.ts +5 -5
  293. package/src/phaser/geom/util/matrix.ts +1 -1
  294. package/src/phaser/geom/util/point.ts +20 -20
  295. package/src/phaser/geom/util/polygon.ts +1 -1
  296. package/src/phaser/geom/util/rectangle.ts +15 -15
  297. package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
  298. package/src/phaser/util/math.ts +65 -151
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import {
3
2
  BLEND_NORMAL,
4
3
  GEOM_CIRCLE,
@@ -26,13 +25,37 @@ import { renderGraphics as renderWebGLGraphics } from './webgl/graphics.js';
26
25
  import { textureFromCanvas } from './webgl/texture_util.js';
27
26
 
28
27
  export class Graphics extends DisplayObject {
28
+ declare type: any;
29
+ declare renderable: any;
30
+ fillAlpha!: any;
31
+ lineWidth!: any;
32
+ lineColor!: any;
33
+ lineAlpha!: any;
34
+ graphicsData!: any;
35
+ declare tint: any;
36
+ blendMode!: any;
37
+ currentPath!: any;
38
+ _webGL!: any;
39
+ isMask!: any;
40
+ boundsPadding!: any;
41
+ _localBounds!: any;
42
+ dirty!: any;
43
+ clearDirty!: any;
44
+ _boundsDirty!: any;
45
+ _cacheAsBitmap!: any;
46
+ webGLDirty!: any;
47
+ cachedSpriteDirty!: any;
48
+ declare _cachedSprite: any;
49
+ filling!: any;
50
+ fillColor!: any;
51
+ _prevTint!: any;
29
52
  /**
30
53
  * Creates a new Graphics object.
31
54
  * @param {import('../core/game.js').Game} game - The game instance.
32
55
  * @param {number} x - The x coordinate of the graphics object.
33
56
  * @param {number} y - The y coordinate of the graphics object.
34
57
  */
35
- constructor(game, x = 0, y = 0) {
58
+ constructor(game: import('../core/game.js').Game, x: number = 0, y: number = 0) {
36
59
  super(game);
37
60
  /** @type {number} */
38
61
  this.type = GRAPHICS;
@@ -88,7 +111,7 @@ export class Graphics extends DisplayObject {
88
111
  * @param {number} alpha - The alpha (transparency) of the line to draw.
89
112
  * @returns {Graphics} This Graphics object for chaining.
90
113
  */
91
- lineStyle(lineWidth = 0, color = 0, alpha = 1) {
114
+ lineStyle(lineWidth: number = 0, color: number = 0, alpha: number = 1) {
92
115
  this.lineWidth = lineWidth || 0;
93
116
  this.lineColor = color || 0;
94
117
  this.lineAlpha = alpha === undefined ? 1 : alpha;
@@ -112,7 +135,7 @@ export class Graphics extends DisplayObject {
112
135
  * @param {number} y - The y coordinate to move to.
113
136
  * @returns {Graphics} This Graphics object for chaining.
114
137
  */
115
- moveTo(x, y) {
138
+ moveTo(x: number, y: number) {
116
139
  this.drawShape(new Polygon([x, y]));
117
140
  return this;
118
141
  }
@@ -123,7 +146,7 @@ export class Graphics extends DisplayObject {
123
146
  * @param {number} y - The y coordinate to draw to.
124
147
  * @returns {Graphics} This Graphics object for chaining.
125
148
  */
126
- lineTo(x, y) {
149
+ lineTo(x: number, y: number) {
127
150
  if (!this.currentPath) {
128
151
  this.moveTo(0, 0);
129
152
  }
@@ -141,7 +164,7 @@ export class Graphics extends DisplayObject {
141
164
  * @param {number} toY - The y coordinate to draw to.
142
165
  * @returns {Graphics} This Graphics object for chaining.
143
166
  */
144
- quadraticCurveTo(cpX, cpY, toX, toY) {
167
+ quadraticCurveTo(cpX: number, cpY: number, toX: number, toY: number) {
145
168
  if (this.currentPath) {
146
169
  if (this.currentPath.shape.points.length === 0) {
147
170
  this.currentPath.shape.points = [0, 0];
@@ -180,7 +203,7 @@ export class Graphics extends DisplayObject {
180
203
  * @param {number} toY - The y coordinate to draw to.
181
204
  * @returns {Graphics} This Graphics object for chaining.
182
205
  */
183
- bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY) {
206
+ bezierCurveTo(cpX: number, cpY: number, cpX2: number, cpY2: number, toX: number, toY: number) {
184
207
  if (this.currentPath) {
185
208
  if (this.currentPath.shape.points.length === 0) {
186
209
  this.currentPath.shape.points = [0, 0];
@@ -224,7 +247,7 @@ export class Graphics extends DisplayObject {
224
247
  * @param {number} radius - The radius of the arc.
225
248
  * @returns {Graphics} This Graphics object for chaining.
226
249
  */
227
- arcTo(x1, y1, x2, y2, radius) {
250
+ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number) {
228
251
  if (this.currentPath) {
229
252
  if (this.currentPath.shape.points.length === 0) {
230
253
  this.currentPath.shape.points.push(x1, y1);
@@ -278,7 +301,15 @@ export class Graphics extends DisplayObject {
278
301
  * @param {number} segments - The number of segments to use for drawing the arc.
279
302
  * @returns {Graphics} This Graphics object for chaining.
280
303
  */
281
- arc(cx, cy, radius, startAngle, endAngle, anticlockwise = false, segments = 40) {
304
+ arc(
305
+ cx: number,
306
+ cy: number,
307
+ radius: number,
308
+ startAngle: number,
309
+ endAngle: number,
310
+ anticlockwise: boolean = false,
311
+ segments: number = 40
312
+ ) {
282
313
  // If we do this we can never draw a full circle
283
314
  if (startAngle === endAngle) {
284
315
  return this;
@@ -327,7 +358,7 @@ export class Graphics extends DisplayObject {
327
358
  * @param {number} alpha - The fill alpha (transparency) to use.
328
359
  * @returns {Graphics} This Graphics object for chaining.
329
360
  */
330
- beginFill(color = 0, alpha = 1) {
361
+ beginFill(color: number = 0, alpha: number = 1) {
331
362
  this.filling = true;
332
363
  this.fillColor = color || 0;
333
364
  this.fillAlpha = alpha === undefined ? 1 : alpha;
@@ -360,7 +391,7 @@ export class Graphics extends DisplayObject {
360
391
  * @param {number} height - The height of the rectangle.
361
392
  * @returns {Graphics} This Graphics object for chaining.
362
393
  */
363
- drawRect(x, y, width, height) {
394
+ drawRect(x: number, y: number, width: number, height: number) {
364
395
  this.drawShape(new Rectangle(x, y, width, height));
365
396
  return this;
366
397
  }
@@ -374,7 +405,7 @@ export class Graphics extends DisplayObject {
374
405
  * @param {number} radius - The radius of the rounded corners.
375
406
  * @returns {Graphics} This Graphics object for chaining.
376
407
  */
377
- drawRoundedRect(x, y, width, height, radius) {
408
+ drawRoundedRect(x: number, y: number, width: number, height: number, radius: number) {
378
409
  this.drawShape(new RoundedRectangle(x, y, width, height, radius));
379
410
  return this;
380
411
  }
@@ -386,7 +417,7 @@ export class Graphics extends DisplayObject {
386
417
  * @param {number} diameter - The diameter of the circle.
387
418
  * @returns {Graphics} This Graphics object for chaining.
388
419
  */
389
- drawCircle(x, y, diameter) {
420
+ drawCircle(x: number, y: number, diameter: number) {
390
421
  this.drawShape(new Circle(x, y, diameter));
391
422
  return this;
392
423
  }
@@ -399,7 +430,7 @@ export class Graphics extends DisplayObject {
399
430
  * @param {number} height - The height of the ellipse.
400
431
  * @returns {Graphics} This Graphics object for chaining.
401
432
  */
402
- drawEllipse(x, y, width, height) {
433
+ drawEllipse(x: number, y: number, width: number, height: number) {
403
434
  this.drawShape(new Ellipse(x, y, width, height));
404
435
  return this;
405
436
  }
@@ -409,7 +440,7 @@ export class Graphics extends DisplayObject {
409
440
  * @param {Polygon} path - The polygon to draw.
410
441
  * @returns {Graphics} This Graphics object for chaining.
411
442
  */
412
- drawPolygon(path) {
443
+ drawPolygon(path: Polygon) {
413
444
  let points;
414
445
  if (path instanceof Polygon) {
415
446
  points = path.points;
@@ -456,7 +487,7 @@ export class Graphics extends DisplayObject {
456
487
  * Renders the graphics object using WebGL.
457
488
  * @param {object} renderSession - The render session to use.
458
489
  */
459
- renderWebGL(renderSession) {
490
+ renderWebGL(renderSession: any) {
460
491
  // if the sprite is not visible or the alpha is 0 then no need to render this element
461
492
  if (this.visible === false || this.alpha === 0 || this.isMask === true) {
462
493
  return;
@@ -470,7 +501,7 @@ export class Graphics extends DisplayObject {
470
501
  this.dirty = false;
471
502
  }
472
503
  this._cachedSprite.worldAlpha = this.worldAlpha;
473
- renderSpriteWebGL.call(this._cachedSprite, renderSession);
504
+ (renderSpriteWebGL as any).call(this._cachedSprite, renderSession);
474
505
  } else {
475
506
  renderSession.spriteBatch.stop();
476
507
  renderSession.blendModeManager.setBlendMode(this.blendMode);
@@ -516,7 +547,7 @@ export class Graphics extends DisplayObject {
516
547
  * Renders the graphics object using Canvas.
517
548
  * @param {object} renderSession - The render session to use.
518
549
  */
519
- renderCanvas(renderSession) {
550
+ renderCanvas(renderSession: any) {
520
551
  // if the sprite is not visible or the alpha is 0 then no need to render this element
521
552
  if (this.visible === false || this.alpha === 0 || this.isMask === true) {
522
553
  return;
@@ -573,7 +604,7 @@ export class Graphics extends DisplayObject {
573
604
  * @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
574
605
  * @returns {Rectangle} The bounds rectangle of the graphics object.
575
606
  */
576
- getBounds(matrix = null) {
607
+ getBounds(matrix: import('../geom/matrix.js').Matrix = null) {
577
608
  if (!this.renderable) {
578
609
  return getEmptyRectangle();
579
610
  }
@@ -653,7 +684,7 @@ export class Graphics extends DisplayObject {
653
684
  * @param {Point} tempPoint - A temporary point object to use.
654
685
  * @returns {boolean} True if the graphics object contains the point, otherwise false.
655
686
  */
656
- containsPoint(point, tempPoint) {
687
+ containsPoint(point: Point, tempPoint: Point) {
657
688
  this.worldTransform.applyInverse(point, tempPoint);
658
689
  const graphicsData = this.graphicsData;
659
690
  for (let i = 0; i < graphicsData.length; i += 0) {
@@ -809,7 +840,7 @@ export class Graphics extends DisplayObject {
809
840
  * @param {object} shape - The shape to draw.
810
841
  * @returns {GraphicsData} The graphics data for the drawn shape.
811
842
  */
812
- drawShape(shape) {
843
+ drawShape(shape: any) {
813
844
  if (this.currentPath) {
814
845
  // check current path!
815
846
  if (this.currentPath.shape.points.length <= 2) {
@@ -859,14 +890,14 @@ export class Graphics extends DisplayObject {
859
890
  * @param {Point[]} points - The points of the triangle.
860
891
  * @param {boolean} cull - Whether to perform backface culling.
861
892
  */
862
- drawTriangle(points, cull = false) {
893
+ drawTriangle(points: Point[], cull: boolean = false) {
863
894
  const triangle = new Polygon(points);
864
895
  if (cull) {
865
896
  const cameraToFace = new Point(0 - points[0].x, 0 - points[0].y);
866
897
  const ab = new Point(points[1].x - points[0].x, points[1].y - points[0].y);
867
898
  const cb = new Point(points[1].x - points[2].x, points[1].y - points[2].y);
868
899
  const faceNormal = cb.cross(ab);
869
- if (cameraToFace.dot(faceNormal) > 0) {
900
+ if (cameraToFace.dot(faceNormal as any) > 0) {
870
901
  this.drawPolygon(triangle);
871
902
  }
872
903
  } else {
@@ -880,7 +911,7 @@ export class Graphics extends DisplayObject {
880
911
  * @param {number[]} indices - The indices of the vertices to use.
881
912
  * @param {boolean} cull - Whether to perform backface culling.
882
913
  */
883
- drawTriangles(vertices, indices, cull = false) {
914
+ drawTriangles(vertices: any, indices: number[], cull: boolean = false) {
884
915
  const point1 = new Point();
885
916
  const point2 = new Point();
886
917
  const point3 = new Point();
@@ -916,7 +947,7 @@ export class Graphics extends DisplayObject {
916
947
  for (i = 0; i < indices.length; i += 1) {
917
948
  point1.x = vertices[indices[i] * 2];
918
949
  point1.y = vertices[indices[i] * 2 + 1];
919
- points.push(point1.copyTo({}));
950
+ points.push(point1.copyTo({} as any));
920
951
  if (points.length === 3) {
921
952
  this.drawTriangle(points, cull);
922
953
  points = [];
@@ -1,7 +1,16 @@
1
- // @ts-nocheck
2
1
  import { clone } from './graphics_data_util.js';
3
2
 
4
3
  export class GraphicsData {
4
+ lineWidth!: any;
5
+ lineColor!: any;
6
+ lineAlpha!: any;
7
+ _lineTint!: any;
8
+ fillColor!: any;
9
+ fillAlpha!: any;
10
+ _fillTint!: any;
11
+ fill!: any;
12
+ shape!: any;
13
+ type!: any;
5
14
  /**
6
15
  * Creates a new GraphicsData object.
7
16
  * @param {number} lineWidth - The line width.
@@ -12,7 +21,7 @@ export class GraphicsData {
12
21
  * @param {boolean} fill - Whether to fill the shape.
13
22
  * @param {object} shape - The shape to draw.
14
23
  */
15
- constructor(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) {
24
+ constructor(lineWidth: number, lineColor: number, lineAlpha: number, fillColor: number, fillAlpha: number, fill: boolean, shape: any) {
16
25
  this.lineWidth = lineWidth;
17
26
  this.lineColor = lineColor;
18
27
  this.lineAlpha = lineAlpha;
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import { GraphicsData } from './graphics_data.js';
3
2
 
4
3
  /**
@@ -6,7 +5,7 @@ import { GraphicsData } from './graphics_data.js';
6
5
  * @param {GraphicsData} source - The source GraphicsData to clone.
7
6
  * @returns {GraphicsData} A new cloned GraphicsData object.
8
7
  */
9
- export const clone = (source) => {
8
+ export const clone = (source: GraphicsData) => {
10
9
  return new GraphicsData(
11
10
  source.lineWidth,
12
11
  source.lineColor,
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import { GROUP } from '../core/const.js';
3
2
  import { Signal } from '../core/signal.js';
4
3
  import { DisplayObject } from './display_object.js';
@@ -8,6 +7,20 @@ export const SORT_ASCENDING = -1;
8
7
  export const SORT_DESCENDING = 1;
9
8
 
10
9
  export class Group extends DisplayObject {
10
+ declare z: number;
11
+ ignoreDestroy!: boolean;
12
+ pendingDestroy!: boolean;
13
+ classType!: Function;
14
+ cursor!: DisplayObject | null;
15
+ inputEnableChildren!: boolean;
16
+ onChildInputDown!: Signal;
17
+ onChildInputUp!: Signal;
18
+ onChildInputOver!: Signal;
19
+ onChildInputOut!: Signal;
20
+ onDestroy!: Signal;
21
+ cursorIndex!: number;
22
+ _sortProperty!: string;
23
+ filters!: object[] | null;
11
24
  /**
12
25
  * Creates a new Group object.
13
26
  * @param {import('../core/game.js').Game} game - The game instance this group belongs to.
@@ -15,7 +28,12 @@ export class Group extends DisplayObject {
15
28
  * @param {string} name - The name of this group.
16
29
  * @param {boolean} addToStage - Whether to add this group to the stage.
17
30
  */
18
- constructor(game, parent = null, name = null, addToStage = false) {
31
+ constructor(
32
+ game: import('../core/game.js').Game,
33
+ parent: DisplayObject = null,
34
+ name: string = null,
35
+ addToStage: boolean = false
36
+ ) {
19
37
  super(game);
20
38
  /** @type {number} */
21
39
  this.type = GROUP;
@@ -62,7 +80,7 @@ export class Group extends DisplayObject {
62
80
  * @param {boolean} destroyChildren - Whether to destroy children as well.
63
81
  * @param {boolean} soft - Whether to perform a soft destroy (leaving the group in the parent's children list).
64
82
  */
65
- destroy(destroyChildren = true, soft = false) {
83
+ destroy(destroyChildren: boolean = true, soft: boolean = false) {
66
84
  if (this.game === null || this.ignoreDestroy) {
67
85
  return;
68
86
  }
@@ -87,7 +105,7 @@ export class Group extends DisplayObject {
87
105
  * @param {number} index - The index to add the child at.
88
106
  * @returns {DisplayObject} The added child.
89
107
  */
90
- add(child, silent = false, index = -1) {
108
+ add(child: any, silent: boolean = false, index: number = -1) {
91
109
  if (child.parent === this) {
92
110
  return child;
93
111
  }
@@ -116,7 +134,7 @@ export class Group extends DisplayObject {
116
134
  * @param {number} index - The index to add the child at.
117
135
  * @param {boolean} silent - Whether to dispatch events.
118
136
  */
119
- addAt(child, index, silent) {
137
+ addAt(child: DisplayObject, index: number, silent: boolean) {
120
138
  this.add(child, silent, index);
121
139
  }
122
140
 
@@ -125,7 +143,7 @@ export class Group extends DisplayObject {
125
143
  * @param {number} index - The index of the child to get.
126
144
  * @returns {DisplayObject} The child at the specified index, or -1 if not found.
127
145
  */
128
- getAt(index) {
146
+ getAt(index: number) {
129
147
  if (index < 0 || index >= this.children.length) {
130
148
  return -1;
131
149
  }
@@ -184,7 +202,7 @@ export class Group extends DisplayObject {
184
202
  * @param {DisplayObject} child1 - The first child to swap.
185
203
  * @param {DisplayObject} child2 - The second child to swap.
186
204
  */
187
- swap(child1, child2) {
205
+ swap(child1: DisplayObject, child2: DisplayObject) {
188
206
  this.swapChildren(child1, child2);
189
207
  this.updateZ();
190
208
  }
@@ -194,7 +212,7 @@ export class Group extends DisplayObject {
194
212
  * @param {DisplayObject} child - The child to bring to the top.
195
213
  * @returns {DisplayObject} The child that was brought to the top.
196
214
  */
197
- bringToTop(child) {
215
+ bringToTop(child: DisplayObject) {
198
216
  if (child.parent === this && this.getIndex(child) < this.children.length) {
199
217
  this.remove(child, false, true);
200
218
  this.add(child, true);
@@ -207,7 +225,7 @@ export class Group extends DisplayObject {
207
225
  * @param {DisplayObject} child - The child to send to the back.
208
226
  * @returns {DisplayObject} The child that was sent to the back.
209
227
  */
210
- sendToBack(child) {
228
+ sendToBack(child: DisplayObject) {
211
229
  if (child.parent === this && this.getIndex(child) > 0) {
212
230
  this.remove(child, false, true);
213
231
  this.addAt(child, 0, true);
@@ -228,7 +246,7 @@ export class Group extends DisplayObject {
228
246
  * @param {DisplayObject} child - The child to get the index of.
229
247
  * @returns {number} The index of the child, or -1 if not found.
230
248
  */
231
- getIndex(child) {
249
+ getIndex(child: DisplayObject) {
232
250
  return this.children.indexOf(child);
233
251
  }
234
252
 
@@ -276,7 +294,7 @@ export class Group extends DisplayObject {
276
294
  * @param {boolean} silent - Whether to dispatch events.
277
295
  * @returns {boolean} True if the child was removed, false otherwise.
278
296
  */
279
- remove(child, destroy = true, silent = false) {
297
+ remove(child: any, destroy: boolean = true, silent: boolean = false) {
280
298
  if (this.children.length === 0 || this.children.indexOf(child) === -1) {
281
299
  return false;
282
300
  }
@@ -289,7 +307,7 @@ export class Group extends DisplayObject {
289
307
  this.next();
290
308
  }
291
309
  if (destroy && removed) {
292
- removed.destroy(true);
310
+ (removed as any).destroy(true);
293
311
  }
294
312
  return true;
295
313
  }
@@ -300,7 +318,7 @@ export class Group extends DisplayObject {
300
318
  * @param {boolean} silent - Whether to dispatch events.
301
319
  * @param {boolean} destroyTexture - Whether to destroy textures as well.
302
320
  */
303
- removeAll(destroy = true, silent = false, destroyTexture = false) {
321
+ removeAll(destroy: boolean = true, silent: boolean = false, destroyTexture: boolean = false) {
304
322
  if (this.children.length === 0) {
305
323
  return;
306
324
  }
@@ -310,7 +328,7 @@ export class Group extends DisplayObject {
310
328
  }
311
329
  const removed = this.removeChild(this.children[0]);
312
330
  if (destroy && removed) {
313
- removed.destroy(true, destroyTexture);
331
+ (removed as any).destroy(true, destroyTexture);
314
332
  }
315
333
  } while (this.children.length > 0);
316
334
  this.cursor = null;
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import { AnimationManager } from '../core/animation_manager.js';
3
2
  import { BLEND_NORMAL, IMAGE, PENDING_ATLAS, SCALE_NEAREST } from '../core/const.js';
4
3
  import { EventManager } from '../core/event_manager.js';
@@ -9,6 +8,25 @@ import { getBounds, getLocalBounds, renderCanvas, renderWebGL, setTexture } from
9
8
  import { Texture } from './webgl/texture.js';
10
9
 
11
10
  export class Image extends DisplayObject {
11
+ key!: any;
12
+ texture!: Texture;
13
+ declare _width: number;
14
+ declare _height: number;
15
+ tint!: number;
16
+ cachedTint!: number;
17
+ tilingTexture!: Texture | null;
18
+ tintedTexture!: Texture | null;
19
+ blendMode!: number;
20
+ shader!: object | null;
21
+ _frame!: any;
22
+ pendingDestroy!: boolean;
23
+ declare events: EventManager;
24
+ animations!: AnimationManager;
25
+ customRender!: boolean;
26
+ cropRect!: Rectangle | null;
27
+ _crop!: Rectangle | null;
28
+ refreshTexture!: boolean;
29
+ declare renderOrderID: number;
12
30
  /**
13
31
  * Creates a new Image instance.
14
32
  * @param {import('../core/game.js').Game} game - The game instance this image belongs to.
@@ -17,7 +35,7 @@ export class Image extends DisplayObject {
17
35
  * @param {string | number | Texture} key - The texture key or texture to use.
18
36
  * @param {string | number} frame - The frame identifier (name or index) to use.
19
37
  */
20
- constructor(game, x, y, key, frame = 0) {
38
+ constructor(game: import('../core/game.js').Game, x: number, y: number, key: string | number | Texture, frame: string | number = 0) {
21
39
  super(game);
22
40
  /** @type {number} */
23
41
  this.type = IMAGE;
@@ -33,7 +51,7 @@ export class Image extends DisplayObject {
33
51
  /** @type {number} */
34
52
  this._height = 0;
35
53
  /** @type {number} */
36
- this.tint = 0xffffff;
54
+ this.tint = 0xff_ff_ff;
37
55
  /** @type {number} */
38
56
  this.cachedTint = -1;
39
57
  /** @type {Texture | null} */
@@ -46,7 +64,7 @@ export class Image extends DisplayObject {
46
64
  this._frame = null;
47
65
  /** @type {boolean} */
48
66
  this.pendingDestroy = false;
49
- /* if (this.texture.baseTexture.hasLoaded) {
67
+ /* If (this.texture.baseTexture.hasLoaded) {
50
68
  this.onTextureUpdate();
51
69
  } */
52
70
  this.position.setTo(x, y);
@@ -65,7 +83,7 @@ export class Image extends DisplayObject {
65
83
  this.key = null;
66
84
  this.data = null;
67
85
  this.texture = null;
68
- this.tint = 0xffffff;
86
+ this.tint = 0xff_ff_ff;
69
87
  this.cachedTint = -1;
70
88
  this.tintedTexture = null;
71
89
  this.shader = null;
@@ -113,7 +131,7 @@ export class Image extends DisplayObject {
113
131
  * @param {string | number | null | undefined} frame - The frame identifier (name or index) to use.
114
132
  * @param {boolean} stopAnimation - Whether to stop the animation when changing textures.
115
133
  */
116
- loadTexture(key, frame = 0, stopAnimation = true) {
134
+ loadTexture(key: string | number | Texture, frame: string | number | null = 0, stopAnimation: boolean = true) {
117
135
  if (key === PENDING_ATLAS) {
118
136
  key = frame;
119
137
  frame = 0;
@@ -125,7 +143,7 @@ export class Image extends DisplayObject {
125
143
  }
126
144
  this.key = key;
127
145
  this.customRender = false;
128
- const cache = this.game.cache;
146
+ const { cache } = this.game;
129
147
  const smoothed = !this.texture.baseTexture.scaleMode;
130
148
  let setFrame = true;
131
149
  if (key instanceof Texture) {
@@ -155,7 +173,7 @@ export class Image extends DisplayObject {
155
173
  * Sets the current frame of this image.
156
174
  * @param {import('../core/frame.js').Frame} frame - The frame to set.
157
175
  */
158
- setFrame(frame) {
176
+ setFrame(frame: import('../core/frame.js').Frame) {
159
177
  this._frame = frame;
160
178
  this.texture.frame.x = frame.x;
161
179
  this.texture.frame.y = frame.y;
@@ -202,7 +220,7 @@ export class Image extends DisplayObject {
202
220
  * @param {number} width - The new width of the frame.
203
221
  * @param {number} height - The new height of the frame.
204
222
  */
205
- resizeFrame(parent, width, height) {
223
+ resizeFrame(parent: DisplayObject, width: number, height: number) {
206
224
  this.texture.frame.resize(width, height);
207
225
  this.texture.setFrame(this.texture.frame);
208
226
  }
@@ -228,7 +246,7 @@ export class Image extends DisplayObject {
228
246
  * Sets the current frame index of this image.
229
247
  * @param {number} value - The new frame index to set.
230
248
  */
231
- set frame(value) {
249
+ set frame(value: number) {
232
250
  this.animations.frame = value;
233
251
  }
234
252
 
@@ -244,7 +262,7 @@ export class Image extends DisplayObject {
244
262
  * Sets the current frame name of this image.
245
263
  * @param {string} value - The new frame name to set.
246
264
  */
247
- set frameName(value) {
265
+ set frameName(value: string) {
248
266
  this.animations.frameName = value;
249
267
  }
250
268
 
@@ -255,7 +273,7 @@ export class Image extends DisplayObject {
255
273
  * @param {Rectangle} rect - The rectangle to crop to.
256
274
  * @param {boolean} copy - Whether to copy the rect or use it directly.
257
275
  */
258
- crop(rect, copy = false) {
276
+ crop(rect: Rectangle, copy: boolean = false) {
259
277
  if (rect) {
260
278
  if (copy && this.cropRect !== null) {
261
279
  this.cropRect.setTo(rect.x, rect.y, rect.width, rect.height);
@@ -316,7 +334,7 @@ export class Image extends DisplayObject {
316
334
  * Sets the width of this image.
317
335
  * @param {number} value - The new width in pixels.
318
336
  */
319
- set width(value) {
337
+ set width(value: number) {
320
338
  this.scale.x = value / this.texture.frame.width;
321
339
  this._width = value;
322
340
  }
@@ -333,7 +351,7 @@ export class Image extends DisplayObject {
333
351
  * Sets the height of this image.
334
352
  * @param {number} value - The new height in pixels.
335
353
  */
336
- set height(value) {
354
+ set height(value: number) {
337
355
  this.scale.y = value / this.texture.frame.height;
338
356
  this._height = value;
339
357
  }
@@ -342,7 +360,7 @@ export class Image extends DisplayObject {
342
360
  * Called when the texture of this image is updated.
343
361
  */
344
362
  onTextureUpdate() {
345
- // so if _width is 0 then width was not set..
363
+ // So if _width is 0 then width was not set..
346
364
  if (this._width) {
347
365
  this.scale.x = this._width / this.texture.frame.width;
348
366
  }
@@ -356,7 +374,7 @@ export class Image extends DisplayObject {
356
374
  * @param {Texture} texture - The new texture to set.
357
375
  * @param {boolean} destroyBase - Whether to destroy the base texture.
358
376
  */
359
- setTexture(texture, destroyBase = false) {
377
+ setTexture(texture: Texture, destroyBase: boolean = false) {
360
378
  setTexture(this, texture, destroyBase);
361
379
  }
362
380
 
@@ -365,7 +383,7 @@ export class Image extends DisplayObject {
365
383
  * @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
366
384
  * @returns {Rectangle} The bounds rectangle of this image.
367
385
  */
368
- getBounds(matrix = null) {
386
+ getBounds(matrix: import('../geom/matrix.js').Matrix = null) {
369
387
  return getBounds(this, matrix);
370
388
  }
371
389
 
@@ -382,7 +400,7 @@ export class Image extends DisplayObject {
382
400
  * @param {object} renderSession - The WebGL rendering session.
383
401
  * @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
384
402
  */
385
- renderWebGL(renderSession, matrix = null) {
403
+ renderWebGL(renderSession: any, matrix: import('../geom/matrix.js').Matrix = null) {
386
404
  renderWebGL(this, renderSession, matrix);
387
405
  }
388
406
 
@@ -391,7 +409,7 @@ export class Image extends DisplayObject {
391
409
  * @param {object} renderSession - The Canvas rendering session.
392
410
  * @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
393
411
  */
394
- renderCanvas(renderSession, matrix = null) {
412
+ renderCanvas(renderSession: any, matrix: import('../geom/matrix.js').Matrix = null) {
395
413
  renderCanvas(this, renderSession, matrix);
396
414
  }
397
415
  }
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import { DisplayObject } from './display_object.js';
3
2
 
4
3
  export class SpriteBatch extends DisplayObject {
@@ -6,7 +5,7 @@ export class SpriteBatch extends DisplayObject {
6
5
  * Creates a new SpriteBatch object.
7
6
  * @param {import('../core/game.js').Game} game - The game instance.
8
7
  */
9
- constructor(game) {
8
+ constructor(game: import('../core/game.js').Game) {
10
9
  super(game);
11
10
  }
12
11
  }
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import { SCALE_LINEAR } from '../core/const.js';
3
2
  import { getIdentityMatrix } from '../geom/util/matrix.js';
4
3
  import { getTintedTexture } from './canvas/tinter.js';
@@ -9,7 +8,7 @@ import { getTintedTexture } from './canvas/tinter.js';
9
8
  * @param {import('./webgl/texture.js').Texture} texture - The new texture to set.
10
9
  * @param {boolean} destroyBase - Whether to destroy the base texture.
11
10
  */
12
- export const setTexture = (target, texture, destroyBase = false) => {
11
+ export const setTexture = (target: import('./image.js').Image, texture: import('./webgl/texture.js').Texture, destroyBase: boolean = false) => {
13
12
  if (destroyBase) {
14
13
  target.texture.baseTexture.destroy();
15
14
  }
@@ -25,7 +24,7 @@ export const setTexture = (target, texture, destroyBase = false) => {
25
24
  * @param {object} matrix - The transformation matrix.
26
25
  * @returns {import('../geom/rectangle.js').Rectangle} The bounds rectangle.
27
26
  */
28
- export const getBounds = (target, matrix = null) => {
27
+ export const getBounds = (target: import('./image.js').Image, matrix: any = null) => {
29
28
  // TODO verify
30
29
  if (target.currentBounds) {
31
30
  return target.currentBounds;
@@ -107,7 +106,7 @@ export const getBounds = (target, matrix = null) => {
107
106
  * @param {import('./image.js').Image} target - The target image to get local bounds for.
108
107
  * @returns {import('../geom/rectangle.js').Rectangle} The local bounds rectangle.
109
108
  */
110
- export const getLocalBounds = (target) => {
109
+ export const getLocalBounds = (target: import('./image.js').Image) => {
111
110
  const matrixCache = target.worldTransform;
112
111
  target.worldTransform = getIdentityMatrix();
113
112
  let i;
@@ -128,7 +127,7 @@ export const getLocalBounds = (target) => {
128
127
  * @param {object} renderSession - The render session object.
129
128
  * @param {import('../geom/matrix.js').Matrix | null | undefined} matrix - The transformation matrix.
130
129
  */
131
- export const renderWebGL = (target, renderSession, matrix = null) => {
130
+ export const renderWebGL = (target: import('./image.js').Image, renderSession: any, matrix: import('../geom/matrix.js').Matrix | null | undefined = null) => {
132
131
  // if the sprite is not visible or the alpha is 0 then no need to render this element
133
132
  if (!target.visible || target.alpha <= 0 || !target.renderable) {
134
133
  return;
@@ -177,7 +176,7 @@ export const renderWebGL = (target, renderSession, matrix = null) => {
177
176
  * @param {object} renderSession - The render session object.
178
177
  * @param {import('../geom/matrix.js').Matrix | null | undefined} matrix - The transformation matrix.
179
178
  */
180
- export const renderCanvas = (target, renderSession, matrix = null) => {
179
+ export const renderCanvas = (target: import('./image.js').Image, renderSession: any, matrix: import('../geom/matrix.js').Matrix | null | undefined = null) => {
181
180
  // If the sprite is not visible or the alpha is 0 then no need to render this element
182
181
  if (
183
182
  !target.visible ||