@vpmedia/phaser 1.0.2 → 1.0.4

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 (44) hide show
  1. package/README.md +20 -3
  2. package/dist/phaser.cjs +1 -1
  3. package/dist/phaser.cjs.LICENSE.txt +1 -1
  4. package/dist/phaser.cjs.map +1 -1
  5. package/dist/phaser.js +1 -1
  6. package/dist/phaser.js.LICENSE.txt +1 -1
  7. package/dist/phaser.js.map +1 -1
  8. package/package.json +27 -20
  9. package/src/index.js +58 -15
  10. package/src/phaser/core/animation_parser.js +14 -11
  11. package/src/phaser/core/array_set.js +0 -1
  12. package/src/phaser/core/const.js +2 -2
  13. package/src/phaser/core/device_util.js +21 -19
  14. package/src/phaser/core/frame_util.js +6 -4
  15. package/src/phaser/core/game.js +8 -0
  16. package/src/phaser/core/loader.js +125 -14
  17. package/src/phaser/core/loader_parser.js +18 -14
  18. package/src/phaser/core/scene.js +0 -1
  19. package/src/phaser/core/scene_manager.js +0 -1
  20. package/src/phaser/core/sound_manager.js +2 -3
  21. package/src/phaser/core/tween_easing.js +62 -37
  22. package/src/phaser/display/canvas/graphics.js +5 -5
  23. package/src/phaser/display/canvas/masker.js +3 -3
  24. package/src/phaser/display/canvas/pool.js +10 -5
  25. package/src/phaser/display/canvas/tinter.js +12 -9
  26. package/src/phaser/display/canvas/util.js +33 -25
  27. package/src/phaser/display/graphics_data_util.js +2 -1
  28. package/src/phaser/display/sprite_util.js +14 -12
  29. package/src/phaser/display/webgl/earcut.js +106 -91
  30. package/src/phaser/display/webgl/graphics.js +31 -25
  31. package/src/phaser/display/webgl/mask_manager.js +4 -4
  32. package/src/phaser/display/webgl/texture_util.js +6 -4
  33. package/src/phaser/display/webgl/util.js +14 -10
  34. package/src/phaser/geom/polygon.js +0 -1
  35. package/src/phaser/geom/util/circle.js +26 -19
  36. package/src/phaser/geom/util/ellipse.js +7 -3
  37. package/src/phaser/geom/util/line.js +21 -16
  38. package/src/phaser/geom/util/matrix.js +7 -2
  39. package/src/phaser/geom/util/point.js +76 -56
  40. package/src/phaser/geom/util/polygon.js +6 -2
  41. package/src/phaser/geom/util/rectangle.js +59 -42
  42. package/src/phaser/geom/util/rounded_rectangle.js +6 -2
  43. package/src/phaser/util/math.js +61 -43
  44. package/src/phaser/util/string.js +6 -0
@@ -9,8 +9,9 @@ import { degToRad, distance } from '../../util/math';
9
9
 
10
10
  /**
11
11
  *
12
- * @param input
13
- * @param output
12
+ * @param {object} input TBD
13
+ * @param {object} output TBD
14
+ * @returns {object} TBD
14
15
  */
15
16
  export function clone(input, output = null) {
16
17
  const result = output || new Circle();
@@ -22,9 +23,10 @@ export function clone(input, output = null) {
22
23
 
23
24
  /**
24
25
  *
25
- * @param a
26
- * @param x
27
- * @param y
26
+ * @param {object} a TBD
27
+ * @param {number} x TBD
28
+ * @param {number} y TBD
29
+ * @returns {boolean} TBD
28
30
  */
29
31
  export function contains(a, x, y) {
30
32
  if (a.radius > 0 && x >= a.left && x <= a.right && y >= a.top && y <= a.bottom) {
@@ -37,8 +39,9 @@ export function contains(a, x, y) {
37
39
 
38
40
  /**
39
41
  *
40
- * @param a
41
- * @param b
42
+ * @param {object} a TBD
43
+ * @param {object} b TBD
44
+ * @returns {boolean} TBD
42
45
  */
43
46
  export function equals(a, b) {
44
47
  return (a.x === b.x && a.y === b.y && a.diameter === b.diameter);
@@ -46,8 +49,9 @@ export function equals(a, b) {
46
49
 
47
50
  /**
48
51
  *
49
- * @param a
50
- * @param b
52
+ * @param {object} a TBD
53
+ * @param {object} b TBD
54
+ * @returns {boolean} TBD
51
55
  */
52
56
  export function intersects(a, b) {
53
57
  return distance(a.x, a.y, b.x, b.y) <= (a.radius + b.radius);
@@ -55,10 +59,11 @@ export function intersects(a, b) {
55
59
 
56
60
  /**
57
61
  *
58
- * @param a
59
- * @param angle
60
- * @param asDegrees
61
- * @param output
62
+ * @param {object} a TBD
63
+ * @param {number} angle TBD
64
+ * @param {boolean} asDegrees TBD
65
+ * @param {object} output TBD
66
+ * @returns {object} TBD
62
67
  */
63
68
  export function circumferencePoint(a, angle, asDegrees = false, output = null) {
64
69
  const result = output || new Point();
@@ -72,10 +77,11 @@ export function circumferencePoint(a, angle, asDegrees = false, output = null) {
72
77
 
73
78
  /**
74
79
  *
75
- * @param a
76
- * @param angle
77
- * @param asDegrees
78
- * @param output
80
+ * @param {object} a TBD
81
+ * @param {number} angle TBD
82
+ * @param {boolean} asDegrees TBD
83
+ * @param {object} output TBD
84
+ * @returns {object} TBD
79
85
  */
80
86
  export function intersectsPoint(a, angle, asDegrees = false, output = null) {
81
87
  const result = output || new Point();
@@ -89,8 +95,9 @@ export function intersectsPoint(a, angle, asDegrees = false, output = null) {
89
95
 
90
96
  /**
91
97
  *
92
- * @param c
93
- * @param r
98
+ * @param {object} c TBD
99
+ * @param {object} r TBD
100
+ * @returns {boolean} TBD
94
101
  */
95
102
  export function intersectsRectangle(c, r) {
96
103
  const cx = Math.abs(c.x - r.x - r.halfWidth);
@@ -5,7 +5,10 @@
5
5
  */
6
6
 
7
7
  /**
8
+ * TBD
8
9
  *
10
+ * @deprecated
11
+ * @returns {boolean} TBD
9
12
  */
10
13
  export default function () {
11
14
  return true;
@@ -13,9 +16,10 @@ export default function () {
13
16
 
14
17
  /**
15
18
  *
16
- * @param a
17
- * @param x
18
- * @param y
19
+ * @param {object} a TBD
20
+ * @param {number} x TBD
21
+ * @param {number} y TBD
22
+ * @returns {boolean} TBD
19
23
  */
20
24
  export function contains(a, x, y) {
21
25
  if (a.width <= 0 || a.height <= 0) {
@@ -9,8 +9,9 @@ import { intersects as intersectsRect } from './rectangle';
9
9
 
10
10
  /**
11
11
  *
12
- * @param input
13
- * @param output
12
+ * @param {object} input TBD
13
+ * @param {object} output TBD
14
+ * @returns {object} TBD
14
15
  */
15
16
  export function clone(input, output = null) {
16
17
  const result = output || new Line();
@@ -23,12 +24,13 @@ export function clone(input, output = null) {
23
24
 
24
25
  /**
25
26
  *
26
- * @param a
27
- * @param b
28
- * @param e
29
- * @param f
30
- * @param asSegment
31
- * @param output
27
+ * @param {object} a TBD
28
+ * @param {object} b TBD
29
+ * @param {object} e TBD
30
+ * @param {object} f TBD
31
+ * @param {boolean} asSegment TBD
32
+ * @param {object} output TBD
33
+ * @returns {boolean} TBD
32
34
  */
33
35
  export function intersectsPoints(a, b, e, f, asSegment = true, output = null) {
34
36
  const result = output || new Point();
@@ -58,10 +60,11 @@ export function intersectsPoints(a, b, e, f, asSegment = true, output = null) {
58
60
 
59
61
  /**
60
62
  *
61
- * @param a
62
- * @param b
63
- * @param asSegment
64
- * @param result
63
+ * @param {object} a TBD
64
+ * @param {object} b TBD
65
+ * @param {boolean} asSegment TBD
66
+ * @param {object} result TBD
67
+ * @returns {boolean} TBD
65
68
  */
66
69
  export function intersects(a, b, asSegment, result) {
67
70
  return intersectsPoints(a.start, a.end, b.start, b.end, asSegment, result);
@@ -69,8 +72,9 @@ export function intersects(a, b, asSegment, result) {
69
72
 
70
73
  /**
71
74
  *
72
- * @param line
73
- * @param rect
75
+ * @param {object} line TBD
76
+ * @param {object} rect TBD
77
+ * @returns {boolean} TBD
74
78
  */
75
79
  export function intersectsRectangle(line, rect) {
76
80
  // Quick bail out of the Line and Rect bounds don't intersect
@@ -122,8 +126,9 @@ export function intersectsRectangle(line, rect) {
122
126
 
123
127
  /**
124
128
  *
125
- * @param a
126
- * @param b
129
+ * @param {object} a TBD
130
+ * @param {object} b TBD
131
+ * @returns {number} TBD
127
132
  */
128
133
  export function reflect(a, b) {
129
134
  return 2 * b.normalAngle - 3.141592653589793 - a.angle;
@@ -7,8 +7,9 @@ import Matrix from '../matrix';
7
7
 
8
8
  /**
9
9
  *
10
- * @param input
11
- * @param output
10
+ * @param {object} input TBD
11
+ * @param {object} output TBD
12
+ * @returns {object} TBD
12
13
  */
13
14
  export function clone(input, output = null) {
14
15
  const result = output || new Matrix();
@@ -22,7 +23,9 @@ export function clone(input, output = null) {
22
23
  }
23
24
 
24
25
  /**
26
+ * TBD
25
27
  *
28
+ * @returns {object} TBD
26
29
  */
27
30
  export function getIdentityMatrix() {
28
31
  if (!window.PhaserRegistry) {
@@ -35,7 +38,9 @@ export function getIdentityMatrix() {
35
38
  }
36
39
 
37
40
  /**
41
+ * TBD
38
42
  *
43
+ * @returns {object} TBD
39
44
  */
40
45
  export function getTempMatrix() {
41
46
  if (!window.PhaserRegistry) {
@@ -7,9 +7,10 @@ import Point from '../point';
7
7
 
8
8
  /**
9
9
  *
10
- * @param a
11
- * @param b
12
- * @param output
10
+ * @param {object} a TBD
11
+ * @param {object} b TBD
12
+ * @param {object} output TBD
13
+ * @returns {object} TBD
13
14
  */
14
15
  export function add(a, b, output = null) {
15
16
  const result = output || new Point();
@@ -20,9 +21,10 @@ export function add(a, b, output = null) {
20
21
 
21
22
  /**
22
23
  *
23
- * @param a
24
- * @param b
25
- * @param output
24
+ * @param {object} a TBD
25
+ * @param {object} b TBD
26
+ * @param {object} output TBD
27
+ * @returns {object} TBD
26
28
  */
27
29
  export function subtract(a, b, output = null) {
28
30
  const result = output || new Point();
@@ -33,9 +35,10 @@ export function subtract(a, b, output = null) {
33
35
 
34
36
  /**
35
37
  *
36
- * @param a
37
- * @param b
38
- * @param output
38
+ * @param {object} a TBD
39
+ * @param {object} b TBD
40
+ * @param {object} output TBD
41
+ * @returns {object} TBD
39
42
  */
40
43
  export function multiply(a, b, output = null) {
41
44
  const result = output || new Point();
@@ -46,9 +49,10 @@ export function multiply(a, b, output = null) {
46
49
 
47
50
  /**
48
51
  *
49
- * @param a
50
- * @param b
51
- * @param output
52
+ * @param {object} a TBD
53
+ * @param {object} b TBD
54
+ * @param {object} output TBD
55
+ * @returns {object} TBD
52
56
  */
53
57
  export function divide(a, b, output = null) {
54
58
  const result = output || new Point();
@@ -59,8 +63,9 @@ export function divide(a, b, output = null) {
59
63
 
60
64
  /**
61
65
  *
62
- * @param a
63
- * @param b
66
+ * @param {object} a TBD
67
+ * @param {object} b TBD
68
+ * @returns {boolean} TBD
64
69
  */
65
70
  export function equals(a, b) {
66
71
  return (a.x === b.x && a.y === b.y);
@@ -68,8 +73,9 @@ export function equals(a, b) {
68
73
 
69
74
  /**
70
75
  *
71
- * @param a
72
- * @param b
76
+ * @param {object} a TBD
77
+ * @param {object} b TBD
78
+ * @returns {number} TBD
73
79
  */
74
80
  export function angle(a, b) {
75
81
  return Math.atan2(a.y - b.y, a.x - b.x);
@@ -77,8 +83,9 @@ export function angle(a, b) {
77
83
 
78
84
  /**
79
85
  *
80
- * @param a
81
- * @param output
86
+ * @param {object} a TBD
87
+ * @param {object} output TBD
88
+ * @returns {object} TBD
82
89
  */
83
90
  export function negative(a, output = null) {
84
91
  const result = output || new Point();
@@ -87,10 +94,11 @@ export function negative(a, output = null) {
87
94
 
88
95
  /**
89
96
  *
90
- * @param a
91
- * @param b
92
- * @param s
93
- * @param output
97
+ * @param {object} a TBD
98
+ * @param {object} b TBD
99
+ * @param {number} s TBD
100
+ * @param {object} output TBD
101
+ * @returns {object} TBD
94
102
  */
95
103
  export function multiplyAdd(a, b, s, output = null) {
96
104
  const result = output || new Point();
@@ -99,10 +107,11 @@ export function multiplyAdd(a, b, s, output = null) {
99
107
 
100
108
  /**
101
109
  *
102
- * @param a
103
- * @param b
104
- * @param f
105
- * @param output
110
+ * @param {object} a TBD
111
+ * @param {object} b TBD
112
+ * @param {number} f TBD
113
+ * @param {object} output TBD
114
+ * @returns {object} TBD
106
115
  */
107
116
  export function interpolate(a, b, f, output = null) {
108
117
  const result = output || new Point();
@@ -111,8 +120,9 @@ export function interpolate(a, b, f, output = null) {
111
120
 
112
121
  /**
113
122
  *
114
- * @param a
115
- * @param output
123
+ * @param {object} a TBD
124
+ * @param {object} output TBD
125
+ * @returns {object} TBD
116
126
  */
117
127
  export function perp(a, output = null) {
118
128
  const result = output || new Point();
@@ -121,8 +131,9 @@ export function perp(a, output = null) {
121
131
 
122
132
  /**
123
133
  *
124
- * @param a
125
- * @param output
134
+ * @param {object} a TBD
135
+ * @param {object} output TBD
136
+ * @returns {object} TBD
126
137
  */
127
138
  export function rperp(a, output = null) {
128
139
  const result = output || new Point();
@@ -131,9 +142,10 @@ export function rperp(a, output = null) {
131
142
 
132
143
  /**
133
144
  *
134
- * @param a
135
- * @param b
136
- * @param round
145
+ * @param {object} a TBD
146
+ * @param {object} b TBD
147
+ * @param {boolean} round TBD
148
+ * @returns {number} TBD
137
149
  */
138
150
  export function distance(a, b, round = false) {
139
151
  const dx = a.x - b.x;
@@ -144,9 +156,10 @@ export function distance(a, b, round = false) {
144
156
 
145
157
  /**
146
158
  *
147
- * @param a
148
- * @param b
149
- * @param output
159
+ * @param {object} a TBD
160
+ * @param {object} b TBD
161
+ * @param {object} output TBD
162
+ * @returns {object} TBD
150
163
  */
151
164
  export function project(a, b, output = null) {
152
165
  const result = output || new Point();
@@ -159,9 +172,10 @@ export function project(a, b, output = null) {
159
172
 
160
173
  /**
161
174
  *
162
- * @param a
163
- * @param b
164
- * @param output
175
+ * @param {object} a TBD
176
+ * @param {object} b TBD
177
+ * @param {object} output TBD
178
+ * @returns {object} TBD
165
179
  */
166
180
  export function projectUnit(a, b, output = null) {
167
181
  const result = output || new Point();
@@ -174,8 +188,9 @@ export function projectUnit(a, b, output = null) {
174
188
 
175
189
  /**
176
190
  *
177
- * @param a
178
- * @param output
191
+ * @param {object} a TBD
192
+ * @param {object} output TBD
193
+ * @returns {object} TBD
179
194
  */
180
195
  export function normalRightHand(a, output = null) {
181
196
  const result = output || new Point();
@@ -184,8 +199,9 @@ export function normalRightHand(a, output = null) {
184
199
 
185
200
  /**
186
201
  *
187
- * @param a
188
- * @param output
202
+ * @param {object} a TBD
203
+ * @param {object} output TBD
204
+ * @returns {object} TBD
189
205
  */
190
206
  export function normalize(a, output = null) {
191
207
  const result = output || new Point();
@@ -198,12 +214,13 @@ export function normalize(a, output = null) {
198
214
 
199
215
  /**
200
216
  *
201
- * @param a
202
- * @param x
203
- * @param y
204
- * @param ang
205
- * @param asDegrees
206
- * @param dist
217
+ * @param {object} a TBD
218
+ * @param {number} x TBD
219
+ * @param {number} y TBD
220
+ * @param {number} ang TBD
221
+ * @param {boolean} asDegrees TBD
222
+ * @param {number} dist TBD
223
+ * @returns {object} TBD
207
224
  */
208
225
  export function rotate(a, x, y, ang, asDegrees, dist) {
209
226
  if (asDegrees) {
@@ -227,8 +244,9 @@ export function rotate(a, x, y, ang, asDegrees, dist) {
227
244
 
228
245
  /**
229
246
  *
230
- * @param points
231
- * @param output
247
+ * @param {object[]} points TBD
248
+ * @param {object} output TBD
249
+ * @returns {object} TBD
232
250
  */
233
251
  export function centroid(points, output = null) {
234
252
  const result = output || new Point();
@@ -249,9 +267,10 @@ export function centroid(points, output = null) {
249
267
 
250
268
  /**
251
269
  *
252
- * @param obj
253
- * @param xProp
254
- * @param yProp
270
+ * @param {object} obj TBD
271
+ * @param {string} xProp TBD
272
+ * @param {string} yProp TBD
273
+ * @returns {object} TBD
255
274
  */
256
275
  export function parse(obj, xProp = 'x', yProp = 'y') {
257
276
  const point = new Point();
@@ -266,8 +285,9 @@ export function parse(obj, xProp = 'x', yProp = 'y') {
266
285
 
267
286
  /**
268
287
  *
269
- * @param input
270
- * @param output
288
+ * @param {object} input TBD
289
+ * @param {object} output TBD
290
+ * @returns {object} TBD
271
291
  */
272
292
  export function clone(input, output = null) {
273
293
  const result = output || new Point();
@@ -6,7 +6,10 @@
6
6
  import Polygon from '../polygon';
7
7
 
8
8
  /**
9
+ * TBD
9
10
  *
11
+ * @deprecated
12
+ * @returns {boolean} TBD
10
13
  */
11
14
  export default function () {
12
15
  return true;
@@ -14,8 +17,9 @@ export default function () {
14
17
 
15
18
  /**
16
19
  *
17
- * @param input
18
- * @param output
20
+ * @param {object} input TBD
21
+ * @param {object} output TBD
22
+ * @returns {object} TBD
19
23
  */
20
24
  export function clone(input, output = null) {
21
25
  const result = output || new Polygon();