@vpmedia/phaser 1.15.0 → 1.17.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 (290) 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 +114 -6
  5. package/src/phaser/core/animation_manager.js +102 -10
  6. package/src/phaser/core/animation_parser.js +6 -19
  7. package/src/phaser/core/array_set.js +59 -5
  8. package/src/phaser/core/cache.js +307 -6
  9. package/src/phaser/core/const.js +107 -4
  10. package/src/phaser/core/device.js +3 -6
  11. package/src/phaser/core/device_util.js +3 -16
  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 -12
  18. package/src/phaser/core/game.js +35 -7
  19. package/src/phaser/core/input.js +133 -17
  20. package/src/phaser/core/input_handler.js +243 -43
  21. package/src/phaser/core/input_mouse.js +70 -5
  22. package/src/phaser/core/input_mspointer.js +40 -9
  23. package/src/phaser/core/input_pointer.js +88 -17
  24. package/src/phaser/core/input_touch.js +42 -5
  25. package/src/phaser/core/loader.js +303 -101
  26. package/src/phaser/core/loader_parser.js +2 -10
  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 -8
  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 +91 -10
  46. package/src/phaser/display/button.js +63 -12
  47. package/src/phaser/display/canvas/buffer.js +16 -6
  48. package/src/phaser/display/canvas/graphics.js +1 -13
  49. package/src/phaser/display/canvas/masker.js +0 -6
  50. package/src/phaser/display/canvas/pool.js +0 -7
  51. package/src/phaser/display/canvas/renderer.js +28 -8
  52. package/src/phaser/display/canvas/tinter.js +4 -43
  53. package/src/phaser/display/canvas/util.js +0 -6
  54. package/src/phaser/display/display_object.js +192 -20
  55. package/src/phaser/display/graphics.js +161 -26
  56. package/src/phaser/display/graphics_data.js +14 -6
  57. package/src/phaser/display/graphics_data_util.js +2 -8
  58. package/src/phaser/display/group.js +82 -9
  59. package/src/phaser/display/image.js +87 -9
  60. package/src/phaser/display/sprite_batch.js +3 -8
  61. package/src/phaser/display/sprite_util.js +3 -23
  62. package/src/phaser/display/text.js +331 -31
  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 -23
  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 -28
  72. package/src/phaser/display/webgl/graphics_data.js +10 -7
  73. package/src/phaser/display/webgl/mask_manager.js +0 -6
  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 -6
  86. package/src/phaser/display/webgl/util.js +0 -7
  87. package/src/phaser/geom/circle.js +123 -18
  88. package/src/phaser/geom/ellipse.js +39 -18
  89. package/src/phaser/geom/line.js +148 -16
  90. package/src/phaser/geom/matrix.js +73 -6
  91. package/src/phaser/geom/point.js +152 -6
  92. package/src/phaser/geom/polygon.js +42 -14
  93. package/src/phaser/geom/rectangle.js +233 -6
  94. package/src/phaser/geom/rounded_rectangle.js +10 -6
  95. package/src/phaser/geom/util/circle.js +3 -9
  96. package/src/phaser/geom/util/ellipse.js +0 -7
  97. package/src/phaser/geom/util/line.js +5 -14
  98. package/src/phaser/geom/util/matrix.js +1 -7
  99. package/src/phaser/geom/util/point.js +0 -6
  100. package/src/phaser/geom/util/polygon.js +1 -7
  101. package/src/phaser/geom/util/rectangle.js +1 -7
  102. package/src/phaser/geom/util/rounded_rectangle.js +1 -7
  103. package/src/phaser/util/math.js +3 -21
  104. package/types/index.d.ts +2 -1
  105. package/types/index.d.ts.map +1 -1
  106. package/types/phaser/core/animation.d.ts +126 -13
  107. package/types/phaser/core/animation.d.ts.map +1 -1
  108. package/types/phaser/core/animation_manager.d.ts +121 -19
  109. package/types/phaser/core/animation_manager.d.ts.map +1 -1
  110. package/types/phaser/core/animation_parser.d.ts +6 -5
  111. package/types/phaser/core/animation_parser.d.ts.map +1 -1
  112. package/types/phaser/core/array_set.d.ts +67 -13
  113. package/types/phaser/core/array_set.d.ts.map +1 -1
  114. package/types/phaser/core/cache.d.ts +365 -69
  115. package/types/phaser/core/cache.d.ts.map +1 -1
  116. package/types/phaser/core/const.d.ts +143 -40
  117. package/types/phaser/core/const.d.ts.map +1 -1
  118. package/types/phaser/core/device.d.ts +0 -5
  119. package/types/phaser/core/device.d.ts.map +1 -1
  120. package/types/phaser/core/device_util.d.ts +1 -1
  121. package/types/phaser/core/device_util.d.ts.map +1 -1
  122. package/types/phaser/core/dom.d.ts +119 -0
  123. package/types/phaser/core/dom.d.ts.map +1 -1
  124. package/types/phaser/core/event_manager.d.ts +127 -0
  125. package/types/phaser/core/event_manager.d.ts.map +1 -1
  126. package/types/phaser/core/factory.d.ts +75 -8
  127. package/types/phaser/core/factory.d.ts.map +1 -1
  128. package/types/phaser/core/frame.d.ts +64 -21
  129. package/types/phaser/core/frame.d.ts.map +1 -1
  130. package/types/phaser/core/frame_data.d.ts +61 -9
  131. package/types/phaser/core/frame_data.d.ts.map +1 -1
  132. package/types/phaser/core/frame_util.d.ts +10 -8
  133. package/types/phaser/core/frame_util.d.ts.map +1 -1
  134. package/types/phaser/core/game.d.ts +40 -6
  135. package/types/phaser/core/game.d.ts.map +1 -1
  136. package/types/phaser/core/input.d.ts +143 -15
  137. package/types/phaser/core/input.d.ts.map +1 -1
  138. package/types/phaser/core/input_handler.d.ts +258 -25
  139. package/types/phaser/core/input_handler.d.ts.map +1 -1
  140. package/types/phaser/core/input_mouse.d.ts +62 -14
  141. package/types/phaser/core/input_mouse.d.ts.map +1 -1
  142. package/types/phaser/core/input_mspointer.d.ts +51 -17
  143. package/types/phaser/core/input_mspointer.d.ts.map +1 -1
  144. package/types/phaser/core/input_pointer.d.ts +99 -14
  145. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  146. package/types/phaser/core/input_touch.d.ts +53 -16
  147. package/types/phaser/core/input_touch.d.ts.map +1 -1
  148. package/types/phaser/core/loader.d.ts +299 -28
  149. package/types/phaser/core/loader.d.ts.map +1 -1
  150. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  151. package/types/phaser/core/raf.d.ts +19 -9
  152. package/types/phaser/core/raf.d.ts.map +1 -1
  153. package/types/phaser/core/scale_manager.d.ts +208 -13
  154. package/types/phaser/core/scale_manager.d.ts.map +1 -1
  155. package/types/phaser/core/scene.d.ts +21 -5
  156. package/types/phaser/core/scene.d.ts.map +1 -1
  157. package/types/phaser/core/scene_manager.d.ts +90 -10
  158. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  159. package/types/phaser/core/signal.d.ts +93 -9
  160. package/types/phaser/core/signal.d.ts.map +1 -1
  161. package/types/phaser/core/signal_binding.d.ts +34 -5
  162. package/types/phaser/core/signal_binding.d.ts.map +1 -1
  163. package/types/phaser/core/sound.d.ts +111 -14
  164. package/types/phaser/core/sound.d.ts.map +1 -1
  165. package/types/phaser/core/sound_manager.d.ts +97 -11
  166. package/types/phaser/core/sound_manager.d.ts.map +1 -1
  167. package/types/phaser/core/sound_sprite.d.ts +22 -8
  168. package/types/phaser/core/sound_sprite.d.ts.map +1 -1
  169. package/types/phaser/core/stage.d.ts +32 -3
  170. package/types/phaser/core/stage.d.ts.map +1 -1
  171. package/types/phaser/core/time.d.ts +73 -6
  172. package/types/phaser/core/time.d.ts.map +1 -1
  173. package/types/phaser/core/timer.d.ts +108 -7
  174. package/types/phaser/core/timer.d.ts.map +1 -1
  175. package/types/phaser/core/timer_event.d.ts +13 -7
  176. package/types/phaser/core/timer_event.d.ts.map +1 -1
  177. package/types/phaser/core/tween.d.ts +124 -4
  178. package/types/phaser/core/tween.d.ts.map +1 -1
  179. package/types/phaser/core/tween_data.d.ts +41 -2
  180. package/types/phaser/core/tween_data.d.ts.map +1 -1
  181. package/types/phaser/core/tween_easing.d.ts +0 -5
  182. package/types/phaser/core/tween_easing.d.ts.map +1 -1
  183. package/types/phaser/core/tween_manager.d.ts +49 -2
  184. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  185. package/types/phaser/core/world.d.ts +9 -1
  186. package/types/phaser/core/world.d.ts.map +1 -1
  187. package/types/phaser/display/bitmap_text.d.ts +84 -7
  188. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  189. package/types/phaser/display/button.d.ts +65 -8
  190. package/types/phaser/display/button.d.ts.map +1 -1
  191. package/types/phaser/display/canvas/buffer.d.ts +20 -4
  192. package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
  193. package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
  194. package/types/phaser/display/canvas/masker.d.ts.map +1 -1
  195. package/types/phaser/display/canvas/pool.d.ts +0 -6
  196. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  197. package/types/phaser/display/canvas/renderer.d.ts +29 -2
  198. package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
  199. package/types/phaser/display/canvas/tinter.d.ts.map +1 -1
  200. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  201. package/types/phaser/display/display_object.d.ts +195 -8
  202. package/types/phaser/display/display_object.d.ts.map +1 -1
  203. package/types/phaser/display/graphics.d.ts +132 -6
  204. package/types/phaser/display/graphics.d.ts.map +1 -1
  205. package/types/phaser/display/graphics_data.d.ts +15 -1
  206. package/types/phaser/display/graphics_data.d.ts.map +1 -1
  207. package/types/phaser/display/graphics_data_util.d.ts +3 -2
  208. package/types/phaser/display/graphics_data_util.d.ts.map +1 -1
  209. package/types/phaser/display/group.d.ts +80 -10
  210. package/types/phaser/display/group.d.ts.map +1 -1
  211. package/types/phaser/display/image.d.ts +72 -6
  212. package/types/phaser/display/image.d.ts.map +1 -1
  213. package/types/phaser/display/sprite_batch.d.ts +4 -3
  214. package/types/phaser/display/sprite_batch.d.ts.map +1 -1
  215. package/types/phaser/display/sprite_util.d.ts.map +1 -1
  216. package/types/phaser/display/text.d.ts +366 -46
  217. package/types/phaser/display/text.d.ts.map +1 -1
  218. package/types/phaser/display/webgl/abstract_filter.d.ts +8 -6
  219. package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  220. package/types/phaser/display/webgl/base_texture.d.ts +20 -1
  221. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
  222. package/types/phaser/display/webgl/blend_manager.d.ts +11 -6
  223. package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  224. package/types/phaser/display/webgl/earcut.d.ts.map +1 -1
  225. package/types/phaser/display/webgl/earcut_node.d.ts +9 -9
  226. package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  227. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +33 -6
  228. package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  229. package/types/phaser/display/webgl/filter_manager.d.ts +22 -6
  230. package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  231. package/types/phaser/display/webgl/filter_texture.d.ts +21 -3
  232. package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  233. package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
  234. package/types/phaser/display/webgl/graphics_data.d.ts +10 -6
  235. package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  236. package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  237. package/types/phaser/display/webgl/render_texture.d.ts +30 -3
  238. package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
  239. package/types/phaser/display/webgl/renderer.d.ts +41 -4
  240. package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
  241. package/types/phaser/display/webgl/shader/complex.d.ts +10 -0
  242. package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  243. package/types/phaser/display/webgl/shader/fast.d.ts +10 -0
  244. package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  245. package/types/phaser/display/webgl/shader/normal.d.ts +20 -0
  246. package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  247. package/types/phaser/display/webgl/shader/primitive.d.ts +10 -0
  248. package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  249. package/types/phaser/display/webgl/shader/strip.d.ts +10 -0
  250. package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  251. package/types/phaser/display/webgl/shader_manager.d.ts +15 -0
  252. package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  253. package/types/phaser/display/webgl/sprite_batch.d.ts +37 -0
  254. package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  255. package/types/phaser/display/webgl/stencil_manager.d.ts +25 -0
  256. package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  257. package/types/phaser/display/webgl/texture.d.ts +21 -0
  258. package/types/phaser/display/webgl/texture.d.ts.map +1 -1
  259. package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
  260. package/types/phaser/display/webgl/util.d.ts +0 -6
  261. package/types/phaser/display/webgl/util.d.ts.map +1 -1
  262. package/types/phaser/geom/circle.d.ts +131 -9
  263. package/types/phaser/geom/circle.d.ts.map +1 -1
  264. package/types/phaser/geom/ellipse.d.ts +43 -5
  265. package/types/phaser/geom/ellipse.d.ts.map +1 -1
  266. package/types/phaser/geom/line.d.ts +159 -13
  267. package/types/phaser/geom/line.d.ts.map +1 -1
  268. package/types/phaser/geom/matrix.d.ts +85 -11
  269. package/types/phaser/geom/matrix.d.ts.map +1 -1
  270. package/types/phaser/geom/point.d.ts +170 -18
  271. package/types/phaser/geom/point.d.ts.map +1 -1
  272. package/types/phaser/geom/polygon.d.ts +45 -5
  273. package/types/phaser/geom/polygon.d.ts.map +1 -1
  274. package/types/phaser/geom/rectangle.d.ts +253 -20
  275. package/types/phaser/geom/rectangle.d.ts.map +1 -1
  276. package/types/phaser/geom/rounded_rectangle.d.ts +11 -1
  277. package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  278. package/types/phaser/geom/util/circle.d.ts +3 -3
  279. package/types/phaser/geom/util/circle.d.ts.map +1 -1
  280. package/types/phaser/geom/util/ellipse.d.ts +0 -6
  281. package/types/phaser/geom/util/ellipse.d.ts.map +1 -1
  282. package/types/phaser/geom/util/line.d.ts +5 -5
  283. package/types/phaser/geom/util/line.d.ts.map +1 -1
  284. package/types/phaser/geom/util/matrix.d.ts.map +1 -1
  285. package/types/phaser/geom/util/point.d.ts.map +1 -1
  286. package/types/phaser/geom/util/polygon.d.ts.map +1 -1
  287. package/types/phaser/geom/util/rectangle.d.ts.map +1 -1
  288. package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  289. package/types/phaser/util/math.d.ts +0 -5
  290. package/types/phaser/util/math.d.ts.map +1 -1
@@ -1,10 +1,5 @@
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 { Texture } from '../display/webgl/texture';
7
- import { Rectangle } from '../geom/rectangle';
2
+ import { Rectangle } from '../geom/rectangle';
8
3
 
9
4
  /**
10
5
  * TBD.
@@ -15,10 +10,7 @@ import { Rectangle } from '../geom/rectangle';
15
10
  export function finalizeBitmapFont(baseTexture, bitmapFontData) {
16
11
  Object.keys(bitmapFontData.chars).forEach((charCode) => {
17
12
  const letter = bitmapFontData.chars[charCode];
18
- letter.texture = new Texture(
19
- baseTexture,
20
- new Rectangle(letter.x, letter.y, letter.width, letter.height)
21
- );
13
+ letter.texture = new Texture(baseTexture, new Rectangle(letter.x, letter.y, letter.width, letter.height));
22
14
  });
23
15
  return bitmapFontData;
24
16
  }
@@ -1,23 +1,34 @@
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
- */
1
+ import { Game } from './game';
2
+
6
3
  export class RequestAnimationFrame {
4
+ /**
5
+ * TBD.
6
+ * @param {Game} game - TBD.
7
+ */
7
8
  constructor(game) {
8
9
  this.game = game;
9
10
  this.rafId = 0;
10
11
  this.updateBinded = this.update.bind(this);
11
12
  }
12
13
 
14
+ /**
15
+ * TBD.
16
+ */
13
17
  start() {
14
18
  this.rafId = requestAnimationFrame(this.updateBinded);
15
19
  }
16
20
 
21
+ /**
22
+ * TBD.
23
+ */
17
24
  stop() {
18
25
  cancelAnimationFrame(this.rafId);
19
26
  }
20
27
 
28
+ /**
29
+ * TBD.
30
+ * @param {number} rafTime - TBD.
31
+ */
21
32
  update(rafTime) {
22
33
  this.game.update(rafTime);
23
34
  this.rafId = requestAnimationFrame(this.updateBinded);
@@ -1,22 +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 { Signal } from './signal';
7
2
  import { DOM } from './dom';
8
3
  import { Point } from '../geom/point';
9
- import { Rectangle } from '../geom/rectangle';
10
- import {
11
- SCALE_OFF,
12
- SCALE_RESIZE,
13
- SCALE_EXACT_FIT,
14
- SCALE_USER,
15
- SCALE_SHOW_ALL,
16
- RENDER_CANVAS,
17
- } from './const';
4
+ import { Rectangle } from '../geom/rectangle';
5
+ import { SCALE_OFF, SCALE_RESIZE, SCALE_EXACT_FIT, SCALE_USER, SCALE_SHOW_ALL, RENDER_CANVAS } from './const';
6
+ import { Game } from './game';
18
7
 
19
8
  export class ScaleManager {
9
+ /**
10
+ * TBD.
11
+ * @param {Game} game - TBD.
12
+ * @param {number} width - TBD.
13
+ * @param {number} height - TBD.
14
+ */
20
15
  constructor(game, width, height) {
21
16
  this.game = game;
22
17
  this.dom = new DOM(game.device);
@@ -95,6 +90,9 @@ export class ScaleManager {
95
90
  this.setupScale(width, height);
96
91
  }
97
92
 
93
+ /**
94
+ * TBD.
95
+ */
98
96
  boot() {
99
97
  // Configure device-dependent compatibility
100
98
  const compat = this.compatibility;
@@ -139,6 +137,10 @@ export class ScaleManager {
139
137
  }
140
138
  }
141
139
 
140
+ /**
141
+ * TBD.
142
+ * @param config - TBD.
143
+ */
142
144
  parseConfig(config) {
143
145
  if (config.scaleMode !== undefined) {
144
146
  if (this._booted) {
@@ -157,6 +159,11 @@ export class ScaleManager {
157
159
  }
158
160
  }
159
161
 
162
+ /**
163
+ * TBD.
164
+ * @param {number} width - TBD.
165
+ * @param {number} height - TBD.
166
+ */
160
167
  setupScale(width, height) {
161
168
  let target;
162
169
  const rect = new Rectangle();
@@ -207,10 +214,18 @@ export class ScaleManager {
207
214
  this.updateDimensions(newWidth, newHeight, false);
208
215
  }
209
216
 
217
+ /**
218
+ * TBD.
219
+ */
210
220
  _gameResumed() {
211
221
  this.queueUpdate(true);
212
222
  }
213
223
 
224
+ /**
225
+ * TBD.
226
+ * @param {number} width - TBD.
227
+ * @param {number} height - TBD.
228
+ */
214
229
  setGameSize(width, height) {
215
230
  this._gameSize.setTo(0, 0, width, height);
216
231
  if (this.currentScaleMode !== SCALE_RESIZE) {
@@ -219,17 +234,32 @@ export class ScaleManager {
219
234
  this.queueUpdate(true);
220
235
  }
221
236
 
237
+ /**
238
+ * TBD.
239
+ * @param hScale - TBD.
240
+ * @param vScale - TBD.
241
+ * @param hTrim - TBD.
242
+ * @param vTrim - TBD.
243
+ */
222
244
  setUserScale(hScale, vScale, hTrim, vTrim) {
223
245
  this._userScaleFactor.setTo(hScale, vScale);
224
246
  this._userScaleTrim.setTo(hTrim | 0, vTrim | 0);
225
247
  this.queueUpdate(true);
226
248
  }
227
249
 
250
+ /**
251
+ * TBD.
252
+ * @param {Function} callback - TBD.
253
+ * @param context - TBD.
254
+ */
228
255
  setResizeCallback(callback, context) {
229
256
  this.onResize = callback;
230
257
  this.onResizeContext = context;
231
258
  }
232
259
 
260
+ /**
261
+ * TBD.
262
+ */
233
263
  signalSizeChange() {
234
264
  if (
235
265
  this.width !== this._lastReportedCanvasSize.width ||
@@ -250,6 +280,13 @@ export class ScaleManager {
250
280
  }
251
281
  }
252
282
 
283
+ /**
284
+ * TBD.
285
+ * @param minWidth - TBD.
286
+ * @param minHeight - TBD.
287
+ * @param maxWidth - TBD.
288
+ * @param maxHeight - TBD.
289
+ */
253
290
  setMinMax(minWidth, minHeight, maxWidth, maxHeight) {
254
291
  this.minWidth = minWidth;
255
292
  this.minHeight = minHeight;
@@ -261,6 +298,9 @@ export class ScaleManager {
261
298
  }
262
299
  }
263
300
 
301
+ /**
302
+ * TBD.
303
+ */
264
304
  preUpdate() {
265
305
  if (this.game.time.time < this._lastUpdate + this._updateThrottle) {
266
306
  return;
@@ -291,12 +331,21 @@ export class ScaleManager {
291
331
  this._lastUpdate = this.game.time.time;
292
332
  }
293
333
 
334
+ /**
335
+ * TBD.
336
+ */
294
337
  pauseUpdate() {
295
338
  this.preUpdate();
296
339
  // Updates at slowest.
297
340
  this._updateThrottle = this.trackParentInterval;
298
341
  }
299
342
 
343
+ /**
344
+ * TBD.
345
+ * @param {number} width - TBD.
346
+ * @param {number} height - TBD.
347
+ * @param resize
348
+ */
300
349
  updateDimensions(width, height, resize) {
301
350
  this.width = width * this.parentScaleFactor.x;
302
351
  this.height = height * this.parentScaleFactor.y;
@@ -310,6 +359,9 @@ export class ScaleManager {
310
359
  }
311
360
  }
312
361
 
362
+ /**
363
+ * TBD.
364
+ */
313
365
  updateScalingAndBounds() {
314
366
  this.scaleFactor.x = this.game.width / this.width;
315
367
  this.scaleFactor.y = this.game.height / this.height;
@@ -327,12 +379,21 @@ export class ScaleManager {
327
379
  }
328
380
  }
329
381
 
382
+ /**
383
+ * TBD.
384
+ * @param forceLandscape - TBD.
385
+ * @param forcePortrait - TBD.
386
+ */
330
387
  forceOrientation(forceLandscape = false, forcePortrait = false) {
331
388
  this.forceLandscape = forceLandscape;
332
389
  this.forcePortrait = forcePortrait;
333
390
  this.queueUpdate(true);
334
391
  }
335
392
 
393
+ /**
394
+ * TBD.
395
+ * @param orientation - TBD.
396
+ */
336
397
  classifyOrientation(orientation) {
337
398
  if (orientation === 'portrait-primary' || orientation === 'portrait-secondary') {
338
399
  return 'portrait';
@@ -342,12 +403,14 @@ export class ScaleManager {
342
403
  return null;
343
404
  }
344
405
 
406
+ /**
407
+ * TBD.
408
+ */
345
409
  updateOrientationState() {
346
410
  const previousOrientation = this.screenOrientation;
347
411
  const previouslyIncorrect = this.incorrectOrientation;
348
412
  this.screenOrientation = this.dom.getScreenOrientation(this.compatibility.orientationFallback);
349
- this.incorrectOrientation =
350
- (this.forceLandscape && !this.isLandscape) || (this.forcePortrait && !this.isPortrait);
413
+ this.incorrectOrientation = (this.forceLandscape && !this.isLandscape) || (this.forcePortrait && !this.isPortrait);
351
414
  const changed = previousOrientation !== this.screenOrientation;
352
415
  const correctnessChanged = previouslyIncorrect !== this.incorrectOrientation;
353
416
  if (correctnessChanged) {
@@ -363,20 +426,34 @@ export class ScaleManager {
363
426
  return changed || correctnessChanged;
364
427
  }
365
428
 
429
+ /**
430
+ * TBD.
431
+ * @param {Event} event - TBD.
432
+ */
366
433
  orientationChange(event) {
367
434
  this.event = event;
368
435
  this.queueUpdate(true);
369
436
  }
370
437
 
438
+ /**
439
+ * TBD.
440
+ * @param {Event} event - TBD.
441
+ */
371
442
  windowResize(event) {
372
443
  this.event = event;
373
444
  this.queueUpdate(true);
374
445
  }
375
446
 
447
+ /**
448
+ * TBD.
449
+ */
376
450
  refresh() {
377
451
  this.queueUpdate(true);
378
452
  }
379
453
 
454
+ /**
455
+ * TBD.
456
+ */
380
457
  updateLayout() {
381
458
  const scaleMode = this.currentScaleMode;
382
459
  if (scaleMode === SCALE_RESIZE) {
@@ -405,10 +482,7 @@ export class ScaleManager {
405
482
  this.width = this.game.width * this._userScaleFactor.x - this._userScaleTrim.x;
406
483
  this.height = this.game.height * this._userScaleFactor.y - this._userScaleTrim.y;
407
484
  }
408
- if (
409
- !this.compatibility.canExpandParent &&
410
- (scaleMode === SCALE_SHOW_ALL || scaleMode === SCALE_USER)
411
- ) {
485
+ if (!this.compatibility.canExpandParent && (scaleMode === SCALE_SHOW_ALL || scaleMode === SCALE_USER)) {
412
486
  const bounds = this.getParentBounds(this._tempBounds);
413
487
  this.width = Math.min(this.width, bounds.width);
414
488
  this.height = Math.min(this.height, bounds.height);
@@ -419,6 +493,10 @@ export class ScaleManager {
419
493
  this.reflowCanvas();
420
494
  }
421
495
 
496
+ /**
497
+ * TBD.
498
+ * @param target - TBD.
499
+ */
422
500
  getParentBounds(target) {
423
501
  const bounds = target || new Rectangle();
424
502
  const parentNode = this.boundingParent;
@@ -448,15 +526,15 @@ export class ScaleManager {
448
526
  bounds.bottom = Math.min(bounds.bottom, windowBounds.height);
449
527
  }
450
528
  }
451
- bounds.setTo(
452
- Math.round(bounds.x),
453
- Math.round(bounds.y),
454
- Math.round(bounds.width),
455
- Math.round(bounds.height)
456
- );
529
+ bounds.setTo(Math.round(bounds.x), Math.round(bounds.y), Math.round(bounds.width), Math.round(bounds.height));
457
530
  return bounds;
458
531
  }
459
532
 
533
+ /**
534
+ * TBD.
535
+ * @param horizontal - TBD.
536
+ * @param vertical - TBD.
537
+ */
460
538
  alignCanvas(horizontal, vertical) {
461
539
  const parentBounds = this.getParentBounds(this._tempBounds);
462
540
  const canvas = this.game.canvas;
@@ -500,19 +578,22 @@ export class ScaleManager {
500
578
  margin.y = margin.top;
501
579
  }
502
580
 
581
+ /**
582
+ * TBD.
583
+ */
503
584
  reflowGame() {
504
585
  this.resetCanvas('', '');
505
586
  const bounds = this.getParentBounds(this._tempBounds);
506
587
  this.updateDimensions(bounds.width, bounds.height, true);
507
588
  }
508
589
 
590
+ /**
591
+ * TBD.
592
+ */
509
593
  reflowCanvas() {
510
594
  if (!this.incorrectOrientation) {
511
595
  this.width = Math.max(this.minWidth || 0, Math.min(this.maxWidth || this.width, this.width));
512
- this.height = Math.max(
513
- this.minHeight || 0,
514
- Math.min(this.maxHeight || this.height, this.height)
515
- );
596
+ this.height = Math.max(this.minHeight || 0, Math.min(this.maxHeight || this.height, this.height));
516
597
  }
517
598
  this.resetCanvas();
518
599
  if (!this.compatibility.noMargins) {
@@ -525,6 +606,11 @@ export class ScaleManager {
525
606
  this.updateScalingAndBounds();
526
607
  }
527
608
 
609
+ /**
610
+ * TBD.
611
+ * @param cssWidth - TBD.
612
+ * @param cssHeight - TBD.
613
+ */
528
614
  resetCanvas(cssWidth = this.width + 'px', cssHeight = this.height + 'px') {
529
615
  const canvas = this.game.canvas;
530
616
  if (!this.compatibility.noMargins) {
@@ -537,6 +623,10 @@ export class ScaleManager {
537
623
  canvas.style.height = cssHeight;
538
624
  }
539
625
 
626
+ /**
627
+ * TBD.
628
+ * @param force - TBD.
629
+ */
540
630
  queueUpdate(force) {
541
631
  if (force) {
542
632
  this._parentBounds.width = 0;
@@ -545,15 +635,25 @@ export class ScaleManager {
545
635
  this._updateThrottle = this._updateThrottleReset;
546
636
  }
547
637
 
638
+ /**
639
+ * TBD.
640
+ */
548
641
  reset() {
549
642
  // pass
550
643
  }
551
644
 
645
+ /**
646
+ * TBD.
647
+ */
552
648
  setMaximum() {
553
649
  this.width = this.dom.visualBounds.width;
554
650
  this.height = this.dom.visualBounds.height;
555
651
  }
556
652
 
653
+ /**
654
+ * TBD.
655
+ * @param expanding - TBD.
656
+ */
557
657
  setShowAll(expanding = false) {
558
658
  const bounds = this.getParentBounds(this._tempBounds);
559
659
  const width = bounds.width;
@@ -568,6 +668,9 @@ export class ScaleManager {
568
668
  this.height = Math.round(this.game.height * multiplier);
569
669
  }
570
670
 
671
+ /**
672
+ * TBD.
673
+ */
571
674
  setExactFit() {
572
675
  const bounds = this.getParentBounds(this._tempBounds);
573
676
  this.width = bounds.width;
@@ -584,6 +687,9 @@ export class ScaleManager {
584
687
  }
585
688
  }
586
689
 
690
+ /**
691
+ * TBD.
692
+ */
587
693
  createFullScreenTarget() {
588
694
  const fsTarget = document.createElement('div');
589
695
  fsTarget.style.margin = '0';
@@ -592,6 +698,11 @@ export class ScaleManager {
592
698
  return fsTarget;
593
699
  }
594
700
 
701
+ /**
702
+ * TBD.
703
+ * @param antialias - TBD.
704
+ * @param allowTrampoline - TBD.
705
+ */
595
706
  startFullScreen(antialias, allowTrampoline) {
596
707
  if (this.isFullScreen) {
597
708
  return false;
@@ -611,10 +722,7 @@ export class ScaleManager {
611
722
  input.activePointer !== input.mousePointer &&
612
723
  (allowTrampoline || allowTrampoline !== false)
613
724
  ) {
614
- input.activePointer.addClickTrampoline('startFullScreen', this.startFullScreen, this, [
615
- antialias,
616
- false,
617
- ]);
725
+ input.activePointer.addClickTrampoline('startFullScreen', this.startFullScreen, this, [antialias, false]);
618
726
  return false;
619
727
  }
620
728
  }
@@ -645,6 +753,9 @@ export class ScaleManager {
645
753
  return true;
646
754
  }
647
755
 
756
+ /**
757
+ * TBD.
758
+ */
648
759
  stopFullScreen() {
649
760
  if (!this.isFullScreen || !this.compatibility.supportsFullScreen) {
650
761
  return false;
@@ -654,6 +765,9 @@ export class ScaleManager {
654
765
  return true;
655
766
  }
656
767
 
768
+ /**
769
+ * TBD.
770
+ */
657
771
  cleanupCreatedTarget() {
658
772
  const fsTarget = this._createdFullScreenTarget;
659
773
  if (fsTarget && fsTarget.parentNode) {
@@ -666,6 +780,10 @@ export class ScaleManager {
666
780
  this._createdFullScreenTarget = null;
667
781
  }
668
782
 
783
+ /**
784
+ * TBD.
785
+ * @param enteringFullscreen - TBD.
786
+ */
669
787
  prepScreenMode(enteringFullscreen) {
670
788
  const fsTarget = this._createdFullScreenTarget || this.fullScreenTarget;
671
789
  if (!fsTarget) {
@@ -696,6 +814,10 @@ export class ScaleManager {
696
814
  }
697
815
  }
698
816
 
817
+ /**
818
+ * TBD.
819
+ * @param {Event} event - TBD.
820
+ */
699
821
  fullScreenChange(event) {
700
822
  this.event = event;
701
823
  if (this.isFullScreen) {
@@ -711,12 +833,19 @@ export class ScaleManager {
711
833
  this.onFullScreenChange.dispatch(this, this.width, this.height);
712
834
  }
713
835
 
836
+ /**
837
+ * TBD.
838
+ * @param {Event} event - TBD.
839
+ */
714
840
  fullScreenError(event) {
715
841
  this.event = event;
716
842
  this.cleanupCreatedTarget();
717
843
  this.onFullScreenError.dispatch(this);
718
844
  }
719
845
 
846
+ /**
847
+ * TBD.
848
+ */
720
849
  destroy() {
721
850
  this.game.onResume.remove(this._gameResumed, this);
722
851
  window.removeEventListener('orientationchange', this._orientationChange, false);
@@ -734,21 +863,27 @@ export class ScaleManager {
734
863
  }
735
864
  }
736
865
 
866
+ /**
867
+ * TBD.
868
+ */
737
869
  get boundingParent() {
738
- if (
739
- this.parentIsWindow ||
740
- (this.isFullScreen && this.hasPhaserSetFullScreen && !this._createdFullScreenTarget)
741
- ) {
870
+ if (this.parentIsWindow || (this.isFullScreen && this.hasPhaserSetFullScreen && !this._createdFullScreenTarget)) {
742
871
  return null;
743
872
  }
744
873
  const parentNode = this.game.canvas && this.game.canvas.parentNode;
745
874
  return parentNode || null;
746
875
  }
747
876
 
877
+ /**
878
+ * TBD.
879
+ */
748
880
  get scaleMode() {
749
881
  return this._scaleMode;
750
882
  }
751
883
 
884
+ /**
885
+ * TBD.
886
+ */
752
887
  set scaleMode(value) {
753
888
  if (value !== this._scaleMode) {
754
889
  if (!this.isFullScreen) {
@@ -760,10 +895,16 @@ export class ScaleManager {
760
895
  // return this._scaleMode;
761
896
  }
762
897
 
898
+ /**
899
+ * TBD.
900
+ */
763
901
  get fullScreenScaleMode() {
764
902
  return this._fullScreenScaleMode;
765
903
  }
766
904
 
905
+ /**
906
+ * TBD.
907
+ */
767
908
  set fullScreenScaleMode(value) {
768
909
  if (value !== this._fullScreenScaleMode) {
769
910
  // If in fullscreen then need a wee bit more work
@@ -779,18 +920,30 @@ export class ScaleManager {
779
920
  // return this._fullScreenScaleMode;
780
921
  }
781
922
 
923
+ /**
924
+ * TBD.
925
+ */
782
926
  get currentScaleMode() {
783
927
  return this.isFullScreen ? this._fullScreenScaleMode : this._scaleMode;
784
928
  }
785
929
 
930
+ /**
931
+ * TBD.
932
+ */
786
933
  get pageAlignHorizontally() {
787
934
  return this._pageAlignHorizontally;
788
935
  }
789
936
 
937
+ /**
938
+ * TBD.
939
+ */
790
940
  get pageAlignVertically() {
791
941
  return this._pageAlignVertically;
792
942
  }
793
943
 
944
+ /**
945
+ * TBD.
946
+ */
794
947
  get isFullScreen() {
795
948
  return !!(
796
949
  document.fullscreenElement ||
@@ -800,18 +953,30 @@ export class ScaleManager {
800
953
  );
801
954
  }
802
955
 
956
+ /**
957
+ * TBD.
958
+ */
803
959
  get isPortrait() {
804
960
  return this.classifyOrientation(this.screenOrientation) === 'portrait';
805
961
  }
806
962
 
963
+ /**
964
+ * TBD.
965
+ */
807
966
  get isLandscape() {
808
967
  return this.classifyOrientation(this.screenOrientation) === 'landscape';
809
968
  }
810
969
 
970
+ /**
971
+ * TBD.
972
+ */
811
973
  get isGamePortrait() {
812
974
  return this.height > this.width;
813
975
  }
814
976
 
977
+ /**
978
+ * TBD.
979
+ */
815
980
  get isGameLandscape() {
816
981
  return this.width > this.height;
817
982
  }
@@ -1,38 +1,57 @@
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
  export class Scene {
2
+ /**
3
+ * TBD.
4
+ */
7
5
  constructor() {
8
6
  this.game = null;
9
7
  this.key = '';
10
8
  }
11
9
 
10
+ /**
11
+ * TBD.
12
+ */
12
13
  init() {
13
14
  // inherit
14
15
  }
15
16
 
17
+ /**
18
+ * TBD.
19
+ */
16
20
  preload() {
17
21
  // inherit
18
22
  }
19
23
 
24
+ /**
25
+ * TBD.
26
+ */
20
27
  create() {
21
28
  // inherit
22
29
  }
23
30
 
31
+ /**
32
+ * TBD.
33
+ */
24
34
  update() {
25
35
  // inherit
26
36
  }
27
37
 
38
+ /**
39
+ * TBD.
40
+ */
28
41
  resize() {
29
42
  // inherit
30
43
  }
31
44
 
45
+ /**
46
+ * TBD.
47
+ */
32
48
  pauseUpdate() {
33
49
  // inherit
34
50
  }
35
51
 
52
+ /**
53
+ * TBD.
54
+ */
36
55
  shutdown() {
37
56
  // inherit
38
57
  }