melonjs 15.3.0 → 15.4.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.mjs/_virtual/_commonjsHelpers.js +1 -1
- package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
- package/dist/melonjs.mjs/_virtual/howler.js +1 -1
- package/dist/melonjs.mjs/_virtual/index.js +1 -1
- package/dist/melonjs.mjs/application/application.js +53 -5
- package/dist/melonjs.mjs/application/header.js +2 -2
- package/dist/melonjs.mjs/application/resize.js +4 -8
- package/dist/melonjs.mjs/application/settings.js +5 -5
- package/dist/melonjs.mjs/audio/audio.js +4 -6
- package/dist/melonjs.mjs/camera/camera2d.js +12 -14
- package/dist/melonjs.mjs/const.js +1 -1
- package/dist/melonjs.mjs/entity/entity.js +3 -4
- package/dist/melonjs.mjs/geometries/ellipse.js +26 -59
- package/dist/melonjs.mjs/geometries/line.js +18 -25
- package/dist/melonjs.mjs/geometries/path2d.js +16 -13
- package/dist/melonjs.mjs/geometries/point.js +8 -16
- package/dist/melonjs.mjs/geometries/poly.js +40 -97
- package/dist/melonjs.mjs/geometries/rectangle.js +37 -91
- package/dist/melonjs.mjs/geometries/roundrect.js +26 -35
- package/dist/melonjs.mjs/index.js +6 -6
- package/dist/melonjs.mjs/input/gamepad.js +1 -1
- package/dist/melonjs.mjs/input/input.js +1 -1
- package/dist/melonjs.mjs/input/keyboard.js +3 -3
- package/dist/melonjs.mjs/input/pointer.js +4 -4
- package/dist/melonjs.mjs/input/pointerevent.js +6 -7
- package/dist/melonjs.mjs/lang/console.js +1 -1
- package/dist/melonjs.mjs/lang/deprecated.js +2 -2
- package/dist/melonjs.mjs/level/level.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXLayer.js +16 -33
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +3 -4
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +4 -4
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +3 -3
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +4 -7
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +2 -2
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +26 -29
- package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +3 -3
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +1 -1
- package/dist/melonjs.mjs/loader/cache.js +1 -1
- package/dist/melonjs.mjs/loader/loader.js +1 -1
- package/dist/melonjs.mjs/loader/loadingscreen.js +1 -1
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
- package/dist/melonjs.mjs/loader/parser.js +4 -5
- package/dist/melonjs.mjs/loader/settings.js +1 -1
- package/dist/melonjs.mjs/math/color.js +2 -2
- package/dist/melonjs.mjs/math/math.js +1 -1
- package/dist/melonjs.mjs/math/matrix2.js +5 -59
- package/dist/melonjs.mjs/math/matrix3.js +82 -141
- package/dist/melonjs.mjs/math/observable_vector2.js +7 -7
- package/dist/melonjs.mjs/math/observable_vector3.js +5 -5
- package/dist/melonjs.mjs/math/vector2.js +7 -91
- package/dist/melonjs.mjs/math/vector3.js +6 -90
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/arraymultimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/multimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +1 -1
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
- package/dist/melonjs.mjs/particles/emitter.js +2 -2
- package/dist/melonjs.mjs/particles/particle.js +2 -2
- package/dist/melonjs.mjs/particles/settings.js +1 -1
- package/dist/melonjs.mjs/physics/body.js +22 -20
- package/dist/melonjs.mjs/physics/bounds.js +27 -33
- package/dist/melonjs.mjs/physics/collision.js +5 -5
- package/dist/melonjs.mjs/physics/detector.js +10 -10
- package/dist/melonjs.mjs/physics/quadtree.js +5 -5
- package/dist/melonjs.mjs/physics/response.js +1 -1
- package/dist/melonjs.mjs/physics/sat.js +3 -4
- package/dist/melonjs.mjs/physics/world.js +6 -9
- package/dist/melonjs.mjs/plugin/plugin.js +3 -3
- package/dist/melonjs.mjs/renderable/collectable.js +2 -2
- package/dist/melonjs.mjs/renderable/colorlayer.js +4 -4
- package/dist/melonjs.mjs/renderable/container.js +25 -25
- package/dist/melonjs.mjs/renderable/draggable.js +1 -1
- package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
- package/dist/melonjs.mjs/renderable/imagelayer.js +4 -4
- package/dist/melonjs.mjs/renderable/light2d.js +3 -3
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +2 -2
- package/dist/melonjs.mjs/renderable/renderable.js +26 -26
- package/dist/melonjs.mjs/renderable/sprite.js +3 -3
- package/dist/melonjs.mjs/renderable/text/bitmaptext.js +421 -0
- package/dist/melonjs.mjs/renderable/text/bitmaptextdata.js +195 -0
- package/dist/melonjs.mjs/renderable/text/glyph.js +65 -0
- package/dist/melonjs.mjs/renderable/text/text.js +422 -0
- package/dist/melonjs.mjs/renderable/text/textmetrics.js +175 -0
- package/dist/melonjs.mjs/renderable/text/textstyle.js +21 -0
- package/dist/melonjs.mjs/renderable/trigger.js +10 -10
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +7 -7
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +7 -7
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +3 -3
- package/dist/melonjs.mjs/state/stage.js +2 -2
- package/dist/melonjs.mjs/state/state.js +1 -38
- package/dist/melonjs.mjs/system/device.js +49 -10
- package/dist/melonjs.mjs/system/dom.js +1 -1
- package/dist/melonjs.mjs/system/event.js +24 -2
- package/dist/melonjs.mjs/system/platform.js +18 -18
- package/dist/melonjs.mjs/system/pooling.js +10 -10
- package/dist/melonjs.mjs/system/save.js +1 -1
- package/dist/melonjs.mjs/system/timer.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptext.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptextdata.js +3 -6
- package/dist/melonjs.mjs/text/glyph.js +1 -1
- package/dist/melonjs.mjs/text/text.js +1 -1
- package/dist/melonjs.mjs/text/textmetrics.js +1 -1
- package/dist/melonjs.mjs/text/textstyle.js +1 -1
- package/dist/melonjs.mjs/tweens/easing.js +1 -1
- package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
- package/dist/melonjs.mjs/tweens/tween.js +2 -2
- package/dist/melonjs.mjs/utils/agent.js +1 -1
- package/dist/melonjs.mjs/utils/array.js +1 -1
- package/dist/melonjs.mjs/utils/file.js +1 -1
- package/dist/melonjs.mjs/utils/function.js +2 -3
- package/dist/melonjs.mjs/utils/string.js +1 -1
- package/dist/melonjs.mjs/utils/utils.js +1 -1
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +3 -7
- package/dist/melonjs.mjs/video/renderer.js +16 -16
- package/dist/melonjs.mjs/video/texture/atlas.js +13 -13
- package/dist/melonjs.mjs/video/texture/cache.js +1 -1
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +15 -15
- package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
- package/dist/melonjs.mjs/video/video.js +4 -4
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +3 -3
- package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +13 -14
- package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +5 -5
- package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +2 -3
- package/dist/melonjs.mjs/video/webgl/glshader.js +2 -2
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +4 -4
- package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +50 -52
- package/dist/melonjs.module.js +1137 -1576
- package/dist/types/application/application.d.ts +28 -4
- package/dist/types/application/header.d.ts +2 -2
- package/dist/types/application/settings.d.ts +23 -23
- package/dist/types/audio/audio.d.ts +4 -6
- package/dist/types/camera/camera2d.d.ts +13 -16
- package/dist/types/entity/entity.d.ts +0 -1
- package/dist/types/geometries/ellipse.d.ts +18 -50
- package/dist/types/geometries/path2d.d.ts +1 -1
- package/dist/types/geometries/point.d.ts +5 -13
- package/dist/types/geometries/poly.d.ts +26 -75
- package/dist/types/geometries/rectangle.d.ts +12 -58
- package/dist/types/geometries/roundrect.d.ts +2 -11
- package/dist/types/index.d.ts +3 -3
- package/dist/types/input/gamepad.d.ts +31 -31
- package/dist/types/input/keyboard.d.ts +105 -105
- package/dist/types/input/pointer.d.ts +21 -21
- package/dist/types/input/pointerevent.d.ts +6 -6
- package/dist/types/level/tiled/TMXLayer.d.ts +1 -1
- package/dist/types/math/matrix2.d.ts +9 -63
- package/dist/types/math/matrix3.d.ts +9 -68
- package/dist/types/math/observable_vector2.d.ts +2 -2
- package/dist/types/math/observable_vector3.d.ts +2 -2
- package/dist/types/math/vector2.d.ts +8 -92
- package/dist/types/math/vector3.d.ts +8 -92
- package/dist/types/particles/settings.d.ts +29 -29
- package/dist/types/physics/body.d.ts +10 -8
- package/dist/types/physics/bounds.d.ts +24 -30
- package/dist/types/physics/collision.d.ts +12 -12
- package/dist/types/physics/detector.d.ts +1 -1
- package/dist/types/physics/world.d.ts +4 -7
- package/dist/types/renderable/container.d.ts +19 -19
- package/dist/types/renderable/imagelayer.d.ts +6 -6
- package/dist/types/renderable/light2d.d.ts +7 -7
- package/dist/types/renderable/renderable.d.ts +9 -16
- package/dist/types/renderable/text/bitmaptext.d.ts +151 -0
- package/dist/types/renderable/text/bitmaptextdata.d.ts +35 -0
- package/dist/types/renderable/text/glyph.d.ts +28 -0
- package/dist/types/renderable/text/text.d.ts +159 -0
- package/dist/types/renderable/text/textmetrics.d.ts +47 -0
- package/dist/types/renderable/text/textstyle.d.ts +5 -0
- package/dist/types/renderable/ui/uibaseelement.d.ts +0 -1
- package/dist/types/renderable/ui/uispriteelement.d.ts +0 -1
- package/dist/types/renderable/ui/uitextbutton.d.ts +2 -7
- package/dist/types/state/state.d.ts +11 -11
- package/dist/types/system/device.d.ts +15 -9
- package/dist/types/system/event.d.ts +20 -0
- package/dist/types/system/platform.d.ts +17 -17
- package/dist/types/utils/function.d.ts +1 -2
- package/dist/types/video/renderer.d.ts +13 -13
- package/dist/types/video/texture/canvas_texture.d.ts +14 -14
- package/dist/types/video/video.d.ts +2 -2
- package/dist/types/video/webgl/buffer/vertex.d.ts +2 -2
- package/dist/types/video/webgl/compositors/compositor.d.ts +24 -13
- package/dist/types/video/webgl/compositors/primitive_compositor.d.ts +0 -1
- package/dist/types/video/webgl/compositors/quad_compositor.d.ts +0 -1
- package/dist/types/video/webgl/utils/precision.d.ts +1 -1
- package/dist/types/video/webgl/webgl_renderer.d.ts +47 -50
- package/package.json +15 -15
- package/src/application/application.js +51 -3
- package/src/application/header.js +1 -1
- package/src/application/resize.js +3 -7
- package/src/application/settings.js +4 -4
- package/src/audio/audio.js +3 -5
- package/src/camera/camera2d.js +11 -13
- package/src/entity/entity.js +2 -3
- package/src/geometries/ellipse.js +25 -58
- package/src/geometries/line.js +17 -24
- package/src/geometries/path2d.js +15 -12
- package/src/geometries/point.js +7 -15
- package/src/geometries/poly.js +39 -96
- package/src/geometries/rectangle.js +36 -90
- package/src/geometries/roundrect.js +25 -34
- package/src/index.js +4 -4
- package/src/input/keyboard.js +2 -2
- package/src/input/pointer.js +3 -3
- package/src/input/pointerevent.js +5 -6
- package/src/lang/deprecated.js +1 -1
- package/src/level/tiled/TMXLayer.js +15 -32
- package/src/level/tiled/TMXObject.js +2 -3
- package/src/level/tiled/TMXTile.js +3 -3
- package/src/level/tiled/TMXTileMap.js +2 -2
- package/src/level/tiled/TMXTileset.js +3 -6
- package/src/level/tiled/TMXTilesetGroup.js +1 -1
- package/src/level/tiled/TMXUtils.js +25 -28
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -2
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
- package/src/loader/parser.js +3 -4
- package/src/math/color.js +1 -1
- package/src/math/matrix2.js +4 -58
- package/src/math/matrix3.js +81 -140
- package/src/math/observable_vector2.js +6 -6
- package/src/math/observable_vector3.js +4 -4
- package/src/math/vector2.js +6 -90
- package/src/math/vector3.js +5 -89
- package/src/particles/emitter.js +1 -1
- package/src/particles/particle.js +1 -1
- package/src/physics/body.js +21 -19
- package/src/physics/bounds.js +26 -32
- package/src/physics/collision.js +4 -4
- package/src/physics/detector.js +9 -9
- package/src/physics/quadtree.js +4 -4
- package/src/physics/sat.js +2 -3
- package/src/physics/world.js +5 -8
- package/src/polyfill/roundrect.js +163 -163
- package/src/renderable/collectable.js +1 -1
- package/src/renderable/colorlayer.js +3 -3
- package/src/renderable/container.js +24 -24
- package/src/renderable/imagelayer.js +3 -3
- package/src/renderable/light2d.js +2 -2
- package/src/renderable/nineslicesprite.js +1 -1
- package/src/renderable/renderable.js +25 -25
- package/src/renderable/sprite.js +2 -2
- package/src/{text → renderable/text}/bitmaptext.js +8 -8
- package/src/{text → renderable/text}/bitmaptextdata.js +4 -7
- package/src/{text → renderable/text}/glyph.js +1 -1
- package/src/{text → renderable/text}/text.js +16 -17
- package/src/{text → renderable/text}/textmetrics.js +2 -2
- package/src/renderable/trigger.js +9 -9
- package/src/renderable/ui/uibaseelement.js +6 -6
- package/src/renderable/ui/uispriteelement.js +6 -6
- package/src/renderable/ui/uitextbutton.js +2 -2
- package/src/state/stage.js +1 -1
- package/src/state/state.js +0 -49
- package/src/system/device.js +48 -9
- package/src/system/event.js +22 -0
- package/src/system/platform.js +18 -18
- package/src/system/pooling.js +9 -9
- package/src/tweens/tween.js +1 -1
- package/src/utils/function.js +1 -2
- package/src/video/canvas/canvas_renderer.js +2 -6
- package/src/video/renderer.js +15 -15
- package/src/video/texture/atlas.js +12 -12
- package/src/video/texture/canvas_texture.js +14 -14
- package/src/video/video.js +3 -3
- package/src/video/webgl/buffer/vertex.js +2 -2
- package/src/video/webgl/compositors/compositor.js +12 -13
- package/src/video/webgl/compositors/primitive_compositor.js +4 -4
- package/src/video/webgl/compositors/quad_compositor.js +1 -2
- package/src/video/webgl/glshader.js +1 -1
- package/src/video/webgl/utils/precision.js +3 -3
- package/src/video/webgl/webgl_renderer.js +49 -51
- /package/src/{text → renderable/text}/textstyle.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -69,7 +69,7 @@ class Detector {
|
|
|
69
69
|
* detect collision between two bodies.
|
|
70
70
|
* @param {Body} bodyA - a reference to body A.
|
|
71
71
|
* @param {Body} bodyB - a reference to body B.
|
|
72
|
-
* @returns {
|
|
72
|
+
* @returns {boolean} true if colliding
|
|
73
73
|
*/
|
|
74
74
|
collides(bodyA, bodyB, response = this.response) {
|
|
75
75
|
// for each shape in body A
|
|
@@ -78,13 +78,13 @@ class Detector {
|
|
|
78
78
|
for (let indexB = bodyB.shapes.length, shapeB; indexB--, (shapeB = bodyB.shapes[indexB]);) {
|
|
79
79
|
// full SAT collision check
|
|
80
80
|
if (sat["test" + shapeA.shapeType + shapeB.shapeType].call(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
this,
|
|
82
|
+
bodyA.ancestor, // a reference to the object A
|
|
83
|
+
shapeA,
|
|
84
|
+
bodyB.ancestor, // a reference to the object B
|
|
85
|
+
shapeB,
|
|
86
|
+
// clear response object before reusing
|
|
87
|
+
response.clear()) === true
|
|
88
88
|
) {
|
|
89
89
|
|
|
90
90
|
// set the shape index
|
|
@@ -197,7 +197,7 @@ class Detector {
|
|
|
197
197
|
shapeA,
|
|
198
198
|
objB, // a reference to the object B
|
|
199
199
|
shapeB
|
|
200
|
-
|
|
200
|
+
)) {
|
|
201
201
|
// we touched something !
|
|
202
202
|
result[collisionCounter] = objB;
|
|
203
203
|
collisionCounter++;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -58,7 +58,7 @@ let QT_VECTOR = new Vector2d();
|
|
|
58
58
|
* a QuadTree implementation in JavaScript, a 2d spatial subdivision algorithm.
|
|
59
59
|
* @see game.world.broadphase
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
class QuadTree {
|
|
62
62
|
/**
|
|
63
63
|
* @param {World} world - the physic world this QuadTree belongs to
|
|
64
64
|
* @param {Bounds} bounds - bounds of the node
|
|
@@ -90,7 +90,7 @@ let QT_VECTOR = new Vector2d();
|
|
|
90
90
|
left = this.bounds.left,
|
|
91
91
|
top = this.bounds.top;
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
//top right node
|
|
94
94
|
this.nodes[0] = QT_ARRAY_POP(
|
|
95
95
|
this.world,
|
|
96
96
|
{
|
|
@@ -286,7 +286,7 @@ let QT_VECTOR = new Vector2d();
|
|
|
286
286
|
if (index !== -1) {
|
|
287
287
|
returnObjects = returnObjects.concat(this.nodes[index].retrieve(item));
|
|
288
288
|
} else {
|
|
289
|
-
|
|
289
|
+
//if rect does not fit into a subnode, check it against all subnodes
|
|
290
290
|
for (let i = 0; i < this.nodes.length; i = i + 1) {
|
|
291
291
|
returnObjects = returnObjects.concat(this.nodes[i].retrieve(item));
|
|
292
292
|
}
|
|
@@ -308,7 +308,7 @@ let QT_VECTOR = new Vector2d();
|
|
|
308
308
|
* @param {object} item - object to be removed
|
|
309
309
|
* @returns {boolean} true if the item was found and removed.
|
|
310
310
|
*/
|
|
311
|
-
|
|
311
|
+
remove(item) {
|
|
312
312
|
let found = false;
|
|
313
313
|
|
|
314
314
|
if (typeof (item.getBounds) === "undefined") {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -213,10 +213,9 @@ function testPolygonPolygon(a, polyA, b, polyB, response) {
|
|
|
213
213
|
// aboslute shape position
|
|
214
214
|
let posA = T_VECTORS.pop().copy(a.pos).add(a.ancestor.getAbsolutePosition()).add(polyA.pos);
|
|
215
215
|
let posB = T_VECTORS.pop().copy(b.pos).add(b.ancestor.getAbsolutePosition()).add(polyB.pos);
|
|
216
|
-
let i;
|
|
217
216
|
|
|
218
217
|
// If any of the edge normals of A is a separating axis, no intersection.
|
|
219
|
-
for (i = 0; i < aLen; i++) {
|
|
218
|
+
for (let i = 0; i < aLen; i++) {
|
|
220
219
|
if (isSeparatingAxis(posA, posB, aPoints, bPoints, aNormals[i], response)) {
|
|
221
220
|
T_VECTORS.push(posA);
|
|
222
221
|
T_VECTORS.push(posB);
|
|
@@ -225,7 +224,7 @@ function testPolygonPolygon(a, polyA, b, polyB, response) {
|
|
|
225
224
|
}
|
|
226
225
|
|
|
227
226
|
// If any of the edge normals of B is a separating axis, no intersection.
|
|
228
|
-
for (i = 0; i < bLen; i++) {
|
|
227
|
+
for (let i = 0; i < bLen; i++) {
|
|
229
228
|
if (isSeparatingAxis(posA, posB, aPoints, bPoints, bNormals[i], response)) {
|
|
230
229
|
T_VECTORS.push(posA);
|
|
231
230
|
T_VECTORS.push(posB);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -18,7 +18,7 @@ import state from '../state/state.js';
|
|
|
18
18
|
* an object representing the physic world, and responsible for managing and updating all childs and physics
|
|
19
19
|
* @augments Container
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
class World extends Container {
|
|
22
22
|
/**
|
|
23
23
|
* @param {number} [x=0] - position of the container (accessible via the inherited pos.x property)
|
|
24
24
|
* @param {number} [y=0] - position of the container (accessible via the inherited pos.y property)
|
|
@@ -57,13 +57,10 @@ import state from '../state/state.js';
|
|
|
57
57
|
this.gravity = new Vector2d(0, 0.98);
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* (amount of layer, layer size, amount of tiles per layer, etc.)<br>
|
|
65
|
-
* note : rendering method is also configurable per layer by adding this
|
|
66
|
-
* property to your layer (in Tiled).
|
|
60
|
+
* Enabled pre-rendering for all tile layers. <br>
|
|
61
|
+
* If false layers are rendered dynamically, if true layers are first fully rendered into an offscreen canvas.<br>
|
|
62
|
+
* the "best" rendering method depends of your game (amount of layer, layer size, amount of tiles per layer, etc.)<br>
|
|
63
|
+
* Note : rendering method is also configurable per layer by adding a boolean "preRender" property to your layer in Tiled ({@link https://doc.mapeditor.org/en/stable/manual/custom-properties/#adding-properties}).
|
|
67
64
|
* @type {boolean}
|
|
68
65
|
* @default false
|
|
69
66
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -33,9 +33,9 @@ class BasePlugin {
|
|
|
33
33
|
* define the minimum required version of melonJS<br>
|
|
34
34
|
* this can be overridden by the plugin
|
|
35
35
|
* @type {string}
|
|
36
|
-
* @default "15.
|
|
36
|
+
* @default "15.4.0"
|
|
37
37
|
*/
|
|
38
|
-
this.version = "15.
|
|
38
|
+
this.version = "15.4.0";
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -15,7 +15,7 @@ import pool from '../system/pooling.js';
|
|
|
15
15
|
* a basic collectable helper class for immovable object (e.g. a coin)
|
|
16
16
|
* @augments Sprite
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
class Collectable extends Sprite {
|
|
19
19
|
/**
|
|
20
20
|
* @param {number} x - the x coordinates of the collectable
|
|
21
21
|
* @param {number} y - the y coordinates of the collectable
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -13,7 +13,7 @@ import Renderable from './renderable.js';
|
|
|
13
13
|
* a generic Color Layer Object. Fills the entire Canvas with the color not just the container the object belongs to.
|
|
14
14
|
* @augments Renderable
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
class ColorLayer extends Renderable {
|
|
17
17
|
/**
|
|
18
18
|
* @param {string} name - Layer name
|
|
19
19
|
* @param {Color|string} color - CSS color
|
|
@@ -30,9 +30,9 @@ import Renderable from './renderable.js';
|
|
|
30
30
|
* @name color
|
|
31
31
|
* @memberof ColorLayer#
|
|
32
32
|
*/
|
|
33
|
-
|
|
33
|
+
this.color = pool.pull("Color").parseCSS(color);
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
this.onResetEvent(name, color, z);
|
|
36
36
|
|
|
37
37
|
}
|
|
38
38
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -29,7 +29,7 @@ let globalFloatingCounter = 0;
|
|
|
29
29
|
* Container represents a collection of child objects
|
|
30
30
|
* @augments Renderable
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
class Container extends Renderable {
|
|
33
33
|
/**
|
|
34
34
|
* @param {number} [x=0] - position of the container (accessible via the inherited pos.x property)
|
|
35
35
|
* @param {number} [y=0] - position of the container (accessible via the inherited pos.y property)
|
|
@@ -184,7 +184,7 @@ let globalFloatingCounter = 0;
|
|
|
184
184
|
* will not be in any container. <br>
|
|
185
185
|
* if the given child implements a onActivateEvent method, that method will be called
|
|
186
186
|
* once the child is added to this container.
|
|
187
|
-
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
|
|
187
|
+
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be added
|
|
188
188
|
* @param {number} [z] - forces the z index of the child to the specified value
|
|
189
189
|
* @returns {Renderable} the added child
|
|
190
190
|
*/
|
|
@@ -217,7 +217,7 @@ let globalFloatingCounter = 0;
|
|
|
217
217
|
// set the child z value if required
|
|
218
218
|
if (typeof(child.pos) !== "undefined") {
|
|
219
219
|
if (typeof(z) === "number") {
|
|
220
|
-
|
|
220
|
+
child.pos.z = z;
|
|
221
221
|
} else if (this.autoDepth === true) {
|
|
222
222
|
child.pos.z = this.getChildren().length;
|
|
223
223
|
}
|
|
@@ -238,7 +238,7 @@ let globalFloatingCounter = 0;
|
|
|
238
238
|
|
|
239
239
|
// if a physic body(ies) to the game world
|
|
240
240
|
if (this.isAttachedToRoot()) {
|
|
241
|
-
|
|
241
|
+
let worldContainer = this.getRootAncestor();
|
|
242
242
|
if (child.body instanceof Body) {
|
|
243
243
|
worldContainer.addBody(child.body);
|
|
244
244
|
}
|
|
@@ -266,8 +266,8 @@ let globalFloatingCounter = 0;
|
|
|
266
266
|
/**
|
|
267
267
|
* Add a child to the container at the specified index<br>
|
|
268
268
|
* (the list won't be sorted after insertion)
|
|
269
|
-
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
|
|
270
|
-
* @param {number} index
|
|
269
|
+
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be added
|
|
270
|
+
* @param {number} index - The index at which to insert the child
|
|
271
271
|
* @returns {Renderable} the added child
|
|
272
272
|
*/
|
|
273
273
|
addChildAt(child, index) {
|
|
@@ -308,7 +308,7 @@ let globalFloatingCounter = 0;
|
|
|
308
308
|
|
|
309
309
|
// if a physic body(ies) to the game world
|
|
310
310
|
if (this.isAttachedToRoot()) {
|
|
311
|
-
|
|
311
|
+
let worldContainer = this.getRootAncestor();
|
|
312
312
|
if (child.body instanceof Body) {
|
|
313
313
|
worldContainer.addBody(child.body);
|
|
314
314
|
}
|
|
@@ -377,8 +377,8 @@ let globalFloatingCounter = 0;
|
|
|
377
377
|
|
|
378
378
|
/**
|
|
379
379
|
* Swaps the position (z-index) of 2 children
|
|
380
|
-
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
|
|
381
|
-
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child2
|
|
380
|
+
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be added
|
|
381
|
+
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child2 - Child to be added
|
|
382
382
|
*/
|
|
383
383
|
swapChildren(child, child2) {
|
|
384
384
|
let index = this.getChildIndex(child);
|
|
@@ -402,7 +402,7 @@ let globalFloatingCounter = 0;
|
|
|
402
402
|
|
|
403
403
|
/**
|
|
404
404
|
* Returns the Child at the specified index
|
|
405
|
-
* @param {number} index
|
|
405
|
+
* @param {number} index - The index of the child
|
|
406
406
|
* @returns {Renderable} the child at the specified index
|
|
407
407
|
*/
|
|
408
408
|
getChildAt(index) {
|
|
@@ -416,7 +416,7 @@ let globalFloatingCounter = 0;
|
|
|
416
416
|
|
|
417
417
|
/**
|
|
418
418
|
* Returns the index of the given Child
|
|
419
|
-
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
|
|
419
|
+
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - The child object
|
|
420
420
|
* @returns {number} index
|
|
421
421
|
*/
|
|
422
422
|
getChildIndex(child) {
|
|
@@ -425,7 +425,7 @@ let globalFloatingCounter = 0;
|
|
|
425
425
|
|
|
426
426
|
/**
|
|
427
427
|
* Returns the next child within the container or undefined if none
|
|
428
|
-
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
|
|
428
|
+
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - The child object
|
|
429
429
|
* @returns {Renderable} child
|
|
430
430
|
*/
|
|
431
431
|
getNextChild(child) {
|
|
@@ -438,7 +438,7 @@ let globalFloatingCounter = 0;
|
|
|
438
438
|
|
|
439
439
|
/**
|
|
440
440
|
* Returns true if contains the specified Child
|
|
441
|
-
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
|
|
441
|
+
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - The child object
|
|
442
442
|
* @returns {boolean}
|
|
443
443
|
*/
|
|
444
444
|
hasChild(child) {
|
|
@@ -497,7 +497,7 @@ let globalFloatingCounter = 0;
|
|
|
497
497
|
|
|
498
498
|
/**
|
|
499
499
|
* returns the list of childs with the specified class type
|
|
500
|
-
* @param {object} classType
|
|
500
|
+
* @param {object} classType - Class type
|
|
501
501
|
* @returns {Renderable[]} Array of children
|
|
502
502
|
*/
|
|
503
503
|
getChildByType(classType) {
|
|
@@ -577,7 +577,7 @@ let globalFloatingCounter = 0;
|
|
|
577
577
|
|
|
578
578
|
/**
|
|
579
579
|
* Checks if this container is root or if it's attached to the root container.
|
|
580
|
-
* @returns {boolean}
|
|
580
|
+
* @returns {boolean} true if this container is root or if it's attached to the root container
|
|
581
581
|
*/
|
|
582
582
|
isAttachedToRoot() {
|
|
583
583
|
if (this.root === true) {
|
|
@@ -596,7 +596,7 @@ let globalFloatingCounter = 0;
|
|
|
596
596
|
|
|
597
597
|
/**
|
|
598
598
|
* Returns the instance of the root container (i.e. the current application World container).
|
|
599
|
-
* @returns {Container}
|
|
599
|
+
* @returns {Container} root container
|
|
600
600
|
*/
|
|
601
601
|
getRootAncestor() {
|
|
602
602
|
if (this.root === true) {
|
|
@@ -646,7 +646,7 @@ let globalFloatingCounter = 0;
|
|
|
646
646
|
/**
|
|
647
647
|
* Invokes the removeChildNow in a defer, to ensure the child is removed safely after the update & draw stack has completed. <br>
|
|
648
648
|
* if the given child implements a onDeactivateEvent() method, that method will be called once the child is removed from this container.
|
|
649
|
-
* @param {RendRenderable|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapTexterable} child
|
|
649
|
+
* @param {RendRenderable|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapTexterable} child - Child to be removed
|
|
650
650
|
* @param {boolean} [keepalive=false] - true to prevent calling child.destroy()
|
|
651
651
|
*/
|
|
652
652
|
removeChild(child, keepalive) {
|
|
@@ -662,7 +662,7 @@ let globalFloatingCounter = 0;
|
|
|
662
662
|
* Removes (and optionally destroys) a child from the container.<br>
|
|
663
663
|
* (removal is immediate and unconditional)<br>
|
|
664
664
|
* Never use keepalive=true with objects from {@link pool}. Doing so will create a memory leak.
|
|
665
|
-
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
|
|
665
|
+
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be removed
|
|
666
666
|
* @param {boolean} [keepalive=False] - True to prevent calling child.destroy()
|
|
667
667
|
*/
|
|
668
668
|
removeChildNow(child, keepalive) {
|
|
@@ -674,7 +674,7 @@ let globalFloatingCounter = 0;
|
|
|
674
674
|
// remove the body first to avoid a condition where a body can be detached
|
|
675
675
|
// from its parent, before the body is removed from the game world
|
|
676
676
|
if (child.body instanceof Body) {
|
|
677
|
-
|
|
677
|
+
this.getRootAncestor().removeBody(child.body);
|
|
678
678
|
}
|
|
679
679
|
|
|
680
680
|
if (!keepalive) {
|
|
@@ -725,7 +725,7 @@ let globalFloatingCounter = 0;
|
|
|
725
725
|
|
|
726
726
|
/**
|
|
727
727
|
* Move the child in the group one step forward (z depth).
|
|
728
|
-
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
|
|
728
|
+
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be moved
|
|
729
729
|
*/
|
|
730
730
|
moveUp(child) {
|
|
731
731
|
let childIndex = this.getChildIndex(child);
|
|
@@ -739,7 +739,7 @@ let globalFloatingCounter = 0;
|
|
|
739
739
|
|
|
740
740
|
/**
|
|
741
741
|
* Move the child in the group one step backward (z depth).
|
|
742
|
-
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
|
|
742
|
+
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be moved
|
|
743
743
|
*/
|
|
744
744
|
moveDown(child) {
|
|
745
745
|
let childIndex = this.getChildIndex(child);
|
|
@@ -753,7 +753,7 @@ let globalFloatingCounter = 0;
|
|
|
753
753
|
|
|
754
754
|
/**
|
|
755
755
|
* Move the specified child to the top(z depth).
|
|
756
|
-
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
|
|
756
|
+
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be moved
|
|
757
757
|
*/
|
|
758
758
|
moveToTop(child) {
|
|
759
759
|
let childIndex = this.getChildIndex(child);
|
|
@@ -770,7 +770,7 @@ let globalFloatingCounter = 0;
|
|
|
770
770
|
|
|
771
771
|
/**
|
|
772
772
|
* Move the specified child the bottom (z depth).
|
|
773
|
-
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child
|
|
773
|
+
* @param {Renderable|Entity|Sprite|Collectable|Trigger|Draggable|DropTarget|NineSliceSprite|ImageLayer|ColorLayer|Light2d|UIBaseElement|UISpriteElement|UITextButton|Text|BitmapText} child - Child to be moved
|
|
774
774
|
*/
|
|
775
775
|
moveToBottom(child) {
|
|
776
776
|
let childIndex = this.getChildIndex(child);
|
|
@@ -786,7 +786,7 @@ let globalFloatingCounter = 0;
|
|
|
786
786
|
}
|
|
787
787
|
|
|
788
788
|
/**
|
|
789
|
-
* Manually trigger the sort of all the childs in the container
|
|
789
|
+
* Manually trigger the sort of all the childs in the container
|
|
790
790
|
* @param {boolean} [recursive=false] - recursively sort all containers if true
|
|
791
791
|
*/
|
|
792
792
|
sort(recursive) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -17,7 +17,7 @@ import { isNumeric } from '../utils/string.js';
|
|
|
17
17
|
* a generic Image Layer Object
|
|
18
18
|
* @augments Renderable
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
class ImageLayer extends Sprite {
|
|
21
21
|
/**
|
|
22
22
|
* @param {number} x - x coordinate
|
|
23
23
|
* @param {number} y - y coordinate
|
|
@@ -26,7 +26,7 @@ import { isNumeric } from '../utils/string.js';
|
|
|
26
26
|
* @param {string} [settings.name="me.ImageLayer"] - layer name
|
|
27
27
|
* @param {number} [settings.z=0] - z-index position
|
|
28
28
|
* @param {number|Vector2d} [settings.ratio=1.0] - Scrolling ratio to be applied. See {@link ImageLayer#ratio}
|
|
29
|
-
* @param {
|
|
29
|
+
* @param {"repeat"|"repeat-x"|"repeat-y"|"no-repeat"} [settings.repeat="repeat"] - define if and how an Image Layer should be repeated. See {@link ImageLayer#repeat}
|
|
30
30
|
* @param {number|Vector2d} [settings.anchorPoint=0.0] - Image origin. See {@link ImageLayer#anchorPoint}
|
|
31
31
|
* @example
|
|
32
32
|
* // create a repetitive background pattern on the X axis using the citycloud image asset
|
|
@@ -233,7 +233,7 @@ import { isNumeric } from '../utils/string.js';
|
|
|
233
233
|
this.isDirty = true;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
|
|
236
|
+
/**
|
|
237
237
|
* override the default predraw function
|
|
238
238
|
* as repeat and anchor are managed directly in the draw method
|
|
239
239
|
* @ignore
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -56,8 +56,8 @@ function createGradient(light) {
|
|
|
56
56
|
* (multiple lights are not supported, alpha component of the ambient light is ignored)
|
|
57
57
|
* @see stage.lights
|
|
58
58
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
class Light2d extends Renderable {
|
|
60
|
+
/**
|
|
61
61
|
* @param {number} x - The horizontal position of the light.
|
|
62
62
|
* @param {number} y - The vertical position of the light.
|
|
63
63
|
* @param {number} radiusX - The horizontal radius of the light.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -15,7 +15,7 @@ import Sprite from './sprite.js';
|
|
|
15
15
|
* @see https://en.wikipedia.org/wiki/9-slice_scaling
|
|
16
16
|
* @augments Sprite
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
class NineSliceSprite extends Sprite {
|
|
19
19
|
/**
|
|
20
20
|
* @param {number} x - the x coordinates of the sprite object
|
|
21
21
|
* @param {number} y - the y coordinates of the sprite object
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -17,7 +17,7 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
17
17
|
* A base class for renderable objects.
|
|
18
18
|
* @augments Rect
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
class Renderable extends Rect {
|
|
21
21
|
/**
|
|
22
22
|
* @param {number} x - position of the renderable object (accessible through inherited pos.x property)
|
|
23
23
|
* @param {number} y - position of the renderable object (accessible through inherited pos.y property)
|
|
@@ -103,7 +103,7 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
103
103
|
*/
|
|
104
104
|
this.body = undefined;
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
/**
|
|
107
107
|
* (G)ame (U)nique (Id)entifier" <br>
|
|
108
108
|
* a GUID will be allocated for any renderable object added <br>
|
|
109
109
|
* to an object container (including the `me.game.world` container)
|
|
@@ -576,7 +576,7 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
576
576
|
}
|
|
577
577
|
|
|
578
578
|
if (absolute === true) {
|
|
579
|
-
|
|
579
|
+
let absPos = this.getAbsolutePosition();
|
|
580
580
|
bounds.centerOn(absPos.x + bounds.x + bounds.width / 2, absPos.y + bounds.y + bounds.height / 2);
|
|
581
581
|
}
|
|
582
582
|
return bounds;
|
|
@@ -592,25 +592,25 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
592
592
|
* update the renderable's bounding rect (private)
|
|
593
593
|
* @ignore
|
|
594
594
|
*/
|
|
595
|
-
|
|
595
|
+
updateBoundsPos(newX = this.pos.x, newY = this.pos.y) {
|
|
596
596
|
this.getBounds().translate(newX - this.pos.x, newY - this.pos.y);
|
|
597
|
-
|
|
597
|
+
}
|
|
598
598
|
|
|
599
|
-
|
|
599
|
+
/**
|
|
600
600
|
* return the renderable absolute position in the game world
|
|
601
601
|
* @returns {Vector2d}
|
|
602
602
|
*/
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
603
|
+
getAbsolutePosition() {
|
|
604
|
+
if (typeof this._absPos === "undefined") {
|
|
605
|
+
this._absPos = pool.pull("Vector2d");
|
|
606
|
+
}
|
|
607
|
+
// XXX Cache me or something
|
|
608
|
+
this._absPos.set(this.pos.x, this.pos.y);
|
|
609
|
+
if (typeof this.ancestor !== "undefined" && typeof this.ancestor.getAbsolutePosition === "function" && this.floating !== true) {
|
|
610
|
+
this._absPos.add(this.ancestor.getAbsolutePosition());
|
|
611
|
+
}
|
|
612
|
+
return this._absPos;
|
|
613
|
+
}
|
|
614
614
|
|
|
615
615
|
/**
|
|
616
616
|
* called when the anchor point value is changed
|
|
@@ -618,14 +618,14 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
618
618
|
* @param {number} x - the new X value to be set for the anchor
|
|
619
619
|
* @param {number} y - the new Y value to be set for the anchor
|
|
620
620
|
*/
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
621
|
+
onAnchorUpdate(x, y) {
|
|
622
|
+
// since the callback is called before setting the new value
|
|
623
|
+
// manually update the anchor point (required for updateBoundsPos)
|
|
624
|
+
this.anchorPoint.setMuted(x, y);
|
|
625
|
+
// then call updateBounds
|
|
626
|
+
this.updateBounds();
|
|
627
|
+
this.isDirty = true;
|
|
628
|
+
}
|
|
629
629
|
|
|
630
630
|
/**
|
|
631
631
|
* Prepare the rendering context before drawing (automatically called by melonJS).
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.4.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -17,7 +17,7 @@ import Color from '../math/color.js';
|
|
|
17
17
|
* An object to display a fixed or animated sprite on screen.
|
|
18
18
|
* @augments Renderable
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
class Sprite extends Renderable {
|
|
21
21
|
/**
|
|
22
22
|
* @param {number} x - the x coordinates of the sprite object
|
|
23
23
|
* @param {number} y - the y coordinates of the sprite object
|
|
@@ -314,7 +314,7 @@ import Color from '../math/color.js';
|
|
|
314
314
|
};
|
|
315
315
|
}
|
|
316
316
|
else {
|
|
317
|
-
|
|
317
|
+
frameObject = frame;
|
|
318
318
|
}
|
|
319
319
|
let frameObjectName = frameObject.name;
|
|
320
320
|
if (typeof(frameObjectName) === "number") {
|