melonjs 10.2.0 → 10.3.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 (95) hide show
  1. package/README.md +1 -1
  2. package/dist/melonjs.js +4435 -4283
  3. package/dist/melonjs.min.js +4 -4
  4. package/dist/melonjs.module.d.ts +3348 -3833
  5. package/dist/melonjs.module.js +4025 -3920
  6. package/package.json +13 -14
  7. package/src/audio/audio.js +45 -45
  8. package/src/camera/camera2d.js +78 -101
  9. package/src/entity/draggable.js +21 -29
  10. package/src/entity/droptarget.js +24 -31
  11. package/src/entity/entity.js +34 -38
  12. package/src/game.js +8 -8
  13. package/src/{shapes → geometries}/ellipse.js +46 -46
  14. package/src/{shapes → geometries}/line.js +14 -14
  15. package/src/{shapes → geometries}/poly.js +103 -54
  16. package/src/{shapes → geometries}/rectangle.js +73 -120
  17. package/src/index.js +18 -19
  18. package/src/input/gamepad.js +20 -20
  19. package/src/input/input.js +3 -3
  20. package/src/input/keyboard.js +122 -124
  21. package/src/input/pointer.js +102 -62
  22. package/src/input/pointerevent.js +97 -42
  23. package/src/lang/deprecated.js +29 -18
  24. package/src/level/level.js +34 -26
  25. package/src/level/tiled/TMXGroup.js +12 -13
  26. package/src/level/tiled/TMXLayer.js +41 -42
  27. package/src/level/tiled/TMXObject.js +76 -70
  28. package/src/level/tiled/TMXTile.js +13 -15
  29. package/src/level/tiled/TMXTileMap.js +26 -25
  30. package/src/level/tiled/TMXTileset.js +14 -15
  31. package/src/level/tiled/TMXTilesetGroup.js +5 -6
  32. package/src/level/tiled/TMXUtils.js +13 -11
  33. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +3 -4
  34. package/src/level/tiled/renderer/TMXIsometricRenderer.js +3 -4
  35. package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -3
  36. package/src/level/tiled/renderer/TMXRenderer.js +18 -19
  37. package/src/level/tiled/renderer/TMXStaggeredRenderer.js +2 -3
  38. package/src/loader/loader.js +46 -40
  39. package/src/loader/loadingscreen.js +7 -7
  40. package/src/math/color.js +68 -88
  41. package/src/math/math.js +33 -33
  42. package/src/math/matrix2.js +70 -71
  43. package/src/math/matrix3.js +90 -91
  44. package/src/math/observable_vector2.js +91 -92
  45. package/src/math/observable_vector3.js +110 -106
  46. package/src/math/vector2.js +116 -104
  47. package/src/math/vector3.js +129 -110
  48. package/src/particles/emitter.js +116 -126
  49. package/src/particles/particle.js +4 -5
  50. package/src/particles/particlecontainer.js +2 -3
  51. package/src/physics/body.js +82 -83
  52. package/src/physics/bounds.js +64 -66
  53. package/src/physics/collision.js +21 -22
  54. package/src/physics/detector.js +13 -13
  55. package/src/physics/quadtree.js +26 -25
  56. package/src/physics/sat.js +21 -21
  57. package/src/physics/world.js +23 -22
  58. package/src/plugin/plugin.js +12 -13
  59. package/src/renderable/GUI.js +20 -26
  60. package/src/renderable/collectable.js +6 -7
  61. package/src/renderable/colorlayer.js +11 -12
  62. package/src/renderable/container.js +98 -81
  63. package/src/renderable/imagelayer.js +33 -35
  64. package/src/renderable/nineslicesprite.js +15 -16
  65. package/src/renderable/renderable.js +112 -111
  66. package/src/renderable/sprite.js +71 -58
  67. package/src/renderable/trigger.js +17 -19
  68. package/src/state/stage.js +14 -15
  69. package/src/state/state.js +78 -78
  70. package/src/system/device.js +137 -180
  71. package/src/system/event.js +116 -104
  72. package/src/system/pooling.js +15 -15
  73. package/src/system/save.js +9 -6
  74. package/src/system/timer.js +33 -33
  75. package/src/text/bitmaptext.js +39 -46
  76. package/src/text/bitmaptextdata.js +14 -15
  77. package/src/text/text.js +55 -58
  78. package/src/tweens/easing.js +5 -5
  79. package/src/tweens/interpolation.js +5 -5
  80. package/src/tweens/tween.js +49 -40
  81. package/src/utils/agent.js +12 -11
  82. package/src/utils/array.js +8 -8
  83. package/src/utils/file.js +7 -7
  84. package/src/utils/function.js +8 -8
  85. package/src/utils/string.js +19 -19
  86. package/src/utils/utils.js +23 -23
  87. package/src/video/canvas/canvas_renderer.js +127 -128
  88. package/src/video/renderer.js +69 -69
  89. package/src/video/texture.js +80 -82
  90. package/src/video/texture_cache.js +2 -4
  91. package/src/video/video.js +38 -38
  92. package/src/video/webgl/buffer/vertex.js +11 -3
  93. package/src/video/webgl/glshader.js +31 -32
  94. package/src/video/webgl/webgl_compositor.js +145 -127
  95. package/src/video/webgl/webgl_renderer.js +196 -175
@@ -7,10 +7,9 @@ import Matrix3d from "./matrix3.js";
7
7
  * the identity matrix and parameters position : <br>
8
8
  * <img src="images/identity-matrix_2x.png"/>
9
9
  * @class Matrix2d
10
- * @memberOf me
11
- * @constructor
10
+ * @memberof me
12
11
  * @param {me.Matrix2d} [mat2d] An instance of me.Matrix2d to copy from
13
- * @param {Number[]} [arguments...] Matrix elements. See {@link me.Matrix2d.setTransform}
12
+ * @param {number[]} [arguments...] Matrix elements. See {@link me.Matrix2d.setTransform}
14
13
  */
15
14
 
16
15
  class Matrix2d {
@@ -45,11 +44,11 @@ class Matrix2d {
45
44
  /**
46
45
  * tx component of the matrix
47
46
  * @public
48
- * @type {Number}
47
+ * @type {number}
49
48
  * @readonly
50
49
  * @see me.Matrix2d.translate
51
50
  * @name tx
52
- * @memberOf me.Matrix2d
51
+ * @memberof me.Matrix2d
53
52
  */
54
53
  get tx() {
55
54
  return this.val[6];
@@ -58,11 +57,11 @@ class Matrix2d {
58
57
  /**
59
58
  * ty component of the matrix
60
59
  * @public
61
- * @type {Number}
60
+ * @type {number}
62
61
  * @readonly
63
62
  * @see me.Matrix2d.translate
64
63
  * @name ty
65
- * @memberOf me.Matrix2d
64
+ * @memberof me.Matrix2d
66
65
  */
67
66
  get ty() {
68
67
  return this.val[7];
@@ -73,9 +72,9 @@ class Matrix2d {
73
72
  * the identity matrix and parameters position : <br>
74
73
  * <img src="images/identity-matrix_2x.png"/>
75
74
  * @name identity
76
- * @memberOf me.Matrix2d
75
+ * @memberof me.Matrix2d
77
76
  * @function
78
- * @return {me.Matrix2d} Reference to this object for method chaining
77
+ * @returns {me.Matrix2d} Reference to this object for method chaining
79
78
  */
80
79
  identity() {
81
80
  this.setTransform(
@@ -89,18 +88,18 @@ class Matrix2d {
89
88
  /**
90
89
  * set the matrix to the specified value
91
90
  * @name setTransform
92
- * @memberOf me.Matrix2d
91
+ * @memberof me.Matrix2d
93
92
  * @function
94
- * @param {Number} a
95
- * @param {Number} b
96
- * @param {Number} c
97
- * @param {Number} d
98
- * @param {Number} e
99
- * @param {Number} f
100
- * @param {Number} [g=0]
101
- * @param {Number} [h=0]
102
- * @param {Number} [i=1]
103
- * @return {me.Matrix2d} Reference to this object for method chaining
93
+ * @param {number} a
94
+ * @param {number} b
95
+ * @param {number} c
96
+ * @param {number} d
97
+ * @param {number} e
98
+ * @param {number} f
99
+ * @param {number} [g=0]
100
+ * @param {number} [h=0]
101
+ * @param {number} [i=1]
102
+ * @returns {me.Matrix2d} Reference to this object for method chaining
104
103
  */
105
104
  setTransform() {
106
105
  var a = this.val;
@@ -133,23 +132,23 @@ class Matrix2d {
133
132
  /**
134
133
  * Copies over the values from another me.Matrix2d.
135
134
  * @name copy
136
- * @memberOf me.Matrix2d
135
+ * @memberof me.Matrix2d
137
136
  * @function
138
137
  * @param {me.Matrix2d} m the matrix object to copy from
139
- * @return {me.Matrix2d} Reference to this object for method chaining
138
+ * @returns {me.Matrix2d} Reference to this object for method chaining
140
139
  */
141
- copy(b) {
142
- this.val.set(b.val);
140
+ copy(m) {
141
+ this.val.set(m.val);
143
142
  return this;
144
143
  }
145
144
 
146
145
  /**
147
146
  * Copies over the upper-left 3x3 values from the given me.Matrix3d
148
147
  * @name fromMat3d
149
- * @memberOf me.Matrix2d
148
+ * @memberof me.Matrix2d
150
149
  * @function
151
150
  * @param {me.Matrix3d} m the matrix object to copy from
152
- * @return {me.Matrix2d} Reference to this object for method chaining
151
+ * @returns {me.Matrix2d} Reference to this object for method chaining
153
152
  */
154
153
  fromMat3d(m) {
155
154
  var b = m.val;
@@ -171,10 +170,10 @@ class Matrix2d {
171
170
  /**
172
171
  * multiply both matrix
173
172
  * @name multiply
174
- * @memberOf me.Matrix2d
173
+ * @memberof me.Matrix2d
175
174
  * @function
176
175
  * @param {me.Matrix2d} m the other matrix
177
- * @return {me.Matrix2d} Reference to this object for method chaining
176
+ * @returns {me.Matrix2d} Reference to this object for method chaining
178
177
  */
179
178
  multiply(m) {
180
179
  var b = m.val;
@@ -203,9 +202,9 @@ class Matrix2d {
203
202
  /**
204
203
  * Transpose the value of this matrix.
205
204
  * @name transpose
206
- * @memberOf me.Matrix2d
205
+ * @memberof me.Matrix2d
207
206
  * @function
208
- * @return {me.Matrix2d} Reference to this object for method chaining
207
+ * @returns {me.Matrix2d} Reference to this object for method chaining
209
208
  */
210
209
  transpose() {
211
210
  var a = this.val,
@@ -226,9 +225,9 @@ class Matrix2d {
226
225
  /**
227
226
  * invert this matrix, causing it to apply the opposite transformation.
228
227
  * @name invert
229
- * @memberOf me.Matrix2d
228
+ * @memberof me.Matrix2d
230
229
  * @function
231
- * @return {me.Matrix2d} Reference to this object for method chaining
230
+ * @returns {me.Matrix2d} Reference to this object for method chaining
232
231
  */
233
232
  invert() {
234
233
  var val = this.val;
@@ -261,10 +260,10 @@ class Matrix2d {
261
260
  /**
262
261
  * apply the current transform to the given 2d vector
263
262
  * @name apply
264
- * @memberOf me.Matrix2d
263
+ * @memberof me.Matrix2d
265
264
  * @function
266
- * @param {me.Vector2d} vector the vector object to be transformed
267
- * @return {me.Vector2d} result vector object.
265
+ * @param {me.Vector2d} v the vector object to be transformed
266
+ * @returns {me.Vector2d} result vector object.
268
267
  */
269
268
  apply(v) {
270
269
  var a = this.val,
@@ -280,10 +279,10 @@ class Matrix2d {
280
279
  /**
281
280
  * apply the inverted current transform to the given 2d vector
282
281
  * @name applyInverse
283
- * @memberOf me.Matrix2d
282
+ * @memberof me.Matrix2d
284
283
  * @function
285
- * @param {me.Vector2d} vector the vector object to be transformed
286
- * @return {me.Vector2d} result vector object.
284
+ * @param {me.Vector2d} v the vector object to be transformed
285
+ * @returns {me.Vector2d} result vector object.
287
286
  */
288
287
  applyInverse(v) {
289
288
  var a = this.val,
@@ -301,11 +300,11 @@ class Matrix2d {
301
300
  /**
302
301
  * scale the matrix
303
302
  * @name scale
304
- * @memberOf me.Matrix2d
303
+ * @memberof me.Matrix2d
305
304
  * @function
306
- * @param {Number} x a number representing the abscissa of the scaling vector.
307
- * @param {Number} [y=x] a number representing the ordinate of the scaling vector.
308
- * @return {me.Matrix2d} Reference to this object for method chaining
305
+ * @param {number} x a number representing the abscissa of the scaling vector.
306
+ * @param {number} [y=x] a number representing the ordinate of the scaling vector.
307
+ * @returns {me.Matrix2d} Reference to this object for method chaining
309
308
  */
310
309
  scale(x, y) {
311
310
  var a = this.val,
@@ -323,10 +322,10 @@ class Matrix2d {
323
322
  /**
324
323
  * adds a 2D scaling transformation.
325
324
  * @name scaleV
326
- * @memberOf me.Matrix2d
325
+ * @memberof me.Matrix2d
327
326
  * @function
328
- * @param {me.Vector2d} vector scaling vector
329
- * @return {me.Matrix2d} Reference to this object for method chaining
327
+ * @param {me.Vector2d} v scaling vector
328
+ * @returns {me.Matrix2d} Reference to this object for method chaining
330
329
  */
331
330
  scaleV(v) {
332
331
  return this.scale(v.x, v.y);
@@ -335,10 +334,10 @@ class Matrix2d {
335
334
  /**
336
335
  * specifies a 2D scale operation using the [sx, 1] scaling vector
337
336
  * @name scaleX
338
- * @memberOf me.Matrix2d
337
+ * @memberof me.Matrix2d
339
338
  * @function
340
- * @param {Number} x x scaling vector
341
- * @return {me.Matrix2d} Reference to this object for method chaining
339
+ * @param {number} x x scaling vector
340
+ * @returns {me.Matrix2d} Reference to this object for method chaining
342
341
  */
343
342
  scaleX(x) {
344
343
  return this.scale(x, 1);
@@ -347,10 +346,10 @@ class Matrix2d {
347
346
  /**
348
347
  * specifies a 2D scale operation using the [1,sy] scaling vector
349
348
  * @name scaleY
350
- * @memberOf me.Matrix2d
349
+ * @memberof me.Matrix2d
351
350
  * @function
352
- * @param {Number} y y scaling vector
353
- * @return {me.Matrix2d} Reference to this object for method chaining
351
+ * @param {number} y y scaling vector
352
+ * @returns {me.Matrix2d} Reference to this object for method chaining
354
353
  */
355
354
  scaleY(y) {
356
355
  return this.scale(1, y);
@@ -359,10 +358,10 @@ class Matrix2d {
359
358
  /**
360
359
  * rotate the matrix (counter-clockwise) by the specified angle (in radians).
361
360
  * @name rotate
362
- * @memberOf me.Matrix2d
361
+ * @memberof me.Matrix2d
363
362
  * @function
364
- * @param {Number} angle Rotation angle in radians.
365
- * @return {me.Matrix2d} Reference to this object for method chaining
363
+ * @param {number} angle Rotation angle in radians.
364
+ * @returns {me.Matrix2d} Reference to this object for method chaining
366
365
  */
367
366
  rotate(angle) {
368
367
  if (angle !== 0) {
@@ -390,19 +389,19 @@ class Matrix2d {
390
389
  /**
391
390
  * translate the matrix position on the horizontal and vertical axis
392
391
  * @name translate
393
- * @memberOf me.Matrix2d
392
+ * @memberof me.Matrix2d
394
393
  * @function
395
- * @param {Number} x the x coordindates to translate the matrix by
396
- * @param {Number} y the y coordindates to translate the matrix by
397
- * @return {me.Matrix2d} Reference to this object for method chaining
394
+ * @param {number} x the x coordindates to translate the matrix by
395
+ * @param {number} y the y coordindates to translate the matrix by
396
+ * @returns {me.Matrix2d} Reference to this object for method chaining
398
397
  */
399
398
  /**
400
399
  * translate the matrix by a vector on the horizontal and vertical axis
401
400
  * @name translateV
402
- * @memberOf me.Matrix2d
401
+ * @memberof me.Matrix2d
403
402
  * @function
404
403
  * @param {me.Vector2d} v the vector to translate the matrix by
405
- * @return {me.Matrix2d} Reference to this object for method chaining
404
+ * @returns {me.Matrix2d} Reference to this object for method chaining
406
405
  */
407
406
  translate() {
408
407
  var a = this.val;
@@ -427,10 +426,10 @@ class Matrix2d {
427
426
  /**
428
427
  * returns true if the matrix is an identity matrix.
429
428
  * @name isIdentity
430
- * @memberOf me.Matrix2d
429
+ * @memberof me.Matrix2d
431
430
  * @function
432
- * @return {Boolean}
433
- **/
431
+ * @returns {boolean}
432
+ */
434
433
  isIdentity() {
435
434
  var a = this.val;
436
435
 
@@ -450,10 +449,10 @@ class Matrix2d {
450
449
  /**
451
450
  * return true if the two matrices are identical
452
451
  * @name equals
453
- * @memberOf me.Matrix2d
452
+ * @memberof me.Matrix2d
454
453
  * @function
455
454
  * @param {me.Matrix2d} m the other matrix
456
- * @return {Boolean} true if both are equals
455
+ * @returns {boolean} true if both are equals
457
456
  */
458
457
  equals(m) {
459
458
  var b = m.val;
@@ -475,9 +474,9 @@ class Matrix2d {
475
474
  /**
476
475
  * Clone the Matrix
477
476
  * @name clone
478
- * @memberOf me.Matrix2d
477
+ * @memberof me.Matrix2d
479
478
  * @function
480
- * @return {me.Matrix2d}
479
+ * @returns {me.Matrix2d}
481
480
  */
482
481
  clone() {
483
482
  return pool.pull("Matrix2d", this);
@@ -486,9 +485,9 @@ class Matrix2d {
486
485
  /**
487
486
  * return an array representation of this Matrix
488
487
  * @name toArray
489
- * @memberOf me.Matrix2d
488
+ * @memberof me.Matrix2d
490
489
  * @function
491
- * @return {Float32Array}
490
+ * @returns {Float32Array}
492
491
  */
493
492
  toArray() {
494
493
  return this.val;
@@ -497,9 +496,9 @@ class Matrix2d {
497
496
  /**
498
497
  * convert the object to a string representation
499
498
  * @name toString
500
- * @memberOf me.Matrix2d
499
+ * @memberof me.Matrix2d
501
500
  * @function
502
- * @return {String}
501
+ * @returns {string}
503
502
  */
504
503
  toString() {
505
504
  var a = this.val;