@vpmedia/phaser 1.16.0 → 1.18.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 (183) hide show
  1. package/README.md +1 -1
  2. package/package.json +3 -3
  3. package/src/phaser/core/animation.js +31 -18
  4. package/src/phaser/core/animation_manager.js +36 -21
  5. package/src/phaser/core/animation_parser.js +1 -1
  6. package/src/phaser/core/array_set.js +17 -9
  7. package/src/phaser/core/cache.js +61 -45
  8. package/src/phaser/core/const.js +66 -0
  9. package/src/phaser/core/device.js +87 -0
  10. package/src/phaser/core/dom.js +13 -8
  11. package/src/phaser/core/event_manager.js +2 -1
  12. package/src/phaser/core/factory.js +21 -21
  13. package/src/phaser/core/frame_data.js +1 -1
  14. package/src/phaser/core/game.js +1 -0
  15. package/src/phaser/core/input.js +37 -20
  16. package/src/phaser/core/input_handler.js +1 -1
  17. package/src/phaser/core/input_mouse.js +16 -12
  18. package/src/phaser/core/input_mspointer.js +7 -7
  19. package/src/phaser/core/input_pointer.js +26 -17
  20. package/src/phaser/core/input_touch.js +7 -7
  21. package/src/phaser/core/loader.js +104 -75
  22. package/src/phaser/core/raf.js +1 -1
  23. package/src/phaser/core/scale_manager.js +46 -29
  24. package/src/phaser/core/scene_manager.js +13 -9
  25. package/src/phaser/core/sound.js +3 -3
  26. package/src/phaser/core/sound_manager.js +17 -10
  27. package/src/phaser/core/sound_sprite.js +7 -4
  28. package/src/phaser/core/timer.js +38 -26
  29. package/src/phaser/core/timer_event.js +10 -8
  30. package/src/phaser/core/tween.js +66 -46
  31. package/src/phaser/core/tween_data.js +22 -15
  32. package/src/phaser/core/tween_manager.js +10 -6
  33. package/src/phaser/display/bitmap_text.js +7 -6
  34. package/src/phaser/display/canvas/pool.js +1 -1
  35. package/src/phaser/display/canvas/renderer.js +5 -4
  36. package/src/phaser/display/canvas/util.js +2 -2
  37. package/src/phaser/display/display_object.js +33 -16
  38. package/src/phaser/display/graphics.js +57 -36
  39. package/src/phaser/display/graphics_data.js +7 -7
  40. package/src/phaser/display/group.js +28 -20
  41. package/src/phaser/display/image.js +19 -12
  42. package/src/phaser/display/sprite_util.js +3 -2
  43. package/src/phaser/display/text.js +27 -14
  44. package/src/phaser/display/webgl/abstract_filter.js +2 -2
  45. package/src/phaser/display/webgl/base_texture.js +2 -2
  46. package/src/phaser/display/webgl/blend_manager.js +3 -2
  47. package/src/phaser/display/webgl/earcut_node.js +1 -1
  48. package/src/phaser/display/webgl/fast_sprite_batch.js +6 -6
  49. package/src/phaser/display/webgl/filter_manager.js +1 -1
  50. package/src/phaser/display/webgl/filter_texture.js +2 -2
  51. package/src/phaser/display/webgl/graphics_data.js +1 -1
  52. package/src/phaser/display/webgl/render_texture.js +7 -3
  53. package/src/phaser/display/webgl/renderer.js +9 -6
  54. package/src/phaser/display/webgl/shader/complex.js +1 -1
  55. package/src/phaser/display/webgl/shader/fast.js +1 -1
  56. package/src/phaser/display/webgl/shader/normal.js +2 -2
  57. package/src/phaser/display/webgl/shader/primitive.js +1 -1
  58. package/src/phaser/display/webgl/shader/strip.js +1 -1
  59. package/src/phaser/display/webgl/shader_manager.js +3 -3
  60. package/src/phaser/display/webgl/sprite_batch.js +9 -7
  61. package/src/phaser/display/webgl/stencil_manager.js +7 -7
  62. package/src/phaser/display/webgl/texture.js +8 -6
  63. package/types/phaser/core/animation.d.ts +43 -30
  64. package/types/phaser/core/animation.d.ts.map +1 -1
  65. package/types/phaser/core/animation_manager.d.ts +59 -43
  66. package/types/phaser/core/animation_manager.d.ts.map +1 -1
  67. package/types/phaser/core/animation_parser.d.ts +2 -2
  68. package/types/phaser/core/array_set.d.ts +24 -16
  69. package/types/phaser/core/array_set.d.ts.map +1 -1
  70. package/types/phaser/core/cache.d.ts +79 -73
  71. package/types/phaser/core/cache.d.ts.map +1 -1
  72. package/types/phaser/core/const.d.ts +88 -22
  73. package/types/phaser/core/const.d.ts.map +1 -1
  74. package/types/phaser/core/device.d.ts +87 -0
  75. package/types/phaser/core/device.d.ts.map +1 -1
  76. package/types/phaser/core/dom.d.ts +19 -27
  77. package/types/phaser/core/dom.d.ts.map +1 -1
  78. package/types/phaser/core/event_manager.d.ts +4 -3
  79. package/types/phaser/core/event_manager.d.ts.map +1 -1
  80. package/types/phaser/core/factory.d.ts +28 -28
  81. package/types/phaser/core/factory.d.ts.map +1 -1
  82. package/types/phaser/core/frame_data.d.ts +2 -2
  83. package/types/phaser/core/frame_data.d.ts.map +1 -1
  84. package/types/phaser/core/game.d.ts +1 -0
  85. package/types/phaser/core/game.d.ts.map +1 -1
  86. package/types/phaser/core/input.d.ts +51 -34
  87. package/types/phaser/core/input.d.ts.map +1 -1
  88. package/types/phaser/core/input_handler.d.ts +2 -2
  89. package/types/phaser/core/input_handler.d.ts.map +1 -1
  90. package/types/phaser/core/input_mouse.d.ts +20 -19
  91. package/types/phaser/core/input_mouse.d.ts.map +1 -1
  92. package/types/phaser/core/input_mspointer.d.ts +15 -15
  93. package/types/phaser/core/input_mspointer.d.ts.map +1 -1
  94. package/types/phaser/core/input_pointer.d.ts +39 -30
  95. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  96. package/types/phaser/core/input_touch.d.ts +15 -15
  97. package/types/phaser/core/input_touch.d.ts.map +1 -1
  98. package/types/phaser/core/loader.d.ts +118 -92
  99. package/types/phaser/core/loader.d.ts.map +1 -1
  100. package/types/phaser/core/raf.d.ts +3 -3
  101. package/types/phaser/core/raf.d.ts.map +1 -1
  102. package/types/phaser/core/scale_manager.d.ts +68 -51
  103. package/types/phaser/core/scale_manager.d.ts.map +1 -1
  104. package/types/phaser/core/scene_manager.d.ts +18 -13
  105. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  106. package/types/phaser/core/sound.d.ts +4 -4
  107. package/types/phaser/core/sound.d.ts.map +1 -1
  108. package/types/phaser/core/sound_manager.d.ts +22 -15
  109. package/types/phaser/core/sound_manager.d.ts.map +1 -1
  110. package/types/phaser/core/sound_sprite.d.ts +10 -7
  111. package/types/phaser/core/sound_sprite.d.ts.map +1 -1
  112. package/types/phaser/core/timer.d.ts +47 -35
  113. package/types/phaser/core/timer.d.ts.map +1 -1
  114. package/types/phaser/core/timer_event.d.ts +15 -14
  115. package/types/phaser/core/timer_event.d.ts.map +1 -1
  116. package/types/phaser/core/tween.d.ts +81 -61
  117. package/types/phaser/core/tween.d.ts.map +1 -1
  118. package/types/phaser/core/tween_data.d.ts +26 -19
  119. package/types/phaser/core/tween_data.d.ts.map +1 -1
  120. package/types/phaser/core/tween_manager.d.ts +16 -12
  121. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  122. package/types/phaser/display/bitmap_text.d.ts +10 -9
  123. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  124. package/types/phaser/display/canvas/buffer.d.ts +2 -2
  125. package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
  126. package/types/phaser/display/canvas/pool.d.ts +2 -2
  127. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  128. package/types/phaser/display/canvas/renderer.d.ts +5 -4
  129. package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
  130. package/types/phaser/display/canvas/util.d.ts +2 -2
  131. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  132. package/types/phaser/display/display_object.d.ts +50 -33
  133. package/types/phaser/display/display_object.d.ts.map +1 -1
  134. package/types/phaser/display/graphics.d.ts +65 -47
  135. package/types/phaser/display/graphics.d.ts.map +1 -1
  136. package/types/phaser/display/graphics_data.d.ts +16 -16
  137. package/types/phaser/display/graphics_data.d.ts.map +1 -1
  138. package/types/phaser/display/group.d.ts +38 -30
  139. package/types/phaser/display/group.d.ts.map +1 -1
  140. package/types/phaser/display/image.d.ts +24 -23
  141. package/types/phaser/display/image.d.ts.map +1 -1
  142. package/types/phaser/display/sprite_util.d.ts +5 -4
  143. package/types/phaser/display/sprite_util.d.ts.map +1 -1
  144. package/types/phaser/display/text.d.ts +33 -55
  145. package/types/phaser/display/text.d.ts.map +1 -1
  146. package/types/phaser/display/webgl/abstract_filter.d.ts +3 -3
  147. package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  148. package/types/phaser/display/webgl/base_texture.d.ts +4 -4
  149. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
  150. package/types/phaser/display/webgl/blend_manager.d.ts +6 -5
  151. package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  152. package/types/phaser/display/webgl/earcut_node.d.ts +3 -3
  153. package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  154. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +12 -12
  155. package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  156. package/types/phaser/display/webgl/filter_manager.d.ts +3 -3
  157. package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  158. package/types/phaser/display/webgl/filter_texture.d.ts +7 -7
  159. package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  160. package/types/phaser/display/webgl/graphics_data.d.ts +5 -5
  161. package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  162. package/types/phaser/display/webgl/render_texture.d.ts +9 -9
  163. package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
  164. package/types/phaser/display/webgl/renderer.d.ts +10 -7
  165. package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
  166. package/types/phaser/display/webgl/shader/complex.d.ts +11 -11
  167. package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  168. package/types/phaser/display/webgl/shader/fast.d.ts +15 -15
  169. package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  170. package/types/phaser/display/webgl/shader/normal.d.ts +11 -11
  171. package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  172. package/types/phaser/display/webgl/shader/primitive.d.ts +12 -12
  173. package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  174. package/types/phaser/display/webgl/shader/strip.d.ts +12 -12
  175. package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  176. package/types/phaser/display/webgl/shader_manager.d.ts +5 -5
  177. package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  178. package/types/phaser/display/webgl/sprite_batch.d.ts +16 -14
  179. package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  180. package/types/phaser/display/webgl/stencil_manager.d.ts +12 -12
  181. package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  182. package/types/phaser/display/webgl/texture.d.ts +15 -12
  183. package/types/phaser/display/webgl/texture.d.ts.map +1 -1
@@ -139,7 +139,7 @@ export class ScaleManager {
139
139
 
140
140
  /**
141
141
  * TBD.
142
- * @param config
142
+ * @param {object} config - TBD.
143
143
  */
144
144
  parseConfig(config) {
145
145
  if (config.scaleMode !== undefined) {
@@ -236,10 +236,10 @@ export class ScaleManager {
236
236
 
237
237
  /**
238
238
  * TBD.
239
- * @param hScale
240
- * @param vScale
241
- * @param hTrim
242
- * @param vTrim
239
+ * @param {number} hScale - TBD.
240
+ * @param {number} vScale - TBD.
241
+ * @param {number} hTrim - TBD.
242
+ * @param {number} vTrim - TBD.
243
243
  */
244
244
  setUserScale(hScale, vScale, hTrim, vTrim) {
245
245
  this._userScaleFactor.setTo(hScale, vScale);
@@ -249,8 +249,8 @@ export class ScaleManager {
249
249
 
250
250
  /**
251
251
  * TBD.
252
- * @param callback - TBD.
253
- * @param context
252
+ * @param {Function} callback - TBD.
253
+ * @param {object} context - TBD.
254
254
  */
255
255
  setResizeCallback(callback, context) {
256
256
  this.onResize = callback;
@@ -282,10 +282,10 @@ export class ScaleManager {
282
282
 
283
283
  /**
284
284
  * TBD.
285
- * @param minWidth
286
- * @param minHeight
287
- * @param maxWidth
288
- * @param maxHeight
285
+ * @param {number} minWidth - TBD.
286
+ * @param {number} minHeight - TBD.
287
+ * @param {number} maxWidth - TBD.
288
+ * @param {number} maxHeight - TBD.
289
289
  */
290
290
  setMinMax(minWidth, minHeight, maxWidth, maxHeight) {
291
291
  this.minWidth = minWidth;
@@ -344,7 +344,7 @@ export class ScaleManager {
344
344
  * TBD.
345
345
  * @param {number} width - TBD.
346
346
  * @param {number} height - TBD.
347
- * @param resize
347
+ * @param {boolean} resize - TBD.
348
348
  */
349
349
  updateDimensions(width, height, resize) {
350
350
  this.width = width * this.parentScaleFactor.x;
@@ -381,8 +381,8 @@ export class ScaleManager {
381
381
 
382
382
  /**
383
383
  * TBD.
384
- * @param forceLandscape
385
- * @param forcePortrait
384
+ * @param {boolean} forceLandscape - TBD.
385
+ * @param {boolean} forcePortrait - TBD.
386
386
  */
387
387
  forceOrientation(forceLandscape = false, forcePortrait = false) {
388
388
  this.forceLandscape = forceLandscape;
@@ -392,7 +392,8 @@ export class ScaleManager {
392
392
 
393
393
  /**
394
394
  * TBD.
395
- * @param orientation
395
+ * @param {string} orientation - TBD.
396
+ * @returns {string} TBD.
396
397
  */
397
398
  classifyOrientation(orientation) {
398
399
  if (orientation === 'portrait-primary' || orientation === 'portrait-secondary') {
@@ -405,6 +406,7 @@ export class ScaleManager {
405
406
 
406
407
  /**
407
408
  * TBD.
409
+ * @returns {boolean} TBD.
408
410
  */
409
411
  updateOrientationState() {
410
412
  const previousOrientation = this.screenOrientation;
@@ -428,7 +430,7 @@ export class ScaleManager {
428
430
 
429
431
  /**
430
432
  * TBD.
431
- * @param event
433
+ * @param {Event} event - TBD.
432
434
  */
433
435
  orientationChange(event) {
434
436
  this.event = event;
@@ -437,7 +439,7 @@ export class ScaleManager {
437
439
 
438
440
  /**
439
441
  * TBD.
440
- * @param event
442
+ * @param {Event} event - TBD.
441
443
  */
442
444
  windowResize(event) {
443
445
  this.event = event;
@@ -495,7 +497,8 @@ export class ScaleManager {
495
497
 
496
498
  /**
497
499
  * TBD.
498
- * @param target - TBD.
500
+ * @param {Rectangle} target - TBD.
501
+ * @returns {Rectangle} TBD.
499
502
  */
500
503
  getParentBounds(target) {
501
504
  const bounds = target || new Rectangle();
@@ -532,8 +535,8 @@ export class ScaleManager {
532
535
 
533
536
  /**
534
537
  * TBD.
535
- * @param horizontal
536
- * @param vertical
538
+ * @param {boolean} horizontal - TBD.
539
+ * @param {boolean} vertical - TBD.
537
540
  */
538
541
  alignCanvas(horizontal, vertical) {
539
542
  const parentBounds = this.getParentBounds(this._tempBounds);
@@ -608,8 +611,8 @@ export class ScaleManager {
608
611
 
609
612
  /**
610
613
  * TBD.
611
- * @param cssWidth
612
- * @param cssHeight
614
+ * @param {string} cssWidth - TBD.
615
+ * @param {string} cssHeight - TBD.
613
616
  */
614
617
  resetCanvas(cssWidth = this.width + 'px', cssHeight = this.height + 'px') {
615
618
  const canvas = this.game.canvas;
@@ -625,7 +628,7 @@ export class ScaleManager {
625
628
 
626
629
  /**
627
630
  * TBD.
628
- * @param force
631
+ * @param {boolean} force - TBD.
629
632
  */
630
633
  queueUpdate(force) {
631
634
  if (force) {
@@ -652,7 +655,7 @@ export class ScaleManager {
652
655
 
653
656
  /**
654
657
  * TBD.
655
- * @param expanding
658
+ * @param {boolean} expanding - TBD.
656
659
  */
657
660
  setShowAll(expanding = false) {
658
661
  const bounds = this.getParentBounds(this._tempBounds);
@@ -689,6 +692,7 @@ export class ScaleManager {
689
692
 
690
693
  /**
691
694
  * TBD.
695
+ * @returns {HTMLDivElement} TBD.
692
696
  */
693
697
  createFullScreenTarget() {
694
698
  const fsTarget = document.createElement('div');
@@ -700,8 +704,9 @@ export class ScaleManager {
700
704
 
701
705
  /**
702
706
  * TBD.
703
- * @param antialias
704
- * @param allowTrampoline
707
+ * @param {boolean} antialias - TBD.
708
+ * @param {boolean} allowTrampoline - TBD.
709
+ * @returns {boolean} TBD.
705
710
  */
706
711
  startFullScreen(antialias, allowTrampoline) {
707
712
  if (this.isFullScreen) {
@@ -755,6 +760,7 @@ export class ScaleManager {
755
760
 
756
761
  /**
757
762
  * TBD.
763
+ * @returns {boolean} TBD.
758
764
  */
759
765
  stopFullScreen() {
760
766
  if (!this.isFullScreen || !this.compatibility.supportsFullScreen) {
@@ -782,7 +788,7 @@ export class ScaleManager {
782
788
 
783
789
  /**
784
790
  * TBD.
785
- * @param enteringFullscreen
791
+ * @param {boolean} enteringFullscreen - TBD.
786
792
  */
787
793
  prepScreenMode(enteringFullscreen) {
788
794
  const fsTarget = this._createdFullScreenTarget || this.fullScreenTarget;
@@ -816,7 +822,7 @@ export class ScaleManager {
816
822
 
817
823
  /**
818
824
  * TBD.
819
- * @param event
825
+ * @param {Event} event - TBD.
820
826
  */
821
827
  fullScreenChange(event) {
822
828
  this.event = event;
@@ -835,7 +841,7 @@ export class ScaleManager {
835
841
 
836
842
  /**
837
843
  * TBD.
838
- * @param event
844
+ * @param {Event} event - TBD.
839
845
  */
840
846
  fullScreenError(event) {
841
847
  this.event = event;
@@ -865,6 +871,7 @@ export class ScaleManager {
865
871
 
866
872
  /**
867
873
  * TBD.
874
+ * @returns {object} TBD.
868
875
  */
869
876
  get boundingParent() {
870
877
  if (this.parentIsWindow || (this.isFullScreen && this.hasPhaserSetFullScreen && !this._createdFullScreenTarget)) {
@@ -876,6 +883,7 @@ export class ScaleManager {
876
883
 
877
884
  /**
878
885
  * TBD.
886
+ * @returns {number} TBD.
879
887
  */
880
888
  get scaleMode() {
881
889
  return this._scaleMode;
@@ -897,6 +905,7 @@ export class ScaleManager {
897
905
 
898
906
  /**
899
907
  * TBD.
908
+ * @returns {number} TBD.
900
909
  */
901
910
  get fullScreenScaleMode() {
902
911
  return this._fullScreenScaleMode;
@@ -922,6 +931,7 @@ export class ScaleManager {
922
931
 
923
932
  /**
924
933
  * TBD.
934
+ * @returns {number} TBD.
925
935
  */
926
936
  get currentScaleMode() {
927
937
  return this.isFullScreen ? this._fullScreenScaleMode : this._scaleMode;
@@ -929,6 +939,7 @@ export class ScaleManager {
929
939
 
930
940
  /**
931
941
  * TBD.
942
+ * @returns {boolean} TBD.
932
943
  */
933
944
  get pageAlignHorizontally() {
934
945
  return this._pageAlignHorizontally;
@@ -936,6 +947,7 @@ export class ScaleManager {
936
947
 
937
948
  /**
938
949
  * TBD.
950
+ * @returns {boolean} TBD.
939
951
  */
940
952
  get pageAlignVertically() {
941
953
  return this._pageAlignVertically;
@@ -943,6 +955,7 @@ export class ScaleManager {
943
955
 
944
956
  /**
945
957
  * TBD.
958
+ * @returns {boolean} TBD.
946
959
  */
947
960
  get isFullScreen() {
948
961
  return !!(
@@ -955,6 +968,7 @@ export class ScaleManager {
955
968
 
956
969
  /**
957
970
  * TBD.
971
+ * @returns {boolean} TBD.
958
972
  */
959
973
  get isPortrait() {
960
974
  return this.classifyOrientation(this.screenOrientation) === 'portrait';
@@ -962,6 +976,7 @@ export class ScaleManager {
962
976
 
963
977
  /**
964
978
  * TBD.
979
+ * @returns {boolean} TBD.
965
980
  */
966
981
  get isLandscape() {
967
982
  return this.classifyOrientation(this.screenOrientation) === 'landscape';
@@ -969,6 +984,7 @@ export class ScaleManager {
969
984
 
970
985
  /**
971
986
  * TBD.
987
+ * @returns {boolean} TBD.
972
988
  */
973
989
  get isGamePortrait() {
974
990
  return this.height > this.width;
@@ -976,6 +992,7 @@ export class ScaleManager {
976
992
 
977
993
  /**
978
994
  * TBD.
995
+ * @returns {boolean} TBD.
979
996
  */
980
997
  get isGameLandscape() {
981
998
  return this.width > this.height;
@@ -5,7 +5,7 @@ export class SceneManager {
5
5
  /**
6
6
  * TBD.
7
7
  * @param {Game} game - TBD.
8
- * @param pendingState
8
+ * @param {string} pendingState - TBD.
9
9
  */
10
10
  constructor(game, pendingState) {
11
11
  this.game = game;
@@ -40,8 +40,9 @@ export class SceneManager {
40
40
  /**
41
41
  * TBD.
42
42
  * @param {string} key - TBD.
43
- * @param state
44
- * @param autoStart
43
+ * @param state - TBD.
44
+ * @param {boolean} autoStart - TBD.
45
+ * @returns {Scene|object} TBD.
45
46
  */
46
47
  add(key, state, autoStart = false) {
47
48
  let newState = null;
@@ -85,9 +86,9 @@ export class SceneManager {
85
86
  /**
86
87
  * TBD.
87
88
  * @param {string} key - TBD.
88
- * @param clearWorld
89
- * @param clearCache
90
- * @param {...any} args
89
+ * @param {boolean} clearWorld - TBD.
90
+ * @param {boolean} clearCache - TBD.
91
+ * @param {...any} args - TBD.
91
92
  */
92
93
  start(key, clearWorld = true, clearCache = false, ...args) {
93
94
  if (this.checkState(key)) {
@@ -103,9 +104,9 @@ export class SceneManager {
103
104
 
104
105
  /**
105
106
  * TBD.
106
- * @param clearWorld
107
- * @param clearCache
108
- * @param {...any} args
107
+ * @param {boolean} clearWorld - TBD.
108
+ * @param {boolean} clearCache - TBD.
109
+ * @param {...any} args - TBD.
109
110
  */
110
111
  restart(clearWorld = true, clearCache = false, ...args) {
111
112
  this._pendingState = this.current;
@@ -174,6 +175,7 @@ export class SceneManager {
174
175
  /**
175
176
  * TBD.
176
177
  * @param {string} key - TBD.
178
+ * @returns {boolean} TBD.
177
179
  */
178
180
  checkState(key) {
179
181
  if (this.states[key]) {
@@ -230,6 +232,7 @@ export class SceneManager {
230
232
 
231
233
  /**
232
234
  * TBD.
235
+ * @returns {Scene} TBD.
233
236
  */
234
237
  getCurrentState() {
235
238
  return this.states[this.current];
@@ -305,6 +308,7 @@ export class SceneManager {
305
308
 
306
309
  /**
307
310
  * TBD.
311
+ * @returns {boolean} TBD.
308
312
  */
309
313
  get created() {
310
314
  return this._created;
@@ -6,9 +6,9 @@ export class Sound {
6
6
  * TBD.
7
7
  * @param {Game} game - TBD.
8
8
  * @param {string} key - TBD.
9
- * @param volume - TBD.
10
- * @param loop - TBD.
11
- * @param connect - TBD.
9
+ * @param {number} volume - TBD.
10
+ * @param {boolean} loop - TBD.
11
+ * @param {boolean} connect - TBD.
12
12
  */
13
13
  constructor(game, key, volume = 1, loop = false, connect = null) {
14
14
  // TODO
@@ -124,7 +124,7 @@ export class SoundManager {
124
124
 
125
125
  /**
126
126
  * TBD.
127
- * @param event
127
+ * @param {Event} event - TBD.
128
128
  */
129
129
  onUnlockEvent(event) {
130
130
  const initialState = this.context.state;
@@ -229,9 +229,9 @@ export class SoundManager {
229
229
 
230
230
  /**
231
231
  * TBD.
232
- * @param files
233
- * @param callback - TBD.
234
- * @param callbackContext
232
+ * @param {Sound[]|string[]} files - TBD.
233
+ * @param {Function} callback - TBD.
234
+ * @param {object} callbackContext - TBD.
235
235
  */
236
236
  setDecodedCallback(files, callback, callbackContext) {
237
237
  if (typeof files === 'string') {
@@ -286,9 +286,10 @@ export class SoundManager {
286
286
  /**
287
287
  * TBD.
288
288
  * @param {string} key - TBD.
289
- * @param volume - TBD.
290
- * @param loop
291
- * @param connect
289
+ * @param {number} volume - TBD.
290
+ * @param {boolean} loop - TBD.
291
+ * @param {boolean} connect - TBD.
292
+ * @returns {Sound} TBD.
292
293
  */
293
294
  add(key, volume = 1, loop = false, connect = this.connectToMaster) {
294
295
  const sound = new Sound(this.game, key, volume, loop, connect);
@@ -299,6 +300,7 @@ export class SoundManager {
299
300
  /**
300
301
  * TBD.
301
302
  * @param {string} key - TBD.
303
+ * @returns {SoundSprite} TBD.
302
304
  */
303
305
  addSprite(key) {
304
306
  return new SoundSprite(this.game, key);
@@ -306,7 +308,8 @@ export class SoundManager {
306
308
 
307
309
  /**
308
310
  * TBD.
309
- * @param sound
311
+ * @param {Sound} sound - TBD.
312
+ * @returns {boolean} TBD.
310
313
  */
311
314
  remove(sound) {
312
315
  let i = this._sounds.length;
@@ -324,6 +327,7 @@ export class SoundManager {
324
327
  /**
325
328
  * TBD.
326
329
  * @param {string} key - TBD.
330
+ * @returns {number} TBD.
327
331
  */
328
332
  removeByKey(key) {
329
333
  let i = this._sounds.length;
@@ -342,8 +346,9 @@ export class SoundManager {
342
346
  /**
343
347
  * TBD.
344
348
  * @param {string} key - TBD.
345
- * @param volume - TBD.
346
- * @param loop
349
+ * @param {number} volume - TBD.
350
+ * @param {boolean} loop - TBD.
351
+ * @returns {Sound} TBD.
347
352
  */
348
353
  play(key, volume = 1, loop = false) {
349
354
  if (this.noAudio) {
@@ -406,6 +411,7 @@ export class SoundManager {
406
411
 
407
412
  /**
408
413
  * TBD.
414
+ * @returns {boolean} TBD.
409
415
  */
410
416
  get mute() {
411
417
  return this._muted;
@@ -432,6 +438,7 @@ export class SoundManager {
432
438
 
433
439
  /**
434
440
  * TBD.
441
+ * @returns {number} TBD.
435
442
  */
436
443
  get volume() {
437
444
  return this._volume;
@@ -1,4 +1,5 @@
1
1
  import { Game } from './game';
2
+ import { Sound } from './sound';
2
3
 
3
4
  export class SoundSprite {
4
5
  /**
@@ -28,8 +29,9 @@ export class SoundSprite {
28
29
 
29
30
  /**
30
31
  * TBD.
31
- * @param marker
32
- * @param volume - TBD.
32
+ * @param {string} marker - TBD.
33
+ * @param {number} volume - TBD.
34
+ * @returns {Sound} TBD.
33
35
  */
34
36
  play(marker, volume = 1) {
35
37
  return this.sounds[marker].play(marker, null, volume);
@@ -37,7 +39,7 @@ export class SoundSprite {
37
39
 
38
40
  /**
39
41
  * TBD.
40
- * @param marker
42
+ * @param {string} marker - TBD.
41
43
  */
42
44
  stop(marker) {
43
45
  if (!marker) {
@@ -51,7 +53,8 @@ export class SoundSprite {
51
53
 
52
54
  /**
53
55
  * TBD.
54
- * @param marker
56
+ * @param {string} marker - TBD.
57
+ * @returns {Sound} TBD.
55
58
  */
56
59
  get(marker) {
57
60
  return this.sounds[marker];
@@ -33,12 +33,13 @@ export class Timer {
33
33
 
34
34
  /**
35
35
  * TBD.
36
- * @param delay - TBD.
37
- * @param loop
38
- * @param repeatCount
39
- * @param callback - TBD.
40
- * @param callbackContext
41
- * @param args - TBD.
36
+ * @param {number} delay - TBD.
37
+ * @param {boolean} loop - TBD.
38
+ * @param {number} repeatCount - TBD.
39
+ * @param {Function} callback - TBD.
40
+ * @param {object} callbackContext - TBD.
41
+ * @param {...any} args - TBD.
42
+ * @returns {TimerEvent} TBD.
42
43
  */
43
44
  create(delay, loop, repeatCount, callback, callbackContext, args) {
44
45
  const roundedDelay = Math.round(delay);
@@ -57,10 +58,11 @@ export class Timer {
57
58
 
58
59
  /**
59
60
  * TBD.
60
- * @param delay - TBD.
61
- * @param callback - TBD.
62
- * @param callbackContext
63
- * @param {...any} args
61
+ * @param {number} delay - TBD.
62
+ * @param {Function} callback - TBD.
63
+ * @param {object} callbackContext - TBD.
64
+ * @param {...any} args - TBD.
65
+ * @returns {TimerEvent} TBD.
64
66
  */
65
67
  add(delay, callback, callbackContext, ...args) {
66
68
  return this.create(delay, false, 0, callback, callbackContext, args);
@@ -68,11 +70,12 @@ export class Timer {
68
70
 
69
71
  /**
70
72
  * TBD.
71
- * @param delay - TBD.
72
- * @param repeatCount
73
- * @param callback - TBD.
74
- * @param callbackContext
75
- * @param {...any} args
73
+ * @param {number} delay - TBD.
74
+ * @param {number} repeatCount - TBD.
75
+ * @param {Function} callback - TBD.
76
+ * @param {object} callbackContext - TBD.
77
+ * @param {...any} args - TBD.
78
+ * @returns {TimerEvent} TBD.
76
79
  */
77
80
  repeat(delay, repeatCount, callback, callbackContext, ...args) {
78
81
  return this.create(delay, false, repeatCount, callback, callbackContext, args);
@@ -80,10 +83,11 @@ export class Timer {
80
83
 
81
84
  /**
82
85
  * TBD.
83
- * @param delay - TBD.
84
- * @param callback - TBD.
85
- * @param callbackContext
86
- * @param {...any} args
86
+ * @param {number} delay - TBD.
87
+ * @param {Function} callback - TBD.
88
+ * @param {object} callbackContext - TBD.
89
+ * @param {...any} args - TBD.
90
+ * @returns {TimerEvent} TBD.
87
91
  */
88
92
  loop(delay, callback, callbackContext, ...args) {
89
93
  return this.create(delay, true, 0, callback, callbackContext, args);
@@ -91,7 +95,7 @@ export class Timer {
91
95
 
92
96
  /**
93
97
  * TBD.
94
- * @param delay - TBD.
98
+ * @param {number} delay - TBD.
95
99
  */
96
100
  start(delay) {
97
101
  if (this.running) {
@@ -106,7 +110,7 @@ export class Timer {
106
110
 
107
111
  /**
108
112
  * TBD.
109
- * @param clearEvents
113
+ * @param {boolean} clearEvents - TBD.
110
114
  */
111
115
  stop(clearEvents = true) {
112
116
  this.running = false;
@@ -117,7 +121,8 @@ export class Timer {
117
121
 
118
122
  /**
119
123
  * TBD.
120
- * @param event
124
+ * @param {Event} event - TBD.
125
+ * @returns {boolean} TBD.
121
126
  */
122
127
  remove(event) {
123
128
  for (let i = 0; i < this.events.length; i += 1) {
@@ -142,8 +147,9 @@ export class Timer {
142
147
 
143
148
  /**
144
149
  * TBD.
145
- * @param a
146
- * @param b
150
+ * @param {TimerEvent} a - TBD.
151
+ * @param {TimerEvent} b - TBD.
152
+ * @returns {number} TBD.
147
153
  */
148
154
  sortHandler(a, b) {
149
155
  if (a.tick < b.tick) {
@@ -171,7 +177,8 @@ export class Timer {
171
177
 
172
178
  /**
173
179
  * TBD.
174
- * @param time
180
+ * @param {number} time - TBD.
181
+ * @returns {boolean} TBD.
175
182
  */
176
183
  update(time) {
177
184
  if (this.paused) {
@@ -256,7 +263,7 @@ export class Timer {
256
263
 
257
264
  /**
258
265
  * TBD.
259
- * @param baseTime
266
+ * @param {number} baseTime - TBD.
260
267
  */
261
268
  adjustEvents(baseTime) {
262
269
  for (let i = 0; i < this.events.length; i += 1) {
@@ -326,6 +333,7 @@ export class Timer {
326
333
 
327
334
  /**
328
335
  * TBD.
336
+ * @returns {number} TBD.
329
337
  */
330
338
  get next() {
331
339
  return this.nextTick;
@@ -333,6 +341,7 @@ export class Timer {
333
341
 
334
342
  /**
335
343
  * TBD.
344
+ * @returns {number} TBD.
336
345
  */
337
346
  get duration() {
338
347
  if (this.running && this.nextTick > this._now) {
@@ -343,6 +352,7 @@ export class Timer {
343
352
 
344
353
  /**
345
354
  * TBD.
355
+ * @returns {number} TBD.
346
356
  */
347
357
  get length() {
348
358
  return this.events.length;
@@ -350,6 +360,7 @@ export class Timer {
350
360
 
351
361
  /**
352
362
  * TBD.
363
+ * @returns {number} TBD.
353
364
  */
354
365
  get ms() {
355
366
  if (this.running) {
@@ -360,6 +371,7 @@ export class Timer {
360
371
 
361
372
  /**
362
373
  * TBD.
374
+ * @returns {number} TBD.
363
375
  */
364
376
  get seconds() {
365
377
  if (this.running) {
@@ -1,14 +1,16 @@
1
+ import { Timer } from './timer';
2
+
1
3
  export class TimerEvent {
2
4
  /**
3
5
  * TBD.
4
- * @param timer - TBD.
5
- * @param delay - TBD.
6
- * @param tick - TBD.
7
- * @param repeatCount - TBD.
8
- * @param loop - TBD.
9
- * @param callback - TBD.
10
- * @param callbackContext - TBD.
11
- * @param args - TBD.
6
+ * @param {Timer} timer - TBD.
7
+ * @param {number} delay - TBD.
8
+ * @param {number} tick - TBD.
9
+ * @param {number} repeatCount - TBD.
10
+ * @param {boolean} loop - TBD.
11
+ * @param {Function} callback - TBD.
12
+ * @param {object} callbackContext - TBD.
13
+ * @param {...any} args - TBD.
12
14
  */
13
15
  constructor(timer, delay, tick, repeatCount, loop, callback, callbackContext, args) {
14
16
  this.timer = timer;