melonjs 10.2.3 → 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.
- package/dist/melonjs.js +1741 -1558
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +1256 -1758
- package/dist/melonjs.module.js +1734 -1582
- package/package.json +12 -12
- package/src/audio/audio.js +3 -3
- package/src/camera/camera2d.js +26 -27
- package/src/entity/draggable.js +10 -19
- package/src/entity/droptarget.js +12 -20
- package/src/entity/entity.js +13 -13
- package/src/game.js +6 -6
- package/src/{shapes → geometries}/ellipse.js +19 -20
- package/src/{shapes → geometries}/line.js +6 -7
- package/src/{shapes → geometries}/poly.js +70 -23
- package/src/{shapes → geometries}/rectangle.js +23 -24
- package/src/index.js +8 -9
- package/src/input/gamepad.js +7 -7
- package/src/input/input.js +2 -2
- package/src/input/keyboard.js +108 -108
- package/src/input/pointer.js +61 -28
- package/src/input/pointerevent.js +79 -16
- package/src/lang/deprecated.js +26 -15
- package/src/level/level.js +10 -10
- package/src/level/tiled/TMXGroup.js +6 -7
- package/src/level/tiled/TMXLayer.js +10 -11
- package/src/level/tiled/TMXObject.js +57 -51
- package/src/level/tiled/TMXTile.js +2 -3
- package/src/level/tiled/TMXTileMap.js +3 -4
- package/src/level/tiled/TMXTileset.js +1 -2
- package/src/level/tiled/TMXTilesetGroup.js +1 -2
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXRenderer.js +1 -2
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +2 -3
- package/src/loader/loader.js +17 -15
- package/src/loader/loadingscreen.js +1 -2
- package/src/math/color.js +23 -24
- package/src/math/math.js +16 -16
- package/src/math/matrix2.js +24 -25
- package/src/math/matrix3.js +26 -27
- package/src/math/observable_vector2.js +46 -35
- package/src/math/observable_vector3.js +54 -36
- package/src/math/vector2.js +58 -47
- package/src/math/vector3.js +66 -48
- package/src/particles/emitter.js +64 -72
- package/src/particles/particle.js +3 -4
- package/src/particles/particlecontainer.js +2 -3
- package/src/physics/body.js +38 -39
- package/src/physics/bounds.js +30 -32
- package/src/physics/collision.js +6 -6
- package/src/physics/detector.js +3 -3
- package/src/physics/quadtree.js +8 -9
- package/src/physics/sat.js +4 -4
- package/src/physics/world.js +11 -12
- package/src/plugin/plugin.js +6 -7
- package/src/renderable/GUI.js +7 -8
- package/src/renderable/collectable.js +3 -4
- package/src/renderable/colorlayer.js +7 -8
- package/src/renderable/container.js +36 -37
- package/src/renderable/imagelayer.js +4 -5
- package/src/renderable/nineslicesprite.js +2 -3
- package/src/renderable/renderable.js +45 -46
- package/src/renderable/sprite.js +16 -17
- package/src/renderable/trigger.js +4 -5
- package/src/state/stage.js +8 -9
- package/src/state/state.js +24 -24
- package/src/system/device.js +41 -97
- package/src/system/event.js +45 -33
- package/src/system/pooling.js +1 -1
- package/src/system/save.js +3 -3
- package/src/system/timer.js +13 -13
- package/src/text/bitmaptext.js +12 -13
- package/src/text/bitmaptextdata.js +5 -6
- package/src/text/text.js +16 -17
- package/src/tweens/easing.js +1 -1
- package/src/tweens/interpolation.js +1 -1
- package/src/tweens/tween.js +14 -15
- package/src/utils/agent.js +3 -3
- package/src/utils/array.js +4 -4
- package/src/utils/file.js +3 -3
- package/src/utils/function.js +3 -3
- package/src/utils/string.js +7 -7
- package/src/utils/utils.js +4 -4
- package/src/video/canvas/canvas_renderer.js +39 -40
- package/src/video/renderer.js +29 -30
- package/src/video/texture.js +8 -9
- package/src/video/texture_cache.js +2 -4
- package/src/video/video.js +7 -7
- package/src/video/webgl/buffer/vertex.js +2 -2
- package/src/video/webgl/glshader.js +11 -12
- package/src/video/webgl/webgl_compositor.js +118 -90
- package/src/video/webgl/webgl_renderer.js +95 -74
package/src/physics/quadtree.js
CHANGED
|
@@ -53,8 +53,7 @@ var QT_VECTOR = new Vector2d();
|
|
|
53
53
|
* a QuadTree implementation in JavaScript, a 2d spatial subdivision algorithm.
|
|
54
54
|
* @class
|
|
55
55
|
* @name QuadTree
|
|
56
|
-
* @
|
|
57
|
-
* @constructor
|
|
56
|
+
* @memberof me
|
|
58
57
|
* @see me.game.world.broadphase
|
|
59
58
|
* @param {me.Bounds} bounds bounds of the node
|
|
60
59
|
* @param {number} [max_objects=4] max objects a node can hold before splitting into 4 subnodes
|
|
@@ -167,7 +166,7 @@ class QuadTree {
|
|
|
167
166
|
/**
|
|
168
167
|
* Insert the given object container into the node.
|
|
169
168
|
* @name insertContainer
|
|
170
|
-
* @
|
|
169
|
+
* @memberof me.QuadTree
|
|
171
170
|
* @function
|
|
172
171
|
* @param {me.Container} container group of objects to be added
|
|
173
172
|
*/
|
|
@@ -196,7 +195,7 @@ class QuadTree {
|
|
|
196
195
|
* exceeds the capacity, it will split and add all
|
|
197
196
|
* objects to their corresponding subnodes.
|
|
198
197
|
* @name insert
|
|
199
|
-
* @
|
|
198
|
+
* @memberof me.QuadTree
|
|
200
199
|
* @function
|
|
201
200
|
* @param {object} item object to be added
|
|
202
201
|
*/
|
|
@@ -241,7 +240,7 @@ class QuadTree {
|
|
|
241
240
|
/**
|
|
242
241
|
* Return all objects that could collide with the given object
|
|
243
242
|
* @name retrieve
|
|
244
|
-
* @
|
|
243
|
+
* @memberof me.QuadTree
|
|
245
244
|
* @function
|
|
246
245
|
* @param {object} item object to be checked against
|
|
247
246
|
* @param {object} [fn] a sorting function for the returned array
|
|
@@ -277,7 +276,7 @@ class QuadTree {
|
|
|
277
276
|
* Remove the given item from the quadtree.
|
|
278
277
|
* (this function won't recalculate the impacted node)
|
|
279
278
|
* @name remove
|
|
280
|
-
* @
|
|
279
|
+
* @memberof me.QuadTree
|
|
281
280
|
* @function
|
|
282
281
|
* @param {object} item object to be removed
|
|
283
282
|
* @returns {boolean} true if the item was found and removed.
|
|
@@ -318,7 +317,7 @@ class QuadTree {
|
|
|
318
317
|
/**
|
|
319
318
|
* return true if the node is prunable
|
|
320
319
|
* @name isPrunable
|
|
321
|
-
* @
|
|
320
|
+
* @memberof me.QuadTree
|
|
322
321
|
* @function
|
|
323
322
|
* @returns {boolean} true if the node is prunable
|
|
324
323
|
*/
|
|
@@ -329,7 +328,7 @@ class QuadTree {
|
|
|
329
328
|
/**
|
|
330
329
|
* return true if the node has any children
|
|
331
330
|
* @name hasChildren
|
|
332
|
-
* @
|
|
331
|
+
* @memberof me.QuadTree
|
|
333
332
|
* @function
|
|
334
333
|
* @returns {boolean} true if the node has any children
|
|
335
334
|
*/
|
|
@@ -346,7 +345,7 @@ class QuadTree {
|
|
|
346
345
|
/**
|
|
347
346
|
* clear the quadtree
|
|
348
347
|
* @name clear
|
|
349
|
-
* @
|
|
348
|
+
* @memberof me.QuadTree
|
|
350
349
|
* @function
|
|
351
350
|
* @param {me.Bounds} [bounds=this.bounds] the bounds to be cleared
|
|
352
351
|
*/
|
package/src/physics/sat.js
CHANGED
|
@@ -58,7 +58,7 @@ function flattenPointsOn(points, normal, result) {
|
|
|
58
58
|
var len = points.length;
|
|
59
59
|
for (var i = 0; i < len; i++) {
|
|
60
60
|
// The magnitude of the projection of the point onto the normal
|
|
61
|
-
var dot = points[i].
|
|
61
|
+
var dot = points[i].dot(normal);
|
|
62
62
|
if (dot < min) { min = dot; }
|
|
63
63
|
if (dot > max) { max = dot; }
|
|
64
64
|
}
|
|
@@ -87,7 +87,7 @@ function isSeparatingAxis(aPos, bPos, aPoints, bPoints, axis, response) {
|
|
|
87
87
|
var rangeB = T_ARRAYS.pop();
|
|
88
88
|
// The magnitude of the offset between the two polygons
|
|
89
89
|
var offsetV = T_VECTORS.pop().copy(bPos).sub(aPos);
|
|
90
|
-
var projectedOffset = offsetV.
|
|
90
|
+
var projectedOffset = offsetV.dot(axis);
|
|
91
91
|
|
|
92
92
|
// Project the polygons onto the axis.
|
|
93
93
|
flattenPointsOn(aPoints, axis, rangeA);
|
|
@@ -169,7 +169,7 @@ function isSeparatingAxis(aPos, bPos, aPoints, bPoints, axis, response) {
|
|
|
169
169
|
*/
|
|
170
170
|
function vornoiRegion(line, point) {
|
|
171
171
|
var len2 = line.length2();
|
|
172
|
-
var dp = point.
|
|
172
|
+
var dp = point.dot(line);
|
|
173
173
|
if (dp < 0) {
|
|
174
174
|
// If the point is beyond the start of the line, it is in the
|
|
175
175
|
// left vornoi region.
|
|
@@ -400,7 +400,7 @@ export function testPolygonEllipse(a, polyA, b, ellipseB, response) {
|
|
|
400
400
|
normal.copy(polyA.normals[i]);
|
|
401
401
|
// Find the perpendicular distance between the center of the
|
|
402
402
|
// circle and the edge.
|
|
403
|
-
dist = point.
|
|
403
|
+
dist = point.dot(normal);
|
|
404
404
|
var distAbs = Math.abs(dist);
|
|
405
405
|
// If the circle is on the outside of the edge, there is no intersection.
|
|
406
406
|
if ((len === 1 || dist > 0) && distAbs > radius) {
|
package/src/physics/world.js
CHANGED
|
@@ -10,9 +10,8 @@ import state from "./../state/state.js";
|
|
|
10
10
|
* @classdesc
|
|
11
11
|
* an object representing the physic world, and responsible for managing and updating all childs and physics
|
|
12
12
|
* @class World
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
15
|
-
* @constructor
|
|
13
|
+
* @augments me.Container
|
|
14
|
+
* @memberof me
|
|
16
15
|
* @param {number} [x=0] position of the container (accessible via the inherited pos.x property)
|
|
17
16
|
* @param {number} [y=0] position of the container (accessible via the inherited pos.y property)
|
|
18
17
|
* @param {number} [w=me.game.viewport.width] width of the container
|
|
@@ -40,7 +39,7 @@ class World extends Container {
|
|
|
40
39
|
* @type {me.Vector2d}
|
|
41
40
|
* @default 60
|
|
42
41
|
* @name fps
|
|
43
|
-
* @
|
|
42
|
+
* @memberof me.World
|
|
44
43
|
* @see me.timer.maxfps
|
|
45
44
|
*/
|
|
46
45
|
this.fps = 60;
|
|
@@ -51,7 +50,7 @@ class World extends Container {
|
|
|
51
50
|
* @type {me.Vector2d}
|
|
52
51
|
* @default <0,0.98>
|
|
53
52
|
* @name gravity
|
|
54
|
-
* @
|
|
53
|
+
* @memberof me.World
|
|
55
54
|
*/
|
|
56
55
|
this.gravity = new Vector2d(0, 0.98);
|
|
57
56
|
|
|
@@ -65,14 +64,14 @@ class World extends Container {
|
|
|
65
64
|
* property to your layer (in Tiled).
|
|
66
65
|
* @type {boolean}
|
|
67
66
|
* @default false
|
|
68
|
-
* @
|
|
67
|
+
* @memberof me.World
|
|
69
68
|
*/
|
|
70
69
|
this.preRender = false;
|
|
71
70
|
|
|
72
71
|
/**
|
|
73
72
|
* the active physic bodies in this simulation
|
|
74
73
|
* @name bodies
|
|
75
|
-
* @
|
|
74
|
+
* @memberof me.World
|
|
76
75
|
* @public
|
|
77
76
|
* @type {Set}
|
|
78
77
|
*/
|
|
@@ -81,7 +80,7 @@ class World extends Container {
|
|
|
81
80
|
/**
|
|
82
81
|
* the instance of the game world quadtree used for broadphase
|
|
83
82
|
* @name broadphase
|
|
84
|
-
* @
|
|
83
|
+
* @memberof me.World
|
|
85
84
|
* @public
|
|
86
85
|
* @type {me.QuadTree}
|
|
87
86
|
*/
|
|
@@ -100,7 +99,7 @@ class World extends Container {
|
|
|
100
99
|
/**
|
|
101
100
|
* reset the game world
|
|
102
101
|
* @name reset
|
|
103
|
-
* @
|
|
102
|
+
* @memberof me.World
|
|
104
103
|
* @function
|
|
105
104
|
*/
|
|
106
105
|
reset() {
|
|
@@ -121,7 +120,7 @@ class World extends Container {
|
|
|
121
120
|
/**
|
|
122
121
|
* Add a physic body to the game world
|
|
123
122
|
* @name addBody
|
|
124
|
-
* @
|
|
123
|
+
* @memberof me.World
|
|
125
124
|
* @see me.Container.addChild
|
|
126
125
|
* @function
|
|
127
126
|
* @param {me.Body} body
|
|
@@ -136,7 +135,7 @@ class World extends Container {
|
|
|
136
135
|
/**
|
|
137
136
|
* Remove a physic body from the game world
|
|
138
137
|
* @name removeBody
|
|
139
|
-
* @
|
|
138
|
+
* @memberof me.World
|
|
140
139
|
* @see me.Container.removeChild
|
|
141
140
|
* @function
|
|
142
141
|
* @param {me.Body} body
|
|
@@ -151,7 +150,7 @@ class World extends Container {
|
|
|
151
150
|
/**
|
|
152
151
|
* update the game world
|
|
153
152
|
* @name reset
|
|
154
|
-
* @
|
|
153
|
+
* @memberof me.World
|
|
155
154
|
* @function
|
|
156
155
|
* @param {number} dt the time passed since the last frame update
|
|
157
156
|
* @returns {boolean} true if the word is dirty
|
package/src/plugin/plugin.js
CHANGED
|
@@ -5,7 +5,7 @@ import { version } from "./../index.js";
|
|
|
5
5
|
* This namespace is a container for all registered plugins.
|
|
6
6
|
* @see me.plugin.register
|
|
7
7
|
* @namespace me.plugins
|
|
8
|
-
* @
|
|
8
|
+
* @memberof me
|
|
9
9
|
*/
|
|
10
10
|
export var plugins = {};
|
|
11
11
|
|
|
@@ -27,7 +27,7 @@ class BasePlugin {
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @namespace plugin
|
|
30
|
-
* @
|
|
30
|
+
* @memberof me
|
|
31
31
|
*/
|
|
32
32
|
export var plugin = {
|
|
33
33
|
|
|
@@ -36,17 +36,16 @@ export var plugin = {
|
|
|
36
36
|
* plugin must be installed using the register function
|
|
37
37
|
* @see me.plugin
|
|
38
38
|
* @class
|
|
39
|
-
* @
|
|
39
|
+
* @augments me.Object
|
|
40
40
|
* @name plugin.Base
|
|
41
|
-
* @
|
|
42
|
-
* @constructor
|
|
41
|
+
* @memberof me
|
|
43
42
|
*/
|
|
44
43
|
Base : BasePlugin,
|
|
45
44
|
|
|
46
45
|
/**
|
|
47
46
|
* patch a melonJS function
|
|
48
47
|
* @name patch
|
|
49
|
-
* @
|
|
48
|
+
* @memberof me.plugin
|
|
50
49
|
* @public
|
|
51
50
|
* @function
|
|
52
51
|
* @param {object} proto target object
|
|
@@ -91,7 +90,7 @@ export var plugin = {
|
|
|
91
90
|
/**
|
|
92
91
|
* Register a plugin.
|
|
93
92
|
* @name register
|
|
94
|
-
* @
|
|
93
|
+
* @memberof me.plugin
|
|
95
94
|
* @see me.plugin.Base
|
|
96
95
|
* @public
|
|
97
96
|
* @function
|
package/src/renderable/GUI.js
CHANGED
|
@@ -10,9 +10,8 @@ import { registerPointerEvent, releasePointerEvent} from "./../input/input.js";
|
|
|
10
10
|
* The object simply register on the "pointerdown" <br>
|
|
11
11
|
* or "touchstart" event and call the onClick function"
|
|
12
12
|
* @class GUI_Object
|
|
13
|
-
* @
|
|
14
|
-
* @
|
|
15
|
-
* @constructor
|
|
13
|
+
* @augments me.Sprite
|
|
14
|
+
* @memberof me
|
|
16
15
|
* @param {number} x the x coordinate of the GUI Object
|
|
17
16
|
* @param {number} y the y coordinate of the GUI Object
|
|
18
17
|
* @param {object} settings See {@link me.Sprite}
|
|
@@ -122,7 +121,7 @@ class GUI_Object extends Sprite {
|
|
|
122
121
|
/**
|
|
123
122
|
* function called when the object is pressed (to be extended)
|
|
124
123
|
* @name onClick
|
|
125
|
-
* @
|
|
124
|
+
* @memberof me.GUI_Object.prototype
|
|
126
125
|
* @public
|
|
127
126
|
* @function
|
|
128
127
|
* @param {me.Pointer} event the event object
|
|
@@ -145,7 +144,7 @@ class GUI_Object extends Sprite {
|
|
|
145
144
|
/**
|
|
146
145
|
* function called when the pointer is over the object
|
|
147
146
|
* @name onOver
|
|
148
|
-
* @
|
|
147
|
+
* @memberof me.GUI_Object.prototype
|
|
149
148
|
* @public
|
|
150
149
|
* @function
|
|
151
150
|
* @param {me.Pointer} event the event object
|
|
@@ -166,7 +165,7 @@ class GUI_Object extends Sprite {
|
|
|
166
165
|
/**
|
|
167
166
|
* function called when the pointer is leaving the object area
|
|
168
167
|
* @name onOut
|
|
169
|
-
* @
|
|
168
|
+
* @memberof me.GUI_Object.prototype
|
|
170
169
|
* @public
|
|
171
170
|
* @function
|
|
172
171
|
* @param {me.Pointer} event the event object
|
|
@@ -191,7 +190,7 @@ class GUI_Object extends Sprite {
|
|
|
191
190
|
/**
|
|
192
191
|
* function called when the object is pressed and released (to be extended)
|
|
193
192
|
* @name onRelease
|
|
194
|
-
* @
|
|
193
|
+
* @memberof me.GUI_Object.prototype
|
|
195
194
|
* @public
|
|
196
195
|
* @function
|
|
197
196
|
* @returns {boolean} return false if we need to stop propagating the event
|
|
@@ -216,7 +215,7 @@ class GUI_Object extends Sprite {
|
|
|
216
215
|
* function called when the object is pressed and held<br>
|
|
217
216
|
* to be extended <br>
|
|
218
217
|
* @name onHold
|
|
219
|
-
* @
|
|
218
|
+
* @memberof me.GUI_Object.prototype
|
|
220
219
|
* @public
|
|
221
220
|
* @function
|
|
222
221
|
*/
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import Sprite from "./sprite.js";
|
|
2
2
|
import Body from "./../physics/body.js";
|
|
3
|
-
import Rect from "./../
|
|
3
|
+
import Rect from "./../geometries/rectangle.js";
|
|
4
4
|
import collision from "./../physics/collision.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @classdesc
|
|
8
8
|
* a basic collectable helper class for immovable object (e.g. a coin)
|
|
9
9
|
* @class Collectable
|
|
10
|
-
* @
|
|
11
|
-
* @
|
|
12
|
-
* @constructor
|
|
10
|
+
* @augments me.Sprite
|
|
11
|
+
* @memberof me
|
|
13
12
|
* @param {number} x the x coordinates of the collectable
|
|
14
13
|
* @param {number} y the y coordinates of the collectable
|
|
15
14
|
* @param {object} settings See {@link me.Sprite}
|
|
@@ -7,9 +7,8 @@ import Renderable from "./renderable.js";
|
|
|
7
7
|
* @classdesc
|
|
8
8
|
* a generic Color Layer Object. Fills the entire Canvas with the color not just the container the object belongs to.
|
|
9
9
|
* @class ColorLayer
|
|
10
|
-
* @
|
|
11
|
-
* @
|
|
12
|
-
* @constructor
|
|
10
|
+
* @augments me.Renderable
|
|
11
|
+
* @memberof me
|
|
13
12
|
* @param {string} name Layer name
|
|
14
13
|
* @param {me.Color|string} color CSS color
|
|
15
14
|
* @param {number} [z = 0] z-index position
|
|
@@ -28,7 +27,7 @@ class ColorLayer extends Renderable {
|
|
|
28
27
|
* @public
|
|
29
28
|
* @type {me.Color}
|
|
30
29
|
* @name color
|
|
31
|
-
* @
|
|
30
|
+
* @memberof me.ColorLayer#
|
|
32
31
|
*/
|
|
33
32
|
this.color = pool.pull("Color").parseCSS(color);
|
|
34
33
|
|
|
@@ -50,14 +49,14 @@ class ColorLayer extends Renderable {
|
|
|
50
49
|
* @ignore
|
|
51
50
|
*/
|
|
52
51
|
draw(renderer, rect) {
|
|
53
|
-
var color = renderer.getColor();
|
|
54
52
|
var vpos = viewport.pos;
|
|
55
|
-
renderer.
|
|
56
|
-
renderer.
|
|
53
|
+
renderer.save();
|
|
54
|
+
renderer.clipRect(
|
|
57
55
|
rect.left - vpos.x, rect.top - vpos.y,
|
|
58
56
|
rect.width, rect.height
|
|
59
57
|
);
|
|
60
|
-
renderer.
|
|
58
|
+
renderer.clearColor(this.color);
|
|
59
|
+
renderer.restore();
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
/**
|
|
@@ -20,9 +20,8 @@ var globalFloatingCounter = 0;
|
|
|
20
20
|
* @classdesc
|
|
21
21
|
* me.Container represents a collection of child objects
|
|
22
22
|
* @class Container
|
|
23
|
-
* @
|
|
24
|
-
* @
|
|
25
|
-
* @constructor
|
|
23
|
+
* @augments me.Renderable
|
|
24
|
+
* @memberof me
|
|
26
25
|
* @param {number} [x=0] position of the container (accessible via the inherited pos.x property)
|
|
27
26
|
* @param {number} [y=0] position of the container (accessible via the inherited pos.y property)
|
|
28
27
|
* @param {number} [w=me.game.viewport.width] width of the container
|
|
@@ -51,7 +50,7 @@ class Container extends Renderable {
|
|
|
51
50
|
* @type {boolean}
|
|
52
51
|
* @default false
|
|
53
52
|
* @name root
|
|
54
|
-
* @
|
|
53
|
+
* @memberof me.Container
|
|
55
54
|
*/
|
|
56
55
|
this.root = root;
|
|
57
56
|
|
|
@@ -68,7 +67,7 @@ class Container extends Renderable {
|
|
|
68
67
|
* @type {string}
|
|
69
68
|
* @default me.game.sortOn
|
|
70
69
|
* @name sortOn
|
|
71
|
-
* @
|
|
70
|
+
* @memberof me.Container
|
|
72
71
|
*/
|
|
73
72
|
this.sortOn = game.sortOn;
|
|
74
73
|
|
|
@@ -78,7 +77,7 @@ class Container extends Renderable {
|
|
|
78
77
|
* @type {boolean}
|
|
79
78
|
* @default true
|
|
80
79
|
* @name autoSort
|
|
81
|
-
* @
|
|
80
|
+
* @memberof me.Container
|
|
82
81
|
*/
|
|
83
82
|
this.autoSort = true;
|
|
84
83
|
|
|
@@ -88,7 +87,7 @@ class Container extends Renderable {
|
|
|
88
87
|
* @type {boolean}
|
|
89
88
|
* @default true
|
|
90
89
|
* @name autoDepth
|
|
91
|
-
* @
|
|
90
|
+
* @memberof me.Container
|
|
92
91
|
*/
|
|
93
92
|
this.autoDepth = true;
|
|
94
93
|
|
|
@@ -98,14 +97,14 @@ class Container extends Renderable {
|
|
|
98
97
|
* @type {boolean}
|
|
99
98
|
* @default false
|
|
100
99
|
* @name clipping
|
|
101
|
-
* @
|
|
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
|
-
* @
|
|
107
|
+
* @memberof me.Container#
|
|
109
108
|
* @function
|
|
110
109
|
* @param {number} index added or removed child index
|
|
111
110
|
*/
|
|
@@ -121,7 +120,7 @@ class Container extends Renderable {
|
|
|
121
120
|
* @type {boolean}
|
|
122
121
|
* @default false
|
|
123
122
|
* @name enableChildBoundsUpdate
|
|
124
|
-
* @
|
|
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
|
-
* @
|
|
151
|
+
* @memberof me.Container
|
|
153
152
|
* @function
|
|
154
153
|
*/
|
|
155
154
|
reset() {
|
|
@@ -183,7 +182,7 @@ 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
|
-
* @
|
|
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
|
|
@@ -247,7 +246,7 @@ 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
|
-
* @
|
|
249
|
+
* @memberof me.Container.prototype
|
|
251
250
|
* @function
|
|
252
251
|
* @param {me.Renderable} child
|
|
253
252
|
* @param {number} index
|
|
@@ -306,7 +305,7 @@ 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
|
-
* @
|
|
308
|
+
* @memberof me.Container.prototype
|
|
310
309
|
* @function
|
|
311
310
|
* @param {Function} callback fnction to execute on each element
|
|
312
311
|
* @param {object} [thisArg] value to use as this(i.e reference Object) when executing callback.
|
|
@@ -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
|
-
* @
|
|
345
|
+
* @memberof me.Container.prototype
|
|
347
346
|
* @function
|
|
348
347
|
* @param {me.Renderable} child
|
|
349
348
|
* @param {me.Renderable} child2
|
|
@@ -369,7 +368,7 @@ class Container extends Renderable {
|
|
|
369
368
|
/**
|
|
370
369
|
* Returns the Child at the specified index
|
|
371
370
|
* @name getChildAt
|
|
372
|
-
* @
|
|
371
|
+
* @memberof me.Container.prototype
|
|
373
372
|
* @function
|
|
374
373
|
* @param {number} index
|
|
375
374
|
* @returns {me.Renderable} the child at the specified index
|
|
@@ -386,7 +385,7 @@ class Container extends Renderable {
|
|
|
386
385
|
/**
|
|
387
386
|
* Returns the index of the given Child
|
|
388
387
|
* @name getChildIndex
|
|
389
|
-
* @
|
|
388
|
+
* @memberof me.Container.prototype
|
|
390
389
|
* @function
|
|
391
390
|
* @param {me.Renderable} child
|
|
392
391
|
* @returns {number} index
|
|
@@ -398,7 +397,7 @@ class Container extends Renderable {
|
|
|
398
397
|
/**
|
|
399
398
|
* Returns the next child within the container or undefined if none
|
|
400
399
|
* @name getNextChild
|
|
401
|
-
* @
|
|
400
|
+
* @memberof me.Container
|
|
402
401
|
* @function
|
|
403
402
|
* @param {me.Renderable} child
|
|
404
403
|
* @returns {me.Renderable} child
|
|
@@ -414,7 +413,7 @@ class Container extends Renderable {
|
|
|
414
413
|
/**
|
|
415
414
|
* Returns true if contains the specified Child
|
|
416
415
|
* @name hasChild
|
|
417
|
-
* @
|
|
416
|
+
* @memberof me.Container.prototype
|
|
418
417
|
* @function
|
|
419
418
|
* @param {me.Renderable} child
|
|
420
419
|
* @returns {boolean}
|
|
@@ -428,7 +427,7 @@ class Container extends Renderable {
|
|
|
428
427
|
* note : avoid calling this function every frame since
|
|
429
428
|
* it parses the whole object tree each time
|
|
430
429
|
* @name getChildByProp
|
|
431
|
-
* @
|
|
430
|
+
* @memberof me.Container.prototype
|
|
432
431
|
* @public
|
|
433
432
|
* @function
|
|
434
433
|
* @param {string} prop Property name
|
|
@@ -480,7 +479,7 @@ class Container extends Renderable {
|
|
|
480
479
|
/**
|
|
481
480
|
* returns the list of childs with the specified class type
|
|
482
481
|
* @name getChildByType
|
|
483
|
-
* @
|
|
482
|
+
* @memberof me.Container.prototype
|
|
484
483
|
* @public
|
|
485
484
|
* @function
|
|
486
485
|
* @param {object} classType
|
|
@@ -507,7 +506,7 @@ class Container extends Renderable {
|
|
|
507
506
|
* note : avoid calling this function every frame since
|
|
508
507
|
* it parses the whole object list each time
|
|
509
508
|
* @name getChildByName
|
|
510
|
-
* @
|
|
509
|
+
* @memberof me.Container.prototype
|
|
511
510
|
* @public
|
|
512
511
|
* @function
|
|
513
512
|
* @param {string|RegExp|number|boolean} name child name
|
|
@@ -522,7 +521,7 @@ class Container extends Renderable {
|
|
|
522
521
|
* note : avoid calling this function every frame since
|
|
523
522
|
* it parses the whole object list each time
|
|
524
523
|
* @name getChildByGUID
|
|
525
|
-
* @
|
|
524
|
+
* @memberof me.Container.prototype
|
|
526
525
|
* @public
|
|
527
526
|
* @function
|
|
528
527
|
* @param {string|RegExp|number|boolean} guid child GUID
|
|
@@ -536,7 +535,7 @@ class Container extends Renderable {
|
|
|
536
535
|
/**
|
|
537
536
|
* return all child in this container
|
|
538
537
|
* @name getChildren
|
|
539
|
-
* @
|
|
538
|
+
* @memberof me.Container.prototype
|
|
540
539
|
* @public
|
|
541
540
|
* @function
|
|
542
541
|
* @returns {me.Renderable[]} an array of renderable object
|
|
@@ -552,7 +551,7 @@ class Container extends Renderable {
|
|
|
552
551
|
* update the bounding box for this shape.
|
|
553
552
|
* @ignore
|
|
554
553
|
* @name updateBounds
|
|
555
|
-
* @
|
|
554
|
+
* @memberof me.Renderable.prototype
|
|
556
555
|
* @function
|
|
557
556
|
* @returns {me.Bounds} this shape bounding box Rectangle object
|
|
558
557
|
*/
|
|
@@ -581,7 +580,7 @@ class Container extends Renderable {
|
|
|
581
580
|
* Checks if this container is root or if it's attached to the root container.
|
|
582
581
|
* @private
|
|
583
582
|
* @name isAttachedToRoot
|
|
584
|
-
* @
|
|
583
|
+
* @memberof me.Container.prototype
|
|
585
584
|
* @function
|
|
586
585
|
* @returns {boolean}
|
|
587
586
|
*/
|
|
@@ -604,7 +603,7 @@ class Container extends Renderable {
|
|
|
604
603
|
* update the cointainer's bounding rect (private)
|
|
605
604
|
* @ignore
|
|
606
605
|
* @name updateBoundsPos
|
|
607
|
-
* @
|
|
606
|
+
* @memberof me.Container.prototype
|
|
608
607
|
* @function
|
|
609
608
|
*/
|
|
610
609
|
updateBoundsPos(newX, newY) {
|
|
@@ -639,7 +638,7 @@ class Container extends Renderable {
|
|
|
639
638
|
/**
|
|
640
639
|
* Invokes the removeChildNow in a defer, to ensure the child is removed safely after the update & draw stack has completed
|
|
641
640
|
* @name removeChild
|
|
642
|
-
* @
|
|
641
|
+
* @memberof me.Container.prototype
|
|
643
642
|
* @public
|
|
644
643
|
* @function
|
|
645
644
|
* @param {me.Renderable} child
|
|
@@ -659,7 +658,7 @@ class Container extends Renderable {
|
|
|
659
658
|
* (removal is immediate and unconditional)<br>
|
|
660
659
|
* Never use keepalive=true with objects from {@link me.pool}. Doing so will create a memory leak.
|
|
661
660
|
* @name removeChildNow
|
|
662
|
-
* @
|
|
661
|
+
* @memberof me.Container.prototype
|
|
663
662
|
* @function
|
|
664
663
|
* @param {me.Renderable} child
|
|
665
664
|
* @param {boolean} [keepalive=False] True to prevent calling child.destroy()
|
|
@@ -712,7 +711,7 @@ class Container extends Renderable {
|
|
|
712
711
|
/**
|
|
713
712
|
* Automatically set the specified property of all childs to the given value
|
|
714
713
|
* @name setChildsProperty
|
|
715
|
-
* @
|
|
714
|
+
* @memberof me.Container.prototype
|
|
716
715
|
* @function
|
|
717
716
|
* @param {string} prop property name
|
|
718
717
|
* @param {object} value property value
|
|
@@ -730,7 +729,7 @@ class Container extends Renderable {
|
|
|
730
729
|
/**
|
|
731
730
|
* Move the child in the group one step forward (z depth).
|
|
732
731
|
* @name moveUp
|
|
733
|
-
* @
|
|
732
|
+
* @memberof me.Container.prototype
|
|
734
733
|
* @function
|
|
735
734
|
* @param {me.Renderable} child
|
|
736
735
|
*/
|
|
@@ -745,7 +744,7 @@ class Container extends Renderable {
|
|
|
745
744
|
/**
|
|
746
745
|
* Move the child in the group one step backward (z depth).
|
|
747
746
|
* @name moveDown
|
|
748
|
-
* @
|
|
747
|
+
* @memberof me.Container.prototype
|
|
749
748
|
* @function
|
|
750
749
|
* @param {me.Renderable} child
|
|
751
750
|
*/
|
|
@@ -760,7 +759,7 @@ class Container extends Renderable {
|
|
|
760
759
|
/**
|
|
761
760
|
* Move the specified child to the top(z depth).
|
|
762
761
|
* @name moveToTop
|
|
763
|
-
* @
|
|
762
|
+
* @memberof me.Container.prototype
|
|
764
763
|
* @function
|
|
765
764
|
* @param {me.Renderable} child
|
|
766
765
|
*/
|
|
@@ -778,7 +777,7 @@ class Container extends Renderable {
|
|
|
778
777
|
/**
|
|
779
778
|
* Move the specified child the bottom (z depth).
|
|
780
779
|
* @name moveToBottom
|
|
781
|
-
* @
|
|
780
|
+
* @memberof me.Container.prototype
|
|
782
781
|
* @function
|
|
783
782
|
* @param {me.Renderable} child
|
|
784
783
|
*/
|
|
@@ -796,7 +795,7 @@ class Container extends Renderable {
|
|
|
796
795
|
/**
|
|
797
796
|
* Manually trigger the sort of all the childs in the container</p>
|
|
798
797
|
* @name sort
|
|
799
|
-
* @
|
|
798
|
+
* @memberof me.Container.prototype
|
|
800
799
|
* @public
|
|
801
800
|
* @function
|
|
802
801
|
* @param {boolean} [recursive=false] recursively sort all containers if true
|
|
@@ -891,7 +890,7 @@ class Container extends Renderable {
|
|
|
891
890
|
* container update function. <br>
|
|
892
891
|
* automatically called by the game manager {@link me.game}
|
|
893
892
|
* @name update
|
|
894
|
-
* @
|
|
893
|
+
* @memberof me.Container.prototype
|
|
895
894
|
* @function
|
|
896
895
|
* @protected
|
|
897
896
|
* @param {number} dt time since the last update in milliseconds.
|
|
@@ -944,7 +943,7 @@ class Container extends Renderable {
|
|
|
944
943
|
* draw the container. <br>
|
|
945
944
|
* automatically called by the game manager {@link me.game}
|
|
946
945
|
* @name draw
|
|
947
|
-
* @
|
|
946
|
+
* @memberof me.Container.prototype
|
|
948
947
|
* @function
|
|
949
948
|
* @protected
|
|
950
949
|
* @param {me.CanvasRenderer|me.WebGLRenderer} renderer a renderer object
|