@vpmedia/phaser 1.104.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 (297) hide show
  1. package/dist/index.js +151 -574
  2. package/dist/index.js.map +1 -1
  3. package/dist/phaser/core/animation.d.ts +35 -57
  4. package/dist/phaser/core/animation.d.ts.map +1 -1
  5. package/dist/phaser/core/animation_manager.d.ts +11 -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 +60 -60
  12. package/dist/phaser/core/cache.d.ts.map +1 -1
  13. package/dist/phaser/core/device.d.ts.map +1 -1
  14. package/dist/phaser/core/device_util.d.ts +10 -10
  15. package/dist/phaser/core/device_util.d.ts.map +1 -1
  16. package/dist/phaser/core/dom.d.ts +6 -5
  17. package/dist/phaser/core/dom.d.ts.map +1 -1
  18. package/dist/phaser/core/event_manager.d.ts +49 -174
  19. package/dist/phaser/core/event_manager.d.ts.map +1 -1
  20. package/dist/phaser/core/factory.d.ts +7 -7
  21. package/dist/phaser/core/factory.d.ts.map +1 -1
  22. package/dist/phaser/core/frame.d.ts +27 -48
  23. package/dist/phaser/core/frame.d.ts.map +1 -1
  24. package/dist/phaser/core/frame_data.d.ts +11 -60
  25. package/dist/phaser/core/frame_data.d.ts.map +1 -1
  26. package/dist/phaser/core/frame_util.d.ts +4 -14
  27. package/dist/phaser/core/frame_util.d.ts.map +1 -1
  28. package/dist/phaser/core/game.d.ts +49 -58
  29. package/dist/phaser/core/game.d.ts.map +1 -1
  30. package/dist/phaser/core/input.d.ts +15 -13
  31. package/dist/phaser/core/input.d.ts.map +1 -1
  32. package/dist/phaser/core/input_handler.d.ts +23 -20
  33. package/dist/phaser/core/input_handler.d.ts.map +1 -1
  34. package/dist/phaser/core/input_mouse.d.ts +26 -1
  35. package/dist/phaser/core/input_mouse.d.ts.map +1 -1
  36. package/dist/phaser/core/input_mspointer.d.ts +2 -2
  37. package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
  38. package/dist/phaser/core/input_pointer.d.ts +9 -9
  39. package/dist/phaser/core/input_pointer.d.ts.map +1 -1
  40. package/dist/phaser/core/input_touch.d.ts +2 -1
  41. package/dist/phaser/core/input_touch.d.ts.map +1 -1
  42. package/dist/phaser/core/loader.d.ts +28 -28
  43. package/dist/phaser/core/loader.d.ts.map +1 -1
  44. package/dist/phaser/core/loader_parser.d.ts +4 -4
  45. package/dist/phaser/core/loader_parser.d.ts.map +1 -1
  46. package/dist/phaser/core/raf.d.ts +2 -2
  47. package/dist/phaser/core/raf.d.ts.map +1 -1
  48. package/dist/phaser/core/scale_manager.d.ts +22 -17
  49. package/dist/phaser/core/scale_manager.d.ts.map +1 -1
  50. package/dist/phaser/core/scene.d.ts +1 -1
  51. package/dist/phaser/core/scene.d.ts.map +1 -1
  52. package/dist/phaser/core/scene_manager.d.ts +10 -9
  53. package/dist/phaser/core/scene_manager.d.ts.map +1 -1
  54. package/dist/phaser/core/signal.d.ts +9 -8
  55. package/dist/phaser/core/signal.d.ts.map +1 -1
  56. package/dist/phaser/core/signal_binding.d.ts +2 -2
  57. package/dist/phaser/core/signal_binding.d.ts.map +1 -1
  58. package/dist/phaser/core/sound.d.ts +56 -101
  59. package/dist/phaser/core/sound.d.ts.map +1 -1
  60. package/dist/phaser/core/sound_manager.d.ts +11 -9
  61. package/dist/phaser/core/sound_manager.d.ts.map +1 -1
  62. package/dist/phaser/core/sound_sprite.d.ts +4 -4
  63. package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
  64. package/dist/phaser/core/stage.d.ts +3 -3
  65. package/dist/phaser/core/stage.d.ts.map +1 -1
  66. package/dist/phaser/core/time.d.ts +5 -5
  67. package/dist/phaser/core/time.d.ts.map +1 -1
  68. package/dist/phaser/core/timer.d.ts +10 -10
  69. package/dist/phaser/core/timer.d.ts.map +1 -1
  70. package/dist/phaser/core/timer_event.d.ts +11 -21
  71. package/dist/phaser/core/timer_event.d.ts.map +1 -1
  72. package/dist/phaser/core/tween.d.ts +37 -59
  73. package/dist/phaser/core/tween.d.ts.map +1 -1
  74. package/dist/phaser/core/tween_data.d.ts +6 -5
  75. package/dist/phaser/core/tween_data.d.ts.map +1 -1
  76. package/dist/phaser/core/tween_easing.d.ts +31 -31
  77. package/dist/phaser/core/tween_easing.d.ts.map +1 -1
  78. package/dist/phaser/core/tween_manager.d.ts +4 -4
  79. package/dist/phaser/core/tween_manager.d.ts.map +1 -1
  80. package/dist/phaser/core/world.d.ts +1 -1
  81. package/dist/phaser/core/world.d.ts.map +1 -1
  82. package/dist/phaser/display/bitmap_text.d.ts +22 -20
  83. package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
  84. package/dist/phaser/display/button.d.ts +23 -35
  85. package/dist/phaser/display/button.d.ts.map +1 -1
  86. package/dist/phaser/display/canvas/buffer.d.ts +2 -2
  87. package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
  88. package/dist/phaser/display/canvas/graphics.d.ts +3 -3
  89. package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
  90. package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
  91. package/dist/phaser/display/canvas/pool.d.ts +2 -2
  92. package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
  93. package/dist/phaser/display/canvas/renderer.d.ts +5 -5
  94. package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
  95. package/dist/phaser/display/canvas/tinter.d.ts +3 -3
  96. package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
  97. package/dist/phaser/display/canvas/util.d.ts +9 -9
  98. package/dist/phaser/display/canvas/util.d.ts.map +1 -1
  99. package/dist/phaser/display/display_object.d.ts +45 -42
  100. package/dist/phaser/display/display_object.d.ts.map +1 -1
  101. package/dist/phaser/display/graphics.d.ts +24 -16
  102. package/dist/phaser/display/graphics.d.ts.map +1 -1
  103. package/dist/phaser/display/graphics_data.d.ts +1 -1
  104. package/dist/phaser/display/graphics_data.d.ts.map +1 -1
  105. package/dist/phaser/display/graphics_data_util.d.ts +1 -1
  106. package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
  107. package/dist/phaser/display/group.d.ts +24 -37
  108. package/dist/phaser/display/group.d.ts.map +1 -1
  109. package/dist/phaser/display/image.d.ts +34 -49
  110. package/dist/phaser/display/image.d.ts.map +1 -1
  111. package/dist/phaser/display/sprite_batch.d.ts +1 -1
  112. package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
  113. package/dist/phaser/display/sprite_util.d.ts +5 -5
  114. package/dist/phaser/display/sprite_util.d.ts.map +1 -1
  115. package/dist/phaser/display/text.d.ts +86 -66
  116. package/dist/phaser/display/text.d.ts.map +1 -1
  117. package/dist/phaser/display/webgl/abstract_filter.d.ts +2 -1
  118. package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  119. package/dist/phaser/display/webgl/base_texture.d.ts +2 -2
  120. package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
  121. package/dist/phaser/display/webgl/blend_manager.d.ts +3 -2
  122. package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  123. package/dist/phaser/display/webgl/earcut.d.ts +10 -10
  124. package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
  125. package/dist/phaser/display/webgl/earcut_node.d.ts +1 -1
  126. package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  127. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +2 -1
  128. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  129. package/dist/phaser/display/webgl/filter_manager.d.ts +2 -1
  130. package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  131. package/dist/phaser/display/webgl/filter_texture.d.ts +3 -2
  132. package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  133. package/dist/phaser/display/webgl/graphics.d.ts +11 -10
  134. package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
  135. package/dist/phaser/display/webgl/graphics_data.d.ts +2 -1
  136. package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  137. package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  138. package/dist/phaser/display/webgl/render_texture.d.ts +2 -1
  139. package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
  140. package/dist/phaser/display/webgl/renderer.d.ts +8 -6
  141. package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
  142. package/dist/phaser/display/webgl/shader/complex.d.ts +2 -1
  143. package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  144. package/dist/phaser/display/webgl/shader/fast.d.ts +2 -1
  145. package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  146. package/dist/phaser/display/webgl/shader/normal.d.ts +1 -0
  147. package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  148. package/dist/phaser/display/webgl/shader/primitive.d.ts +2 -1
  149. package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  150. package/dist/phaser/display/webgl/shader/strip.d.ts +2 -1
  151. package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  152. package/dist/phaser/display/webgl/shader_manager.d.ts +4 -2
  153. package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  154. package/dist/phaser/display/webgl/sprite_batch.d.ts +3 -2
  155. package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  156. package/dist/phaser/display/webgl/stencil_manager.d.ts +5 -4
  157. package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  158. package/dist/phaser/display/webgl/texture.d.ts +15 -2
  159. package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
  160. package/dist/phaser/display/webgl/texture_util.d.ts +2 -2
  161. package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
  162. package/dist/phaser/display/webgl/util.d.ts +6 -6
  163. package/dist/phaser/display/webgl/util.d.ts.map +1 -1
  164. package/dist/phaser/geom/circle.d.ts +11 -10
  165. package/dist/phaser/geom/circle.d.ts.map +1 -1
  166. package/dist/phaser/geom/ellipse.d.ts +6 -5
  167. package/dist/phaser/geom/ellipse.d.ts.map +1 -1
  168. package/dist/phaser/geom/line.d.ts +14 -14
  169. package/dist/phaser/geom/line.d.ts.map +1 -1
  170. package/dist/phaser/geom/matrix.d.ts +13 -12
  171. package/dist/phaser/geom/matrix.d.ts.map +1 -1
  172. package/dist/phaser/geom/point.d.ts +19 -19
  173. package/dist/phaser/geom/point.d.ts.map +1 -1
  174. package/dist/phaser/geom/polygon.d.ts +6 -6
  175. package/dist/phaser/geom/polygon.d.ts.map +1 -1
  176. package/dist/phaser/geom/rectangle.d.ts +20 -20
  177. package/dist/phaser/geom/rectangle.d.ts.map +1 -1
  178. package/dist/phaser/geom/rounded_rectangle.d.ts +2 -2
  179. package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  180. package/dist/phaser/geom/util/circle.d.ts +9 -7
  181. package/dist/phaser/geom/util/circle.d.ts.map +1 -1
  182. package/dist/phaser/geom/util/ellipse.d.ts +1 -1
  183. package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
  184. package/dist/phaser/geom/util/line.d.ts +5 -3
  185. package/dist/phaser/geom/util/line.d.ts.map +1 -1
  186. package/dist/phaser/geom/util/matrix.d.ts +2 -1
  187. package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
  188. package/dist/phaser/geom/util/point.d.ts +19 -19
  189. package/dist/phaser/geom/util/point.d.ts.map +1 -1
  190. package/dist/phaser/geom/util/polygon.d.ts +2 -1
  191. package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
  192. package/dist/phaser/geom/util/rectangle.d.ts +17 -15
  193. package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
  194. package/dist/phaser/geom/util/rounded_rectangle.d.ts +2 -1
  195. package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  196. package/dist/phaser/util/math.d.ts +51 -142
  197. package/dist/phaser/util/math.d.ts.map +1 -1
  198. package/package.json +1 -1
  199. package/src/phaser/core/animation.ts +38 -61
  200. package/src/phaser/core/animation_manager.ts +21 -21
  201. package/src/phaser/core/animation_parser.ts +11 -3
  202. package/src/phaser/core/array_set.ts +8 -8
  203. package/src/phaser/core/cache.ts +75 -68
  204. package/src/phaser/core/device.ts +23 -24
  205. package/src/phaser/core/device_util.ts +10 -10
  206. package/src/phaser/core/dom.ts +5 -5
  207. package/src/phaser/core/event_manager.ts +52 -193
  208. package/src/phaser/core/factory.ts +25 -18
  209. package/src/phaser/core/frame.ts +37 -51
  210. package/src/phaser/core/frame_data.ts +29 -76
  211. package/src/phaser/core/frame_util.ts +3 -16
  212. package/src/phaser/core/game.ts +36 -63
  213. package/src/phaser/core/input.ts +68 -68
  214. package/src/phaser/core/input_handler.ts +81 -86
  215. package/src/phaser/core/input_mouse.ts +42 -36
  216. package/src/phaser/core/input_mspointer.ts +24 -25
  217. package/src/phaser/core/input_pointer.ts +55 -56
  218. package/src/phaser/core/input_touch.ts +26 -26
  219. package/src/phaser/core/loader.ts +97 -70
  220. package/src/phaser/core/loader_parser.ts +6 -7
  221. package/src/phaser/core/raf.ts +2 -2
  222. package/src/phaser/core/scale_manager.ts +85 -82
  223. package/src/phaser/core/scene.ts +3 -4
  224. package/src/phaser/core/scene_manager.ts +26 -26
  225. package/src/phaser/core/signal.ts +10 -10
  226. package/src/phaser/core/signal_binding.ts +2 -2
  227. package/src/phaser/core/sound.ts +65 -112
  228. package/src/phaser/core/sound_manager.ts +31 -30
  229. package/src/phaser/core/sound_sprite.ts +10 -11
  230. package/src/phaser/core/stage.ts +8 -8
  231. package/src/phaser/core/time.ts +33 -34
  232. package/src/phaser/core/timer.ts +40 -34
  233. package/src/phaser/core/timer_event.ts +23 -23
  234. package/src/phaser/core/tween.ts +42 -68
  235. package/src/phaser/core/tween_data.ts +31 -31
  236. package/src/phaser/core/tween_easing.ts +31 -31
  237. package/src/phaser/core/tween_manager.ts +10 -11
  238. package/src/phaser/core/world.ts +1 -2
  239. package/src/phaser/display/bitmap_text.ts +41 -31
  240. package/src/phaser/display/button.ts +24 -51
  241. package/src/phaser/display/canvas/buffer.ts +6 -7
  242. package/src/phaser/display/canvas/graphics.ts +3 -4
  243. package/src/phaser/display/canvas/masker.ts +2 -3
  244. package/src/phaser/display/canvas/pool.ts +3 -4
  245. package/src/phaser/display/canvas/renderer.ts +19 -20
  246. package/src/phaser/display/canvas/tinter.ts +4 -5
  247. package/src/phaser/display/canvas/util.ts +9 -9
  248. package/src/phaser/display/display_object.ts +49 -50
  249. package/src/phaser/display/graphics.ts +56 -43
  250. package/src/phaser/display/graphics_data.ts +11 -12
  251. package/src/phaser/display/graphics_data_util.ts +1 -2
  252. package/src/phaser/display/group.ts +32 -42
  253. package/src/phaser/display/image.ts +32 -52
  254. package/src/phaser/display/sprite_batch.ts +1 -2
  255. package/src/phaser/display/sprite_util.ts +5 -6
  256. package/src/phaser/display/text.ts +82 -56
  257. package/src/phaser/display/webgl/abstract_filter.ts +8 -8
  258. package/src/phaser/display/webgl/base_texture.ts +14 -15
  259. package/src/phaser/display/webgl/blend_manager.ts +5 -5
  260. package/src/phaser/display/webgl/earcut.ts +27 -27
  261. package/src/phaser/display/webgl/earcut_node.ts +1 -1
  262. package/src/phaser/display/webgl/fast_sprite_batch.ts +19 -19
  263. package/src/phaser/display/webgl/filter_manager.ts +5 -5
  264. package/src/phaser/display/webgl/filter_texture.ts +7 -7
  265. package/src/phaser/display/webgl/graphics.ts +10 -11
  266. package/src/phaser/display/webgl/graphics_data.ts +11 -11
  267. package/src/phaser/display/webgl/mask_manager.ts +2 -3
  268. package/src/phaser/display/webgl/render_texture.ts +12 -12
  269. package/src/phaser/display/webgl/renderer.ts +24 -24
  270. package/src/phaser/display/webgl/shader/complex.ts +7 -7
  271. package/src/phaser/display/webgl/shader/fast.ts +8 -8
  272. package/src/phaser/display/webgl/shader/normal.ts +12 -12
  273. package/src/phaser/display/webgl/shader/primitive.ts +7 -7
  274. package/src/phaser/display/webgl/shader/strip.ts +7 -7
  275. package/src/phaser/display/webgl/shader_manager.ts +13 -13
  276. package/src/phaser/display/webgl/sprite_batch.ts +20 -20
  277. package/src/phaser/display/webgl/stencil_manager.ts +8 -8
  278. package/src/phaser/display/webgl/texture.ts +35 -24
  279. package/src/phaser/display/webgl/texture_util.ts +2 -3
  280. package/src/phaser/display/webgl/util.ts +6 -6
  281. package/src/phaser/geom/circle.ts +10 -10
  282. package/src/phaser/geom/ellipse.ts +6 -6
  283. package/src/phaser/geom/line.ts +14 -14
  284. package/src/phaser/geom/matrix.ts +12 -12
  285. package/src/phaser/geom/point.ts +19 -19
  286. package/src/phaser/geom/polygon.ts +5 -5
  287. package/src/phaser/geom/rectangle.ts +21 -21
  288. package/src/phaser/geom/rounded_rectangle.ts +2 -2
  289. package/src/phaser/geom/util/circle.ts +7 -7
  290. package/src/phaser/geom/util/ellipse.ts +1 -1
  291. package/src/phaser/geom/util/line.ts +5 -5
  292. package/src/phaser/geom/util/matrix.ts +1 -1
  293. package/src/phaser/geom/util/point.ts +20 -20
  294. package/src/phaser/geom/util/polygon.ts +1 -1
  295. package/src/phaser/geom/util/rectangle.ts +15 -15
  296. package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
  297. package/src/phaser/util/math.ts +65 -151
@@ -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,34 +7,20 @@ export const SORT_ASCENDING = -1;
8
7
  export const SORT_DESCENDING = 1;
9
8
 
10
9
  export class Group extends DisplayObject {
11
- /** @type {number} */
12
- z;
13
- /** @type {boolean} */
14
- ignoreDestroy;
15
- /** @type {boolean} */
16
- pendingDestroy;
17
- /** @type {Function} */
18
- classType;
19
- /** @type {DisplayObject | null} */
20
- cursor;
21
- /** @type {boolean} */
22
- inputEnableChildren;
23
- /** @type {Signal} */
24
- onChildInputDown;
25
- /** @type {Signal} */
26
- onChildInputUp;
27
- /** @type {Signal} */
28
- onChildInputOver;
29
- /** @type {Signal} */
30
- onChildInputOut;
31
- /** @type {Signal} */
32
- onDestroy;
33
- /** @type {number} */
34
- cursorIndex;
35
- /** @type {string} */
36
- _sortProperty;
37
- /** @type {object[] | null} */
38
- filters;
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;
39
24
  /**
40
25
  * Creates a new Group object.
41
26
  * @param {import('../core/game.js').Game} game - The game instance this group belongs to.
@@ -43,7 +28,12 @@ export class Group extends DisplayObject {
43
28
  * @param {string} name - The name of this group.
44
29
  * @param {boolean} addToStage - Whether to add this group to the stage.
45
30
  */
46
- 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
+ ) {
47
37
  super(game);
48
38
  /** @type {number} */
49
39
  this.type = GROUP;
@@ -90,7 +80,7 @@ export class Group extends DisplayObject {
90
80
  * @param {boolean} destroyChildren - Whether to destroy children as well.
91
81
  * @param {boolean} soft - Whether to perform a soft destroy (leaving the group in the parent's children list).
92
82
  */
93
- destroy(destroyChildren = true, soft = false) {
83
+ destroy(destroyChildren: boolean = true, soft: boolean = false) {
94
84
  if (this.game === null || this.ignoreDestroy) {
95
85
  return;
96
86
  }
@@ -115,7 +105,7 @@ export class Group extends DisplayObject {
115
105
  * @param {number} index - The index to add the child at.
116
106
  * @returns {DisplayObject} The added child.
117
107
  */
118
- add(child, silent = false, index = -1) {
108
+ add(child: any, silent: boolean = false, index: number = -1) {
119
109
  if (child.parent === this) {
120
110
  return child;
121
111
  }
@@ -144,7 +134,7 @@ export class Group extends DisplayObject {
144
134
  * @param {number} index - The index to add the child at.
145
135
  * @param {boolean} silent - Whether to dispatch events.
146
136
  */
147
- addAt(child, index, silent) {
137
+ addAt(child: DisplayObject, index: number, silent: boolean) {
148
138
  this.add(child, silent, index);
149
139
  }
150
140
 
@@ -153,7 +143,7 @@ export class Group extends DisplayObject {
153
143
  * @param {number} index - The index of the child to get.
154
144
  * @returns {DisplayObject} The child at the specified index, or -1 if not found.
155
145
  */
156
- getAt(index) {
146
+ getAt(index: number) {
157
147
  if (index < 0 || index >= this.children.length) {
158
148
  return -1;
159
149
  }
@@ -212,7 +202,7 @@ export class Group extends DisplayObject {
212
202
  * @param {DisplayObject} child1 - The first child to swap.
213
203
  * @param {DisplayObject} child2 - The second child to swap.
214
204
  */
215
- swap(child1, child2) {
205
+ swap(child1: DisplayObject, child2: DisplayObject) {
216
206
  this.swapChildren(child1, child2);
217
207
  this.updateZ();
218
208
  }
@@ -222,7 +212,7 @@ export class Group extends DisplayObject {
222
212
  * @param {DisplayObject} child - The child to bring to the top.
223
213
  * @returns {DisplayObject} The child that was brought to the top.
224
214
  */
225
- bringToTop(child) {
215
+ bringToTop(child: DisplayObject) {
226
216
  if (child.parent === this && this.getIndex(child) < this.children.length) {
227
217
  this.remove(child, false, true);
228
218
  this.add(child, true);
@@ -235,7 +225,7 @@ export class Group extends DisplayObject {
235
225
  * @param {DisplayObject} child - The child to send to the back.
236
226
  * @returns {DisplayObject} The child that was sent to the back.
237
227
  */
238
- sendToBack(child) {
228
+ sendToBack(child: DisplayObject) {
239
229
  if (child.parent === this && this.getIndex(child) > 0) {
240
230
  this.remove(child, false, true);
241
231
  this.addAt(child, 0, true);
@@ -256,7 +246,7 @@ export class Group extends DisplayObject {
256
246
  * @param {DisplayObject} child - The child to get the index of.
257
247
  * @returns {number} The index of the child, or -1 if not found.
258
248
  */
259
- getIndex(child) {
249
+ getIndex(child: DisplayObject) {
260
250
  return this.children.indexOf(child);
261
251
  }
262
252
 
@@ -304,7 +294,7 @@ export class Group extends DisplayObject {
304
294
  * @param {boolean} silent - Whether to dispatch events.
305
295
  * @returns {boolean} True if the child was removed, false otherwise.
306
296
  */
307
- remove(child, destroy = true, silent = false) {
297
+ remove(child: any, destroy: boolean = true, silent: boolean = false) {
308
298
  if (this.children.length === 0 || this.children.indexOf(child) === -1) {
309
299
  return false;
310
300
  }
@@ -317,7 +307,7 @@ export class Group extends DisplayObject {
317
307
  this.next();
318
308
  }
319
309
  if (destroy && removed) {
320
- removed.destroy(true);
310
+ (removed as any).destroy(true);
321
311
  }
322
312
  return true;
323
313
  }
@@ -328,7 +318,7 @@ export class Group extends DisplayObject {
328
318
  * @param {boolean} silent - Whether to dispatch events.
329
319
  * @param {boolean} destroyTexture - Whether to destroy textures as well.
330
320
  */
331
- removeAll(destroy = true, silent = false, destroyTexture = false) {
321
+ removeAll(destroy: boolean = true, silent: boolean = false, destroyTexture: boolean = false) {
332
322
  if (this.children.length === 0) {
333
323
  return;
334
324
  }
@@ -338,7 +328,7 @@ export class Group extends DisplayObject {
338
328
  }
339
329
  const removed = this.removeChild(this.children[0]);
340
330
  if (destroy && removed) {
341
- removed.destroy(true, destroyTexture);
331
+ (removed as any).destroy(true, destroyTexture);
342
332
  }
343
333
  } while (this.children.length > 0);
344
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,44 +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 {
12
- /** @type {string | number | Texture} */
13
- key;
14
- /** @type {Texture} */
15
- texture;
16
- /** @type {number} */
17
- _width;
18
- /** @type {number} */
19
- _height;
20
- /** @type {number} */
21
- tint;
22
- /** @type {number} */
23
- cachedTint;
24
- /** @type {Texture | null} */
25
- tilingTexture;
26
- /** @type {Texture | null} */
27
- tintedTexture;
28
- /** @type {number} */
29
- blendMode;
30
- /** @type {object | null} */
31
- shader;
32
- /** @type {import('../core/frame.js').Frame | null} */
33
- _frame;
34
- /** @type {boolean} */
35
- pendingDestroy;
36
- /** @type {EventManager} */
37
- events;
38
- /** @type {AnimationManager} */
39
- animations;
40
- /** @type {boolean} */
41
- customRender;
42
- /** @type {Rectangle | null} */
43
- cropRect;
44
- /** @type {Rectangle | null} */
45
- _crop;
46
- /** @type {boolean} */
47
- refreshTexture;
48
- /** @type {number} */
49
- renderOrderID;
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;
50
30
  /**
51
31
  * Creates a new Image instance.
52
32
  * @param {import('../core/game.js').Game} game - The game instance this image belongs to.
@@ -55,7 +35,7 @@ export class Image extends DisplayObject {
55
35
  * @param {string | number | Texture} key - The texture key or texture to use.
56
36
  * @param {string | number} frame - The frame identifier (name or index) to use.
57
37
  */
58
- 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) {
59
39
  super(game);
60
40
  /** @type {number} */
61
41
  this.type = IMAGE;
@@ -151,7 +131,7 @@ export class Image extends DisplayObject {
151
131
  * @param {string | number | null | undefined} frame - The frame identifier (name or index) to use.
152
132
  * @param {boolean} stopAnimation - Whether to stop the animation when changing textures.
153
133
  */
154
- loadTexture(key, frame: string | number | null = 0, stopAnimation = true) {
134
+ loadTexture(key: string | number | Texture, frame: string | number | null = 0, stopAnimation: boolean = true) {
155
135
  if (key === PENDING_ATLAS) {
156
136
  key = frame;
157
137
  frame = 0;
@@ -193,7 +173,7 @@ export class Image extends DisplayObject {
193
173
  * Sets the current frame of this image.
194
174
  * @param {import('../core/frame.js').Frame} frame - The frame to set.
195
175
  */
196
- setFrame(frame) {
176
+ setFrame(frame: import('../core/frame.js').Frame) {
197
177
  this._frame = frame;
198
178
  this.texture.frame.x = frame.x;
199
179
  this.texture.frame.y = frame.y;
@@ -240,7 +220,7 @@ export class Image extends DisplayObject {
240
220
  * @param {number} width - The new width of the frame.
241
221
  * @param {number} height - The new height of the frame.
242
222
  */
243
- resizeFrame(parent, width, height) {
223
+ resizeFrame(parent: DisplayObject, width: number, height: number) {
244
224
  this.texture.frame.resize(width, height);
245
225
  this.texture.setFrame(this.texture.frame);
246
226
  }
@@ -266,7 +246,7 @@ export class Image extends DisplayObject {
266
246
  * Sets the current frame index of this image.
267
247
  * @param {number} value - The new frame index to set.
268
248
  */
269
- set frame(value) {
249
+ set frame(value: number) {
270
250
  this.animations.frame = value;
271
251
  }
272
252
 
@@ -282,7 +262,7 @@ export class Image extends DisplayObject {
282
262
  * Sets the current frame name of this image.
283
263
  * @param {string} value - The new frame name to set.
284
264
  */
285
- set frameName(value) {
265
+ set frameName(value: string) {
286
266
  this.animations.frameName = value;
287
267
  }
288
268
 
@@ -293,7 +273,7 @@ export class Image extends DisplayObject {
293
273
  * @param {Rectangle} rect - The rectangle to crop to.
294
274
  * @param {boolean} copy - Whether to copy the rect or use it directly.
295
275
  */
296
- crop(rect, copy = false) {
276
+ crop(rect: Rectangle, copy: boolean = false) {
297
277
  if (rect) {
298
278
  if (copy && this.cropRect !== null) {
299
279
  this.cropRect.setTo(rect.x, rect.y, rect.width, rect.height);
@@ -354,7 +334,7 @@ export class Image extends DisplayObject {
354
334
  * Sets the width of this image.
355
335
  * @param {number} value - The new width in pixels.
356
336
  */
357
- set width(value) {
337
+ set width(value: number) {
358
338
  this.scale.x = value / this.texture.frame.width;
359
339
  this._width = value;
360
340
  }
@@ -371,7 +351,7 @@ export class Image extends DisplayObject {
371
351
  * Sets the height of this image.
372
352
  * @param {number} value - The new height in pixels.
373
353
  */
374
- set height(value) {
354
+ set height(value: number) {
375
355
  this.scale.y = value / this.texture.frame.height;
376
356
  this._height = value;
377
357
  }
@@ -394,7 +374,7 @@ export class Image extends DisplayObject {
394
374
  * @param {Texture} texture - The new texture to set.
395
375
  * @param {boolean} destroyBase - Whether to destroy the base texture.
396
376
  */
397
- setTexture(texture, destroyBase = false) {
377
+ setTexture(texture: Texture, destroyBase: boolean = false) {
398
378
  setTexture(this, texture, destroyBase);
399
379
  }
400
380
 
@@ -403,7 +383,7 @@ export class Image extends DisplayObject {
403
383
  * @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
404
384
  * @returns {Rectangle} The bounds rectangle of this image.
405
385
  */
406
- getBounds(matrix = null) {
386
+ getBounds(matrix: import('../geom/matrix.js').Matrix = null) {
407
387
  return getBounds(this, matrix);
408
388
  }
409
389
 
@@ -420,7 +400,7 @@ export class Image extends DisplayObject {
420
400
  * @param {object} renderSession - The WebGL rendering session.
421
401
  * @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
422
402
  */
423
- renderWebGL(renderSession, matrix = null) {
403
+ renderWebGL(renderSession: any, matrix: import('../geom/matrix.js').Matrix = null) {
424
404
  renderWebGL(this, renderSession, matrix);
425
405
  }
426
406
 
@@ -429,7 +409,7 @@ export class Image extends DisplayObject {
429
409
  * @param {object} renderSession - The Canvas rendering session.
430
410
  * @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
431
411
  */
432
- renderCanvas(renderSession, matrix = null) {
412
+ renderCanvas(renderSession: any, matrix: import('../geom/matrix.js').Matrix = null) {
433
413
  renderCanvas(this, renderSession, matrix);
434
414
  }
435
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 ||