@vpmedia/phaser 1.104.0 → 1.106.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 (300) hide show
  1. package/dist/index.d.ts +5 -0
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +164 -592
  4. package/dist/index.js.map +1 -1
  5. package/dist/phaser/core/animation.d.ts +35 -57
  6. package/dist/phaser/core/animation.d.ts.map +1 -1
  7. package/dist/phaser/core/animation_manager.d.ts +11 -10
  8. package/dist/phaser/core/animation_manager.d.ts.map +1 -1
  9. package/dist/phaser/core/animation_parser.d.ts +2 -2
  10. package/dist/phaser/core/animation_parser.d.ts.map +1 -1
  11. package/dist/phaser/core/array_set.d.ts +3 -3
  12. package/dist/phaser/core/array_set.d.ts.map +1 -1
  13. package/dist/phaser/core/cache.d.ts +60 -60
  14. package/dist/phaser/core/cache.d.ts.map +1 -1
  15. package/dist/phaser/core/device.d.ts.map +1 -1
  16. package/dist/phaser/core/device_util.d.ts +10 -10
  17. package/dist/phaser/core/device_util.d.ts.map +1 -1
  18. package/dist/phaser/core/dom.d.ts +6 -5
  19. package/dist/phaser/core/dom.d.ts.map +1 -1
  20. package/dist/phaser/core/event_manager.d.ts +49 -174
  21. package/dist/phaser/core/event_manager.d.ts.map +1 -1
  22. package/dist/phaser/core/factory.d.ts +7 -7
  23. package/dist/phaser/core/factory.d.ts.map +1 -1
  24. package/dist/phaser/core/frame.d.ts +27 -48
  25. package/dist/phaser/core/frame.d.ts.map +1 -1
  26. package/dist/phaser/core/frame_data.d.ts +11 -60
  27. package/dist/phaser/core/frame_data.d.ts.map +1 -1
  28. package/dist/phaser/core/frame_util.d.ts +4 -14
  29. package/dist/phaser/core/frame_util.d.ts.map +1 -1
  30. package/dist/phaser/core/game.d.ts +49 -58
  31. package/dist/phaser/core/game.d.ts.map +1 -1
  32. package/dist/phaser/core/input.d.ts +15 -13
  33. package/dist/phaser/core/input.d.ts.map +1 -1
  34. package/dist/phaser/core/input_handler.d.ts +23 -20
  35. package/dist/phaser/core/input_handler.d.ts.map +1 -1
  36. package/dist/phaser/core/input_mouse.d.ts +26 -1
  37. package/dist/phaser/core/input_mouse.d.ts.map +1 -1
  38. package/dist/phaser/core/input_mspointer.d.ts +2 -2
  39. package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
  40. package/dist/phaser/core/input_pointer.d.ts +9 -9
  41. package/dist/phaser/core/input_pointer.d.ts.map +1 -1
  42. package/dist/phaser/core/input_touch.d.ts +2 -1
  43. package/dist/phaser/core/input_touch.d.ts.map +1 -1
  44. package/dist/phaser/core/loader.d.ts +38 -28
  45. package/dist/phaser/core/loader.d.ts.map +1 -1
  46. package/dist/phaser/core/loader_parser.d.ts +4 -4
  47. package/dist/phaser/core/loader_parser.d.ts.map +1 -1
  48. package/dist/phaser/core/raf.d.ts +2 -2
  49. package/dist/phaser/core/raf.d.ts.map +1 -1
  50. package/dist/phaser/core/scale_manager.d.ts +22 -17
  51. package/dist/phaser/core/scale_manager.d.ts.map +1 -1
  52. package/dist/phaser/core/scene.d.ts +1 -1
  53. package/dist/phaser/core/scene.d.ts.map +1 -1
  54. package/dist/phaser/core/scene_manager.d.ts +10 -9
  55. package/dist/phaser/core/scene_manager.d.ts.map +1 -1
  56. package/dist/phaser/core/signal.d.ts +9 -8
  57. package/dist/phaser/core/signal.d.ts.map +1 -1
  58. package/dist/phaser/core/signal_binding.d.ts +2 -2
  59. package/dist/phaser/core/signal_binding.d.ts.map +1 -1
  60. package/dist/phaser/core/sound.d.ts +56 -101
  61. package/dist/phaser/core/sound.d.ts.map +1 -1
  62. package/dist/phaser/core/sound_manager.d.ts +11 -9
  63. package/dist/phaser/core/sound_manager.d.ts.map +1 -1
  64. package/dist/phaser/core/sound_sprite.d.ts +4 -4
  65. package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
  66. package/dist/phaser/core/stage.d.ts +3 -3
  67. package/dist/phaser/core/stage.d.ts.map +1 -1
  68. package/dist/phaser/core/time.d.ts +5 -5
  69. package/dist/phaser/core/time.d.ts.map +1 -1
  70. package/dist/phaser/core/timer.d.ts +10 -10
  71. package/dist/phaser/core/timer.d.ts.map +1 -1
  72. package/dist/phaser/core/timer_event.d.ts +11 -21
  73. package/dist/phaser/core/timer_event.d.ts.map +1 -1
  74. package/dist/phaser/core/tween.d.ts +37 -59
  75. package/dist/phaser/core/tween.d.ts.map +1 -1
  76. package/dist/phaser/core/tween_data.d.ts +6 -5
  77. package/dist/phaser/core/tween_data.d.ts.map +1 -1
  78. package/dist/phaser/core/tween_easing.d.ts +31 -31
  79. package/dist/phaser/core/tween_easing.d.ts.map +1 -1
  80. package/dist/phaser/core/tween_manager.d.ts +4 -4
  81. package/dist/phaser/core/tween_manager.d.ts.map +1 -1
  82. package/dist/phaser/core/world.d.ts +1 -1
  83. package/dist/phaser/core/world.d.ts.map +1 -1
  84. package/dist/phaser/display/bitmap_text.d.ts +22 -20
  85. package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
  86. package/dist/phaser/display/button.d.ts +23 -35
  87. package/dist/phaser/display/button.d.ts.map +1 -1
  88. package/dist/phaser/display/canvas/buffer.d.ts +2 -2
  89. package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
  90. package/dist/phaser/display/canvas/graphics.d.ts +3 -3
  91. package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
  92. package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
  93. package/dist/phaser/display/canvas/pool.d.ts +2 -2
  94. package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
  95. package/dist/phaser/display/canvas/renderer.d.ts +5 -5
  96. package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
  97. package/dist/phaser/display/canvas/tinter.d.ts +3 -3
  98. package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
  99. package/dist/phaser/display/canvas/util.d.ts +9 -9
  100. package/dist/phaser/display/canvas/util.d.ts.map +1 -1
  101. package/dist/phaser/display/display_object.d.ts +45 -42
  102. package/dist/phaser/display/display_object.d.ts.map +1 -1
  103. package/dist/phaser/display/graphics.d.ts +24 -16
  104. package/dist/phaser/display/graphics.d.ts.map +1 -1
  105. package/dist/phaser/display/graphics_data.d.ts +1 -1
  106. package/dist/phaser/display/graphics_data.d.ts.map +1 -1
  107. package/dist/phaser/display/graphics_data_util.d.ts +1 -1
  108. package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
  109. package/dist/phaser/display/group.d.ts +24 -37
  110. package/dist/phaser/display/group.d.ts.map +1 -1
  111. package/dist/phaser/display/image.d.ts +34 -49
  112. package/dist/phaser/display/image.d.ts.map +1 -1
  113. package/dist/phaser/display/sprite_batch.d.ts +1 -1
  114. package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
  115. package/dist/phaser/display/sprite_util.d.ts +5 -5
  116. package/dist/phaser/display/sprite_util.d.ts.map +1 -1
  117. package/dist/phaser/display/text.d.ts +86 -66
  118. package/dist/phaser/display/text.d.ts.map +1 -1
  119. package/dist/phaser/display/webgl/abstract_filter.d.ts +2 -1
  120. package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  121. package/dist/phaser/display/webgl/base_texture.d.ts +2 -2
  122. package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
  123. package/dist/phaser/display/webgl/blend_manager.d.ts +3 -2
  124. package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  125. package/dist/phaser/display/webgl/earcut.d.ts +10 -10
  126. package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
  127. package/dist/phaser/display/webgl/earcut_node.d.ts +1 -1
  128. package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  129. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +2 -1
  130. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  131. package/dist/phaser/display/webgl/filter_manager.d.ts +2 -1
  132. package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  133. package/dist/phaser/display/webgl/filter_texture.d.ts +3 -2
  134. package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  135. package/dist/phaser/display/webgl/graphics.d.ts +11 -10
  136. package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
  137. package/dist/phaser/display/webgl/graphics_data.d.ts +2 -1
  138. package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  139. package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  140. package/dist/phaser/display/webgl/render_texture.d.ts +2 -1
  141. package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
  142. package/dist/phaser/display/webgl/renderer.d.ts +8 -6
  143. package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
  144. package/dist/phaser/display/webgl/shader/complex.d.ts +2 -1
  145. package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  146. package/dist/phaser/display/webgl/shader/fast.d.ts +2 -1
  147. package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  148. package/dist/phaser/display/webgl/shader/normal.d.ts +1 -0
  149. package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  150. package/dist/phaser/display/webgl/shader/primitive.d.ts +2 -1
  151. package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  152. package/dist/phaser/display/webgl/shader/strip.d.ts +2 -1
  153. package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  154. package/dist/phaser/display/webgl/shader_manager.d.ts +4 -2
  155. package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  156. package/dist/phaser/display/webgl/sprite_batch.d.ts +3 -2
  157. package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  158. package/dist/phaser/display/webgl/stencil_manager.d.ts +5 -4
  159. package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  160. package/dist/phaser/display/webgl/texture.d.ts +15 -2
  161. package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
  162. package/dist/phaser/display/webgl/texture_util.d.ts +2 -2
  163. package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
  164. package/dist/phaser/display/webgl/util.d.ts +6 -6
  165. package/dist/phaser/display/webgl/util.d.ts.map +1 -1
  166. package/dist/phaser/geom/circle.d.ts +11 -10
  167. package/dist/phaser/geom/circle.d.ts.map +1 -1
  168. package/dist/phaser/geom/ellipse.d.ts +6 -5
  169. package/dist/phaser/geom/ellipse.d.ts.map +1 -1
  170. package/dist/phaser/geom/line.d.ts +14 -14
  171. package/dist/phaser/geom/line.d.ts.map +1 -1
  172. package/dist/phaser/geom/matrix.d.ts +13 -12
  173. package/dist/phaser/geom/matrix.d.ts.map +1 -1
  174. package/dist/phaser/geom/point.d.ts +19 -19
  175. package/dist/phaser/geom/point.d.ts.map +1 -1
  176. package/dist/phaser/geom/polygon.d.ts +6 -6
  177. package/dist/phaser/geom/polygon.d.ts.map +1 -1
  178. package/dist/phaser/geom/rectangle.d.ts +20 -20
  179. package/dist/phaser/geom/rectangle.d.ts.map +1 -1
  180. package/dist/phaser/geom/rounded_rectangle.d.ts +2 -2
  181. package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  182. package/dist/phaser/geom/util/circle.d.ts +9 -7
  183. package/dist/phaser/geom/util/circle.d.ts.map +1 -1
  184. package/dist/phaser/geom/util/ellipse.d.ts +1 -1
  185. package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
  186. package/dist/phaser/geom/util/line.d.ts +5 -3
  187. package/dist/phaser/geom/util/line.d.ts.map +1 -1
  188. package/dist/phaser/geom/util/matrix.d.ts +2 -1
  189. package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
  190. package/dist/phaser/geom/util/point.d.ts +19 -19
  191. package/dist/phaser/geom/util/point.d.ts.map +1 -1
  192. package/dist/phaser/geom/util/polygon.d.ts +2 -1
  193. package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
  194. package/dist/phaser/geom/util/rectangle.d.ts +17 -15
  195. package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
  196. package/dist/phaser/geom/util/rounded_rectangle.d.ts +2 -1
  197. package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  198. package/dist/phaser/util/math.d.ts +51 -142
  199. package/dist/phaser/util/math.d.ts.map +1 -1
  200. package/package.json +13 -13
  201. package/src/index.ts +8 -0
  202. package/src/phaser/core/animation.ts +46 -61
  203. package/src/phaser/core/animation_manager.ts +27 -21
  204. package/src/phaser/core/animation_parser.ts +11 -3
  205. package/src/phaser/core/array_set.ts +8 -8
  206. package/src/phaser/core/cache.ts +75 -68
  207. package/src/phaser/core/device.ts +24 -25
  208. package/src/phaser/core/device_util.ts +10 -10
  209. package/src/phaser/core/dom.ts +5 -5
  210. package/src/phaser/core/event_manager.ts +52 -193
  211. package/src/phaser/core/factory.ts +25 -18
  212. package/src/phaser/core/frame.ts +37 -51
  213. package/src/phaser/core/frame_data.ts +29 -76
  214. package/src/phaser/core/frame_util.ts +3 -16
  215. package/src/phaser/core/game.ts +36 -63
  216. package/src/phaser/core/input.ts +72 -68
  217. package/src/phaser/core/input_handler.ts +93 -84
  218. package/src/phaser/core/input_mouse.ts +42 -36
  219. package/src/phaser/core/input_mspointer.ts +24 -25
  220. package/src/phaser/core/input_pointer.ts +55 -56
  221. package/src/phaser/core/input_touch.ts +26 -26
  222. package/src/phaser/core/loader.ts +108 -70
  223. package/src/phaser/core/loader_parser.ts +24 -7
  224. package/src/phaser/core/raf.ts +2 -2
  225. package/src/phaser/core/scale_manager.ts +85 -82
  226. package/src/phaser/core/scene.ts +3 -4
  227. package/src/phaser/core/scene_manager.ts +26 -26
  228. package/src/phaser/core/signal.ts +16 -10
  229. package/src/phaser/core/signal_binding.ts +9 -2
  230. package/src/phaser/core/sound.ts +71 -112
  231. package/src/phaser/core/sound_manager.ts +31 -30
  232. package/src/phaser/core/sound_sprite.ts +11 -12
  233. package/src/phaser/core/stage.ts +8 -8
  234. package/src/phaser/core/time.ts +34 -35
  235. package/src/phaser/core/timer.ts +40 -34
  236. package/src/phaser/core/timer_event.ts +23 -23
  237. package/src/phaser/core/tween.ts +62 -68
  238. package/src/phaser/core/tween_data.ts +31 -31
  239. package/src/phaser/core/tween_easing.ts +31 -31
  240. package/src/phaser/core/tween_manager.ts +11 -12
  241. package/src/phaser/core/world.ts +1 -2
  242. package/src/phaser/display/bitmap_text.ts +41 -31
  243. package/src/phaser/display/button.ts +34 -49
  244. package/src/phaser/display/canvas/buffer.ts +6 -7
  245. package/src/phaser/display/canvas/graphics.ts +3 -4
  246. package/src/phaser/display/canvas/masker.ts +2 -3
  247. package/src/phaser/display/canvas/pool.ts +3 -4
  248. package/src/phaser/display/canvas/renderer.ts +19 -20
  249. package/src/phaser/display/canvas/tinter.ts +4 -5
  250. package/src/phaser/display/canvas/util.ts +17 -9
  251. package/src/phaser/display/display_object.ts +49 -50
  252. package/src/phaser/display/graphics.ts +56 -43
  253. package/src/phaser/display/graphics_data.ts +19 -12
  254. package/src/phaser/display/graphics_data_util.ts +1 -2
  255. package/src/phaser/display/group.ts +32 -42
  256. package/src/phaser/display/image.ts +38 -52
  257. package/src/phaser/display/sprite_batch.ts +1 -2
  258. package/src/phaser/display/sprite_util.ts +17 -6
  259. package/src/phaser/display/text.ts +82 -56
  260. package/src/phaser/display/webgl/abstract_filter.ts +8 -8
  261. package/src/phaser/display/webgl/base_texture.ts +14 -15
  262. package/src/phaser/display/webgl/blend_manager.ts +5 -5
  263. package/src/phaser/display/webgl/earcut.ts +44 -27
  264. package/src/phaser/display/webgl/earcut_node.ts +1 -1
  265. package/src/phaser/display/webgl/fast_sprite_batch.ts +19 -19
  266. package/src/phaser/display/webgl/filter_manager.ts +5 -5
  267. package/src/phaser/display/webgl/filter_texture.ts +7 -7
  268. package/src/phaser/display/webgl/graphics.ts +17 -11
  269. package/src/phaser/display/webgl/graphics_data.ts +11 -11
  270. package/src/phaser/display/webgl/mask_manager.ts +2 -3
  271. package/src/phaser/display/webgl/render_texture.ts +18 -12
  272. package/src/phaser/display/webgl/renderer.ts +24 -24
  273. package/src/phaser/display/webgl/shader/complex.ts +7 -7
  274. package/src/phaser/display/webgl/shader/fast.ts +8 -8
  275. package/src/phaser/display/webgl/shader/normal.ts +12 -12
  276. package/src/phaser/display/webgl/shader/primitive.ts +7 -7
  277. package/src/phaser/display/webgl/shader/strip.ts +7 -7
  278. package/src/phaser/display/webgl/shader_manager.ts +13 -13
  279. package/src/phaser/display/webgl/sprite_batch.ts +20 -20
  280. package/src/phaser/display/webgl/stencil_manager.ts +20 -8
  281. package/src/phaser/display/webgl/texture.ts +40 -24
  282. package/src/phaser/display/webgl/texture_util.ts +2 -3
  283. package/src/phaser/display/webgl/util.ts +10 -6
  284. package/src/phaser/geom/circle.ts +10 -10
  285. package/src/phaser/geom/ellipse.ts +6 -6
  286. package/src/phaser/geom/line.ts +14 -14
  287. package/src/phaser/geom/matrix.ts +12 -12
  288. package/src/phaser/geom/point.ts +19 -19
  289. package/src/phaser/geom/polygon.ts +5 -5
  290. package/src/phaser/geom/rectangle.ts +21 -21
  291. package/src/phaser/geom/rounded_rectangle.ts +2 -2
  292. package/src/phaser/geom/util/circle.ts +7 -7
  293. package/src/phaser/geom/util/ellipse.ts +1 -1
  294. package/src/phaser/geom/util/line.ts +5 -5
  295. package/src/phaser/geom/util/matrix.ts +1 -1
  296. package/src/phaser/geom/util/point.ts +27 -20
  297. package/src/phaser/geom/util/polygon.ts +1 -1
  298. package/src/phaser/geom/util/rectangle.ts +22 -15
  299. package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
  300. package/src/phaser/util/math.ts +65 -151
@@ -5,7 +5,7 @@ import { Node } from './earcut_node.js';
5
5
  * @param {object} list - The list of points to process.
6
6
  * @returns {object} The processed earcut data structure.
7
7
  */
8
- export function sortLinked(list) {
8
+ export function sortLinked(list: any) {
9
9
  let i;
10
10
  let p;
11
11
  let q;
@@ -72,7 +72,7 @@ export function sortLinked(list) {
72
72
  * @param {object} b - The second point of the triangle.
73
73
  * @returns {number} The calculated area of the triangle.
74
74
  */
75
- export function compareX(a, b) {
75
+ export function compareX(a: any, b: any) {
76
76
  return a.x - b.x;
77
77
  }
78
78
 
@@ -85,7 +85,7 @@ export function compareX(a, b) {
85
85
  * @param {number} size - The size of the bounding box.
86
86
  * @returns {number} The calculated distance from the point to the triangle edge.
87
87
  */
88
- export function zOrder(x, y, minX, minY, size) {
88
+ export function zOrder(x: number, y: number, minX: number, minY: number, size: number) {
89
89
  // coords are transformed into non-negative 15-bit integer range
90
90
  x = (32767 * (x - minX)) / size;
91
91
  y = (32767 * (y - minY)) / size;
@@ -107,7 +107,7 @@ export function zOrder(x, y, minX, minY, size) {
107
107
  * @param {number} minY - The minimum y-coordinate of the bounding box.
108
108
  * @param {number} size - The size of the bounding box.
109
109
  */
110
- export function indexCurve(start, minX, minY, size) {
110
+ export function indexCurve(start: any, minX: number, minY: number, size: number) {
111
111
  let p = start;
112
112
  do {
113
113
  if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);
@@ -125,7 +125,7 @@ export function indexCurve(start, minX, minY, size) {
125
125
  * @param {object} start - TBD.
126
126
  * @returns {object} The calculated point that is the closest to the triangle edge.
127
127
  */
128
- export function getLeftmost(start) {
128
+ export function getLeftmost(start: any) {
129
129
  let p = start;
130
130
  let leftmost = start;
131
131
  do {
@@ -147,7 +147,16 @@ export function getLeftmost(start) {
147
147
  * @param {number} py - TBD.
148
148
  * @returns {object} TBD.
149
149
  */
150
- export function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
150
+ export function pointInTriangle(
151
+ ax: number,
152
+ ay: number,
153
+ bx: number,
154
+ by: number,
155
+ cx: number,
156
+ cy: number,
157
+ px: number,
158
+ py: number
159
+ ) {
151
160
  return (
152
161
  (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 &&
153
162
  (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 &&
@@ -162,7 +171,7 @@ export function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) {
162
171
  * @param {object} r - TBD.
163
172
  * @returns {number} TBD.
164
173
  */
165
- export function area(p, q, r) {
174
+ export function area(p: any, q: any, r: any) {
166
175
  return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y);
167
176
  }
168
177
 
@@ -172,7 +181,7 @@ export function area(p, q, r) {
172
181
  * @param {object} p2 - The second point of the triangle.
173
182
  * @returns {boolean} True if the point is inside the triangle, false otherwise.
174
183
  */
175
- export function equals(p1, p2) {
184
+ export function equals(p1: any, p2: any) {
176
185
  return p1.x === p2.x && p1.y === p2.y;
177
186
  }
178
187
 
@@ -184,7 +193,7 @@ export function equals(p1, p2) {
184
193
  * @param {object} q2 - The second point of the second line segment.
185
194
  * @returns {boolean} True if the line segments intersect, false otherwise.
186
195
  */
187
- export function intersects(p1, q1, p2, q2) {
196
+ export function intersects(p1: any, q1: any, p2: any, q2: any) {
188
197
  return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 && area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0;
189
198
  }
190
199
 
@@ -194,7 +203,7 @@ export function intersects(p1, q1, p2, q2) {
194
203
  * @param {object} b - The second point of the line segment.
195
204
  * @returns {boolean} True if the points are collinear, false otherwise.
196
205
  */
197
- export function intersectsPolygon(a, b) {
206
+ export function intersectsPolygon(a: any, b: any) {
198
207
  let p = a;
199
208
  do {
200
209
  if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true;
@@ -209,7 +218,7 @@ export function intersectsPolygon(a, b) {
209
218
  * @param {object} b - The second point of the cross product.
210
219
  * @returns {object} The calculated cross product result.
211
220
  */
212
- export function locallyInside(a, b) {
221
+ export function locallyInside(a: any, b: any) {
213
222
  return area(a.prev, a, a.next) < 0
214
223
  ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0
215
224
  : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0;
@@ -221,7 +230,7 @@ export function locallyInside(a, b) {
221
230
  * @param {object} b - The second point of the triangle.
222
231
  * @returns {boolean} True if the point is inside the triangle, false otherwise.
223
232
  */
224
- export function middleInside(a, b) {
233
+ export function middleInside(a: any, b: any) {
225
234
  let p = a;
226
235
  let inside = false;
227
236
  const px = (a.x + b.x) / 2;
@@ -241,7 +250,7 @@ export function middleInside(a, b) {
241
250
  * @param {object} b - The second point of the triangle.
242
251
  * @returns {boolean} True if the point is inside the triangle, false otherwise.
243
252
  */
244
- export function isValidDiagonal(a, b) {
253
+ export function isValidDiagonal(a: any, b: any) {
245
254
  return (
246
255
  equals(a, b) ||
247
256
  (a.next.i !== b.i &&
@@ -259,7 +268,7 @@ export function isValidDiagonal(a, b) {
259
268
  * @param {object} b - TBD.
260
269
  * @returns {object} TBD.
261
270
  */
262
- export function splitPolygon(a, b) {
271
+ export function splitPolygon(a: any, b: any) {
263
272
  const a2 = new Node(a.i, a.x, a.y);
264
273
  const b2 = new Node(b.i, b.x, b.y);
265
274
  const an = a.next;
@@ -283,7 +292,7 @@ export function splitPolygon(a, b) {
283
292
  * @param {object} last - TBD.
284
293
  * @returns {object} TBD.
285
294
  */
286
- export function insertNode(i, x, y, last) {
295
+ export function insertNode(i: number, x: number, y: number, last: any) {
287
296
  const p = new Node(i, x, y);
288
297
  if (!last) {
289
298
  p.prev = p;
@@ -301,7 +310,7 @@ export function insertNode(i, x, y, last) {
301
310
  * TBD.
302
311
  * @param {object} p - TBD.
303
312
  */
304
- export function removeNode(p) {
313
+ export function removeNode(p: any) {
305
314
  p.next.prev = p.prev;
306
315
  p.prev.next = p.next;
307
316
  if (p.prevZ) {
@@ -317,7 +326,7 @@ export function removeNode(p) {
317
326
  * @param {object} ear - TBD.
318
327
  * @returns {boolean} TBD.
319
328
  */
320
- export function isEar(ear) {
329
+ export function isEar(ear: any) {
321
330
  const a = ear.prev;
322
331
  const b = ear;
323
332
  const c = ear.next;
@@ -339,7 +348,7 @@ export function isEar(ear) {
339
348
  * @param {number} size - TBD.
340
349
  * @returns {boolean} TBD.
341
350
  */
342
- export function isEarHashed(ear, minX, minY, size) {
351
+ export function isEarHashed(ear: any, minX: number, minY: number, size: number) {
343
352
  const a = ear.prev;
344
353
  const b = ear;
345
354
  const c = ear.next;
@@ -390,7 +399,7 @@ export function isEarHashed(ear, minX, minY, size) {
390
399
  * @param {boolean} clockwise - Whether the triangles should be clockwise or counterclockwise.
391
400
  * @returns {object} The processed earcut data structure with triangulation information.
392
401
  */
393
- export function linkedList(data, start, end, dim, clockwise) {
402
+ export function linkedList(data: any, start: number, end: number, dim: number, clockwise: boolean) {
394
403
  let sum = 0;
395
404
  let i;
396
405
  let j;
@@ -415,7 +424,7 @@ export function linkedList(data, start, end, dim, clockwise) {
415
424
  * @param {object} end - The ending point in the data structure.
416
425
  * @returns {object} The calculated bounding box with min and max coordinates.
417
426
  */
418
- export function filterPoints(start, end?) {
427
+ export function filterPoints(start: any, end?: any) {
419
428
  if (!start) return start;
420
429
  if (!end) end = start;
421
430
  let p = start;
@@ -441,7 +450,7 @@ export function filterPoints(start, end?) {
441
450
  * @param {object} outerNode - The outer node that contains the hole.
442
451
  * @returns {object} The processed hole data structure.
443
452
  */
444
- export function findHoleBridge(hole, outerNode) {
453
+ export function findHoleBridge(hole: any, outerNode: any) {
445
454
  let p = outerNode;
446
455
  const hx = hole.x;
447
456
  const hy = hole.y;
@@ -490,7 +499,7 @@ export function findHoleBridge(hole, outerNode) {
490
499
  * @param {object} hole - The hole to process.
491
500
  * @param {object} outerNode - The outer node that contains the hole.
492
501
  */
493
- export function eliminateHole(hole, outerNode) {
502
+ export function eliminateHole(hole: any, outerNode: any) {
494
503
  outerNode = findHoleBridge(hole, outerNode);
495
504
  if (outerNode) {
496
505
  const b = splitPolygon(outerNode, hole);
@@ -506,7 +515,7 @@ export function eliminateHole(hole, outerNode) {
506
515
  * @param {object} dim - The dimension of the data (2 or 3).
507
516
  * @returns {object} The processed earcut data structure with holes included.
508
517
  */
509
- export function eliminateHoles(data, holeIndices, outerNode, dim) {
518
+ export function eliminateHoles(data: any, holeIndices: any, outerNode: any, dim: any) {
510
519
  const queue = [];
511
520
  let i;
512
521
  let len;
@@ -536,7 +545,7 @@ export function eliminateHoles(data, holeIndices, outerNode, dim) {
536
545
  * @param {number} dim - The dimension of the data (2 or 3).
537
546
  * @returns {object} The processed triangulation data structure.
538
547
  */
539
- export function cureLocalIntersections(start, triangles, dim) {
548
+ export function cureLocalIntersections(start: any, triangles: any, dim: number) {
540
549
  let p = start;
541
550
  do {
542
551
  const a = p.prev;
@@ -566,7 +575,7 @@ export function cureLocalIntersections(start, triangles, dim) {
566
575
  * @param {number} minY - The minimum y-coordinate of the bounding box.
567
576
  * @param {number} size - The size of the bounding box.
568
577
  */
569
- export function splitEarcut(start, triangles, dim, minX, minY, size) {
578
+ export function splitEarcut(start: any, triangles: any, dim: number, minX: number, minY: number, size: number) {
570
579
  // look for a valid diagonal that divides the polygon into two
571
580
  let a = start;
572
581
  do {
@@ -599,7 +608,15 @@ export function splitEarcut(start, triangles, dim, minX, minY, size) {
599
608
  * @param {number} size - The size of the bounding box.
600
609
  * @param {object} pass - The pass information for triangulation.
601
610
  */
602
- export function earcutLinked(ear, triangles, dim, minX?, minY?, size?, pass?) {
611
+ export function earcutLinked(
612
+ ear: any,
613
+ triangles: any,
614
+ dim: number,
615
+ minX?: number,
616
+ minY?: number,
617
+ size?: number,
618
+ pass?: any
619
+ ) {
603
620
  if (!ear) return;
604
621
  // interlink polygon nodes in z-order
605
622
  if (!pass && size) indexCurve(ear, minX, minY, size);
@@ -647,7 +664,7 @@ export function earcutLinked(ear, triangles, dim, minX?, minY?, size?, pass?) {
647
664
  * @param {number} dim - The dimension of the data (2 or 3).
648
665
  * @returns {object} The processed earcut data structure with triangulation information.
649
666
  */
650
- export function triangulate(data, holeIndices, dim) {
667
+ export function triangulate(data: any, holeIndices: any, dim: number) {
651
668
  dim = dim || 2;
652
669
  const hasHoles = holeIndices && holeIndices.length;
653
670
  const outerLen = hasHoles ? holeIndices[0] * dim : data.length;
@@ -15,7 +15,7 @@ export class Node {
15
15
  * @param {number} x - The x coordinate of the vertex.
16
16
  * @param {number} y - The y coordinate of the vertex.
17
17
  */
18
- constructor(i, x, y) {
18
+ constructor(i: number, x: number, y: number) {
19
19
  // vertice index in coordinates array
20
20
  this.i = i;
21
21
  // vertex coordinates
@@ -1,20 +1,20 @@
1
- // @ts-nocheck
2
1
  export class FastSpriteBatch {
3
- vertSize;
4
- maxSize;
5
- size;
6
- vertices;
7
- indices;
8
- vertexBuffer;
9
- indexBuffer;
10
- lastIndexCount;
11
- drawing;
12
- currentBatchSize;
13
- currentBaseTexture;
14
- currentBlendMode;
15
- renderSession;
16
- shader;
17
- matrix;
2
+ [key: string]: any;
3
+ vertSize!: any;
4
+ maxSize!: any;
5
+ size!: any;
6
+ vertices!: any;
7
+ indices!: any;
8
+ vertexBuffer!: any;
9
+ indexBuffer!: any;
10
+ lastIndexCount!: any;
11
+ drawing!: any;
12
+ currentBatchSize!: any;
13
+ currentBaseTexture!: any;
14
+ currentBlendMode!: any;
15
+ renderSession!: any;
16
+ shader!: any;
17
+ matrix!: any;
18
18
  /**
19
19
  * Creates a new FastSpriteBatch instance.
20
20
  * @param {WebGLRenderingContext & { id: number }} gl - The WebGL rendering context.
@@ -72,7 +72,7 @@ matrix;
72
72
  * @param {object} spriteBatch - The sprite batch to render.
73
73
  * @param {object} renderSession - The render session to use.
74
74
  */
75
- begin(spriteBatch, renderSession) {
75
+ begin(spriteBatch: any, renderSession: any) {
76
76
  this.renderSession = renderSession;
77
77
  this.shader = this.renderSession.shaderManager.fastShader;
78
78
  this.matrix = spriteBatch.worldTransform.toArray(true);
@@ -90,7 +90,7 @@ matrix;
90
90
  * Flushes the sprite batch to WebGL.
91
91
  * @param {object} spriteBatch - The sprite batch to flush.
92
92
  */
93
- render(spriteBatch) {
93
+ render(spriteBatch: any) {
94
94
  const children = spriteBatch.children;
95
95
  const sprite = children[0];
96
96
  // if the uvs have not updated then no point rendering just yet!
@@ -114,7 +114,7 @@ matrix;
114
114
  * Renders a sprite using WebGL.
115
115
  * @param {import('../../display/image.js').Image} sprite - The sprite to render.
116
116
  */
117
- renderSprite(sprite) {
117
+ renderSprite(sprite: import('../../display/image.js').Image) {
118
118
  if (!sprite.visible) {
119
119
  return;
120
120
  }
@@ -1,8 +1,8 @@
1
- // @ts-nocheck
2
1
  export class WebGLFilterManager {
3
- filterStack;
4
- offsetX;
5
- offsetY;
2
+ [key: string]: any;
3
+ filterStack!: any;
4
+ offsetX!: any;
5
+ offsetY!: any;
6
6
  /**
7
7
  * Creates a new FilterManager instance.
8
8
  */
@@ -16,7 +16,7 @@ offsetY;
16
16
  * Initializes the filter manager with a WebGL context.
17
17
  * @param {WebGLRenderingContext} gl - The WebGL rendering context.
18
18
  */
19
- setContext(gl) {
19
+ setContext(gl: WebGLRenderingContext) {
20
20
  this.gl = gl;
21
21
  this.texturePool = [];
22
22
  this.initShaderBuffers();
@@ -1,11 +1,11 @@
1
- // @ts-nocheck
2
1
  import { SCALE_LINEAR } from '../../core/const.js';
3
2
 
4
3
  export class FilterTexture {
5
- gl;
6
- frameBuffer;
7
- texture;
8
- renderBuffer;
4
+ [key: string]: any;
5
+ gl!: any;
6
+ frameBuffer!: any;
7
+ texture!: any;
8
+ renderBuffer!: any;
9
9
  /**
10
10
  * Creates a new FilterTexture instance.
11
11
  * @param {WebGLRenderingContext} gl - The WebGL rendering context.
@@ -13,7 +13,7 @@ renderBuffer;
13
13
  * @param {number} height - The height of the filter texture.
14
14
  * @param {number} scaleMode - The scale mode to use.
15
15
  */
16
- constructor(gl, width, height, scaleMode) {
16
+ constructor(gl: WebGLRenderingContext, width: number, height: number, scaleMode: number) {
17
17
  this.gl = gl;
18
18
  this.frameBuffer = gl.createFramebuffer();
19
19
  this.texture = gl.createTexture();
@@ -47,7 +47,7 @@ renderBuffer;
47
47
  * @param {number} width - The new width of the filter texture.
48
48
  * @param {number} height - The new height of the filter texture.
49
49
  */
50
- resize(width, height) {
50
+ resize(width: number, height: number) {
51
51
  if (this.width === width && this.height === height) {
52
52
  return;
53
53
  }
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import { GEOM_CIRCLE, GEOM_ELLIPSE, GEOM_POLYGON, GEOM_RECTANGLE, GEOM_ROUNDED_RECTANGLE } from '../../core/const.js';
3
2
  import { Point } from '../../geom/point.js';
4
3
  import { hex2rgb } from '../../util/math.js';
@@ -33,7 +32,7 @@ export const getGraphicsDataPool = () => {
33
32
  * @param {number} type - The type of graphics data to create.
34
33
  * @returns {object} The newly created graphics data object.
35
34
  */
36
- export const switchMode = (webGL, type) => {
35
+ export const switchMode = (webGL: any, type: number) => {
37
36
  let webGLData;
38
37
  if (!webGL.data.length) {
39
38
  webGLData = getGraphicsDataPool().pop() || new GraphicsData(webGL.gl);
@@ -56,7 +55,7 @@ export const switchMode = (webGL, type) => {
56
55
  * @param {object} graphicsData - The graphics data to update.
57
56
  * @param {GraphicsData} webGLData - The WebGL graphics data object.
58
57
  */
59
- export const buildLine = (graphicsData, webGLData) => {
58
+ export const buildLine = (graphicsData: any, webGLData: GraphicsData) => {
60
59
  // TODO OPTIMISE!
61
60
  let i = 0;
62
61
  let points = graphicsData.points;
@@ -221,7 +220,7 @@ export const buildLine = (graphicsData, webGLData) => {
221
220
  * @param {object} graphicsData - The graphics data to update.
222
221
  * @param {GraphicsData} webGLData - The WebGL graphics data object.
223
222
  */
224
- export const buildRectangle = (graphicsData, webGLData) => {
223
+ export const buildRectangle = (graphicsData: any, webGLData: GraphicsData) => {
225
224
  //
226
225
  // need to convert points to a nice regular data
227
226
  //
@@ -270,7 +269,14 @@ export const buildRectangle = (graphicsData, webGLData) => {
270
269
  * @param {number} toY - The ending y-coordinate.
271
270
  * @returns {number[]} The calculated points for the quadratic bezier curve.
272
271
  */
273
- export const quadraticBezierCurve = (fromX, fromY, cpX, cpY, toX, toY) => {
272
+ export const quadraticBezierCurve = (
273
+ fromX: number,
274
+ fromY: number,
275
+ cpX: number,
276
+ cpY: number,
277
+ toX: number,
278
+ toY: number
279
+ ) => {
274
280
  let xa;
275
281
  let ya;
276
282
  let xb;
@@ -304,7 +310,7 @@ export const quadraticBezierCurve = (fromX, fromY, cpX, cpY, toX, toY) => {
304
310
  * @param {object} graphicsData - The graphics data to update.
305
311
  * @param {GraphicsData} webGLData - The WebGL graphics data object.
306
312
  */
307
- export const buildRoundedRectangle = (graphicsData, webGLData) => {
313
+ export const buildRoundedRectangle = (graphicsData: any, webGLData: GraphicsData) => {
308
314
  const rrectData = graphicsData.shape;
309
315
  const x = rrectData.x;
310
316
  const y = rrectData.y;
@@ -354,7 +360,7 @@ export const buildRoundedRectangle = (graphicsData, webGLData) => {
354
360
  * @param {object} graphicsData - The graphics data to update.
355
361
  * @param {GraphicsData} webGLData - The WebGL graphics data object.
356
362
  */
357
- export const buildCircle = (graphicsData, webGLData) => {
363
+ export const buildCircle = (graphicsData: any, webGLData: GraphicsData) => {
358
364
  // need to convert points to a nice regular data
359
365
  const circleData = graphicsData.shape;
360
366
  const x = circleData.x;
@@ -405,7 +411,7 @@ export const buildCircle = (graphicsData, webGLData) => {
405
411
  * @param {object} graphicsData - The graphics data to update.
406
412
  * @param {GraphicsData} webGLData - The WebGL graphics data object.
407
413
  */
408
- export const buildComplexPoly = (graphicsData, webGLData) => {
414
+ export const buildComplexPoly = (graphicsData: any, webGLData: GraphicsData) => {
409
415
  // TODO - no need to copy this as it gets turned into a Float32Array anyways..
410
416
  const points = graphicsData.points.slice();
411
417
  if (points.length < 6) {
@@ -450,7 +456,7 @@ export const buildComplexPoly = (graphicsData, webGLData) => {
450
456
  * @param {GraphicsData} webGLData - TBD.
451
457
  * @returns {boolean} TBD.
452
458
  */
453
- export const buildPoly = (graphicsData, webGLData) => {
459
+ export const buildPoly = (graphicsData: any, webGLData: GraphicsData) => {
454
460
  const points = graphicsData.points;
455
461
  if (points.length < 6) {
456
462
  return false;
@@ -488,7 +494,7 @@ export const buildPoly = (graphicsData, webGLData) => {
488
494
  * @param {import('../graphics.js').Graphics} graphics - The graphics object to update.
489
495
  * @param {WebGLRenderingContext & { id: number }} gl - The WebGL rendering context.
490
496
  */
491
- export const updateGraphics = (graphics, gl) => {
497
+ export const updateGraphics = (graphics: import('../graphics.js').Graphics, gl) => {
492
498
  const stencilBufferLimit = getStencilBufferLimit();
493
499
  // get the contexts graphics object
494
500
  let webGL = graphics._webGL[gl.id];
@@ -577,7 +583,7 @@ export const updateGraphics = (graphics, gl) => {
577
583
  * @param {import('../graphics.js').Graphics} graphics - The graphics object to update.
578
584
  * @param {object} renderSession - The rendering session.
579
585
  */
580
- export const renderGraphics = (graphics, renderSession) => {
586
+ export const renderGraphics = (graphics: import('../graphics.js').Graphics, renderSession: any) => {
581
587
  const gl = renderSession.gl;
582
588
  const projection = renderSession.projection;
583
589
  const offset = renderSession.offset;
@@ -1,19 +1,19 @@
1
- // @ts-nocheck
2
1
  export class GraphicsData {
3
- gl;
4
- color;
5
- points;
6
- indices;
7
- buffer;
8
- indexBuffer;
9
- mode;
10
- alpha;
11
- dirty;
2
+ [key: string]: any;
3
+ gl!: any;
4
+ color!: any;
5
+ points!: any;
6
+ indices!: any;
7
+ buffer!: any;
8
+ indexBuffer!: any;
9
+ mode!: any;
10
+ alpha!: any;
11
+ dirty!: any;
12
12
  /**
13
13
  * Creates a new GraphicsData instance.
14
14
  * @param {WebGLRenderingContext} gl - The WebGL rendering context.
15
15
  */
16
- constructor(gl) {
16
+ constructor(gl: WebGLRenderingContext) {
17
17
  this.gl = gl;
18
18
  // TODO does this need to be split before uploading??
19
19
  this.color = [0, 0, 0]; // color split!
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import { updateGraphics } from './graphics.js';
3
2
 
4
3
  /**
@@ -6,7 +5,7 @@ import { updateGraphics } from './graphics.js';
6
5
  * @param {object} maskData - The mask data to apply.
7
6
  * @param {object} renderSession - The rendering session.
8
7
  */
9
- export const pushMask = (maskData, renderSession) => {
8
+ export const pushMask = (maskData: any, renderSession: any) => {
10
9
  const gl = renderSession.gl;
11
10
  if (maskData.dirty) {
12
11
  updateGraphics(maskData, gl);
@@ -26,7 +25,7 @@ export const pushMask = (maskData, renderSession) => {
26
25
  * @param {object} maskData - The mask data to apply.
27
26
  * @param {object} renderSession - The rendering session.
28
27
  */
29
- export const popMask = (maskData, renderSession) => {
28
+ export const popMask = (maskData: any, renderSession: any) => {
30
29
  const gl = renderSession.gl;
31
30
  if (
32
31
  maskData._webGL[gl.id] === undefined ||
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import { RENDER_WEBGL } from '../../core/const.js';
3
2
  import { Point } from '../../geom/point.js';
4
3
  import { Rectangle } from '../../geom/rectangle.js';
@@ -8,16 +7,17 @@ import { FilterTexture } from './filter_texture.js';
8
7
  import { Texture } from './texture.js';
9
8
 
10
9
  export class RenderTexture extends Texture {
11
- width;
12
- height;
13
- resolution;
14
- frame;
15
- crop;
16
- renderer;
17
- textureBuffer;
18
- render;
19
- projection;
20
- valid;
10
+ [key: string]: any;
11
+ declare width: any;
12
+ declare height: any;
13
+ resolution!: any;
14
+ declare frame: any;
15
+ declare crop: any;
16
+ renderer!: any;
17
+ textureBuffer!: any;
18
+ render!: any;
19
+ projection!: any;
20
+ declare valid: any;
21
21
  /**
22
22
  * Creates a new RenderTexture instance.
23
23
  * @param {number} width - The width of the render texture.
@@ -26,7 +26,13 @@ valid;
26
26
  * @param {number} scaleMode - The scale mode to use.
27
27
  * @param {number} resolution - The resolution to use.
28
28
  */
29
- constructor(width, height, renderer, scaleMode, resolution = 1) {
29
+ constructor(
30
+ width: number,
31
+ height: number,
32
+ renderer: import('./renderer.js').WebGLRenderer | import('../canvas/renderer.js').CanvasRenderer,
33
+ scaleMode: number,
34
+ resolution: number = 1
35
+ ) {
30
36
  const w = width || 100;
31
37
  const h = height || 100;
32
38
  const res = resolution || 1;
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  import {
3
2
  BLEND_ADD,
4
3
  BLEND_COLOR,
@@ -33,28 +32,29 @@ import { WebGLStencilManager } from './stencil_manager.js';
33
32
  import { getWebGLContextErrorCode, getWebGLContextErrorName } from './util.js';
34
33
 
35
34
  export class WebGLRenderer {
36
- type;
37
- resolution;
38
- autoResize;
39
- contextLost;
40
- clearBeforeRender;
41
- width;
42
- height;
43
- view;
44
- _contextOptions;
45
- projection;
46
- offset;
47
- shaderManager;
48
- spriteBatch;
49
- filterManager;
50
- stencilManager;
51
- blendModeManager;
52
- renderSession;
35
+ [key: string]: any;
36
+ type!: any;
37
+ resolution!: any;
38
+ autoResize!: any;
39
+ contextLost!: any;
40
+ clearBeforeRender!: any;
41
+ width!: any;
42
+ height!: any;
43
+ view!: any;
44
+ _contextOptions!: any;
45
+ projection!: any;
46
+ offset!: any;
47
+ shaderManager!: any;
48
+ spriteBatch!: any;
49
+ filterManager!: any;
50
+ stencilManager!: any;
51
+ blendModeManager!: any;
52
+ renderSession!: any;
53
53
  /**
54
54
  * Creates a new WebGLRenderer instance.
55
55
  * @param {import('../../core/game.js').Game} game - The game instance.
56
56
  */
57
- constructor(game) {
57
+ constructor(game: import('../../core/game.js').Game) {
58
58
  /** @type {number} */
59
59
  this.type = RENDER_WEBGL;
60
60
  this.resolution = game.config.resolution;
@@ -143,7 +143,7 @@ renderSession;
143
143
  * @param {import('../../core/game.js').Game} game - The game instance.
144
144
  * @throws {Error}
145
145
  */
146
- initContext(game) {
146
+ initContext(game: import('../../core/game.js').Game) {
147
147
  game.logger.info('initContext');
148
148
  // TODO: view.addEventListener('webglcontextcreationerror', this.onWebGLContextCreationError, false);
149
149
  /** @type {WebGLRenderingContext & { id: number }} */
@@ -187,7 +187,7 @@ renderSession;
187
187
  * Renders the stage to WebGL.
188
188
  * @param {import('../../core/stage.js').Stage} stage - The root stage to render.
189
189
  */
190
- render(stage) {
190
+ render(stage: import('../../core/stage.js').Stage) {
191
191
  if (this.contextLost) {
192
192
  return;
193
193
  }
@@ -212,7 +212,7 @@ renderSession;
212
212
  * @param {object} buffer - The render buffer.
213
213
  * @param {import('../../geom/matrix.js').Matrix} matrix - The transformation matrix.
214
214
  */
215
- renderDisplayObject(displayObject, projection, buffer, matrix) {
215
+ renderDisplayObject(displayObject: any, projection: Point, buffer?: any, matrix?: any) {
216
216
  this.renderSession.blendModeManager.setBlendMode(BLEND_NORMAL);
217
217
  // reset the render session data..
218
218
  this.renderSession.drawCount = 0;
@@ -237,7 +237,7 @@ renderSession;
237
237
  * @param {number} width - The new width of the canvas.
238
238
  * @param {number} height - The new height of the canvas.
239
239
  */
240
- resize(width, height) {
240
+ resize(width: number, height: number) {
241
241
  this.width = width * this.resolution;
242
242
  this.height = height * this.resolution;
243
243
  this.view.width = this.width;
@@ -256,7 +256,7 @@ renderSession;
256
256
  * @param {import('./base_texture.js').BaseTexture} texture - The base texture to update.
257
257
  * @returns {boolean} Whether the update was successful.
258
258
  */
259
- updateTexture(texture) {
259
+ updateTexture(texture: import('./base_texture.js').BaseTexture) {
260
260
  if (!texture.hasLoaded) {
261
261
  return false;
262
262
  }