melonjs 10.3.0 → 10.4.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 (94) hide show
  1. package/README.md +6 -6
  2. package/dist/melonjs.js +2419 -3072
  3. package/dist/melonjs.min.js +3 -3
  4. package/dist/melonjs.module.d.ts +3417 -3816
  5. package/dist/melonjs.module.js +2737 -3002
  6. package/package.json +16 -16
  7. package/src/audio/audio.js +29 -30
  8. package/src/camera/camera2d.js +46 -56
  9. package/src/entity/draggable.js +12 -13
  10. package/src/entity/droptarget.js +13 -15
  11. package/src/entity/entity.js +30 -36
  12. package/src/game.js +21 -22
  13. package/src/geometries/ellipse.js +40 -46
  14. package/src/geometries/line.js +9 -11
  15. package/src/geometries/poly.js +53 -53
  16. package/src/geometries/rectangle.js +42 -44
  17. package/src/index.js +4 -14
  18. package/src/input/gamepad.js +11 -10
  19. package/src/input/input.js +2 -3
  20. package/src/input/keyboard.js +113 -113
  21. package/src/input/pointer.js +30 -31
  22. package/src/input/pointerevent.js +26 -26
  23. package/src/lang/deprecated.js +25 -6
  24. package/src/level/level.js +23 -24
  25. package/src/level/tiled/TMXGroup.js +7 -8
  26. package/src/level/tiled/TMXLayer.js +30 -32
  27. package/src/level/tiled/TMXObject.js +21 -21
  28. package/src/level/tiled/TMXTile.js +18 -18
  29. package/src/level/tiled/TMXTileMap.js +37 -44
  30. package/src/level/tiled/TMXTileset.js +12 -15
  31. package/src/level/tiled/TMXTilesetGroup.js +9 -9
  32. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +7 -8
  33. package/src/level/tiled/renderer/TMXIsometricRenderer.js +7 -8
  34. package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +4 -5
  35. package/src/level/tiled/renderer/TMXRenderer.js +24 -25
  36. package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -4
  37. package/src/loader/loader.js +14 -15
  38. package/src/loader/loadingscreen.js +2 -4
  39. package/src/math/color.js +47 -66
  40. package/src/math/math.js +15 -16
  41. package/src/math/matrix2.js +53 -58
  42. package/src/math/matrix3.js +56 -62
  43. package/src/math/observable_vector2.js +75 -76
  44. package/src/math/observable_vector3.js +79 -80
  45. package/src/math/vector2.js +91 -92
  46. package/src/math/vector3.js +94 -96
  47. package/src/particles/emitter.js +38 -40
  48. package/src/particles/particle.js +4 -5
  49. package/src/particles/particlecontainer.js +2 -3
  50. package/src/physics/body.js +44 -142
  51. package/src/physics/bounds.js +47 -47
  52. package/src/physics/collision.js +13 -14
  53. package/src/physics/detector.js +14 -14
  54. package/src/physics/quadtree.js +17 -19
  55. package/src/physics/sat.js +26 -26
  56. package/src/physics/world.js +24 -28
  57. package/src/plugin/plugin.js +11 -14
  58. package/src/renderable/GUI.js +41 -46
  59. package/src/renderable/collectable.js +4 -8
  60. package/src/renderable/colorlayer.js +6 -10
  61. package/src/renderable/container.js +87 -72
  62. package/src/renderable/imagelayer.js +25 -31
  63. package/src/renderable/nineslicesprite.js +41 -41
  64. package/src/renderable/renderable.js +112 -122
  65. package/src/renderable/sprite.js +62 -68
  66. package/src/renderable/trigger.js +25 -30
  67. package/src/state/stage.js +13 -17
  68. package/src/state/state.js +26 -27
  69. package/src/system/device.js +74 -75
  70. package/src/system/event.js +71 -72
  71. package/src/system/pooling.js +11 -12
  72. package/src/system/save.js +3 -4
  73. package/src/system/timer.js +19 -20
  74. package/src/text/bitmaptext.js +57 -54
  75. package/src/text/bitmaptextdata.js +10 -10
  76. package/src/text/glyph.js +3 -0
  77. package/src/text/text.js +44 -49
  78. package/src/tweens/easing.js +1 -1
  79. package/src/tweens/interpolation.js +1 -1
  80. package/src/tweens/tween.js +43 -44
  81. package/src/utils/agent.js +3 -4
  82. package/src/utils/array.js +4 -5
  83. package/src/utils/file.js +3 -4
  84. package/src/utils/function.js +4 -5
  85. package/src/utils/string.js +7 -9
  86. package/src/utils/utils.js +4 -5
  87. package/src/video/canvas/canvas_renderer.js +58 -59
  88. package/src/video/renderer.js +49 -53
  89. package/src/video/texture.js +98 -111
  90. package/src/video/texture_cache.js +2 -2
  91. package/src/video/video.js +15 -16
  92. package/src/video/webgl/glshader.js +37 -38
  93. package/src/video/webgl/webgl_compositor.js +31 -32
  94. package/src/video/webgl/webgl_renderer.js +79 -80
@@ -3,15 +3,12 @@ import { EPSILON } from "./math.js";
3
3
 
4
4
  /**
5
5
  * @classdesc
6
- * a 4x4 Matrix3d Object<br>
7
- * @class Matrix3d
8
- * @memberof me
9
- * @param {me.Matrix3d} [mat3d] An instance of me.Matrix3d to copy from
10
- * @param {number[]} [arguments...] Matrix elements. See {@link me.Matrix3d.setTransform}
6
+ * a 4x4 Matrix3d Object
11
7
  */
12
-
13
8
  class Matrix3d {
14
-
9
+ /**
10
+ * @param {(Matrix3d|...number)} args An instance of me.Matrix3d to copy from, or individual Matrix components (See {@link Matrix3d.setTransform}). If not arguments are given, the matrix will be set to Identity.
11
+ */
15
12
  constructor(...args) {
16
13
  this.onResetEvent(...args);
17
14
  }
@@ -39,9 +36,8 @@ class Matrix3d {
39
36
  * tx component of the matrix
40
37
  * @public
41
38
  * @type {number}
42
- * @readonly
43
39
  * @name tx
44
- * @memberof me.Matrix3d
40
+ * @memberof Matrix3d
45
41
  */
46
42
  get tx() {
47
43
  return this.val[12];
@@ -51,9 +47,8 @@ class Matrix3d {
51
47
  * ty component of the matrix
52
48
  * @public
53
49
  * @type {number}
54
- * @readonly
55
50
  * @name ty
56
- * @memberof me.Matrix3d
51
+ * @memberof Matrix3d
57
52
  */
58
53
  get ty() {
59
54
  return this.val[13];
@@ -63,9 +58,8 @@ class Matrix3d {
63
58
  * ty component of the matrix
64
59
  * @public
65
60
  * @type {number}
66
- * @readonly
67
61
  * @name tz
68
- * @memberof me.Matrix3d
62
+ * @memberof Matrix3d
69
63
  */
70
64
  get tz() {
71
65
  return this.val[14];
@@ -76,9 +70,9 @@ class Matrix3d {
76
70
  * the identity matrix and parameters position : <br>
77
71
  * <img src="images/identity-matrix_2x.png"/>
78
72
  * @name identity
79
- * @memberof me.Matrix3d
73
+ * @memberof Matrix3d
80
74
  * @function
81
- * @returns {me.Matrix3d} Reference to this object for method chaining
75
+ * @returns {Matrix3d} Reference to this object for method chaining
82
76
  */
83
77
  identity() {
84
78
  return this.setTransform(
@@ -92,7 +86,7 @@ class Matrix3d {
92
86
  /**
93
87
  * set the matrix to the specified value
94
88
  * @name setTransform
95
- * @memberof me.Matrix3d
89
+ * @memberof Matrix3d
96
90
  * @function
97
91
  * @param {number} m00
98
92
  * @param {number} m01
@@ -110,7 +104,7 @@ class Matrix3d {
110
104
  * @param {number} m31
111
105
  * @param {number} m32
112
106
  * @param {number} m33
113
- * @returns {me.Matrix3d} Reference to this object for method chaining
107
+ * @returns {Matrix3d} Reference to this object for method chaining
114
108
  */
115
109
  setTransform(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33) {
116
110
  var a = this.val;
@@ -138,10 +132,10 @@ class Matrix3d {
138
132
  /**
139
133
  * Copies over the values from another me.Matrix3d.
140
134
  * @name copy
141
- * @memberof me.Matrix3d
135
+ * @memberof Matrix3d
142
136
  * @function
143
- * @param {me.Matrix3d} m the matrix object to copy from
144
- * @returns {me.Matrix3d} Reference to this object for method chaining
137
+ * @param {Matrix3d} m the matrix object to copy from
138
+ * @returns {Matrix3d} Reference to this object for method chaining
145
139
  */
146
140
  copy(m) {
147
141
  this.val.set(m.val);
@@ -151,10 +145,10 @@ class Matrix3d {
151
145
  /**
152
146
  * Copies over the upper-left 2x2 values from the given me.Matrix2d
153
147
  * @name fromMat2d
154
- * @memberof me.Matrix3d
148
+ * @memberof Matrix3d
155
149
  * @function
156
- * @param {me.Matrix2d} m the matrix object to copy from
157
- * @returns {me.Matrix2d} Reference to this object for method chaining
150
+ * @param {Matrix2d} m the matrix object to copy from
151
+ * @returns {Matrix2d} Reference to this object for method chaining
158
152
  */
159
153
  fromMat2d(m) {
160
154
  var b = m.val;
@@ -170,10 +164,10 @@ class Matrix3d {
170
164
  /**
171
165
  * multiply both matrix
172
166
  * @name multiply
173
- * @memberof me.Matrix3d
167
+ * @memberof Matrix3d
174
168
  * @function
175
- * @param {me.Matrix3d} m Other matrix
176
- * @returns {me.Matrix3d} Reference to this object for method chaining
169
+ * @param {Matrix3d} m Other matrix
170
+ * @returns {Matrix3d} Reference to this object for method chaining
177
171
  */
178
172
  multiply(m) {
179
173
  var a = this.val;
@@ -226,9 +220,9 @@ class Matrix3d {
226
220
  /**
227
221
  * Transpose the value of this matrix.
228
222
  * @name transpose
229
- * @memberof me.Matrix3d
223
+ * @memberof Matrix3d
230
224
  * @function
231
- * @returns {me.Matrix3d} Reference to this object for method chaining
225
+ * @returns {Matrix3d} Reference to this object for method chaining
232
226
  */
233
227
  transpose() {
234
228
  var a = this.val,
@@ -258,9 +252,9 @@ class Matrix3d {
258
252
  /**
259
253
  * invert this matrix, causing it to apply the opposite transformation.
260
254
  * @name invert
261
- * @memberof me.Matrix3d
255
+ * @memberof Matrix3d
262
256
  * @function
263
- * @returns {me.Matrix3d} Reference to this object for method chaining
257
+ * @returns {Matrix3d} Reference to this object for method chaining
264
258
  */
265
259
  invert() {
266
260
  var a = this.val;
@@ -318,10 +312,10 @@ class Matrix3d {
318
312
  /**
319
313
  * apply the current transform to the given 2d or 3d vector
320
314
  * @name apply
321
- * @memberof me.Matrix3d
315
+ * @memberof Matrix3d
322
316
  * @function
323
- * @param {me.Vector2d|me.Vector3d} v the vector object to be transformed
324
- * @returns {me.Vector2d|me.Vector3d} result vector object.
317
+ * @param {Vector2d|Vector3d} v the vector object to be transformed
318
+ * @returns {Vector2d|Vector3d} result vector object.
325
319
  */
326
320
  apply(v) {
327
321
  var a = this.val,
@@ -344,10 +338,10 @@ class Matrix3d {
344
338
  /**
345
339
  * apply the inverted current transform to the given 2d or 3d vector
346
340
  * @name applyInverse
347
- * @memberof me.Matrix3d
341
+ * @memberof Matrix3d
348
342
  * @function
349
- * @param {me.Vector2d|me.Vector3d} v the vector object to be transformed
350
- * @returns {me.Vector2d|me.Vector3d} result vector object.
343
+ * @param {Vector2d|Vector3d} v the vector object to be transformed
344
+ * @returns {Vector2d|Vector3d} result vector object.
351
345
  */
352
346
  applyInverse(v) {
353
347
  // invert the current matrix
@@ -365,7 +359,7 @@ class Matrix3d {
365
359
  * generate an orthogonal projection matrix, with the result replacing the current matrix
366
360
  * <img src="images/glOrtho.gif"/><br>
367
361
  * @name ortho
368
- * @memberof me.Matrix3d
362
+ * @memberof Matrix3d
369
363
  * @function
370
364
  * @param {number} left farthest left on the x-axis
371
365
  * @param {number} right farthest right on the x-axis
@@ -373,7 +367,7 @@ class Matrix3d {
373
367
  * @param {number} top farthest up on the y-axis
374
368
  * @param {number} near distance to the near clipping plane along the -Z axis
375
369
  * @param {number} far distance to the far clipping plane along the -Z axis
376
- * @returns {me.Matrix3d} Reference to this object for method chaining
370
+ * @returns {Matrix3d} Reference to this object for method chaining
377
371
  */
378
372
  ortho(left, right, bottom, top, near, far) {
379
373
  var a = this.val;
@@ -404,12 +398,12 @@ class Matrix3d {
404
398
  /**
405
399
  * scale the matrix
406
400
  * @name scale
407
- * @memberof me.Matrix3d
401
+ * @memberof Matrix3d
408
402
  * @function
409
403
  * @param {number} x a number representing the abscissa of the scaling vector.
410
404
  * @param {number} [y=x] a number representing the ordinate of the scaling vector.
411
405
  * @param {number} [z=0] a number representing the depth vector
412
- * @returns {me.Matrix3d} Reference to this object for method chaining
406
+ * @returns {Matrix3d} Reference to this object for method chaining
413
407
  */
414
408
  scale(x, y, z) {
415
409
  var a = this.val,
@@ -438,10 +432,10 @@ class Matrix3d {
438
432
  /**
439
433
  * adds a 2D scaling transformation.
440
434
  * @name scaleV
441
- * @memberof me.Matrix3d
435
+ * @memberof Matrix3d
442
436
  * @function
443
- * @param {me.Vector2d|me.Vector3d} v scaling vector
444
- * @returns {me.Matrix3d} Reference to this object for method chaining
437
+ * @param {Vector2d|Vector3d} v scaling vector
438
+ * @returns {Matrix3d} Reference to this object for method chaining
445
439
  */
446
440
  scaleV(v) {
447
441
  return this.scale(v.x, v.y, v.z);
@@ -450,10 +444,10 @@ class Matrix3d {
450
444
  /**
451
445
  * specifies a 2D scale operation using the [sx, 1] scaling vector
452
446
  * @name scaleX
453
- * @memberof me.Matrix3d
447
+ * @memberof Matrix3d
454
448
  * @function
455
449
  * @param {number} x x scaling vector
456
- * @returns {me.Matrix3d} Reference to this object for method chaining
450
+ * @returns {Matrix3d} Reference to this object for method chaining
457
451
  */
458
452
  scaleX(x) {
459
453
  return this.scale(x, 1);
@@ -462,10 +456,10 @@ class Matrix3d {
462
456
  /**
463
457
  * specifies a 2D scale operation using the [1,sy] scaling vector
464
458
  * @name scaleY
465
- * @memberof me.Matrix3d
459
+ * @memberof Matrix3d
466
460
  * @function
467
461
  * @param {number} y y scaling vector
468
- * @returns {me.Matrix3d} Reference to this object for method chaining
462
+ * @returns {Matrix3d} Reference to this object for method chaining
469
463
  */
470
464
  scaleY(y) {
471
465
  return this.scale(1, y);
@@ -474,11 +468,11 @@ class Matrix3d {
474
468
  /**
475
469
  * rotate this matrix (counter-clockwise) by the specified angle (in radians).
476
470
  * @name rotate
477
- * @memberof me.Matrix3d
471
+ * @memberof Matrix3d
478
472
  * @function
479
473
  * @param {number} angle Rotation angle in radians.
480
- * @param {me.Vector3d} v the axis to rotate around
481
- * @returns {me.Matrix3d} Reference to this object for method chaining
474
+ * @param {Vector3d} v the axis to rotate around
475
+ * @returns {Matrix3d} Reference to this object for method chaining
482
476
  */
483
477
  rotate(angle, v) {
484
478
  var a = this.val,
@@ -553,20 +547,20 @@ class Matrix3d {
553
547
  /**
554
548
  * translate the matrix position using the given vector
555
549
  * @name translate
556
- * @memberof me.Matrix3d
550
+ * @memberof Matrix3d
557
551
  * @function
558
552
  * @param {number} x a number representing the abscissa of the vector.
559
553
  * @param {number} [y=x] a number representing the ordinate of the vector.
560
554
  * @param {number} [z=0] a number representing the depth of the vector
561
- * @returns {me.Matrix3d} Reference to this object for method chaining
555
+ * @returns {Matrix3d} Reference to this object for method chaining
562
556
  */
563
557
  /**
564
558
  * translate the matrix by a vector on the horizontal and vertical axis
565
559
  * @name translateV
566
- * @memberof me.Matrix3d
560
+ * @memberof Matrix3d
567
561
  * @function
568
- * @param {me.Vector2d|me.Vector3d} v the vector to translate the matrix by
569
- * @returns {me.Matrix3d} Reference to this object for method chaining
562
+ * @param {Vector2d|Vector3d} v the vector to translate the matrix by
563
+ * @returns {Matrix3d} Reference to this object for method chaining
570
564
  */
571
565
  translate() {
572
566
  var a = this.val;
@@ -595,7 +589,7 @@ class Matrix3d {
595
589
  /**
596
590
  * returns true if the matrix is an identity matrix.
597
591
  * @name isIdentity
598
- * @memberof me.Matrix3d
592
+ * @memberof Matrix3d
599
593
  * @function
600
594
  * @returns {boolean}
601
595
  */
@@ -625,9 +619,9 @@ class Matrix3d {
625
619
  /**
626
620
  * return true if the two matrices are identical
627
621
  * @name equals
628
- * @memberof me.Matrix3d
622
+ * @memberof Matrix3d
629
623
  * @function
630
- * @param {me.Matrix3d} m the other matrix
624
+ * @param {Matrix3d} m the other matrix
631
625
  * @returns {boolean} true if both are equals
632
626
  */
633
627
  equals(m) {
@@ -657,9 +651,9 @@ class Matrix3d {
657
651
  /**
658
652
  * Clone the Matrix
659
653
  * @name clone
660
- * @memberof me.Matrix3d
654
+ * @memberof Matrix3d
661
655
  * @function
662
- * @returns {me.Matrix3d}
656
+ * @returns {Matrix3d}
663
657
  */
664
658
  clone() {
665
659
  return pool.pull("Matrix3d", this);
@@ -668,7 +662,7 @@ class Matrix3d {
668
662
  /**
669
663
  * return an array representation of this Matrix
670
664
  * @name toArray
671
- * @memberof me.Matrix3d
665
+ * @memberof Matrix3d
672
666
  * @function
673
667
  * @returns {Float32Array}
674
668
  */
@@ -679,7 +673,7 @@ class Matrix3d {
679
673
  /**
680
674
  * convert the object to a string representation
681
675
  * @name toString
682
- * @memberof me.Matrix3d
676
+ * @memberof Matrix3d
683
677
  * @function
684
678
  * @returns {string}
685
679
  */