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
@@ -14,7 +14,7 @@ var tmpVec = new Vector2d();
14
14
  /**
15
15
  * @classdesc
16
16
  * a pointer object, representing a single finger on a touch enabled device.
17
- * @class
17
+ * @class Pointer
18
18
  * @extends me.Bounds
19
19
  * @memberOf me
20
20
  * @constructor
@@ -35,7 +35,7 @@ class Pointer extends Bounds {
35
35
  /**
36
36
  * constant for left button
37
37
  * @public
38
- * @type {Number}
38
+ * @type {number}
39
39
  * @name LEFT
40
40
  * @memberOf me.Pointer
41
41
  */
@@ -44,7 +44,7 @@ class Pointer extends Bounds {
44
44
  /**
45
45
  * constant for middle button
46
46
  * @public
47
- * @type {Number}
47
+ * @type {number}
48
48
  * @name MIDDLE
49
49
  * @memberOf me.Pointer
50
50
  */
@@ -53,7 +53,7 @@ class Pointer extends Bounds {
53
53
  /**
54
54
  * constant for right button
55
55
  * @public
56
- * @type {Number}
56
+ * @type {number}
57
57
  * @name RIGHT
58
58
  * @memberOf me.Pointer
59
59
  */
@@ -74,7 +74,7 @@ class Pointer extends Bounds {
74
74
  /**
75
75
  * a string containing the event's type.
76
76
  * @public
77
- * @type {String}
77
+ * @type {string}
78
78
  * @name type
79
79
  * @see https://developer.mozilla.org/en-US/docs/Web/API/Event/type
80
80
  * @memberOf me.Pointer
@@ -85,7 +85,7 @@ class Pointer extends Bounds {
85
85
  /**
86
86
  * the button property indicates which button was pressed on the mouse to trigger the event.
87
87
  * @public
88
- * @type {Number}
88
+ * @type {number}
89
89
  * @name button
90
90
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
91
91
  * @memberOf me.Pointer
@@ -95,7 +95,7 @@ class Pointer extends Bounds {
95
95
  /**
96
96
  * indicates whether or not the pointer device that created the event is the primary pointer.
97
97
  * @public
98
- * @type {Boolean}
98
+ * @type {boolean}
99
99
  * @name isPrimary
100
100
  * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary
101
101
  * @memberOf me.Pointer
@@ -105,7 +105,7 @@ class Pointer extends Bounds {
105
105
  /**
106
106
  * the horizontal coordinate at which the event occurred, relative to the left edge of the entire document.
107
107
  * @public
108
- * @type {Number}
108
+ * @type {number}
109
109
  * @name pageX
110
110
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/pageX
111
111
  * @memberOf me.Pointer
@@ -115,7 +115,7 @@ class Pointer extends Bounds {
115
115
  /**
116
116
  * the vertical coordinate at which the event occurred, relative to the left edge of the entire document.
117
117
  * @public
118
- * @type {Number}
118
+ * @type {number}
119
119
  * @name pageY
120
120
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/pageY
121
121
  * @memberOf me.Pointer
@@ -125,7 +125,7 @@ class Pointer extends Bounds {
125
125
  /**
126
126
  * the horizontal coordinate within the application's client area at which the event occurred
127
127
  * @public
128
- * @type {Number}
128
+ * @type {number}
129
129
  * @name clientX
130
130
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/clientX
131
131
  * @memberOf me.Pointer
@@ -135,7 +135,7 @@ class Pointer extends Bounds {
135
135
  /**
136
136
  * the vertical coordinate within the application's client area at which the event occurred
137
137
  * @public
138
- * @type {Number}
138
+ * @type {number}
139
139
  * @name clientY
140
140
  * @see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/clientY
141
141
  * @memberOf me.Pointer
@@ -145,7 +145,7 @@ class Pointer extends Bounds {
145
145
  /**
146
146
  * an unsigned long representing the unit of the delta values scroll amount
147
147
  * @public
148
- * @type {Number}
148
+ * @type {number}
149
149
  * @name deltaMode
150
150
  * @see https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaMode
151
151
  * @memberOf me.Pointer
@@ -155,7 +155,7 @@ class Pointer extends Bounds {
155
155
  /**
156
156
  * a double representing the horizontal scroll amount in the Wheel Event deltaMode unit.
157
157
  * @public
158
- * @type {Number}
158
+ * @type {number}
159
159
  * @name deltaX
160
160
  * @see https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaX
161
161
  * @memberOf me.Pointer
@@ -165,7 +165,7 @@ class Pointer extends Bounds {
165
165
  /**
166
166
  * a double representing the vertical scroll amount in the Wheel Event deltaMode unit.
167
167
  * @public
168
- * @type {Number}
168
+ * @type {number}
169
169
  * @name deltaY
170
170
  * @see https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaY
171
171
  * @memberOf me.Pointer
@@ -175,7 +175,7 @@ class Pointer extends Bounds {
175
175
  /**
176
176
  * a double representing the scroll amount in the z-axis, in the Wheel Event deltaMode unit.
177
177
  * @public
178
- * @type {Number}
178
+ * @type {number}
179
179
  * @name deltaZ
180
180
  * @see https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent/deltaZ
181
181
  * @memberOf me.Pointer
@@ -186,7 +186,7 @@ class Pointer extends Bounds {
186
186
  * Event normalized X coordinate within the game canvas itself<br>
187
187
  * <img src="images/event_coord.png"/>
188
188
  * @public
189
- * @type {Number}
189
+ * @type {number}
190
190
  * @name gameX
191
191
  * @memberOf me.Pointer
192
192
  */
@@ -196,7 +196,7 @@ class Pointer extends Bounds {
196
196
  * Event normalized Y coordinate within the game canvas itself<br>
197
197
  * <img src="images/event_coord.png"/>
198
198
  * @public
199
- * @type {Number}
199
+ * @type {number}
200
200
  * @name gameY
201
201
  * @memberOf me.Pointer
202
202
  */
@@ -205,7 +205,7 @@ class Pointer extends Bounds {
205
205
  /**
206
206
  * Event X coordinate relative to the viewport
207
207
  * @public
208
- * @type {Number}
208
+ * @type {number}
209
209
  * @name gameScreenX
210
210
  * @memberOf me.Pointer
211
211
  */
@@ -214,7 +214,7 @@ class Pointer extends Bounds {
214
214
  /**
215
215
  * Event Y coordinate relative to the viewport
216
216
  * @public
217
- * @type {Number}
217
+ * @type {number}
218
218
  * @name gameScreenY
219
219
  * @memberOf me.Pointer
220
220
  */
@@ -223,7 +223,7 @@ class Pointer extends Bounds {
223
223
  /**
224
224
  * Event X coordinate relative to the map
225
225
  * @public
226
- * @type {Number}
226
+ * @type {number}
227
227
  * @name gameWorldX
228
228
  * @memberOf me.Pointer
229
229
  */
@@ -232,7 +232,7 @@ class Pointer extends Bounds {
232
232
  /**
233
233
  * Event Y coordinate relative to the map
234
234
  * @public
235
- * @type {Number}
235
+ * @type {number}
236
236
  * @name gameWorldY
237
237
  * @memberOf me.Pointer
238
238
  */
@@ -241,7 +241,7 @@ class Pointer extends Bounds {
241
241
  /**
242
242
  * Event X coordinate relative to the holding container
243
243
  * @public
244
- * @type {Number}
244
+ * @type {number}
245
245
  * @name gameLocalX
246
246
  * @memberOf me.Pointer
247
247
  */
@@ -250,21 +250,30 @@ class Pointer extends Bounds {
250
250
  /**
251
251
  * Event Y coordinate relative to the holding container
252
252
  * @public
253
- * @type {Number}
253
+ * @type {number}
254
254
  * @name gameLocalY
255
255
  * @memberOf me.Pointer
256
256
  */
257
257
  this.gameLocalY = 0;
258
258
 
259
259
  /**
260
- * The unique identifier of the contact for a touch, mouse or pen
260
+ * The unique identifier of the contact for a touch, mouse or pen
261
+ * @public
262
+ * @type {number}
263
+ * @name pointerId
264
+ * @memberOf me.Pointer
265
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId
266
+ */
267
+ this.pointerId = undefined;
268
+
269
+ /**
270
+ * true if not originally a pointer event
261
271
  * @public
262
- * @type {Number}
263
- * @name pointerId
272
+ * @type {boolean}
273
+ * @name isNormalized
264
274
  * @memberOf me.Pointer
265
- * @see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerId
266
275
  */
267
- this.pointerId = undefined;
276
+ this.isNormalized = false;
268
277
 
269
278
  // bind list for mouse buttons
270
279
  this.bind = [ 0, 0, 0 ];
@@ -276,11 +285,11 @@ class Pointer extends Bounds {
276
285
  * @private
277
286
  * @function
278
287
  * @param {Event} event the original Event object
279
- * @param {Number} [pageX=0] the horizontal coordinate at which the event occurred, relative to the left edge of the entire document
280
- * @param {Number} [pageY=0] the vertical coordinate at which the event occurred, relative to the left edge of the entire document
281
- * @param {Number} [clientX=0] the horizontal coordinate within the application's client area at which the event occurred
282
- * @param {Number} [clientX=0] the vertical coordinate within the application's client area at which the event occurred
283
- * @param {Number} [pointedId=1] the Pointer, Touch or Mouse event Id (1)
288
+ * @param {number} [pageX=0] the horizontal coordinate at which the event occurred, relative to the left edge of the entire document
289
+ * @param {number} [pageY=0] the vertical coordinate at which the event occurred, relative to the left edge of the entire document
290
+ * @param {number} [clientX=0] the horizontal coordinate within the application's client area at which the event occurred
291
+ * @param {number} [clientY=0] the vertical coordinate within the application's client area at which the event occurred
292
+ * @param {number} [pointerId=1] the Pointer, Touch or Mouse event Id (1)
284
293
  */
285
294
  setEvent(event, pageX = 0, pageY = 0, clientX = 0, clientY = 0, pointerId = 1) {
286
295
  // the original event object
@@ -320,8 +329,6 @@ class Pointer extends Bounds {
320
329
 
321
330
  this.type = event.type;
322
331
 
323
-
324
-
325
332
  // get the current screen to game world offset
326
333
  if (typeof viewport !== "undefined") {
327
334
  viewport.localToWorld(this.gameScreenX, this.gameScreenY, tmpVec);
@@ -1,6 +1,5 @@
1
1
  import {preventDefault} from "./input.js";
2
2
  import {getBindingKey, triggerKeyEvent} from "./keyboard.js";
3
- import Vector2d from "./../math/vector2.js";
4
3
  import { renderer, scaleRatio } from "./../video/video.js";
5
4
  import * as fctUtil from "./../utils/function.js";
6
5
  import * as arrayUtil from "./../utils/array.js";
@@ -11,13 +10,11 @@ import device from "./../system/device.js";
11
10
  import Pointer from "./pointer.js";
12
11
  import Rect from "./../shapes/rectangle.js";
13
12
  import Container from "./../renderable/container.js";
14
- import Renderable from "./../renderable/renderable.js";
15
13
  import { world, viewport } from "./../game.js";
16
14
 
17
-
18
15
  /**
19
16
  * A pool of `Pointer` objects to cache pointer/touch event coordinates.
20
- * @type {Array.<Vector>}
17
+ * @type {Array.<me.Vector2d>}
21
18
  * @ignore
22
19
  */
23
20
  var T_POINTERS = [];
@@ -292,7 +289,7 @@ function dispatchEvent(normalizedEvents) {
292
289
  var bounds = region.getBounds();
293
290
  var eventInBounds = false;
294
291
 
295
- if (region.floating === true) {
292
+ if (region.isFloating === true) {
296
293
  pointer.gameX = pointer.gameLocalX = pointer.gameScreenX;
297
294
  pointer.gameY = pointer.gameLocalY = pointer.gameScreenY;
298
295
  } else {
@@ -308,10 +305,11 @@ function dispatchEvent(normalizedEvents) {
308
305
  pointer.gameLocalY = pointer.gameY - parentBounds.y;
309
306
  }
310
307
 
308
+ var gameX = pointer.gameX;
309
+ var gameY = pointer.gameY;
310
+
311
311
  // apply inverse transformation for renderable
312
- if (region instanceof Renderable) {
313
- var gameX = pointer.gameX;
314
- var gameY = pointer.gameY;
312
+ if (typeof region.currentTransform !== "undefined") {
315
313
  if (!region.currentTransform.isIdentity()) {
316
314
  var invV = region.currentTransform.applyInverse(
317
315
  pool.pull("Vector2d", gameX, gameY)
@@ -320,14 +318,8 @@ function dispatchEvent(normalizedEvents) {
320
318
  gameY = invV.y;
321
319
  pool.push(invV);
322
320
  }
323
- eventInBounds = bounds.contains(gameX, gameY);
324
- } else {
325
- eventInBounds =
326
- bounds.contains(pointer.gameX, pointer.gameY) &&
327
- (bounds === region ||
328
- // if the given target is another shape than me.Rect
329
- region.contains(pointer.gameLocalX, pointer.gameLocalY));
330
321
  }
322
+ eventInBounds = bounds.contains(gameX, gameY);
331
323
 
332
324
  switch (pointer.type) {
333
325
  case POINTER_MOVE[0]:
@@ -410,15 +402,15 @@ function dispatchEvent(normalizedEvents) {
410
402
  * @ignore
411
403
  */
412
404
  function normalizeEvent(originalEvent) {
413
- var pointer;
405
+ var _pointer;
414
406
 
415
407
  // PointerEvent or standard Mouse event
416
408
  if (device.TouchEvent && originalEvent.changedTouches) {
417
409
  // iOS/Android Touch event
418
410
  for (var i = 0, l = originalEvent.changedTouches.length; i < l; i++) {
419
411
  var touchEvent = originalEvent.changedTouches[i];
420
- pointer = T_POINTERS.pop();
421
- pointer.setEvent(
412
+ _pointer = T_POINTERS.pop();
413
+ _pointer.setEvent(
422
414
  originalEvent,
423
415
  touchEvent.pageX,
424
416
  touchEvent.pageY,
@@ -426,12 +418,12 @@ function normalizeEvent(originalEvent) {
426
418
  touchEvent.clientY,
427
419
  touchEvent.identifier
428
420
  );
429
- normalizedEvents.push(pointer);
421
+ normalizedEvents.push(_pointer);
430
422
  }
431
423
  } else {
432
424
  // Mouse or PointerEvent
433
- pointer = T_POINTERS.pop();
434
- pointer.setEvent(
425
+ _pointer = T_POINTERS.pop();
426
+ _pointer.setEvent(
435
427
  originalEvent,
436
428
  originalEvent.pageX,
437
429
  originalEvent.pageY,
@@ -439,7 +431,7 @@ function normalizeEvent(originalEvent) {
439
431
  originalEvent.clientY,
440
432
  originalEvent.pointerId
441
433
  );
442
- normalizedEvents.push(pointer);
434
+ normalizedEvents.push(_pointer);
443
435
  }
444
436
 
445
437
  // if event.isPrimary is defined and false, return
@@ -498,7 +490,7 @@ function onPointerEvent(e) {
498
490
  /**
499
491
  * the default target element for pointer events (usually the canvas element in which the game is rendered)
500
492
  * @public
501
- * @type EventTarget
493
+ * @type {EventTarget}
502
494
  * @name pointerEventTarget
503
495
  * @memberOf me.input
504
496
  */
@@ -518,7 +510,7 @@ export var pointer = new Pointer(0, 0, 1, 1);
518
510
  * default value : "1000/me.timer.maxfps" ms<br>
519
511
  * set to 0 ms to disable the feature
520
512
  * @public
521
- * @type Number
513
+ * @type {number}
522
514
  * @name throttlingInterval
523
515
  * @memberOf me.input
524
516
  */
@@ -531,10 +523,10 @@ export var throttlingInterval;
531
523
  * @memberOf me.input
532
524
  * @public
533
525
  * @function
534
- * @param {Number} x the global x coordinate to be translated.
535
- * @param {Number} y the global y coordinate to be translated.
526
+ * @param {number} x the global x coordinate to be translated.
527
+ * @param {number} y the global y coordinate to be translated.
536
528
  * @param {me.Vector2d} [v] an optional vector object where to set the translated coordinates
537
- * @return {me.Vector2d} A vector object with the corresponding translated coordinates
529
+ * @returns {me.Vector2d} A vector object with the corresponding translated coordinates
538
530
  * @example
539
531
  * onMouseEvent : function (pointer) {
540
532
  * // convert the given into local (viewport) relative coordinates
@@ -543,7 +535,7 @@ export var throttlingInterval;
543
535
  * };
544
536
  */
545
537
  export function globalToLocal(x, y, v) {
546
- v = v || new Vector2d();
538
+ v = v || pool.pull("Vector2d");
547
539
  var rect = device.getElementBounds(renderer.getScreenCanvas());
548
540
  var pixelRatio = device.devicePixelRatio;
549
541
  x -= rect.left + (window.pageXOffset || 0);
@@ -565,7 +557,7 @@ export function globalToLocal(x, y, v) {
565
557
  * @public
566
558
  * @function
567
559
  * @param {HTMLCanvasElement} element
568
- * @param {String} [value="none"]
560
+ * @param {string} [value="none"]
569
561
  */
570
562
  export function setTouchAction(element, value) {
571
563
  element.style["touch-action"] = value || "none";
@@ -580,7 +572,7 @@ export function setTouchAction(element, value) {
580
572
  * @memberOf me.input
581
573
  * @public
582
574
  * @function
583
- * @param {Number} [button=me.input.pointer.LEFT] (accordingly to W3C values : 0,1,2 for left, middle and right buttons)
575
+ * @param {number} [button=me.input.pointer.LEFT] (accordingly to W3C values : 0,1,2 for left, middle and right buttons)
584
576
  * @param {me.input.KEY} keyCode
585
577
  * @example
586
578
  * // enable the keyboard
@@ -611,7 +603,7 @@ export function bindPointer() {
611
603
  * @memberOf me.input
612
604
  * @public
613
605
  * @function
614
- * @param {Number} [button=me.input.pointer.LEFT] (accordingly to W3C values : 0,1,2 for left, middle and right buttons)
606
+ * @param {number} [button=me.input.pointer.LEFT] (accordingly to W3C values : 0,1,2 for left, middle and right buttons)
615
607
  * @example
616
608
  * me.input.unbindPointer(me.input.pointer.LEFT);
617
609
  */
@@ -633,7 +625,7 @@ export function unbindPointer(button) {
633
625
  * @memberOf me.input
634
626
  * @public
635
627
  * @function
636
- * @param {String} eventType The event type for which the object is registering <br>
628
+ * @param {string} eventType The event type for which the object is registering <br>
637
629
  * melonJS currently supports: <br>
638
630
  * <ul>
639
631
  * <li><code>"pointermove"</code></li>
@@ -705,7 +697,7 @@ export function registerPointerEvent(eventType, region, callback) {
705
697
  * @memberOf me.input
706
698
  * @public
707
699
  * @function
708
- * @param {String} eventType The event type for which the object was registered. See {@link me.input.registerPointerEvent}
700
+ * @param {string} eventType The event type for which the object was registered. See {@link me.input.registerPointerEvent}
709
701
  * @param {me.Rect|me.Polygon|me.Line|me.Ellipse} region the registered region to release for this event
710
702
  * @param {Function} [callback="all"] if specified unregister the event only for the specific callback
711
703
  * @example
@@ -10,9 +10,9 @@
10
10
  * @function
11
11
  * @memberOf me.deprecated
12
12
  * @name warning
13
- * @param {String} deprecated deprecated class,function or property name
14
- * @param {String} replacement the replacement class, function, or property name
15
- * @param {String} version the version since when the lass,function or property is deprecated
13
+ * @param {string} deprecated deprecated class,function or property name
14
+ * @param {string} replacement the replacement class, function, or property name
15
+ * @param {string} version the version since when the lass,function or property is deprecated
16
16
  */
17
17
  export function warning(deprecated, replacement, version) {
18
18
  var msg = "melonJS: %s is deprecated since version %s, please use %s";
@@ -13,6 +13,9 @@ var levelIdx = [];
13
13
  // current level index
14
14
  var currentLevelIdx = 0;
15
15
 
16
+ /**
17
+ * @ignore
18
+ */
16
19
  function safeLoadLevel(levelId, options, restart) {
17
20
  // clean the destination container
18
21
  options.container.reset();
@@ -48,8 +51,8 @@ function safeLoadLevel(levelId, options, restart) {
48
51
  * @name loadTMXLevel
49
52
  * @memberOf me.level
50
53
  * @private
51
- * @param {String} level level id
52
- * @param {me.Container} target container
54
+ * @param {string} levelId level id
55
+ * @param {me.Container} container target container
53
56
  * @param {boolean} [flatten=true] if true, flatten all objects into the given container
54
57
  * @param {boolean} [setViewportBounds=false] if true, set the viewport bounds to the map size, this should be set to true especially if adding a level to the game world container.
55
58
  * @ignore
@@ -84,10 +87,10 @@ var level = {
84
87
  * @memberOf me.level
85
88
  * @public
86
89
  * @function
87
- * @param {String} format level format (only "tmx" supported)
88
- * @param {String} levelId the level id (or name)
90
+ * @param {string} format level format (only "tmx" supported)
91
+ * @param {string} levelId the level id (or name)
89
92
  * @param {Function} [callback] a function to be called once the level is loaded
90
- * @return {Boolean} true if the level was loaded
93
+ * @returns {boolean} true if the level was loaded
91
94
  */
92
95
  add(format, levelId, callback) {
93
96
  switch (format) {
@@ -123,12 +126,13 @@ var level = {
123
126
  * @memberOf me.level
124
127
  * @public
125
128
  * @function
126
- * @param {String} level level id
127
- * @param {Object} [options] additional optional parameters
129
+ * @param {string} levelId level id
130
+ * @param {object} [options] additional optional parameters
128
131
  * @param {me.Container} [options.container=me.game.world] container in which to load the specified level
129
- * @param {function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
132
+ * @param {Function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
130
133
  * @param {boolean} [options.flatten=me.game.mergeGroup] if true, flatten all objects into the given container
131
134
  * @param {boolean} [options.setViewportBounds=true] if true, set the viewport bounds to the map size
135
+ * @returns {boolean} true if the level was successfully loaded
132
136
  * @example
133
137
  * // the game assets to be be preloaded
134
138
  * // TMX maps
@@ -196,7 +200,7 @@ var level = {
196
200
  * @memberOf me.level
197
201
  * @public
198
202
  * @function
199
- * @return {String}
203
+ * @returns {string}
200
204
  */
201
205
  getCurrentLevelId() {
202
206
  return levelIdx[currentLevelIdx];
@@ -210,7 +214,7 @@ var level = {
210
214
  * @memberOf me.level
211
215
  * @public
212
216
  * @function
213
- * @return {me.TMXTileMap}
217
+ * @returns {me.TMXTileMap}
214
218
  */
215
219
  getCurrentLevel() {
216
220
  return levels[this.getCurrentLevelId()];
@@ -222,10 +226,11 @@ var level = {
222
226
  * @memberOf me.level
223
227
  * @public
224
228
  * @function
225
- * @param {Object} [options] additional optional parameters
229
+ * @param {object} [options] additional optional parameters
226
230
  * @param {me.Container} [options.container=me.game.world] container in which to load the specified level
227
- * @param {function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
231
+ * @param {Function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
228
232
  * @param {boolean} [options.flatten=me.game.mergeGroup] if true, flatten all objects into the given container
233
+ * @returns {object} the current level
229
234
  */
230
235
  reload(options) {
231
236
  // reset the level to initial state
@@ -239,10 +244,11 @@ var level = {
239
244
  * @memberOf me.level
240
245
  * @public
241
246
  * @function
242
- * @param {Object} [options] additional optional parameters
247
+ * @param {object} [options] additional optional parameters
243
248
  * @param {me.Container} [options.container=me.game.world] container in which to load the specified level
244
- * @param {function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
249
+ * @param {Function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
245
250
  * @param {boolean} [options.flatten=me.game.mergeGroup] if true, flatten all objects into the given container
251
+ * @returns {boolean} true if the next level was successfully loaded
246
252
  */
247
253
  next(options) {
248
254
  //go to the next level
@@ -260,10 +266,11 @@ var level = {
260
266
  * @memberOf me.level
261
267
  * @public
262
268
  * @function
263
- * @param {Object} [options] additional optional parameters
269
+ * @param {object} [options] additional optional parameters
264
270
  * @param {me.Container} [options.container=me.game.world] container in which to load the specified level
265
- * @param {function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
271
+ * @param {Function} [options.onLoaded=me.game.onLevelLoaded] callback for when the level is fully loaded
266
272
  * @param {boolean} [options.flatten=me.game.mergeGroup] if true, flatten all objects into the given container
273
+ * @returns {boolean} true if the previous level was successfully loaded
267
274
  */
268
275
  previous(options) {
269
276
  // go to previous level
@@ -281,6 +288,7 @@ var level = {
281
288
  * @memberOf me.level
282
289
  * @public
283
290
  * @function
291
+ * @returns {number} the amount of level preloaded
284
292
  */
285
293
  levelCount() {
286
294
  return levelIdx.length;
@@ -18,7 +18,7 @@ export default class TMXGroup {
18
18
  /**
19
19
  * group name
20
20
  * @public
21
- * @type String
21
+ * @type {string}
22
22
  * @name name
23
23
  * @memberOf me.TMXGroup
24
24
  */
@@ -27,7 +27,7 @@ export default class TMXGroup {
27
27
  /**
28
28
  * group width
29
29
  * @public
30
- * @type Number
30
+ * @type {number}
31
31
  * @name width
32
32
  * @memberOf me.TMXGroup
33
33
  */
@@ -36,7 +36,7 @@ export default class TMXGroup {
36
36
  /**
37
37
  * group height
38
38
  * @public
39
- * @type Number
39
+ * @type {number}
40
40
  * @name height
41
41
  * @memberOf me.TMXGroup
42
42
  */
@@ -45,7 +45,7 @@ export default class TMXGroup {
45
45
  /**
46
46
  * tint color
47
47
  * @public
48
- * @type String
48
+ * @type {string}
49
49
  * @name tintcolor
50
50
  * @memberOf me.TMXGroup
51
51
  */
@@ -54,7 +54,7 @@ export default class TMXGroup {
54
54
  /**
55
55
  * group z order
56
56
  * @public
57
- * @type Number
57
+ * @type {number}
58
58
  * @name z
59
59
  * @memberOf me.TMXGroup
60
60
  */
@@ -64,7 +64,7 @@ export default class TMXGroup {
64
64
  * group objects list definition
65
65
  * @see me.TMXObject
66
66
  * @public
67
- * @type Array
67
+ * @type {object[]}
68
68
  * @name name
69
69
  * @memberOf me.TMXGroup
70
70
  */