melonjs 10.1.0 → 10.2.2

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 (92) hide show
  1. package/README.md +6 -12
  2. package/dist/melonjs.js +3119 -2857
  3. package/dist/melonjs.min.js +3 -3
  4. package/dist/melonjs.module.d.ts +2590 -2490
  5. package/dist/melonjs.module.js +2698 -2470
  6. package/package.json +10 -11
  7. package/src/audio/audio.js +43 -43
  8. package/src/camera/camera2d.js +55 -77
  9. package/src/entity/draggable.js +18 -17
  10. package/src/entity/droptarget.js +19 -18
  11. package/src/entity/entity.js +22 -26
  12. package/src/game.js +3 -3
  13. package/src/index.js +15 -11
  14. package/src/input/gamepad.js +13 -13
  15. package/src/input/input.js +1 -1
  16. package/src/input/keyboard.js +14 -16
  17. package/src/input/pointer.js +42 -35
  18. package/src/input/pointerevent.js +25 -33
  19. package/src/lang/deprecated.js +3 -3
  20. package/src/level/level.js +24 -16
  21. package/src/level/tiled/TMXGroup.js +6 -6
  22. package/src/level/tiled/TMXLayer.js +31 -31
  23. package/src/level/tiled/TMXObject.js +19 -19
  24. package/src/level/tiled/TMXTile.js +11 -12
  25. package/src/level/tiled/TMXTileMap.js +23 -21
  26. package/src/level/tiled/TMXTileset.js +13 -13
  27. package/src/level/tiled/TMXTilesetGroup.js +4 -4
  28. package/src/level/tiled/TMXUtils.js +13 -11
  29. package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
  30. package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
  31. package/src/level/tiled/renderer/TMXRenderer.js +17 -17
  32. package/src/loader/loader.js +31 -27
  33. package/src/loader/loadingscreen.js +40 -72
  34. package/src/math/color.js +45 -64
  35. package/src/math/math.js +17 -17
  36. package/src/math/matrix2.js +46 -46
  37. package/src/math/matrix3.js +64 -64
  38. package/src/math/observable_vector2.js +45 -57
  39. package/src/math/observable_vector3.js +56 -70
  40. package/src/math/vector2.js +60 -59
  41. package/src/math/vector3.js +65 -64
  42. package/src/particles/emitter.js +53 -55
  43. package/src/particles/particle.js +1 -1
  44. package/src/physics/body.js +45 -51
  45. package/src/physics/bounds.js +36 -36
  46. package/src/physics/collision.js +15 -16
  47. package/src/physics/detector.js +10 -11
  48. package/src/physics/quadtree.js +19 -17
  49. package/src/physics/sat.js +17 -17
  50. package/src/physics/world.js +13 -10
  51. package/src/plugin/plugin.js +6 -6
  52. package/src/renderable/GUI.js +13 -18
  53. package/src/renderable/collectable.js +3 -3
  54. package/src/renderable/colorlayer.js +4 -4
  55. package/src/renderable/container.js +65 -46
  56. package/src/renderable/imagelayer.js +32 -31
  57. package/src/renderable/nineslicesprite.js +211 -0
  58. package/src/renderable/renderable.js +69 -67
  59. package/src/renderable/sprite.js +57 -43
  60. package/src/renderable/trigger.js +14 -15
  61. package/src/shapes/ellipse.js +27 -26
  62. package/src/shapes/line.js +8 -7
  63. package/src/shapes/poly.js +33 -31
  64. package/src/shapes/rectangle.js +50 -96
  65. package/src/state/stage.js +8 -8
  66. package/src/state/state.js +56 -56
  67. package/src/system/device.js +97 -84
  68. package/src/system/event.js +72 -72
  69. package/src/system/pooling.js +14 -14
  70. package/src/system/save.js +6 -3
  71. package/src/system/timer.js +20 -20
  72. package/src/text/bitmaptext.js +27 -33
  73. package/src/text/bitmaptextdata.js +9 -9
  74. package/src/text/text.js +118 -59
  75. package/src/tweens/easing.js +4 -4
  76. package/src/tweens/interpolation.js +4 -4
  77. package/src/tweens/tween.js +37 -27
  78. package/src/utils/agent.js +9 -8
  79. package/src/utils/array.js +4 -4
  80. package/src/utils/file.js +4 -4
  81. package/src/utils/function.js +5 -5
  82. package/src/utils/string.js +12 -12
  83. package/src/utils/utils.js +19 -19
  84. package/src/video/canvas/canvas_renderer.js +90 -90
  85. package/src/video/renderer.js +40 -39
  86. package/src/video/texture.js +85 -76
  87. package/src/video/texture_cache.js +11 -0
  88. package/src/video/video.js +30 -30
  89. package/src/video/webgl/buffer/vertex.js +9 -1
  90. package/src/video/webgl/glshader.js +20 -20
  91. package/src/video/webgl/webgl_compositor.js +47 -37
  92. package/src/video/webgl/webgl_renderer.js +104 -104
@@ -79,7 +79,7 @@ class WebGLCompositor {
79
79
  * The number of quads held in the batch
80
80
  * @name length
81
81
  * @memberOf me.WebGLCompositor
82
- * @type Number
82
+ * @type {number}
83
83
  * @readonly
84
84
  */
85
85
  //this.length = 0;
@@ -196,11 +196,11 @@ class WebGLCompositor {
196
196
  * @name addAttribute
197
197
  * @memberOf me.WebGLCompositor
198
198
  * @function
199
- * @param {String} name name of the attribute in the vertex shader
200
- * @param {Number} size number of components per vertex attribute. Must be 1, 2, 3, or 4.
199
+ * @param {string} name name of the attribute in the vertex shader
200
+ * @param {number} size number of components per vertex attribute. Must be 1, 2, 3, or 4.
201
201
  * @param {GLenum} type data type of each component in the array
202
- * @param {Boolean} normalized whether integer data values should be normalized into a certain range when being cast to a float
203
- * @param {Number} offset offset in bytes of the first component in the vertex attribute array
202
+ * @param {boolean} normalized whether integer data values should be normalized into a certain range when being cast to a float
203
+ * @param {number} offset offset in bytes of the first component in the vertex attribute array
204
204
  */
205
205
  addAttribute(name, size, type, normalized, offset) {
206
206
  this.attributes.push({
@@ -217,10 +217,10 @@ class WebGLCompositor {
217
217
  * @name setViewport
218
218
  * @memberOf me.WebGLCompositor
219
219
  * @function
220
- * @param {Number} x x position of viewport
221
- * @param {Number} y y position of viewport
222
- * @param {Number} width width of viewport
223
- * @param {Number} height height of viewport
220
+ * @param {number} x x position of viewport
221
+ * @param {number} y y position of viewport
222
+ * @param {number} w width of viewport
223
+ * @param {number} h height of viewport
224
224
  */
225
225
  setViewport(x, y, w, h) {
226
226
  this.gl.viewport(x, y, w, h);
@@ -231,17 +231,16 @@ class WebGLCompositor {
231
231
  * @name createTexture2D
232
232
  * @memberOf me.WebGLCompositor
233
233
  * @function
234
- * @param {Number} unit Destination texture unit
235
- * @param {Image|Canvas|ImageData|UInt8Array[]|Float32Array[]} image Source image
236
- * @param {Number} filter gl.LINEAR or gl.NEAREST
237
- * @param {String} [repeat="no-repeat"] Image repeat behavior (see {@link me.ImageLayer#repeat})
238
- * @param {Number} [w] Source image width (Only use with UInt8Array[] or Float32Array[] source image)
239
- * @param {Number} [h] Source image height (Only use with UInt8Array[] or Float32Array[] source image)
240
- * @param {Number} [b] Source image border (Only use with UInt8Array[] or Float32Array[] source image)
241
- * @param {Number} [b] Source image border (Only use with UInt8Array[] or Float32Array[] source image)
242
- * @param {Boolean} [premultipliedAlpha=true] Multiplies the alpha channel into the other color channels
243
- * @param {Boolean} [mipmap=true] Whether mipmap levels should be generated for this texture
244
- * @return {WebGLTexture} a WebGL texture
234
+ * @param {number} unit Destination texture unit
235
+ * @param {Image|HTMLCanvasElement|ImageData|Uint8Array[]|Float32Array[]} image Source image
236
+ * @param {number} filter gl.LINEAR or gl.NEAREST
237
+ * @param {string} [repeat="no-repeat"] Image repeat behavior (see {@link me.ImageLayer#repeat})
238
+ * @param {number} [w] Source image width (Only use with UInt8Array[] or Float32Array[] source image)
239
+ * @param {number} [h] Source image height (Only use with UInt8Array[] or Float32Array[] source image)
240
+ * @param {number} [b] Source image border (Only use with UInt8Array[] or Float32Array[] source image)
241
+ * @param {boolean} [premultipliedAlpha=true] Multiplies the alpha channel into the other color channels
242
+ * @param {boolean} [mipmap=true] Whether mipmap levels should be generated for this texture
243
+ * @returns {WebGLTexture} a WebGL texture
245
244
  */
246
245
  createTexture2D(unit, image, filter, repeat = "no-repeat", w, h, b, premultipliedAlpha = true, mipmap = true) {
247
246
  var gl = this.gl;
@@ -250,7 +249,7 @@ class WebGLCompositor {
250
249
  var rs = (repeat.search(/^repeat(-x)?$/) === 0) && (isPOT || this.renderer.WebGLVersion > 1) ? gl.REPEAT : gl.CLAMP_TO_EDGE;
251
250
  var rt = (repeat.search(/^repeat(-y)?$/) === 0) && (isPOT || this.renderer.WebGLVersion > 1) ? gl.REPEAT : gl.CLAMP_TO_EDGE;
252
251
 
253
- this.setTexture2D(texture, unit);
252
+ this.bindTexture2D(texture, unit);
254
253
 
255
254
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, rs);
256
255
  gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, rt);
@@ -274,13 +273,13 @@ class WebGLCompositor {
274
273
 
275
274
  /**
276
275
  * assign the given WebGL texture to the current batch
277
- * @name setTexture2D
276
+ * @name bindTexture2D
278
277
  * @memberOf me.WebGLCompositor
279
278
  * @function
280
- * @param {WebGLTexture} a WebGL texture
281
- * @param {Number} unit Texture unit to which the given texture is bound
279
+ * @param {WebGLTexture} texture a WebGL texture
280
+ * @param {number} unit Texture unit to which the given texture is bound
282
281
  */
283
- setTexture2D(texture, unit) {
282
+ bindTexture2D(texture, unit) {
284
283
  var gl = this.gl;
285
284
 
286
285
  if (texture !== this.boundTextures[unit]) {
@@ -300,6 +299,17 @@ class WebGLCompositor {
300
299
  }
301
300
  }
302
301
 
302
+ /**
303
+ * unbind the given WebGL texture, forcing it to be reuploaded
304
+ * @name unbindTexture2D
305
+ * @memberOf me.WebGLCompositor
306
+ * @function
307
+ * @param {WebGLTexture} texture a WebGL texture
308
+ */
309
+ unbindTexture2D(texture) {
310
+ var unit = this.renderer.cache.getUnit(texture);
311
+ this.boundTextures[unit] = null;
312
+ }
303
313
 
304
314
  /**
305
315
  * @ignore
@@ -320,7 +330,7 @@ class WebGLCompositor {
320
330
  texture.premultipliedAlpha
321
331
  );
322
332
  } else {
323
- this.setTexture2D(texture2D, unit);
333
+ this.bindTexture2D(texture2D, unit);
324
334
  }
325
335
 
326
336
  return this.currentTextureUnit;
@@ -363,10 +373,10 @@ class WebGLCompositor {
363
373
  * @memberOf me.WebGLCompositor
364
374
  * @function
365
375
  * @param {me.Renderer.Texture} texture Source texture
366
- * @param {Number} x Destination x-coordinate
367
- * @param {Number} y Destination y-coordinate
368
- * @param {Number} w Destination width
369
- * @param {Number} h Destination height
376
+ * @param {number} x Destination x-coordinate
377
+ * @param {number} y Destination y-coordinate
378
+ * @param {number} w Destination width
379
+ * @param {number} h Destination height
370
380
  * @param {number} u0 Texture UV (u0) value.
371
381
  * @param {number} v0 Texture UV (v0) value.
372
382
  * @param {number} u1 Texture UV (u1) value.
@@ -414,7 +424,7 @@ class WebGLCompositor {
414
424
 
415
425
  /**
416
426
  * Flush batched texture operations to the GPU
417
- * @param
427
+ * @param {number} [mode=gl.TRIANGLES] the GL drawing mode
418
428
  * @memberOf me.WebGLCompositor
419
429
  * @function
420
430
  */
@@ -452,9 +462,9 @@ class WebGLCompositor {
452
462
  * @name drawVertices
453
463
  * @memberOf me.WebGLCompositor
454
464
  * @function
455
- * @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)
465
+ * @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)
456
466
  * @param {me.Vector2d[]} verts vertices
457
- * @param {Number} [vertexCount=verts.length] amount of points defined in the points array
467
+ * @param {number} [vertexCount=verts.length] amount of points defined in the points array
458
468
  */
459
469
  drawVertices(mode, verts, vertexCount = verts.length) {
460
470
  // use the primitive shader
@@ -482,10 +492,10 @@ class WebGLCompositor {
482
492
  * @name clearColor
483
493
  * @memberOf me.WebGLCompositor
484
494
  * @function
485
- * @param {Number} r - the red color value used when the color buffers are cleared
486
- * @param {Number} g - the green color value used when the color buffers are cleared
487
- * @param {Number} b - the blue color value used when the color buffers are cleared
488
- * @param {Number} a - the alpha color value used when the color buffers are cleared
495
+ * @param {number} r - the red color value used when the color buffers are cleared
496
+ * @param {number} g - the green color value used when the color buffers are cleared
497
+ * @param {number} b - the blue color value used when the color buffers are cleared
498
+ * @param {number} a - the alpha color value used when the color buffers are cleared
489
499
  */
490
500
  clearColor(r, g, b, a) {
491
501
  this.gl.clearColor(r, g, b, a);
@@ -18,19 +18,19 @@ import { isPowerOfTwo, nextPowerOfTwo, TAU } from "./../../math/math.js";
18
18
  * @extends me.Renderer
19
19
  * @memberOf me
20
20
  * @constructor
21
- * @param {Object} options The renderer parameters
22
- * @param {Number} options.width The width of the canvas without scaling
23
- * @param {Number} options.height The height of the canvas without scaling
21
+ * @param {object} options The renderer parameters
22
+ * @param {number} options.width The width of the canvas without scaling
23
+ * @param {number} options.height The height of the canvas without scaling
24
24
  * @param {HTMLCanvasElement} [options.canvas] The html canvas to draw to on screen
25
- * @param {Boolean} [options.doubleBuffering=false] Whether to enable double buffering
26
- * @param {Boolean} [options.antiAlias=false] Whether to enable anti-aliasing
27
- * @param {Boolean} [options.failIfMajorPerformanceCaveat=true] If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
28
- * @param {Boolean} [options.transparent=false] Whether to enable transparency on the canvas (performance hit when enabled)
29
- * @param {Boolean} [options.subPixel=false] Whether to enable subpixel renderering (performance hit when enabled)
30
- * @param {Boolean} [options.preferWebGL1=false] if true the renderer will only use WebGL 1
31
- * @param {String} [options.powerPreference="default"] a hint to the user agent indicating what configuration of GPU is suitable for the WebGL context ("default", "high-performance", "low-power"). To be noted that Safari and Chrome (since version 80) both default to "low-power" to save battery life and improve the user experience on these dual-GPU machines.
32
- * @param {Number} [options.zoomX=width] The actual width of the canvas with scaling applied
33
- * @param {Number} [options.zoomY=height] The actual height of the canvas with scaling applied
25
+ * @param {boolean} [options.doubleBuffering=false] Whether to enable double buffering
26
+ * @param {boolean} [options.antiAlias=false] Whether to enable anti-aliasing
27
+ * @param {boolean} [options.failIfMajorPerformanceCaveat=true] If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
28
+ * @param {boolean} [options.transparent=false] Whether to enable transparency on the canvas (performance hit when enabled)
29
+ * @param {boolean} [options.subPixel=false] Whether to enable subpixel renderering (performance hit when enabled)
30
+ * @param {boolean} [options.preferWebGL1=false] if true the renderer will only use WebGL 1
31
+ * @param {string} [options.powerPreference="default"] a hint to the user agent indicating what configuration of GPU is suitable for the WebGL context ("default", "high-performance", "low-power"). To be noted that Safari and Chrome (since version 80) both default to "low-power" to save battery life and improve the user experience on these dual-GPU machines.
32
+ * @param {number} [options.zoomX=width] The actual width of the canvas with scaling applied
33
+ * @param {number} [options.zoomY=height] The actual height of the canvas with scaling applied
34
34
  * @param {me.WebGLCompositor} [options.compositor] A class that implements the compositor API
35
35
  */
36
36
  class WebGLRenderer extends Renderer {
@@ -44,7 +44,7 @@ class WebGLRenderer extends Renderer {
44
44
  * The WebGL version used by this renderer (1 or 2)
45
45
  * @name WebGLVersion
46
46
  * @memberOf me.WebGLRenderer
47
- * @type {Number}
47
+ * @type {number}
48
48
  * @default 1
49
49
  * @readonly
50
50
  */
@@ -54,7 +54,7 @@ class WebGLRenderer extends Renderer {
54
54
  * The vendor string of the underlying graphics driver.
55
55
  * @name GPUVendor
56
56
  * @memberOf me.WebGLRenderer
57
- * @type {String}
57
+ * @type {string}
58
58
  * @default null
59
59
  * @readonly
60
60
  */
@@ -64,7 +64,7 @@ class WebGLRenderer extends Renderer {
64
64
  * The renderer string of the underlying graphics driver.
65
65
  * @name GPURenderer
66
66
  * @memberOf me.WebGLRenderer
67
- * @type {String}
67
+ * @type {string}
68
68
  * @default null
69
69
  * @readonly
70
70
  */
@@ -82,7 +82,7 @@ class WebGLRenderer extends Renderer {
82
82
  * Maximum number of texture unit supported under the current context
83
83
  * @name maxTextures
84
84
  * @memberOf me.WebGLRenderer
85
- * @type {Number}
85
+ * @type {number}
86
86
  * @readonly
87
87
  */
88
88
  this.maxTextures = this.gl.getParameter(this.gl.MAX_TEXTURE_IMAGE_UNITS);
@@ -115,7 +115,7 @@ class WebGLRenderer extends Renderer {
115
115
  /**
116
116
  * The current transformation matrix used for transformations on the overall scene
117
117
  * @name currentTransform
118
- * @type me.Matrix2d
118
+ * @type {me.Matrix2d}
119
119
  * @memberOf me.WebGLRenderer#
120
120
  */
121
121
  this.currentTransform = new Matrix2d();
@@ -123,7 +123,7 @@ class WebGLRenderer extends Renderer {
123
123
  /**
124
124
  * The current compositor used by the renderer
125
125
  * @name currentCompositor
126
- * @type me.WebGLCompositor
126
+ * @type {me.WebGLCompositor}
127
127
  * @memberOf me.WebGLRenderer#
128
128
  */
129
129
  this.currentCompositor = null;
@@ -258,9 +258,9 @@ class WebGLRenderer extends Renderer {
258
258
  * @name createPattern
259
259
  * @memberOf me.WebGLRenderer.prototype
260
260
  * @function
261
- * @param {image} image Source image
262
- * @param {String} repeat Define how the pattern should be repeated
263
- * @return {me.Renderer.Texture}
261
+ * @param {Image} image Source image
262
+ * @param {string} repeat Define how the pattern should be repeated
263
+ * @returns {me.Renderer.Texture}
264
264
  * @see me.ImageLayer#repeat
265
265
  * @example
266
266
  * var tileable = renderer.createPattern(image, "repeat");
@@ -301,19 +301,19 @@ class WebGLRenderer extends Renderer {
301
301
  * @name clearColor
302
302
  * @memberOf me.WebGLRenderer.prototype
303
303
  * @function
304
- * @param {me.Color|String} [color] CSS color.
305
- * @param {Boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
304
+ * @param {me.Color|string} color CSS color.
305
+ * @param {boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
306
306
  */
307
- clearColor(col, opaque) {
307
+ clearColor(color, opaque) {
308
308
  var glArray;
309
309
 
310
310
  this.save();
311
311
 
312
- if (col instanceof Color) {
313
- glArray = col.toArray();
312
+ if (color instanceof Color) {
313
+ glArray = color.toArray();
314
314
  } else {
315
315
  // reuse temporary the renderer default color object
316
- glArray = this.getColor().parseCSS(col).toArray();
316
+ glArray = this.getColor().parseCSS(color).toArray();
317
317
  }
318
318
 
319
319
  // clear gl context with the specified color
@@ -331,10 +331,10 @@ class WebGLRenderer extends Renderer {
331
331
  * @name clearRect
332
332
  * @memberOf me.WebGLRenderer.prototype
333
333
  * @function
334
- * @param {Number} x x axis of the coordinate for the rectangle starting point.
335
- * @param {Number} y y axis of the coordinate for the rectangle starting point.
336
- * @param {Number} width The rectangle's width.
337
- * @param {Number} height The rectangle's height.
334
+ * @param {number} x x axis of the coordinate for the rectangle starting point.
335
+ * @param {number} y y axis of the coordinate for the rectangle starting point.
336
+ * @param {number} width The rectangle's width.
337
+ * @param {number} height The rectangle's height.
338
338
  */
339
339
  clearRect(x, y, width, height) {
340
340
  var color = this.currentColor.clone();
@@ -383,14 +383,14 @@ class WebGLRenderer extends Renderer {
383
383
  * @memberOf me.WebGLRenderer.prototype
384
384
  * @function
385
385
  * @param {Image} image An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas.
386
- * @param {Number} sx The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
387
- * @param {Number} sy The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
388
- * @param {Number} sw The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.
389
- * @param {Number} sh The height of the sub-rectangle of the source image to draw into the destination context.
390
- * @param {Number} dx The X coordinate in the destination canvas at which to place the top-left corner of the source image.
391
- * @param {Number} dy The Y coordinate in the destination canvas at which to place the top-left corner of the source image.
392
- * @param {Number} dWidth The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.
393
- * @param {Number} dHeight The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.
386
+ * @param {number} sx The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
387
+ * @param {number} sy The Y coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
388
+ * @param {number} sw The width of the sub-rectangle of the source image to draw into the destination context. If not specified, the entire rectangle from the coordinates specified by sx and sy to the bottom-right corner of the image is used.
389
+ * @param {number} sh The height of the sub-rectangle of the source image to draw into the destination context.
390
+ * @param {number} dx The X coordinate in the destination canvas at which to place the top-left corner of the source image.
391
+ * @param {number} dy The Y coordinate in the destination canvas at which to place the top-left corner of the source image.
392
+ * @param {number} dw The width to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in width when drawn.
393
+ * @param {number} dh The height to draw the image in the destination canvas. This allows scaling of the drawn image. If not specified, the image is not scaled in height when drawn.
394
394
  * @example
395
395
  * // Position the image on the canvas:
396
396
  * renderer.drawImage(image, dx, dy);
@@ -436,10 +436,10 @@ class WebGLRenderer extends Renderer {
436
436
  * @memberOf me.WebGLRenderer.prototype
437
437
  * @function
438
438
  * @param {me.Renderer.Texture} pattern Pattern object
439
- * @param {Number} x
440
- * @param {Number} y
441
- * @param {Number} width
442
- * @param {Number} height
439
+ * @param {number} x
440
+ * @param {number} y
441
+ * @param {number} width
442
+ * @param {number} height
443
443
  * @see me.WebGLRenderer#createPattern
444
444
  */
445
445
  drawPattern(pattern, x, y, width, height) {
@@ -453,7 +453,7 @@ class WebGLRenderer extends Renderer {
453
453
  * @name getScreenContext
454
454
  * @memberOf me.WebGLRenderer.prototype
455
455
  * @function
456
- * @return {WebGLRenderingContext}
456
+ * @returns {WebGLRenderingContext}
457
457
  */
458
458
  getScreenContext() {
459
459
  return this.gl;
@@ -464,9 +464,9 @@ class WebGLRenderer extends Renderer {
464
464
  * @name getContextGL
465
465
  * @memberOf me.WebGLRenderer.prototype
466
466
  * @function
467
- * @param {Canvas} canvas
468
- * @param {Boolean} [transparent=true] use false to disable transparency
469
- * @return {WebGLRenderingContext}
467
+ * @param {HTMLCanvasElement} canvas
468
+ * @param {boolean} [transparent=true] use false to disable transparency
469
+ * @returns {WebGLRenderingContext}
470
470
  */
471
471
  getContextGL(canvas, transparent) {
472
472
  if (typeof canvas === "undefined" || canvas === null) {
@@ -522,7 +522,7 @@ class WebGLRenderer extends Renderer {
522
522
  * @name getContext
523
523
  * @memberOf me.WebGLRenderer.prototype
524
524
  * @function
525
- * @return {WebGLRenderingContext}
525
+ * @returns {WebGLRenderingContext}
526
526
  */
527
527
  getContext() {
528
528
  return this.gl;
@@ -533,7 +533,7 @@ class WebGLRenderer extends Renderer {
533
533
  * @name setBlendMode
534
534
  * @memberOf me.WebGLRenderer.prototype
535
535
  * @function
536
- * @param {String} [mode="normal"] blend mode : "normal", "multiply"
536
+ * @param {string} [mode="normal"] blend mode : "normal", "multiply"
537
537
  * @param {WebGLRenderingContext} [gl]
538
538
  */
539
539
  setBlendMode(mode, gl) {
@@ -623,7 +623,7 @@ class WebGLRenderer extends Renderer {
623
623
  * @name rotate
624
624
  * @memberOf me.WebGLRenderer.prototype
625
625
  * @function
626
- * @param {Number} angle in radians
626
+ * @param {number} angle in radians
627
627
  */
628
628
  rotate(angle) {
629
629
  this.currentTransform.rotate(angle);
@@ -634,8 +634,8 @@ class WebGLRenderer extends Renderer {
634
634
  * @name scale
635
635
  * @memberOf me.WebGLRenderer.prototype
636
636
  * @function
637
- * @param {Number} x
638
- * @param {Number} y
637
+ * @param {number} x
638
+ * @param {number} y
639
639
  */
640
640
  scale(x, y) {
641
641
  this.currentTransform.scale(x, y);
@@ -655,10 +655,10 @@ class WebGLRenderer extends Renderer {
655
655
  * @name setGlobalAlpha
656
656
  * @memberOf me.WebGLRenderer.prototype
657
657
  * @function
658
- * @param {Number} alpha 0.0 to 1.0 values accepted.
658
+ * @param {number} alpha 0.0 to 1.0 values accepted.
659
659
  */
660
- setGlobalAlpha(a) {
661
- this.currentColor.alpha = a;
660
+ setGlobalAlpha(alpha) {
661
+ this.currentColor.alpha = alpha;
662
662
  }
663
663
 
664
664
  /**
@@ -667,7 +667,7 @@ class WebGLRenderer extends Renderer {
667
667
  * @name setColor
668
668
  * @memberOf me.WebGLRenderer.prototype
669
669
  * @function
670
- * @param {me.Color|String} color css color string.
670
+ * @param {me.Color|string} color css color string.
671
671
  */
672
672
  setColor(color) {
673
673
  var alpha = this.currentColor.alpha;
@@ -680,7 +680,7 @@ class WebGLRenderer extends Renderer {
680
680
  * @name setLineWidth
681
681
  * @memberOf me.WebGLRenderer.prototype
682
682
  * @function
683
- * @param {Number} width Line width
683
+ * @param {number} width Line width
684
684
  */
685
685
  setLineWidth(width) {
686
686
  this.getScreenContext().lineWidth(width);
@@ -691,13 +691,13 @@ class WebGLRenderer extends Renderer {
691
691
  * @name strokeArc
692
692
  * @memberOf me.WebGLRenderer.prototype
693
693
  * @function
694
- * @param {Number} x arc center point x-axis
695
- * @param {Number} y arc center point y-axis
696
- * @param {Number} radius
697
- * @param {Number} start start angle in radians
698
- * @param {Number} end end angle in radians
699
- * @param {Boolean} [antiClockwise=false] draw arc anti-clockwise
700
- * @param {Boolean} [fill=false]
694
+ * @param {number} x arc center point x-axis
695
+ * @param {number} y arc center point y-axis
696
+ * @param {number} radius
697
+ * @param {number} start start angle in radians
698
+ * @param {number} end end angle in radians
699
+ * @param {boolean} [antiClockwise=false] draw arc anti-clockwise
700
+ * @param {boolean} [fill=false]
701
701
  */
702
702
  strokeArc(x, y, radius, start, end, antiClockwise = false, fill) {
703
703
  if (fill === true ) {
@@ -735,12 +735,12 @@ class WebGLRenderer extends Renderer {
735
735
  * @name fillArc
736
736
  * @memberOf me.WebGLRenderer.prototype
737
737
  * @function
738
- * @param {Number} x arc center point x-axis
739
- * @param {Number} y arc center point y-axis
740
- * @param {Number} radius
741
- * @param {Number} start start angle in radians
742
- * @param {Number} end end angle in radians
743
- * @param {Boolean} [antiClockwise=false] draw arc anti-clockwise
738
+ * @param {number} x arc center point x-axis
739
+ * @param {number} y arc center point y-axis
740
+ * @param {number} radius
741
+ * @param {number} start start angle in radians
742
+ * @param {number} end end angle in radians
743
+ * @param {boolean} [antiClockwise=false] draw arc anti-clockwise
744
744
  */
745
745
  fillArc(x, y, radius, start, end /*, antiClockwise = false*/) {
746
746
  // XXX to be optimzed using a specific shader
@@ -778,11 +778,11 @@ class WebGLRenderer extends Renderer {
778
778
  * @name strokeEllipse
779
779
  * @memberOf me.WebGLRenderer.prototype
780
780
  * @function
781
- * @param {Number} x ellipse center point x-axis
782
- * @param {Number} y ellipse center point y-axis
783
- * @param {Number} w horizontal radius of the ellipse
784
- * @param {Number} h vertical radius of the ellipse
785
- * @param {Boolean} [fill=false] also fill the shape with the current color if true
781
+ * @param {number} x ellipse center point x-axis
782
+ * @param {number} y ellipse center point y-axis
783
+ * @param {number} w horizontal radius of the ellipse
784
+ * @param {number} h vertical radius of the ellipse
785
+ * @param {boolean} [fill=false] also fill the shape with the current color if true
786
786
  */
787
787
  strokeEllipse(x, y, w, h, fill = false) {
788
788
  if (fill === true ) {
@@ -815,10 +815,10 @@ class WebGLRenderer extends Renderer {
815
815
  * @name fillEllipse
816
816
  * @memberOf me.WebGLRenderer.prototype
817
817
  * @function
818
- * @param {Number} x ellipse center point x-axis
819
- * @param {Number} y ellipse center point y-axis
820
- * @param {Number} w horizontal radius of the ellipse
821
- * @param {Number} h vertical radius of the ellipse
818
+ * @param {number} x ellipse center point x-axis
819
+ * @param {number} y ellipse center point y-axis
820
+ * @param {number} w horizontal radius of the ellipse
821
+ * @param {number} h vertical radius of the ellipse
822
822
  */
823
823
  fillEllipse(x, y, w, h) {
824
824
  // XXX to be optimzed using a specific shader
@@ -850,10 +850,10 @@ class WebGLRenderer extends Renderer {
850
850
  * @name strokeLine
851
851
  * @memberOf me.WebGLRenderer.prototype
852
852
  * @function
853
- * @param {Number} startX the start x coordinate
854
- * @param {Number} startY the start y coordinate
855
- * @param {Number} endX the end x coordinate
856
- * @param {Number} endY the end y coordinate
853
+ * @param {number} startX the start x coordinate
854
+ * @param {number} startY the start y coordinate
855
+ * @param {number} endX the end x coordinate
856
+ * @param {number} endY the end y coordinate
857
857
  */
858
858
  strokeLine(startX, startY, endX, endY) {
859
859
  var points = this._glPoints;
@@ -870,10 +870,10 @@ class WebGLRenderer extends Renderer {
870
870
  * @name fillLine
871
871
  * @memberOf me.WebGLRenderer.prototype
872
872
  * @function
873
- * @param {Number} startX the start x coordinate
874
- * @param {Number} startY the start y coordinate
875
- * @param {Number} endX the end x coordinate
876
- * @param {Number} endY the end y coordinate
873
+ * @param {number} startX the start x coordinate
874
+ * @param {number} startY the start y coordinate
875
+ * @param {number} endX the end x coordinate
876
+ * @param {number} endY the end y coordinate
877
877
  */
878
878
  fillLine(startX, startY, endX, endY) {
879
879
  this.strokeLine(startX, startY, endX, endY);
@@ -885,7 +885,7 @@ class WebGLRenderer extends Renderer {
885
885
  * @memberOf me.WebGLRenderer.prototype
886
886
  * @function
887
887
  * @param {me.Polygon} poly the shape to draw
888
- * @param {Boolean} [fill=false] also fill the shape with the current color if true
888
+ * @param {boolean} [fill=false] also fill the shape with the current color if true
889
889
  */
890
890
  strokePolygon(poly, fill = false) {
891
891
  if (fill === true ) {
@@ -915,7 +915,7 @@ class WebGLRenderer extends Renderer {
915
915
  * @memberOf me.WebGLRenderer.prototype
916
916
  * @function
917
917
  * @param {me.Polygon} poly the shape to draw
918
- */
918
+ */
919
919
  fillPolygon(poly) {
920
920
  var points = poly.points;
921
921
  var glPoints = this._glPoints;
@@ -942,11 +942,11 @@ class WebGLRenderer extends Renderer {
942
942
  * @name strokeRect
943
943
  * @memberOf me.WebGLRenderer.prototype
944
944
  * @function
945
- * @param {Number} x
946
- * @param {Number} y
947
- * @param {Number} width
948
- * @param {Number} height
949
- * @param {Boolean} [fill=false] also fill the shape with the current color if true
945
+ * @param {number} x
946
+ * @param {number} y
947
+ * @param {number} width
948
+ * @param {number} height
949
+ * @param {boolean} [fill=false] also fill the shape with the current color if true
950
950
  */
951
951
  strokeRect(x, y, width, height, fill = false) {
952
952
  if (fill === true ) {
@@ -970,10 +970,10 @@ class WebGLRenderer extends Renderer {
970
970
  * @name fillRect
971
971
  * @memberOf me.WebGLRenderer.prototype
972
972
  * @function
973
- * @param {Number} x
974
- * @param {Number} y
975
- * @param {Number} width
976
- * @param {Number} height
973
+ * @param {number} x
974
+ * @param {number} y
975
+ * @param {number} width
976
+ * @param {number} height
977
977
  */
978
978
  fillRect(x, y, width, height) {
979
979
  var glPoints = this._glPoints;
@@ -1024,8 +1024,8 @@ class WebGLRenderer extends Renderer {
1024
1024
  * @name translate
1025
1025
  * @memberOf me.WebGLRenderer.prototype
1026
1026
  * @function
1027
- * @param {Number} x
1028
- * @param {Number} y
1027
+ * @param {number} x
1028
+ * @param {number} y
1029
1029
  */
1030
1030
  translate(x, y) {
1031
1031
  var currentTransform = this.currentTransform;
@@ -1047,10 +1047,10 @@ class WebGLRenderer extends Renderer {
1047
1047
  * @name clipRect
1048
1048
  * @memberOf me.WebGLRenderer.prototype
1049
1049
  * @function
1050
- * @param {Number} x
1051
- * @param {Number} y
1052
- * @param {Number} width
1053
- * @param {Number} height
1050
+ * @param {number} x
1051
+ * @param {number} y
1052
+ * @param {number} width
1053
+ * @param {number} height
1054
1054
  */
1055
1055
  clipRect(x, y, width, height) {
1056
1056
  var canvas = this.backBufferCanvas;