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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "melonjs",
3
- "version": "10.2.0",
3
+ "version": "10.3.0",
4
4
  "description": "melonJS Game Engine",
5
5
  "homepage": "http://www.melonjs.org/",
6
6
  "keywords": [
@@ -60,35 +60,34 @@
60
60
  "devDependencies": {
61
61
  "@rollup/plugin-buble": "^0.21.3",
62
62
  "@rollup/plugin-commonjs": "^21.0.1",
63
- "@rollup/plugin-node-resolve": "^13.0.6",
64
- "@rollup/plugin-replace": "^3.0.0",
63
+ "@rollup/plugin-node-resolve": "^13.1.3",
64
+ "@rollup/plugin-replace": "^3.0.1",
65
65
  "cheerio": "^1.0.0-rc.10",
66
66
  "del-cli": "^4.0.1",
67
- "eslint": "^8.3.0",
68
- "ghpages": "0.0.10",
69
- "jasmine-core": "^3.10.1",
70
- "jsdoc": "^3.6.7",
71
- "karma": "^6.3.9",
67
+ "eslint": "^8.8.0",
68
+ "eslint-plugin-jsdoc": "^37.7.0",
69
+ "jasmine-core": "^4.0.0",
70
+ "jsdoc": "^3.6.10",
71
+ "karma": "^6.3.13",
72
72
  "karma-chrome-launcher": "^3.1.0",
73
- "karma-coverage": "^2.0.3",
73
+ "karma-coverage": "^2.1.0",
74
74
  "karma-html-detailed-reporter": "^2.1.0",
75
75
  "karma-jasmine": "^4.0.1",
76
76
  "karma-nyan-reporter": "0.2.5",
77
- "qs": "^6.10.1",
78
- "rollup": "^2.60.1",
77
+ "qs": "^6.10.3",
78
+ "rollup": "^2.67.0",
79
79
  "rollup-plugin-bundle-size": "^1.0.3",
80
80
  "rollup-plugin-string": "^3.0.0",
81
81
  "terser": "^5.10.0",
82
- "typescript": "^4.5.2"
82
+ "typescript": "^4.5.5"
83
83
  },
84
84
  "scripts": {
85
85
  "build": "npm run lint && rollup -c --silent",
86
86
  "dist": " npm run build && npm run minify && mkdirp dist && cp -f build/*.js dist/ && npm run makedts",
87
87
  "minify": "terser build/melonjs.js --compress --mangle --comments '/(?:^!|@(?:license|preserve|cc_on))/' --output build/melonjs.min.js",
88
- "lint": "eslint --config .eslintrc.json src",
88
+ "lint": "eslint --config .eslintrc.json src rollup.config.js",
89
89
  "test": "npm run build && karma start tests/karma.conf.js",
90
90
  "doc": "mkdirp docs && jsdoc -c jsdoc_conf.json",
91
- "publishdoc": "npm run doc && ghpages melonjs/melonJS -p docs",
92
91
  "release": "npm run dist && npm publish --access public",
93
92
  "clean": "del-cli --force build/*.js docs src/**/*.d.ts",
94
93
  "makedts": "npx -p typescript tsc dist/melonjs.module.js --declaration --allowJs --emitDeclarationOnly",
@@ -5,7 +5,7 @@ import loader from "./../loader/loader.js";
5
5
 
6
6
  /**
7
7
  * @namespace audio
8
- * @memberOf me
8
+ * @memberof me
9
9
  */
10
10
 
11
11
  /**
@@ -68,9 +68,9 @@ var soundLoadError = function (sound_name, onerror_cb) {
68
68
  * if false, melonJS will disable sounds and output a warning message
69
69
  * in the console<br>
70
70
  * @name stopOnAudioError
71
- * @type {Boolean}
71
+ * @type {boolean}
72
72
  * @default true
73
- * @memberOf me.audio
73
+ * @memberof me.audio
74
74
  */
75
75
  export let stopOnAudioError = true;
76
76
 
@@ -84,8 +84,8 @@ export let stopOnAudioError = true;
84
84
  * It is important to remember that melonJS selects the first compatible sound based on the list of extensions and given order passed here.
85
85
  * So if you want webm to be used before mp3, you need to put the audio format in that order.
86
86
  * @function me.audio.init
87
- * @param {String} [format="mp3"] audio format to prioritize
88
- * @returns {Boolean} Indicates whether audio initialization was successful
87
+ * @param {string} [format="mp3"] audio format to prioritize
88
+ * @returns {boolean} Indicates whether audio initialization was successful
89
89
  * @example
90
90
  * // initialize the "sound engine", giving "webm" as default desired audio format, and "mp3" as a fallback
91
91
  * if (!me.audio.init("webm,mp3")) {
@@ -103,8 +103,8 @@ export let stopOnAudioError = true;
103
103
  /**
104
104
  * check if the given audio format is supported
105
105
  * @function me.audio.hasFormat
106
- * @param {String} format audio format : "mp3", "mpeg", opus", "ogg", "oga", "wav", "aac", "caf", "m4a", "m4b", "mp4", "weba", "webm", "dolby", "flac"
107
- * @returns {Boolean} return true if the given audio format is supported
106
+ * @param {string} codec audio format : "mp3", "mpeg", opus", "ogg", "oga", "wav", "aac", "caf", "m4a", "m4b", "mp4", "weba", "webm", "dolby", "flac"
107
+ * @returns {boolean} return true if the given audio format is supported
108
108
  */
109
109
  export function hasFormat(codec) {
110
110
  return hasAudio() && Howler.codecs(codec);
@@ -113,7 +113,7 @@ export function hasFormat(codec) {
113
113
  /**
114
114
  * check if audio (HTML5 or WebAudio) is supported
115
115
  * @function me.audio.hasAudio
116
- * @returns {Boolean} return true if audio (HTML5 or WebAudio) is supported
116
+ * @returns {boolean} return true if audio (HTML5 or WebAudio) is supported
117
117
  */
118
118
  export function hasAudio() {
119
119
  return !Howler.noAudio;
@@ -181,11 +181,11 @@ export function load(sound, html5, onload_cb, onerror_cb) {
181
181
  /**
182
182
  * play the specified sound
183
183
  * @function me.audio.play
184
- * @param {String} sound_name audio clip name - case sensitive
185
- * @param {Boolean} [loop=false] loop audio
184
+ * @param {string} sound_name audio clip name - case sensitive
185
+ * @param {boolean} [loop=false] loop audio
186
186
  * @param {Function} [onend] Function to call when sound instance ends playing.
187
- * @param {Number} [volume=default] Float specifying volume (0.0 - 1.0 values accepted).
188
- * @return {Number} the sound instance ID.
187
+ * @param {number} [volume=default] Float specifying volume (0.0 - 1.0 values accepted).
188
+ * @returns {number} the sound instance ID.
189
189
  * @example
190
190
  * // play the "cling" audio clip
191
191
  * me.audio.play("cling");
@@ -222,11 +222,11 @@ export function play(sound_name, loop = false, onend, volume) {
222
222
  /**
223
223
  * Fade a currently playing sound between two volumee.
224
224
  * @function me.audio.fade
225
- * @param {String} sound_name audio clip name - case sensitive
226
- * @param {Number} from Volume to fade from (0.0 to 1.0).
227
- * @param {Number} to Volume to fade to (0.0 to 1.0).
228
- * @param {Number} duration Time in milliseconds to fade.
229
- * @param {Number} [id] the sound instance ID. If none is passed, all sounds in group will fade.
225
+ * @param {string} sound_name audio clip name - case sensitive
226
+ * @param {number} from Volume to fade from (0.0 to 1.0).
227
+ * @param {number} to Volume to fade to (0.0 to 1.0).
228
+ * @param {number} duration Time in milliseconds to fade.
229
+ * @param {number} [id] the sound instance ID. If none is passed, all sounds in group will fade.
230
230
  */
231
231
  export function fade(sound_name, from, to, duration, id) {
232
232
  var sound = audioTracks[sound_name];
@@ -240,10 +240,10 @@ export function fade(sound_name, from, to, duration, id) {
240
240
  /**
241
241
  * get/set the position of playback for a sound.
242
242
  * @function me.audio.seek
243
- * @param {String} sound_name audio clip name - case sensitive
244
- * @param {Number} [seek] The position to move current playback to (in seconds).
245
- * @param {Number} [id] the sound instance ID. If none is passed, all sounds in group will changed.
246
- * @return return the current seek position (if no extra parameters were given)
243
+ * @param {string} sound_name audio clip name - case sensitive
244
+ * @param {number} [seek] the position to move current playback to (in seconds).
245
+ * @param {number} [id] the sound instance ID. If none is passed, all sounds in group will changed.
246
+ * @returns {number} return the current seek position (if no extra parameters were given)
247
247
  * @example
248
248
  * // return the current position of the background music
249
249
  * var current_pos = me.audio.seek("dst-gameforest");
@@ -262,10 +262,10 @@ export function seek(sound_name, ...args) {
262
262
  /**
263
263
  * get or set the rate of playback for a sound.
264
264
  * @function me.audio.rate
265
- * @param {String} sound_name audio clip name - case sensitive
266
- * @param {Number} [rate] playback rate : 0.5 to 4.0, with 1.0 being normal speed.
267
- * @param {Number} [id] the sound instance ID. If none is passed, all sounds in group will be changed.
268
- * @return return the current playback rate (if no extra parameters were given)
265
+ * @param {string} sound_name audio clip name - case sensitive
266
+ * @param {number} [rate] playback rate : 0.5 to 4.0, with 1.0 being normal speed.
267
+ * @param {number} [id] the sound instance ID. If none is passed, all sounds in group will be changed.
268
+ * @returns {number} return the current playback rate (if no extra parameters were given)
269
269
  * @example
270
270
  * // get the playback rate of the background music
271
271
  * var rate = me.audio.rate("dst-gameforest");
@@ -284,8 +284,8 @@ export function rate(sound_name, ...args) {
284
284
  /**
285
285
  * stop the specified sound on all channels
286
286
  * @function me.audio.stop
287
- * @param {String} [sound_name] audio clip name (case sensitive). If none is passed, all sounds are stopped.
288
- * @param {Number} [id] the sound instance ID. If none is passed, all sounds in group will stop.
287
+ * @param {string} [sound_name] audio clip name (case sensitive). If none is passed, all sounds are stopped.
288
+ * @param {number} [id] the sound instance ID. If none is passed, all sounds in group will stop.
289
289
  * @example
290
290
  * me.audio.stop("cling");
291
291
  */
@@ -308,8 +308,8 @@ export function stop(sound_name, id) {
308
308
  * pause the specified sound on all channels<br>
309
309
  * this function does not reset the currentTime property
310
310
  * @function me.audio.pause
311
- * @param {String} sound_name audio clip name - case sensitive
312
- * @param {Number} [id] the sound instance ID. If none is passed, all sounds in group will pause.
311
+ * @param {string} sound_name audio clip name - case sensitive
312
+ * @param {number} [id] the sound instance ID. If none is passed, all sounds in group will pause.
313
313
  * @example
314
314
  * me.audio.pause("cling");
315
315
  */
@@ -325,8 +325,8 @@ export function pause(sound_name, id) {
325
325
  /**
326
326
  * resume the specified sound on all channels<br>
327
327
  * @function me.audio.resume
328
- * @param {String} sound_name audio clip name - case sensitive
329
- * @param {Number} [id] the sound instance ID. If none is passed, all sounds in group will resume.
328
+ * @param {string} sound_name audio clip name - case sensitive
329
+ * @param {number} [id] the sound instance ID. If none is passed, all sounds in group will resume.
330
330
  * @example
331
331
  * // play a audio clip
332
332
  * var id = me.audio.play("myClip");
@@ -351,9 +351,9 @@ export function resume(sound_name, id) {
351
351
  * this function automatically set the loop property to true<br>
352
352
  * and keep track of the current sound being played.
353
353
  * @function me.audio.playTrack
354
- * @param {String} sound_name audio track name - case sensitive
355
- * @param {Number} [volume=default] Float specifying volume (0.0 - 1.0 values accepted).
356
- * @return {Number} the sound instance ID.
354
+ * @param {string} sound_name audio track name - case sensitive
355
+ * @param {number} [volume=default] Float specifying volume (0.0 - 1.0 values accepted).
356
+ * @returns {number} the sound instance ID.
357
357
  * @example
358
358
  * me.audio.playTrack("awesome_music");
359
359
  */
@@ -416,7 +416,7 @@ export function resumeTrack() {
416
416
  /**
417
417
  * returns the current track Id
418
418
  * @function me.audio.getCurrentTrack
419
- * @return {String} audio track name
419
+ * @returns {string} audio track name
420
420
  */
421
421
  export function getCurrentTrack() {
422
422
  return current_track_id;
@@ -425,7 +425,7 @@ export function getCurrentTrack() {
425
425
  /**
426
426
  * set the default global volume
427
427
  * @function me.audio.setVolume
428
- * @param {Number} volume Float specifying volume (0.0 - 1.0 values accepted).
428
+ * @param {number} volume Float specifying volume (0.0 - 1.0 values accepted).
429
429
  */
430
430
  export function setVolume(volume) {
431
431
  Howler.volume(volume);
@@ -434,7 +434,7 @@ export function setVolume(volume) {
434
434
  /**
435
435
  * get the default global volume
436
436
  * @function me.audio.getVolume
437
- * @returns {Number} current volume value in Float [0.0 - 1.0] .
437
+ * @returns {number} current volume value in Float [0.0 - 1.0] .
438
438
  */
439
439
  export function getVolume() {
440
440
  return Howler.volume();
@@ -443,9 +443,9 @@ export function getVolume() {
443
443
  /**
444
444
  * mute or unmute the specified sound, but does not pause the playback.
445
445
  * @function me.audio.mute
446
- * @param {String} sound_name audio clip name - case sensitive
447
- * @param {Number} [id] the sound instance ID. If none is passed, all sounds in group will mute.
448
- * @param {Boolean} [mute=true] True to mute and false to unmute
446
+ * @param {string} sound_name audio clip name - case sensitive
447
+ * @param {number} [id] the sound instance ID. If none is passed, all sounds in group will mute.
448
+ * @param {boolean} [mute=true] True to mute and false to unmute
449
449
  * @example
450
450
  * // mute the background music
451
451
  * me.audio.mute("awesome_music");
@@ -464,8 +464,8 @@ export function mute(sound_name, id, mute) {
464
464
  /**
465
465
  * unmute the specified sound
466
466
  * @function me.audio.unmute
467
- * @param {String} sound_name audio clip name
468
- * @param {Number} [id] the sound instance ID. If none is passed, all sounds in group will unmute.
467
+ * @param {string} sound_name audio clip name
468
+ * @param {number} [id] the sound instance ID. If none is passed, all sounds in group will unmute.
469
469
  */
470
470
  export function unmute(sound_name, id) {
471
471
  mute(sound_name, id, false);
@@ -490,7 +490,7 @@ export function unmuteAll() {
490
490
  /**
491
491
  * Returns true if audio is muted globally.
492
492
  * @function me.audio.muted
493
- * @return {Boolean} true if audio is muted globally
493
+ * @returns {boolean} true if audio is muted globally
494
494
  */
495
495
  export function muted() {
496
496
  return Howler._muted;
@@ -499,8 +499,8 @@ export function muted() {
499
499
  /**
500
500
  * unload specified audio track to free memory
501
501
  * @function me.audio.unload
502
- * @param {String} sound_name audio track name - case sensitive
503
- * @return {Boolean} true if unloaded
502
+ * @param {string} sound_name audio track name - case sensitive
503
+ * @returns {boolean} true if unloaded
504
504
  * @example
505
505
  * me.audio.unload("awesome_music");
506
506
  */
@@ -4,7 +4,7 @@ import ObservableVector2d from "./../math/observable_vector2.js";
4
4
  import ObservableVector3d from "./../math/observable_vector3.js";
5
5
  import Matrix2d from "./../math/matrix2.js";
6
6
  import Matrix3d from "./../math/matrix3.js";
7
- import Rect from "./../shapes/rectangle.js";
7
+ import Rect from "./../geometries/rectangle.js";
8
8
  import { renderer } from "./../video/video.js";
9
9
  import * as event from "./../system/event.js";
10
10
  import pool from "./../system/pooling.js";
@@ -22,13 +22,12 @@ var targetV = new Vector2d();
22
22
  * @classdesc
23
23
  * a 2D orthographic camera
24
24
  * @class Camera2d
25
- * @extends me.Renderable
26
- * @memberOf me
27
- * @constructor
28
- * @param {Number} minX start x offset
29
- * @param {Number} minY start y offset
30
- * @param {Number} maxX end x offset
31
- * @param {Number} maxY end y offset
25
+ * @augments me.Renderable
26
+ * @memberof me
27
+ * @param {number} minX start x offset
28
+ * @param {number} minY start y offset
29
+ * @param {number} maxX end x offset
30
+ * @param {number} maxY end y offset
32
31
  */
33
32
  class Camera2d extends Renderable {
34
33
 
@@ -40,15 +39,15 @@ class Camera2d extends Renderable {
40
39
 
41
40
  /**
42
41
  * Axis definition
43
- * @property NONE
44
- * @property HORIZONTAL
45
- * @property VERTICAL
46
- * @property BOTH
42
+ * @property {number} NONE no axis
43
+ * @property {number} HORIZONTAL horizontal axis only
44
+ * @property {number} VERTICAL vertical axis only
45
+ * @property {number} BOTH both axis
47
46
  * @public
48
47
  * @constant
49
- * @enum {Number}
48
+ * @enum {number}
50
49
  * @name AXIS
51
- * @memberOf me.Camera2d
50
+ * @memberof me.Camera2d
52
51
  */
53
52
  this.AXIS = {
54
53
  NONE : 0,
@@ -60,20 +59,20 @@ class Camera2d extends Renderable {
60
59
  /**
61
60
  * Camera bounds
62
61
  * @public
63
- * @type me.Bounds
62
+ * @type {me.Bounds}
64
63
  * @name bounds
65
- * @memberOf me.Camera2d
64
+ * @memberof me.Camera2d
66
65
  */
67
66
  this.bounds = pool.pull("Bounds");
68
67
 
69
68
  /**
70
69
  * [IMTERNAL] enable or disable damping
71
70
  * @private
72
- * @type {Boolean}
71
+ * @type {boolean}
73
72
  * @name smoothFollow
74
73
  * @see me.Camera2d.damping
75
74
  * @default true
76
- * @memberOf me.Camera2d
75
+ * @memberof me.Camera2d
77
76
  */
78
77
  this.smoothFollow = true;
79
78
 
@@ -81,30 +80,30 @@ class Camera2d extends Renderable {
81
80
  * Camera damping for smooth transition [0 .. 1].
82
81
  * 1 being the maximum value and will snap the camera to the target position
83
82
  * @public
84
- * @type {Number}
83
+ * @type {number}
85
84
  * @name damping
86
85
  * @default 1.0
87
- * @memberOf me.Camera2d
86
+ * @memberof me.Camera2d
88
87
  */
89
88
  this.damping = 1.0;
90
89
 
91
90
  /**
92
91
  * the closest point relative to the camera
93
92
  * @public
94
- * @type {Number}
93
+ * @type {number}
95
94
  * @name near
96
95
  * @default -1000
97
- * @memberOf me.Camera2d
96
+ * @memberof me.Camera2d
98
97
  */
99
98
  this.near = -1000;
100
99
 
101
100
  /**
102
101
  * the furthest point relative to the camera.
103
102
  * @public
104
- * @type {Number}
103
+ * @type {number}
105
104
  * @name far
106
105
  * @default 1000
107
- * @memberOf me.Camera2d
106
+ * @memberof me.Camera2d
108
107
  */
109
108
  this.far = 1000;
110
109
 
@@ -114,7 +113,7 @@ class Camera2d extends Renderable {
114
113
  * @public
115
114
  * @type {me.Matrix3d}
116
115
  * @name projectionMatrix
117
- * @memberOf me.Camera2d
116
+ * @memberof me.Camera2d
118
117
  */
119
118
  this.projectionMatrix = new Matrix3d();
120
119
 
@@ -123,7 +122,7 @@ class Camera2d extends Renderable {
123
122
  * @ignore
124
123
  * @type {me.Matrix2d}
125
124
  * @name invCurrentTransform
126
- * @memberOf me.Camera2d
125
+ * @memberof me.Camera2d
127
126
  */
128
127
  this.invCurrentTransform = new Matrix2d();
129
128
 
@@ -216,10 +215,10 @@ class Camera2d extends Renderable {
216
215
  /**
217
216
  * reset the camera position to specified coordinates
218
217
  * @name reset
219
- * @memberOf me.Camera2d
218
+ * @memberof me.Camera2d
220
219
  * @function
221
- * @param {Number} [x=0]
222
- * @param {Number} [y=0]
220
+ * @param {number} [x=0]
221
+ * @param {number} [y=0]
223
222
  */
224
223
  reset(x = 0, y = 0) {
225
224
  // reset the initial camera position to 0,0
@@ -247,10 +246,10 @@ class Camera2d extends Renderable {
247
246
  * the followed renderable can move without scrolling the camera.
248
247
  * @name setDeadzone
249
248
  * @see me.Camera2d.follow
250
- * @memberOf me.Camera2d
249
+ * @memberof me.Camera2d
251
250
  * @function
252
- * @param {Number} w deadzone width
253
- * @param {Number} h deadzone height
251
+ * @param {number} w deadzone width
252
+ * @param {number} h deadzone height
254
253
  */
255
254
  setDeadzone(w, h) {
256
255
  if (typeof(this.deadzone) === "undefined") {
@@ -275,12 +274,12 @@ class Camera2d extends Renderable {
275
274
  /**
276
275
  * resize the camera
277
276
  * @name resize
278
- * @memberOf me.Camera2d
277
+ * @memberof me.Camera2d
279
278
  * @function
280
- * @param {Number} w new width of the camera
281
- * @param {Number} h new height of the camera
282
- * @return {me.Camera2d} this camera
283
- */
279
+ * @param {number} w new width of the camera
280
+ * @param {number} h new height of the camera
281
+ * @returns {me.Camera2d} this camera
282
+ */
284
283
  resize(w, h) {
285
284
  // parent consctructor, resize camera rect
286
285
  super.resize(w, h);
@@ -307,12 +306,12 @@ class Camera2d extends Renderable {
307
306
  * set the camera boundaries (set to the world limit by default).
308
307
  * the camera is bound to the given coordinates and cannot move/be scrolled outside of it.
309
308
  * @name setBounds
310
- * @memberOf me.Camera2d
309
+ * @memberof me.Camera2d
311
310
  * @function
312
- * @param {Number} x world left limit
313
- * @param {Number} y world top limit
314
- * @param {Number} w world width limit
315
- * @param {Number} h world height limit
311
+ * @param {number} x world left limit
312
+ * @param {number} y world top limit
313
+ * @param {number} w world width limit
314
+ * @param {number} h world height limit
316
315
  */
317
316
  setBounds(x, y, w, h) {
318
317
  this.smoothFollow = false;
@@ -326,11 +325,11 @@ class Camera2d extends Renderable {
326
325
  * set the camera to follow the specified renderable. <br>
327
326
  * (this will put the camera center around the given target)
328
327
  * @name follow
329
- * @memberOf me.Camera2d
328
+ * @memberof me.Camera2d
330
329
  * @function
331
330
  * @param {me.Renderable|me.Vector2d} target renderable or position vector to follow
332
331
  * @param {me.Camera2d.AXIS} [axis=this.AXIS.BOTH] Which axis to follow
333
- * @param {Number} [damping=1] default damping value
332
+ * @param {number} [damping=1] default damping value
334
333
  * @example
335
334
  * // set the camera to follow this renderable on both axis, and enable damping
336
335
  * me.game.viewport.follow(this, me.game.viewport.AXIS.BOTH, 0.1);
@@ -368,7 +367,7 @@ class Camera2d extends Renderable {
368
367
  /**
369
368
  * unfollow the current target
370
369
  * @name unfollow
371
- * @memberOf me.Camera2d
370
+ * @memberof me.Camera2d
372
371
  * @function
373
372
  */
374
373
  unfollow() {
@@ -379,11 +378,11 @@ class Camera2d extends Renderable {
379
378
  /**
380
379
  * move the camera upper-left position by the specified offset.
381
380
  * @name move
382
- * @memberOf me.Camera2d
381
+ * @memberof me.Camera2d
383
382
  * @see me.Camera2d.focusOn
384
383
  * @function
385
- * @param {Number} x
386
- * @param {Number} y
384
+ * @param {number} x
385
+ * @param {number} y
387
386
  * @example
388
387
  * // Move the camera up by four pixels
389
388
  * me.game.viewport.move(0, -4);
@@ -395,11 +394,11 @@ class Camera2d extends Renderable {
395
394
  /**
396
395
  * move the camera upper-left position to the specified coordinates
397
396
  * @name moveTo
398
- * @memberOf me.Camera2d
397
+ * @memberof me.Camera2d
399
398
  * @see me.Camera2d.focusOn
400
399
  * @function
401
- * @param {Number} x
402
- * @param {Number} y
400
+ * @param {number} x
401
+ * @param {number} y
403
402
  */
404
403
  moveTo(x, y) {
405
404
  var _x = this.pos.x;
@@ -519,15 +518,15 @@ class Camera2d extends Renderable {
519
518
  /**
520
519
  * shake the camera
521
520
  * @name shake
522
- * @memberOf me.Camera2d
521
+ * @memberof me.Camera2d
523
522
  * @function
524
- * @param {Number} intensity maximum offset that the screen can be moved
523
+ * @param {number} intensity maximum offset that the screen can be moved
525
524
  * while shaking
526
- * @param {Number} duration expressed in milliseconds
525
+ * @param {number} duration expressed in milliseconds
527
526
  * @param {me.Camera2d.AXIS} [axis=this.AXIS.BOTH] specify on which axis you
528
527
  * want the shake effect
529
528
  * @param {Function} [onComplete] callback once shaking effect is over
530
- * @param {Boolean} [force] if true this will override the current effect
529
+ * @param {boolean} [force] if true this will override the current effect
531
530
  * @example
532
531
  * // shake it baby !
533
532
  * me.game.viewport.shake(10, 500, me.game.viewport.AXIS.BOTH);
@@ -545,10 +544,10 @@ class Camera2d extends Renderable {
545
544
  * fadeOut(flash) effect<p>
546
545
  * screen is filled with the specified color and slowly goes back to normal
547
546
  * @name fadeOut
548
- * @memberOf me.Camera2d
547
+ * @memberof me.Camera2d
549
548
  * @function
550
- * @param {me.Color|String} color a CSS color value
551
- * @param {Number} [duration=1000] expressed in milliseconds
549
+ * @param {me.Color|string} color a CSS color value
550
+ * @param {number} [duration=1000] expressed in milliseconds
552
551
  * @param {Function} [onComplete] callback once effect is over
553
552
  * @example
554
553
  * // fade the camera to white upon dying, reload the level, and then fade out back
@@ -571,10 +570,10 @@ class Camera2d extends Renderable {
571
570
  * fadeIn effect <p>
572
571
  * fade to the specified color
573
572
  * @name fadeIn
574
- * @memberOf me.Camera2d
573
+ * @memberof me.Camera2d
575
574
  * @function
576
- * @param {me.Color|String} color a CSS color value
577
- * @param {Number} [duration=1000] expressed in milliseconds
575
+ * @param {me.Color|string} color a CSS color value
576
+ * @param {number} [duration=1000] expressed in milliseconds
578
577
  * @param {Function} [onComplete] callback once effect is over
579
578
  * @example
580
579
  * // flash the camera to white for 75ms
@@ -591,34 +590,12 @@ class Camera2d extends Renderable {
591
590
  this._fadeIn.tween.start();
592
591
  }
593
592
 
594
- /**
595
- * return the camera width
596
- * @name getWidth
597
- * @memberOf me.Camera2d
598
- * @function
599
- * @return {Number}
600
- */
601
- getWidth() {
602
- return this.width;
603
- }
604
-
605
- /**
606
- * return the camera height
607
- * @name getHeight
608
- * @memberOf me.Camera2d
609
- * @function
610
- * @return {Number}
611
- */
612
- getHeight() {
613
- return this.height;
614
- }
615
-
616
593
  /**
617
594
  * set the camera position around the specified object
618
595
  * @name focusOn
619
- * @memberOf me.Camera2d
596
+ * @memberof me.Camera2d
620
597
  * @function
621
- * @param {me.Renderable}
598
+ * @param {me.Renderable} target the renderable to focus the camera on
622
599
  */
623
600
  focusOn(target) {
624
601
  var bounds = target.getBounds();
@@ -631,11 +608,11 @@ class Camera2d extends Renderable {
631
608
  /**
632
609
  * check if the specified renderable is in the camera
633
610
  * @name isVisible
634
- * @memberOf me.Camera2d
611
+ * @memberof me.Camera2d
635
612
  * @function
636
- * @param {me.Renderable} object
637
- * @param {Boolean} [floating===object.floating] if visibility check should be done against screen coordinates
638
- * @return {Boolean}
613
+ * @param {me.Renderable} obj to be checked against
614
+ * @param {boolean} [floating = obj.floating] if visibility check should be done against screen coordinates
615
+ * @returns {boolean}
639
616
  */
640
617
  isVisible(obj, floating = obj.floating) {
641
618
  if (floating === true || obj.floating === true) {
@@ -650,17 +627,17 @@ class Camera2d extends Renderable {
650
627
  /**
651
628
  * convert the given "local" (screen) coordinates into world coordinates
652
629
  * @name localToWorld
653
- * @memberOf me.Camera2d
630
+ * @memberof me.Camera2d
654
631
  * @function
655
- * @param {Number} x
656
- * @param {Number} y
657
- * @param {Number} [v] an optional vector object where to set the
632
+ * @param {number} x
633
+ * @param {number} y
634
+ * @param {number} [v] an optional vector object where to set the
658
635
  * converted value
659
- * @return {me.Vector2d}
636
+ * @returns {me.Vector2d}
660
637
  */
661
638
  localToWorld(x, y, v) {
662
639
  // TODO memoization for one set of coords (multitouch)
663
- v = v || new Vector2d();
640
+ v = v || pool.pull("Vector2d");
664
641
  v.set(x, y).add(this.pos).sub(world.pos);
665
642
  if (!this.currentTransform.isIdentity()) {
666
643
  this.invCurrentTransform.apply(v);
@@ -671,17 +648,17 @@ class Camera2d extends Renderable {
671
648
  /**
672
649
  * convert the given world coordinates into "local" (screen) coordinates
673
650
  * @name worldToLocal
674
- * @memberOf me.Camera2d
651
+ * @memberof me.Camera2d
675
652
  * @function
676
- * @param {Number} x
677
- * @param {Number} y
678
- * @param {Number} [v] an optional vector object where to set the
653
+ * @param {number} x
654
+ * @param {number} y
655
+ * @param {number} [v] an optional vector object where to set the
679
656
  * converted value
680
- * @return {me.Vector2d}
657
+ * @returns {me.Vector2d}
681
658
  */
682
659
  worldToLocal(x, y, v) {
683
660
  // TODO memoization for one set of coords (multitouch)
684
- v = v || new Vector2d();
661
+ v = v || pool.pull("Vector2d");
685
662
  v.set(x, y);
686
663
  if (!this.currentTransform.isIdentity()) {
687
664
  this.currentTransform.apply(v);