melonjs 10.3.0 → 10.5.1

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 +6 -6
  2. package/dist/melonjs.js +3147 -3293
  3. package/dist/melonjs.min.js +4 -4
  4. package/dist/melonjs.module.d.ts +3411 -3852
  5. package/dist/melonjs.module.js +3448 -3210
  6. package/package.json +18 -17
  7. package/src/audio/audio.js +29 -30
  8. package/src/camera/camera2d.js +46 -56
  9. package/src/entity/entity.js +30 -36
  10. package/src/game.js +21 -22
  11. package/src/geometries/ellipse.js +40 -46
  12. package/src/geometries/line.js +9 -11
  13. package/src/geometries/poly.js +53 -53
  14. package/src/geometries/rectangle.js +42 -44
  15. package/src/index.js +9 -26
  16. package/src/input/gamepad.js +11 -10
  17. package/src/input/input.js +2 -3
  18. package/src/input/keyboard.js +113 -113
  19. package/src/input/pointer.js +30 -31
  20. package/src/input/pointerevent.js +26 -26
  21. package/src/lang/deprecated.js +65 -6
  22. package/src/level/level.js +23 -24
  23. package/src/level/tiled/TMXGroup.js +7 -8
  24. package/src/level/tiled/TMXLayer.js +30 -32
  25. package/src/level/tiled/TMXObject.js +21 -21
  26. package/src/level/tiled/TMXTile.js +18 -18
  27. package/src/level/tiled/TMXTileMap.js +39 -44
  28. package/src/level/tiled/TMXTileset.js +12 -15
  29. package/src/level/tiled/TMXTilesetGroup.js +9 -9
  30. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +7 -8
  31. package/src/level/tiled/renderer/TMXIsometricRenderer.js +7 -8
  32. package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +4 -5
  33. package/src/level/tiled/renderer/TMXRenderer.js +24 -25
  34. package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -4
  35. package/src/loader/loader.js +14 -15
  36. package/src/loader/loadingscreen.js +2 -4
  37. package/src/math/color.js +47 -66
  38. package/src/math/math.js +15 -16
  39. package/src/math/matrix2.js +53 -58
  40. package/src/math/matrix3.js +56 -62
  41. package/src/math/observable_vector2.js +75 -76
  42. package/src/math/observable_vector3.js +79 -80
  43. package/src/math/vector2.js +91 -92
  44. package/src/math/vector3.js +94 -96
  45. package/src/particles/emitter.js +38 -40
  46. package/src/particles/particle.js +4 -5
  47. package/src/particles/particlecontainer.js +2 -3
  48. package/src/physics/body.js +46 -143
  49. package/src/physics/bounds.js +47 -47
  50. package/src/physics/collision.js +13 -14
  51. package/src/physics/detector.js +18 -17
  52. package/src/physics/quadtree.js +17 -19
  53. package/src/physics/sat.js +26 -26
  54. package/src/physics/world.js +24 -28
  55. package/src/plugin/plugin.js +11 -14
  56. package/src/renderable/GUI.js +41 -46
  57. package/src/renderable/collectable.js +4 -8
  58. package/src/renderable/colorlayer.js +6 -10
  59. package/src/renderable/container.js +87 -72
  60. package/src/renderable/dragndrop.js +224 -0
  61. package/src/renderable/imagelayer.js +25 -31
  62. package/src/renderable/nineslicesprite.js +41 -41
  63. package/src/renderable/renderable.js +114 -125
  64. package/src/renderable/sprite.js +62 -68
  65. package/src/renderable/trigger.js +25 -30
  66. package/src/state/stage.js +13 -17
  67. package/src/state/state.js +26 -27
  68. package/src/system/device.js +74 -75
  69. package/src/system/event.js +71 -72
  70. package/src/system/pooling.js +11 -12
  71. package/src/system/save.js +3 -4
  72. package/src/system/timer.js +19 -20
  73. package/src/text/bitmaptext.js +57 -54
  74. package/src/text/bitmaptextdata.js +10 -10
  75. package/src/text/glyph.js +3 -0
  76. package/src/text/text.js +44 -49
  77. package/src/tweens/easing.js +1 -1
  78. package/src/tweens/interpolation.js +1 -1
  79. package/src/tweens/tween.js +43 -44
  80. package/src/utils/agent.js +3 -4
  81. package/src/utils/array.js +4 -5
  82. package/src/utils/file.js +3 -4
  83. package/src/utils/function.js +4 -5
  84. package/src/utils/string.js +7 -9
  85. package/src/utils/utils.js +4 -5
  86. package/src/video/canvas/canvas_renderer.js +58 -59
  87. package/src/video/renderer.js +49 -53
  88. package/src/video/texture.js +98 -111
  89. package/src/video/texture_cache.js +24 -6
  90. package/src/video/video.js +16 -17
  91. package/src/video/webgl/glshader.js +37 -38
  92. package/src/video/webgl/webgl_compositor.js +31 -32
  93. package/src/video/webgl/webgl_renderer.js +79 -80
  94. package/src/entity/draggable.js +0 -130
  95. package/src/entity/droptarget.js +0 -101
@@ -21,12 +21,11 @@ var V_ARRAY = [
21
21
  * @classdesc
22
22
  * A WebGL Compositor object. This class handles all of the WebGL state<br>
23
23
  * Pushes texture regions or shape geometry into WebGL buffers, automatically flushes to GPU
24
- * @class WebGLCompositor
25
- * @memberof me
26
- * @param {me.WebGLRenderer} renderer the current WebGL renderer session
27
24
  */
28
25
  class WebGLCompositor {
29
-
26
+ /**
27
+ * @param {WebGLRenderer} renderer the current WebGL renderer session
28
+ */
30
29
  constructor (renderer) {
31
30
  this.init(renderer);
32
31
  }
@@ -58,16 +57,16 @@ class WebGLCompositor {
58
57
  /**
59
58
  * a reference to the active WebGL shader
60
59
  * @name activeShader
61
- * @memberof me.WebGLCompositor
62
- * @type {me.GLShader}
60
+ * @memberof WebGLCompositor
61
+ * @type {GLShader}
63
62
  */
64
63
  this.activeShader = null;
65
64
 
66
65
  /**
67
66
  * primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
68
67
  * @name mode
69
- * @see me.WebGLCompositor
70
- * @memberof me.WebGLCompositor
68
+ * @see WebGLCompositor
69
+ * @memberof WebGLCompositor
71
70
  * @default gl.TRIANGLES
72
71
  */
73
72
  this.mode = gl.TRIANGLES;
@@ -75,8 +74,8 @@ class WebGLCompositor {
75
74
  /**
76
75
  * an array of vertex attribute properties
77
76
  * @name attributes
78
- * @see me.WebGLCompositor.addAttribute
79
- * @memberof me.WebGLCompositor
77
+ * @see WebGLCompositor.addAttribute
78
+ * @memberof WebGLCompositor
80
79
  */
81
80
  this.attributes = [];
82
81
 
@@ -84,8 +83,8 @@ class WebGLCompositor {
84
83
  * the size of a single vertex in bytes
85
84
  * (will automatically be calculated as attributes definitions are added)
86
85
  * @name vertexByteSize
87
- * @see me.WebGLCompositor.addAttribute
88
- * @memberof me.WebGLCompositor
86
+ * @see WebGLCompositor.addAttribute
87
+ * @memberof WebGLCompositor
89
88
  */
90
89
  this.vertexByteSize = 0;
91
90
 
@@ -93,8 +92,8 @@ class WebGLCompositor {
93
92
  * the size of a single vertex in floats
94
93
  * (will automatically be calculated as attributes definitions are added)
95
94
  * @name vertexSize
96
- * @see me.WebGLCompositor.addAttribute
97
- * @memberof me.WebGLCompositor
95
+ * @see WebGLCompositor.addAttribute
96
+ * @memberof WebGLCompositor
98
97
  */
99
98
  this.vertexSize = 0;
100
99
 
@@ -156,7 +155,7 @@ class WebGLCompositor {
156
155
  /**
157
156
  * add vertex attribute property definition to the compositor
158
157
  * @name addAttribute
159
- * @memberof me.WebGLCompositor
158
+ * @memberof WebGLCompositor
160
159
  * @function
161
160
  * @param {string} name name of the attribute in the vertex shader
162
161
  * @param {number} size number of components per vertex attribute. Must be 1, 2, 3, or 4.
@@ -204,7 +203,7 @@ class WebGLCompositor {
204
203
  /**
205
204
  * Sets the viewport
206
205
  * @name setViewport
207
- * @memberof me.WebGLCompositor
206
+ * @memberof WebGLCompositor
208
207
  * @function
209
208
  * @param {number} x x position of viewport
210
209
  * @param {number} y y position of viewport
@@ -218,12 +217,12 @@ class WebGLCompositor {
218
217
  /**
219
218
  * Create a WebGL texture from an image
220
219
  * @name createTexture2D
221
- * @memberof me.WebGLCompositor
220
+ * @memberof WebGLCompositor
222
221
  * @function
223
222
  * @param {number} unit Destination texture unit
224
223
  * @param {Image|HTMLCanvasElement|ImageData|Uint8Array[]|Float32Array[]} image Source image
225
224
  * @param {number} filter gl.LINEAR or gl.NEAREST
226
- * @param {string} [repeat="no-repeat"] Image repeat behavior (see {@link me.ImageLayer#repeat})
225
+ * @param {string} [repeat="no-repeat"] Image repeat behavior (see {@link ImageLayer#repeat})
227
226
  * @param {number} [w] Source image width (Only use with UInt8Array[] or Float32Array[] source image)
228
227
  * @param {number} [h] Source image height (Only use with UInt8Array[] or Float32Array[] source image)
229
228
  * @param {number} [b] Source image border (Only use with UInt8Array[] or Float32Array[] source image)
@@ -263,7 +262,7 @@ class WebGLCompositor {
263
262
  /**
264
263
  * delete the given WebGL texture
265
264
  * @name bindTexture2D
266
- * @memberof me.WebGLCompositor
265
+ * @memberof WebGLCompositor
267
266
  * @function
268
267
  * @param {WebGLTexture} [texture] a WebGL texture to delete
269
268
  * @param {number} [unit] Texture unit to delete
@@ -276,7 +275,7 @@ class WebGLCompositor {
276
275
  /**
277
276
  * returns the WebGL texture associated to the given texture unit
278
277
  * @name bindTexture2D
279
- * @memberof me.WebGLCompositor
278
+ * @memberof WebGLCompositor
280
279
  * @function
281
280
  * @param {number} unit Texture unit to which a texture is bound
282
281
  * @returns {WebGLTexture} texture a WebGL texture
@@ -288,7 +287,7 @@ class WebGLCompositor {
288
287
  /**
289
288
  * assign the given WebGL texture to the current batch
290
289
  * @name bindTexture2D
291
- * @memberof me.WebGLCompositor
290
+ * @memberof WebGLCompositor
292
291
  * @function
293
292
  * @param {WebGLTexture} texture a WebGL texture
294
293
  * @param {number} unit Texture unit to which the given texture is bound
@@ -316,7 +315,7 @@ class WebGLCompositor {
316
315
  /**
317
316
  * unbind the given WebGL texture, forcing it to be reuploaded
318
317
  * @name unbindTexture2D
319
- * @memberof me.WebGLCompositor
318
+ * @memberof WebGLCompositor
320
319
  * @function
321
320
  * @param {WebGLTexture} [texture] a WebGL texture
322
321
  * @param {number} [unit] a WebGL texture
@@ -363,10 +362,10 @@ class WebGLCompositor {
363
362
  /**
364
363
  * Select the shader to use for compositing
365
364
  * @name useShader
366
- * @see me.GLShader
367
- * @memberof me.WebGLCompositor
365
+ * @see GLShader
366
+ * @memberof WebGLCompositor
368
367
  * @function
369
- * @param {me.GLShader} shader a reference to a GLShader instance
368
+ * @param {GLShader} shader a reference to a GLShader instance
370
369
  */
371
370
  useShader(shader) {
372
371
  if (this.activeShader !== shader) {
@@ -394,9 +393,9 @@ class WebGLCompositor {
394
393
  /**
395
394
  * Add a textured quad
396
395
  * @name addQuad
397
- * @memberof me.WebGLCompositor
396
+ * @memberof WebGLCompositor
398
397
  * @function
399
- * @param {me.Renderer.Texture} texture Source texture
398
+ * @param {TextureAtlas} texture Source texture atlas
400
399
  * @param {number} x Destination x-coordinate
401
400
  * @param {number} y Destination y-coordinate
402
401
  * @param {number} w Destination width
@@ -451,7 +450,7 @@ class WebGLCompositor {
451
450
  /**
452
451
  * Flush batched texture operations to the GPU
453
452
  * @param {number} [mode=gl.TRIANGLES] the GL drawing mode
454
- * @memberof me.WebGLCompositor
453
+ * @memberof WebGLCompositor
455
454
  * @function
456
455
  */
457
456
  flush(mode = this.mode) {
@@ -479,10 +478,10 @@ class WebGLCompositor {
479
478
  /**
480
479
  * Draw an array of vertices
481
480
  * @name drawVertices
482
- * @memberof me.WebGLCompositor
481
+ * @memberof WebGLCompositor
483
482
  * @function
484
483
  * @param {GLenum} mode primitive type to render (gl.POINTS, gl.LINE_STRIP, gl.LINE_LOOP, gl.LINES, gl.TRIANGLE_STRIP, gl.TRIANGLE_FAN, gl.TRIANGLES)
485
- * @param {me.Vector2d[]} verts vertices
484
+ * @param {Vector2d[]} verts vertices
486
485
  * @param {number} [vertexCount=verts.length] amount of points defined in the points array
487
486
  */
488
487
  drawVertices(mode, verts, vertexCount = verts.length) {
@@ -509,7 +508,7 @@ class WebGLCompositor {
509
508
  /**
510
509
  * Specify the color values used when clearing color buffers. The values are clamped between 0 and 1.
511
510
  * @name clearColor
512
- * @memberof me.WebGLCompositor
511
+ * @memberof WebGLCompositor
513
512
  * @function
514
513
  * @param {number} [r=0] - the red color value used when the color buffers are cleared
515
514
  * @param {number} [g=0] - the green color value used when the color buffers are cleared
@@ -523,7 +522,7 @@ class WebGLCompositor {
523
522
  /**
524
523
  * Clear the frame buffer
525
524
  * @name clear
526
- * @memberof me.WebGLCompositor
525
+ * @memberof WebGLCompositor
527
526
  * @function
528
527
  */
529
528
  clear() {