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
@@ -20,13 +20,12 @@ var globalFloatingCounter = 0;
20
20
  * @classdesc
21
21
  * me.Container represents a collection of child objects
22
22
  * @class Container
23
- * @extends me.Renderable
24
- * @memberOf me
25
- * @constructor
26
- * @param {Number} [x=0] position of the container (accessible via the inherited pos.x property)
27
- * @param {Number} [y=0] position of the container (accessible via the inherited pos.y property)
28
- * @param {Number} [w=me.game.viewport.width] width of the container
29
- * @param {Number} [h=me.game.viewport.height] height of the container
23
+ * @augments me.Renderable
24
+ * @memberof me
25
+ * @param {number} [x=0] position of the container (accessible via the inherited pos.x property)
26
+ * @param {number} [y=0] position of the container (accessible via the inherited pos.y property)
27
+ * @param {number} [w=me.game.viewport.width] width of the container
28
+ * @param {number} [h=me.game.viewport.height] height of the container
30
29
  */
31
30
 
32
31
  class Container extends Renderable {
@@ -48,10 +47,10 @@ class Container extends Renderable {
48
47
  /**
49
48
  * whether the container is the root of the scene
50
49
  * @public
51
- * @type Boolean
50
+ * @type {boolean}
52
51
  * @default false
53
52
  * @name root
54
- * @memberOf me.Container
53
+ * @memberof me.Container
55
54
  */
56
55
  this.root = root;
57
56
 
@@ -65,49 +64,49 @@ class Container extends Renderable {
65
64
  * The property of the child object that should be used to sort on <br>
66
65
  * value : "x", "y", "z"
67
66
  * @public
68
- * @type String
67
+ * @type {string}
69
68
  * @default me.game.sortOn
70
69
  * @name sortOn
71
- * @memberOf me.Container
70
+ * @memberof me.Container
72
71
  */
73
72
  this.sortOn = game.sortOn;
74
73
 
75
74
  /**
76
75
  * Specify if the children list should be automatically sorted when adding a new child
77
76
  * @public
78
- * @type Boolean
77
+ * @type {boolean}
79
78
  * @default true
80
79
  * @name autoSort
81
- * @memberOf me.Container
80
+ * @memberof me.Container
82
81
  */
83
82
  this.autoSort = true;
84
83
 
85
84
  /**
86
85
  * Specify if the children z index should automatically be managed by the parent container
87
86
  * @public
88
- * @type Boolean
87
+ * @type {boolean}
89
88
  * @default true
90
89
  * @name autoDepth
91
- * @memberOf me.Container
90
+ * @memberof me.Container
92
91
  */
93
92
  this.autoDepth = true;
94
93
 
95
94
  /**
96
95
  * Specify if the container draw operation should clip his children to its own bounds
97
96
  * @public
98
- * @type Boolean
97
+ * @type {boolean}
99
98
  * @default false
100
99
  * @name clipping
101
- * @memberOf me.Container
100
+ * @memberof me.Container
102
101
  */
103
102
  this.clipping = false;
104
103
 
105
104
  /**
106
105
  * a callback to be extended, triggered after a child has been added or removed
107
106
  * @name onChildChange
108
- * @memberOf me.Container#
107
+ * @memberof me.Container#
109
108
  * @function
110
- * @param {Number} index added or removed child index
109
+ * @param {number} index added or removed child index
111
110
  */
112
111
  this.onChildChange = function (/* index */) {
113
112
  // to be extended
@@ -118,10 +117,10 @@ class Container extends Renderable {
118
117
  * all child bounds when updated (this is expensive and disabled by default,
119
118
  * only enable if necessary)
120
119
  * @public
121
- * @type Boolean
120
+ * @type {boolean}
122
121
  * @default false
123
122
  * @name enableChildBoundsUpdate
124
- * @memberOf me.Container
123
+ * @memberof me.Container
125
124
  */
126
125
  this.enableChildBoundsUpdate = false;
127
126
 
@@ -149,7 +148,7 @@ class Container extends Renderable {
149
148
  /**
150
149
  * reset the container, removing all childrens, and reseting transforms.
151
150
  * @name reset
152
- * @memberOf me.Container
151
+ * @memberof me.Container
153
152
  * @function
154
153
  */
155
154
  reset() {
@@ -183,11 +182,11 @@ class Container extends Renderable {
183
182
  * orginal container. Then when the me.game.world.reset() is called the renderable
184
183
  * will not be in any container.
185
184
  * @name addChild
186
- * @memberOf me.Container.prototype
185
+ * @memberof me.Container.prototype
187
186
  * @function
188
187
  * @param {me.Renderable} child
189
188
  * @param {number} [z] forces the z index of the child to the specified value
190
- * @return {me.Renderable} the added child
189
+ * @returns {me.Renderable} the added child
191
190
  */
192
191
  addChild(child, z) {
193
192
  if (child.ancestor instanceof Container) {
@@ -247,11 +246,11 @@ class Container extends Renderable {
247
246
  * Add a child to the container at the specified index<br>
248
247
  * (the list won't be sorted after insertion)
249
248
  * @name addChildAt
250
- * @memberOf me.Container.prototype
249
+ * @memberof me.Container.prototype
251
250
  * @function
252
251
  * @param {me.Renderable} child
253
- * @param {Number} index
254
- * @return {me.Renderable} the added child
252
+ * @param {number} index
253
+ * @returns {me.Renderable} the added child
255
254
  */
256
255
  addChildAt(child, index) {
257
256
  if (index >= 0 && index < this.getChildren().length) {
@@ -306,10 +305,10 @@ class Container extends Renderable {
306
305
  * - The index of element in the array. <br>
307
306
  * - The array forEach() was called upon. <br>
308
307
  * @name forEach
309
- * @memberOf me.Container.prototype
308
+ * @memberof me.Container.prototype
310
309
  * @function
311
310
  * @param {Function} callback fnction to execute on each element
312
- * @param {Object} [thisArg] value to use as this(i.e reference Object) when executing callback.
311
+ * @param {object} [thisArg] value to use as this(i.e reference Object) when executing callback.
313
312
  * @example
314
313
  * // iterate through all children of the root container
315
314
  * me.game.world.forEach((child) => {
@@ -343,7 +342,7 @@ class Container extends Renderable {
343
342
  /**
344
343
  * Swaps the position (z-index) of 2 children
345
344
  * @name swapChildren
346
- * @memberOf me.Container.prototype
345
+ * @memberof me.Container.prototype
347
346
  * @function
348
347
  * @param {me.Renderable} child
349
348
  * @param {me.Renderable} child2
@@ -369,9 +368,10 @@ class Container extends Renderable {
369
368
  /**
370
369
  * Returns the Child at the specified index
371
370
  * @name getChildAt
372
- * @memberOf me.Container.prototype
371
+ * @memberof me.Container.prototype
373
372
  * @function
374
- * @param {Number} index
373
+ * @param {number} index
374
+ * @returns {me.Renderable} the child at the specified index
375
375
  */
376
376
  getChildAt(index) {
377
377
  if (index >= 0 && index < this.getChildren().length) {
@@ -385,9 +385,10 @@ class Container extends Renderable {
385
385
  /**
386
386
  * Returns the index of the given Child
387
387
  * @name getChildIndex
388
- * @memberOf me.Container.prototype
388
+ * @memberof me.Container.prototype
389
389
  * @function
390
390
  * @param {me.Renderable} child
391
+ * @returns {number} index
391
392
  */
392
393
  getChildIndex(child) {
393
394
  return this.getChildren().indexOf(child);
@@ -396,9 +397,10 @@ class Container extends Renderable {
396
397
  /**
397
398
  * Returns the next child within the container or undefined if none
398
399
  * @name getNextChild
399
- * @memberOf me.Container
400
+ * @memberof me.Container
400
401
  * @function
401
402
  * @param {me.Renderable} child
403
+ * @returns {me.Renderable} child
402
404
  */
403
405
  getNextChild(child) {
404
406
  var index = this.getChildren().indexOf(child) - 1;
@@ -411,10 +413,10 @@ class Container extends Renderable {
411
413
  /**
412
414
  * Returns true if contains the specified Child
413
415
  * @name hasChild
414
- * @memberOf me.Container.prototype
416
+ * @memberof me.Container.prototype
415
417
  * @function
416
418
  * @param {me.Renderable} child
417
- * @return {Boolean}
419
+ * @returns {boolean}
418
420
  */
419
421
  hasChild(child) {
420
422
  return this === child.ancestor;
@@ -425,12 +427,12 @@ class Container extends Renderable {
425
427
  * note : avoid calling this function every frame since
426
428
  * it parses the whole object tree each time
427
429
  * @name getChildByProp
428
- * @memberOf me.Container.prototype
430
+ * @memberof me.Container.prototype
429
431
  * @public
430
432
  * @function
431
- * @param {String} prop Property name
432
- * @param {String|RegExp|Number|Boolean} value Value of the property
433
- * @return {me.Renderable[]} Array of childs
433
+ * @param {string} prop Property name
434
+ * @param {string|RegExp|number|boolean} value Value of the property
435
+ * @returns {me.Renderable[]} Array of childs
434
436
  * @example
435
437
  * // get the first child object called "mainPlayer" in a specific container :
436
438
  * var ent = myContainer.getChildByProp("name", "mainPlayer");
@@ -449,6 +451,9 @@ class Container extends Renderable {
449
451
  getChildByProp(prop, value) {
450
452
  var objList = [];
451
453
 
454
+ /**
455
+ * @ignore
456
+ */
452
457
  function compare(obj, prop) {
453
458
  var v = obj[prop];
454
459
  if (value instanceof RegExp && typeof(v) === "string") {
@@ -474,21 +479,21 @@ class Container extends Renderable {
474
479
  /**
475
480
  * returns the list of childs with the specified class type
476
481
  * @name getChildByType
477
- * @memberOf me.Container.prototype
482
+ * @memberof me.Container.prototype
478
483
  * @public
479
484
  * @function
480
- * @param {Object} class type
481
- * @return {me.Renderable[]} Array of children
485
+ * @param {object} classType
486
+ * @returns {me.Renderable[]} Array of children
482
487
  */
483
- getChildByType(_class) {
488
+ getChildByType(classType) {
484
489
  var objList = [];
485
490
 
486
491
  this.forEach((child) => {
487
- if (child instanceof _class) {
492
+ if (child instanceof classType) {
488
493
  objList.push(child);
489
494
  }
490
495
  if (child instanceof Container) {
491
- objList = objList.concat(child.getChildByType(_class));
496
+ objList = objList.concat(child.getChildByType(classType));
492
497
  }
493
498
  });
494
499
 
@@ -501,11 +506,11 @@ class Container extends Renderable {
501
506
  * note : avoid calling this function every frame since
502
507
  * it parses the whole object list each time
503
508
  * @name getChildByName
504
- * @memberOf me.Container.prototype
509
+ * @memberof me.Container.prototype
505
510
  * @public
506
511
  * @function
507
- * @param {String|RegExp|Number|Boolean} name child name
508
- * @return {me.Renderable[]} Array of children
512
+ * @param {string|RegExp|number|boolean} name child name
513
+ * @returns {me.Renderable[]} Array of children
509
514
  */
510
515
  getChildByName(name) {
511
516
  return this.getChildByProp("name", name);
@@ -516,26 +521,24 @@ class Container extends Renderable {
516
521
  * note : avoid calling this function every frame since
517
522
  * it parses the whole object list each time
518
523
  * @name getChildByGUID
519
- * @memberOf me.Container.prototype
524
+ * @memberof me.Container.prototype
520
525
  * @public
521
526
  * @function
522
- * @param {String|RegExp|Number|Boolean} GUID child GUID
523
- * @return {me.Renderable} corresponding child or null
527
+ * @param {string|RegExp|number|boolean} guid child GUID
528
+ * @returns {me.Renderable} corresponding child or null
524
529
  */
525
530
  getChildByGUID(guid) {
526
531
  var obj = this.getChildByProp("GUID", guid);
527
532
  return (obj.length > 0) ? obj[0] : null;
528
533
  }
529
534
 
530
-
531
535
  /**
532
536
  * return all child in this container
533
-
534
537
  * @name getChildren
535
- * @memberOf me.Container.prototype
538
+ * @memberof me.Container.prototype
536
539
  * @public
537
540
  * @function
538
- * @return {me.Renderable[]} an array of renderable object
541
+ * @returns {me.Renderable[]} an array of renderable object
539
542
  */
540
543
  getChildren() {
541
544
  if (typeof this.children === "undefined") {
@@ -548,9 +551,9 @@ class Container extends Renderable {
548
551
  * update the bounding box for this shape.
549
552
  * @ignore
550
553
  * @name updateBounds
551
- * @memberOf me.Renderable.prototype
554
+ * @memberof me.Renderable.prototype
552
555
  * @function
553
- * @return {me.Bounds} this shape bounding box Rectangle object
556
+ * @returns {me.Bounds} this shape bounding box Rectangle object
554
557
  */
555
558
  updateBounds(forceUpdateChildBounds = false) {
556
559
 
@@ -577,9 +580,9 @@ class Container extends Renderable {
577
580
  * Checks if this container is root or if it's attached to the root container.
578
581
  * @private
579
582
  * @name isAttachedToRoot
580
- * @memberOf me.Container.prototype
583
+ * @memberof me.Container.prototype
581
584
  * @function
582
- * @returns Boolean
585
+ * @returns {boolean}
583
586
  */
584
587
  isAttachedToRoot() {
585
588
  if (this.root === true) {
@@ -598,9 +601,9 @@ class Container extends Renderable {
598
601
 
599
602
  /**
600
603
  * update the cointainer's bounding rect (private)
601
- * @private
604
+ * @ignore
602
605
  * @name updateBoundsPos
603
- * @memberOf me.Container.prototype
606
+ * @memberof me.Container.prototype
604
607
  * @function
605
608
  */
606
609
  updateBoundsPos(newX, newY) {
@@ -635,11 +638,11 @@ class Container extends Renderable {
635
638
  /**
636
639
  * Invokes the removeChildNow in a defer, to ensure the child is removed safely after the update & draw stack has completed
637
640
  * @name removeChild
638
- * @memberOf me.Container.prototype
641
+ * @memberof me.Container.prototype
639
642
  * @public
640
643
  * @function
641
644
  * @param {me.Renderable} child
642
- * @param {Boolean} [keepalive=False] True to prevent calling child.destroy()
645
+ * @param {boolean} [keepalive=False] True to prevent calling child.destroy()
643
646
  */
644
647
  removeChild(child, keepalive) {
645
648
  if (this.hasChild(child)) {
@@ -655,10 +658,10 @@ class Container extends Renderable {
655
658
  * (removal is immediate and unconditional)<br>
656
659
  * Never use keepalive=true with objects from {@link me.pool}. Doing so will create a memory leak.
657
660
  * @name removeChildNow
658
- * @memberOf me.Container.prototype
661
+ * @memberof me.Container.prototype
659
662
  * @function
660
663
  * @param {me.Renderable} child
661
- * @param {Boolean} [keepalive=False] True to prevent calling child.destroy()
664
+ * @param {boolean} [keepalive=False] True to prevent calling child.destroy()
662
665
  */
663
666
  removeChildNow(child, keepalive) {
664
667
  if (this.hasChild(child) && (this.getChildIndex(child) >= 0)) {
@@ -708,25 +711,25 @@ class Container extends Renderable {
708
711
  /**
709
712
  * Automatically set the specified property of all childs to the given value
710
713
  * @name setChildsProperty
711
- * @memberOf me.Container.prototype
714
+ * @memberof me.Container.prototype
712
715
  * @function
713
- * @param {String} property property name
714
- * @param {Object} value property value
715
- * @param {Boolean} [recursive=false] recursively apply the value to child containers if true
716
+ * @param {string} prop property name
717
+ * @param {object} value property value
718
+ * @param {boolean} [recursive=false] recursively apply the value to child containers if true
716
719
  */
717
- setChildsProperty(prop, val, recursive) {
720
+ setChildsProperty(prop, value, recursive) {
718
721
  this.forEach((child) => {
719
722
  if ((recursive === true) && (child instanceof Container)) {
720
- child.setChildsProperty(prop, val, recursive);
723
+ child.setChildsProperty(prop, value, recursive);
721
724
  }
722
- child[prop] = val;
725
+ child[prop] = value;
723
726
  });
724
727
  }
725
728
 
726
729
  /**
727
730
  * Move the child in the group one step forward (z depth).
728
731
  * @name moveUp
729
- * @memberOf me.Container.prototype
732
+ * @memberof me.Container.prototype
730
733
  * @function
731
734
  * @param {me.Renderable} child
732
735
  */
@@ -741,7 +744,7 @@ class Container extends Renderable {
741
744
  /**
742
745
  * Move the child in the group one step backward (z depth).
743
746
  * @name moveDown
744
- * @memberOf me.Container.prototype
747
+ * @memberof me.Container.prototype
745
748
  * @function
746
749
  * @param {me.Renderable} child
747
750
  */
@@ -756,7 +759,7 @@ class Container extends Renderable {
756
759
  /**
757
760
  * Move the specified child to the top(z depth).
758
761
  * @name moveToTop
759
- * @memberOf me.Container.prototype
762
+ * @memberof me.Container.prototype
760
763
  * @function
761
764
  * @param {me.Renderable} child
762
765
  */
@@ -774,7 +777,7 @@ class Container extends Renderable {
774
777
  /**
775
778
  * Move the specified child the bottom (z depth).
776
779
  * @name moveToBottom
777
- * @memberOf me.Container.prototype
780
+ * @memberof me.Container.prototype
778
781
  * @function
779
782
  * @param {me.Renderable} child
780
783
  */
@@ -792,10 +795,10 @@ class Container extends Renderable {
792
795
  /**
793
796
  * Manually trigger the sort of all the childs in the container</p>
794
797
  * @name sort
795
- * @memberOf me.Container.prototype
798
+ * @memberof me.Container.prototype
796
799
  * @public
797
800
  * @function
798
- * @param {Boolean} [recursive=false] recursively sort all containers if true
801
+ * @param {boolean} [recursive=false] recursively sort all containers if true
799
802
  */
800
803
  sort(recursive) {
801
804
  // do nothing if there is already a pending sort
@@ -884,7 +887,14 @@ class Container extends Renderable {
884
887
  }
885
888
 
886
889
  /**
887
- * @ignore
890
+ * container update function. <br>
891
+ * automatically called by the game manager {@link me.game}
892
+ * @name update
893
+ * @memberof me.Container.prototype
894
+ * @function
895
+ * @protected
896
+ * @param {number} dt time since the last update in milliseconds.
897
+ * @returns {boolean} true if the Container is dirty
888
898
  */
889
899
  update(dt) {
890
900
  var isFloating = false;
@@ -930,7 +940,14 @@ class Container extends Renderable {
930
940
  }
931
941
 
932
942
  /**
933
- * @ignore
943
+ * draw the container. <br>
944
+ * automatically called by the game manager {@link me.game}
945
+ * @name draw
946
+ * @memberof me.Container.prototype
947
+ * @function
948
+ * @protected
949
+ * @param {me.CanvasRenderer|me.WebGLRenderer} renderer a renderer object
950
+ * @param {me.Rect|me.Bounds} [rect] the area or viewport to (re)draw
934
951
  */
935
952
  draw(renderer, rect) {
936
953
  var isFloating = false;
@@ -10,19 +10,18 @@ import * as stringUtil from "./../utils/string.js";
10
10
  * @classdesc
11
11
  * a generic Image Layer Object
12
12
  * @class ImageLayer
13
- * @extends me.Renderable
14
- * @memberOf me
15
- * @constructor
16
- * @param {Number} x x coordinate
17
- * @param {Number} y y coordinate
18
- * @param {Object} settings ImageLayer properties
19
- * @param {HTMLImageElement|HTMLCanvasElement|String} settings.image Image reference. See {@link me.loader.getImage}
20
- * @param {String} [settings.name="me.ImageLayer"] layer name
21
- * @param {Number} [settings.z=0] z-index position
22
- * @param {Number|me.Vector2d} [settings.ratio=1.0] Scrolling ratio to be applied. See {@link me.ImageLayer#ratio}
23
- * @param {String} [settings.repeat='repeat'] define if and how an Image Layer should be repeated (accepted values are 'repeat',
13
+ * @augments me.Renderable
14
+ * @memberof me
15
+ * @param {number} x x coordinate
16
+ * @param {number} y y coordinate
17
+ * @param {object} settings ImageLayer properties
18
+ * @param {HTMLImageElement|HTMLCanvasElement|string} settings.image Image reference. See {@link me.loader.getImage}
19
+ * @param {string} [settings.name="me.ImageLayer"] layer name
20
+ * @param {number} [settings.z=0] z-index position
21
+ * @param {number|me.Vector2d} [settings.ratio=1.0] Scrolling ratio to be applied. See {@link me.ImageLayer#ratio}
22
+ * @param {string} [settings.repeat='repeat'] define if and how an Image Layer should be repeated (accepted values are 'repeat',
24
23
  'repeat-x', 'repeat-y', 'no-repeat'). See {@link me.ImageLayer#repeat}
25
- * @param {Number|me.Vector2d} [settings.anchorPoint=0.0] Image origin. See {@link me.ImageLayer#anchorPoint}
24
+ * @param {number|me.Vector2d} [settings.anchorPoint=0.0] Image origin. See {@link me.ImageLayer#anchorPoint}
26
25
  * @example
27
26
  * // create a repetitive background pattern on the X axis using the citycloud image asset
28
27
  * me.game.world.addChild(new me.ImageLayer(0, 0, {
@@ -54,7 +53,7 @@ class ImageLayer extends Sprite {
54
53
  * - a number, to change the value for both axis <br>
55
54
  * - a json expression like `json:{"x":0.5,"y":0.5}` if you wish to specify a different value for both x and y
56
55
  * @public
57
- * @type me.Vector2d
56
+ * @type {me.Vector2d}
58
57
  * @default <1.0,1.0>
59
58
  * @name me.ImageLayer#ratio
60
59
  */
@@ -75,14 +74,14 @@ class ImageLayer extends Sprite {
75
74
  * By default, its upper-left corner is anchored to the viewport bounds upper left corner.<br>
76
75
  * The anchorPoint is a unit vector where each component falls in range [0.0,1.0].<br>
77
76
  * Some common examples:<br>
78
- * * &lt;0.0,0.0&gt; : (Default) Anchor image to the upper-left corner of viewport bounds
79
- * * &lt;0.5,0.5&gt; : Center the image within viewport bounds
80
- * * &lt;1.0,1.0&gt; : Anchor image to the lower-right corner of viewport bounds
77
+ * - &lt;0.0,0.0&gt; : (Default) Anchor image to the upper-left corner of viewport bounds
78
+ * - &lt;0.5,0.5&gt; : Center the image within viewport bounds
79
+ * - &lt;1.0,1.0&gt; : Anchor image to the lower-right corner of viewport bounds
81
80
  * To specify a value through Tiled, use one of the following format : <br>
82
81
  * - a number, to change the value for both axis <br>
83
82
  * - a json expression like `json:{"x":0.5,"y":0.5}` if you wish to specify a different value for both x and y
84
83
  * @public
85
- * @type me.Vector2d
84
+ * @type {me.Vector2d}
86
85
  * @default <0.0,0.0>
87
86
  * @name me.ImageLayer#anchorPoint
88
87
  */
@@ -107,26 +106,20 @@ class ImageLayer extends Sprite {
107
106
  * Define if and how an Image Layer should be repeated.<br>
108
107
  * By default, an Image Layer is repeated both vertically and horizontally.<br>
109
108
  * Acceptable values : <br>
110
- * * 'repeat' - The background image will be repeated both vertically and horizontally <br>
111
- * * 'repeat-x' - The background image will be repeated only horizontally.<br>
112
- * * 'repeat-y' - The background image will be repeated only vertically.<br>
113
- * * 'no-repeat' - The background-image will not be repeated.<br>
109
+ * - 'repeat' - The background image will be repeated both vertically and horizontally <br>
110
+ * - 'repeat-x' - The background image will be repeated only horizontally.<br>
111
+ * - 'repeat-y' - The background image will be repeated only vertically.<br>
112
+ * - 'no-repeat' - The background-image will not be repeated.<br>
114
113
  * @public
115
- * @type String
114
+ * @type {string}
116
115
  * @default 'repeat'
117
116
  * @name me.ImageLayer#repeat
118
117
  */
119
118
 
120
- /**
121
- * @ignore
122
- */
123
119
  get repeat() {
124
120
  return this._repeat;
125
121
  }
126
122
 
127
- /**
128
- * @ignore
129
- */
130
123
  set repeat(value) {
131
124
  this._repeat = value;
132
125
  switch (this._repeat) {
@@ -172,11 +165,11 @@ class ImageLayer extends Sprite {
172
165
  /**
173
166
  * resize the Image Layer to match the given size
174
167
  * @name resize
175
- * @memberOf me.ImageLayer.prototype
168
+ * @memberof me.ImageLayer.prototype
176
169
  * @function
177
- * @param {Number} w new width
178
- * @param {Number} h new height
179
- */
170
+ * @param {number} w new width
171
+ * @param {number} h new height
172
+ */
180
173
  resize(w, h) {
181
174
  super.resize(
182
175
  this.repeatX ? Infinity : w,
@@ -243,7 +236,7 @@ class ImageLayer extends Sprite {
243
236
  this.isDirty = true;
244
237
  }
245
238
 
246
- /*
239
+ /**
247
240
  * override the default predraw function
248
241
  * as repeat and anchor are managed directly in the draw method
249
242
  * @ignore
@@ -259,8 +252,13 @@ class ImageLayer extends Sprite {
259
252
  }
260
253
 
261
254
  /**
262
- * draw the image layer
263
- * @ignore
255
+ * draw the ImageLayer. <br>
256
+ * automatically called by the game manager {@link me.game}
257
+ * @name draw
258
+ * @memberof me.ImageLayer.prototype
259
+ * @function
260
+ * @protected
261
+ * @param {me.CanvasRenderer|me.WebGLRenderer} renderer a renderer object
264
262
  */
265
263
  draw(renderer) {
266
264
  var width = this.width,
@@ -7,22 +7,21 @@ import Sprite from "./sprite.js";
7
7
  * <img src="images/9-slice-scaling.png"/><br>
8
8
  * @see https://en.wikipedia.org/wiki/9-slice_scaling
9
9
  * @class NineSliceSprite
10
- * @extends me.Sprite
11
- * @memberOf me
12
- * @constructor
13
- * @param {Number} x the x coordinates of the sprite object
14
- * @param {Number} y the y coordinates of the sprite object
15
- * @param {Object} settings Configuration parameters for the Sprite object
16
- * @param {Number} settings.width the width of the Renderable over which the sprite needs to be stretched
17
- * @param {Number} settings.height the height of the Renderable over which the sprite needs to be stretched
18
- * @param {me.Renderer.Texture|HTMLImageElement|HTMLCanvasElement|String} settings.image reference to a texture, spritesheet image or to a texture atlas
19
- * @param {String} [settings.name=""] name of this object
20
- * @param {String} [settings.region] region name of a specific region to use when using a texture atlas, see {@link me.Renderer.Texture}
21
- * @param {Number} [settings.framewidth] Width of a single frame within the spritesheet
22
- * @param {Number} [settings.frameheight] Height of a single frame within the spritesheet
23
- * @param {String|me.Color} [settings.tint] a tint to be applied to this sprite
24
- * @param {Number} [settings.flipX] flip the sprite on the horizontal axis
25
- * @param {Number} [settings.flipY] flip the sprite on the vertical axis
10
+ * @augments me.Sprite
11
+ * @memberof me
12
+ * @param {number} x the x coordinates of the sprite object
13
+ * @param {number} y the y coordinates of the sprite object
14
+ * @param {object} settings Configuration parameters for the Sprite object
15
+ * @param {number} settings.width the width of the Renderable over which the sprite needs to be stretched
16
+ * @param {number} settings.height the height of the Renderable over which the sprite needs to be stretched
17
+ * @param {me.Renderer.Texture|HTMLImageElement|HTMLCanvasElement|string} settings.image reference to a texture, spritesheet image or to a texture atlas
18
+ * @param {string} [settings.name=""] name of this object
19
+ * @param {string} [settings.region] region name of a specific region to use when using a texture atlas, see {@link me.Renderer.Texture}
20
+ * @param {number} [settings.framewidth] Width of a single frame within the spritesheet
21
+ * @param {number} [settings.frameheight] Height of a single frame within the spritesheet
22
+ * @param {string|me.Color} [settings.tint] a tint to be applied to this sprite
23
+ * @param {number} [settings.flipX] flip the sprite on the horizontal axis
24
+ * @param {number} [settings.flipY] flip the sprite on the vertical axis
26
25
  * @param {me.Vector2d} [settings.anchorPoint={x:0.5, y:0.5}] Anchor point to draw the frame at (defaults to the center of the frame).
27
26
  * @example
28
27
  * this.panelSprite = new me.NineSliceSprite(0, 0, {