melonjs 14.1.0 → 14.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
- package/dist/melonjs.mjs/_virtual/arraymultimap.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/_virtual/index2.js +1 -1
- package/dist/melonjs.mjs/_virtual/multimap.js +1 -1
- package/dist/melonjs.mjs/_virtual/setmultimap.js +1 -1
- package/dist/melonjs.mjs/application/application.js +3 -5
- package/dist/melonjs.mjs/audio/audio.js +1 -1
- package/dist/melonjs.mjs/camera/camera2d.js +3 -4
- package/dist/melonjs.mjs/entity/entity.js +3 -4
- package/dist/melonjs.mjs/game.js +1 -1
- package/dist/melonjs.mjs/geometries/ellipse.js +3 -4
- package/dist/melonjs.mjs/geometries/line.js +3 -4
- package/dist/melonjs.mjs/geometries/path2d.js +3 -4
- package/dist/melonjs.mjs/geometries/point.js +3 -4
- package/dist/melonjs.mjs/geometries/poly.js +3 -5
- package/dist/melonjs.mjs/geometries/rectangle.js +3 -4
- package/dist/melonjs.mjs/geometries/roundrect.js +2 -3
- package/dist/melonjs.mjs/index.js +2 -2
- 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 +1 -1
- package/dist/melonjs.mjs/input/pointer.js +1 -1
- package/dist/melonjs.mjs/input/pointerevent.js +1 -1
- package/dist/melonjs.mjs/lang/deprecated.js +1 -1
- 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 +3 -5
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +3 -4
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +5 -8
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +3 -5
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +3 -5
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +3 -5
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +3 -5
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +3 -5
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +3 -4
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +3 -5
- 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/math/color.js +3 -5
- package/dist/melonjs.mjs/math/math.js +1 -1
- package/dist/melonjs.mjs/math/matrix2.js +3 -5
- package/dist/melonjs.mjs/math/matrix3.js +3 -5
- package/dist/melonjs.mjs/math/observable_vector2.js +3 -5
- package/dist/melonjs.mjs/math/observable_vector3.js +3 -5
- package/dist/melonjs.mjs/math/vector2.js +3 -5
- package/dist/melonjs.mjs/math/vector3.js +3 -5
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/arraymultimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/multimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/src/setmultimap.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 +9 -0
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
- package/dist/melonjs.mjs/particles/emitter.js +3 -5
- package/dist/melonjs.mjs/particles/particle.js +3 -5
- package/dist/melonjs.mjs/particles/settings.js +1 -1
- package/dist/melonjs.mjs/physics/body.js +3 -5
- package/dist/melonjs.mjs/physics/bounds.js +3 -4
- package/dist/melonjs.mjs/physics/collision.js +1 -1
- package/dist/melonjs.mjs/physics/detector.js +1 -5
- package/dist/melonjs.mjs/physics/quadtree.js +23 -20
- package/dist/melonjs.mjs/physics/response.js +1 -1
- package/dist/melonjs.mjs/physics/sat.js +1 -1
- package/dist/melonjs.mjs/physics/world.js +3 -5
- package/dist/melonjs.mjs/plugin/plugin.js +3 -3
- package/dist/melonjs.mjs/renderable/collectable.js +3 -5
- package/dist/melonjs.mjs/renderable/colorlayer.js +3 -5
- package/dist/melonjs.mjs/renderable/container.js +6 -8
- package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
- package/dist/melonjs.mjs/renderable/imagelayer.js +4 -5
- package/dist/melonjs.mjs/renderable/light2d.js +3 -4
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +3 -4
- package/dist/melonjs.mjs/renderable/renderable.js +5 -7
- package/dist/melonjs.mjs/renderable/sprite.js +3 -4
- package/dist/melonjs.mjs/renderable/trigger.js +3 -4
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +3 -4
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +3 -4
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +3 -4
- package/dist/melonjs.mjs/state/stage.js +3 -4
- package/dist/melonjs.mjs/state/state.js +1 -1
- package/dist/melonjs.mjs/system/device.js +1 -1
- package/dist/melonjs.mjs/system/dom.js +1 -1
- package/dist/melonjs.mjs/system/event.js +1 -1
- package/dist/melonjs.mjs/system/platform.js +1 -1
- package/dist/melonjs.mjs/system/pooling.js +1 -1
- 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 +3 -4
- package/dist/melonjs.mjs/text/bitmaptextdata.js +3 -4
- package/dist/melonjs.mjs/text/glyph.js +3 -4
- package/dist/melonjs.mjs/text/text.js +3 -4
- package/dist/melonjs.mjs/text/textmetrics.js +3 -4
- 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 +3 -4
- 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 +1 -1
- 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 -4
- package/dist/melonjs.mjs/video/renderer.js +4 -5
- package/dist/melonjs.mjs/video/texture/atlas.js +1 -1
- package/dist/melonjs.mjs/video/texture/cache.js +1 -1
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +1 -1
- package/dist/melonjs.mjs/video/video.js +1 -1
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +3 -4
- package/dist/melonjs.mjs/video/webgl/glshader.js +3 -4
- 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 +1 -1
- 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_compositor.js +3 -4
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +3 -4
- package/dist/melonjs.module.js +659 -740
- package/dist/types/index.d.ts +108 -0
- package/package.json +19 -19
- package/src/application/application.js +1 -2
- package/src/camera/camera2d.js +1 -2
- package/src/entity/entity.js +1 -2
- package/src/geometries/ellipse.js +1 -2
- package/src/geometries/line.js +1 -2
- package/src/geometries/path2d.js +1 -2
- package/src/geometries/point.js +1 -2
- package/src/geometries/poly.js +1 -3
- package/src/geometries/rectangle.js +1 -2
- package/src/geometries/roundrect.js +1 -2
- package/src/level/tiled/TMXLayer.js +1 -2
- package/src/level/tiled/TMXTile.js +1 -2
- package/src/level/tiled/TMXTileMap.js +2 -4
- package/src/level/tiled/TMXTileset.js +1 -2
- package/src/level/tiled/TMXTilesetGroup.js +1 -2
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -2
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -2
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -2
- package/src/level/tiled/renderer/TMXRenderer.js +1 -2
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -2
- package/src/math/color.js +1 -2
- package/src/math/matrix2.js +1 -2
- package/src/math/matrix3.js +1 -2
- package/src/math/observable_vector2.js +1 -2
- package/src/math/observable_vector3.js +1 -2
- package/src/math/vector2.js +1 -2
- package/src/math/vector3.js +1 -2
- package/src/particles/emitter.js +1 -2
- package/src/particles/particle.js +1 -2
- package/src/physics/body.js +1 -2
- package/src/physics/bounds.js +2 -2
- package/src/physics/detector.js +0 -4
- package/src/physics/quadtree.js +7 -12
- package/src/physics/world.js +1 -2
- package/src/renderable/collectable.js +1 -3
- package/src/renderable/colorlayer.js +1 -3
- package/src/renderable/container.js +4 -6
- package/src/renderable/imagelayer.js +1 -2
- package/src/renderable/light2d.js +1 -2
- package/src/renderable/nineslicesprite.js +1 -2
- package/src/renderable/renderable.js +3 -5
- package/src/renderable/sprite.js +1 -2
- package/src/renderable/trigger.js +1 -2
- package/src/renderable/ui/uibaseelement.js +1 -2
- package/src/renderable/ui/uispriteelement.js +2 -2
- package/src/renderable/ui/uitextbutton.js +2 -2
- package/src/state/stage.js +1 -2
- package/src/text/bitmaptext.js +1 -2
- package/src/text/bitmaptextdata.js +1 -2
- package/src/text/glyph.js +1 -2
- package/src/text/text.js +1 -2
- package/src/text/textmetrics.js +1 -2
- package/src/tweens/tween.js +1 -2
- package/src/video/canvas/canvas_renderer.js +1 -2
- package/src/video/renderer.js +1 -2
- package/src/video/webgl/buffer/vertex.js +1 -2
- package/src/video/webgl/glshader.js +2 -2
- package/src/video/webgl/webgl_compositor.js +1 -2
- package/src/video/webgl/webgl_renderer.js +1 -2
- package/dist/melonjs.module.d.ts +0 -14020
package/dist/melonjs.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v14.1.
|
|
2
|
+
* melonJS Game Engine - v14.1.2
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -764,7 +764,7 @@ var pool$1 = pool;
|
|
|
764
764
|
* @classdesc
|
|
765
765
|
* a generic 2D Vector Object
|
|
766
766
|
*/
|
|
767
|
-
class Vector2d {
|
|
767
|
+
class Vector2d {
|
|
768
768
|
/**
|
|
769
769
|
* @param {number} [x=0] - x value of the vector
|
|
770
770
|
* @param {number} [y=0] - y value of the vector
|
|
@@ -1275,8 +1275,6 @@ class Vector2d {
|
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
1277
|
|
|
1278
|
-
var Vector2d$1 = Vector2d;
|
|
1279
|
-
|
|
1280
1278
|
// convert a give color component to it hexadecimal value
|
|
1281
1279
|
function toHex(component) {
|
|
1282
1280
|
return "0123456789ABCDEF".charAt((component - (component % 16)) >> 4) + "0123456789ABCDEF".charAt(component % 16);
|
|
@@ -1458,7 +1456,7 @@ var cssToRGB = new Map();
|
|
|
1458
1456
|
* @classdesc
|
|
1459
1457
|
* A color manipulation object.
|
|
1460
1458
|
*/
|
|
1461
|
-
class Color {
|
|
1459
|
+
class Color {
|
|
1462
1460
|
/**
|
|
1463
1461
|
* @param {number} [r=0] - red component or array of color components
|
|
1464
1462
|
* @param {number} [g=0] - green component
|
|
@@ -1882,13 +1880,11 @@ class Color {
|
|
|
1882
1880
|
}
|
|
1883
1881
|
}
|
|
1884
1882
|
|
|
1885
|
-
var Color$1 = Color;
|
|
1886
|
-
|
|
1887
1883
|
/**
|
|
1888
1884
|
* @classdesc
|
|
1889
1885
|
* a 4x4 Matrix3d Object
|
|
1890
1886
|
*/
|
|
1891
|
-
class Matrix3d {
|
|
1887
|
+
class Matrix3d {
|
|
1892
1888
|
/**
|
|
1893
1889
|
* @param {(Matrix3d|...number)} args - An instance of me.Matrix3d to copy from, or individual Matrix components (See {@link Matrix3d.setTransform}). If not arguments are given, the matrix will be set to Identity.
|
|
1894
1890
|
*/
|
|
@@ -2552,15 +2548,13 @@ class Matrix3d {
|
|
|
2552
2548
|
}
|
|
2553
2549
|
}
|
|
2554
2550
|
|
|
2555
|
-
var Matrix3d$1 = Matrix3d;
|
|
2556
|
-
|
|
2557
2551
|
/**
|
|
2558
2552
|
* @classdesc
|
|
2559
2553
|
* a Matrix2d Object.<br>
|
|
2560
2554
|
* the identity matrix and parameters position : <br>
|
|
2561
2555
|
* <img src="images/identity-matrix_2x.png"/>
|
|
2562
2556
|
*/
|
|
2563
|
-
class Matrix2d {
|
|
2557
|
+
class Matrix2d {
|
|
2564
2558
|
/**
|
|
2565
2559
|
* @param {(Matrix2d|Matrix3d|...number)} args - an instance of me.Matrix2d or me.Matrix3d to copy from, or individual matrix components (See {@link Matrix2d.setTransform}). If not arguments are given, the matrix will be set to Identity.
|
|
2566
2560
|
*/
|
|
@@ -2579,7 +2573,7 @@ class Matrix2d {
|
|
|
2579
2573
|
if (arguments.length && arguments[0] instanceof Matrix2d) {
|
|
2580
2574
|
this.copy(arguments[0]);
|
|
2581
2575
|
}
|
|
2582
|
-
else if (arguments.length && arguments[0] instanceof Matrix3d
|
|
2576
|
+
else if (arguments.length && arguments[0] instanceof Matrix3d) {
|
|
2583
2577
|
this.fromMat3d(arguments[0]);
|
|
2584
2578
|
}
|
|
2585
2579
|
else if (arguments.length >= 6) {
|
|
@@ -3044,8 +3038,6 @@ class Matrix2d {
|
|
|
3044
3038
|
}
|
|
3045
3039
|
}
|
|
3046
3040
|
|
|
3047
|
-
var Matrix2d$1 = Matrix2d;
|
|
3048
|
-
|
|
3049
3041
|
var eventemitter3 = {exports: {}};
|
|
3050
3042
|
|
|
3051
3043
|
(function (module) {
|
|
@@ -5369,7 +5361,7 @@ function minify(src) {
|
|
|
5369
5361
|
* @classdesc
|
|
5370
5362
|
* a base GL Shader object
|
|
5371
5363
|
*/
|
|
5372
|
-
class GLShader {
|
|
5364
|
+
class GLShader {
|
|
5373
5365
|
/**
|
|
5374
5366
|
* @param {WebGLRenderingContext} gl - the current WebGL rendering context
|
|
5375
5367
|
* @param {string} vertex - a string containing the GLSL source code to set
|
|
@@ -5515,7 +5507,6 @@ class GLShader {
|
|
|
5515
5507
|
this.fragment = null;
|
|
5516
5508
|
}
|
|
5517
5509
|
}
|
|
5518
|
-
var GLShader$1 = GLShader;
|
|
5519
5510
|
|
|
5520
5511
|
/**
|
|
5521
5512
|
* @classdesc
|
|
@@ -5524,7 +5515,7 @@ var GLShader$1 = GLShader;
|
|
|
5524
5515
|
* @ignore
|
|
5525
5516
|
*/
|
|
5526
5517
|
|
|
5527
|
-
class VertexArrayBuffer {
|
|
5518
|
+
class VertexArrayBuffer {
|
|
5528
5519
|
|
|
5529
5520
|
constructor(vertex_size, vertex_per_quad) {
|
|
5530
5521
|
// the size of one vertex in float
|
|
@@ -5650,7 +5641,6 @@ class VertexArrayBuffer {
|
|
|
5650
5641
|
}
|
|
5651
5642
|
|
|
5652
5643
|
}
|
|
5653
|
-
var VertexArrayBuffer$1 = VertexArrayBuffer;
|
|
5654
5644
|
|
|
5655
5645
|
var primitiveVertex = "// Current vertex point\nattribute vec2 aVertex;\n\n// Projection matrix\nuniform mat4 uProjectionMatrix;\n\n// Vertex color\nuniform vec4 uColor;\n\n// Fragment color\nvarying vec4 vColor;\n\nvoid main(void) {\n // Transform the vertex position by the projection matrix\n gl_Position = uProjectionMatrix * vec4(aVertex, 0.0, 1.0);\n // Pass the remaining attributes to the fragment shader\n vColor = vec4(uColor.rgb * uColor.a, uColor.a);\n}\n";
|
|
5656
5646
|
|
|
@@ -5662,10 +5652,10 @@ var quadFragment = "uniform sampler2D uSampler;\nvarying vec4 vColor;\nvarying v
|
|
|
5662
5652
|
|
|
5663
5653
|
// a pool of resuable vectors
|
|
5664
5654
|
var V_ARRAY = [
|
|
5665
|
-
new Vector2d
|
|
5666
|
-
new Vector2d
|
|
5667
|
-
new Vector2d
|
|
5668
|
-
new Vector2d
|
|
5655
|
+
new Vector2d(),
|
|
5656
|
+
new Vector2d(),
|
|
5657
|
+
new Vector2d(),
|
|
5658
|
+
new Vector2d()
|
|
5669
5659
|
];
|
|
5670
5660
|
|
|
5671
5661
|
/**
|
|
@@ -5673,7 +5663,7 @@ var V_ARRAY = [
|
|
|
5673
5663
|
* A WebGL Compositor object. This class handles all of the WebGL state<br>
|
|
5674
5664
|
* Pushes texture regions or shape geometry into WebGL buffers, automatically flushes to GPU
|
|
5675
5665
|
*/
|
|
5676
|
-
class WebGLCompositor {
|
|
5666
|
+
class WebGLCompositor {
|
|
5677
5667
|
/**
|
|
5678
5668
|
* @param {WebGLRenderer} renderer - the current WebGL renderer session
|
|
5679
5669
|
*/
|
|
@@ -5742,15 +5732,15 @@ class WebGLCompositor {
|
|
|
5742
5732
|
this.vertexSize = 0;
|
|
5743
5733
|
|
|
5744
5734
|
// Load and create shader programs
|
|
5745
|
-
this.primitiveShader = new GLShader
|
|
5746
|
-
this.quadShader = new GLShader
|
|
5735
|
+
this.primitiveShader = new GLShader(this.gl, primitiveVertex, primitiveFragment);
|
|
5736
|
+
this.quadShader = new GLShader(this.gl, quadVertex, quadFragment);
|
|
5747
5737
|
|
|
5748
5738
|
/// define all vertex attributes
|
|
5749
5739
|
this.addAttribute("aVertex", 2, gl.FLOAT, false, 0 * Float32Array.BYTES_PER_ELEMENT); // 0
|
|
5750
5740
|
this.addAttribute("aRegion", 2, gl.FLOAT, false, 2 * Float32Array.BYTES_PER_ELEMENT); // 1
|
|
5751
5741
|
this.addAttribute("aColor", 4, gl.UNSIGNED_BYTE, true, 4 * Float32Array.BYTES_PER_ELEMENT); // 2
|
|
5752
5742
|
|
|
5753
|
-
this.vertexBuffer = new VertexArrayBuffer
|
|
5743
|
+
this.vertexBuffer = new VertexArrayBuffer(this.vertexSize, 6); // 6 vertices per quad
|
|
5754
5744
|
|
|
5755
5745
|
// vertex buffer
|
|
5756
5746
|
gl.bindBuffer(gl.ARRAY_BUFFER, gl.createBuffer());
|
|
@@ -6135,7 +6125,6 @@ class WebGLCompositor {
|
|
|
6135
6125
|
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
6136
6126
|
}
|
|
6137
6127
|
}
|
|
6138
|
-
var WebGLCompositor$1 = WebGLCompositor;
|
|
6139
6128
|
|
|
6140
6129
|
var earcut$1 = {exports: {}};
|
|
6141
6130
|
|
|
@@ -6829,7 +6818,7 @@ earcut.flatten = function (data) {
|
|
|
6829
6818
|
*
|
|
6830
6819
|
* A polygon's `winding` is clockwise if its vertices (points) are declared turning to the right. The image above shows COUNTERCLOCKWISE winding.
|
|
6831
6820
|
*/
|
|
6832
|
-
class Polygon {
|
|
6821
|
+
class Polygon {
|
|
6833
6822
|
/**
|
|
6834
6823
|
* @param {number} x - origin point of the Polygon
|
|
6835
6824
|
* @param {number} y - origin point of the Polygon
|
|
@@ -6925,7 +6914,7 @@ class Polygon {
|
|
|
6925
6914
|
}
|
|
6926
6915
|
|
|
6927
6916
|
// convert given points to me.Vector2d if required
|
|
6928
|
-
if (!(vertices[0] instanceof Vector2d
|
|
6917
|
+
if (!(vertices[0] instanceof Vector2d)) {
|
|
6929
6918
|
this.points.length = 0;
|
|
6930
6919
|
|
|
6931
6920
|
if (typeof vertices[0] === "object") {
|
|
@@ -7304,14 +7293,12 @@ class Polygon {
|
|
|
7304
7293
|
}
|
|
7305
7294
|
}
|
|
7306
7295
|
|
|
7307
|
-
var Polygon$1 = Polygon;
|
|
7308
|
-
|
|
7309
7296
|
/**
|
|
7310
7297
|
* @classdesc
|
|
7311
7298
|
* a rectangle Object
|
|
7312
7299
|
* @augments Polygon
|
|
7313
7300
|
*/
|
|
7314
|
-
class Rect extends Polygon
|
|
7301
|
+
class Rect extends Polygon {
|
|
7315
7302
|
/**
|
|
7316
7303
|
* @param {number} x - position of the Rectangle
|
|
7317
7304
|
* @param {number} y - position of the Rectangle
|
|
@@ -7668,7 +7655,6 @@ class Rect extends Polygon$1 {
|
|
|
7668
7655
|
);
|
|
7669
7656
|
}
|
|
7670
7657
|
}
|
|
7671
|
-
var Rect$1 = Rect;
|
|
7672
7658
|
|
|
7673
7659
|
// https://developer.chrome.com/blog/canvas2d/#round-rect
|
|
7674
7660
|
|
|
@@ -7677,7 +7663,7 @@ var Rect$1 = Rect;
|
|
|
7677
7663
|
* a rectangle object with rounded corners
|
|
7678
7664
|
* @augments Rect
|
|
7679
7665
|
*/
|
|
7680
|
-
class RoundRect extends Rect
|
|
7666
|
+
class RoundRect extends Rect {
|
|
7681
7667
|
/**
|
|
7682
7668
|
* @param {number} x - position of the rounded rectangle
|
|
7683
7669
|
* @param {number} y - position of the rounded rectangle
|
|
@@ -7760,7 +7746,7 @@ class RoundRect extends Rect$1 {
|
|
|
7760
7746
|
_x = arg0;
|
|
7761
7747
|
_y = arguments[1];
|
|
7762
7748
|
} else {
|
|
7763
|
-
if (arg0 instanceof Rect
|
|
7749
|
+
if (arg0 instanceof Rect) {
|
|
7764
7750
|
// good enough
|
|
7765
7751
|
return super.contains(arg0);
|
|
7766
7752
|
} else {
|
|
@@ -7826,13 +7812,12 @@ class RoundRect extends Rect$1 {
|
|
|
7826
7812
|
return new RoundRect(this.pos.x, this.pos.y, this.width, this.height, this.radius);
|
|
7827
7813
|
}
|
|
7828
7814
|
}
|
|
7829
|
-
var RoundRect$1 = RoundRect;
|
|
7830
7815
|
|
|
7831
7816
|
/**
|
|
7832
7817
|
* @classdesc
|
|
7833
7818
|
* an ellipse Object
|
|
7834
7819
|
*/
|
|
7835
|
-
class Ellipse {
|
|
7820
|
+
class Ellipse {
|
|
7836
7821
|
/**
|
|
7837
7822
|
* @param {number} x - the center x coordinate of the ellipse
|
|
7838
7823
|
* @param {number} y - the center y coordinate of the ellipse
|
|
@@ -8091,7 +8076,6 @@ class Ellipse {
|
|
|
8091
8076
|
);
|
|
8092
8077
|
}
|
|
8093
8078
|
}
|
|
8094
|
-
var Ellipse$1 = Ellipse;
|
|
8095
8079
|
|
|
8096
8080
|
/**
|
|
8097
8081
|
* @classdesc
|
|
@@ -8102,7 +8086,7 @@ var Ellipse$1 = Ellipse;
|
|
|
8102
8086
|
* @param {Vector2d[]} points - array of vectors defining the Line
|
|
8103
8087
|
*/
|
|
8104
8088
|
|
|
8105
|
-
class Line extends Polygon
|
|
8089
|
+
class Line extends Polygon {
|
|
8106
8090
|
|
|
8107
8091
|
/**
|
|
8108
8092
|
* Returns true if the Line contains the given point
|
|
@@ -8196,19 +8180,18 @@ class Line extends Polygon$1 {
|
|
|
8196
8180
|
}
|
|
8197
8181
|
|
|
8198
8182
|
}
|
|
8199
|
-
var Line$1 = Line;
|
|
8200
8183
|
|
|
8201
8184
|
/**
|
|
8202
8185
|
* @classdesc
|
|
8203
8186
|
* a bound object contains methods for creating and manipulating axis-aligned bounding boxes (AABB).
|
|
8204
8187
|
*/
|
|
8205
|
-
class Bounds {
|
|
8188
|
+
class Bounds {
|
|
8206
8189
|
/**
|
|
8207
8190
|
* @param {Vector2d[]} [vertices] - an array of me.Vector2d points
|
|
8208
8191
|
*/
|
|
8209
8192
|
constructor(vertices) {
|
|
8210
8193
|
// @ignore
|
|
8211
|
-
this._center = new Vector2d
|
|
8194
|
+
this._center = new Vector2d();
|
|
8212
8195
|
this.onResetEvent(vertices);
|
|
8213
8196
|
}
|
|
8214
8197
|
|
|
@@ -8645,13 +8628,12 @@ class Bounds {
|
|
|
8645
8628
|
}
|
|
8646
8629
|
|
|
8647
8630
|
}
|
|
8648
|
-
var Bounds$1 = Bounds;
|
|
8649
8631
|
|
|
8650
8632
|
/**
|
|
8651
8633
|
* @classdesc
|
|
8652
8634
|
* a simplified path2d implementation, supporting only one path
|
|
8653
8635
|
*/
|
|
8654
|
-
class Path2D {
|
|
8636
|
+
class Path2D {
|
|
8655
8637
|
constructor() {
|
|
8656
8638
|
/**
|
|
8657
8639
|
* the points defining the current path
|
|
@@ -8951,13 +8933,12 @@ class Path2D {
|
|
|
8951
8933
|
this.arcTo(x, y, x + radius, y, radius);
|
|
8952
8934
|
}
|
|
8953
8935
|
}
|
|
8954
|
-
var Path2D$1 = Path2D;
|
|
8955
8936
|
|
|
8956
8937
|
/**
|
|
8957
8938
|
* @classdesc
|
|
8958
8939
|
* represents a point in a 2d space
|
|
8959
8940
|
*/
|
|
8960
|
-
class Point {
|
|
8941
|
+
class Point {
|
|
8961
8942
|
constructor(x = 0, y = 0) {
|
|
8962
8943
|
/**
|
|
8963
8944
|
* the position of the point on the horizontal axis
|
|
@@ -9032,13 +9013,12 @@ class Point {
|
|
|
9032
9013
|
return new Point(this.x, this.y);
|
|
9033
9014
|
}
|
|
9034
9015
|
}
|
|
9035
|
-
var Point$1 = Point;
|
|
9036
9016
|
|
|
9037
9017
|
/**
|
|
9038
9018
|
* @classdesc
|
|
9039
9019
|
* a base renderer object
|
|
9040
9020
|
*/
|
|
9041
|
-
class Renderer {
|
|
9021
|
+
class Renderer {
|
|
9042
9022
|
/**
|
|
9043
9023
|
* @param {object} options - The renderer parameters
|
|
9044
9024
|
* @param {number} options.width - The width of the canvas without scaling
|
|
@@ -9073,7 +9053,7 @@ class Renderer {
|
|
|
9073
9053
|
* The Path2D instance used by the renderer to draw primitives
|
|
9074
9054
|
* @type {Path2D}
|
|
9075
9055
|
*/
|
|
9076
|
-
this.path2D = new Path2D
|
|
9056
|
+
this.path2D = new Path2D();
|
|
9077
9057
|
|
|
9078
9058
|
/**
|
|
9079
9059
|
* @ignore
|
|
@@ -9104,13 +9084,13 @@ class Renderer {
|
|
|
9104
9084
|
}
|
|
9105
9085
|
|
|
9106
9086
|
// global color
|
|
9107
|
-
this.currentColor = new Color
|
|
9087
|
+
this.currentColor = new Color(0, 0, 0, 1.0);
|
|
9108
9088
|
|
|
9109
9089
|
// global tint color
|
|
9110
|
-
this.currentTint = new Color
|
|
9090
|
+
this.currentTint = new Color(255, 255, 255, 1.0);
|
|
9111
9091
|
|
|
9112
9092
|
// the projectionMatrix (set through setProjection)
|
|
9113
|
-
this.projectionMatrix = new Matrix3d
|
|
9093
|
+
this.projectionMatrix = new Matrix3d();
|
|
9114
9094
|
|
|
9115
9095
|
// default uvOffset
|
|
9116
9096
|
this.uvOffset = 0;
|
|
@@ -9313,19 +9293,19 @@ class Renderer {
|
|
|
9313
9293
|
* @param {boolean} [fill=false] - fill the shape with the current color if true
|
|
9314
9294
|
*/
|
|
9315
9295
|
stroke(shape, fill) {
|
|
9316
|
-
if (shape instanceof RoundRect
|
|
9296
|
+
if (shape instanceof RoundRect) {
|
|
9317
9297
|
this.strokeRoundRect(shape.left, shape.top, shape.width, shape.height, shape.radius, fill);
|
|
9318
9298
|
return;
|
|
9319
9299
|
}
|
|
9320
|
-
if (shape instanceof Rect
|
|
9300
|
+
if (shape instanceof Rect || shape instanceof Bounds) {
|
|
9321
9301
|
this.strokeRect(shape.left, shape.top, shape.width, shape.height, fill);
|
|
9322
9302
|
return;
|
|
9323
9303
|
}
|
|
9324
|
-
if (shape instanceof Line
|
|
9304
|
+
if (shape instanceof Line || shape instanceof Polygon) {
|
|
9325
9305
|
this.strokePolygon(shape, fill);
|
|
9326
9306
|
return;
|
|
9327
9307
|
}
|
|
9328
|
-
if (shape instanceof Ellipse
|
|
9308
|
+
if (shape instanceof Ellipse) {
|
|
9329
9309
|
this.strokeEllipse(
|
|
9330
9310
|
shape.pos.x,
|
|
9331
9311
|
shape.pos.y,
|
|
@@ -9335,7 +9315,7 @@ class Renderer {
|
|
|
9335
9315
|
);
|
|
9336
9316
|
return;
|
|
9337
9317
|
}
|
|
9338
|
-
if (shape instanceof Point
|
|
9318
|
+
if (shape instanceof Point) {
|
|
9339
9319
|
this.strokePoint(shape.x, shape.y);
|
|
9340
9320
|
return;
|
|
9341
9321
|
}
|
|
@@ -9365,7 +9345,7 @@ class Renderer {
|
|
|
9365
9345
|
|
|
9366
9346
|
context.save();
|
|
9367
9347
|
|
|
9368
|
-
context.fillStyle = color instanceof Color
|
|
9348
|
+
context.fillStyle = color instanceof Color ? color.toRGB() : color;
|
|
9369
9349
|
context.fillRect(0, 0, src.width, src.height);
|
|
9370
9350
|
|
|
9371
9351
|
context.globalCompositeOperation = mode || "multiply";
|
|
@@ -9420,7 +9400,6 @@ class Renderer {
|
|
|
9420
9400
|
drawFont(/*bounds*/) {}
|
|
9421
9401
|
|
|
9422
9402
|
}
|
|
9423
|
-
var Renderer$1 = Renderer;
|
|
9424
9403
|
|
|
9425
9404
|
var howler = {};
|
|
9426
9405
|
|
|
@@ -13209,12 +13188,395 @@ var audio = /*#__PURE__*/Object.freeze({
|
|
|
13209
13188
|
unloadAll: unloadAll
|
|
13210
13189
|
});
|
|
13211
13190
|
|
|
13191
|
+
/*
|
|
13192
|
+
* A QuadTree implementation in JavaScript, a 2d spatial subdivision algorithm.
|
|
13193
|
+
* Based on the QuadTree Library by Timo Hausmann and released under the MIT license
|
|
13194
|
+
* https://github.com/timohausmann/quadtree-js/
|
|
13195
|
+
**/
|
|
13196
|
+
|
|
13197
|
+
/**
|
|
13198
|
+
* a pool of `QuadTree` objects
|
|
13199
|
+
* @ignore
|
|
13200
|
+
*/
|
|
13201
|
+
var QT_ARRAY = [];
|
|
13202
|
+
|
|
13203
|
+
/**
|
|
13204
|
+
* will pop a quadtree object from the array
|
|
13205
|
+
* or create a new one if the array is empty
|
|
13206
|
+
* @ignore
|
|
13207
|
+
*/
|
|
13208
|
+
function QT_ARRAY_POP(world, bounds, max_objects = 4, max_levels = 4, level = 0) {
|
|
13209
|
+
if (QT_ARRAY.length > 0) {
|
|
13210
|
+
var _qt = QT_ARRAY.pop();
|
|
13211
|
+
_qt.world = world;
|
|
13212
|
+
_qt.bounds = bounds;
|
|
13213
|
+
_qt.max_objects = max_objects;
|
|
13214
|
+
_qt.max_levels = max_levels;
|
|
13215
|
+
_qt.level = level;
|
|
13216
|
+
return _qt;
|
|
13217
|
+
} else {
|
|
13218
|
+
return new QuadTree(world, bounds, max_objects, max_levels, level);
|
|
13219
|
+
}
|
|
13220
|
+
}
|
|
13221
|
+
|
|
13222
|
+
/**
|
|
13223
|
+
* Push back a quadtree back into the array
|
|
13224
|
+
* @ignore
|
|
13225
|
+
*/
|
|
13226
|
+
function QT_ARRAY_PUSH(qt) {
|
|
13227
|
+
QT_ARRAY.push(qt);
|
|
13228
|
+
}
|
|
13229
|
+
|
|
13230
|
+
/**
|
|
13231
|
+
* a temporary vector object to be reused
|
|
13232
|
+
* @ignore
|
|
13233
|
+
*/
|
|
13234
|
+
var QT_VECTOR = new Vector2d();
|
|
13235
|
+
|
|
13236
|
+
/**
|
|
13237
|
+
* @classdesc
|
|
13238
|
+
* a QuadTree implementation in JavaScript, a 2d spatial subdivision algorithm.
|
|
13239
|
+
* @see game.world.broadphase
|
|
13240
|
+
*/
|
|
13241
|
+
class QuadTree {
|
|
13242
|
+
/**
|
|
13243
|
+
* @param {World} world - the physic world this QuadTree belongs to
|
|
13244
|
+
* @param {Bounds} bounds - bounds of the node
|
|
13245
|
+
* @param {number} [max_objects=4] - max objects a node can hold before splitting into 4 subnodes
|
|
13246
|
+
* @param {number} [max_levels=4] - total max levels inside root Quadtree
|
|
13247
|
+
* @param {number} [level] - deepth level, required for subnodes
|
|
13248
|
+
*/
|
|
13249
|
+
constructor(world, bounds, max_objects = 4, max_levels = 4, level = 0) {
|
|
13250
|
+
|
|
13251
|
+
this.world = world;
|
|
13252
|
+
this.bounds = bounds;
|
|
13253
|
+
|
|
13254
|
+
this.max_objects = max_objects;
|
|
13255
|
+
this.max_levels = max_levels;
|
|
13256
|
+
|
|
13257
|
+
this.level = level;
|
|
13258
|
+
|
|
13259
|
+
this.objects = [];
|
|
13260
|
+
this.nodes = [];
|
|
13261
|
+
}
|
|
13262
|
+
|
|
13263
|
+
/*
|
|
13264
|
+
* Split the node into 4 subnodes
|
|
13265
|
+
*/
|
|
13266
|
+
split() {
|
|
13267
|
+
var nextLevel = this.level + 1,
|
|
13268
|
+
subWidth = this.bounds.width / 2,
|
|
13269
|
+
subHeight = this.bounds.height / 2,
|
|
13270
|
+
left = this.bounds.left,
|
|
13271
|
+
top = this.bounds.top;
|
|
13272
|
+
|
|
13273
|
+
//top right node
|
|
13274
|
+
this.nodes[0] = QT_ARRAY_POP(
|
|
13275
|
+
this.world,
|
|
13276
|
+
{
|
|
13277
|
+
left : left + subWidth,
|
|
13278
|
+
top : top,
|
|
13279
|
+
width : subWidth,
|
|
13280
|
+
height : subHeight
|
|
13281
|
+
},
|
|
13282
|
+
this.max_objects,
|
|
13283
|
+
this.max_levels,
|
|
13284
|
+
nextLevel
|
|
13285
|
+
);
|
|
13286
|
+
|
|
13287
|
+
//top left node
|
|
13288
|
+
this.nodes[1] = QT_ARRAY_POP(
|
|
13289
|
+
this.world,
|
|
13290
|
+
{
|
|
13291
|
+
left : left,
|
|
13292
|
+
top: top,
|
|
13293
|
+
width : subWidth,
|
|
13294
|
+
height : subHeight
|
|
13295
|
+
},
|
|
13296
|
+
this.max_objects,
|
|
13297
|
+
this.max_levels,
|
|
13298
|
+
nextLevel
|
|
13299
|
+
);
|
|
13300
|
+
|
|
13301
|
+
//bottom left node
|
|
13302
|
+
this.nodes[2] = QT_ARRAY_POP(
|
|
13303
|
+
this.world,
|
|
13304
|
+
{
|
|
13305
|
+
left : left,
|
|
13306
|
+
top : top + subHeight,
|
|
13307
|
+
width : subWidth,
|
|
13308
|
+
height : subHeight
|
|
13309
|
+
},
|
|
13310
|
+
this.max_objects,
|
|
13311
|
+
this.max_levels,
|
|
13312
|
+
nextLevel
|
|
13313
|
+
);
|
|
13314
|
+
|
|
13315
|
+
//bottom right node
|
|
13316
|
+
this.nodes[3] = QT_ARRAY_POP(
|
|
13317
|
+
this.world,
|
|
13318
|
+
{
|
|
13319
|
+
left : left + subWidth,
|
|
13320
|
+
top : top + subHeight,
|
|
13321
|
+
width : subWidth,
|
|
13322
|
+
height : subHeight
|
|
13323
|
+
},
|
|
13324
|
+
this.max_objects,
|
|
13325
|
+
this.max_levels,
|
|
13326
|
+
nextLevel
|
|
13327
|
+
);
|
|
13328
|
+
}
|
|
13329
|
+
|
|
13330
|
+
/*
|
|
13331
|
+
* Determine which node the object belongs to
|
|
13332
|
+
* @param {Rect} rect bounds of the area to be checked
|
|
13333
|
+
* @returns Integer index of the subnode (0-3), or -1 if rect cannot completely fit within a subnode and is part of the parent node
|
|
13334
|
+
*/
|
|
13335
|
+
getIndex(item) {
|
|
13336
|
+
var pos;
|
|
13337
|
+
var bounds = item.getBounds();
|
|
13338
|
+
|
|
13339
|
+
// use game world coordinates for floating items
|
|
13340
|
+
if (item.isFloating === true) {
|
|
13341
|
+
pos = this.world.app.viewport.localToWorld(bounds.left, bounds.top, QT_VECTOR);
|
|
13342
|
+
} else {
|
|
13343
|
+
pos = QT_VECTOR.set(item.left, item.top);
|
|
13344
|
+
}
|
|
13345
|
+
|
|
13346
|
+
var index = -1,
|
|
13347
|
+
rx = pos.x,
|
|
13348
|
+
ry = pos.y,
|
|
13349
|
+
rw = bounds.width,
|
|
13350
|
+
rh = bounds.height,
|
|
13351
|
+
verticalMidpoint = this.bounds.left + (this.bounds.width / 2),
|
|
13352
|
+
horizontalMidpoint = this.bounds.top + (this.bounds.height / 2),
|
|
13353
|
+
//rect can completely fit within the top quadrants
|
|
13354
|
+
topQuadrant = (ry < horizontalMidpoint && ry + rh < horizontalMidpoint),
|
|
13355
|
+
//rect can completely fit within the bottom quadrants
|
|
13356
|
+
bottomQuadrant = (ry > horizontalMidpoint);
|
|
13357
|
+
|
|
13358
|
+
//rect can completely fit within the left quadrants
|
|
13359
|
+
if (rx < verticalMidpoint && rx + rw < verticalMidpoint) {
|
|
13360
|
+
if (topQuadrant) {
|
|
13361
|
+
index = 1;
|
|
13362
|
+
} else if (bottomQuadrant) {
|
|
13363
|
+
index = 2;
|
|
13364
|
+
}
|
|
13365
|
+
} else if (rx > verticalMidpoint) {
|
|
13366
|
+
//rect can completely fit within the right quadrants
|
|
13367
|
+
if (topQuadrant) {
|
|
13368
|
+
index = 0;
|
|
13369
|
+
} else if (bottomQuadrant) {
|
|
13370
|
+
index = 3;
|
|
13371
|
+
}
|
|
13372
|
+
}
|
|
13373
|
+
|
|
13374
|
+
return index;
|
|
13375
|
+
}
|
|
13376
|
+
|
|
13377
|
+
/**
|
|
13378
|
+
* Insert the given object container into the node.
|
|
13379
|
+
* @name insertContainer
|
|
13380
|
+
* @memberof QuadTree
|
|
13381
|
+
* @param {Container} container - group of objects to be added
|
|
13382
|
+
*/
|
|
13383
|
+
insertContainer(container) {
|
|
13384
|
+
for (var i = container.children.length, child; i--, (child = container.children[i]);) {
|
|
13385
|
+
if (child.isKinematic !== true) {
|
|
13386
|
+
if (typeof child.addChild === "function") {
|
|
13387
|
+
if (child.name !== "rootContainer") {
|
|
13388
|
+
this.insert(child);
|
|
13389
|
+
}
|
|
13390
|
+
// recursivly insert all childs
|
|
13391
|
+
this.insertContainer(child);
|
|
13392
|
+
} else {
|
|
13393
|
+
// only insert object with a bounding box
|
|
13394
|
+
// Probably redundant with `isKinematic`
|
|
13395
|
+
if (typeof (child.getBounds) === "function") {
|
|
13396
|
+
this.insert(child);
|
|
13397
|
+
}
|
|
13398
|
+
}
|
|
13399
|
+
}
|
|
13400
|
+
}
|
|
13401
|
+
}
|
|
13402
|
+
|
|
13403
|
+
/**
|
|
13404
|
+
* Insert the given object into the node. If the node
|
|
13405
|
+
* exceeds the capacity, it will split and add all
|
|
13406
|
+
* objects to their corresponding subnodes.
|
|
13407
|
+
* @name insert
|
|
13408
|
+
* @memberof QuadTree
|
|
13409
|
+
* @param {object} item - object to be added
|
|
13410
|
+
*/
|
|
13411
|
+
insert(item) {
|
|
13412
|
+
var index = -1;
|
|
13413
|
+
|
|
13414
|
+
//if we have subnodes ...
|
|
13415
|
+
if (this.nodes.length > 0) {
|
|
13416
|
+
index = this.getIndex(item);
|
|
13417
|
+
|
|
13418
|
+
if (index !== -1) {
|
|
13419
|
+
this.nodes[index].insert(item);
|
|
13420
|
+
return;
|
|
13421
|
+
}
|
|
13422
|
+
}
|
|
13423
|
+
|
|
13424
|
+
this.objects.push(item);
|
|
13425
|
+
|
|
13426
|
+
if (this.objects.length > this.max_objects && this.level < this.max_levels) {
|
|
13427
|
+
|
|
13428
|
+
//split if we don't already have subnodes
|
|
13429
|
+
if (this.nodes.length === 0) {
|
|
13430
|
+
this.split();
|
|
13431
|
+
}
|
|
13432
|
+
|
|
13433
|
+
var i = 0;
|
|
13434
|
+
|
|
13435
|
+
//add all objects to there corresponding subnodes
|
|
13436
|
+
while (i < this.objects.length) {
|
|
13437
|
+
|
|
13438
|
+
index = this.getIndex(this.objects[i]);
|
|
13439
|
+
|
|
13440
|
+
if (index !== -1) {
|
|
13441
|
+
this.nodes[index].insert(this.objects.splice(i, 1)[0]);
|
|
13442
|
+
} else {
|
|
13443
|
+
i = i + 1;
|
|
13444
|
+
}
|
|
13445
|
+
}
|
|
13446
|
+
}
|
|
13447
|
+
}
|
|
13448
|
+
|
|
13449
|
+
/**
|
|
13450
|
+
* Return all objects that could collide with the given object
|
|
13451
|
+
* @name retrieve
|
|
13452
|
+
* @memberof QuadTree
|
|
13453
|
+
* @param {object} item - object to be checked against
|
|
13454
|
+
* @param {object} [fn] - a sorting function for the returned array
|
|
13455
|
+
* @returns {object[]} array with all detected objects
|
|
13456
|
+
*/
|
|
13457
|
+
retrieve(item, fn) {
|
|
13458
|
+
var returnObjects = this.objects;
|
|
13459
|
+
|
|
13460
|
+
//if we have subnodes ...
|
|
13461
|
+
if (this.nodes.length > 0) {
|
|
13462
|
+
|
|
13463
|
+
var index = this.getIndex(item);
|
|
13464
|
+
|
|
13465
|
+
//if rect fits into a subnode ..
|
|
13466
|
+
if (index !== -1) {
|
|
13467
|
+
returnObjects = returnObjects.concat(this.nodes[index].retrieve(item));
|
|
13468
|
+
} else {
|
|
13469
|
+
//if rect does not fit into a subnode, check it against all subnodes
|
|
13470
|
+
for (var i = 0; i < this.nodes.length; i = i + 1) {
|
|
13471
|
+
returnObjects = returnObjects.concat(this.nodes[i].retrieve(item));
|
|
13472
|
+
}
|
|
13473
|
+
}
|
|
13474
|
+
}
|
|
13475
|
+
|
|
13476
|
+
if (typeof(fn) === "function") {
|
|
13477
|
+
returnObjects.sort(fn);
|
|
13478
|
+
}
|
|
13479
|
+
|
|
13480
|
+
return returnObjects;
|
|
13481
|
+
}
|
|
13482
|
+
|
|
13483
|
+
/**
|
|
13484
|
+
* Remove the given item from the quadtree.
|
|
13485
|
+
* (this function won't recalculate the impacted node)
|
|
13486
|
+
* @name remove
|
|
13487
|
+
* @memberof QuadTree
|
|
13488
|
+
* @param {object} item - object to be removed
|
|
13489
|
+
* @returns {boolean} true if the item was found and removed.
|
|
13490
|
+
*/
|
|
13491
|
+
remove(item) {
|
|
13492
|
+
var found = false;
|
|
13493
|
+
|
|
13494
|
+
if (typeof (item.getBounds) === "undefined") {
|
|
13495
|
+
// ignore object that cannot be added in the first place
|
|
13496
|
+
return false;
|
|
13497
|
+
}
|
|
13498
|
+
|
|
13499
|
+
//if we have subnodes ...
|
|
13500
|
+
if (this.nodes.length > 0) {
|
|
13501
|
+
// determine to which node the item belongs to
|
|
13502
|
+
var index = this.getIndex(item);
|
|
13503
|
+
|
|
13504
|
+
if (index !== -1) {
|
|
13505
|
+
found = remove(this.nodes[index], item);
|
|
13506
|
+
// trim node if empty
|
|
13507
|
+
if (found && this.nodes[index].isPrunable()) {
|
|
13508
|
+
this.nodes.splice(index, 1);
|
|
13509
|
+
}
|
|
13510
|
+
}
|
|
13511
|
+
}
|
|
13512
|
+
|
|
13513
|
+
if (found === false) {
|
|
13514
|
+
// try and remove the item from the list of items in this node
|
|
13515
|
+
if (this.objects.indexOf(item) !== -1) {
|
|
13516
|
+
remove(this.objects, item);
|
|
13517
|
+
found = true;
|
|
13518
|
+
}
|
|
13519
|
+
}
|
|
13520
|
+
|
|
13521
|
+
return found;
|
|
13522
|
+
}
|
|
13523
|
+
|
|
13524
|
+
/**
|
|
13525
|
+
* return true if the node is prunable
|
|
13526
|
+
* @name isPrunable
|
|
13527
|
+
* @memberof QuadTree
|
|
13528
|
+
* @returns {boolean} true if the node is prunable
|
|
13529
|
+
*/
|
|
13530
|
+
isPrunable() {
|
|
13531
|
+
return !(this.hasChildren() || (this.objects.length > 0));
|
|
13532
|
+
}
|
|
13533
|
+
|
|
13534
|
+
/**
|
|
13535
|
+
* return true if the node has any children
|
|
13536
|
+
* @name hasChildren
|
|
13537
|
+
* @memberof QuadTree
|
|
13538
|
+
* @returns {boolean} true if the node has any children
|
|
13539
|
+
*/
|
|
13540
|
+
hasChildren() {
|
|
13541
|
+
for (var i = 0; i < this.nodes.length; i = i + 1) {
|
|
13542
|
+
var subnode = this.nodes[i];
|
|
13543
|
+
if (subnode.length > 0 || subnode.objects.length > 0) {
|
|
13544
|
+
return true;
|
|
13545
|
+
}
|
|
13546
|
+
}
|
|
13547
|
+
return false;
|
|
13548
|
+
}
|
|
13549
|
+
|
|
13550
|
+
/**
|
|
13551
|
+
* clear the quadtree
|
|
13552
|
+
* @name clear
|
|
13553
|
+
* @memberof QuadTree
|
|
13554
|
+
* @param {Bounds} [bounds=this.bounds] - the bounds to be cleared
|
|
13555
|
+
*/
|
|
13556
|
+
clear(bounds) {
|
|
13557
|
+
this.objects.length = 0;
|
|
13558
|
+
|
|
13559
|
+
for (var i = 0; i < this.nodes.length; i++) {
|
|
13560
|
+
this.nodes[i].clear();
|
|
13561
|
+
// recycle the quadTree object
|
|
13562
|
+
QT_ARRAY_PUSH(this.nodes[i]);
|
|
13563
|
+
}
|
|
13564
|
+
// empty the array
|
|
13565
|
+
this.nodes.length = 0;
|
|
13566
|
+
|
|
13567
|
+
// resize the root bounds if required
|
|
13568
|
+
if (typeof bounds !== "undefined") {
|
|
13569
|
+
this.bounds.setMinMax(bounds.min.x, bounds.min.y, bounds.max.x, bounds.max.y);
|
|
13570
|
+
}
|
|
13571
|
+
}
|
|
13572
|
+
}
|
|
13573
|
+
|
|
13212
13574
|
/**
|
|
13213
13575
|
* @classdesc
|
|
13214
13576
|
* A Vector2d object that provide notification by executing the given callback when the vector is changed.
|
|
13215
13577
|
* @augments Vector2d
|
|
13216
13578
|
*/
|
|
13217
|
-
class ObservableVector2d extends Vector2d
|
|
13579
|
+
class ObservableVector2d extends Vector2d {
|
|
13218
13580
|
/**
|
|
13219
13581
|
* @param {number} x - x value of the vector
|
|
13220
13582
|
* @param {number} y - y value of the vector
|
|
@@ -13666,13 +14028,11 @@ class ObservableVector2d extends Vector2d$1 {
|
|
|
13666
14028
|
}
|
|
13667
14029
|
}
|
|
13668
14030
|
|
|
13669
|
-
var ObservableVector2d$1 = ObservableVector2d;
|
|
13670
|
-
|
|
13671
14031
|
/**
|
|
13672
14032
|
* @classdesc
|
|
13673
14033
|
* a generic 3D Vector Object
|
|
13674
14034
|
*/
|
|
13675
|
-
class Vector3d {
|
|
14035
|
+
class Vector3d {
|
|
13676
14036
|
/**
|
|
13677
14037
|
* @param {number} [x=0] - x value of the vector
|
|
13678
14038
|
* @param {number} [y=0] - y value of the vector
|
|
@@ -14224,14 +14584,12 @@ class Vector3d {
|
|
|
14224
14584
|
}
|
|
14225
14585
|
}
|
|
14226
14586
|
|
|
14227
|
-
var Vector3d$1 = Vector3d;
|
|
14228
|
-
|
|
14229
14587
|
/**
|
|
14230
14588
|
* @classdesc
|
|
14231
14589
|
* A Vector3d object that provide notification by executing the given callback when the vector is changed.
|
|
14232
14590
|
* @augments Vector3d
|
|
14233
14591
|
*/
|
|
14234
|
-
class ObservableVector3d extends Vector3d
|
|
14592
|
+
class ObservableVector3d extends Vector3d {
|
|
14235
14593
|
/**
|
|
14236
14594
|
* @param {number} x - x value of the vector
|
|
14237
14595
|
* @param {number} y - y value of the vector
|
|
@@ -14773,8 +15131,6 @@ class ObservableVector3d extends Vector3d$1 {
|
|
|
14773
15131
|
}
|
|
14774
15132
|
}
|
|
14775
15133
|
|
|
14776
|
-
var ObservableVector3d$1 = ObservableVector3d;
|
|
14777
|
-
|
|
14778
15134
|
// corresponding actions
|
|
14779
15135
|
var _keyStatus = {};
|
|
14780
15136
|
|
|
@@ -15237,7 +15593,7 @@ function unbindKey(keycode) {
|
|
|
15237
15593
|
* a temporary vector object
|
|
15238
15594
|
* @ignore
|
|
15239
15595
|
*/
|
|
15240
|
-
var tmpVec = new Vector2d
|
|
15596
|
+
var tmpVec = new Vector2d();
|
|
15241
15597
|
|
|
15242
15598
|
/**
|
|
15243
15599
|
* @classdesc
|
|
@@ -15245,7 +15601,7 @@ var tmpVec = new Vector2d$1();
|
|
|
15245
15601
|
* @class Pointer
|
|
15246
15602
|
* @augments Bounds
|
|
15247
15603
|
*/
|
|
15248
|
-
class Pointer extends Bounds
|
|
15604
|
+
class Pointer extends Bounds {
|
|
15249
15605
|
|
|
15250
15606
|
/**
|
|
15251
15607
|
* @ignore
|
|
@@ -15717,7 +16073,7 @@ function enablePointerEvent() {
|
|
|
15717
16073
|
if (!pointerInitialized) {
|
|
15718
16074
|
|
|
15719
16075
|
// the current pointer area
|
|
15720
|
-
currentPointer = new Rect
|
|
16076
|
+
currentPointer = new Rect(0, 0, 1, 1);
|
|
15721
16077
|
|
|
15722
16078
|
// instantiate a pool of pointer catched
|
|
15723
16079
|
for (var v = 0; v < maxTouchPoints; v++) {
|
|
@@ -15888,7 +16244,7 @@ function dispatchEvent(normalizedEvents) {
|
|
|
15888
16244
|
}
|
|
15889
16245
|
|
|
15890
16246
|
// fetch valid candiates from the game world container
|
|
15891
|
-
var candidates = game$1.world.broadphase.retrieve(currentPointer, Container
|
|
16247
|
+
var candidates = game$1.world.broadphase.retrieve(currentPointer, Container.prototype._sortReverseZ);
|
|
15892
16248
|
|
|
15893
16249
|
// add the main game viewport to the list of candidates
|
|
15894
16250
|
candidates = candidates.concat([ game$1.viewport ]);
|
|
@@ -16951,7 +17307,7 @@ var input = /*#__PURE__*/Object.freeze({
|
|
|
16951
17307
|
* A base class for renderable objects.
|
|
16952
17308
|
* @augments Rect
|
|
16953
17309
|
*/
|
|
16954
|
-
class Renderable extends Rect
|
|
17310
|
+
class Renderable extends Rect {
|
|
16955
17311
|
/**
|
|
16956
17312
|
* @param {number} x - position of the renderable object (accessible through inherited pos.x property)
|
|
16957
17313
|
* @param {number} y - position of the renderable object (accessible through inherited pos.y property)
|
|
@@ -17072,7 +17428,7 @@ class Renderable extends Rect$1 {
|
|
|
17072
17428
|
*/
|
|
17073
17429
|
this.floating = false;
|
|
17074
17430
|
|
|
17075
|
-
if (this.anchorPoint instanceof ObservableVector2d
|
|
17431
|
+
if (this.anchorPoint instanceof ObservableVector2d) {
|
|
17076
17432
|
this.anchorPoint.setMuted(0.5, 0.5).setCallback(this.onAnchorUpdate, this);
|
|
17077
17433
|
} else {
|
|
17078
17434
|
/**
|
|
@@ -17164,7 +17520,7 @@ class Renderable extends Rect$1 {
|
|
|
17164
17520
|
*/
|
|
17165
17521
|
this.name = "";
|
|
17166
17522
|
|
|
17167
|
-
if (this.pos instanceof ObservableVector3d
|
|
17523
|
+
if (this.pos instanceof ObservableVector3d) {
|
|
17168
17524
|
this.pos.setMuted(x, y, 0).setCallback(this.updateBoundsPos, this);
|
|
17169
17525
|
} else {
|
|
17170
17526
|
/**
|
|
@@ -17224,7 +17580,7 @@ class Renderable extends Rect$1 {
|
|
|
17224
17580
|
if (typeof this._tint === "undefined") {
|
|
17225
17581
|
this._tint = pool$1.pull("Color", 255, 255, 255, 1.0);
|
|
17226
17582
|
}
|
|
17227
|
-
if (value instanceof Color
|
|
17583
|
+
if (value instanceof Color) {
|
|
17228
17584
|
this._tint.copy(value);
|
|
17229
17585
|
} else {
|
|
17230
17586
|
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
@@ -17497,7 +17853,7 @@ class Renderable extends Rect$1 {
|
|
|
17497
17853
|
*/
|
|
17498
17854
|
|
|
17499
17855
|
// XXX: This is called from the constructor, before it gets an ancestor
|
|
17500
|
-
if (this.ancestor
|
|
17856
|
+
if (typeof this.ancestor !== "undefined" && typeof this.ancestor.addChild === "function" && this.floating !== true) {
|
|
17501
17857
|
bounds.translate(this.ancestor.getAbsolutePosition());
|
|
17502
17858
|
}
|
|
17503
17859
|
|
|
@@ -17514,7 +17870,7 @@ class Renderable extends Rect$1 {
|
|
|
17514
17870
|
}
|
|
17515
17871
|
// XXX Cache me or something
|
|
17516
17872
|
this._absPos.set(this.pos.x, this.pos.y);
|
|
17517
|
-
if (this.ancestor
|
|
17873
|
+
if (typeof this.ancestor !== "undefined" && typeof this.ancestor.addChild === "function" && this.floating !== true) {
|
|
17518
17874
|
this._absPos.add(this.ancestor.getAbsolutePosition());
|
|
17519
17875
|
}
|
|
17520
17876
|
return this._absPos;
|
|
@@ -17710,7 +18066,6 @@ class Renderable extends Rect$1 {
|
|
|
17710
18066
|
}
|
|
17711
18067
|
|
|
17712
18068
|
}
|
|
17713
|
-
var Renderable$1 = Renderable;
|
|
17714
18069
|
|
|
17715
18070
|
/*
|
|
17716
18071
|
* Separating Axis Theorem implementation, based on the SAT.js library by Jim Riecken <jimr@jimr.ca>
|
|
@@ -17742,7 +18097,7 @@ const RIGHT_VORNOI_REGION = 1;
|
|
|
17742
18097
|
* @ignore
|
|
17743
18098
|
*/
|
|
17744
18099
|
var T_VECTORS = [];
|
|
17745
|
-
for (var v = 0; v < 10; v++) { T_VECTORS.push(new Vector2d
|
|
18100
|
+
for (var v = 0; v < 10; v++) { T_VECTORS.push(new Vector2d()); }
|
|
17746
18101
|
|
|
17747
18102
|
/**
|
|
17748
18103
|
* A pool of arrays of numbers used in calculations to avoid allocating memory.
|
|
@@ -18212,8 +18567,8 @@ class ResponseObject {
|
|
|
18212
18567
|
constructor() {
|
|
18213
18568
|
this.a = null;
|
|
18214
18569
|
this.b = null;
|
|
18215
|
-
this.overlapN = new Vector2d
|
|
18216
|
-
this.overlapV = new Vector2d
|
|
18570
|
+
this.overlapN = new Vector2d();
|
|
18571
|
+
this.overlapV = new Vector2d();
|
|
18217
18572
|
this.aInB = true;
|
|
18218
18573
|
this.bInA = true;
|
|
18219
18574
|
this.indexShapeA = -1;
|
|
@@ -18242,17 +18597,17 @@ class ResponseObject {
|
|
|
18242
18597
|
|
|
18243
18598
|
// a dummy object when using Line for raycasting
|
|
18244
18599
|
let dummyObj = {
|
|
18245
|
-
pos : new Vector2d
|
|
18600
|
+
pos : new Vector2d(0, 0),
|
|
18246
18601
|
ancestor : {
|
|
18247
|
-
_absPos : new Vector2d
|
|
18602
|
+
_absPos : new Vector2d(0, 0),
|
|
18248
18603
|
getAbsolutePosition : function () {
|
|
18249
18604
|
return this._absPos;
|
|
18250
18605
|
}
|
|
18251
18606
|
}
|
|
18252
18607
|
};
|
|
18253
18608
|
|
|
18254
|
-
let boundsA = new Bounds
|
|
18255
|
-
let boundsB = new Bounds
|
|
18609
|
+
let boundsA = new Bounds();
|
|
18610
|
+
let boundsB = new Bounds();
|
|
18256
18611
|
|
|
18257
18612
|
// the global response object used for collisions
|
|
18258
18613
|
let globalResponse = new ResponseObject();
|
|
@@ -18260,8 +18615,6 @@ let globalResponse = new ResponseObject();
|
|
|
18260
18615
|
/**
|
|
18261
18616
|
* a function used to determine if two objects should collide (based on both respective objects collision mask and type).<br>
|
|
18262
18617
|
* you can redefine this function if you need any specific rules over what should collide with what.
|
|
18263
|
-
* @name shouldCollide
|
|
18264
|
-
* @memberof collision
|
|
18265
18618
|
* @ignore
|
|
18266
18619
|
* @param {Renderable} a - a reference to the object A.
|
|
18267
18620
|
* @param {Renderable} b - a reference to the object B.
|
|
@@ -18285,7 +18638,6 @@ function shouldCollide(a, b) {
|
|
|
18285
18638
|
|
|
18286
18639
|
/**
|
|
18287
18640
|
* find all the collisions for the specified object
|
|
18288
|
-
* @name collisionCheck
|
|
18289
18641
|
* @ignore
|
|
18290
18642
|
* @param {Renderable} objA - object to be tested for collision
|
|
18291
18643
|
* @param {ResponseObject} [response] - a user defined response object that will be populated if they intersect.
|
|
@@ -18348,7 +18700,6 @@ function collisionCheck(objA, response = globalResponse) {
|
|
|
18348
18700
|
|
|
18349
18701
|
/**
|
|
18350
18702
|
* Checks for object colliding with the given line
|
|
18351
|
-
* @name rayCast
|
|
18352
18703
|
* @ignore
|
|
18353
18704
|
* @param {Line} line - line to be tested for collision
|
|
18354
18705
|
* @param {Array.<Renderable>} [result] - a user defined array that will be populated with intersecting physic objects.
|
|
@@ -18547,7 +18898,7 @@ var collision$1 = collision;
|
|
|
18547
18898
|
* a Generic Physic Body Object with some physic properties and behavior functionality, to as a member of a Renderable.
|
|
18548
18899
|
* @see Renderable.body
|
|
18549
18900
|
*/
|
|
18550
|
-
class Body {
|
|
18901
|
+
class Body {
|
|
18551
18902
|
/**
|
|
18552
18903
|
* @param {Renderable} ancestor - the parent object this body is attached to
|
|
18553
18904
|
* @param {Rect|Rect[]|Polygon|Polygon[]|Line|Line[]|Ellipse|Ellipse[]|Point|Point[]|Bounds|Bounds[]|object} [shapes] - a initial shape, list of shapes, or JSON object defining the body
|
|
@@ -18778,13 +19129,13 @@ class Body {
|
|
|
18778
19129
|
* this.body.addShape(me.loader.getJSON("shapesdef").banana);
|
|
18779
19130
|
*/
|
|
18780
19131
|
addShape(shape) {
|
|
18781
|
-
if (shape instanceof Rect
|
|
19132
|
+
if (shape instanceof Rect || shape instanceof Bounds) {
|
|
18782
19133
|
var poly = shape.toPolygon();
|
|
18783
19134
|
this.shapes.push(poly);
|
|
18784
19135
|
// update the body bounds
|
|
18785
19136
|
this.bounds.add(poly.points);
|
|
18786
19137
|
this.bounds.translate(poly.pos);
|
|
18787
|
-
} else if (shape instanceof Ellipse
|
|
19138
|
+
} else if (shape instanceof Ellipse) {
|
|
18788
19139
|
if (!this.shapes.includes(shape)) {
|
|
18789
19140
|
// see removeShape
|
|
18790
19141
|
this.shapes.push(shape);
|
|
@@ -18796,7 +19147,7 @@ class Body {
|
|
|
18796
19147
|
shape.getBounds().x,
|
|
18797
19148
|
shape.getBounds().y
|
|
18798
19149
|
);
|
|
18799
|
-
} else if (shape instanceof Polygon
|
|
19150
|
+
} else if (shape instanceof Polygon) {
|
|
18800
19151
|
if (!this.shapes.includes(shape)) {
|
|
18801
19152
|
// see removeShape
|
|
18802
19153
|
this.shapes.push(shape);
|
|
@@ -18804,7 +19155,7 @@ class Body {
|
|
|
18804
19155
|
// update the body bounds
|
|
18805
19156
|
this.bounds.add(shape.points);
|
|
18806
19157
|
this.bounds.translate(shape.pos);
|
|
18807
|
-
} else if (shape instanceof Point
|
|
19158
|
+
} else if (shape instanceof Point) {
|
|
18808
19159
|
if (!this.shapes.includes(shape)) {
|
|
18809
19160
|
// see removeShape
|
|
18810
19161
|
this.shapes.push(shape);
|
|
@@ -18831,7 +19182,7 @@ class Body {
|
|
|
18831
19182
|
*/
|
|
18832
19183
|
setVertices(vertices, index = 0, clear = true) {
|
|
18833
19184
|
var polygon = this.getShape(index);
|
|
18834
|
-
if (polygon instanceof Polygon
|
|
19185
|
+
if (polygon instanceof Polygon) {
|
|
18835
19186
|
polygon.setShape(0, 0, vertices);
|
|
18836
19187
|
} else {
|
|
18837
19188
|
// this will replace any other non polygon shape type if defined
|
|
@@ -19095,7 +19446,7 @@ class Body {
|
|
|
19095
19446
|
this.forEach((shape) => {
|
|
19096
19447
|
shape.rotate(angle, v);
|
|
19097
19448
|
this.bounds.addBounds(shape.getBounds());
|
|
19098
|
-
if (shape instanceof Ellipse
|
|
19449
|
+
if (shape instanceof Ellipse) {
|
|
19099
19450
|
// use bounds position as ellipse position is center
|
|
19100
19451
|
this.bounds.translate(
|
|
19101
19452
|
shape.getBounds().x,
|
|
@@ -19225,24 +19576,22 @@ class Body {
|
|
|
19225
19576
|
}
|
|
19226
19577
|
}
|
|
19227
19578
|
|
|
19228
|
-
var Body$1 = Body;
|
|
19229
|
-
|
|
19230
19579
|
/**
|
|
19231
19580
|
* Private function to re-use for object removal in a defer
|
|
19232
19581
|
* @ignore
|
|
19233
19582
|
*/
|
|
19234
|
-
|
|
19583
|
+
function deferredRemove(child, keepalive) {
|
|
19235
19584
|
this.removeChildNow(child, keepalive);
|
|
19236
|
-
}
|
|
19585
|
+
}
|
|
19237
19586
|
|
|
19238
|
-
|
|
19587
|
+
let globalFloatingCounter = 0;
|
|
19239
19588
|
|
|
19240
19589
|
/**
|
|
19241
19590
|
* @classdesc
|
|
19242
19591
|
* Container represents a collection of child objects
|
|
19243
19592
|
* @augments Renderable
|
|
19244
19593
|
*/
|
|
19245
|
-
class Container extends Renderable
|
|
19594
|
+
class Container extends Renderable {
|
|
19246
19595
|
/**
|
|
19247
19596
|
* @param {number} [x=0] - position of the container (accessible via the inherited pos.x property)
|
|
19248
19597
|
* @param {number} [y=0] - position of the container (accessible via the inherited pos.y property)
|
|
@@ -19466,7 +19815,7 @@ class Container extends Renderable$1 {
|
|
|
19466
19815
|
}
|
|
19467
19816
|
|
|
19468
19817
|
// if a physic body is defined, add it to the game world
|
|
19469
|
-
if (child.body instanceof Body
|
|
19818
|
+
if (child.body instanceof Body) {
|
|
19470
19819
|
game$1.world.addBody(child.body);
|
|
19471
19820
|
}
|
|
19472
19821
|
|
|
@@ -19517,7 +19866,7 @@ class Container extends Renderable$1 {
|
|
|
19517
19866
|
}
|
|
19518
19867
|
|
|
19519
19868
|
// if a physic body is defined, add it to the game world
|
|
19520
|
-
if (child.body instanceof Body
|
|
19869
|
+
if (child.body instanceof Body) {
|
|
19521
19870
|
game$1.world.addBody(child.body);
|
|
19522
19871
|
}
|
|
19523
19872
|
|
|
@@ -19891,7 +20240,7 @@ class Container extends Renderable$1 {
|
|
|
19891
20240
|
|
|
19892
20241
|
// remove the body first to avoid a condition where a body can be detached
|
|
19893
20242
|
// from its parent, before the body is removed from the game world
|
|
19894
|
-
if (child.body instanceof Body
|
|
20243
|
+
if (child.body instanceof Body) {
|
|
19895
20244
|
game$1.world.removeBody(child.body);
|
|
19896
20245
|
}
|
|
19897
20246
|
|
|
@@ -20227,393 +20576,12 @@ class Container extends Renderable$1 {
|
|
|
20227
20576
|
}
|
|
20228
20577
|
}
|
|
20229
20578
|
|
|
20230
|
-
var Container$1 = Container;
|
|
20231
|
-
|
|
20232
|
-
/*
|
|
20233
|
-
* A QuadTree implementation in JavaScript, a 2d spatial subdivision algorithm.
|
|
20234
|
-
* Based on the QuadTree Library by Timo Hausmann and released under the MIT license
|
|
20235
|
-
* https://github.com/timohausmann/quadtree-js/
|
|
20236
|
-
**/
|
|
20237
|
-
|
|
20238
|
-
|
|
20239
|
-
/**
|
|
20240
|
-
* a pool of `QuadTree` objects
|
|
20241
|
-
* @ignore
|
|
20242
|
-
*/
|
|
20243
|
-
var QT_ARRAY = [];
|
|
20244
|
-
|
|
20245
|
-
/**
|
|
20246
|
-
* will pop a quadtree object from the array
|
|
20247
|
-
* or create a new one if the array is empty
|
|
20248
|
-
* @ignore
|
|
20249
|
-
*/
|
|
20250
|
-
function QT_ARRAY_POP(world, bounds, max_objects = 4, max_levels = 4, level = 0) {
|
|
20251
|
-
if (QT_ARRAY.length > 0) {
|
|
20252
|
-
var _qt = QT_ARRAY.pop();
|
|
20253
|
-
_qt.world = world;
|
|
20254
|
-
_qt.bounds = bounds;
|
|
20255
|
-
_qt.max_objects = max_objects;
|
|
20256
|
-
_qt.max_levels = max_levels;
|
|
20257
|
-
_qt.level = level;
|
|
20258
|
-
return _qt;
|
|
20259
|
-
} else {
|
|
20260
|
-
return new QuadTree(world, bounds, max_objects, max_levels, level);
|
|
20261
|
-
}
|
|
20262
|
-
}
|
|
20263
|
-
|
|
20264
|
-
/**
|
|
20265
|
-
* Push back a quadtree back into the array
|
|
20266
|
-
* @ignore
|
|
20267
|
-
*/
|
|
20268
|
-
function QT_ARRAY_PUSH(qt) {
|
|
20269
|
-
QT_ARRAY.push(qt);
|
|
20270
|
-
}
|
|
20271
|
-
|
|
20272
|
-
/**
|
|
20273
|
-
* a temporary vector object to be reused
|
|
20274
|
-
* @ignore
|
|
20275
|
-
*/
|
|
20276
|
-
var QT_VECTOR = new Vector2d$1();
|
|
20277
|
-
|
|
20278
|
-
/**
|
|
20279
|
-
* @classdesc
|
|
20280
|
-
* a QuadTree implementation in JavaScript, a 2d spatial subdivision algorithm.
|
|
20281
|
-
* @see game.world.broadphase
|
|
20282
|
-
*/
|
|
20283
|
-
class QuadTree {
|
|
20284
|
-
/**
|
|
20285
|
-
* @param {World} world - the physic world this QuadTree belongs to
|
|
20286
|
-
* @param {Bounds} bounds - bounds of the node
|
|
20287
|
-
* @param {number} [max_objects=4] - max objects a node can hold before splitting into 4 subnodes
|
|
20288
|
-
* @param {number} [max_levels=4] - total max levels inside root Quadtree
|
|
20289
|
-
* @param {number} [level] - deepth level, required for subnodes
|
|
20290
|
-
*/
|
|
20291
|
-
constructor(world, bounds, max_objects = 4, max_levels = 4, level = 0) {
|
|
20292
|
-
|
|
20293
|
-
this.world = world;
|
|
20294
|
-
this.bounds = bounds;
|
|
20295
|
-
|
|
20296
|
-
this.max_objects = max_objects;
|
|
20297
|
-
this.max_levels = max_levels;
|
|
20298
|
-
|
|
20299
|
-
this.level = level;
|
|
20300
|
-
this.bounds = bounds;
|
|
20301
|
-
|
|
20302
|
-
this.objects = [];
|
|
20303
|
-
this.nodes = [];
|
|
20304
|
-
}
|
|
20305
|
-
|
|
20306
|
-
/*
|
|
20307
|
-
* Split the node into 4 subnodes
|
|
20308
|
-
*/
|
|
20309
|
-
split() {
|
|
20310
|
-
this.level + 1;
|
|
20311
|
-
var subWidth = this.bounds.width / 2,
|
|
20312
|
-
subHeight = this.bounds.height / 2,
|
|
20313
|
-
left = this.bounds.left,
|
|
20314
|
-
top = this.bounds.top;
|
|
20315
|
-
|
|
20316
|
-
//top right node
|
|
20317
|
-
this.nodes[0] = QT_ARRAY_POP(
|
|
20318
|
-
this.world,
|
|
20319
|
-
this.bounds, {
|
|
20320
|
-
left : left + subWidth,
|
|
20321
|
-
top : top,
|
|
20322
|
-
width : subWidth,
|
|
20323
|
-
height : subHeight
|
|
20324
|
-
},
|
|
20325
|
-
this.max_objects,
|
|
20326
|
-
this.max_levels);
|
|
20327
|
-
|
|
20328
|
-
//top left node
|
|
20329
|
-
this.nodes[1] = QT_ARRAY_POP(
|
|
20330
|
-
this.world,
|
|
20331
|
-
this.bounds, {
|
|
20332
|
-
left : left,
|
|
20333
|
-
top: top,
|
|
20334
|
-
width : subWidth,
|
|
20335
|
-
height : subHeight
|
|
20336
|
-
},
|
|
20337
|
-
this.max_objects,
|
|
20338
|
-
this.max_levels);
|
|
20339
|
-
|
|
20340
|
-
//bottom left node
|
|
20341
|
-
this.nodes[2] = QT_ARRAY_POP(
|
|
20342
|
-
this.world,
|
|
20343
|
-
this.bounds, {
|
|
20344
|
-
left : left,
|
|
20345
|
-
top : top + subHeight,
|
|
20346
|
-
width : subWidth,
|
|
20347
|
-
height : subHeight
|
|
20348
|
-
},
|
|
20349
|
-
this.max_objects,
|
|
20350
|
-
this.max_levels);
|
|
20351
|
-
|
|
20352
|
-
//bottom right node
|
|
20353
|
-
this.nodes[3] = QT_ARRAY_POP(
|
|
20354
|
-
this.world,
|
|
20355
|
-
this.bounds, {
|
|
20356
|
-
left : left + subWidth,
|
|
20357
|
-
top : top + subHeight,
|
|
20358
|
-
width : subWidth,
|
|
20359
|
-
height : subHeight
|
|
20360
|
-
},
|
|
20361
|
-
this.max_objects,
|
|
20362
|
-
this.max_levels);
|
|
20363
|
-
}
|
|
20364
|
-
|
|
20365
|
-
/*
|
|
20366
|
-
* Determine which node the object belongs to
|
|
20367
|
-
* @param {Rect} rect bounds of the area to be checked
|
|
20368
|
-
* @returns Integer index of the subnode (0-3), or -1 if rect cannot completely fit within a subnode and is part of the parent node
|
|
20369
|
-
*/
|
|
20370
|
-
getIndex(item) {
|
|
20371
|
-
var pos;
|
|
20372
|
-
var bounds = item.getBounds();
|
|
20373
|
-
|
|
20374
|
-
// use game world coordinates for floating items
|
|
20375
|
-
if (item.isFloating === true) {
|
|
20376
|
-
pos = this.world.app.viewport.localToWorld(bounds.left, bounds.top, QT_VECTOR);
|
|
20377
|
-
} else {
|
|
20378
|
-
pos = QT_VECTOR.set(bounds.left, bounds.top);
|
|
20379
|
-
}
|
|
20380
|
-
|
|
20381
|
-
var index = -1,
|
|
20382
|
-
rx = pos.x,
|
|
20383
|
-
ry = pos.y,
|
|
20384
|
-
rw = bounds.width,
|
|
20385
|
-
rh = bounds.height,
|
|
20386
|
-
verticalMidpoint = this.bounds.left + (this.bounds.width / 2),
|
|
20387
|
-
horizontalMidpoint = this.bounds.top + (this.bounds.height / 2),
|
|
20388
|
-
//rect can completely fit within the top quadrants
|
|
20389
|
-
topQuadrant = (ry < horizontalMidpoint && ry + rh < horizontalMidpoint),
|
|
20390
|
-
//rect can completely fit within the bottom quadrants
|
|
20391
|
-
bottomQuadrant = (ry > horizontalMidpoint);
|
|
20392
|
-
|
|
20393
|
-
//rect can completely fit within the left quadrants
|
|
20394
|
-
if (rx < verticalMidpoint && rx + rw < verticalMidpoint) {
|
|
20395
|
-
if (topQuadrant) {
|
|
20396
|
-
index = 1;
|
|
20397
|
-
} else if (bottomQuadrant) {
|
|
20398
|
-
index = 2;
|
|
20399
|
-
}
|
|
20400
|
-
} else if (rx > verticalMidpoint) {
|
|
20401
|
-
//rect can completely fit within the right quadrants
|
|
20402
|
-
if (topQuadrant) {
|
|
20403
|
-
index = 0;
|
|
20404
|
-
} else if (bottomQuadrant) {
|
|
20405
|
-
index = 3;
|
|
20406
|
-
}
|
|
20407
|
-
}
|
|
20408
|
-
|
|
20409
|
-
return index;
|
|
20410
|
-
}
|
|
20411
|
-
|
|
20412
|
-
/**
|
|
20413
|
-
* Insert the given object container into the node.
|
|
20414
|
-
* @name insertContainer
|
|
20415
|
-
* @memberof QuadTree
|
|
20416
|
-
* @param {Container} container - group of objects to be added
|
|
20417
|
-
*/
|
|
20418
|
-
insertContainer(container) {
|
|
20419
|
-
for (var i = container.children.length, child; i--, (child = container.children[i]);) {
|
|
20420
|
-
if (child.isKinematic !== true) {
|
|
20421
|
-
if (child instanceof Container$1) {
|
|
20422
|
-
if (child.name !== "rootContainer") {
|
|
20423
|
-
this.insert(child);
|
|
20424
|
-
}
|
|
20425
|
-
// recursivly insert all childs
|
|
20426
|
-
this.insertContainer(child);
|
|
20427
|
-
} else {
|
|
20428
|
-
// only insert object with a bounding box
|
|
20429
|
-
// Probably redundant with `isKinematic`
|
|
20430
|
-
if (typeof (child.getBounds) === "function") {
|
|
20431
|
-
this.insert(child);
|
|
20432
|
-
}
|
|
20433
|
-
}
|
|
20434
|
-
}
|
|
20435
|
-
}
|
|
20436
|
-
}
|
|
20437
|
-
|
|
20438
|
-
/**
|
|
20439
|
-
* Insert the given object into the node. If the node
|
|
20440
|
-
* exceeds the capacity, it will split and add all
|
|
20441
|
-
* objects to their corresponding subnodes.
|
|
20442
|
-
* @name insert
|
|
20443
|
-
* @memberof QuadTree
|
|
20444
|
-
* @param {object} item - object to be added
|
|
20445
|
-
*/
|
|
20446
|
-
insert(item) {
|
|
20447
|
-
var index = -1;
|
|
20448
|
-
|
|
20449
|
-
//if we have subnodes ...
|
|
20450
|
-
if (this.nodes.length > 0) {
|
|
20451
|
-
index = this.getIndex(item);
|
|
20452
|
-
|
|
20453
|
-
if (index !== -1) {
|
|
20454
|
-
this.nodes[index].insert(item);
|
|
20455
|
-
return;
|
|
20456
|
-
}
|
|
20457
|
-
}
|
|
20458
|
-
|
|
20459
|
-
this.objects.push(item);
|
|
20460
|
-
|
|
20461
|
-
if (this.objects.length > this.max_objects && this.level < this.max_levels) {
|
|
20462
|
-
|
|
20463
|
-
//split if we don't already have subnodes
|
|
20464
|
-
if (this.nodes.length === 0) {
|
|
20465
|
-
this.split();
|
|
20466
|
-
}
|
|
20467
|
-
|
|
20468
|
-
var i = 0;
|
|
20469
|
-
|
|
20470
|
-
//add all objects to there corresponding subnodes
|
|
20471
|
-
while (i < this.objects.length) {
|
|
20472
|
-
|
|
20473
|
-
index = this.getIndex(this.objects[i]);
|
|
20474
|
-
|
|
20475
|
-
if (index !== -1) {
|
|
20476
|
-
this.nodes[index].insert(this.objects.splice(i, 1)[0]);
|
|
20477
|
-
} else {
|
|
20478
|
-
i = i + 1;
|
|
20479
|
-
}
|
|
20480
|
-
}
|
|
20481
|
-
}
|
|
20482
|
-
}
|
|
20483
|
-
|
|
20484
|
-
/**
|
|
20485
|
-
* Return all objects that could collide with the given object
|
|
20486
|
-
* @name retrieve
|
|
20487
|
-
* @memberof QuadTree
|
|
20488
|
-
* @param {object} item - object to be checked against
|
|
20489
|
-
* @param {object} [fn] - a sorting function for the returned array
|
|
20490
|
-
* @returns {object[]} array with all detected objects
|
|
20491
|
-
*/
|
|
20492
|
-
retrieve(item, fn) {
|
|
20493
|
-
var returnObjects = this.objects;
|
|
20494
|
-
|
|
20495
|
-
//if we have subnodes ...
|
|
20496
|
-
if (this.nodes.length > 0) {
|
|
20497
|
-
|
|
20498
|
-
var index = this.getIndex(item);
|
|
20499
|
-
|
|
20500
|
-
//if rect fits into a subnode ..
|
|
20501
|
-
if (index !== -1) {
|
|
20502
|
-
returnObjects = returnObjects.concat(this.nodes[index].retrieve(item));
|
|
20503
|
-
} else {
|
|
20504
|
-
//if rect does not fit into a subnode, check it against all subnodes
|
|
20505
|
-
for (var i = 0; i < this.nodes.length; i = i + 1) {
|
|
20506
|
-
returnObjects = returnObjects.concat(this.nodes[i].retrieve(item));
|
|
20507
|
-
}
|
|
20508
|
-
}
|
|
20509
|
-
}
|
|
20510
|
-
|
|
20511
|
-
if (typeof(fn) === "function") {
|
|
20512
|
-
returnObjects.sort(fn);
|
|
20513
|
-
}
|
|
20514
|
-
|
|
20515
|
-
return returnObjects;
|
|
20516
|
-
}
|
|
20517
|
-
|
|
20518
|
-
/**
|
|
20519
|
-
* Remove the given item from the quadtree.
|
|
20520
|
-
* (this function won't recalculate the impacted node)
|
|
20521
|
-
* @name remove
|
|
20522
|
-
* @memberof QuadTree
|
|
20523
|
-
* @param {object} item - object to be removed
|
|
20524
|
-
* @returns {boolean} true if the item was found and removed.
|
|
20525
|
-
*/
|
|
20526
|
-
remove(item) {
|
|
20527
|
-
var found = false;
|
|
20528
|
-
|
|
20529
|
-
if (typeof (item.getBounds) === "undefined") {
|
|
20530
|
-
// ignore object that cannot be added in the first place
|
|
20531
|
-
return false;
|
|
20532
|
-
}
|
|
20533
|
-
|
|
20534
|
-
//if we have subnodes ...
|
|
20535
|
-
if (this.nodes.length > 0) {
|
|
20536
|
-
// determine to which node the item belongs to
|
|
20537
|
-
var index = this.getIndex(item);
|
|
20538
|
-
|
|
20539
|
-
if (index !== -1) {
|
|
20540
|
-
found = remove(this.nodes[index], item);
|
|
20541
|
-
// trim node if empty
|
|
20542
|
-
if (found && this.nodes[index].isPrunable()) {
|
|
20543
|
-
this.nodes.splice(index, 1);
|
|
20544
|
-
}
|
|
20545
|
-
}
|
|
20546
|
-
}
|
|
20547
|
-
|
|
20548
|
-
if (found === false) {
|
|
20549
|
-
// try and remove the item from the list of items in this node
|
|
20550
|
-
if (this.objects.indexOf(item) !== -1) {
|
|
20551
|
-
remove(this.objects, item);
|
|
20552
|
-
found = true;
|
|
20553
|
-
}
|
|
20554
|
-
}
|
|
20555
|
-
|
|
20556
|
-
return found;
|
|
20557
|
-
}
|
|
20558
|
-
|
|
20559
|
-
/**
|
|
20560
|
-
* return true if the node is prunable
|
|
20561
|
-
* @name isPrunable
|
|
20562
|
-
* @memberof QuadTree
|
|
20563
|
-
* @returns {boolean} true if the node is prunable
|
|
20564
|
-
*/
|
|
20565
|
-
isPrunable() {
|
|
20566
|
-
return !(this.hasChildren() || (this.objects.length > 0));
|
|
20567
|
-
}
|
|
20568
|
-
|
|
20569
|
-
/**
|
|
20570
|
-
* return true if the node has any children
|
|
20571
|
-
* @name hasChildren
|
|
20572
|
-
* @memberof QuadTree
|
|
20573
|
-
* @returns {boolean} true if the node has any children
|
|
20574
|
-
*/
|
|
20575
|
-
hasChildren() {
|
|
20576
|
-
for (var i = 0; i < this.nodes.length; i = i + 1) {
|
|
20577
|
-
var subnode = this.nodes[i];
|
|
20578
|
-
if (subnode.length > 0 || subnode.objects.length > 0) {
|
|
20579
|
-
return true;
|
|
20580
|
-
}
|
|
20581
|
-
}
|
|
20582
|
-
return false;
|
|
20583
|
-
}
|
|
20584
|
-
|
|
20585
|
-
/**
|
|
20586
|
-
* clear the quadtree
|
|
20587
|
-
* @name clear
|
|
20588
|
-
* @memberof QuadTree
|
|
20589
|
-
* @param {Bounds} [bounds=this.bounds] - the bounds to be cleared
|
|
20590
|
-
*/
|
|
20591
|
-
clear(bounds) {
|
|
20592
|
-
this.objects.length = 0;
|
|
20593
|
-
|
|
20594
|
-
for (var i = 0; i < this.nodes.length; i++) {
|
|
20595
|
-
this.nodes[i].clear();
|
|
20596
|
-
// recycle the quadTree object
|
|
20597
|
-
QT_ARRAY_PUSH(this.nodes[i]);
|
|
20598
|
-
}
|
|
20599
|
-
// empty the array
|
|
20600
|
-
this.nodes.length = 0;
|
|
20601
|
-
|
|
20602
|
-
// resize the root bounds if required
|
|
20603
|
-
if (typeof bounds !== "undefined") {
|
|
20604
|
-
this.bounds.setMinMax(bounds.min.x, bounds.min.y, bounds.max.x, bounds.max.y);
|
|
20605
|
-
}
|
|
20606
|
-
}
|
|
20607
|
-
}
|
|
20608
|
-
|
|
20609
|
-
var QuadTree$1 = QuadTree;
|
|
20610
|
-
|
|
20611
20579
|
/**
|
|
20612
20580
|
* @classdesc
|
|
20613
20581
|
* an object representing the physic world, and responsible for managing and updating all childs and physics
|
|
20614
20582
|
* @augments Container
|
|
20615
20583
|
*/
|
|
20616
|
-
class World extends Container
|
|
20584
|
+
class World extends Container {
|
|
20617
20585
|
/**
|
|
20618
20586
|
* @param {number} [x=0] - position of the container (accessible via the inherited pos.x property)
|
|
20619
20587
|
* @param {number} [y=0] - position of the container (accessible via the inherited pos.y property)
|
|
@@ -20657,7 +20625,7 @@ class World extends Container$1 {
|
|
|
20657
20625
|
* @name gravity
|
|
20658
20626
|
* @memberof World
|
|
20659
20627
|
*/
|
|
20660
|
-
this.gravity = new Vector2d
|
|
20628
|
+
this.gravity = new Vector2d(0, 0.98);
|
|
20661
20629
|
|
|
20662
20630
|
/**
|
|
20663
20631
|
* Specify the rendering method for tile layers. <br>
|
|
@@ -20689,7 +20657,7 @@ class World extends Container$1 {
|
|
|
20689
20657
|
* @public
|
|
20690
20658
|
* @type {QuadTree}
|
|
20691
20659
|
*/
|
|
20692
|
-
this.broadphase = new QuadTree
|
|
20660
|
+
this.broadphase = new QuadTree(this, this.getBounds().clone(), collision$1.maxChildren, collision$1.maxDepth);
|
|
20693
20661
|
|
|
20694
20662
|
// reset the world container on the game reset signal
|
|
20695
20663
|
on(GAME_RESET, this.reset, this);
|
|
@@ -20811,15 +20779,13 @@ class World extends Container$1 {
|
|
|
20811
20779
|
|
|
20812
20780
|
}
|
|
20813
20781
|
|
|
20814
|
-
var World$1 = World;
|
|
20815
|
-
|
|
20816
20782
|
/**
|
|
20817
20783
|
* @classdesc
|
|
20818
20784
|
* An Application represents a single melonJS game.
|
|
20819
20785
|
* An Application is responsible for updating (each frame) all the related object status and draw them.
|
|
20820
20786
|
* @see game
|
|
20821
20787
|
*/
|
|
20822
|
-
class Application {
|
|
20788
|
+
class Application {
|
|
20823
20789
|
constructor() {
|
|
20824
20790
|
/**
|
|
20825
20791
|
* a reference to the current active stage "default" camera
|
|
@@ -20894,7 +20860,7 @@ class Application {
|
|
|
20894
20860
|
*/
|
|
20895
20861
|
init() {
|
|
20896
20862
|
// create a new physic world
|
|
20897
|
-
this.world = new World
|
|
20863
|
+
this.world = new World();
|
|
20898
20864
|
// set the reference to this application instance
|
|
20899
20865
|
this.world.app = this;
|
|
20900
20866
|
this.lastUpdate = globalThis.performance.now();
|
|
@@ -21037,8 +21003,6 @@ class Application {
|
|
|
21037
21003
|
}
|
|
21038
21004
|
}
|
|
21039
21005
|
|
|
21040
|
-
var Application$1 = Application;
|
|
21041
|
-
|
|
21042
21006
|
/**
|
|
21043
21007
|
* game is a default instance of a melonJS Application and represents your current game,
|
|
21044
21008
|
* it contains all the objects, tilemap layers, current viewport, collision map, etc...<br>
|
|
@@ -21047,7 +21011,7 @@ var Application$1 = Application;
|
|
|
21047
21011
|
*/
|
|
21048
21012
|
|
|
21049
21013
|
// create a default melonJS application instance
|
|
21050
|
-
let game = new Application
|
|
21014
|
+
let game = new Application();
|
|
21051
21015
|
|
|
21052
21016
|
// initialize the game manager on system boot
|
|
21053
21017
|
on(BOOT, () => {
|
|
@@ -21060,14 +21024,14 @@ var game$1 = game;
|
|
|
21060
21024
|
// some ref shortcut
|
|
21061
21025
|
const MIN = Math.min, MAX = Math.max;
|
|
21062
21026
|
|
|
21063
|
-
var targetV = new Vector2d
|
|
21027
|
+
var targetV = new Vector2d();
|
|
21064
21028
|
|
|
21065
21029
|
/**
|
|
21066
21030
|
* @classdesc
|
|
21067
21031
|
* a 2D orthographic camera
|
|
21068
21032
|
* @augments Renderable
|
|
21069
21033
|
*/
|
|
21070
|
-
class Camera2d extends Renderable
|
|
21034
|
+
class Camera2d extends Renderable {
|
|
21071
21035
|
/**
|
|
21072
21036
|
* @param {number} minX - start x offset
|
|
21073
21037
|
* @param {number} minY - start y offset
|
|
@@ -21150,7 +21114,7 @@ class Camera2d extends Renderable$1 {
|
|
|
21150
21114
|
* @name projectionMatrix
|
|
21151
21115
|
* @memberof Camera2d
|
|
21152
21116
|
*/
|
|
21153
|
-
this.projectionMatrix = new Matrix3d
|
|
21117
|
+
this.projectionMatrix = new Matrix3d();
|
|
21154
21118
|
|
|
21155
21119
|
/**
|
|
21156
21120
|
* the invert camera transform used to unproject points
|
|
@@ -21159,10 +21123,10 @@ class Camera2d extends Renderable$1 {
|
|
|
21159
21123
|
* @name invCurrentTransform
|
|
21160
21124
|
* @memberof Camera2d
|
|
21161
21125
|
*/
|
|
21162
|
-
this.invCurrentTransform = new Matrix2d
|
|
21126
|
+
this.invCurrentTransform = new Matrix2d();
|
|
21163
21127
|
|
|
21164
21128
|
// offset for shake effect
|
|
21165
|
-
this.offset = new Vector2d
|
|
21129
|
+
this.offset = new Vector2d();
|
|
21166
21130
|
|
|
21167
21131
|
// target to follow
|
|
21168
21132
|
this.target = null;
|
|
@@ -21286,7 +21250,7 @@ class Camera2d extends Renderable$1 {
|
|
|
21286
21250
|
*/
|
|
21287
21251
|
setDeadzone(w, h) {
|
|
21288
21252
|
if (typeof(this.deadzone) === "undefined") {
|
|
21289
|
-
this.deadzone = new Rect
|
|
21253
|
+
this.deadzone = new Rect(0, 0, 0, 0);
|
|
21290
21254
|
}
|
|
21291
21255
|
|
|
21292
21256
|
// reusing the old code for now...
|
|
@@ -21365,11 +21329,11 @@ class Camera2d extends Renderable$1 {
|
|
|
21365
21329
|
* me.game.viewport.follow(this, me.game.viewport.AXIS.BOTH, 0.1);
|
|
21366
21330
|
*/
|
|
21367
21331
|
follow(target, axis, damping) {
|
|
21368
|
-
if (target instanceof Renderable
|
|
21332
|
+
if (target instanceof Renderable) {
|
|
21369
21333
|
this.target = target.pos;
|
|
21370
21334
|
}
|
|
21371
|
-
else if ((target instanceof Vector2d
|
|
21372
|
-
(target instanceof ObservableVector2d
|
|
21335
|
+
else if ((target instanceof Vector2d) || (target instanceof Vector3d) ||
|
|
21336
|
+
(target instanceof ObservableVector2d) || (target instanceof ObservableVector3d)) {
|
|
21373
21337
|
this.target = target;
|
|
21374
21338
|
}
|
|
21375
21339
|
else {
|
|
@@ -21765,7 +21729,6 @@ class Camera2d extends Renderable$1 {
|
|
|
21765
21729
|
}
|
|
21766
21730
|
|
|
21767
21731
|
}
|
|
21768
|
-
var Camera2d$1 = Camera2d;
|
|
21769
21732
|
|
|
21770
21733
|
// a default camera instance to use across all stages
|
|
21771
21734
|
var default_camera;
|
|
@@ -21782,7 +21745,7 @@ var default_settings = {
|
|
|
21782
21745
|
* through the state manager must inherit from this base class.
|
|
21783
21746
|
* @see state
|
|
21784
21747
|
*/
|
|
21785
|
-
class Stage {
|
|
21748
|
+
class Stage {
|
|
21786
21749
|
|
|
21787
21750
|
/**
|
|
21788
21751
|
* @param {object} [settings] - The stage` parameters
|
|
@@ -21834,7 +21797,7 @@ class Stage {
|
|
|
21834
21797
|
* @default "#000000"
|
|
21835
21798
|
* @see Light2d
|
|
21836
21799
|
*/
|
|
21837
|
-
this.ambientLight = new Color
|
|
21800
|
+
this.ambientLight = new Color(0, 0, 0, 0);
|
|
21838
21801
|
|
|
21839
21802
|
/**
|
|
21840
21803
|
* The given constructor options
|
|
@@ -21863,7 +21826,7 @@ class Stage {
|
|
|
21863
21826
|
var width = renderer.getWidth();
|
|
21864
21827
|
var height = renderer.getHeight();
|
|
21865
21828
|
// new default camera instance
|
|
21866
|
-
default_camera = new Camera2d
|
|
21829
|
+
default_camera = new Camera2d(0, 0, width, height);
|
|
21867
21830
|
}
|
|
21868
21831
|
this.cameras.set("default", default_camera);
|
|
21869
21832
|
}
|
|
@@ -21989,13 +21952,12 @@ class Stage {
|
|
|
21989
21952
|
}
|
|
21990
21953
|
}
|
|
21991
21954
|
}
|
|
21992
|
-
var Stage$1 = Stage;
|
|
21993
21955
|
|
|
21994
21956
|
var img = "data:image/png;base64,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";
|
|
21995
21957
|
var logo_url = img;
|
|
21996
21958
|
|
|
21997
21959
|
// a basic progress bar object
|
|
21998
|
-
class ProgressBar extends Renderable
|
|
21960
|
+
class ProgressBar extends Renderable {
|
|
21999
21961
|
/**
|
|
22000
21962
|
* @ignore
|
|
22001
21963
|
*/
|
|
@@ -22052,7 +22014,7 @@ class ProgressBar extends Renderable$1 {
|
|
|
22052
22014
|
* a default loading screen
|
|
22053
22015
|
* @ignore
|
|
22054
22016
|
*/
|
|
22055
|
-
class DefaultLoadingScreen extends Stage
|
|
22017
|
+
class DefaultLoadingScreen extends Stage {
|
|
22056
22018
|
/**
|
|
22057
22019
|
* call when the loader is resetted
|
|
22058
22020
|
* @ignore
|
|
@@ -22074,7 +22036,7 @@ class DefaultLoadingScreen extends Stage$1 {
|
|
|
22074
22036
|
// load the melonJS logo
|
|
22075
22037
|
loader$1.load({name: "melonjs_logo", type: "image", src: logo_url}, () => {
|
|
22076
22038
|
// melonJS logo
|
|
22077
|
-
game$1.world.addChild(new Sprite
|
|
22039
|
+
game$1.world.addChild(new Sprite(
|
|
22078
22040
|
renderer.getWidth() / 2,
|
|
22079
22041
|
renderer.getHeight() / 2, {
|
|
22080
22042
|
image : "melonjs_logo",
|
|
@@ -22226,7 +22188,7 @@ on(BOOT, () => {
|
|
|
22226
22188
|
// set the built-in loading stage
|
|
22227
22189
|
state.set(state.LOADING, new DefaultLoadingScreen$1());
|
|
22228
22190
|
// set and enable the default stage
|
|
22229
|
-
state.set(state.DEFAULT, new Stage
|
|
22191
|
+
state.set(state.DEFAULT, new Stage());
|
|
22230
22192
|
// enable by default as soon as the display is initialized
|
|
22231
22193
|
on(VIDEO_INIT, () => {
|
|
22232
22194
|
state.change(state.DEFAULT, true);
|
|
@@ -22539,7 +22501,7 @@ var state = {
|
|
|
22539
22501
|
* me.state.set(me.state.MENU, new MenuScreen());
|
|
22540
22502
|
*/
|
|
22541
22503
|
set(state, stage, start = false) {
|
|
22542
|
-
if (!(stage instanceof Stage
|
|
22504
|
+
if (!(stage instanceof Stage)) {
|
|
22543
22505
|
throw new Error(stage + " is not an instance of me.Stage");
|
|
22544
22506
|
}
|
|
22545
22507
|
_stages[state] = {};
|
|
@@ -23045,7 +23007,7 @@ const TMX_FLIP_H = 0x80000000,
|
|
|
23045
23007
|
* a basic tile object
|
|
23046
23008
|
* @augments Bounds
|
|
23047
23009
|
*/
|
|
23048
|
-
class Tile extends Bounds
|
|
23010
|
+
class Tile extends Bounds {
|
|
23049
23011
|
/**
|
|
23050
23012
|
* @param {number} x - x index of the Tile in the map
|
|
23051
23013
|
* @param {number} y - y index of the Tile in the map
|
|
@@ -23128,7 +23090,7 @@ class Tile extends Bounds$1 {
|
|
|
23128
23090
|
// create and apply transformation matrix if required
|
|
23129
23091
|
if (this.flipped === true) {
|
|
23130
23092
|
if (this.currentTransform === null) {
|
|
23131
|
-
this.currentTransform = new Matrix2d
|
|
23093
|
+
this.currentTransform = new Matrix2d();
|
|
23132
23094
|
}
|
|
23133
23095
|
this.setTileTransform(this.currentTransform.identity());
|
|
23134
23096
|
}
|
|
@@ -23188,7 +23150,7 @@ class Tile extends Bounds$1 {
|
|
|
23188
23150
|
} else {
|
|
23189
23151
|
if (tileset.isCollection === true) {
|
|
23190
23152
|
var image = tileset.getTileImage(this.tileId);
|
|
23191
|
-
renderable = new Sprite
|
|
23153
|
+
renderable = new Sprite(0, 0,
|
|
23192
23154
|
Object.assign({
|
|
23193
23155
|
image: image
|
|
23194
23156
|
})//, settings)
|
|
@@ -23214,14 +23176,13 @@ class Tile extends Bounds$1 {
|
|
|
23214
23176
|
return renderable;
|
|
23215
23177
|
}
|
|
23216
23178
|
}
|
|
23217
|
-
var Tile$1 = Tile;
|
|
23218
23179
|
|
|
23219
23180
|
/**
|
|
23220
23181
|
* @classdesc
|
|
23221
23182
|
* a canvas renderer object
|
|
23222
23183
|
* @augments Renderer
|
|
23223
23184
|
*/
|
|
23224
|
-
class CanvasRenderer extends Renderer
|
|
23185
|
+
class CanvasRenderer extends Renderer {
|
|
23225
23186
|
/**
|
|
23226
23187
|
* @param {object} options - The renderer parameters
|
|
23227
23188
|
* @param {number} options.width - The width of the canvas without scaling
|
|
@@ -23355,7 +23316,7 @@ class CanvasRenderer extends Renderer$1 {
|
|
|
23355
23316
|
this.resetTransform();
|
|
23356
23317
|
context.globalAlpha = 1;
|
|
23357
23318
|
context.globalCompositeOperation = opaque === true ? "copy" : "source-over";
|
|
23358
|
-
context.fillStyle = (color instanceof Color
|
|
23319
|
+
context.fillStyle = (color instanceof Color) ? color.toRGBA() : color;
|
|
23359
23320
|
this.fillRect(0, 0, canvas.width, canvas.height);
|
|
23360
23321
|
this.restore();
|
|
23361
23322
|
}
|
|
@@ -23804,7 +23765,7 @@ class CanvasRenderer extends Renderer$1 {
|
|
|
23804
23765
|
var context = this.getContext();
|
|
23805
23766
|
context.strokeStyle =
|
|
23806
23767
|
context.fillStyle = (
|
|
23807
|
-
color instanceof Color
|
|
23768
|
+
color instanceof Color ?
|
|
23808
23769
|
color.toRGBA() :
|
|
23809
23770
|
color
|
|
23810
23771
|
);
|
|
@@ -23943,11 +23904,11 @@ class CanvasRenderer extends Renderer$1 {
|
|
|
23943
23904
|
}
|
|
23944
23905
|
|
|
23945
23906
|
// https://github.com/melonjs/melonJS/issues/648
|
|
23946
|
-
if (mask instanceof RoundRect
|
|
23907
|
+
if (mask instanceof RoundRect) {
|
|
23947
23908
|
context.roundRect(mask.top, mask.left, mask.width, mask.height, mask.radius);
|
|
23948
|
-
} else if (mask instanceof Rect
|
|
23909
|
+
} else if (mask instanceof Rect || mask instanceof Bounds) {
|
|
23949
23910
|
context.rect(mask.top, mask.left, mask.width, mask.height);
|
|
23950
|
-
} else if (mask instanceof Ellipse
|
|
23911
|
+
} else if (mask instanceof Ellipse) {
|
|
23951
23912
|
const _x = mask.pos.x, _y = mask.pos.y,
|
|
23952
23913
|
hw = mask.radiusV.x,
|
|
23953
23914
|
hh = mask.radiusV.y,
|
|
@@ -24004,7 +23965,6 @@ class CanvasRenderer extends Renderer$1 {
|
|
|
24004
23965
|
}
|
|
24005
23966
|
}
|
|
24006
23967
|
}
|
|
24007
|
-
var CanvasRenderer$1 = CanvasRenderer;
|
|
24008
23968
|
|
|
24009
23969
|
/**
|
|
24010
23970
|
* Create required arrays for the given layer object
|
|
@@ -24054,7 +24014,7 @@ function preRenderLayer(layer, renderer) {
|
|
|
24054
24014
|
// get the value of the gid
|
|
24055
24015
|
var tile = layer.layerData[x][y];
|
|
24056
24016
|
// draw the tile if defined
|
|
24057
|
-
if (tile instanceof Tile
|
|
24017
|
+
if (tile instanceof Tile) {
|
|
24058
24018
|
// add a new tile to the layer
|
|
24059
24019
|
layer.getRenderer().drawTile(renderer, x, y, tile);
|
|
24060
24020
|
}
|
|
@@ -24068,7 +24028,7 @@ function preRenderLayer(layer, renderer) {
|
|
|
24068
24028
|
* Tiled QT 0.7.x format
|
|
24069
24029
|
* @augments Renderable
|
|
24070
24030
|
*/
|
|
24071
|
-
class TMXLayer extends Renderable
|
|
24031
|
+
class TMXLayer extends Renderable {
|
|
24072
24032
|
/**
|
|
24073
24033
|
* @param {object} map - layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
|
|
24074
24034
|
* @param {object} data - layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
|
|
@@ -24229,7 +24189,7 @@ class TMXLayer extends Renderable$1 {
|
|
|
24229
24189
|
|
|
24230
24190
|
// if pre-rendering method is use, create an offline canvas/renderer
|
|
24231
24191
|
if ((this.preRender === true) && (!this.canvasRenderer)) {
|
|
24232
|
-
this.canvasRenderer = new CanvasRenderer
|
|
24192
|
+
this.canvasRenderer = new CanvasRenderer({
|
|
24233
24193
|
canvas : createCanvas(this.width, this.height),
|
|
24234
24194
|
widht : this.width,
|
|
24235
24195
|
heigth : this.height,
|
|
@@ -24342,7 +24302,7 @@ class TMXLayer extends Renderable$1 {
|
|
|
24342
24302
|
// look for the corresponding tileset
|
|
24343
24303
|
this.tileset = this.tilesets.getTilesetByGid(tileId);
|
|
24344
24304
|
}
|
|
24345
|
-
return new Tile
|
|
24305
|
+
return new Tile(x, y, tileId, this.tileset);
|
|
24346
24306
|
}
|
|
24347
24307
|
|
|
24348
24308
|
/**
|
|
@@ -24436,15 +24396,13 @@ class TMXLayer extends Renderable$1 {
|
|
|
24436
24396
|
}
|
|
24437
24397
|
}
|
|
24438
24398
|
|
|
24439
|
-
var TMXLayer$1 = TMXLayer;
|
|
24440
|
-
|
|
24441
24399
|
/* eslint-disable no-unused-vars */
|
|
24442
24400
|
|
|
24443
24401
|
/**
|
|
24444
24402
|
* @classdesc
|
|
24445
24403
|
* The map renderer base class
|
|
24446
24404
|
*/
|
|
24447
|
-
class TMXRenderer {
|
|
24405
|
+
class TMXRenderer {
|
|
24448
24406
|
/**
|
|
24449
24407
|
* @param {number} cols - width of the tilemap in tiles
|
|
24450
24408
|
* @param {number} rows - height of the tilemap in tiles
|
|
@@ -24456,7 +24414,7 @@ class TMXRenderer {
|
|
|
24456
24414
|
this.rows = rows;
|
|
24457
24415
|
this.tilewidth = tilewidth;
|
|
24458
24416
|
this.tileheight = tileheight;
|
|
24459
|
-
this.bounds = new Bounds
|
|
24417
|
+
this.bounds = new Bounds();
|
|
24460
24418
|
}
|
|
24461
24419
|
|
|
24462
24420
|
/**
|
|
@@ -24487,7 +24445,7 @@ class TMXRenderer {
|
|
|
24487
24445
|
* @returns {Bounds}
|
|
24488
24446
|
*/
|
|
24489
24447
|
getBounds(layer) {
|
|
24490
|
-
var bounds = layer instanceof TMXLayer
|
|
24448
|
+
var bounds = layer instanceof TMXLayer ? pool$1.pull("Bounds") : this.bounds;
|
|
24491
24449
|
bounds.setMinMax(
|
|
24492
24450
|
0, 0,
|
|
24493
24451
|
this.cols * this.tilewidth,
|
|
@@ -24547,7 +24505,6 @@ class TMXRenderer {
|
|
|
24547
24505
|
|
|
24548
24506
|
}
|
|
24549
24507
|
|
|
24550
|
-
var TMXRenderer$1 = TMXRenderer;
|
|
24551
24508
|
|
|
24552
24509
|
/* eslint-enable no-unused-vars */
|
|
24553
24510
|
|
|
@@ -24556,7 +24513,7 @@ var TMXRenderer$1 = TMXRenderer;
|
|
|
24556
24513
|
* an Orthogonal Map Renderder
|
|
24557
24514
|
* @augments TMXRenderer
|
|
24558
24515
|
*/
|
|
24559
|
-
class TMXOrthogonalRenderer extends TMXRenderer
|
|
24516
|
+
class TMXOrthogonalRenderer extends TMXRenderer {
|
|
24560
24517
|
/**
|
|
24561
24518
|
* @param {TMXTileMap} map - the TMX map
|
|
24562
24519
|
*/
|
|
@@ -24585,7 +24542,7 @@ class TMXOrthogonalRenderer extends TMXRenderer$1 {
|
|
|
24585
24542
|
* @ignore
|
|
24586
24543
|
*/
|
|
24587
24544
|
pixelToTileCoords(x, y, v) {
|
|
24588
|
-
var ret = v || new Vector2d
|
|
24545
|
+
var ret = v || new Vector2d();
|
|
24589
24546
|
return ret.set(
|
|
24590
24547
|
x / this.tilewidth,
|
|
24591
24548
|
y / this.tileheight
|
|
@@ -24598,7 +24555,7 @@ class TMXOrthogonalRenderer extends TMXRenderer$1 {
|
|
|
24598
24555
|
* @ignore
|
|
24599
24556
|
*/
|
|
24600
24557
|
tileToPixelCoords(x, y, v) {
|
|
24601
|
-
var ret = v || new Vector2d
|
|
24558
|
+
var ret = v || new Vector2d();
|
|
24602
24559
|
return ret.set(
|
|
24603
24560
|
x * this.tilewidth,
|
|
24604
24561
|
y * this.tileheight
|
|
@@ -24694,14 +24651,12 @@ class TMXOrthogonalRenderer extends TMXRenderer$1 {
|
|
|
24694
24651
|
}
|
|
24695
24652
|
}
|
|
24696
24653
|
|
|
24697
|
-
var TMXOrthogonalRenderer$1 = TMXOrthogonalRenderer;
|
|
24698
|
-
|
|
24699
24654
|
/**
|
|
24700
24655
|
* @classdesc
|
|
24701
24656
|
* an Isometric Map Renderder
|
|
24702
24657
|
* @augments TMXRenderer
|
|
24703
24658
|
*/
|
|
24704
|
-
class TMXIsometricRenderer extends TMXRenderer
|
|
24659
|
+
class TMXIsometricRenderer extends TMXRenderer {
|
|
24705
24660
|
/**
|
|
24706
24661
|
* @param {TMXTileMap} map - the TMX map
|
|
24707
24662
|
*/
|
|
@@ -24737,7 +24692,7 @@ class TMXIsometricRenderer extends TMXRenderer$1 {
|
|
|
24737
24692
|
* @returns {Bounds}
|
|
24738
24693
|
*/
|
|
24739
24694
|
getBounds(layer) {
|
|
24740
|
-
var bounds = layer instanceof TMXLayer
|
|
24695
|
+
var bounds = layer instanceof TMXLayer ? pool$1.pull("Bounds") : this.bounds;
|
|
24741
24696
|
bounds.setMinMax(
|
|
24742
24697
|
0, 0,
|
|
24743
24698
|
(this.cols + this.rows) * (this.tilewidth / 2),
|
|
@@ -24751,7 +24706,7 @@ class TMXIsometricRenderer extends TMXRenderer$1 {
|
|
|
24751
24706
|
* @ignore
|
|
24752
24707
|
*/
|
|
24753
24708
|
pixelToTileCoords(x, y, v) {
|
|
24754
|
-
var ret = v || new Vector2d
|
|
24709
|
+
var ret = v || new Vector2d();
|
|
24755
24710
|
return ret.set(
|
|
24756
24711
|
(y / this.tileheight) + ((x - this.originX) / this.tilewidth),
|
|
24757
24712
|
(y / this.tileheight) - ((x - this.originX) / this.tilewidth)
|
|
@@ -24763,7 +24718,7 @@ class TMXIsometricRenderer extends TMXRenderer$1 {
|
|
|
24763
24718
|
* @ignore
|
|
24764
24719
|
*/
|
|
24765
24720
|
tileToPixelCoords(x, y, v) {
|
|
24766
|
-
var ret = v || new Vector2d
|
|
24721
|
+
var ret = v || new Vector2d();
|
|
24767
24722
|
return ret.set(
|
|
24768
24723
|
(x - y) * this.hTilewidth + this.originX,
|
|
24769
24724
|
(x + y) * this.hTileheight
|
|
@@ -24901,8 +24856,6 @@ class TMXIsometricRenderer extends TMXRenderer$1 {
|
|
|
24901
24856
|
}
|
|
24902
24857
|
}
|
|
24903
24858
|
|
|
24904
|
-
var TMXIsometricRenderer$1 = TMXIsometricRenderer;
|
|
24905
|
-
|
|
24906
24859
|
// scope global var & constants
|
|
24907
24860
|
const offsetsStaggerX = [
|
|
24908
24861
|
{x: 0, y: 0},
|
|
@@ -24922,7 +24875,7 @@ const offsetsStaggerY = [
|
|
|
24922
24875
|
* an Hexagonal Map Renderder
|
|
24923
24876
|
* @augments TMXRenderer
|
|
24924
24877
|
*/
|
|
24925
|
-
class TMXHexagonalRenderer extends TMXRenderer
|
|
24878
|
+
class TMXHexagonalRenderer extends TMXRenderer {
|
|
24926
24879
|
/**
|
|
24927
24880
|
* @param {TMXTileMap} map - the TMX map
|
|
24928
24881
|
*/
|
|
@@ -24957,10 +24910,10 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
24957
24910
|
this.rowheight = this.sideoffsety + this.sidelengthy;
|
|
24958
24911
|
|
|
24959
24912
|
this.centers = [
|
|
24960
|
-
new Vector2d
|
|
24961
|
-
new Vector2d
|
|
24962
|
-
new Vector2d
|
|
24963
|
-
new Vector2d
|
|
24913
|
+
new Vector2d(),
|
|
24914
|
+
new Vector2d(),
|
|
24915
|
+
new Vector2d(),
|
|
24916
|
+
new Vector2d()
|
|
24964
24917
|
];
|
|
24965
24918
|
}
|
|
24966
24919
|
|
|
@@ -24983,7 +24936,7 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
24983
24936
|
* @returns {Bounds}
|
|
24984
24937
|
*/
|
|
24985
24938
|
getBounds(layer) {
|
|
24986
|
-
var bounds = layer instanceof TMXLayer
|
|
24939
|
+
var bounds = layer instanceof TMXLayer ? pool$1.pull("Bounds") : this.bounds;
|
|
24987
24940
|
|
|
24988
24941
|
// The map size is the same regardless of which indexes are shifted.
|
|
24989
24942
|
if (this.staggerX) {
|
|
@@ -25026,7 +24979,7 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
25026
24979
|
* @ignore
|
|
25027
24980
|
*/
|
|
25028
24981
|
topLeft(x, y, v) {
|
|
25029
|
-
var ret = v || new Vector2d
|
|
24982
|
+
var ret = v || new Vector2d();
|
|
25030
24983
|
|
|
25031
24984
|
if (!this.staggerX) {
|
|
25032
24985
|
if ((y & 1) ^ this.staggerEven) {
|
|
@@ -25050,7 +25003,7 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
25050
25003
|
* @ignore
|
|
25051
25004
|
*/
|
|
25052
25005
|
topRight(x, y, v) {
|
|
25053
|
-
var ret = v || new Vector2d
|
|
25006
|
+
var ret = v || new Vector2d();
|
|
25054
25007
|
|
|
25055
25008
|
if (!this.staggerX) {
|
|
25056
25009
|
if ((y & 1) ^ this.staggerEven) {
|
|
@@ -25075,7 +25028,7 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
25075
25028
|
* @ignore
|
|
25076
25029
|
*/
|
|
25077
25030
|
bottomLeft(x, y, v) {
|
|
25078
|
-
var ret = v || new Vector2d
|
|
25031
|
+
var ret = v || new Vector2d();
|
|
25079
25032
|
|
|
25080
25033
|
if (!this.staggerX) {
|
|
25081
25034
|
if ((y & 1) ^ this.staggerEven) {
|
|
@@ -25099,7 +25052,7 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
25099
25052
|
* @ignore
|
|
25100
25053
|
*/
|
|
25101
25054
|
bottomRight(x, y, v) {
|
|
25102
|
-
var ret = v || new Vector2d
|
|
25055
|
+
var ret = v || new Vector2d();
|
|
25103
25056
|
|
|
25104
25057
|
if (!this.staggerX) {
|
|
25105
25058
|
if ((y & 1) ^ this.staggerEven) {
|
|
@@ -25124,7 +25077,7 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
25124
25077
|
* @ignore
|
|
25125
25078
|
*/
|
|
25126
25079
|
pixelToTileCoords(x, y, v) {
|
|
25127
|
-
var ret = v || new Vector2d
|
|
25080
|
+
var ret = v || new Vector2d();
|
|
25128
25081
|
|
|
25129
25082
|
if (this.staggerX) { //flat top
|
|
25130
25083
|
x -= this.staggerEven ? this.tilewidth : this.sideoffsetx;
|
|
@@ -25212,7 +25165,7 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
25212
25165
|
tileToPixelCoords(x, y, v) {
|
|
25213
25166
|
var tileX = Math.floor(x),
|
|
25214
25167
|
tileY = Math.floor(y);
|
|
25215
|
-
var ret = v || new Vector2d
|
|
25168
|
+
var ret = v || new Vector2d();
|
|
25216
25169
|
|
|
25217
25170
|
if (this.staggerX) {
|
|
25218
25171
|
ret.y = tileY * (this.tileheight + this.sidelengthy);
|
|
@@ -25394,14 +25347,12 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
25394
25347
|
}
|
|
25395
25348
|
}
|
|
25396
25349
|
|
|
25397
|
-
var TMXHexagonalRenderer$1 = TMXHexagonalRenderer;
|
|
25398
|
-
|
|
25399
25350
|
/**
|
|
25400
25351
|
* @classdesc
|
|
25401
25352
|
* a Staggered Map Renderder
|
|
25402
25353
|
* @augments TMXHexagonalRenderer
|
|
25403
25354
|
*/
|
|
25404
|
-
class TMXStaggeredRenderer extends TMXHexagonalRenderer
|
|
25355
|
+
class TMXStaggeredRenderer extends TMXHexagonalRenderer {
|
|
25405
25356
|
|
|
25406
25357
|
/**
|
|
25407
25358
|
* return true if the renderer can render the specified layer
|
|
@@ -25419,7 +25370,7 @@ class TMXStaggeredRenderer extends TMXHexagonalRenderer$1 {
|
|
|
25419
25370
|
* @ignore
|
|
25420
25371
|
*/
|
|
25421
25372
|
pixelToTileCoords(x, y, v) {
|
|
25422
|
-
var ret = v || new Vector2d
|
|
25373
|
+
var ret = v || new Vector2d();
|
|
25423
25374
|
|
|
25424
25375
|
var alignedX = x,
|
|
25425
25376
|
alignedY = y;
|
|
@@ -25490,13 +25441,11 @@ class TMXStaggeredRenderer extends TMXHexagonalRenderer$1 {
|
|
|
25490
25441
|
}
|
|
25491
25442
|
}
|
|
25492
25443
|
|
|
25493
|
-
var TMXStaggeredRenderer$1 = TMXStaggeredRenderer;
|
|
25494
|
-
|
|
25495
25444
|
/**
|
|
25496
25445
|
* @classdesc
|
|
25497
25446
|
* a TMX Tile Set Object
|
|
25498
25447
|
*/
|
|
25499
|
-
class TMXTileset {
|
|
25448
|
+
class TMXTileset {
|
|
25500
25449
|
/**
|
|
25501
25450
|
* @param {object} tileset - tileset data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#tileset})
|
|
25502
25451
|
*/
|
|
@@ -25532,7 +25481,7 @@ class TMXTileset {
|
|
|
25532
25481
|
this.margin = +tileset.margin || 0;
|
|
25533
25482
|
|
|
25534
25483
|
// set tile offset properties (if any)
|
|
25535
|
-
this.tileoffset = new Vector2d
|
|
25484
|
+
this.tileoffset = new Vector2d();
|
|
25536
25485
|
|
|
25537
25486
|
/**
|
|
25538
25487
|
* Tileset contains animated tiles
|
|
@@ -25787,8 +25736,6 @@ class TMXTileset {
|
|
|
25787
25736
|
}
|
|
25788
25737
|
}
|
|
25789
25738
|
|
|
25790
|
-
var TMXTileset$1 = TMXTileset;
|
|
25791
|
-
|
|
25792
25739
|
// bitmask constants to check for flipped & rotated tiles
|
|
25793
25740
|
const TMX_CLEAR_BIT_MASK = ~(0x80000000 | 0x40000000 | 0x20000000);
|
|
25794
25741
|
|
|
@@ -25796,7 +25743,7 @@ const TMX_CLEAR_BIT_MASK = ~(0x80000000 | 0x40000000 | 0x20000000);
|
|
|
25796
25743
|
* @classdesc
|
|
25797
25744
|
* an object containing all tileset
|
|
25798
25745
|
*/
|
|
25799
|
-
class TMXTilesetGroup {
|
|
25746
|
+
class TMXTilesetGroup {
|
|
25800
25747
|
|
|
25801
25748
|
constructor() {
|
|
25802
25749
|
this.tilesets = [];
|
|
@@ -25862,8 +25809,6 @@ class TMXTilesetGroup {
|
|
|
25862
25809
|
}
|
|
25863
25810
|
}
|
|
25864
25811
|
|
|
25865
|
-
var TMXTilesetGroup$1 = TMXTilesetGroup;
|
|
25866
|
-
|
|
25867
25812
|
/**
|
|
25868
25813
|
* @classdesc
|
|
25869
25814
|
* a TMX Object defintion, as defined in Tiled
|
|
@@ -26121,7 +26066,7 @@ class TMXObject {
|
|
|
26121
26066
|
}
|
|
26122
26067
|
|
|
26123
26068
|
// the object corresponding tile object
|
|
26124
|
-
this.tile = new Tile
|
|
26069
|
+
this.tile = new Tile(this.x, this.y, this.gid, tileset);
|
|
26125
26070
|
}
|
|
26126
26071
|
|
|
26127
26072
|
/**
|
|
@@ -26297,7 +26242,7 @@ class TMXGroup {
|
|
|
26297
26242
|
|
|
26298
26243
|
if (data.layers) {
|
|
26299
26244
|
data.layers.forEach((data) => {
|
|
26300
|
-
var layer = new TMXLayer
|
|
26245
|
+
var layer = new TMXLayer(map, data, map.tilewidth, map.tileheight, map.orientation, map.tilesets, z++);
|
|
26301
26246
|
// set a renderer
|
|
26302
26247
|
layer.setRenderer(map.getRenderer());
|
|
26303
26248
|
// resize container accordingly
|
|
@@ -26345,16 +26290,16 @@ const COLLISION_GROUP = "collision";
|
|
|
26345
26290
|
function getNewDefaultRenderer(map) {
|
|
26346
26291
|
switch (map.orientation) {
|
|
26347
26292
|
case "orthogonal":
|
|
26348
|
-
return new TMXOrthogonalRenderer
|
|
26293
|
+
return new TMXOrthogonalRenderer(map);
|
|
26349
26294
|
|
|
26350
26295
|
case "isometric":
|
|
26351
|
-
return new TMXIsometricRenderer
|
|
26296
|
+
return new TMXIsometricRenderer(map);
|
|
26352
26297
|
|
|
26353
26298
|
case "hexagonal":
|
|
26354
|
-
return new TMXHexagonalRenderer
|
|
26299
|
+
return new TMXHexagonalRenderer(map);
|
|
26355
26300
|
|
|
26356
26301
|
case "staggered":
|
|
26357
|
-
return new TMXStaggeredRenderer
|
|
26302
|
+
return new TMXStaggeredRenderer(map);
|
|
26358
26303
|
|
|
26359
26304
|
// if none found, throw an exception
|
|
26360
26305
|
default:
|
|
@@ -26367,7 +26312,7 @@ function getNewDefaultRenderer(map) {
|
|
|
26367
26312
|
* @ignore
|
|
26368
26313
|
*/
|
|
26369
26314
|
function readLayer(map, data, z) {
|
|
26370
|
-
return new TMXLayer
|
|
26315
|
+
return new TMXLayer(map, data, map.tilewidth, map.tileheight, map.orientation, map.tilesets, z);
|
|
26371
26316
|
}
|
|
26372
26317
|
|
|
26373
26318
|
/**
|
|
@@ -26406,7 +26351,7 @@ function readImageLayer(map, data, z) {
|
|
|
26406
26351
|
* @ignore
|
|
26407
26352
|
*/
|
|
26408
26353
|
function readTileset(data) {
|
|
26409
|
-
return (new TMXTileset
|
|
26354
|
+
return (new TMXTileset(data));
|
|
26410
26355
|
}
|
|
26411
26356
|
|
|
26412
26357
|
/**
|
|
@@ -26422,7 +26367,7 @@ function readObjectGroup(map, data, z) {
|
|
|
26422
26367
|
* a TMX Tile Map Object
|
|
26423
26368
|
* Tiled QT +0.7.x format
|
|
26424
26369
|
*/
|
|
26425
|
-
class TMXTileMap {
|
|
26370
|
+
class TMXTileMap {
|
|
26426
26371
|
/**
|
|
26427
26372
|
* @param {string} levelId - name of TMX map
|
|
26428
26373
|
* @param {object} data - TMX map in JSON format
|
|
@@ -26621,7 +26566,7 @@ class TMXTileMap {
|
|
|
26621
26566
|
// Tileset information
|
|
26622
26567
|
if (!this.tilesets) {
|
|
26623
26568
|
// make sure we have a TilesetGroup Object
|
|
26624
|
-
this.tilesets = new TMXTilesetGroup
|
|
26569
|
+
this.tilesets = new TMXTilesetGroup();
|
|
26625
26570
|
}
|
|
26626
26571
|
|
|
26627
26572
|
// parse all tileset objects
|
|
@@ -26773,7 +26718,7 @@ class TMXTileMap {
|
|
|
26773
26718
|
|
|
26774
26719
|
if (flatten === false) {
|
|
26775
26720
|
// create a new container
|
|
26776
|
-
targetContainer = new Container
|
|
26721
|
+
targetContainer = new Container(0, 0, this.width, this.height);
|
|
26777
26722
|
|
|
26778
26723
|
// tiled uses 0,0 by default
|
|
26779
26724
|
targetContainer.anchorPoint.set(0, 0);
|
|
@@ -26812,7 +26757,7 @@ class TMXTileMap {
|
|
|
26812
26757
|
/// specific instantiation logic/details from here
|
|
26813
26758
|
|
|
26814
26759
|
// groups can contains either text, objects or layers
|
|
26815
|
-
if (settings instanceof TMXLayer
|
|
26760
|
+
if (settings instanceof TMXLayer) {
|
|
26816
26761
|
// layers are already instantiated & initialized
|
|
26817
26762
|
obj = settings;
|
|
26818
26763
|
// z value set already
|
|
@@ -26840,7 +26785,7 @@ class TMXTileMap {
|
|
|
26840
26785
|
}
|
|
26841
26786
|
// check if a me.Tile object is embedded
|
|
26842
26787
|
obj = settings.tile.getRenderable(settings);
|
|
26843
|
-
obj.body = new Body
|
|
26788
|
+
obj.body = new Body(obj, shape);
|
|
26844
26789
|
obj.body.setStatic(true);
|
|
26845
26790
|
// set the obj z order
|
|
26846
26791
|
obj.pos.setMuted(settings.x, settings.y, settings.z);
|
|
@@ -26874,7 +26819,7 @@ class TMXTileMap {
|
|
|
26874
26819
|
// for backward compatibility
|
|
26875
26820
|
obj.class = settings.class || settings.type;
|
|
26876
26821
|
obj.id = settings.id;
|
|
26877
|
-
obj.body = new Body
|
|
26822
|
+
obj.body = new Body(obj, shape);
|
|
26878
26823
|
obj.body.setStatic(true);
|
|
26879
26824
|
obj.resize(obj.body.getBounds().width, obj.body.getBounds().height);
|
|
26880
26825
|
}
|
|
@@ -26894,7 +26839,7 @@ class TMXTileMap {
|
|
|
26894
26839
|
if (obj.isRenderable === true) {
|
|
26895
26840
|
obj.setOpacity(obj.getOpacity() * group.opacity);
|
|
26896
26841
|
// and to child renderables if any
|
|
26897
|
-
if (obj.renderable
|
|
26842
|
+
if (typeof obj.renderable !== "undefined" && obj.renderable.isRenderable === true) {
|
|
26898
26843
|
obj.renderable.setOpacity(obj.renderable.getOpacity() * group.opacity);
|
|
26899
26844
|
}
|
|
26900
26845
|
}
|
|
@@ -26946,8 +26891,6 @@ class TMXTileMap {
|
|
|
26946
26891
|
}
|
|
26947
26892
|
}
|
|
26948
26893
|
|
|
26949
|
-
var TMXTileMap$1 = TMXTileMap;
|
|
26950
|
-
|
|
26951
26894
|
// our levels
|
|
26952
26895
|
var levels = {};
|
|
26953
26896
|
// level index table
|
|
@@ -27037,7 +26980,7 @@ var level = {
|
|
|
27037
26980
|
// just load the level with the XML stuff
|
|
27038
26981
|
if (levels[levelId] == null) {
|
|
27039
26982
|
//console.log("loading "+ levelId);
|
|
27040
|
-
levels[levelId] = new TMXTileMap
|
|
26983
|
+
levels[levelId] = new TMXTileMap(levelId, loader$1.getTMX(levelId));
|
|
27041
26984
|
// level index
|
|
27042
26985
|
levelIdx.push(levelId);
|
|
27043
26986
|
}
|
|
@@ -27110,7 +27053,7 @@ var level = {
|
|
|
27110
27053
|
throw new Error("level " + levelId + " not found");
|
|
27111
27054
|
}
|
|
27112
27055
|
|
|
27113
|
-
if (levels[levelId] instanceof TMXTileMap
|
|
27056
|
+
if (levels[levelId] instanceof TMXTileMap) {
|
|
27114
27057
|
|
|
27115
27058
|
// check the status of the state mngr
|
|
27116
27059
|
var wasRunning = state$1.isRunning();
|
|
@@ -28019,7 +27962,7 @@ var loader$1 = loader;
|
|
|
28019
27962
|
* An object to display a fixed or animated sprite on screen.
|
|
28020
27963
|
* @augments Renderable
|
|
28021
27964
|
*/
|
|
28022
|
-
class Sprite extends Renderable
|
|
27965
|
+
class Sprite extends Renderable {
|
|
28023
27966
|
/**
|
|
28024
27967
|
* @param {number} x - the x coordinates of the sprite object
|
|
28025
27968
|
* @param {number} y - the y coordinates of the sprite object
|
|
@@ -28193,7 +28136,7 @@ class Sprite extends Renderable$1 {
|
|
|
28193
28136
|
}
|
|
28194
28137
|
|
|
28195
28138
|
if (typeof (settings.tint) !== "undefined") {
|
|
28196
|
-
if (settings.tint instanceof Color
|
|
28139
|
+
if (settings.tint instanceof Color) {
|
|
28197
28140
|
this.tint.copy(settings.tint);
|
|
28198
28141
|
} else {
|
|
28199
28142
|
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
@@ -28651,7 +28594,6 @@ class Sprite extends Renderable$1 {
|
|
|
28651
28594
|
);
|
|
28652
28595
|
}
|
|
28653
28596
|
}
|
|
28654
|
-
var Sprite$1 = Sprite;
|
|
28655
28597
|
|
|
28656
28598
|
/**
|
|
28657
28599
|
* create a simple 1 frame texture atlas based on the given parameters
|
|
@@ -28838,8 +28780,8 @@ class TextureAtlas {
|
|
|
28838
28780
|
atlas[frame.filename] = {
|
|
28839
28781
|
name : frame.filename, // frame name
|
|
28840
28782
|
texture : data.meta.image || "default", // the source texture
|
|
28841
|
-
offset : new Vector2d
|
|
28842
|
-
anchorPoint : (hasTextureAnchorPoint) ? new Vector2d
|
|
28783
|
+
offset : new Vector2d(s.x, s.y),
|
|
28784
|
+
anchorPoint : (hasTextureAnchorPoint) ? new Vector2d(originX / s.w, originY / s.h) : null,
|
|
28843
28785
|
trimmed : !!frame.trimmed,
|
|
28844
28786
|
width : s.w,
|
|
28845
28787
|
height : s.h,
|
|
@@ -28895,7 +28837,7 @@ class TextureAtlas {
|
|
|
28895
28837
|
atlas[name] = {
|
|
28896
28838
|
name : name,
|
|
28897
28839
|
texture : "default", // the source texture
|
|
28898
|
-
offset : new Vector2d
|
|
28840
|
+
offset : new Vector2d(
|
|
28899
28841
|
margin + (spacing + data.framewidth) * (frame % spritecount.x),
|
|
28900
28842
|
margin + (spacing + data.frameheight) * ~~(frame / spritecount.x)
|
|
28901
28843
|
),
|
|
@@ -28969,7 +28911,7 @@ class TextureAtlas {
|
|
|
28969
28911
|
|
|
28970
28912
|
atlas[name] = {
|
|
28971
28913
|
name : name,
|
|
28972
|
-
offset : new Vector2d
|
|
28914
|
+
offset : new Vector2d(x, y),
|
|
28973
28915
|
width : w,
|
|
28974
28916
|
height : h,
|
|
28975
28917
|
angle : 0
|
|
@@ -29033,7 +28975,7 @@ class TextureAtlas {
|
|
|
29033
28975
|
*/
|
|
29034
28976
|
addUVs(atlas, name, w, h) {
|
|
29035
28977
|
// ignore if using the Canvas Renderer
|
|
29036
|
-
if (renderer instanceof WebGLRenderer
|
|
28978
|
+
if (renderer instanceof WebGLRenderer) {
|
|
29037
28979
|
// Source coordinates
|
|
29038
28980
|
var s = atlas[name].offset;
|
|
29039
28981
|
var sw = atlas[name].width;
|
|
@@ -29143,7 +29085,7 @@ class TextureAtlas {
|
|
|
29143
29085
|
height = Math.max(region.height, height);
|
|
29144
29086
|
}
|
|
29145
29087
|
// instantiate a new animation sheet object
|
|
29146
|
-
return new Sprite
|
|
29088
|
+
return new Sprite(0, 0, Object.assign({
|
|
29147
29089
|
image: this,
|
|
29148
29090
|
framewidth: width,
|
|
29149
29091
|
frameheight: height,
|
|
@@ -29737,7 +29679,7 @@ var TextureCache$1 = TextureCache;
|
|
|
29737
29679
|
* a WebGL renderer object
|
|
29738
29680
|
* @augments Renderer
|
|
29739
29681
|
*/
|
|
29740
|
-
class WebGLRenderer extends Renderer
|
|
29682
|
+
class WebGLRenderer extends Renderer {
|
|
29741
29683
|
/**
|
|
29742
29684
|
* @param {object} options - The renderer parameters
|
|
29743
29685
|
* @param {number} options.width - The width of the canvas without scaling
|
|
@@ -29821,7 +29763,7 @@ class WebGLRenderer extends Renderer$1 {
|
|
|
29821
29763
|
* The current transformation matrix used for transformations on the overall scene
|
|
29822
29764
|
* @type {Matrix2d}
|
|
29823
29765
|
*/
|
|
29824
|
-
this.currentTransform = new Matrix2d
|
|
29766
|
+
this.currentTransform = new Matrix2d();
|
|
29825
29767
|
|
|
29826
29768
|
/**
|
|
29827
29769
|
* The current compositor used by the renderer
|
|
@@ -29836,7 +29778,7 @@ class WebGLRenderer extends Renderer$1 {
|
|
|
29836
29778
|
this.compositors = new Map();
|
|
29837
29779
|
|
|
29838
29780
|
// Create a default compositor
|
|
29839
|
-
var compositor = new (this.settings.compositor || WebGLCompositor
|
|
29781
|
+
var compositor = new (this.settings.compositor || WebGLCompositor)(this);
|
|
29840
29782
|
this.compositors.set("default", compositor);
|
|
29841
29783
|
this.setCompositor(compositor);
|
|
29842
29784
|
|
|
@@ -30026,7 +29968,7 @@ class WebGLRenderer extends Renderer$1 {
|
|
|
30026
29968
|
clearColor(color = "#000000", opaque = false) {
|
|
30027
29969
|
var glArray;
|
|
30028
29970
|
|
|
30029
|
-
if (color instanceof Color
|
|
29971
|
+
if (color instanceof Color) {
|
|
30030
29972
|
glArray = color.toArray();
|
|
30031
29973
|
} else {
|
|
30032
29974
|
var _color = pool$1.pull("me.Color");
|
|
@@ -30747,7 +30689,6 @@ class WebGLRenderer extends Renderer$1 {
|
|
|
30747
30689
|
}
|
|
30748
30690
|
}
|
|
30749
30691
|
}
|
|
30750
|
-
var WebGLRenderer$1 = WebGLRenderer;
|
|
30751
30692
|
|
|
30752
30693
|
/**
|
|
30753
30694
|
* video functions
|
|
@@ -30784,12 +30725,12 @@ var settings = {
|
|
|
30784
30725
|
function autoDetectRenderer(options) {
|
|
30785
30726
|
try {
|
|
30786
30727
|
if (isWebGLSupported(options)) {
|
|
30787
|
-
return new WebGLRenderer
|
|
30728
|
+
return new WebGLRenderer(options);
|
|
30788
30729
|
}
|
|
30789
30730
|
} catch (e) {
|
|
30790
30731
|
console.log("Error creating WebGL renderer :" + e.message);
|
|
30791
30732
|
}
|
|
30792
|
-
return new CanvasRenderer
|
|
30733
|
+
return new CanvasRenderer(options);
|
|
30793
30734
|
}
|
|
30794
30735
|
|
|
30795
30736
|
/**
|
|
@@ -30908,7 +30849,7 @@ let parent = null;
|
|
|
30908
30849
|
* @default <1,1>
|
|
30909
30850
|
* @memberof video
|
|
30910
30851
|
*/
|
|
30911
|
-
let scaleRatio = new Vector2d
|
|
30852
|
+
let scaleRatio = new Vector2d(1, 1);
|
|
30912
30853
|
|
|
30913
30854
|
/**
|
|
30914
30855
|
* A reference to the active Canvas or WebGL active renderer renderer
|
|
@@ -31063,7 +31004,7 @@ function init(width, height, options) {
|
|
|
31063
31004
|
renderer = autoDetectRenderer(settings);
|
|
31064
31005
|
break;
|
|
31065
31006
|
default:
|
|
31066
|
-
renderer = new CanvasRenderer
|
|
31007
|
+
renderer = new CanvasRenderer(settings);
|
|
31067
31008
|
break;
|
|
31068
31009
|
}
|
|
31069
31010
|
} catch (e) {
|
|
@@ -31097,7 +31038,7 @@ function init(width, height, options) {
|
|
|
31097
31038
|
}
|
|
31098
31039
|
|
|
31099
31040
|
if (settings.consoleHeader !== false) {
|
|
31100
|
-
var renderType = (renderer instanceof CanvasRenderer
|
|
31041
|
+
var renderType = (renderer instanceof CanvasRenderer) ? "CANVAS" : "WebGL" + renderer.WebGLVersion;
|
|
31101
31042
|
var audioType = hasWebAudio ? "Web Audio" : "HTML5 Audio";
|
|
31102
31043
|
var gpu_renderer = (typeof renderer.GPURenderer === "string") ? " (" + renderer.GPURenderer + ")" : "";
|
|
31103
31044
|
// output video information in the console
|
|
@@ -31235,7 +31176,7 @@ var utils = {
|
|
|
31235
31176
|
*/
|
|
31236
31177
|
getPixels : function (image) {
|
|
31237
31178
|
if (image instanceof HTMLImageElement) {
|
|
31238
|
-
var _context = CanvasRenderer
|
|
31179
|
+
var _context = CanvasRenderer.getContext2d(
|
|
31239
31180
|
createCanvas(image.width, image.height)
|
|
31240
31181
|
);
|
|
31241
31182
|
_context.drawImage(image, 0, 0);
|
|
@@ -31652,10 +31593,10 @@ class BasePlugin {
|
|
|
31652
31593
|
* this can be overridden by the plugin
|
|
31653
31594
|
* @public
|
|
31654
31595
|
* @type {string}
|
|
31655
|
-
* @default "14.1.
|
|
31596
|
+
* @default "14.1.2"
|
|
31656
31597
|
* @name plugin.Base#version
|
|
31657
31598
|
*/
|
|
31658
|
-
this.version = "14.1.
|
|
31599
|
+
this.version = "14.1.2";
|
|
31659
31600
|
}
|
|
31660
31601
|
}
|
|
31661
31602
|
|
|
@@ -32217,7 +32158,7 @@ let Interpolation = {
|
|
|
32217
32158
|
* author lechecacharro<br>
|
|
32218
32159
|
* author Josh Faul / http://jocafa.com/
|
|
32219
32160
|
*/
|
|
32220
|
-
class Tween {
|
|
32161
|
+
class Tween {
|
|
32221
32162
|
|
|
32222
32163
|
/**
|
|
32223
32164
|
* @param {object} object - object on which to apply the tween
|
|
@@ -32662,7 +32603,6 @@ class Tween {
|
|
|
32662
32603
|
static get Easing() { return Easing; }
|
|
32663
32604
|
static get Interpolation() { return Interpolation; }
|
|
32664
32605
|
}
|
|
32665
|
-
var Tween$1 = Tween;
|
|
32666
32606
|
|
|
32667
32607
|
// default canvas settings
|
|
32668
32608
|
var defaultAttributes = {
|
|
@@ -32817,7 +32757,7 @@ function setContextStyle(context, style, stroke = false) {
|
|
|
32817
32757
|
* a Text Metrics object that contains helper for text manipulation
|
|
32818
32758
|
* @augments Bounds
|
|
32819
32759
|
*/
|
|
32820
|
-
class TextMetrics extends Bounds
|
|
32760
|
+
class TextMetrics extends Bounds {
|
|
32821
32761
|
|
|
32822
32762
|
/**
|
|
32823
32763
|
* @param {Text|BitmapText} ancestor - the parent object that contains this TextMetrics object
|
|
@@ -32843,7 +32783,7 @@ class TextMetrics extends Bounds$1 {
|
|
|
32843
32783
|
* @returns {number} the height of a segment of inline text in CSS pixels.
|
|
32844
32784
|
*/
|
|
32845
32785
|
lineHeight() {
|
|
32846
|
-
if (this.ancestor instanceof Text
|
|
32786
|
+
if (this.ancestor instanceof Text) {
|
|
32847
32787
|
return this.ancestor.fontSize * this.ancestor.lineHeight;
|
|
32848
32788
|
} else { // it's a BitmapText
|
|
32849
32789
|
return this.ancestor.fontData.capHeight * this.ancestor.lineHeight * this.ancestor.fontScale.y;
|
|
@@ -32857,7 +32797,7 @@ class TextMetrics extends Bounds$1 {
|
|
|
32857
32797
|
* @returns {number} the width of the given segment of inline text in CSS pixels.
|
|
32858
32798
|
*/
|
|
32859
32799
|
lineWidth(text, context) {
|
|
32860
|
-
if (this.ancestor instanceof Text
|
|
32800
|
+
if (this.ancestor instanceof Text) {
|
|
32861
32801
|
return context.measureText(text).width;
|
|
32862
32802
|
} else { // it's a BitmapText
|
|
32863
32803
|
var characters = text.split("");
|
|
@@ -32974,7 +32914,6 @@ class TextMetrics extends Bounds$1 {
|
|
|
32974
32914
|
return output;
|
|
32975
32915
|
}
|
|
32976
32916
|
}
|
|
32977
|
-
var TextMetrics$1 = TextMetrics;
|
|
32978
32917
|
|
|
32979
32918
|
/*
|
|
32980
32919
|
* ASCII Table
|
|
@@ -33005,7 +32944,7 @@ var getContext2d = function (renderer$1, text) {
|
|
|
33005
32944
|
* a generic system font object.
|
|
33006
32945
|
* @augments Renderable
|
|
33007
32946
|
*/
|
|
33008
|
-
class Text extends Renderable
|
|
32947
|
+
class Text extends Renderable {
|
|
33009
32948
|
/**
|
|
33010
32949
|
* @param {number} x - position of the text object
|
|
33011
32950
|
* @param {number} y - position of the text object
|
|
@@ -33042,7 +32981,7 @@ class Text extends Renderable$1 {
|
|
|
33042
32981
|
* @default black
|
|
33043
32982
|
*/
|
|
33044
32983
|
if (typeof settings.fillStyle !== "undefined") {
|
|
33045
|
-
if (settings.fillStyle instanceof Color
|
|
32984
|
+
if (settings.fillStyle instanceof Color) {
|
|
33046
32985
|
this.fillStyle = settings.fillStyle;
|
|
33047
32986
|
} else {
|
|
33048
32987
|
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
@@ -33060,7 +32999,7 @@ class Text extends Renderable$1 {
|
|
|
33060
32999
|
* @default black
|
|
33061
33000
|
*/
|
|
33062
33001
|
if (typeof settings.strokeStyle !== "undefined") {
|
|
33063
|
-
if (settings.strokeStyle instanceof Color
|
|
33002
|
+
if (settings.strokeStyle instanceof Color) {
|
|
33064
33003
|
this.strokeStyle = settings.strokeStyle;
|
|
33065
33004
|
} else {
|
|
33066
33005
|
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
@@ -33167,7 +33106,7 @@ class Text extends Renderable$1 {
|
|
|
33167
33106
|
}
|
|
33168
33107
|
|
|
33169
33108
|
// instance to text metrics functions
|
|
33170
|
-
this.metrics = new TextMetrics
|
|
33109
|
+
this.metrics = new TextMetrics(this);
|
|
33171
33110
|
|
|
33172
33111
|
// set the text
|
|
33173
33112
|
this.setText(settings.text);
|
|
@@ -33264,7 +33203,7 @@ class Text extends Renderable$1 {
|
|
|
33264
33203
|
var width = Math.ceil(this.metrics.width),
|
|
33265
33204
|
height = Math.ceil(this.metrics.height);
|
|
33266
33205
|
|
|
33267
|
-
if (renderer instanceof WebGLRenderer
|
|
33206
|
+
if (renderer instanceof WebGLRenderer) {
|
|
33268
33207
|
// invalidate the previous corresponding texture so that it can reuploaded once changed
|
|
33269
33208
|
this.glTextureUnit = renderer.cache.getUnit(renderer.cache.get(this.canvasTexture.canvas));
|
|
33270
33209
|
renderer.currentCompositor.unbindTexture2D(null, this.glTextureUnit);
|
|
@@ -33394,7 +33333,7 @@ class Text extends Renderable$1 {
|
|
|
33394
33333
|
*/
|
|
33395
33334
|
destroy() {
|
|
33396
33335
|
if (this.offScreenCanvas === true) {
|
|
33397
|
-
if (renderer instanceof WebGLRenderer
|
|
33336
|
+
if (renderer instanceof WebGLRenderer) {
|
|
33398
33337
|
renderer.currentCompositor.deleteTexture2D(renderer.currentCompositor.getTexture2D(this.glTextureUnit));
|
|
33399
33338
|
this.glTextureUnit = undefined;
|
|
33400
33339
|
}
|
|
@@ -33410,14 +33349,13 @@ class Text extends Renderable$1 {
|
|
|
33410
33349
|
super.destroy();
|
|
33411
33350
|
}
|
|
33412
33351
|
}
|
|
33413
|
-
var Text$1 = Text;
|
|
33414
33352
|
|
|
33415
33353
|
/**
|
|
33416
33354
|
* @classdesc
|
|
33417
33355
|
* a bitmap font object
|
|
33418
33356
|
* @augments Renderable
|
|
33419
33357
|
*/
|
|
33420
|
-
class BitmapText extends Renderable
|
|
33358
|
+
class BitmapText extends Renderable {
|
|
33421
33359
|
/**
|
|
33422
33360
|
* @param {number} x - position of the text object
|
|
33423
33361
|
* @param {number} y - position of the text object
|
|
@@ -33537,7 +33475,7 @@ class BitmapText extends Renderable$1 {
|
|
|
33537
33475
|
}
|
|
33538
33476
|
|
|
33539
33477
|
// instance to text metrics functions
|
|
33540
|
-
this.metrics = new TextMetrics
|
|
33478
|
+
this.metrics = new TextMetrics(this);
|
|
33541
33479
|
|
|
33542
33480
|
// resize if necessary
|
|
33543
33481
|
if (typeof settings.size === "number" && settings.size !== 1.0) {
|
|
@@ -33599,7 +33537,7 @@ class BitmapText extends Renderable$1 {
|
|
|
33599
33537
|
return this.tint;
|
|
33600
33538
|
}
|
|
33601
33539
|
set fillStyle(value) {
|
|
33602
|
-
if (value instanceof Color
|
|
33540
|
+
if (value instanceof Color) {
|
|
33603
33541
|
this.tint.copy(value);
|
|
33604
33542
|
} else {
|
|
33605
33543
|
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
@@ -33760,7 +33698,6 @@ class BitmapText extends Renderable$1 {
|
|
|
33760
33698
|
}
|
|
33761
33699
|
|
|
33762
33700
|
}
|
|
33763
|
-
var BitmapText$1 = BitmapText;
|
|
33764
33701
|
|
|
33765
33702
|
// bitmap constants
|
|
33766
33703
|
const LOG2_PAGE_SIZE = 9;
|
|
@@ -33770,7 +33707,7 @@ const PAGE_SIZE = 1 << LOG2_PAGE_SIZE;
|
|
|
33770
33707
|
* a glyph representing a single character in a font
|
|
33771
33708
|
* @ignore
|
|
33772
33709
|
*/
|
|
33773
|
-
class Glyph {
|
|
33710
|
+
class Glyph {
|
|
33774
33711
|
/**
|
|
33775
33712
|
* @ignore
|
|
33776
33713
|
*/
|
|
@@ -33818,7 +33755,6 @@ class Glyph {
|
|
|
33818
33755
|
page[ch & PAGE_SIZE - 1] = value;
|
|
33819
33756
|
}
|
|
33820
33757
|
}
|
|
33821
|
-
var Glyph$1 = Glyph;
|
|
33822
33758
|
|
|
33823
33759
|
// bitmap constants
|
|
33824
33760
|
const capChars = ["M", "N", "B", "D", "C", "E", "F", "K", "A", "G", "H", "I", "J", "L", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"];
|
|
@@ -33865,7 +33801,7 @@ function createSpaceGlyph(glyphs) {
|
|
|
33865
33801
|
var spaceCharCode = " ".charCodeAt(0);
|
|
33866
33802
|
var glyph = glyphs[spaceCharCode];
|
|
33867
33803
|
if (!glyph) {
|
|
33868
|
-
glyph = new Glyph
|
|
33804
|
+
glyph = new Glyph();
|
|
33869
33805
|
glyph.id = spaceCharCode;
|
|
33870
33806
|
glyph.xadvance = getFirstGlyph(glyphs).xadvance;
|
|
33871
33807
|
glyphs[spaceCharCode] = glyph;
|
|
@@ -33876,7 +33812,7 @@ function createSpaceGlyph(glyphs) {
|
|
|
33876
33812
|
* Class for storing relevant data from the font file.
|
|
33877
33813
|
* @ignore
|
|
33878
33814
|
*/
|
|
33879
|
-
class BitmapTextData {
|
|
33815
|
+
class BitmapTextData {
|
|
33880
33816
|
|
|
33881
33817
|
/**
|
|
33882
33818
|
* @param {string} data - The bitmap font data pulled from the resource loader using me.loader.getBinary()
|
|
@@ -33959,7 +33895,7 @@ class BitmapTextData {
|
|
|
33959
33895
|
glyph.setKerning(second, amount);
|
|
33960
33896
|
}
|
|
33961
33897
|
} else {
|
|
33962
|
-
glyph = new Glyph
|
|
33898
|
+
glyph = new Glyph();
|
|
33963
33899
|
|
|
33964
33900
|
var ch = parseFloat(characterValues[2]);
|
|
33965
33901
|
glyph.id = ch;
|
|
@@ -34007,14 +33943,13 @@ class BitmapTextData {
|
|
|
34007
33943
|
this.capHeight -= padY;
|
|
34008
33944
|
}
|
|
34009
33945
|
}
|
|
34010
|
-
var BitmapTextData$1 = BitmapTextData;
|
|
34011
33946
|
|
|
34012
33947
|
/**
|
|
34013
33948
|
* @classdesc
|
|
34014
33949
|
* a generic Color Layer Object. Fills the entire Canvas with the color not just the container the object belongs to.
|
|
34015
33950
|
* @augments Renderable
|
|
34016
33951
|
*/
|
|
34017
|
-
class ColorLayer extends Renderable
|
|
33952
|
+
class ColorLayer extends Renderable {
|
|
34018
33953
|
/**
|
|
34019
33954
|
* @param {string} name - Layer name
|
|
34020
33955
|
* @param {Color|string} color - CSS color
|
|
@@ -34076,14 +34011,12 @@ class ColorLayer extends Renderable$1 {
|
|
|
34076
34011
|
|
|
34077
34012
|
}
|
|
34078
34013
|
|
|
34079
|
-
var ColorLayer$1 = ColorLayer;
|
|
34080
|
-
|
|
34081
34014
|
/**
|
|
34082
34015
|
* @classdesc
|
|
34083
34016
|
* a generic Image Layer Object
|
|
34084
34017
|
* @augments Renderable
|
|
34085
34018
|
*/
|
|
34086
|
-
class ImageLayer extends Sprite
|
|
34019
|
+
class ImageLayer extends Sprite {
|
|
34087
34020
|
/**
|
|
34088
34021
|
* @param {number} x - x coordinate
|
|
34089
34022
|
* @param {number} y - y coordinate
|
|
@@ -34367,7 +34300,6 @@ class ImageLayer extends Sprite$1 {
|
|
|
34367
34300
|
}
|
|
34368
34301
|
|
|
34369
34302
|
}
|
|
34370
|
-
var ImageLayer$1 = ImageLayer;
|
|
34371
34303
|
|
|
34372
34304
|
/**
|
|
34373
34305
|
* @classdesc
|
|
@@ -34377,7 +34309,7 @@ var ImageLayer$1 = ImageLayer;
|
|
|
34377
34309
|
* @see https://en.wikipedia.org/wiki/9-slice_scaling
|
|
34378
34310
|
* @augments Sprite
|
|
34379
34311
|
*/
|
|
34380
|
-
class NineSliceSprite extends Sprite
|
|
34312
|
+
class NineSliceSprite extends Sprite {
|
|
34381
34313
|
/**
|
|
34382
34314
|
* @param {number} x - the x coordinates of the sprite object
|
|
34383
34315
|
* @param {number} y - the y coordinates of the sprite object
|
|
@@ -34604,7 +34536,6 @@ class NineSliceSprite extends Sprite$1 {
|
|
|
34604
34536
|
);
|
|
34605
34537
|
}
|
|
34606
34538
|
}
|
|
34607
|
-
var NineSliceSprite$1 = NineSliceSprite;
|
|
34608
34539
|
|
|
34609
34540
|
/**
|
|
34610
34541
|
* @classdesc
|
|
@@ -34613,7 +34544,7 @@ var NineSliceSprite$1 = NineSliceSprite;
|
|
|
34613
34544
|
* text and images.
|
|
34614
34545
|
* @augments Container
|
|
34615
34546
|
*/
|
|
34616
|
-
class UIBaseElement extends Container
|
|
34547
|
+
class UIBaseElement extends Container {
|
|
34617
34548
|
/**
|
|
34618
34549
|
*
|
|
34619
34550
|
* @param {number} x - The x position of the container
|
|
@@ -34805,14 +34736,13 @@ class UIBaseElement extends Container$1 {
|
|
|
34805
34736
|
timer$1.clearTimeout(this.holdTimeout);
|
|
34806
34737
|
}
|
|
34807
34738
|
}
|
|
34808
|
-
var UIBaseElement$1 = UIBaseElement;
|
|
34809
34739
|
|
|
34810
34740
|
/**
|
|
34811
34741
|
* @classdesc
|
|
34812
34742
|
* This is a basic base text button which you can use in your Game UI.
|
|
34813
34743
|
* @augments UIBaseElement
|
|
34814
34744
|
*/
|
|
34815
|
-
class UITextButton extends UIBaseElement
|
|
34745
|
+
class UITextButton extends UIBaseElement {
|
|
34816
34746
|
/**
|
|
34817
34747
|
* A Text Button with an outlined background border, filled with background color.
|
|
34818
34748
|
* It uses a RoundRect as background and changes the background color on hovering over.
|
|
@@ -34863,14 +34793,14 @@ class UITextButton extends UIBaseElement$1 {
|
|
|
34863
34793
|
settings.offScreenCanvas = settings.offScreenCanvas || false;
|
|
34864
34794
|
settings.fillStyle = settings.fillStyle || "#ffffff";
|
|
34865
34795
|
settings.lineWidth = settings.lineWidth || 1;
|
|
34866
|
-
settings.anchorPoint = settings.anchorPoint || new Vector2d
|
|
34796
|
+
settings.anchorPoint = settings.anchorPoint || new Vector2d(0, 0);
|
|
34867
34797
|
|
|
34868
|
-
let font = new BitmapText
|
|
34798
|
+
let font = new BitmapText(x, y, settings);
|
|
34869
34799
|
let dimensions = font.measureText();
|
|
34870
34800
|
settings.borderWidth = settings.borderWidth || dimensions.width + 16;
|
|
34871
34801
|
settings.borderHeight = settings.borderHeight || dimensions.height + 16;
|
|
34872
34802
|
|
|
34873
|
-
let border = new RoundRect
|
|
34803
|
+
let border = new RoundRect(
|
|
34874
34804
|
x,
|
|
34875
34805
|
y,
|
|
34876
34806
|
settings.borderWidth,
|
|
@@ -34920,14 +34850,13 @@ class UITextButton extends UIBaseElement$1 {
|
|
|
34920
34850
|
);
|
|
34921
34851
|
}
|
|
34922
34852
|
}
|
|
34923
|
-
var UITextButton$1 = UITextButton;
|
|
34924
34853
|
|
|
34925
34854
|
/**
|
|
34926
34855
|
* @classdesc
|
|
34927
34856
|
* This is a basic sprite based button which you can use in your Game UI.
|
|
34928
34857
|
* @augments Sprite
|
|
34929
34858
|
*/
|
|
34930
|
-
class UISpriteElement extends Sprite
|
|
34859
|
+
class UISpriteElement extends Sprite {
|
|
34931
34860
|
/**
|
|
34932
34861
|
* @param {number} x - the x coordinate of the GUI Object
|
|
34933
34862
|
* @param {number} y - the y coordinate of the GUI Object
|
|
@@ -35134,14 +35063,13 @@ class UISpriteElement extends Sprite$1 {
|
|
|
35134
35063
|
timer$1.clearTimeout(this.holdTimeout);
|
|
35135
35064
|
}
|
|
35136
35065
|
}
|
|
35137
|
-
var UISpriteElement$1 = UISpriteElement;
|
|
35138
35066
|
|
|
35139
35067
|
/**
|
|
35140
35068
|
* @classdesc
|
|
35141
35069
|
* a basic collectable helper class for immovable object (e.g. a coin)
|
|
35142
35070
|
* @augments Sprite
|
|
35143
35071
|
*/
|
|
35144
|
-
class Collectable extends Sprite
|
|
35072
|
+
class Collectable extends Sprite {
|
|
35145
35073
|
/**
|
|
35146
35074
|
* @param {number} x - the x coordinates of the collectable
|
|
35147
35075
|
* @param {number} y - the y coordinates of the collectable
|
|
@@ -35165,7 +35093,7 @@ class Collectable extends Sprite$1 {
|
|
|
35165
35093
|
pool$1.pull("Vector2d", this.width, this.height)
|
|
35166
35094
|
]);
|
|
35167
35095
|
}
|
|
35168
|
-
this.body = new Body
|
|
35096
|
+
this.body = new Body(this, shape);
|
|
35169
35097
|
this.body.collisionType = collision$1.types.COLLECTABLE_OBJECT;
|
|
35170
35098
|
// by default only collides with PLAYER_OBJECT
|
|
35171
35099
|
this.body.setCollisionMask(collision$1.types.PLAYER_OBJECT);
|
|
@@ -35183,14 +35111,12 @@ class Collectable extends Sprite$1 {
|
|
|
35183
35111
|
|
|
35184
35112
|
}
|
|
35185
35113
|
|
|
35186
|
-
var Collectable$1 = Collectable;
|
|
35187
|
-
|
|
35188
35114
|
/**
|
|
35189
35115
|
* @classdesc
|
|
35190
35116
|
* trigger an event when colliding with another object
|
|
35191
35117
|
* @augments Renderable
|
|
35192
35118
|
*/
|
|
35193
|
-
class Trigger extends Renderable
|
|
35119
|
+
class Trigger extends Renderable {
|
|
35194
35120
|
/**
|
|
35195
35121
|
* @param {number} x - the x coordinates of the trigger area
|
|
35196
35122
|
* @param {number} y - the y coordinates of the trigger area
|
|
@@ -35255,7 +35181,7 @@ class Trigger extends Renderable$1 {
|
|
|
35255
35181
|
pool$1.pull("Vector2d", this.width, this.height)
|
|
35256
35182
|
]);
|
|
35257
35183
|
}
|
|
35258
|
-
this.body = new Body
|
|
35184
|
+
this.body = new Body(this, shape);
|
|
35259
35185
|
this.body.collisionType = collision$1.types.ACTION_OBJECT;
|
|
35260
35186
|
// by default only collides with PLAYER_OBJECT
|
|
35261
35187
|
this.body.setCollisionMask(collision$1.types.PLAYER_OBJECT);
|
|
@@ -35325,7 +35251,6 @@ class Trigger extends Renderable$1 {
|
|
|
35325
35251
|
}
|
|
35326
35252
|
|
|
35327
35253
|
}
|
|
35328
|
-
var Trigger$1 = Trigger;
|
|
35329
35254
|
|
|
35330
35255
|
/** @ignore */
|
|
35331
35256
|
function createGradient(light) {
|
|
@@ -35375,7 +35300,7 @@ function createGradient(light) {
|
|
|
35375
35300
|
* (multiple lights are not supported, alpha component of the ambient light is ignored)
|
|
35376
35301
|
* @see stage.lights
|
|
35377
35302
|
*/
|
|
35378
|
-
class Light2d extends Renderable
|
|
35303
|
+
class Light2d extends Renderable {
|
|
35379
35304
|
/**
|
|
35380
35305
|
* @param {number} x - The horizontal position of the light.
|
|
35381
35306
|
* @param {number} y - The vertical position of the light.
|
|
@@ -35470,7 +35395,6 @@ class Light2d extends Renderable$1 {
|
|
|
35470
35395
|
super.destroy();
|
|
35471
35396
|
}
|
|
35472
35397
|
}
|
|
35473
|
-
var Light2d$1 = Light2d;
|
|
35474
35398
|
|
|
35475
35399
|
/**
|
|
35476
35400
|
* @classdesc
|
|
@@ -35478,7 +35402,7 @@ var Light2d$1 = Light2d;
|
|
|
35478
35402
|
* @see DropTarget
|
|
35479
35403
|
* @augments Renderable
|
|
35480
35404
|
*/
|
|
35481
|
-
class Draggable extends Renderable
|
|
35405
|
+
class Draggable extends Renderable {
|
|
35482
35406
|
/**
|
|
35483
35407
|
* @param {number} x - the x coordinates of the draggable object
|
|
35484
35408
|
* @param {number} y - the y coordinates of the draggable object
|
|
@@ -35490,7 +35414,7 @@ class Draggable extends Renderable$1 {
|
|
|
35490
35414
|
this.isKinematic = false;
|
|
35491
35415
|
this.dragging = false;
|
|
35492
35416
|
this.dragId = null;
|
|
35493
|
-
this.grabOffset = new Vector2d
|
|
35417
|
+
this.grabOffset = new Vector2d(0, 0);
|
|
35494
35418
|
this.initEvents();
|
|
35495
35419
|
}
|
|
35496
35420
|
|
|
@@ -35586,7 +35510,7 @@ class Draggable extends Renderable$1 {
|
|
|
35586
35510
|
* @see Draggable
|
|
35587
35511
|
* @augments Renderable
|
|
35588
35512
|
*/
|
|
35589
|
-
class DropTarget extends Renderable
|
|
35513
|
+
class DropTarget extends Renderable {
|
|
35590
35514
|
/**
|
|
35591
35515
|
* @param {number} x - the x coordinates of the drop target
|
|
35592
35516
|
* @param {number} y - the y coordinates of the drop target
|
|
@@ -36011,7 +35935,7 @@ function createDefaultParticleTexture(w = 8, h = 8) {
|
|
|
36011
35935
|
* Particle Emitter Object.
|
|
36012
35936
|
* @augments Container
|
|
36013
35937
|
*/
|
|
36014
|
-
class ParticleEmitter extends Container
|
|
35938
|
+
class ParticleEmitter extends Container {
|
|
36015
35939
|
/**
|
|
36016
35940
|
* @param {number} x - x position of the particle emitter
|
|
36017
35941
|
* @param {number} y - y position of the particle emitter
|
|
@@ -36246,14 +36170,12 @@ class ParticleEmitter extends Container$1 {
|
|
|
36246
36170
|
}
|
|
36247
36171
|
}
|
|
36248
36172
|
|
|
36249
|
-
var ParticleEmitter$1 = ParticleEmitter;
|
|
36250
|
-
|
|
36251
36173
|
/**
|
|
36252
36174
|
* @classdesc
|
|
36253
36175
|
* Single Particle Object.
|
|
36254
36176
|
* @augments Renderable
|
|
36255
36177
|
*/
|
|
36256
|
-
class Particle extends Renderable
|
|
36178
|
+
class Particle extends Renderable {
|
|
36257
36179
|
/**
|
|
36258
36180
|
* @param {ParticleEmitter} emitter - the particle emitter
|
|
36259
36181
|
*/
|
|
@@ -36421,15 +36343,13 @@ class Particle extends Renderable$1 {
|
|
|
36421
36343
|
}
|
|
36422
36344
|
}
|
|
36423
36345
|
|
|
36424
|
-
var Particle$1 = Particle;
|
|
36425
|
-
|
|
36426
36346
|
/**
|
|
36427
36347
|
* @classdesc
|
|
36428
36348
|
* a Generic Object Entity
|
|
36429
36349
|
* @augments Renderable
|
|
36430
36350
|
* @see Renderable
|
|
36431
36351
|
*/
|
|
36432
|
-
class Entity extends Renderable
|
|
36352
|
+
class Entity extends Renderable {
|
|
36433
36353
|
/**
|
|
36434
36354
|
* @param {number} x - the x coordinates of the entity object
|
|
36435
36355
|
* @param {number} y - the y coordinates of the entity object
|
|
@@ -36467,7 +36387,7 @@ class Entity extends Renderable$1 {
|
|
|
36467
36387
|
// set the frame size to the given entity size, if not defined in settings
|
|
36468
36388
|
settings.framewidth = settings.framewidth || settings.width;
|
|
36469
36389
|
settings.frameheight = settings.frameheight || settings.height;
|
|
36470
|
-
this.renderable = new Sprite
|
|
36390
|
+
this.renderable = new Sprite(0, 0, settings);
|
|
36471
36391
|
}
|
|
36472
36392
|
|
|
36473
36393
|
// Update anchorPoint
|
|
@@ -36527,7 +36447,7 @@ class Entity extends Renderable$1 {
|
|
|
36527
36447
|
pool$1.pull("Vector2d", 0, this.height)
|
|
36528
36448
|
]);
|
|
36529
36449
|
}
|
|
36530
|
-
this.body = new Body
|
|
36450
|
+
this.body = new Body(this, settings.shapes, this.onBodyUpdate.bind(this));
|
|
36531
36451
|
|
|
36532
36452
|
// resize the entity if required
|
|
36533
36453
|
if (this.width === 0 && this.height === 0) {
|
|
@@ -36556,7 +36476,7 @@ class Entity extends Renderable$1 {
|
|
|
36556
36476
|
}
|
|
36557
36477
|
|
|
36558
36478
|
set renderable(value) {
|
|
36559
|
-
if (value instanceof Renderable
|
|
36479
|
+
if (value instanceof Renderable) {
|
|
36560
36480
|
this.children[0] = value;
|
|
36561
36481
|
this.children[0].ancestor = this;
|
|
36562
36482
|
} else {
|
|
@@ -36595,7 +36515,7 @@ class Entity extends Renderable$1 {
|
|
|
36595
36515
|
this.pos.y + this.body.getBounds().y
|
|
36596
36516
|
);
|
|
36597
36517
|
|
|
36598
|
-
if (this.renderable instanceof Renderable
|
|
36518
|
+
if (this.renderable instanceof Renderable) {
|
|
36599
36519
|
// draw the child renderable's anchorPoint at the entity's
|
|
36600
36520
|
// anchor point. the entity's anchor point is a scale from
|
|
36601
36521
|
// body position to body width/height
|
|
@@ -36616,7 +36536,7 @@ class Entity extends Renderable$1 {
|
|
|
36616
36536
|
*/
|
|
36617
36537
|
draw(renderer, viewport) {
|
|
36618
36538
|
var renderable = this.renderable;
|
|
36619
|
-
if (renderable instanceof Renderable
|
|
36539
|
+
if (renderable instanceof Renderable) {
|
|
36620
36540
|
// predraw (apply transforms)
|
|
36621
36541
|
renderable.preDraw(renderer);
|
|
36622
36542
|
|
|
@@ -36656,7 +36576,6 @@ class Entity extends Renderable$1 {
|
|
|
36656
36576
|
}
|
|
36657
36577
|
|
|
36658
36578
|
}
|
|
36659
|
-
var Entity$1 = Entity;
|
|
36660
36579
|
|
|
36661
36580
|
/*
|
|
36662
36581
|
* placeholder for all deprecated classes and corresponding alias for backward compatibility
|
|
@@ -36708,7 +36627,7 @@ function warning(deprecated, replacement, version) {
|
|
|
36708
36627
|
* @deprecated since 10.4.0
|
|
36709
36628
|
* @see TextureAtlas
|
|
36710
36629
|
*/
|
|
36711
|
-
Object.defineProperty(Renderer
|
|
36630
|
+
Object.defineProperty(Renderer.prototype, "Texture", {
|
|
36712
36631
|
/**
|
|
36713
36632
|
* @ignore
|
|
36714
36633
|
*/
|
|
@@ -36764,7 +36683,7 @@ class DroptargetEntity extends DropTarget {
|
|
|
36764
36683
|
* @deprecated since 13.1.0
|
|
36765
36684
|
* @see getCanvas();
|
|
36766
36685
|
*/
|
|
36767
|
-
Renderer
|
|
36686
|
+
Renderer.prototype.getScreenCanvas = function() {
|
|
36768
36687
|
warning("getScreenCanvas", "getCanvas", "13.1.0");
|
|
36769
36688
|
return this.getCanvas();
|
|
36770
36689
|
};
|
|
@@ -36778,7 +36697,7 @@ Renderer$1.prototype.getScreenCanvas = function() {
|
|
|
36778
36697
|
* @deprecated since 13.1.0
|
|
36779
36698
|
* @see getContext();
|
|
36780
36699
|
*/
|
|
36781
|
-
Renderer
|
|
36700
|
+
Renderer.prototype.getScreenContext = function() {
|
|
36782
36701
|
warning("getScreenContext", "getContext", "13.1.0");
|
|
36783
36702
|
return this.getContext();
|
|
36784
36703
|
};
|
|
@@ -36790,7 +36709,7 @@ Renderer$1.prototype.getScreenContext = function() {
|
|
|
36790
36709
|
* @deprecated since 14.0.0
|
|
36791
36710
|
* @see UISpriteElement
|
|
36792
36711
|
*/
|
|
36793
|
-
class GUI_Object extends UISpriteElement
|
|
36712
|
+
class GUI_Object extends UISpriteElement {
|
|
36794
36713
|
/**
|
|
36795
36714
|
* @param {number} x - the x coordinate of the GUI Object
|
|
36796
36715
|
* @param {number} y - the y coordinate of the GUI Object
|
|
@@ -36812,7 +36731,7 @@ Renderer$1.prototype.getScreenContext = function() {
|
|
|
36812
36731
|
* @name version
|
|
36813
36732
|
* @type {string}
|
|
36814
36733
|
*/
|
|
36815
|
-
const version = "14.1.
|
|
36734
|
+
const version = "14.1.2";
|
|
36816
36735
|
|
|
36817
36736
|
|
|
36818
36737
|
/**
|
|
@@ -36846,64 +36765,64 @@ function boot() {
|
|
|
36846
36765
|
}
|
|
36847
36766
|
|
|
36848
36767
|
// register all built-ins objects into the object pool
|
|
36849
|
-
pool$1.register("me.Entity", Entity
|
|
36850
|
-
pool$1.register("me.Collectable", Collectable
|
|
36851
|
-
pool$1.register("me.Trigger", Trigger
|
|
36852
|
-
pool$1.register("me.Light2d", Light2d
|
|
36853
|
-
pool$1.register("me.Tween", Tween
|
|
36854
|
-
pool$1.register("me.Color", Color
|
|
36855
|
-
pool$1.register("me.Particle", Particle
|
|
36856
|
-
pool$1.register("me.Sprite", Sprite
|
|
36857
|
-
pool$1.register("me.NineSliceSprite", NineSliceSprite
|
|
36858
|
-
pool$1.register("me.Renderable", Renderable
|
|
36859
|
-
pool$1.register("me.Text", Text
|
|
36860
|
-
pool$1.register("me.BitmapText", BitmapText
|
|
36861
|
-
pool$1.register("me.BitmapTextData", BitmapTextData
|
|
36862
|
-
pool$1.register("me.ImageLayer", ImageLayer
|
|
36863
|
-
pool$1.register("me.ColorLayer", ColorLayer
|
|
36864
|
-
pool$1.register("me.Vector2d", Vector2d
|
|
36865
|
-
pool$1.register("me.Vector3d", Vector3d
|
|
36866
|
-
pool$1.register("me.ObservableVector2d", ObservableVector2d
|
|
36867
|
-
pool$1.register("me.ObservableVector3d", ObservableVector3d
|
|
36868
|
-
pool$1.register("me.Matrix2d", Matrix2d
|
|
36869
|
-
pool$1.register("me.Matrix3d", Matrix3d
|
|
36870
|
-
pool$1.register("me.Rect", Rect
|
|
36871
|
-
pool$1.register("me.RoundRect", RoundRect
|
|
36872
|
-
pool$1.register("me.Polygon", Polygon
|
|
36873
|
-
pool$1.register("me.Line", Line
|
|
36874
|
-
pool$1.register("me.Point", Point
|
|
36875
|
-
pool$1.register("me.Ellipse", Ellipse
|
|
36876
|
-
pool$1.register("me.Bounds", Bounds
|
|
36768
|
+
pool$1.register("me.Entity", Entity);
|
|
36769
|
+
pool$1.register("me.Collectable", Collectable);
|
|
36770
|
+
pool$1.register("me.Trigger", Trigger);
|
|
36771
|
+
pool$1.register("me.Light2d", Light2d);
|
|
36772
|
+
pool$1.register("me.Tween", Tween, true);
|
|
36773
|
+
pool$1.register("me.Color", Color, true);
|
|
36774
|
+
pool$1.register("me.Particle", Particle, true);
|
|
36775
|
+
pool$1.register("me.Sprite", Sprite);
|
|
36776
|
+
pool$1.register("me.NineSliceSprite", NineSliceSprite);
|
|
36777
|
+
pool$1.register("me.Renderable", Renderable);
|
|
36778
|
+
pool$1.register("me.Text", Text, true);
|
|
36779
|
+
pool$1.register("me.BitmapText", BitmapText);
|
|
36780
|
+
pool$1.register("me.BitmapTextData", BitmapTextData, true);
|
|
36781
|
+
pool$1.register("me.ImageLayer", ImageLayer);
|
|
36782
|
+
pool$1.register("me.ColorLayer", ColorLayer, true);
|
|
36783
|
+
pool$1.register("me.Vector2d", Vector2d, true);
|
|
36784
|
+
pool$1.register("me.Vector3d", Vector3d, true);
|
|
36785
|
+
pool$1.register("me.ObservableVector2d", ObservableVector2d, true);
|
|
36786
|
+
pool$1.register("me.ObservableVector3d", ObservableVector3d, true);
|
|
36787
|
+
pool$1.register("me.Matrix2d", Matrix2d, true);
|
|
36788
|
+
pool$1.register("me.Matrix3d", Matrix3d, true);
|
|
36789
|
+
pool$1.register("me.Rect", Rect, true);
|
|
36790
|
+
pool$1.register("me.RoundRect", RoundRect, true);
|
|
36791
|
+
pool$1.register("me.Polygon", Polygon, true);
|
|
36792
|
+
pool$1.register("me.Line", Line, true);
|
|
36793
|
+
pool$1.register("me.Point", Point, true);
|
|
36794
|
+
pool$1.register("me.Ellipse", Ellipse, true);
|
|
36795
|
+
pool$1.register("me.Bounds", Bounds, true);
|
|
36877
36796
|
|
|
36878
36797
|
// duplicate all entries if use with no namespace (e.g. es6)
|
|
36879
|
-
pool$1.register("Entity", Entity
|
|
36880
|
-
pool$1.register("Collectable", Collectable
|
|
36881
|
-
pool$1.register("Trigger", Trigger
|
|
36882
|
-
pool$1.register("Light2d", Light2d
|
|
36883
|
-
pool$1.register("Tween", Tween
|
|
36884
|
-
pool$1.register("Color", Color
|
|
36885
|
-
pool$1.register("Particle", Particle
|
|
36886
|
-
pool$1.register("Sprite", Sprite
|
|
36887
|
-
pool$1.register("NineSliceSprite", NineSliceSprite
|
|
36888
|
-
pool$1.register("Renderable", Renderable
|
|
36889
|
-
pool$1.register("Text", Text
|
|
36890
|
-
pool$1.register("BitmapText", BitmapText
|
|
36891
|
-
pool$1.register("BitmapTextData", BitmapTextData
|
|
36892
|
-
pool$1.register("ImageLayer", ImageLayer
|
|
36893
|
-
pool$1.register("ColorLayer", ColorLayer
|
|
36894
|
-
pool$1.register("Vector2d", Vector2d
|
|
36895
|
-
pool$1.register("Vector3d", Vector3d
|
|
36896
|
-
pool$1.register("ObservableVector2d", ObservableVector2d
|
|
36897
|
-
pool$1.register("ObservableVector3d", ObservableVector3d
|
|
36898
|
-
pool$1.register("Matrix2d", Matrix2d
|
|
36899
|
-
pool$1.register("Matrix3d", Matrix3d
|
|
36900
|
-
pool$1.register("Rect", Rect
|
|
36901
|
-
pool$1.register("RoundRect", RoundRect
|
|
36902
|
-
pool$1.register("Polygon", Polygon
|
|
36903
|
-
pool$1.register("Line", Line
|
|
36904
|
-
pool$1.register("Point", Point
|
|
36905
|
-
pool$1.register("Ellipse", Ellipse
|
|
36906
|
-
pool$1.register("Bounds", Bounds
|
|
36798
|
+
pool$1.register("Entity", Entity);
|
|
36799
|
+
pool$1.register("Collectable", Collectable);
|
|
36800
|
+
pool$1.register("Trigger", Trigger);
|
|
36801
|
+
pool$1.register("Light2d", Light2d);
|
|
36802
|
+
pool$1.register("Tween", Tween, true);
|
|
36803
|
+
pool$1.register("Color", Color, true);
|
|
36804
|
+
pool$1.register("Particle", Particle, true);
|
|
36805
|
+
pool$1.register("Sprite", Sprite);
|
|
36806
|
+
pool$1.register("NineSliceSprite", NineSliceSprite);
|
|
36807
|
+
pool$1.register("Renderable", Renderable);
|
|
36808
|
+
pool$1.register("Text", Text, true);
|
|
36809
|
+
pool$1.register("BitmapText", BitmapText);
|
|
36810
|
+
pool$1.register("BitmapTextData", BitmapTextData, true);
|
|
36811
|
+
pool$1.register("ImageLayer", ImageLayer);
|
|
36812
|
+
pool$1.register("ColorLayer", ColorLayer, true);
|
|
36813
|
+
pool$1.register("Vector2d", Vector2d, true);
|
|
36814
|
+
pool$1.register("Vector3d", Vector3d, true);
|
|
36815
|
+
pool$1.register("ObservableVector2d", ObservableVector2d, true);
|
|
36816
|
+
pool$1.register("ObservableVector3d", ObservableVector3d, true);
|
|
36817
|
+
pool$1.register("Matrix2d", Matrix2d, true);
|
|
36818
|
+
pool$1.register("Matrix3d", Matrix3d, true);
|
|
36819
|
+
pool$1.register("Rect", Rect, true);
|
|
36820
|
+
pool$1.register("RoundRect", RoundRect, true);
|
|
36821
|
+
pool$1.register("Polygon", Polygon, true);
|
|
36822
|
+
pool$1.register("Line", Line, true);
|
|
36823
|
+
pool$1.register("Point", Point, true);
|
|
36824
|
+
pool$1.register("Ellipse", Ellipse, true);
|
|
36825
|
+
pool$1.register("Bounds", Bounds, true);
|
|
36907
36826
|
pool$1.register("CanvasTexture", CanvasTexture$1, true);
|
|
36908
36827
|
|
|
36909
36828
|
// publish Boot notification
|
|
@@ -36926,4 +36845,4 @@ onReady(() => {
|
|
|
36926
36845
|
}
|
|
36927
36846
|
});
|
|
36928
36847
|
|
|
36929
|
-
export { BitmapText
|
|
36848
|
+
export { BitmapText, BitmapTextData, Body, Bounds, Camera2d, CanvasRenderer, Collectable, Color, ColorLayer, Container, Draggable, DraggableEntity, DropTarget, DroptargetEntity, Ellipse, Entity, GLShader, GUI_Object, ImageLayer, Light2d, Line, math as Math, Matrix2d, Matrix3d, NineSliceSprite, ObservableVector2d, ObservableVector3d, Particle, ParticleEmitter, ParticleEmitterSettings$1 as ParticleEmitterSettings, Point, Pointer$1 as Pointer, Polygon, QuadTree, Rect, Renderable, Renderer, RoundRect, Sprite, Stage, TMXHexagonalRenderer, TMXIsometricRenderer, TMXLayer, TMXOrthogonalRenderer, TMXRenderer, TMXStaggeredRenderer, TMXTileMap, TMXTileset, TMXTilesetGroup, Text, TextureAtlas, Tile, Trigger, Tween, UIBaseElement, UISpriteElement, UITextButton, Vector2d, Vector3d, WebGLCompositor, WebGLRenderer, World, audio, boot, collision$1 as collision, device, event, game$1 as game, initialized, input, level$1 as level, loader$1 as loader, plugin, plugins, pool$1 as pool, save$1 as save, skipAutoInit, state$1 as state, timer$1 as timer, utils$1 as utils, version, video, warning };
|