@vpmedia/phaser 1.19.0 → 1.20.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 (80) hide show
  1. package/README.md +1 -1
  2. package/package.json +2 -2
  3. package/src/phaser/core/cache.js +16 -37
  4. package/src/phaser/core/dom.js +3 -3
  5. package/src/phaser/core/input.js +12 -13
  6. package/src/phaser/core/input_handler.js +1 -2
  7. package/src/phaser/core/input_mouse.js +2 -3
  8. package/src/phaser/core/input_pointer.js +1 -2
  9. package/src/phaser/core/loader.js +69 -70
  10. package/src/phaser/core/scene_manager.js +1 -1
  11. package/src/phaser/core/signal_binding.js +7 -16
  12. package/src/phaser/core/tween.js +4 -5
  13. package/src/phaser/core/tween_data.js +1 -2
  14. package/src/phaser/display/canvas/renderer.js +5 -8
  15. package/src/phaser/display/display_object.js +0 -2
  16. package/src/phaser/display/graphics.js +4 -4
  17. package/src/phaser/display/image.js +4 -6
  18. package/src/phaser/display/text.js +30 -41
  19. package/src/phaser/display/webgl/abstract_filter.js +1 -1
  20. package/src/phaser/display/webgl/fast_sprite_batch.js +1 -3
  21. package/src/phaser/display/webgl/graphics.js +6 -6
  22. package/src/phaser/display/webgl/render_texture.js +1 -3
  23. package/src/phaser/display/webgl/renderer.js +5 -9
  24. package/src/phaser/display/webgl/shader/normal.js +1 -1
  25. package/src/phaser/display/webgl/shader_manager.js +2 -3
  26. package/src/phaser/display/webgl/sprite_batch.js +1 -2
  27. package/src/phaser/display/webgl/stencil_manager.js +6 -8
  28. package/typedefs/global.d.ts +1 -1
  29. package/types/phaser/core/cache.d.ts +44 -68
  30. package/types/phaser/core/cache.d.ts.map +1 -1
  31. package/types/phaser/core/dom.d.ts +6 -6
  32. package/types/phaser/core/dom.d.ts.map +1 -1
  33. package/types/phaser/core/input.d.ts +19 -20
  34. package/types/phaser/core/input.d.ts.map +1 -1
  35. package/types/phaser/core/input_handler.d.ts +4 -5
  36. package/types/phaser/core/input_handler.d.ts.map +1 -1
  37. package/types/phaser/core/input_mouse.d.ts +1 -1
  38. package/types/phaser/core/input_mouse.d.ts.map +1 -1
  39. package/types/phaser/core/input_pointer.d.ts +2 -3
  40. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  41. package/types/phaser/core/loader.d.ts +103 -104
  42. package/types/phaser/core/loader.d.ts.map +1 -1
  43. package/types/phaser/core/scene_manager.d.ts +2 -2
  44. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  45. package/types/phaser/core/signal_binding.d.ts +15 -23
  46. package/types/phaser/core/signal_binding.d.ts.map +1 -1
  47. package/types/phaser/core/tween.d.ts +8 -8
  48. package/types/phaser/core/tween.d.ts.map +1 -1
  49. package/types/phaser/core/tween_data.d.ts +5 -6
  50. package/types/phaser/core/tween_data.d.ts.map +1 -1
  51. package/types/phaser/display/button.d.ts +2 -3
  52. package/types/phaser/display/button.d.ts.map +1 -1
  53. package/types/phaser/display/canvas/renderer.d.ts +7 -10
  54. package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
  55. package/types/phaser/display/display_object.d.ts +3 -5
  56. package/types/phaser/display/display_object.d.ts.map +1 -1
  57. package/types/phaser/display/graphics.d.ts +6 -6
  58. package/types/phaser/display/graphics.d.ts.map +1 -1
  59. package/types/phaser/display/image.d.ts +11 -14
  60. package/types/phaser/display/image.d.ts.map +1 -1
  61. package/types/phaser/display/text.d.ts +50 -61
  62. package/types/phaser/display/text.d.ts.map +1 -1
  63. package/types/phaser/display/webgl/abstract_filter.d.ts +3 -3
  64. package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  65. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +2 -3
  66. package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  67. package/types/phaser/display/webgl/graphics.d.ts +12 -13
  68. package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
  69. package/types/phaser/display/webgl/render_texture.d.ts +3 -5
  70. package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
  71. package/types/phaser/display/webgl/renderer.d.ts +8 -12
  72. package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
  73. package/types/phaser/display/webgl/shader/normal.d.ts +2 -2
  74. package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  75. package/types/phaser/display/webgl/shader_manager.d.ts +5 -6
  76. package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  77. package/types/phaser/display/webgl/sprite_batch.d.ts +2 -3
  78. package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  79. package/types/phaser/display/webgl/stencil_manager.d.ts +9 -11
  80. package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
@@ -71,11 +71,10 @@ export class Text extends Image {
71
71
  * TBD.
72
72
  * @param {number} x - TBD.
73
73
  * @param {number} y - TBD.
74
- * @param {string} color - TBD.
75
- * @param {number} blur - TBD.
76
- * @param {boolean} shadowStroke - TBD.
77
- * @param {boolean} shadowFill - TBD.
78
- * @returns {Text} TBD.
74
+ * @param color - TBD.
75
+ * @param blur - TBD.
76
+ * @param shadowStroke - TBD.
77
+ * @param shadowFill - TBD.
79
78
  */
80
79
  setShadow(x = 0, y = 0, color = 'rgba(0, 0, 0, 1)', blur = 0, shadowStroke = true, shadowFill = true) {
81
80
  this.style.shadowOffsetX = x;
@@ -90,9 +89,8 @@ export class Text extends Image {
90
89
 
91
90
  /**
92
91
  * TBD.
93
- * @param {object} style - TBD.
94
- * @param {boolean} update - TBD.
95
- * @returns {Text} TBD.
92
+ * @param style
93
+ * @param update
96
94
  */
97
95
  setStyle(style = null, update = false) {
98
96
  style = JSON.parse(JSON.stringify(style)) || {};
@@ -300,10 +298,10 @@ export class Text extends Image {
300
298
 
301
299
  /**
302
300
  * TBD.
303
- * @param {string} line - TBD.
301
+ * @param line - TBD.
304
302
  * @param {number} x - TBD.
305
303
  * @param {number} y - TBD.
306
- * @param {boolean} fill - TBD.
304
+ * @param fill - TBD.
307
305
  */
308
306
  renderTabLine(line, x, y, fill) {
309
307
  const text = line.split(/(?:\t)/);
@@ -339,7 +337,7 @@ export class Text extends Image {
339
337
 
340
338
  /**
341
339
  * TBD.
342
- * @param {string} state - TBD.
340
+ * @param state
343
341
  */
344
342
  updateShadow(state) {
345
343
  if (state) {
@@ -357,8 +355,7 @@ export class Text extends Image {
357
355
 
358
356
  /**
359
357
  * TBD.
360
- * @param {string} line - TBD.
361
- * @returns {number} TBD.
358
+ * @param line - TBD.
362
359
  */
363
360
  measureLine(line) {
364
361
  let lineLength = 0;
@@ -394,7 +391,7 @@ export class Text extends Image {
394
391
 
395
392
  /**
396
393
  * TBD.
397
- * @param {string} line - TBD.
394
+ * @param line - TBD.
398
395
  * @param {number} x - TBD.
399
396
  * @param {number} y - TBD.
400
397
  */
@@ -454,8 +451,8 @@ export class Text extends Image {
454
451
 
455
452
  /**
456
453
  * TBD.
457
- * @param {number} color - TBD.
458
- * @param {number} position - TBD.
454
+ * @param color - TBD.
455
+ * @param position - TBD.
459
456
  * @returns {Text} TBD.
460
457
  */
461
458
  addColor(color, position) {
@@ -466,8 +463,8 @@ export class Text extends Image {
466
463
 
467
464
  /**
468
465
  * TBD.
469
- * @param {number} color - TBD.
470
- * @param {number} position - TBD.
466
+ * @param color - TBD.
467
+ * @param position - TBD.
471
468
  * @returns {Text} TBD.
472
469
  */
473
470
  addStrokeColor(color, position) {
@@ -478,8 +475,8 @@ export class Text extends Image {
478
475
 
479
476
  /**
480
477
  * TBD.
481
- * @param {object} style - TBD.
482
- * @param {number} position - TBD.
478
+ * @param style - TBD.
479
+ * @param position - TBD.
483
480
  * @returns {Text} TBD.
484
481
  */
485
482
  addFontStyle(style, position) {
@@ -490,8 +487,8 @@ export class Text extends Image {
490
487
 
491
488
  /**
492
489
  * TBD.
493
- * @param {number} weight - TBD.
494
- * @param {number} position - TBD.
490
+ * @param weight - TBD.
491
+ * @param position - TBD.
495
492
  * @returns {Text} TBD.
496
493
  */
497
494
  addFontWeight(weight, position) {
@@ -502,8 +499,7 @@ export class Text extends Image {
502
499
 
503
500
  /**
504
501
  * TBD.
505
- * @param {string} text - TBD.
506
- * @returns {string[]} TBD.
502
+ * @param text - TBD.
507
503
  */
508
504
  precalculateWordWrap(text) {
509
505
  this.texture.baseTexture.resolution = this._res;
@@ -514,8 +510,7 @@ export class Text extends Image {
514
510
 
515
511
  /**
516
512
  * TBD.
517
- * @param {string} text - TBD.
518
- * @returns {string} TBD.
513
+ * @param text - TBD.
519
514
  */
520
515
  runWordWrap(text) {
521
516
  if (this.useAdvancedWrap) {
@@ -526,9 +521,7 @@ export class Text extends Image {
526
521
 
527
522
  /**
528
523
  * TBD.
529
- * @param {string} text - TBD.
530
- * @returns {string} TBD.
531
- * @throws Error.
524
+ * @param text - TBD.
532
525
  */
533
526
  advancedWordWrap(text) {
534
527
  const context = this.context;
@@ -609,8 +602,7 @@ export class Text extends Image {
609
602
 
610
603
  /**
611
604
  * TBD.
612
- * @param {string} text - TBD.
613
- * @returns {string} TBD.
605
+ * @param text - TBD.
614
606
  */
615
607
  basicWordWrap(text) {
616
608
  let result = '';
@@ -642,7 +634,7 @@ export class Text extends Image {
642
634
 
643
635
  /**
644
636
  * TBD.
645
- * @param {object} components - TBD.
637
+ * @param components
646
638
  */
647
639
  updateFont(components) {
648
640
  const font = this.componentsToFont(components);
@@ -657,7 +649,7 @@ export class Text extends Image {
657
649
 
658
650
  /**
659
651
  * TBD.
660
- * @param {string} font - TBD.
652
+ * @param font - TBD.
661
653
  * @returns {object} TBD.
662
654
  */
663
655
  fontToComponents(font) {
@@ -693,8 +685,7 @@ export class Text extends Image {
693
685
 
694
686
  /**
695
687
  * TBD.
696
- * @param {object} components - TBD.
697
- * @returns {string} TBD.
688
+ * @param components - TBD.
698
689
  */
699
690
  componentsToFont(components) {
700
691
  const parts = [];
@@ -728,8 +719,8 @@ export class Text extends Image {
728
719
 
729
720
  /**
730
721
  * TBD.
731
- * @param {string} text - TBD.
732
- * @param {boolean} immediate - TBD.
722
+ * @param text - TBD.
723
+ * @param immediate - TBD.
733
724
  * @returns {Text} TBD.
734
725
  */
735
726
  setText(text, immediate = false) {
@@ -744,7 +735,7 @@ export class Text extends Image {
744
735
 
745
736
  /**
746
737
  * TBD.
747
- * @param {string[]|string[][]} list - TBD.
738
+ * @param list
748
739
  * @returns {Text} TBD.
749
740
  */
750
741
  parseList(list) {
@@ -885,7 +876,6 @@ export class Text extends Image {
885
876
 
886
877
  /**
887
878
  * TBD.
888
- * @returns {CanvasRenderingContext2D} TBD.
889
879
  */
890
880
  getFontPropertiesContext() {
891
881
  if (!window.PhaserRegistry.fontPropertiesContext) {
@@ -898,8 +888,7 @@ export class Text extends Image {
898
888
 
899
889
  /**
900
890
  * TBD.
901
- * @param {string} fontStyle - TBD.
902
- * @returns {object} TBD.
891
+ * @param fontStyle
903
892
  */
904
893
  determineFontProperties(fontStyle) {
905
894
  const fontPropertiesCache = this.getFontPropertiesCache();
@@ -1,7 +1,7 @@
1
1
  export class AbstractFilter {
2
2
  /**
3
3
  * TBD.
4
- * @param {string[]} fragmentSrc - TBD.
4
+ * @param fragmentSrc - TBD.
5
5
  * @param {object} uniforms - TBD.
6
6
  */
7
7
  constructor(fragmentSrc, uniforms) {
@@ -1,5 +1,3 @@
1
- import { Image } from '../image';
2
-
3
1
  export class FastSpriteBatch {
4
2
  /**
5
3
  * TBD.
@@ -98,7 +96,7 @@ export class FastSpriteBatch {
98
96
 
99
97
  /**
100
98
  * TBD.
101
- * @param {Image} sprite - TBD.
99
+ * @param sprite - TBD.
102
100
  */
103
101
  renderSprite(sprite) {
104
102
  if (!sprite.visible) {
@@ -53,7 +53,7 @@ export function switchMode(webGL, type) {
53
53
  /**
54
54
  * TBD.
55
55
  * @param {object} graphicsData - TBD.
56
- * @param {GraphicsData} webGLData - TBD.
56
+ * @param {object} webGLData - TBD.
57
57
  */
58
58
  export function buildLine(graphicsData, webGLData) {
59
59
  // TODO OPTIMISE!
@@ -218,7 +218,7 @@ export function buildLine(graphicsData, webGLData) {
218
218
  /**
219
219
  * TBD.
220
220
  * @param {object} graphicsData - TBD.
221
- * @param {GraphicsData} webGLData - TBD.
221
+ * @param {object} webGLData - TBD.
222
222
  */
223
223
  export function buildRectangle(graphicsData, webGLData) {
224
224
  //
@@ -301,7 +301,7 @@ export function quadraticBezierCurve(fromX, fromY, cpX, cpY, toX, toY) {
301
301
  /**
302
302
  * TBD.
303
303
  * @param {object} graphicsData - TBD.
304
- * @param {GraphicsData} webGLData - TBD.
304
+ * @param {object} webGLData - TBD.
305
305
  */
306
306
  export function buildRoundedRectangle(graphicsData, webGLData) {
307
307
  const rrectData = graphicsData.shape;
@@ -351,7 +351,7 @@ export function buildRoundedRectangle(graphicsData, webGLData) {
351
351
  /**
352
352
  * TBD.
353
353
  * @param {object} graphicsData - TBD.
354
- * @param {GraphicsData} webGLData - TBD.
354
+ * @param {object} webGLData - TBD.
355
355
  */
356
356
  export function buildCircle(graphicsData, webGLData) {
357
357
  // need to convert points to a nice regular data
@@ -402,7 +402,7 @@ export function buildCircle(graphicsData, webGLData) {
402
402
  /**
403
403
  * TBD.
404
404
  * @param {object} graphicsData - TBD.
405
- * @param {GraphicsData} webGLData - TBD.
405
+ * @param {object} webGLData - TBD.
406
406
  */
407
407
  export function buildComplexPoly(graphicsData, webGLData) {
408
408
  // TODO - no need to copy this as it gets turned into a Float32Array anyways..
@@ -446,7 +446,7 @@ export function buildComplexPoly(graphicsData, webGLData) {
446
446
  /**
447
447
  * TBD.
448
448
  * @param {object} graphicsData - TBD.
449
- * @param {GraphicsData} webGLData - TBD.
449
+ * @param {object} webGLData - TBD.
450
450
  * @returns {boolean} TBD.
451
451
  */
452
452
  export function buildPoly(graphicsData, webGLData) {
@@ -4,8 +4,6 @@ import { Texture } from './texture';
4
4
  import { BaseTexture } from './base_texture';
5
5
  import { FilterTexture } from './filter_texture';
6
6
  import { CanvasBuffer } from '../canvas/buffer';
7
- import { CanvasRenderer } from '../canvas/renderer';
8
- import { WebGLRenderer } from './renderer';
9
7
  import { RENDER_WEBGL } from '../../core/const';
10
8
 
11
9
  export class RenderTexture extends Texture {
@@ -13,7 +11,7 @@ export class RenderTexture extends Texture {
13
11
  * TBD.
14
12
  * @param {number} width - TBD.
15
13
  * @param {number} height - TBD.
16
- * @param {WebGLRenderer|CanvasRenderer} renderer - TBD.
14
+ * @param renderer - TBD.
17
15
  * @param {number} scaleMode - TBD.
18
16
  * @param {number} resolution - TBD.
19
17
  */
@@ -29,9 +29,6 @@ import * as WebGLMaskManager from './mask_manager';
29
29
  import { WebGLFilterManager } from './filter_manager';
30
30
  import { WebGLStencilManager } from './stencil_manager';
31
31
  import { WebGLBlendModeManager } from './blend_manager';
32
- import { BaseTexture } from './base_texture';
33
- import { DisplayObject } from '../../display/display_object';
34
- import { Stage } from '../../core/stage';
35
32
  import { Game } from '../../core/game';
36
33
 
37
34
  export class WebGLRenderer {
@@ -124,7 +121,6 @@ export class WebGLRenderer {
124
121
 
125
122
  /**
126
123
  * TBD.
127
- * @throws Error.
128
124
  */
129
125
  initContext() {
130
126
  const gl =
@@ -158,7 +154,7 @@ export class WebGLRenderer {
158
154
 
159
155
  /**
160
156
  * TBD.
161
- * @param {Stage} stage - TBD.
157
+ * @param stage - TBD.
162
158
  */
163
159
  render(stage) {
164
160
  if (this.contextLost) {
@@ -180,9 +176,9 @@ export class WebGLRenderer {
180
176
 
181
177
  /**
182
178
  * TBD.
183
- * @param {DisplayObject} displayObject - TBD.
184
- * @param {Point} projection - TBD.
185
- * @param {object} buffer - TBD.
179
+ * @param displayObject - TBD.
180
+ * @param projection - TBD.
181
+ * @param buffer - TBD.
186
182
  * @param {Matrix} matrix - TBD.
187
183
  */
188
184
  renderDisplayObject(displayObject, projection, buffer, matrix) {
@@ -226,7 +222,7 @@ export class WebGLRenderer {
226
222
 
227
223
  /**
228
224
  * TBD.
229
- * @param {BaseTexture} texture - TBD.
225
+ * @param texture - TBD.
230
226
  * @returns {boolean} TBD.
231
227
  */
232
228
  updateTexture(texture) {
@@ -131,7 +131,7 @@ export class NormalShader {
131
131
 
132
132
  /**
133
133
  * TBD.
134
- * @param {object} uniform - TBD.
134
+ * @param uniform - TBD.
135
135
  */
136
136
  initSampler2D(uniform) {
137
137
  if (!uniform.value || !uniform.value.baseTexture || !uniform.value.baseTexture.hasLoaded) {
@@ -40,7 +40,7 @@ export class WebGLShaderManager {
40
40
 
41
41
  /**
42
42
  * TBD.
43
- * @param {number[]} attribs - TBD.
43
+ * @param attribs - TBD.
44
44
  */
45
45
  setAttribs(attribs) {
46
46
  // reset temp state
@@ -68,8 +68,7 @@ export class WebGLShaderManager {
68
68
 
69
69
  /**
70
70
  * TBD.
71
- * @param {NormalShader} shader - TBD.
72
- * @returns {boolean} TBD.
71
+ * @param shader - TBD.
73
72
  */
74
73
  setShader(shader) {
75
74
  if (this._currentId === shader._UID) {
@@ -2,7 +2,6 @@ import { AbstractFilter } from './abstract_filter';
2
2
  import { NormalShader } from './shader/normal';
3
3
  import { BaseTexture } from './base_texture';
4
4
  import { Matrix } from '../../geom/matrix';
5
- import { Image } from '../../display/image';
6
5
 
7
6
  export class WebGLSpriteBatch {
8
7
  /**
@@ -89,7 +88,7 @@ export class WebGLSpriteBatch {
89
88
 
90
89
  /**
91
90
  * TBD.
92
- * @param {Image} sprite - TBD.
91
+ * @param sprite - TBD.
93
92
  * @param {Matrix} matrix - TBD.
94
93
  */
95
94
  render(sprite, matrix) {
@@ -1,6 +1,4 @@
1
1
  import { hex2rgb } from '../../util/math';
2
- import { GraphicsData } from './graphics_data';
3
- import { Graphics } from '../../display/graphics';
4
2
 
5
3
  export class WebGLStencilManager {
6
4
  /**
@@ -30,8 +28,8 @@ export class WebGLStencilManager {
30
28
 
31
29
  /**
32
30
  * TBD.
33
- * @param {Graphics} graphics - TBD.
34
- * @param {GraphicsData} webGLData - TBD.
31
+ * @param graphics - TBD.
32
+ * @param webGLData - TBD.
35
33
  * @param {object} renderSession - TBD.
36
34
  */
37
35
  pushStencil(graphics, webGLData, renderSession) {
@@ -88,8 +86,8 @@ export class WebGLStencilManager {
88
86
 
89
87
  /**
90
88
  * TBD.
91
- * @param {Graphics} graphics - TBD.
92
- * @param {GraphicsData} webGLData - TBD.
89
+ * @param graphics - TBD.
90
+ * @param webGLData - TBD.
93
91
  * @param {object} renderSession - TBD.
94
92
  */
95
93
  bindGraphics(graphics, webGLData, renderSession) {
@@ -135,8 +133,8 @@ export class WebGLStencilManager {
135
133
 
136
134
  /**
137
135
  * TBD.
138
- * @param {Graphics} graphics - TBD.
139
- * @param {GraphicsData} webGLData - TBD.
136
+ * @param graphics - TBD.
137
+ * @param webGLData - TBD.
140
138
  * @param {object} renderSession - TBD.
141
139
  */
142
140
  popStencil(graphics, webGLData, renderSession) {
@@ -1,6 +1,6 @@
1
1
  declare global {
2
2
  interface Window {
3
- PhaserRegistry: any;
3
+ PhaserRegistry: object;
4
4
  }
5
5
  }
6
6