melonjs 10.1.1 → 10.2.3
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.
- package/README.md +6 -10
- package/dist/melonjs.js +3114 -2866
- package/dist/melonjs.min.js +3 -3
- package/dist/melonjs.module.d.ts +2588 -2498
- package/dist/melonjs.module.js +2694 -2479
- package/package.json +10 -11
- package/src/audio/audio.js +43 -43
- package/src/camera/camera2d.js +52 -74
- package/src/entity/draggable.js +18 -17
- package/src/entity/droptarget.js +19 -18
- package/src/entity/entity.js +22 -26
- package/src/game.js +3 -3
- package/src/index.js +15 -11
- package/src/input/gamepad.js +13 -13
- package/src/input/input.js +1 -1
- package/src/input/keyboard.js +14 -16
- package/src/input/pointer.js +42 -35
- package/src/input/pointerevent.js +25 -33
- package/src/lang/deprecated.js +3 -3
- package/src/level/level.js +24 -16
- package/src/level/tiled/TMXGroup.js +6 -6
- package/src/level/tiled/TMXLayer.js +31 -31
- package/src/level/tiled/TMXObject.js +19 -19
- package/src/level/tiled/TMXTile.js +11 -12
- package/src/level/tiled/TMXTileMap.js +23 -21
- package/src/level/tiled/TMXTileset.js +13 -13
- package/src/level/tiled/TMXTilesetGroup.js +4 -4
- package/src/level/tiled/TMXUtils.js +13 -11
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXRenderer.js +17 -17
- package/src/loader/loader.js +31 -27
- package/src/loader/loadingscreen.js +44 -75
- package/src/math/color.js +45 -64
- package/src/math/math.js +17 -17
- package/src/math/matrix2.js +46 -46
- package/src/math/matrix3.js +64 -64
- package/src/math/observable_vector2.js +45 -57
- package/src/math/observable_vector3.js +56 -70
- package/src/math/vector2.js +60 -59
- package/src/math/vector3.js +65 -64
- package/src/particles/emitter.js +53 -55
- package/src/particles/particle.js +1 -1
- package/src/physics/body.js +45 -51
- package/src/physics/bounds.js +36 -36
- package/src/physics/collision.js +15 -16
- package/src/physics/detector.js +10 -11
- package/src/physics/quadtree.js +18 -16
- package/src/physics/sat.js +17 -17
- package/src/physics/world.js +12 -10
- package/src/plugin/plugin.js +6 -6
- package/src/renderable/GUI.js +13 -18
- package/src/renderable/collectable.js +3 -3
- package/src/renderable/colorlayer.js +4 -4
- package/src/renderable/container.js +64 -46
- package/src/renderable/imagelayer.js +30 -31
- package/src/renderable/nineslicesprite.js +158 -69
- package/src/renderable/renderable.js +68 -67
- package/src/renderable/sprite.js +57 -43
- package/src/renderable/trigger.js +14 -15
- package/src/shapes/ellipse.js +27 -26
- package/src/shapes/line.js +8 -7
- package/src/shapes/poly.js +33 -31
- package/src/shapes/rectangle.js +50 -96
- package/src/state/stage.js +8 -8
- package/src/state/state.js +56 -56
- package/src/system/device.js +97 -84
- package/src/system/event.js +72 -72
- package/src/system/pooling.js +14 -14
- package/src/system/save.js +6 -3
- package/src/system/timer.js +20 -20
- package/src/text/bitmaptext.js +27 -33
- package/src/text/bitmaptextdata.js +9 -9
- package/src/text/text.js +118 -59
- package/src/tweens/easing.js +4 -4
- package/src/tweens/interpolation.js +4 -4
- package/src/tweens/tween.js +37 -27
- package/src/utils/agent.js +9 -8
- package/src/utils/array.js +4 -4
- package/src/utils/file.js +4 -4
- package/src/utils/function.js +5 -5
- package/src/utils/string.js +12 -12
- package/src/utils/utils.js +19 -19
- package/src/video/canvas/canvas_renderer.js +90 -90
- package/src/video/renderer.js +40 -39
- package/src/video/texture.js +85 -76
- package/src/video/texture_cache.js +11 -0
- package/src/video/video.js +31 -31
- package/src/video/webgl/buffer/vertex.js +9 -1
- package/src/video/webgl/glshader.js +20 -20
- package/src/video/webgl/webgl_compositor.js +47 -46
- package/src/video/webgl/webgl_renderer.js +104 -104
|
@@ -23,10 +23,10 @@ var globalFloatingCounter = 0;
|
|
|
23
23
|
* @extends me.Renderable
|
|
24
24
|
* @memberOf me
|
|
25
25
|
* @constructor
|
|
26
|
-
* @param {
|
|
27
|
-
* @param {
|
|
28
|
-
* @param {
|
|
29
|
-
* @param {
|
|
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
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
32
|
class Container extends Renderable {
|
|
@@ -48,7 +48,7 @@ class Container extends Renderable {
|
|
|
48
48
|
/**
|
|
49
49
|
* whether the container is the root of the scene
|
|
50
50
|
* @public
|
|
51
|
-
* @type
|
|
51
|
+
* @type {boolean}
|
|
52
52
|
* @default false
|
|
53
53
|
* @name root
|
|
54
54
|
* @memberOf me.Container
|
|
@@ -65,7 +65,7 @@ class Container extends Renderable {
|
|
|
65
65
|
* The property of the child object that should be used to sort on <br>
|
|
66
66
|
* value : "x", "y", "z"
|
|
67
67
|
* @public
|
|
68
|
-
* @type
|
|
68
|
+
* @type {string}
|
|
69
69
|
* @default me.game.sortOn
|
|
70
70
|
* @name sortOn
|
|
71
71
|
* @memberOf me.Container
|
|
@@ -75,7 +75,7 @@ class Container extends Renderable {
|
|
|
75
75
|
/**
|
|
76
76
|
* Specify if the children list should be automatically sorted when adding a new child
|
|
77
77
|
* @public
|
|
78
|
-
* @type
|
|
78
|
+
* @type {boolean}
|
|
79
79
|
* @default true
|
|
80
80
|
* @name autoSort
|
|
81
81
|
* @memberOf me.Container
|
|
@@ -85,7 +85,7 @@ class Container extends Renderable {
|
|
|
85
85
|
/**
|
|
86
86
|
* Specify if the children z index should automatically be managed by the parent container
|
|
87
87
|
* @public
|
|
88
|
-
* @type
|
|
88
|
+
* @type {boolean}
|
|
89
89
|
* @default true
|
|
90
90
|
* @name autoDepth
|
|
91
91
|
* @memberOf me.Container
|
|
@@ -95,7 +95,7 @@ class Container extends Renderable {
|
|
|
95
95
|
/**
|
|
96
96
|
* Specify if the container draw operation should clip his children to its own bounds
|
|
97
97
|
* @public
|
|
98
|
-
* @type
|
|
98
|
+
* @type {boolean}
|
|
99
99
|
* @default false
|
|
100
100
|
* @name clipping
|
|
101
101
|
* @memberOf me.Container
|
|
@@ -107,7 +107,7 @@ class Container extends Renderable {
|
|
|
107
107
|
* @name onChildChange
|
|
108
108
|
* @memberOf me.Container#
|
|
109
109
|
* @function
|
|
110
|
-
* @param {
|
|
110
|
+
* @param {number} index added or removed child index
|
|
111
111
|
*/
|
|
112
112
|
this.onChildChange = function (/* index */) {
|
|
113
113
|
// to be extended
|
|
@@ -118,7 +118,7 @@ class Container extends Renderable {
|
|
|
118
118
|
* all child bounds when updated (this is expensive and disabled by default,
|
|
119
119
|
* only enable if necessary)
|
|
120
120
|
* @public
|
|
121
|
-
* @type
|
|
121
|
+
* @type {boolean}
|
|
122
122
|
* @default false
|
|
123
123
|
* @name enableChildBoundsUpdate
|
|
124
124
|
* @memberOf me.Container
|
|
@@ -187,7 +187,7 @@ class Container extends Renderable {
|
|
|
187
187
|
* @function
|
|
188
188
|
* @param {me.Renderable} child
|
|
189
189
|
* @param {number} [z] forces the z index of the child to the specified value
|
|
190
|
-
* @
|
|
190
|
+
* @returns {me.Renderable} the added child
|
|
191
191
|
*/
|
|
192
192
|
addChild(child, z) {
|
|
193
193
|
if (child.ancestor instanceof Container) {
|
|
@@ -250,8 +250,8 @@ class Container extends Renderable {
|
|
|
250
250
|
* @memberOf me.Container.prototype
|
|
251
251
|
* @function
|
|
252
252
|
* @param {me.Renderable} child
|
|
253
|
-
* @param {
|
|
254
|
-
* @
|
|
253
|
+
* @param {number} index
|
|
254
|
+
* @returns {me.Renderable} the added child
|
|
255
255
|
*/
|
|
256
256
|
addChildAt(child, index) {
|
|
257
257
|
if (index >= 0 && index < this.getChildren().length) {
|
|
@@ -309,7 +309,7 @@ class Container extends Renderable {
|
|
|
309
309
|
* @memberOf me.Container.prototype
|
|
310
310
|
* @function
|
|
311
311
|
* @param {Function} callback fnction to execute on each element
|
|
312
|
-
* @param {
|
|
312
|
+
* @param {object} [thisArg] value to use as this(i.e reference Object) when executing callback.
|
|
313
313
|
* @example
|
|
314
314
|
* // iterate through all children of the root container
|
|
315
315
|
* me.game.world.forEach((child) => {
|
|
@@ -371,7 +371,8 @@ class Container extends Renderable {
|
|
|
371
371
|
* @name getChildAt
|
|
372
372
|
* @memberOf me.Container.prototype
|
|
373
373
|
* @function
|
|
374
|
-
* @param {
|
|
374
|
+
* @param {number} index
|
|
375
|
+
* @returns {me.Renderable} the child at the specified index
|
|
375
376
|
*/
|
|
376
377
|
getChildAt(index) {
|
|
377
378
|
if (index >= 0 && index < this.getChildren().length) {
|
|
@@ -388,6 +389,7 @@ class Container extends Renderable {
|
|
|
388
389
|
* @memberOf me.Container.prototype
|
|
389
390
|
* @function
|
|
390
391
|
* @param {me.Renderable} child
|
|
392
|
+
* @returns {number} index
|
|
391
393
|
*/
|
|
392
394
|
getChildIndex(child) {
|
|
393
395
|
return this.getChildren().indexOf(child);
|
|
@@ -399,6 +401,7 @@ class Container extends Renderable {
|
|
|
399
401
|
* @memberOf me.Container
|
|
400
402
|
* @function
|
|
401
403
|
* @param {me.Renderable} child
|
|
404
|
+
* @returns {me.Renderable} child
|
|
402
405
|
*/
|
|
403
406
|
getNextChild(child) {
|
|
404
407
|
var index = this.getChildren().indexOf(child) - 1;
|
|
@@ -414,7 +417,7 @@ class Container extends Renderable {
|
|
|
414
417
|
* @memberOf me.Container.prototype
|
|
415
418
|
* @function
|
|
416
419
|
* @param {me.Renderable} child
|
|
417
|
-
* @
|
|
420
|
+
* @returns {boolean}
|
|
418
421
|
*/
|
|
419
422
|
hasChild(child) {
|
|
420
423
|
return this === child.ancestor;
|
|
@@ -428,9 +431,9 @@ class Container extends Renderable {
|
|
|
428
431
|
* @memberOf me.Container.prototype
|
|
429
432
|
* @public
|
|
430
433
|
* @function
|
|
431
|
-
* @param {
|
|
432
|
-
* @param {
|
|
433
|
-
* @
|
|
434
|
+
* @param {string} prop Property name
|
|
435
|
+
* @param {string|RegExp|number|boolean} value Value of the property
|
|
436
|
+
* @returns {me.Renderable[]} Array of childs
|
|
434
437
|
* @example
|
|
435
438
|
* // get the first child object called "mainPlayer" in a specific container :
|
|
436
439
|
* var ent = myContainer.getChildByProp("name", "mainPlayer");
|
|
@@ -449,6 +452,9 @@ class Container extends Renderable {
|
|
|
449
452
|
getChildByProp(prop, value) {
|
|
450
453
|
var objList = [];
|
|
451
454
|
|
|
455
|
+
/**
|
|
456
|
+
* @ignore
|
|
457
|
+
*/
|
|
452
458
|
function compare(obj, prop) {
|
|
453
459
|
var v = obj[prop];
|
|
454
460
|
if (value instanceof RegExp && typeof(v) === "string") {
|
|
@@ -477,18 +483,18 @@ class Container extends Renderable {
|
|
|
477
483
|
* @memberOf me.Container.prototype
|
|
478
484
|
* @public
|
|
479
485
|
* @function
|
|
480
|
-
* @param {
|
|
481
|
-
* @
|
|
486
|
+
* @param {object} classType
|
|
487
|
+
* @returns {me.Renderable[]} Array of children
|
|
482
488
|
*/
|
|
483
|
-
getChildByType(
|
|
489
|
+
getChildByType(classType) {
|
|
484
490
|
var objList = [];
|
|
485
491
|
|
|
486
492
|
this.forEach((child) => {
|
|
487
|
-
if (child instanceof
|
|
493
|
+
if (child instanceof classType) {
|
|
488
494
|
objList.push(child);
|
|
489
495
|
}
|
|
490
496
|
if (child instanceof Container) {
|
|
491
|
-
objList = objList.concat(child.getChildByType(
|
|
497
|
+
objList = objList.concat(child.getChildByType(classType));
|
|
492
498
|
}
|
|
493
499
|
});
|
|
494
500
|
|
|
@@ -504,8 +510,8 @@ class Container extends Renderable {
|
|
|
504
510
|
* @memberOf me.Container.prototype
|
|
505
511
|
* @public
|
|
506
512
|
* @function
|
|
507
|
-
* @param {
|
|
508
|
-
* @
|
|
513
|
+
* @param {string|RegExp|number|boolean} name child name
|
|
514
|
+
* @returns {me.Renderable[]} Array of children
|
|
509
515
|
*/
|
|
510
516
|
getChildByName(name) {
|
|
511
517
|
return this.getChildByProp("name", name);
|
|
@@ -519,23 +525,21 @@ class Container extends Renderable {
|
|
|
519
525
|
* @memberOf me.Container.prototype
|
|
520
526
|
* @public
|
|
521
527
|
* @function
|
|
522
|
-
* @param {
|
|
523
|
-
* @
|
|
528
|
+
* @param {string|RegExp|number|boolean} guid child GUID
|
|
529
|
+
* @returns {me.Renderable} corresponding child or null
|
|
524
530
|
*/
|
|
525
531
|
getChildByGUID(guid) {
|
|
526
532
|
var obj = this.getChildByProp("GUID", guid);
|
|
527
533
|
return (obj.length > 0) ? obj[0] : null;
|
|
528
534
|
}
|
|
529
535
|
|
|
530
|
-
|
|
531
536
|
/**
|
|
532
537
|
* return all child in this container
|
|
533
|
-
|
|
534
538
|
* @name getChildren
|
|
535
539
|
* @memberOf me.Container.prototype
|
|
536
540
|
* @public
|
|
537
541
|
* @function
|
|
538
|
-
* @
|
|
542
|
+
* @returns {me.Renderable[]} an array of renderable object
|
|
539
543
|
*/
|
|
540
544
|
getChildren() {
|
|
541
545
|
if (typeof this.children === "undefined") {
|
|
@@ -550,7 +554,7 @@ class Container extends Renderable {
|
|
|
550
554
|
* @name updateBounds
|
|
551
555
|
* @memberOf me.Renderable.prototype
|
|
552
556
|
* @function
|
|
553
|
-
* @
|
|
557
|
+
* @returns {me.Bounds} this shape bounding box Rectangle object
|
|
554
558
|
*/
|
|
555
559
|
updateBounds(forceUpdateChildBounds = false) {
|
|
556
560
|
|
|
@@ -579,7 +583,7 @@ class Container extends Renderable {
|
|
|
579
583
|
* @name isAttachedToRoot
|
|
580
584
|
* @memberOf me.Container.prototype
|
|
581
585
|
* @function
|
|
582
|
-
* @returns
|
|
586
|
+
* @returns {boolean}
|
|
583
587
|
*/
|
|
584
588
|
isAttachedToRoot() {
|
|
585
589
|
if (this.root === true) {
|
|
@@ -598,7 +602,7 @@ class Container extends Renderable {
|
|
|
598
602
|
|
|
599
603
|
/**
|
|
600
604
|
* update the cointainer's bounding rect (private)
|
|
601
|
-
* @
|
|
605
|
+
* @ignore
|
|
602
606
|
* @name updateBoundsPos
|
|
603
607
|
* @memberOf me.Container.prototype
|
|
604
608
|
* @function
|
|
@@ -639,7 +643,7 @@ class Container extends Renderable {
|
|
|
639
643
|
* @public
|
|
640
644
|
* @function
|
|
641
645
|
* @param {me.Renderable} child
|
|
642
|
-
* @param {
|
|
646
|
+
* @param {boolean} [keepalive=False] True to prevent calling child.destroy()
|
|
643
647
|
*/
|
|
644
648
|
removeChild(child, keepalive) {
|
|
645
649
|
if (this.hasChild(child)) {
|
|
@@ -658,7 +662,7 @@ class Container extends Renderable {
|
|
|
658
662
|
* @memberOf me.Container.prototype
|
|
659
663
|
* @function
|
|
660
664
|
* @param {me.Renderable} child
|
|
661
|
-
* @param {
|
|
665
|
+
* @param {boolean} [keepalive=False] True to prevent calling child.destroy()
|
|
662
666
|
*/
|
|
663
667
|
removeChildNow(child, keepalive) {
|
|
664
668
|
if (this.hasChild(child) && (this.getChildIndex(child) >= 0)) {
|
|
@@ -710,16 +714,16 @@ class Container extends Renderable {
|
|
|
710
714
|
* @name setChildsProperty
|
|
711
715
|
* @memberOf me.Container.prototype
|
|
712
716
|
* @function
|
|
713
|
-
* @param {
|
|
714
|
-
* @param {
|
|
715
|
-
* @param {
|
|
717
|
+
* @param {string} prop property name
|
|
718
|
+
* @param {object} value property value
|
|
719
|
+
* @param {boolean} [recursive=false] recursively apply the value to child containers if true
|
|
716
720
|
*/
|
|
717
|
-
setChildsProperty(prop,
|
|
721
|
+
setChildsProperty(prop, value, recursive) {
|
|
718
722
|
this.forEach((child) => {
|
|
719
723
|
if ((recursive === true) && (child instanceof Container)) {
|
|
720
|
-
child.setChildsProperty(prop,
|
|
724
|
+
child.setChildsProperty(prop, value, recursive);
|
|
721
725
|
}
|
|
722
|
-
child[prop] =
|
|
726
|
+
child[prop] = value;
|
|
723
727
|
});
|
|
724
728
|
}
|
|
725
729
|
|
|
@@ -795,7 +799,7 @@ class Container extends Renderable {
|
|
|
795
799
|
* @memberOf me.Container.prototype
|
|
796
800
|
* @public
|
|
797
801
|
* @function
|
|
798
|
-
* @param {
|
|
802
|
+
* @param {boolean} [recursive=false] recursively sort all containers if true
|
|
799
803
|
*/
|
|
800
804
|
sort(recursive) {
|
|
801
805
|
// do nothing if there is already a pending sort
|
|
@@ -884,7 +888,14 @@ class Container extends Renderable {
|
|
|
884
888
|
}
|
|
885
889
|
|
|
886
890
|
/**
|
|
887
|
-
*
|
|
891
|
+
* container update function. <br>
|
|
892
|
+
* automatically called by the game manager {@link me.game}
|
|
893
|
+
* @name update
|
|
894
|
+
* @memberOf me.Container.prototype
|
|
895
|
+
* @function
|
|
896
|
+
* @protected
|
|
897
|
+
* @param {number} dt time since the last update in milliseconds.
|
|
898
|
+
* @returns {boolean} true if the Container is dirty
|
|
888
899
|
*/
|
|
889
900
|
update(dt) {
|
|
890
901
|
var isFloating = false;
|
|
@@ -930,7 +941,14 @@ class Container extends Renderable {
|
|
|
930
941
|
}
|
|
931
942
|
|
|
932
943
|
/**
|
|
933
|
-
*
|
|
944
|
+
* draw the container. <br>
|
|
945
|
+
* automatically called by the game manager {@link me.game}
|
|
946
|
+
* @name draw
|
|
947
|
+
* @memberOf me.Container.prototype
|
|
948
|
+
* @function
|
|
949
|
+
* @protected
|
|
950
|
+
* @param {me.CanvasRenderer|me.WebGLRenderer} renderer a renderer object
|
|
951
|
+
* @param {me.Rect|me.Bounds} [rect] the area or viewport to (re)draw
|
|
934
952
|
*/
|
|
935
953
|
draw(renderer, rect) {
|
|
936
954
|
var isFloating = false;
|
|
@@ -13,16 +13,16 @@ import * as stringUtil from "./../utils/string.js";
|
|
|
13
13
|
* @extends me.Renderable
|
|
14
14
|
* @memberOf me
|
|
15
15
|
* @constructor
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {HTMLImageElement|HTMLCanvasElement|
|
|
20
|
-
* @param {
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {
|
|
23
|
-
* @param {
|
|
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',
|
|
24
24
|
'repeat-x', 'repeat-y', 'no-repeat'). See {@link me.ImageLayer#repeat}
|
|
25
|
-
* @param {
|
|
25
|
+
* @param {number|me.Vector2d} [settings.anchorPoint=0.0] Image origin. See {@link me.ImageLayer#anchorPoint}
|
|
26
26
|
* @example
|
|
27
27
|
* // create a repetitive background pattern on the X axis using the citycloud image asset
|
|
28
28
|
* me.game.world.addChild(new me.ImageLayer(0, 0, {
|
|
@@ -54,7 +54,7 @@ class ImageLayer extends Sprite {
|
|
|
54
54
|
* - a number, to change the value for both axis <br>
|
|
55
55
|
* - 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
56
|
* @public
|
|
57
|
-
* @type me.Vector2d
|
|
57
|
+
* @type {me.Vector2d}
|
|
58
58
|
* @default <1.0,1.0>
|
|
59
59
|
* @name me.ImageLayer#ratio
|
|
60
60
|
*/
|
|
@@ -75,14 +75,14 @@ class ImageLayer extends Sprite {
|
|
|
75
75
|
* By default, its upper-left corner is anchored to the viewport bounds upper left corner.<br>
|
|
76
76
|
* The anchorPoint is a unit vector where each component falls in range [0.0,1.0].<br>
|
|
77
77
|
* Some common examples:<br>
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
78
|
+
* - <0.0,0.0> : (Default) Anchor image to the upper-left corner of viewport bounds
|
|
79
|
+
* - <0.5,0.5> : Center the image within viewport bounds
|
|
80
|
+
* - <1.0,1.0> : Anchor image to the lower-right corner of viewport bounds
|
|
81
81
|
* To specify a value through Tiled, use one of the following format : <br>
|
|
82
82
|
* - a number, to change the value for both axis <br>
|
|
83
83
|
* - 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
84
|
* @public
|
|
85
|
-
* @type me.Vector2d
|
|
85
|
+
* @type {me.Vector2d}
|
|
86
86
|
* @default <0.0,0.0>
|
|
87
87
|
* @name me.ImageLayer#anchorPoint
|
|
88
88
|
*/
|
|
@@ -107,26 +107,20 @@ class ImageLayer extends Sprite {
|
|
|
107
107
|
* Define if and how an Image Layer should be repeated.<br>
|
|
108
108
|
* By default, an Image Layer is repeated both vertically and horizontally.<br>
|
|
109
109
|
* Acceptable values : <br>
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
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>
|
|
114
114
|
* @public
|
|
115
|
-
* @type
|
|
115
|
+
* @type {string}
|
|
116
116
|
* @default 'repeat'
|
|
117
117
|
* @name me.ImageLayer#repeat
|
|
118
118
|
*/
|
|
119
119
|
|
|
120
|
-
/**
|
|
121
|
-
* @ignore
|
|
122
|
-
*/
|
|
123
120
|
get repeat() {
|
|
124
121
|
return this._repeat;
|
|
125
122
|
}
|
|
126
123
|
|
|
127
|
-
/**
|
|
128
|
-
* @ignore
|
|
129
|
-
*/
|
|
130
124
|
set repeat(value) {
|
|
131
125
|
this._repeat = value;
|
|
132
126
|
switch (this._repeat) {
|
|
@@ -174,9 +168,9 @@ class ImageLayer extends Sprite {
|
|
|
174
168
|
* @name resize
|
|
175
169
|
* @memberOf me.ImageLayer.prototype
|
|
176
170
|
* @function
|
|
177
|
-
* @param {
|
|
178
|
-
* @param {
|
|
179
|
-
|
|
171
|
+
* @param {number} w new width
|
|
172
|
+
* @param {number} h new height
|
|
173
|
+
*/
|
|
180
174
|
resize(w, h) {
|
|
181
175
|
super.resize(
|
|
182
176
|
this.repeatX ? Infinity : w,
|
|
@@ -243,7 +237,7 @@ class ImageLayer extends Sprite {
|
|
|
243
237
|
this.isDirty = true;
|
|
244
238
|
}
|
|
245
239
|
|
|
246
|
-
|
|
240
|
+
/**
|
|
247
241
|
* override the default predraw function
|
|
248
242
|
* as repeat and anchor are managed directly in the draw method
|
|
249
243
|
* @ignore
|
|
@@ -259,8 +253,13 @@ class ImageLayer extends Sprite {
|
|
|
259
253
|
}
|
|
260
254
|
|
|
261
255
|
/**
|
|
262
|
-
* draw the
|
|
263
|
-
* @
|
|
256
|
+
* draw the ImageLayer. <br>
|
|
257
|
+
* automatically called by the game manager {@link me.game}
|
|
258
|
+
* @name draw
|
|
259
|
+
* @memberOf me.ImageLayer.prototype
|
|
260
|
+
* @function
|
|
261
|
+
* @protected
|
|
262
|
+
* @param {me.CanvasRenderer|me.WebGLRenderer} renderer a renderer object
|
|
264
263
|
*/
|
|
265
264
|
draw(renderer) {
|
|
266
265
|
var width = this.width,
|