@vpmedia/phaser 1.17.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 (153) hide show
  1. package/README.md +1 -1
  2. package/package.json +3 -3
  3. package/src/phaser/core/animation.js +3 -2
  4. package/src/phaser/core/animation_manager.js +3 -2
  5. package/src/phaser/core/cache.js +1 -1
  6. package/src/phaser/core/const.js +66 -0
  7. package/src/phaser/core/device.js +87 -0
  8. package/src/phaser/core/dom.js +13 -8
  9. package/src/phaser/core/event_manager.js +2 -1
  10. package/src/phaser/core/factory.js +11 -11
  11. package/src/phaser/core/game.js +1 -0
  12. package/src/phaser/core/input_mspointer.js +6 -6
  13. package/src/phaser/core/input_pointer.js +1 -1
  14. package/src/phaser/core/scale_manager.js +41 -24
  15. package/src/phaser/core/scene_manager.js +10 -6
  16. package/src/phaser/core/sound_manager.js +14 -7
  17. package/src/phaser/core/sound_sprite.js +7 -4
  18. package/src/phaser/core/timer.js +33 -21
  19. package/src/phaser/core/timer_event.js +8 -6
  20. package/src/phaser/core/tween.js +65 -45
  21. package/src/phaser/core/tween_data.js +22 -15
  22. package/src/phaser/core/tween_manager.js +10 -6
  23. package/src/phaser/display/bitmap_text.js +7 -6
  24. package/src/phaser/display/canvas/pool.js +1 -1
  25. package/src/phaser/display/canvas/renderer.js +5 -4
  26. package/src/phaser/display/canvas/util.js +2 -2
  27. package/src/phaser/display/display_object.js +33 -16
  28. package/src/phaser/display/graphics.js +57 -36
  29. package/src/phaser/display/graphics_data.js +7 -7
  30. package/src/phaser/display/image.js +16 -11
  31. package/src/phaser/display/sprite_util.js +3 -2
  32. package/src/phaser/display/text.js +27 -14
  33. package/src/phaser/display/webgl/abstract_filter.js +2 -2
  34. package/src/phaser/display/webgl/base_texture.js +2 -2
  35. package/src/phaser/display/webgl/blend_manager.js +3 -2
  36. package/src/phaser/display/webgl/earcut_node.js +1 -1
  37. package/src/phaser/display/webgl/fast_sprite_batch.js +6 -6
  38. package/src/phaser/display/webgl/filter_manager.js +1 -1
  39. package/src/phaser/display/webgl/filter_texture.js +2 -2
  40. package/src/phaser/display/webgl/graphics_data.js +1 -1
  41. package/src/phaser/display/webgl/render_texture.js +7 -3
  42. package/src/phaser/display/webgl/renderer.js +9 -6
  43. package/src/phaser/display/webgl/shader/complex.js +1 -1
  44. package/src/phaser/display/webgl/shader/fast.js +1 -1
  45. package/src/phaser/display/webgl/shader/normal.js +2 -2
  46. package/src/phaser/display/webgl/shader/primitive.js +1 -1
  47. package/src/phaser/display/webgl/shader/strip.js +1 -1
  48. package/src/phaser/display/webgl/shader_manager.js +3 -3
  49. package/src/phaser/display/webgl/sprite_batch.js +9 -7
  50. package/src/phaser/display/webgl/stencil_manager.js +7 -7
  51. package/src/phaser/display/webgl/texture.js +8 -6
  52. package/types/phaser/core/animation.d.ts +5 -4
  53. package/types/phaser/core/animation.d.ts.map +1 -1
  54. package/types/phaser/core/animation_manager.d.ts +7 -6
  55. package/types/phaser/core/animation_manager.d.ts.map +1 -1
  56. package/types/phaser/core/cache.d.ts +2 -2
  57. package/types/phaser/core/cache.d.ts.map +1 -1
  58. package/types/phaser/core/const.d.ts +88 -22
  59. package/types/phaser/core/const.d.ts.map +1 -1
  60. package/types/phaser/core/device.d.ts +87 -0
  61. package/types/phaser/core/device.d.ts.map +1 -1
  62. package/types/phaser/core/dom.d.ts +19 -27
  63. package/types/phaser/core/dom.d.ts.map +1 -1
  64. package/types/phaser/core/event_manager.d.ts +4 -3
  65. package/types/phaser/core/event_manager.d.ts.map +1 -1
  66. package/types/phaser/core/factory.d.ts +15 -15
  67. package/types/phaser/core/factory.d.ts.map +1 -1
  68. package/types/phaser/core/game.d.ts +1 -0
  69. package/types/phaser/core/game.d.ts.map +1 -1
  70. package/types/phaser/core/input.d.ts +2 -2
  71. package/types/phaser/core/input.d.ts.map +1 -1
  72. package/types/phaser/core/input_mspointer.d.ts +13 -13
  73. package/types/phaser/core/input_mspointer.d.ts.map +1 -1
  74. package/types/phaser/core/input_pointer.d.ts +2 -2
  75. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  76. package/types/phaser/core/scale_manager.d.ts +57 -40
  77. package/types/phaser/core/scale_manager.d.ts.map +1 -1
  78. package/types/phaser/core/scene_manager.d.ts +15 -10
  79. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  80. package/types/phaser/core/sound_manager.d.ts +16 -9
  81. package/types/phaser/core/sound_manager.d.ts.map +1 -1
  82. package/types/phaser/core/sound_sprite.d.ts +10 -7
  83. package/types/phaser/core/sound_sprite.d.ts.map +1 -1
  84. package/types/phaser/core/timer.d.ts +41 -29
  85. package/types/phaser/core/timer.d.ts.map +1 -1
  86. package/types/phaser/core/timer_event.d.ts +12 -11
  87. package/types/phaser/core/timer_event.d.ts.map +1 -1
  88. package/types/phaser/core/tween.d.ts +79 -59
  89. package/types/phaser/core/tween.d.ts.map +1 -1
  90. package/types/phaser/core/tween_data.d.ts +26 -19
  91. package/types/phaser/core/tween_data.d.ts.map +1 -1
  92. package/types/phaser/core/tween_manager.d.ts +16 -12
  93. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  94. package/types/phaser/display/bitmap_text.d.ts +10 -9
  95. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  96. package/types/phaser/display/canvas/buffer.d.ts +2 -2
  97. package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
  98. package/types/phaser/display/canvas/pool.d.ts +2 -2
  99. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  100. package/types/phaser/display/canvas/renderer.d.ts +5 -4
  101. package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
  102. package/types/phaser/display/canvas/util.d.ts +2 -2
  103. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  104. package/types/phaser/display/display_object.d.ts +50 -33
  105. package/types/phaser/display/display_object.d.ts.map +1 -1
  106. package/types/phaser/display/graphics.d.ts +65 -47
  107. package/types/phaser/display/graphics.d.ts.map +1 -1
  108. package/types/phaser/display/graphics_data.d.ts +16 -16
  109. package/types/phaser/display/graphics_data.d.ts.map +1 -1
  110. package/types/phaser/display/image.d.ts +17 -18
  111. package/types/phaser/display/image.d.ts.map +1 -1
  112. package/types/phaser/display/sprite_util.d.ts +5 -4
  113. package/types/phaser/display/sprite_util.d.ts.map +1 -1
  114. package/types/phaser/display/text.d.ts +33 -55
  115. package/types/phaser/display/text.d.ts.map +1 -1
  116. package/types/phaser/display/webgl/abstract_filter.d.ts +3 -3
  117. package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  118. package/types/phaser/display/webgl/base_texture.d.ts +4 -4
  119. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
  120. package/types/phaser/display/webgl/blend_manager.d.ts +6 -5
  121. package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  122. package/types/phaser/display/webgl/earcut_node.d.ts +3 -3
  123. package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  124. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +12 -12
  125. package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  126. package/types/phaser/display/webgl/filter_manager.d.ts +3 -3
  127. package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  128. package/types/phaser/display/webgl/filter_texture.d.ts +7 -7
  129. package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  130. package/types/phaser/display/webgl/graphics_data.d.ts +5 -5
  131. package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  132. package/types/phaser/display/webgl/render_texture.d.ts +9 -9
  133. package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
  134. package/types/phaser/display/webgl/renderer.d.ts +10 -7
  135. package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
  136. package/types/phaser/display/webgl/shader/complex.d.ts +11 -11
  137. package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  138. package/types/phaser/display/webgl/shader/fast.d.ts +15 -15
  139. package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  140. package/types/phaser/display/webgl/shader/normal.d.ts +11 -11
  141. package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  142. package/types/phaser/display/webgl/shader/primitive.d.ts +12 -12
  143. package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  144. package/types/phaser/display/webgl/shader/strip.d.ts +12 -12
  145. package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  146. package/types/phaser/display/webgl/shader_manager.d.ts +5 -5
  147. package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  148. package/types/phaser/display/webgl/sprite_batch.d.ts +16 -14
  149. package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  150. package/types/phaser/display/webgl/stencil_manager.d.ts +12 -12
  151. package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  152. package/types/phaser/display/webgl/texture.d.ts +15 -12
  153. 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 - TBD.
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 - TBD.
240
- * @param vScale - TBD.
241
- * @param hTrim - TBD.
242
- * @param vTrim - TBD.
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);
@@ -250,7 +250,7 @@ export class ScaleManager {
250
250
  /**
251
251
  * TBD.
252
252
  * @param {Function} callback - TBD.
253
- * @param context - 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 - TBD.
286
- * @param minHeight - TBD.
287
- * @param maxWidth - TBD.
288
- * @param maxHeight - TBD.
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 - TBD.
385
- * @param forcePortrait - TBD.
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 - TBD.
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;
@@ -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 - TBD.
536
- * @param vertical - TBD.
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 - TBD.
612
- * @param cssHeight - TBD.
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 - TBD.
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 - TBD.
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 - TBD.
704
- * @param allowTrampoline - TBD.
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 - TBD.
791
+ * @param {boolean} enteringFullscreen - TBD.
786
792
  */
787
793
  prepScreenMode(enteringFullscreen) {
788
794
  const fsTarget = this._createdFullScreenTarget || this.fullScreenTarget;
@@ -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 - TBD.
8
+ * @param {string} pendingState - TBD.
9
9
  */
10
10
  constructor(game, pendingState) {
11
11
  this.game = game;
@@ -41,7 +41,8 @@ export class SceneManager {
41
41
  * TBD.
42
42
  * @param {string} key - TBD.
43
43
  * @param state - TBD.
44
- * @param autoStart - 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,8 +86,8 @@ export class SceneManager {
85
86
  /**
86
87
  * TBD.
87
88
  * @param {string} key - TBD.
88
- * @param clearWorld - TBD.
89
- * @param clearCache - TBD.
89
+ * @param {boolean} clearWorld - TBD.
90
+ * @param {boolean} clearCache - TBD.
90
91
  * @param {...any} args - TBD.
91
92
  */
92
93
  start(key, clearWorld = true, clearCache = false, ...args) {
@@ -103,8 +104,8 @@ export class SceneManager {
103
104
 
104
105
  /**
105
106
  * TBD.
106
- * @param clearWorld - TBD.
107
- * @param clearCache - TBD.
107
+ * @param {boolean} clearWorld - TBD.
108
+ * @param {boolean} clearCache - TBD.
108
109
  * @param {...any} args - TBD.
109
110
  */
110
111
  restart(clearWorld = true, clearCache = false, ...args) {
@@ -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;
@@ -229,7 +229,7 @@ export class SoundManager {
229
229
 
230
230
  /**
231
231
  * TBD.
232
- * @param files - TBD.
232
+ * @param {Sound[]|string[]} files - TBD.
233
233
  * @param {Function} callback - TBD.
234
234
  * @param {object} callbackContext - TBD.
235
235
  */
@@ -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 - TBD.
291
- * @param connect - TBD.
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 - TBD.
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 - TBD.
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 - TBD.
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 - TBD.
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 - TBD.
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
36
+ * @param {number} delay - TBD.
37
+ * @param {boolean} loop - TBD.
38
+ * @param {number} repeatCount - TBD.
39
39
  * @param {Function} callback - TBD.
40
- * @param callbackContext
41
- * @param args - 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 {number} delay - TBD.
61
62
  * @param {Function} callback - TBD.
62
- * @param callbackContext
63
- * @param {...any} args
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 {number} delay - TBD.
74
+ * @param {number} repeatCount - TBD.
73
75
  * @param {Function} callback - TBD.
74
- * @param callbackContext
75
- * @param {...any} args
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.
86
+ * @param {number} delay - TBD.
84
87
  * @param {Function} callback - TBD.
85
- * @param callbackContext
86
- * @param {...any} args
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;
@@ -118,6 +122,7 @@ export class Timer {
118
122
  /**
119
123
  * TBD.
120
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 - TBD.
146
- * @param b - TBD.
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 - TBD.
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 - TBD.
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.
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.
9
11
  * @param {Function} callback - TBD.
10
12
  * @param {object} callbackContext - TBD.
11
- * @param args - TBD.
13
+ * @param {...any} args - TBD.
12
14
  */
13
15
  constructor(timer, delay, tick, repeatCount, loop, callback, callbackContext, args) {
14
16
  this.timer = timer;