@vpmedia/phaser 1.14.0 → 1.16.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 (306) hide show
  1. package/README.md +3 -3
  2. package/package.json +6 -5
  3. package/src/index.js +15 -18
  4. package/src/phaser/core/animation.js +102 -6
  5. package/src/phaser/core/animation_manager.js +88 -10
  6. package/src/phaser/core/animation_parser.js +5 -20
  7. package/src/phaser/core/array_set.js +51 -5
  8. package/src/phaser/core/cache.js +291 -6
  9. package/src/phaser/core/const.js +107 -4
  10. package/src/phaser/core/device.js +5 -6
  11. package/src/phaser/core/device_util.js +3 -25
  12. package/src/phaser/core/dom.js +127 -29
  13. package/src/phaser/core/event_manager.js +128 -6
  14. package/src/phaser/core/factory.js +69 -34
  15. package/src/phaser/core/frame.js +43 -6
  16. package/src/phaser/core/frame_data.js +55 -5
  17. package/src/phaser/core/frame_util.js +7 -14
  18. package/src/phaser/core/game.js +35 -7
  19. package/src/phaser/core/input.js +116 -17
  20. package/src/phaser/core/input_handler.js +242 -42
  21. package/src/phaser/core/input_mouse.js +68 -7
  22. package/src/phaser/core/input_mspointer.js +40 -9
  23. package/src/phaser/core/input_pointer.js +79 -17
  24. package/src/phaser/core/input_touch.js +42 -5
  25. package/src/phaser/core/loader.js +274 -101
  26. package/src/phaser/core/loader_parser.js +2 -14
  27. package/src/phaser/core/raf.js +16 -5
  28. package/src/phaser/core/scale_manager.js +204 -39
  29. package/src/phaser/core/scene.js +24 -5
  30. package/src/phaser/core/scene_manager.js +81 -11
  31. package/src/phaser/core/signal.js +88 -11
  32. package/src/phaser/core/signal_binding.js +35 -15
  33. package/src/phaser/core/sound.js +99 -10
  34. package/src/phaser/core/sound_manager.js +89 -13
  35. package/src/phaser/core/sound_sprite.js +20 -5
  36. package/src/phaser/core/stage.js +43 -7
  37. package/src/phaser/core/time.js +67 -5
  38. package/src/phaser/core/timer.js +107 -30
  39. package/src/phaser/core/timer_event.js +11 -6
  40. package/src/phaser/core/tween.js +124 -30
  41. package/src/phaser/core/tween_data.js +42 -18
  42. package/src/phaser/core/tween_easing.js +1 -39
  43. package/src/phaser/core/tween_manager.js +47 -5
  44. package/src/phaser/core/world.js +9 -6
  45. package/src/phaser/display/bitmap_text.js +92 -11
  46. package/src/phaser/display/button.js +64 -13
  47. package/src/phaser/display/canvas/buffer.js +16 -6
  48. package/src/phaser/display/canvas/graphics.js +1 -16
  49. package/src/phaser/display/canvas/masker.js +0 -8
  50. package/src/phaser/display/canvas/pool.js +0 -14
  51. package/src/phaser/display/canvas/renderer.js +28 -8
  52. package/src/phaser/display/canvas/tinter.js +4 -48
  53. package/src/phaser/display/canvas/util.js +0 -15
  54. package/src/phaser/display/display_object.js +192 -20
  55. package/src/phaser/display/graphics.js +162 -27
  56. package/src/phaser/display/graphics_data.js +14 -6
  57. package/src/phaser/display/graphics_data_util.js +2 -9
  58. package/src/phaser/display/group.js +75 -10
  59. package/src/phaser/display/image.js +86 -10
  60. package/src/phaser/display/sprite_batch.js +3 -9
  61. package/src/phaser/display/sprite_util.js +3 -28
  62. package/src/phaser/display/text.js +332 -32
  63. package/src/phaser/display/webgl/abstract_filter.js +8 -7
  64. package/src/phaser/display/webgl/base_texture.js +20 -12
  65. package/src/phaser/display/webgl/blend_manager.js +14 -7
  66. package/src/phaser/display/webgl/earcut.js +4 -50
  67. package/src/phaser/display/webgl/earcut_node.js +6 -7
  68. package/src/phaser/display/webgl/fast_sprite_batch.js +34 -11
  69. package/src/phaser/display/webgl/filter_manager.js +25 -7
  70. package/src/phaser/display/webgl/filter_texture.js +21 -22
  71. package/src/phaser/display/webgl/graphics.js +5 -40
  72. package/src/phaser/display/webgl/graphics_data.js +10 -7
  73. package/src/phaser/display/webgl/mask_manager.js +0 -8
  74. package/src/phaser/display/webgl/render_texture.js +33 -21
  75. package/src/phaser/display/webgl/renderer.js +38 -11
  76. package/src/phaser/display/webgl/shader/complex.js +10 -6
  77. package/src/phaser/display/webgl/shader/fast.js +10 -6
  78. package/src/phaser/display/webgl/shader/normal.js +23 -32
  79. package/src/phaser/display/webgl/shader/primitive.js +10 -6
  80. package/src/phaser/display/webgl/shader/strip.js +10 -6
  81. package/src/phaser/display/webgl/shader_manager.js +18 -6
  82. package/src/phaser/display/webgl/sprite_batch.js +41 -8
  83. package/src/phaser/display/webgl/stencil_manager.js +28 -6
  84. package/src/phaser/display/webgl/texture.js +28 -15
  85. package/src/phaser/display/webgl/texture_util.js +0 -8
  86. package/src/phaser/display/webgl/util.js +0 -11
  87. package/src/phaser/geom/circle.js +123 -19
  88. package/src/phaser/geom/ellipse.js +39 -19
  89. package/src/phaser/geom/line.js +148 -17
  90. package/src/phaser/geom/matrix.js +73 -7
  91. package/src/phaser/geom/point.js +152 -7
  92. package/src/phaser/geom/polygon.js +42 -14
  93. package/src/phaser/geom/rectangle.js +233 -7
  94. package/src/phaser/geom/rounded_rectangle.js +10 -7
  95. package/src/phaser/geom/util/circle.js +3 -16
  96. package/src/phaser/geom/util/ellipse.js +0 -8
  97. package/src/phaser/geom/util/line.js +5 -19
  98. package/src/phaser/geom/util/matrix.js +1 -10
  99. package/src/phaser/geom/util/point.js +0 -26
  100. package/src/phaser/geom/util/polygon.js +1 -8
  101. package/src/phaser/geom/util/rectangle.js +1 -23
  102. package/src/phaser/geom/util/rounded_rectangle.js +1 -8
  103. package/src/phaser/util/math.js +3 -43
  104. package/{types → typedefs}/global.d.ts +1 -1
  105. package/types/index.d.ts +2 -1
  106. package/types/index.d.ts.map +1 -1
  107. package/types/phaser/core/animation.d.ts +106 -5
  108. package/types/phaser/core/animation.d.ts.map +1 -1
  109. package/types/phaser/core/animation_manager.d.ts +88 -1
  110. package/types/phaser/core/animation_manager.d.ts.map +1 -1
  111. package/types/phaser/core/animation_parser.d.ts +5 -6
  112. package/types/phaser/core/animation_parser.d.ts.map +1 -1
  113. package/types/phaser/core/array_set.d.ts +53 -7
  114. package/types/phaser/core/array_set.d.ts.map +1 -1
  115. package/types/phaser/core/cache.d.ts +348 -58
  116. package/types/phaser/core/cache.d.ts.map +1 -1
  117. package/types/phaser/core/const.d.ts +143 -40
  118. package/types/phaser/core/const.d.ts.map +1 -1
  119. package/types/phaser/core/device.d.ts +2 -5
  120. package/types/phaser/core/device.d.ts.map +1 -1
  121. package/types/phaser/core/device_util.d.ts +1 -10
  122. package/types/phaser/core/device_util.d.ts.map +1 -1
  123. package/types/phaser/core/dom.d.ts +122 -3
  124. package/types/phaser/core/dom.d.ts.map +1 -1
  125. package/types/phaser/core/event_manager.d.ts +142 -15
  126. package/types/phaser/core/event_manager.d.ts.map +1 -1
  127. package/types/phaser/core/factory.d.ts +74 -7
  128. package/types/phaser/core/factory.d.ts.map +1 -1
  129. package/types/phaser/core/frame.d.ts +68 -26
  130. package/types/phaser/core/frame.d.ts.map +1 -1
  131. package/types/phaser/core/frame_data.d.ts +61 -9
  132. package/types/phaser/core/frame_data.d.ts.map +1 -1
  133. package/types/phaser/core/frame_util.d.ts +10 -10
  134. package/types/phaser/core/frame_util.d.ts.map +1 -1
  135. package/types/phaser/core/game.d.ts +54 -20
  136. package/types/phaser/core/game.d.ts.map +1 -1
  137. package/types/phaser/core/input.d.ts +132 -21
  138. package/types/phaser/core/input.d.ts.map +1 -1
  139. package/types/phaser/core/input_handler.d.ts +258 -25
  140. package/types/phaser/core/input_handler.d.ts.map +1 -1
  141. package/types/phaser/core/input_mouse.d.ts +59 -12
  142. package/types/phaser/core/input_mouse.d.ts.map +1 -1
  143. package/types/phaser/core/input_mspointer.d.ts +49 -15
  144. package/types/phaser/core/input_mspointer.d.ts.map +1 -1
  145. package/types/phaser/core/input_pointer.d.ts +80 -4
  146. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  147. package/types/phaser/core/input_touch.d.ts +52 -15
  148. package/types/phaser/core/input_touch.d.ts.map +1 -1
  149. package/types/phaser/core/loader.d.ts +268 -23
  150. package/types/phaser/core/loader.d.ts.map +1 -1
  151. package/types/phaser/core/loader_parser.d.ts +0 -4
  152. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  153. package/types/phaser/core/raf.d.ts +17 -7
  154. package/types/phaser/core/raf.d.ts.map +1 -1
  155. package/types/phaser/core/scale_manager.d.ts +210 -15
  156. package/types/phaser/core/scale_manager.d.ts.map +1 -1
  157. package/types/phaser/core/scene.d.ts +21 -5
  158. package/types/phaser/core/scene.d.ts.map +1 -1
  159. package/types/phaser/core/scene_manager.d.ts +90 -10
  160. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  161. package/types/phaser/core/signal.d.ts +95 -11
  162. package/types/phaser/core/signal.d.ts.map +1 -1
  163. package/types/phaser/core/signal_binding.d.ts +35 -6
  164. package/types/phaser/core/signal_binding.d.ts.map +1 -1
  165. package/types/phaser/core/sound.d.ts +111 -14
  166. package/types/phaser/core/sound.d.ts.map +1 -1
  167. package/types/phaser/core/sound_manager.d.ts +94 -8
  168. package/types/phaser/core/sound_manager.d.ts.map +1 -1
  169. package/types/phaser/core/sound_sprite.d.ts +22 -8
  170. package/types/phaser/core/sound_sprite.d.ts.map +1 -1
  171. package/types/phaser/core/stage.d.ts +32 -3
  172. package/types/phaser/core/stage.d.ts.map +1 -1
  173. package/types/phaser/core/time.d.ts +73 -6
  174. package/types/phaser/core/time.d.ts.map +1 -1
  175. package/types/phaser/core/timer.d.ts +103 -2
  176. package/types/phaser/core/timer.d.ts.map +1 -1
  177. package/types/phaser/core/timer_event.d.ts +11 -5
  178. package/types/phaser/core/timer_event.d.ts.map +1 -1
  179. package/types/phaser/core/tween.d.ts +123 -3
  180. package/types/phaser/core/tween.d.ts.map +1 -1
  181. package/types/phaser/core/tween_data.d.ts +42 -3
  182. package/types/phaser/core/tween_data.d.ts.map +1 -1
  183. package/types/phaser/core/tween_easing.d.ts +0 -36
  184. package/types/phaser/core/tween_easing.d.ts.map +1 -1
  185. package/types/phaser/core/tween_manager.d.ts +49 -2
  186. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  187. package/types/phaser/core/world.d.ts +9 -1
  188. package/types/phaser/core/world.d.ts.map +1 -1
  189. package/types/phaser/display/bitmap_text.d.ts +89 -12
  190. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  191. package/types/phaser/display/button.d.ts +68 -11
  192. package/types/phaser/display/button.d.ts.map +1 -1
  193. package/types/phaser/display/canvas/buffer.d.ts +21 -5
  194. package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
  195. package/types/phaser/display/canvas/graphics.d.ts +0 -3
  196. package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
  197. package/types/phaser/display/canvas/masker.d.ts +0 -2
  198. package/types/phaser/display/canvas/masker.d.ts.map +1 -1
  199. package/types/phaser/display/canvas/pool.d.ts +0 -13
  200. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  201. package/types/phaser/display/canvas/renderer.d.ts +30 -3
  202. package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
  203. package/types/phaser/display/canvas/tinter.d.ts +0 -5
  204. package/types/phaser/display/canvas/tinter.d.ts.map +1 -1
  205. package/types/phaser/display/canvas/util.d.ts +0 -9
  206. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  207. package/types/phaser/display/display_object.d.ts +196 -9
  208. package/types/phaser/display/display_object.d.ts.map +1 -1
  209. package/types/phaser/display/graphics.d.ts +142 -16
  210. package/types/phaser/display/graphics.d.ts.map +1 -1
  211. package/types/phaser/display/graphics_data.d.ts +15 -1
  212. package/types/phaser/display/graphics_data.d.ts.map +1 -1
  213. package/types/phaser/display/graphics_data_util.d.ts +3 -3
  214. package/types/phaser/display/graphics_data_util.d.ts.map +1 -1
  215. package/types/phaser/display/group.d.ts +68 -6
  216. package/types/phaser/display/group.d.ts.map +1 -1
  217. package/types/phaser/display/image.d.ts +77 -15
  218. package/types/phaser/display/image.d.ts.map +1 -1
  219. package/types/phaser/display/sprite_batch.d.ts +4 -4
  220. package/types/phaser/display/sprite_batch.d.ts.map +1 -1
  221. package/types/phaser/display/sprite_util.d.ts +0 -5
  222. package/types/phaser/display/sprite_util.d.ts.map +1 -1
  223. package/types/phaser/display/text.d.ts +373 -53
  224. package/types/phaser/display/text.d.ts.map +1 -1
  225. package/types/phaser/display/webgl/abstract_filter.d.ts +8 -6
  226. package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  227. package/types/phaser/display/webgl/base_texture.d.ts +20 -1
  228. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
  229. package/types/phaser/display/webgl/blend_manager.d.ts +11 -6
  230. package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  231. package/types/phaser/display/webgl/earcut.d.ts +0 -27
  232. package/types/phaser/display/webgl/earcut.d.ts.map +1 -1
  233. package/types/phaser/display/webgl/earcut_node.d.ts +9 -9
  234. package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  235. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +33 -6
  236. package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  237. package/types/phaser/display/webgl/filter_manager.d.ts +23 -7
  238. package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  239. package/types/phaser/display/webgl/filter_texture.d.ts +21 -3
  240. package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  241. package/types/phaser/display/webgl/graphics.d.ts +0 -12
  242. package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
  243. package/types/phaser/display/webgl/graphics_data.d.ts +12 -8
  244. package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  245. package/types/phaser/display/webgl/mask_manager.d.ts +0 -2
  246. package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  247. package/types/phaser/display/webgl/render_texture.d.ts +31 -4
  248. package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
  249. package/types/phaser/display/webgl/renderer.d.ts +42 -5
  250. package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
  251. package/types/phaser/display/webgl/shader/complex.d.ts +12 -2
  252. package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  253. package/types/phaser/display/webgl/shader/fast.d.ts +12 -2
  254. package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  255. package/types/phaser/display/webgl/shader/normal.d.ts +21 -1
  256. package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  257. package/types/phaser/display/webgl/shader/primitive.d.ts +12 -2
  258. package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  259. package/types/phaser/display/webgl/shader/strip.d.ts +12 -2
  260. package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  261. package/types/phaser/display/webgl/shader_manager.d.ts +20 -5
  262. package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  263. package/types/phaser/display/webgl/sprite_batch.d.ts +38 -1
  264. package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  265. package/types/phaser/display/webgl/stencil_manager.d.ts +25 -0
  266. package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  267. package/types/phaser/display/webgl/texture.d.ts +22 -1
  268. package/types/phaser/display/webgl/texture.d.ts.map +1 -1
  269. package/types/phaser/display/webgl/texture_util.d.ts +0 -2
  270. package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
  271. package/types/phaser/display/webgl/util.d.ts +0 -10
  272. package/types/phaser/display/webgl/util.d.ts.map +1 -1
  273. package/types/phaser/geom/circle.d.ts +130 -10
  274. package/types/phaser/geom/circle.d.ts.map +1 -1
  275. package/types/phaser/geom/ellipse.d.ts +42 -6
  276. package/types/phaser/geom/ellipse.d.ts.map +1 -1
  277. package/types/phaser/geom/line.d.ts +159 -14
  278. package/types/phaser/geom/line.d.ts.map +1 -1
  279. package/types/phaser/geom/matrix.d.ts +84 -12
  280. package/types/phaser/geom/matrix.d.ts.map +1 -1
  281. package/types/phaser/geom/point.d.ts +170 -19
  282. package/types/phaser/geom/point.d.ts.map +1 -1
  283. package/types/phaser/geom/polygon.d.ts +45 -5
  284. package/types/phaser/geom/polygon.d.ts.map +1 -1
  285. package/types/phaser/geom/rectangle.d.ts +253 -21
  286. package/types/phaser/geom/rectangle.d.ts.map +1 -1
  287. package/types/phaser/geom/rounded_rectangle.d.ts +11 -2
  288. package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  289. package/types/phaser/geom/util/circle.d.ts +3 -10
  290. package/types/phaser/geom/util/circle.d.ts.map +1 -1
  291. package/types/phaser/geom/util/ellipse.d.ts +0 -7
  292. package/types/phaser/geom/util/ellipse.d.ts.map +1 -1
  293. package/types/phaser/geom/util/line.d.ts +5 -10
  294. package/types/phaser/geom/util/line.d.ts.map +1 -1
  295. package/types/phaser/geom/util/matrix.d.ts +0 -3
  296. package/types/phaser/geom/util/matrix.d.ts.map +1 -1
  297. package/types/phaser/geom/util/point.d.ts +0 -20
  298. package/types/phaser/geom/util/point.d.ts.map +1 -1
  299. package/types/phaser/geom/util/polygon.d.ts +0 -1
  300. package/types/phaser/geom/util/polygon.d.ts.map +1 -1
  301. package/types/phaser/geom/util/rectangle.d.ts +0 -16
  302. package/types/phaser/geom/util/rectangle.d.ts.map +1 -1
  303. package/types/phaser/geom/util/rounded_rectangle.d.ts +0 -1
  304. package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  305. package/types/phaser/util/math.d.ts +0 -27
  306. package/types/phaser/util/math.d.ts.map +1 -1
package/README.md CHANGED
@@ -1,7 +1,6 @@
1
- @vpmedia/phaser
2
- ===============
1
+ # @vpmedia/phaser
3
2
 
4
- [![npm version](https://badge.fury.io/js/@vpmedia%2Fphaser.svg?v=1.14.0)](https://badge.fury.io/js/@vpmedia%2Fphaser)
3
+ [![npm version](https://badge.fury.io/js/@vpmedia%2Fphaser.svg?v=1.16.0)](https://badge.fury.io/js/@vpmedia%2Fphaser)
5
4
  [![Node.js CI](https://github.com/vpmedia/phaser/actions/workflows/node.js.yml/badge.svg)](https://github.com/vpmedia/phaser/actions/workflows/node.js.yml)
6
5
 
7
6
  @vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2.
@@ -17,6 +16,7 @@ https://github.com/vpmedia/phaser-example
17
16
  ### Comments
18
17
 
19
18
  Some features has not been ported compared to the original version:
19
+
20
20
  - Creature, RetroFont, Rope, SpriteBatch and Video display objects
21
21
  - Particle System
22
22
  - Physics System
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vpmedia/phaser",
3
- "version": "1.14.0",
3
+ "version": "1.16.0",
4
4
  "description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
5
5
  "author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
6
6
  "license": "MIT",
@@ -26,7 +26,7 @@
26
26
  "eslint-config-prettier": "^8.8.0",
27
27
  "eslint-plugin-import": "^2.27.5",
28
28
  "eslint-plugin-jest": "^27.2.1",
29
- "eslint-plugin-jsdoc": "^41.1.2",
29
+ "eslint-plugin-jsdoc": "^43.0.6",
30
30
  "eslint-plugin-prettier": "^4.2.1",
31
31
  "husky": "^8.0.3",
32
32
  "jest": "^29.5.0",
@@ -36,10 +36,11 @@
36
36
  },
37
37
  "scripts": {
38
38
  "test": "NODE_OPTIONS=--experimental-vm-modules jest --passWithNoTests",
39
- "lint": "eslint \"**/*.js\"",
40
- "lint-fix": "eslint \"**/*.js\" --fix",
39
+ "lint": "eslint \"**/*.{js,jsx}\"",
40
+ "lint-fix": "eslint --fix \"**/*.{js,jsx}\"",
41
41
  "typecheck": "tsc",
42
- "format": "prettier --write \"**/*.{js,json}\"",
42
+ "format": "prettier --write \"**/*.{css,js,jsx,json,md}\"",
43
+ "prepare": "husky install",
43
44
  "lint-staged": "lint-staged"
44
45
  },
45
46
  "engines": {
package/src/index.js CHANGED
@@ -1,32 +1,28 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- */
6
1
  // core
7
2
  import * as Const from './phaser/core/const';
8
3
  import { Game } from './phaser/core/game';
9
- import { Signal } from './phaser/core/signal';
4
+ import { Signal } from './phaser/core/signal';
10
5
  import * as MathUtils from './phaser/util/math';
11
6
  // texture
12
7
  import { BaseTexture } from './phaser/display/webgl/base_texture';
13
8
  import { Texture } from './phaser/display/webgl/texture';
14
9
  // geom
15
- import { Circle } from './phaser/geom/circle';
16
- import { Ellipse } from './phaser/geom/ellipse';
17
- import { Line } from './phaser/geom/line';
18
- import { Matrix } from './phaser/geom/matrix';
10
+ import { Circle } from './phaser/geom/circle';
11
+ import { Ellipse } from './phaser/geom/ellipse';
12
+ import { Line } from './phaser/geom/line';
13
+ import { Matrix } from './phaser/geom/matrix';
19
14
  import { Point } from './phaser/geom/point';
20
- import { Polygon } from './phaser/geom/polygon';
21
- import { Rectangle } from './phaser/geom/rectangle';
22
- import { RoundedRectangle } from './phaser/geom/rounded_rectangle';
15
+ import { Polygon } from './phaser/geom/polygon';
16
+ import { Rectangle } from './phaser/geom/rectangle';
17
+ import { RoundedRectangle } from './phaser/geom/rounded_rectangle';
23
18
  // display
24
- import { BitmapText } from './phaser/display/bitmap_text';
25
- import { DisplayObject } from './phaser/display/display_object';
26
- import { Button } from './phaser/display/button';
19
+ import { BitmapText } from './phaser/display/bitmap_text';
20
+ import { DisplayObject } from './phaser/display/display_object';
21
+ import { Button } from './phaser/display/button';
27
22
  import { Image } from './phaser/display/image';
28
- import { Group } from './phaser/display/group';
29
- import { Text } from './phaser/display/text';
23
+ import { Group } from './phaser/display/group';
24
+ import { Text } from './phaser/display/text';
25
+ import { Graphics } from './phaser/display/graphics';
30
26
  // exports
31
27
  export {
32
28
  Const,
@@ -49,4 +45,5 @@ export {
49
45
  Image,
50
46
  Group,
51
47
  Text,
48
+ Graphics,
52
49
  };
@@ -1,11 +1,17 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- */
6
- import { Signal } from './signal';
1
+ import { Game } from './game';
2
+ import { Signal } from './signal';
7
3
 
8
4
  export class Animation {
5
+ /**
6
+ * TBD.
7
+ * @param {Game} game - TBD.
8
+ * @param parent - TBD.
9
+ * @param name - TBD.
10
+ * @param frameData - TBD.
11
+ * @param frames - TBD.
12
+ * @param frameRate - TBD.
13
+ * @param loop - TBD.
14
+ */
9
15
  constructor(game, parent, name, frameData, frames, frameRate, loop = false) {
10
16
  this.game = game;
11
17
  this._parent = parent;
@@ -35,6 +41,12 @@ export class Animation {
35
41
  this.game.onResume.add(this.onResume, this);
36
42
  }
37
43
 
44
+ /**
45
+ * TBD.
46
+ * @param frameRate - TBD.
47
+ * @param loop - TBD.
48
+ * @param killOnComplete - TBD.
49
+ */
38
50
  play(frameRate, loop, killOnComplete) {
39
51
  if (typeof frameRate === 'number') {
40
52
  // If they set a new frame rate then use it, otherwise use the one set on creation
@@ -63,6 +75,9 @@ export class Animation {
63
75
  return this;
64
76
  }
65
77
 
78
+ /**
79
+ * TBD.
80
+ */
66
81
  restart() {
67
82
  this.isPlaying = true;
68
83
  this.isFinished = false;
@@ -78,16 +93,27 @@ export class Animation {
78
93
  this.onStart.dispatch(this._parent, this);
79
94
  }
80
95
 
96
+ /**
97
+ * TBD.
98
+ */
81
99
  reverse() {
82
100
  this.reversed = !this.reversed;
83
101
  return this;
84
102
  }
85
103
 
104
+ /**
105
+ * TBD.
106
+ */
86
107
  reverseOnce() {
87
108
  this.onComplete.addOnce(this.reverse, this);
88
109
  return this.reverse();
89
110
  }
90
111
 
112
+ /**
113
+ * TBD.
114
+ * @param frameId - TBD.
115
+ * @param useLocalFrameIndex - TBD.
116
+ */
91
117
  setFrame(frameId, useLocalFrameIndex = false) {
92
118
  let frameIndex;
93
119
  // Find the index to the desired frame.
@@ -117,6 +143,11 @@ export class Animation {
117
143
  }
118
144
  }
119
145
 
146
+ /**
147
+ * TBD.
148
+ * @param resetFrame - TBD.
149
+ * @param dispatchComplete - TBD.
150
+ */
120
151
  stop(resetFrame = false, dispatchComplete = false) {
121
152
  this.isPlaying = false;
122
153
  this.isFinished = true;
@@ -133,18 +164,27 @@ export class Animation {
133
164
  }
134
165
  }
135
166
 
167
+ /**
168
+ * TBD.
169
+ */
136
170
  onPause() {
137
171
  if (this.isPlaying) {
138
172
  this._frameDiff = this._timeNextFrame - this.game.time.time;
139
173
  }
140
174
  }
141
175
 
176
+ /**
177
+ * TBD.
178
+ */
142
179
  onResume() {
143
180
  if (this.isPlaying) {
144
181
  this._timeNextFrame = this.game.time.time + this._frameDiff;
145
182
  }
146
183
  }
147
184
 
185
+ /**
186
+ * TBD.
187
+ */
148
188
  update() {
149
189
  if (this.isPaused) {
150
190
  return false;
@@ -200,6 +240,11 @@ export class Animation {
200
240
  return false;
201
241
  }
202
242
 
243
+ /**
244
+ * TBD.
245
+ * @param signalUpdate - TBD.
246
+ * @param fromPlay - TBD.
247
+ */
203
248
  updateCurrentFrame(signalUpdate, fromPlay = false) {
204
249
  if (!this._frameData || !this.currentFrame) {
205
250
  // The animation is already destroyed, probably from a callback
@@ -219,6 +264,10 @@ export class Animation {
219
264
  return true;
220
265
  }
221
266
 
267
+ /**
268
+ * TBD.
269
+ * @param quantity - TBD.
270
+ */
222
271
  next(quantity = 1) {
223
272
  let frame = this._frameIndex + quantity;
224
273
  if (frame >= this._frames.length) {
@@ -234,6 +283,10 @@ export class Animation {
234
283
  }
235
284
  }
236
285
 
286
+ /**
287
+ * TBD.
288
+ * @param quantity - TBD.
289
+ */
237
290
  previous(quantity = 1) {
238
291
  let frame = this._frameIndex - quantity;
239
292
  if (frame < 0) {
@@ -249,6 +302,10 @@ export class Animation {
249
302
  }
250
303
  }
251
304
 
305
+ /**
306
+ * TBD.
307
+ * @param frameData - TBD.
308
+ */
252
309
  updateFrameData(frameData) {
253
310
  this._frameData = frameData;
254
311
  this.currentFrame = this._frameData
@@ -256,6 +313,9 @@ export class Animation {
256
313
  : null;
257
314
  }
258
315
 
316
+ /**
317
+ * TBD.
318
+ */
259
319
  destroy() {
260
320
  if (!this._frameData) {
261
321
  // Already destroyed
@@ -277,6 +337,9 @@ export class Animation {
277
337
  }
278
338
  }
279
339
 
340
+ /**
341
+ * TBD.
342
+ */
280
343
  complete() {
281
344
  this._frameIndex = this._frames.length - 1;
282
345
  this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
@@ -290,10 +353,16 @@ export class Animation {
290
353
  }
291
354
  }
292
355
 
356
+ /**
357
+ * TBD.
358
+ */
293
359
  get paused() {
294
360
  return this.isPaused;
295
361
  }
296
362
 
363
+ /**
364
+ * TBD.
365
+ */
297
366
  set paused(value) {
298
367
  this.isPaused = value;
299
368
  if (value) {
@@ -303,18 +372,30 @@ export class Animation {
303
372
  }
304
373
  }
305
374
 
375
+ /**
376
+ * TBD.
377
+ */
306
378
  get reversed() {
307
379
  return this.isReversed;
308
380
  }
309
381
 
382
+ /**
383
+ * TBD.
384
+ */
310
385
  set reversed(value) {
311
386
  this.isReversed = value;
312
387
  }
313
388
 
389
+ /**
390
+ * TBD.
391
+ */
314
392
  get frameTotal() {
315
393
  return this._frames.length;
316
394
  }
317
395
 
396
+ /**
397
+ * TBD.
398
+ */
318
399
  get frame() {
319
400
  if (this.currentFrame !== null) {
320
401
  return this.currentFrame.index;
@@ -322,6 +403,9 @@ export class Animation {
322
403
  return this._frameIndex;
323
404
  }
324
405
 
406
+ /**
407
+ * TBD.
408
+ */
325
409
  set frame(value) {
326
410
  this.currentFrame = this._frameData.getFrame(this._frames[value]);
327
411
  if (this.currentFrame !== null) {
@@ -333,20 +417,32 @@ export class Animation {
333
417
  }
334
418
  }
335
419
 
420
+ /**
421
+ * TBD.
422
+ */
336
423
  get speed() {
337
424
  return 1000 / this.delay;
338
425
  }
339
426
 
427
+ /**
428
+ * TBD.
429
+ */
340
430
  set speed(value) {
341
431
  if (value > 0) {
342
432
  this.delay = 1000 / value;
343
433
  }
344
434
  }
345
435
 
436
+ /**
437
+ * TBD.
438
+ */
346
439
  get enableUpdate() {
347
440
  return this.onUpdate !== null;
348
441
  }
349
442
 
443
+ /**
444
+ * TBD.
445
+ */
350
446
  set enableUpdate(value) {
351
447
  if (value && this.onUpdate === null) {
352
448
  this.onUpdate = new Signal();
@@ -1,11 +1,10 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- */
6
1
  import { Animation } from './animation';
7
2
 
8
3
  export class AnimationManager {
4
+ /**
5
+ * TBD.
6
+ * @param sprite - TBD.
7
+ */
9
8
  constructor(sprite) {
10
9
  this.sprite = sprite;
11
10
  this.game = sprite.game;
@@ -18,6 +17,9 @@ export class AnimationManager {
18
17
  this._outputFrames = [];
19
18
  }
20
19
 
20
+ /**
21
+ * TBD.
22
+ */
21
23
  destroy() {
22
24
  const keys = Object.keys(this._anims);
23
25
  for (let i = 0; i < keys.length; i += 1) {
@@ -32,6 +34,11 @@ export class AnimationManager {
32
34
  this.game = null;
33
35
  }
34
36
 
37
+ /**
38
+ * TBD.
39
+ * @param frameData - TBD.
40
+ * @param frame - TBD.
41
+ */
35
42
  loadFrameData(frameData, frame) {
36
43
  if (!frameData) {
37
44
  return false;
@@ -56,6 +63,11 @@ export class AnimationManager {
56
63
  return true;
57
64
  }
58
65
 
66
+ /**
67
+ * TBD.
68
+ * @param frameData - TBD.
69
+ * @param frame - TBD.
70
+ */
59
71
  copyFrameData(frameData, frame) {
60
72
  this._frameData = frameData.clone();
61
73
  if (this.isLoaded) {
@@ -77,6 +89,14 @@ export class AnimationManager {
77
89
  return true;
78
90
  }
79
91
 
92
+ /**
93
+ * TBD.
94
+ * @param name - TBD.
95
+ * @param frameList - TBD.
96
+ * @param frameRate - TBD.
97
+ * @param loop - TBD.
98
+ * @param useNumericIndex - TBD.
99
+ */
80
100
  add(name, frameList, frameRate = 60, loop = false, useNumericIndex = undefined) {
81
101
  const frames = frameList || [];
82
102
  // If they didn't set the useNumericIndex then let's at least try and guess it
@@ -105,6 +125,11 @@ export class AnimationManager {
105
125
  return this._anims[name];
106
126
  }
107
127
 
128
+ /**
129
+ * TBD.
130
+ * @param frames - TBD.
131
+ * @param useNumericIndex - TBD.
132
+ */
108
133
  validateFrames(frames, useNumericIndex = false) {
109
134
  for (let i = 0; i < frames.length; i += 1) {
110
135
  if (useNumericIndex === true) {
@@ -118,6 +143,13 @@ export class AnimationManager {
118
143
  return true;
119
144
  }
120
145
 
146
+ /**
147
+ * TBD.
148
+ * @param name - TBD.
149
+ * @param frameRate - TBD.
150
+ * @param loop - TBD.
151
+ * @param killOnComplete - TBD.
152
+ */
121
153
  play(name, frameRate, loop, killOnComplete) {
122
154
  if (this._anims[name]) {
123
155
  if (this.currentAnim === this._anims[name]) {
@@ -138,12 +170,20 @@ export class AnimationManager {
138
170
  return null;
139
171
  }
140
172
 
173
+ /**
174
+ * TBD.
175
+ * @param name - TBD.
176
+ * @param resetFrame - TBD.
177
+ */
141
178
  stop(name, resetFrame = false) {
142
179
  if (this.currentAnim && (typeof name !== 'string' || name === this.currentAnim.name)) {
143
180
  this.currentAnim.stop(resetFrame);
144
181
  }
145
182
  }
146
183
 
184
+ /**
185
+ * TBD.
186
+ */
147
187
  update() {
148
188
  if (this.updateIfVisible && !this.sprite.visible) {
149
189
  return false;
@@ -155,6 +195,10 @@ export class AnimationManager {
155
195
  return false;
156
196
  }
157
197
 
198
+ /**
199
+ * TBD.
200
+ * @param quantity - TBD.
201
+ */
158
202
  next(quantity) {
159
203
  if (this.currentAnim) {
160
204
  this.currentAnim.next(quantity);
@@ -162,6 +206,10 @@ export class AnimationManager {
162
206
  }
163
207
  }
164
208
 
209
+ /**
210
+ * TBD.
211
+ * @param quantity - TBD.
212
+ */
165
213
  previous(quantity) {
166
214
  if (this.currentAnim) {
167
215
  this.currentAnim.previous(quantity);
@@ -169,6 +217,10 @@ export class AnimationManager {
169
217
  }
170
218
  }
171
219
 
220
+ /**
221
+ * TBD.
222
+ * @param name - TBD.
223
+ */
172
224
  getAnimation(name) {
173
225
  if (name && this._anims[name]) {
174
226
  return this._anims[name];
@@ -176,28 +228,46 @@ export class AnimationManager {
176
228
  return null;
177
229
  }
178
230
 
231
+ /**
232
+ * TBD.
233
+ */
179
234
  refreshFrame() {
180
235
  // TODO
181
236
  console.warn('animation_manager.refreshFrame() is not implemented');
182
237
  // this.sprite.setTexture(PIXI.TextureCache[this.currentFrame.uuid]);
183
238
  }
184
239
 
240
+ /**
241
+ * TBD.
242
+ */
185
243
  get frameData() {
186
244
  return this._frameData;
187
245
  }
188
246
 
247
+ /**
248
+ * TBD.
249
+ */
189
250
  get frameTotal() {
190
251
  return this._frameData.total;
191
252
  }
192
253
 
254
+ /**
255
+ * TBD.
256
+ */
193
257
  get paused() {
194
258
  return this.currentAnim.isPaused;
195
259
  }
196
260
 
261
+ /**
262
+ * TBD.
263
+ */
197
264
  set paused(value) {
198
265
  this.currentAnim.paused = value;
199
266
  }
200
267
 
268
+ /**
269
+ * TBD.
270
+ */
201
271
  get name() {
202
272
  if (this.currentAnim) {
203
273
  return this.currentAnim.name;
@@ -205,6 +275,9 @@ export class AnimationManager {
205
275
  return null;
206
276
  }
207
277
 
278
+ /**
279
+ * TBD.
280
+ */
208
281
  get frame() {
209
282
  if (this.currentFrame) {
210
283
  return this.currentFrame.index;
@@ -212,6 +285,9 @@ export class AnimationManager {
212
285
  return 0;
213
286
  }
214
287
 
288
+ /**
289
+ * TBD.
290
+ */
215
291
  set frame(value) {
216
292
  if (typeof value === 'number' && this._frameData && this._frameData.getFrame(value) !== null) {
217
293
  this.currentFrame = this._frameData.getFrame(value);
@@ -223,6 +299,9 @@ export class AnimationManager {
223
299
  }
224
300
  }
225
301
 
302
+ /**
303
+ * TBD.
304
+ */
226
305
  get frameName() {
227
306
  if (this.currentFrame) {
228
307
  return this.currentFrame.name;
@@ -230,12 +309,11 @@ export class AnimationManager {
230
309
  return null;
231
310
  }
232
311
 
312
+ /**
313
+ * TBD.
314
+ */
233
315
  set frameName(value) {
234
- if (
235
- typeof value === 'string' &&
236
- this._frameData &&
237
- this._frameData.getFrameByName(value) !== null
238
- ) {
316
+ if (typeof value === 'string' && this._frameData && this._frameData.getFrameByName(value) !== null) {
239
317
  this.currentFrame = this._frameData.getFrameByName(value);
240
318
  if (this.currentFrame) {
241
319
  this._frameIndex = this.currentFrame.index;
@@ -1,15 +1,10 @@
1
- /**
2
- * @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
3
- * @author Andras Csizmadia <andras@vpmedia.hu>
4
- * @author Richard Davey <rich@photonstorm.com>
5
- */
6
1
  import { Frame } from './frame';
7
2
  import { FrameData } from './frame_data';
3
+ import { Game } from './game';
8
4
 
9
5
  /**
10
6
  * TBD.
11
- *
12
- * @param {object} game - TBD.
7
+ * @param {Game} game - TBD.
13
8
  * @param {object} key - TBD.
14
9
  * @param {number} frameWidth - TBD.
15
10
  * @param {number} frameHeight - TBD.
@@ -43,9 +38,7 @@ export function spriteSheet(game, key, frameWidth, frameHeight, frameMax, margin
43
38
  // Zero or smaller than frame sizes?
44
39
  if (width === 0 || height === 0 || width < frameWidth || height < frameHeight || total === 0) {
45
40
  console.warn(
46
- "AnimationParser.spriteSheet: '" +
47
- key +
48
- "'s width/height zero or width/height < given frameWidth/frameHeight"
41
+ "AnimationParser.spriteSheet: '" + key + "'s width/height zero or width/height < given frameWidth/frameHeight"
49
42
  );
50
43
  return null;
51
44
  }
@@ -66,8 +59,7 @@ export function spriteSheet(game, key, frameWidth, frameHeight, frameMax, margin
66
59
 
67
60
  /**
68
61
  * TBD.
69
- *
70
- * @param {object} game - TBD.
62
+ * @param {Game} game - TBD.
71
63
  * @param {object} json - TBD.
72
64
  * @returns {object} TBD.
73
65
  */
@@ -86,14 +78,7 @@ export function JSONDataHash(game, json) {
86
78
  for (let k = 0; k < keys.length; k += 1) {
87
79
  const key = keys[k];
88
80
  newFrame = data.addFrame(
89
- new Frame(
90
- i,
91
- frames[key].frame.x,
92
- frames[key].frame.y,
93
- frames[key].frame.w,
94
- frames[key].frame.h,
95
- key
96
- )
81
+ new Frame(i, frames[key].frame.x, frames[key].frame.y, frames[key].frame.w, frames[key].frame.h, key)
97
82
  );
98
83
  if (frames[key].trimmed) {
99
84
  newFrame.setTrim(