melonjs 14.1.0 → 14.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
- package/dist/melonjs.mjs/_virtual/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/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 -1
- 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.d.ts +138 -199
- package/dist/melonjs.module.js +659 -736
- package/package.json +6 -6
- 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/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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v14.1.
|
|
2
|
+
* melonJS Game Engine - v14.1.1
|
|
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();
|
|
@@ -18547,7 +18902,7 @@ var collision$1 = collision;
|
|
|
18547
18902
|
* a Generic Physic Body Object with some physic properties and behavior functionality, to as a member of a Renderable.
|
|
18548
18903
|
* @see Renderable.body
|
|
18549
18904
|
*/
|
|
18550
|
-
class Body {
|
|
18905
|
+
class Body {
|
|
18551
18906
|
/**
|
|
18552
18907
|
* @param {Renderable} ancestor - the parent object this body is attached to
|
|
18553
18908
|
* @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 +19133,13 @@ class Body {
|
|
|
18778
19133
|
* this.body.addShape(me.loader.getJSON("shapesdef").banana);
|
|
18779
19134
|
*/
|
|
18780
19135
|
addShape(shape) {
|
|
18781
|
-
if (shape instanceof Rect
|
|
19136
|
+
if (shape instanceof Rect || shape instanceof Bounds) {
|
|
18782
19137
|
var poly = shape.toPolygon();
|
|
18783
19138
|
this.shapes.push(poly);
|
|
18784
19139
|
// update the body bounds
|
|
18785
19140
|
this.bounds.add(poly.points);
|
|
18786
19141
|
this.bounds.translate(poly.pos);
|
|
18787
|
-
} else if (shape instanceof Ellipse
|
|
19142
|
+
} else if (shape instanceof Ellipse) {
|
|
18788
19143
|
if (!this.shapes.includes(shape)) {
|
|
18789
19144
|
// see removeShape
|
|
18790
19145
|
this.shapes.push(shape);
|
|
@@ -18796,7 +19151,7 @@ class Body {
|
|
|
18796
19151
|
shape.getBounds().x,
|
|
18797
19152
|
shape.getBounds().y
|
|
18798
19153
|
);
|
|
18799
|
-
} else if (shape instanceof Polygon
|
|
19154
|
+
} else if (shape instanceof Polygon) {
|
|
18800
19155
|
if (!this.shapes.includes(shape)) {
|
|
18801
19156
|
// see removeShape
|
|
18802
19157
|
this.shapes.push(shape);
|
|
@@ -18804,7 +19159,7 @@ class Body {
|
|
|
18804
19159
|
// update the body bounds
|
|
18805
19160
|
this.bounds.add(shape.points);
|
|
18806
19161
|
this.bounds.translate(shape.pos);
|
|
18807
|
-
} else if (shape instanceof Point
|
|
19162
|
+
} else if (shape instanceof Point) {
|
|
18808
19163
|
if (!this.shapes.includes(shape)) {
|
|
18809
19164
|
// see removeShape
|
|
18810
19165
|
this.shapes.push(shape);
|
|
@@ -18831,7 +19186,7 @@ class Body {
|
|
|
18831
19186
|
*/
|
|
18832
19187
|
setVertices(vertices, index = 0, clear = true) {
|
|
18833
19188
|
var polygon = this.getShape(index);
|
|
18834
|
-
if (polygon instanceof Polygon
|
|
19189
|
+
if (polygon instanceof Polygon) {
|
|
18835
19190
|
polygon.setShape(0, 0, vertices);
|
|
18836
19191
|
} else {
|
|
18837
19192
|
// this will replace any other non polygon shape type if defined
|
|
@@ -19095,7 +19450,7 @@ class Body {
|
|
|
19095
19450
|
this.forEach((shape) => {
|
|
19096
19451
|
shape.rotate(angle, v);
|
|
19097
19452
|
this.bounds.addBounds(shape.getBounds());
|
|
19098
|
-
if (shape instanceof Ellipse
|
|
19453
|
+
if (shape instanceof Ellipse) {
|
|
19099
19454
|
// use bounds position as ellipse position is center
|
|
19100
19455
|
this.bounds.translate(
|
|
19101
19456
|
shape.getBounds().x,
|
|
@@ -19225,24 +19580,22 @@ class Body {
|
|
|
19225
19580
|
}
|
|
19226
19581
|
}
|
|
19227
19582
|
|
|
19228
|
-
var Body$1 = Body;
|
|
19229
|
-
|
|
19230
19583
|
/**
|
|
19231
19584
|
* Private function to re-use for object removal in a defer
|
|
19232
19585
|
* @ignore
|
|
19233
19586
|
*/
|
|
19234
|
-
|
|
19587
|
+
function deferredRemove(child, keepalive) {
|
|
19235
19588
|
this.removeChildNow(child, keepalive);
|
|
19236
|
-
}
|
|
19589
|
+
}
|
|
19237
19590
|
|
|
19238
|
-
|
|
19591
|
+
let globalFloatingCounter = 0;
|
|
19239
19592
|
|
|
19240
19593
|
/**
|
|
19241
19594
|
* @classdesc
|
|
19242
19595
|
* Container represents a collection of child objects
|
|
19243
19596
|
* @augments Renderable
|
|
19244
19597
|
*/
|
|
19245
|
-
class Container extends Renderable
|
|
19598
|
+
class Container extends Renderable {
|
|
19246
19599
|
/**
|
|
19247
19600
|
* @param {number} [x=0] - position of the container (accessible via the inherited pos.x property)
|
|
19248
19601
|
* @param {number} [y=0] - position of the container (accessible via the inherited pos.y property)
|
|
@@ -19466,7 +19819,7 @@ class Container extends Renderable$1 {
|
|
|
19466
19819
|
}
|
|
19467
19820
|
|
|
19468
19821
|
// if a physic body is defined, add it to the game world
|
|
19469
|
-
if (child.body instanceof Body
|
|
19822
|
+
if (child.body instanceof Body) {
|
|
19470
19823
|
game$1.world.addBody(child.body);
|
|
19471
19824
|
}
|
|
19472
19825
|
|
|
@@ -19517,7 +19870,7 @@ class Container extends Renderable$1 {
|
|
|
19517
19870
|
}
|
|
19518
19871
|
|
|
19519
19872
|
// if a physic body is defined, add it to the game world
|
|
19520
|
-
if (child.body instanceof Body
|
|
19873
|
+
if (child.body instanceof Body) {
|
|
19521
19874
|
game$1.world.addBody(child.body);
|
|
19522
19875
|
}
|
|
19523
19876
|
|
|
@@ -19891,7 +20244,7 @@ class Container extends Renderable$1 {
|
|
|
19891
20244
|
|
|
19892
20245
|
// remove the body first to avoid a condition where a body can be detached
|
|
19893
20246
|
// from its parent, before the body is removed from the game world
|
|
19894
|
-
if (child.body instanceof Body
|
|
20247
|
+
if (child.body instanceof Body) {
|
|
19895
20248
|
game$1.world.removeBody(child.body);
|
|
19896
20249
|
}
|
|
19897
20250
|
|
|
@@ -20227,393 +20580,12 @@ class Container extends Renderable$1 {
|
|
|
20227
20580
|
}
|
|
20228
20581
|
}
|
|
20229
20582
|
|
|
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
20583
|
/**
|
|
20612
20584
|
* @classdesc
|
|
20613
20585
|
* an object representing the physic world, and responsible for managing and updating all childs and physics
|
|
20614
20586
|
* @augments Container
|
|
20615
20587
|
*/
|
|
20616
|
-
class World extends Container
|
|
20588
|
+
class World extends Container {
|
|
20617
20589
|
/**
|
|
20618
20590
|
* @param {number} [x=0] - position of the container (accessible via the inherited pos.x property)
|
|
20619
20591
|
* @param {number} [y=0] - position of the container (accessible via the inherited pos.y property)
|
|
@@ -20657,7 +20629,7 @@ class World extends Container$1 {
|
|
|
20657
20629
|
* @name gravity
|
|
20658
20630
|
* @memberof World
|
|
20659
20631
|
*/
|
|
20660
|
-
this.gravity = new Vector2d
|
|
20632
|
+
this.gravity = new Vector2d(0, 0.98);
|
|
20661
20633
|
|
|
20662
20634
|
/**
|
|
20663
20635
|
* Specify the rendering method for tile layers. <br>
|
|
@@ -20689,7 +20661,7 @@ class World extends Container$1 {
|
|
|
20689
20661
|
* @public
|
|
20690
20662
|
* @type {QuadTree}
|
|
20691
20663
|
*/
|
|
20692
|
-
this.broadphase = new QuadTree
|
|
20664
|
+
this.broadphase = new QuadTree(this, this.getBounds().clone(), collision$1.maxChildren, collision$1.maxDepth);
|
|
20693
20665
|
|
|
20694
20666
|
// reset the world container on the game reset signal
|
|
20695
20667
|
on(GAME_RESET, this.reset, this);
|
|
@@ -20811,15 +20783,13 @@ class World extends Container$1 {
|
|
|
20811
20783
|
|
|
20812
20784
|
}
|
|
20813
20785
|
|
|
20814
|
-
var World$1 = World;
|
|
20815
|
-
|
|
20816
20786
|
/**
|
|
20817
20787
|
* @classdesc
|
|
20818
20788
|
* An Application represents a single melonJS game.
|
|
20819
20789
|
* An Application is responsible for updating (each frame) all the related object status and draw them.
|
|
20820
20790
|
* @see game
|
|
20821
20791
|
*/
|
|
20822
|
-
class Application {
|
|
20792
|
+
class Application {
|
|
20823
20793
|
constructor() {
|
|
20824
20794
|
/**
|
|
20825
20795
|
* a reference to the current active stage "default" camera
|
|
@@ -20894,7 +20864,7 @@ class Application {
|
|
|
20894
20864
|
*/
|
|
20895
20865
|
init() {
|
|
20896
20866
|
// create a new physic world
|
|
20897
|
-
this.world = new World
|
|
20867
|
+
this.world = new World();
|
|
20898
20868
|
// set the reference to this application instance
|
|
20899
20869
|
this.world.app = this;
|
|
20900
20870
|
this.lastUpdate = globalThis.performance.now();
|
|
@@ -21037,8 +21007,6 @@ class Application {
|
|
|
21037
21007
|
}
|
|
21038
21008
|
}
|
|
21039
21009
|
|
|
21040
|
-
var Application$1 = Application;
|
|
21041
|
-
|
|
21042
21010
|
/**
|
|
21043
21011
|
* game is a default instance of a melonJS Application and represents your current game,
|
|
21044
21012
|
* it contains all the objects, tilemap layers, current viewport, collision map, etc...<br>
|
|
@@ -21047,7 +21015,7 @@ var Application$1 = Application;
|
|
|
21047
21015
|
*/
|
|
21048
21016
|
|
|
21049
21017
|
// create a default melonJS application instance
|
|
21050
|
-
let game = new Application
|
|
21018
|
+
let game = new Application();
|
|
21051
21019
|
|
|
21052
21020
|
// initialize the game manager on system boot
|
|
21053
21021
|
on(BOOT, () => {
|
|
@@ -21060,14 +21028,14 @@ var game$1 = game;
|
|
|
21060
21028
|
// some ref shortcut
|
|
21061
21029
|
const MIN = Math.min, MAX = Math.max;
|
|
21062
21030
|
|
|
21063
|
-
var targetV = new Vector2d
|
|
21031
|
+
var targetV = new Vector2d();
|
|
21064
21032
|
|
|
21065
21033
|
/**
|
|
21066
21034
|
* @classdesc
|
|
21067
21035
|
* a 2D orthographic camera
|
|
21068
21036
|
* @augments Renderable
|
|
21069
21037
|
*/
|
|
21070
|
-
class Camera2d extends Renderable
|
|
21038
|
+
class Camera2d extends Renderable {
|
|
21071
21039
|
/**
|
|
21072
21040
|
* @param {number} minX - start x offset
|
|
21073
21041
|
* @param {number} minY - start y offset
|
|
@@ -21150,7 +21118,7 @@ class Camera2d extends Renderable$1 {
|
|
|
21150
21118
|
* @name projectionMatrix
|
|
21151
21119
|
* @memberof Camera2d
|
|
21152
21120
|
*/
|
|
21153
|
-
this.projectionMatrix = new Matrix3d
|
|
21121
|
+
this.projectionMatrix = new Matrix3d();
|
|
21154
21122
|
|
|
21155
21123
|
/**
|
|
21156
21124
|
* the invert camera transform used to unproject points
|
|
@@ -21159,10 +21127,10 @@ class Camera2d extends Renderable$1 {
|
|
|
21159
21127
|
* @name invCurrentTransform
|
|
21160
21128
|
* @memberof Camera2d
|
|
21161
21129
|
*/
|
|
21162
|
-
this.invCurrentTransform = new Matrix2d
|
|
21130
|
+
this.invCurrentTransform = new Matrix2d();
|
|
21163
21131
|
|
|
21164
21132
|
// offset for shake effect
|
|
21165
|
-
this.offset = new Vector2d
|
|
21133
|
+
this.offset = new Vector2d();
|
|
21166
21134
|
|
|
21167
21135
|
// target to follow
|
|
21168
21136
|
this.target = null;
|
|
@@ -21286,7 +21254,7 @@ class Camera2d extends Renderable$1 {
|
|
|
21286
21254
|
*/
|
|
21287
21255
|
setDeadzone(w, h) {
|
|
21288
21256
|
if (typeof(this.deadzone) === "undefined") {
|
|
21289
|
-
this.deadzone = new Rect
|
|
21257
|
+
this.deadzone = new Rect(0, 0, 0, 0);
|
|
21290
21258
|
}
|
|
21291
21259
|
|
|
21292
21260
|
// reusing the old code for now...
|
|
@@ -21365,11 +21333,11 @@ class Camera2d extends Renderable$1 {
|
|
|
21365
21333
|
* me.game.viewport.follow(this, me.game.viewport.AXIS.BOTH, 0.1);
|
|
21366
21334
|
*/
|
|
21367
21335
|
follow(target, axis, damping) {
|
|
21368
|
-
if (target instanceof Renderable
|
|
21336
|
+
if (target instanceof Renderable) {
|
|
21369
21337
|
this.target = target.pos;
|
|
21370
21338
|
}
|
|
21371
|
-
else if ((target instanceof Vector2d
|
|
21372
|
-
(target instanceof ObservableVector2d
|
|
21339
|
+
else if ((target instanceof Vector2d) || (target instanceof Vector3d) ||
|
|
21340
|
+
(target instanceof ObservableVector2d) || (target instanceof ObservableVector3d)) {
|
|
21373
21341
|
this.target = target;
|
|
21374
21342
|
}
|
|
21375
21343
|
else {
|
|
@@ -21765,7 +21733,6 @@ class Camera2d extends Renderable$1 {
|
|
|
21765
21733
|
}
|
|
21766
21734
|
|
|
21767
21735
|
}
|
|
21768
|
-
var Camera2d$1 = Camera2d;
|
|
21769
21736
|
|
|
21770
21737
|
// a default camera instance to use across all stages
|
|
21771
21738
|
var default_camera;
|
|
@@ -21782,7 +21749,7 @@ var default_settings = {
|
|
|
21782
21749
|
* through the state manager must inherit from this base class.
|
|
21783
21750
|
* @see state
|
|
21784
21751
|
*/
|
|
21785
|
-
class Stage {
|
|
21752
|
+
class Stage {
|
|
21786
21753
|
|
|
21787
21754
|
/**
|
|
21788
21755
|
* @param {object} [settings] - The stage` parameters
|
|
@@ -21834,7 +21801,7 @@ class Stage {
|
|
|
21834
21801
|
* @default "#000000"
|
|
21835
21802
|
* @see Light2d
|
|
21836
21803
|
*/
|
|
21837
|
-
this.ambientLight = new Color
|
|
21804
|
+
this.ambientLight = new Color(0, 0, 0, 0);
|
|
21838
21805
|
|
|
21839
21806
|
/**
|
|
21840
21807
|
* The given constructor options
|
|
@@ -21863,7 +21830,7 @@ class Stage {
|
|
|
21863
21830
|
var width = renderer.getWidth();
|
|
21864
21831
|
var height = renderer.getHeight();
|
|
21865
21832
|
// new default camera instance
|
|
21866
|
-
default_camera = new Camera2d
|
|
21833
|
+
default_camera = new Camera2d(0, 0, width, height);
|
|
21867
21834
|
}
|
|
21868
21835
|
this.cameras.set("default", default_camera);
|
|
21869
21836
|
}
|
|
@@ -21989,13 +21956,12 @@ class Stage {
|
|
|
21989
21956
|
}
|
|
21990
21957
|
}
|
|
21991
21958
|
}
|
|
21992
|
-
var Stage$1 = Stage;
|
|
21993
21959
|
|
|
21994
21960
|
var img = "data:image/png;base64,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";
|
|
21995
21961
|
var logo_url = img;
|
|
21996
21962
|
|
|
21997
21963
|
// a basic progress bar object
|
|
21998
|
-
class ProgressBar extends Renderable
|
|
21964
|
+
class ProgressBar extends Renderable {
|
|
21999
21965
|
/**
|
|
22000
21966
|
* @ignore
|
|
22001
21967
|
*/
|
|
@@ -22052,7 +22018,7 @@ class ProgressBar extends Renderable$1 {
|
|
|
22052
22018
|
* a default loading screen
|
|
22053
22019
|
* @ignore
|
|
22054
22020
|
*/
|
|
22055
|
-
class DefaultLoadingScreen extends Stage
|
|
22021
|
+
class DefaultLoadingScreen extends Stage {
|
|
22056
22022
|
/**
|
|
22057
22023
|
* call when the loader is resetted
|
|
22058
22024
|
* @ignore
|
|
@@ -22074,7 +22040,7 @@ class DefaultLoadingScreen extends Stage$1 {
|
|
|
22074
22040
|
// load the melonJS logo
|
|
22075
22041
|
loader$1.load({name: "melonjs_logo", type: "image", src: logo_url}, () => {
|
|
22076
22042
|
// melonJS logo
|
|
22077
|
-
game$1.world.addChild(new Sprite
|
|
22043
|
+
game$1.world.addChild(new Sprite(
|
|
22078
22044
|
renderer.getWidth() / 2,
|
|
22079
22045
|
renderer.getHeight() / 2, {
|
|
22080
22046
|
image : "melonjs_logo",
|
|
@@ -22226,7 +22192,7 @@ on(BOOT, () => {
|
|
|
22226
22192
|
// set the built-in loading stage
|
|
22227
22193
|
state.set(state.LOADING, new DefaultLoadingScreen$1());
|
|
22228
22194
|
// set and enable the default stage
|
|
22229
|
-
state.set(state.DEFAULT, new Stage
|
|
22195
|
+
state.set(state.DEFAULT, new Stage());
|
|
22230
22196
|
// enable by default as soon as the display is initialized
|
|
22231
22197
|
on(VIDEO_INIT, () => {
|
|
22232
22198
|
state.change(state.DEFAULT, true);
|
|
@@ -22539,7 +22505,7 @@ var state = {
|
|
|
22539
22505
|
* me.state.set(me.state.MENU, new MenuScreen());
|
|
22540
22506
|
*/
|
|
22541
22507
|
set(state, stage, start = false) {
|
|
22542
|
-
if (!(stage instanceof Stage
|
|
22508
|
+
if (!(stage instanceof Stage)) {
|
|
22543
22509
|
throw new Error(stage + " is not an instance of me.Stage");
|
|
22544
22510
|
}
|
|
22545
22511
|
_stages[state] = {};
|
|
@@ -23045,7 +23011,7 @@ const TMX_FLIP_H = 0x80000000,
|
|
|
23045
23011
|
* a basic tile object
|
|
23046
23012
|
* @augments Bounds
|
|
23047
23013
|
*/
|
|
23048
|
-
class Tile extends Bounds
|
|
23014
|
+
class Tile extends Bounds {
|
|
23049
23015
|
/**
|
|
23050
23016
|
* @param {number} x - x index of the Tile in the map
|
|
23051
23017
|
* @param {number} y - y index of the Tile in the map
|
|
@@ -23128,7 +23094,7 @@ class Tile extends Bounds$1 {
|
|
|
23128
23094
|
// create and apply transformation matrix if required
|
|
23129
23095
|
if (this.flipped === true) {
|
|
23130
23096
|
if (this.currentTransform === null) {
|
|
23131
|
-
this.currentTransform = new Matrix2d
|
|
23097
|
+
this.currentTransform = new Matrix2d();
|
|
23132
23098
|
}
|
|
23133
23099
|
this.setTileTransform(this.currentTransform.identity());
|
|
23134
23100
|
}
|
|
@@ -23188,7 +23154,7 @@ class Tile extends Bounds$1 {
|
|
|
23188
23154
|
} else {
|
|
23189
23155
|
if (tileset.isCollection === true) {
|
|
23190
23156
|
var image = tileset.getTileImage(this.tileId);
|
|
23191
|
-
renderable = new Sprite
|
|
23157
|
+
renderable = new Sprite(0, 0,
|
|
23192
23158
|
Object.assign({
|
|
23193
23159
|
image: image
|
|
23194
23160
|
})//, settings)
|
|
@@ -23214,14 +23180,13 @@ class Tile extends Bounds$1 {
|
|
|
23214
23180
|
return renderable;
|
|
23215
23181
|
}
|
|
23216
23182
|
}
|
|
23217
|
-
var Tile$1 = Tile;
|
|
23218
23183
|
|
|
23219
23184
|
/**
|
|
23220
23185
|
* @classdesc
|
|
23221
23186
|
* a canvas renderer object
|
|
23222
23187
|
* @augments Renderer
|
|
23223
23188
|
*/
|
|
23224
|
-
class CanvasRenderer extends Renderer
|
|
23189
|
+
class CanvasRenderer extends Renderer {
|
|
23225
23190
|
/**
|
|
23226
23191
|
* @param {object} options - The renderer parameters
|
|
23227
23192
|
* @param {number} options.width - The width of the canvas without scaling
|
|
@@ -23355,7 +23320,7 @@ class CanvasRenderer extends Renderer$1 {
|
|
|
23355
23320
|
this.resetTransform();
|
|
23356
23321
|
context.globalAlpha = 1;
|
|
23357
23322
|
context.globalCompositeOperation = opaque === true ? "copy" : "source-over";
|
|
23358
|
-
context.fillStyle = (color instanceof Color
|
|
23323
|
+
context.fillStyle = (color instanceof Color) ? color.toRGBA() : color;
|
|
23359
23324
|
this.fillRect(0, 0, canvas.width, canvas.height);
|
|
23360
23325
|
this.restore();
|
|
23361
23326
|
}
|
|
@@ -23804,7 +23769,7 @@ class CanvasRenderer extends Renderer$1 {
|
|
|
23804
23769
|
var context = this.getContext();
|
|
23805
23770
|
context.strokeStyle =
|
|
23806
23771
|
context.fillStyle = (
|
|
23807
|
-
color instanceof Color
|
|
23772
|
+
color instanceof Color ?
|
|
23808
23773
|
color.toRGBA() :
|
|
23809
23774
|
color
|
|
23810
23775
|
);
|
|
@@ -23943,11 +23908,11 @@ class CanvasRenderer extends Renderer$1 {
|
|
|
23943
23908
|
}
|
|
23944
23909
|
|
|
23945
23910
|
// https://github.com/melonjs/melonJS/issues/648
|
|
23946
|
-
if (mask instanceof RoundRect
|
|
23911
|
+
if (mask instanceof RoundRect) {
|
|
23947
23912
|
context.roundRect(mask.top, mask.left, mask.width, mask.height, mask.radius);
|
|
23948
|
-
} else if (mask instanceof Rect
|
|
23913
|
+
} else if (mask instanceof Rect || mask instanceof Bounds) {
|
|
23949
23914
|
context.rect(mask.top, mask.left, mask.width, mask.height);
|
|
23950
|
-
} else if (mask instanceof Ellipse
|
|
23915
|
+
} else if (mask instanceof Ellipse) {
|
|
23951
23916
|
const _x = mask.pos.x, _y = mask.pos.y,
|
|
23952
23917
|
hw = mask.radiusV.x,
|
|
23953
23918
|
hh = mask.radiusV.y,
|
|
@@ -24004,7 +23969,6 @@ class CanvasRenderer extends Renderer$1 {
|
|
|
24004
23969
|
}
|
|
24005
23970
|
}
|
|
24006
23971
|
}
|
|
24007
|
-
var CanvasRenderer$1 = CanvasRenderer;
|
|
24008
23972
|
|
|
24009
23973
|
/**
|
|
24010
23974
|
* Create required arrays for the given layer object
|
|
@@ -24054,7 +24018,7 @@ function preRenderLayer(layer, renderer) {
|
|
|
24054
24018
|
// get the value of the gid
|
|
24055
24019
|
var tile = layer.layerData[x][y];
|
|
24056
24020
|
// draw the tile if defined
|
|
24057
|
-
if (tile instanceof Tile
|
|
24021
|
+
if (tile instanceof Tile) {
|
|
24058
24022
|
// add a new tile to the layer
|
|
24059
24023
|
layer.getRenderer().drawTile(renderer, x, y, tile);
|
|
24060
24024
|
}
|
|
@@ -24068,7 +24032,7 @@ function preRenderLayer(layer, renderer) {
|
|
|
24068
24032
|
* Tiled QT 0.7.x format
|
|
24069
24033
|
* @augments Renderable
|
|
24070
24034
|
*/
|
|
24071
|
-
class TMXLayer extends Renderable
|
|
24035
|
+
class TMXLayer extends Renderable {
|
|
24072
24036
|
/**
|
|
24073
24037
|
* @param {object} map - layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
|
|
24074
24038
|
* @param {object} data - layer data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#layer})
|
|
@@ -24229,7 +24193,7 @@ class TMXLayer extends Renderable$1 {
|
|
|
24229
24193
|
|
|
24230
24194
|
// if pre-rendering method is use, create an offline canvas/renderer
|
|
24231
24195
|
if ((this.preRender === true) && (!this.canvasRenderer)) {
|
|
24232
|
-
this.canvasRenderer = new CanvasRenderer
|
|
24196
|
+
this.canvasRenderer = new CanvasRenderer({
|
|
24233
24197
|
canvas : createCanvas(this.width, this.height),
|
|
24234
24198
|
widht : this.width,
|
|
24235
24199
|
heigth : this.height,
|
|
@@ -24342,7 +24306,7 @@ class TMXLayer extends Renderable$1 {
|
|
|
24342
24306
|
// look for the corresponding tileset
|
|
24343
24307
|
this.tileset = this.tilesets.getTilesetByGid(tileId);
|
|
24344
24308
|
}
|
|
24345
|
-
return new Tile
|
|
24309
|
+
return new Tile(x, y, tileId, this.tileset);
|
|
24346
24310
|
}
|
|
24347
24311
|
|
|
24348
24312
|
/**
|
|
@@ -24436,15 +24400,13 @@ class TMXLayer extends Renderable$1 {
|
|
|
24436
24400
|
}
|
|
24437
24401
|
}
|
|
24438
24402
|
|
|
24439
|
-
var TMXLayer$1 = TMXLayer;
|
|
24440
|
-
|
|
24441
24403
|
/* eslint-disable no-unused-vars */
|
|
24442
24404
|
|
|
24443
24405
|
/**
|
|
24444
24406
|
* @classdesc
|
|
24445
24407
|
* The map renderer base class
|
|
24446
24408
|
*/
|
|
24447
|
-
class TMXRenderer {
|
|
24409
|
+
class TMXRenderer {
|
|
24448
24410
|
/**
|
|
24449
24411
|
* @param {number} cols - width of the tilemap in tiles
|
|
24450
24412
|
* @param {number} rows - height of the tilemap in tiles
|
|
@@ -24456,7 +24418,7 @@ class TMXRenderer {
|
|
|
24456
24418
|
this.rows = rows;
|
|
24457
24419
|
this.tilewidth = tilewidth;
|
|
24458
24420
|
this.tileheight = tileheight;
|
|
24459
|
-
this.bounds = new Bounds
|
|
24421
|
+
this.bounds = new Bounds();
|
|
24460
24422
|
}
|
|
24461
24423
|
|
|
24462
24424
|
/**
|
|
@@ -24487,7 +24449,7 @@ class TMXRenderer {
|
|
|
24487
24449
|
* @returns {Bounds}
|
|
24488
24450
|
*/
|
|
24489
24451
|
getBounds(layer) {
|
|
24490
|
-
var bounds = layer instanceof TMXLayer
|
|
24452
|
+
var bounds = layer instanceof TMXLayer ? pool$1.pull("Bounds") : this.bounds;
|
|
24491
24453
|
bounds.setMinMax(
|
|
24492
24454
|
0, 0,
|
|
24493
24455
|
this.cols * this.tilewidth,
|
|
@@ -24547,7 +24509,6 @@ class TMXRenderer {
|
|
|
24547
24509
|
|
|
24548
24510
|
}
|
|
24549
24511
|
|
|
24550
|
-
var TMXRenderer$1 = TMXRenderer;
|
|
24551
24512
|
|
|
24552
24513
|
/* eslint-enable no-unused-vars */
|
|
24553
24514
|
|
|
@@ -24556,7 +24517,7 @@ var TMXRenderer$1 = TMXRenderer;
|
|
|
24556
24517
|
* an Orthogonal Map Renderder
|
|
24557
24518
|
* @augments TMXRenderer
|
|
24558
24519
|
*/
|
|
24559
|
-
class TMXOrthogonalRenderer extends TMXRenderer
|
|
24520
|
+
class TMXOrthogonalRenderer extends TMXRenderer {
|
|
24560
24521
|
/**
|
|
24561
24522
|
* @param {TMXTileMap} map - the TMX map
|
|
24562
24523
|
*/
|
|
@@ -24585,7 +24546,7 @@ class TMXOrthogonalRenderer extends TMXRenderer$1 {
|
|
|
24585
24546
|
* @ignore
|
|
24586
24547
|
*/
|
|
24587
24548
|
pixelToTileCoords(x, y, v) {
|
|
24588
|
-
var ret = v || new Vector2d
|
|
24549
|
+
var ret = v || new Vector2d();
|
|
24589
24550
|
return ret.set(
|
|
24590
24551
|
x / this.tilewidth,
|
|
24591
24552
|
y / this.tileheight
|
|
@@ -24598,7 +24559,7 @@ class TMXOrthogonalRenderer extends TMXRenderer$1 {
|
|
|
24598
24559
|
* @ignore
|
|
24599
24560
|
*/
|
|
24600
24561
|
tileToPixelCoords(x, y, v) {
|
|
24601
|
-
var ret = v || new Vector2d
|
|
24562
|
+
var ret = v || new Vector2d();
|
|
24602
24563
|
return ret.set(
|
|
24603
24564
|
x * this.tilewidth,
|
|
24604
24565
|
y * this.tileheight
|
|
@@ -24694,14 +24655,12 @@ class TMXOrthogonalRenderer extends TMXRenderer$1 {
|
|
|
24694
24655
|
}
|
|
24695
24656
|
}
|
|
24696
24657
|
|
|
24697
|
-
var TMXOrthogonalRenderer$1 = TMXOrthogonalRenderer;
|
|
24698
|
-
|
|
24699
24658
|
/**
|
|
24700
24659
|
* @classdesc
|
|
24701
24660
|
* an Isometric Map Renderder
|
|
24702
24661
|
* @augments TMXRenderer
|
|
24703
24662
|
*/
|
|
24704
|
-
class TMXIsometricRenderer extends TMXRenderer
|
|
24663
|
+
class TMXIsometricRenderer extends TMXRenderer {
|
|
24705
24664
|
/**
|
|
24706
24665
|
* @param {TMXTileMap} map - the TMX map
|
|
24707
24666
|
*/
|
|
@@ -24737,7 +24696,7 @@ class TMXIsometricRenderer extends TMXRenderer$1 {
|
|
|
24737
24696
|
* @returns {Bounds}
|
|
24738
24697
|
*/
|
|
24739
24698
|
getBounds(layer) {
|
|
24740
|
-
var bounds = layer instanceof TMXLayer
|
|
24699
|
+
var bounds = layer instanceof TMXLayer ? pool$1.pull("Bounds") : this.bounds;
|
|
24741
24700
|
bounds.setMinMax(
|
|
24742
24701
|
0, 0,
|
|
24743
24702
|
(this.cols + this.rows) * (this.tilewidth / 2),
|
|
@@ -24751,7 +24710,7 @@ class TMXIsometricRenderer extends TMXRenderer$1 {
|
|
|
24751
24710
|
* @ignore
|
|
24752
24711
|
*/
|
|
24753
24712
|
pixelToTileCoords(x, y, v) {
|
|
24754
|
-
var ret = v || new Vector2d
|
|
24713
|
+
var ret = v || new Vector2d();
|
|
24755
24714
|
return ret.set(
|
|
24756
24715
|
(y / this.tileheight) + ((x - this.originX) / this.tilewidth),
|
|
24757
24716
|
(y / this.tileheight) - ((x - this.originX) / this.tilewidth)
|
|
@@ -24763,7 +24722,7 @@ class TMXIsometricRenderer extends TMXRenderer$1 {
|
|
|
24763
24722
|
* @ignore
|
|
24764
24723
|
*/
|
|
24765
24724
|
tileToPixelCoords(x, y, v) {
|
|
24766
|
-
var ret = v || new Vector2d
|
|
24725
|
+
var ret = v || new Vector2d();
|
|
24767
24726
|
return ret.set(
|
|
24768
24727
|
(x - y) * this.hTilewidth + this.originX,
|
|
24769
24728
|
(x + y) * this.hTileheight
|
|
@@ -24901,8 +24860,6 @@ class TMXIsometricRenderer extends TMXRenderer$1 {
|
|
|
24901
24860
|
}
|
|
24902
24861
|
}
|
|
24903
24862
|
|
|
24904
|
-
var TMXIsometricRenderer$1 = TMXIsometricRenderer;
|
|
24905
|
-
|
|
24906
24863
|
// scope global var & constants
|
|
24907
24864
|
const offsetsStaggerX = [
|
|
24908
24865
|
{x: 0, y: 0},
|
|
@@ -24922,7 +24879,7 @@ const offsetsStaggerY = [
|
|
|
24922
24879
|
* an Hexagonal Map Renderder
|
|
24923
24880
|
* @augments TMXRenderer
|
|
24924
24881
|
*/
|
|
24925
|
-
class TMXHexagonalRenderer extends TMXRenderer
|
|
24882
|
+
class TMXHexagonalRenderer extends TMXRenderer {
|
|
24926
24883
|
/**
|
|
24927
24884
|
* @param {TMXTileMap} map - the TMX map
|
|
24928
24885
|
*/
|
|
@@ -24957,10 +24914,10 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
24957
24914
|
this.rowheight = this.sideoffsety + this.sidelengthy;
|
|
24958
24915
|
|
|
24959
24916
|
this.centers = [
|
|
24960
|
-
new Vector2d
|
|
24961
|
-
new Vector2d
|
|
24962
|
-
new Vector2d
|
|
24963
|
-
new Vector2d
|
|
24917
|
+
new Vector2d(),
|
|
24918
|
+
new Vector2d(),
|
|
24919
|
+
new Vector2d(),
|
|
24920
|
+
new Vector2d()
|
|
24964
24921
|
];
|
|
24965
24922
|
}
|
|
24966
24923
|
|
|
@@ -24983,7 +24940,7 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
24983
24940
|
* @returns {Bounds}
|
|
24984
24941
|
*/
|
|
24985
24942
|
getBounds(layer) {
|
|
24986
|
-
var bounds = layer instanceof TMXLayer
|
|
24943
|
+
var bounds = layer instanceof TMXLayer ? pool$1.pull("Bounds") : this.bounds;
|
|
24987
24944
|
|
|
24988
24945
|
// The map size is the same regardless of which indexes are shifted.
|
|
24989
24946
|
if (this.staggerX) {
|
|
@@ -25026,7 +24983,7 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
25026
24983
|
* @ignore
|
|
25027
24984
|
*/
|
|
25028
24985
|
topLeft(x, y, v) {
|
|
25029
|
-
var ret = v || new Vector2d
|
|
24986
|
+
var ret = v || new Vector2d();
|
|
25030
24987
|
|
|
25031
24988
|
if (!this.staggerX) {
|
|
25032
24989
|
if ((y & 1) ^ this.staggerEven) {
|
|
@@ -25050,7 +25007,7 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
25050
25007
|
* @ignore
|
|
25051
25008
|
*/
|
|
25052
25009
|
topRight(x, y, v) {
|
|
25053
|
-
var ret = v || new Vector2d
|
|
25010
|
+
var ret = v || new Vector2d();
|
|
25054
25011
|
|
|
25055
25012
|
if (!this.staggerX) {
|
|
25056
25013
|
if ((y & 1) ^ this.staggerEven) {
|
|
@@ -25075,7 +25032,7 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
25075
25032
|
* @ignore
|
|
25076
25033
|
*/
|
|
25077
25034
|
bottomLeft(x, y, v) {
|
|
25078
|
-
var ret = v || new Vector2d
|
|
25035
|
+
var ret = v || new Vector2d();
|
|
25079
25036
|
|
|
25080
25037
|
if (!this.staggerX) {
|
|
25081
25038
|
if ((y & 1) ^ this.staggerEven) {
|
|
@@ -25099,7 +25056,7 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
25099
25056
|
* @ignore
|
|
25100
25057
|
*/
|
|
25101
25058
|
bottomRight(x, y, v) {
|
|
25102
|
-
var ret = v || new Vector2d
|
|
25059
|
+
var ret = v || new Vector2d();
|
|
25103
25060
|
|
|
25104
25061
|
if (!this.staggerX) {
|
|
25105
25062
|
if ((y & 1) ^ this.staggerEven) {
|
|
@@ -25124,7 +25081,7 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
25124
25081
|
* @ignore
|
|
25125
25082
|
*/
|
|
25126
25083
|
pixelToTileCoords(x, y, v) {
|
|
25127
|
-
var ret = v || new Vector2d
|
|
25084
|
+
var ret = v || new Vector2d();
|
|
25128
25085
|
|
|
25129
25086
|
if (this.staggerX) { //flat top
|
|
25130
25087
|
x -= this.staggerEven ? this.tilewidth : this.sideoffsetx;
|
|
@@ -25212,7 +25169,7 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
25212
25169
|
tileToPixelCoords(x, y, v) {
|
|
25213
25170
|
var tileX = Math.floor(x),
|
|
25214
25171
|
tileY = Math.floor(y);
|
|
25215
|
-
var ret = v || new Vector2d
|
|
25172
|
+
var ret = v || new Vector2d();
|
|
25216
25173
|
|
|
25217
25174
|
if (this.staggerX) {
|
|
25218
25175
|
ret.y = tileY * (this.tileheight + this.sidelengthy);
|
|
@@ -25394,14 +25351,12 @@ class TMXHexagonalRenderer extends TMXRenderer$1 {
|
|
|
25394
25351
|
}
|
|
25395
25352
|
}
|
|
25396
25353
|
|
|
25397
|
-
var TMXHexagonalRenderer$1 = TMXHexagonalRenderer;
|
|
25398
|
-
|
|
25399
25354
|
/**
|
|
25400
25355
|
* @classdesc
|
|
25401
25356
|
* a Staggered Map Renderder
|
|
25402
25357
|
* @augments TMXHexagonalRenderer
|
|
25403
25358
|
*/
|
|
25404
|
-
class TMXStaggeredRenderer extends TMXHexagonalRenderer
|
|
25359
|
+
class TMXStaggeredRenderer extends TMXHexagonalRenderer {
|
|
25405
25360
|
|
|
25406
25361
|
/**
|
|
25407
25362
|
* return true if the renderer can render the specified layer
|
|
@@ -25419,7 +25374,7 @@ class TMXStaggeredRenderer extends TMXHexagonalRenderer$1 {
|
|
|
25419
25374
|
* @ignore
|
|
25420
25375
|
*/
|
|
25421
25376
|
pixelToTileCoords(x, y, v) {
|
|
25422
|
-
var ret = v || new Vector2d
|
|
25377
|
+
var ret = v || new Vector2d();
|
|
25423
25378
|
|
|
25424
25379
|
var alignedX = x,
|
|
25425
25380
|
alignedY = y;
|
|
@@ -25490,13 +25445,11 @@ class TMXStaggeredRenderer extends TMXHexagonalRenderer$1 {
|
|
|
25490
25445
|
}
|
|
25491
25446
|
}
|
|
25492
25447
|
|
|
25493
|
-
var TMXStaggeredRenderer$1 = TMXStaggeredRenderer;
|
|
25494
|
-
|
|
25495
25448
|
/**
|
|
25496
25449
|
* @classdesc
|
|
25497
25450
|
* a TMX Tile Set Object
|
|
25498
25451
|
*/
|
|
25499
|
-
class TMXTileset {
|
|
25452
|
+
class TMXTileset {
|
|
25500
25453
|
/**
|
|
25501
25454
|
* @param {object} tileset - tileset data in JSON format ({@link http://docs.mapeditor.org/en/stable/reference/tmx-map-format/#tileset})
|
|
25502
25455
|
*/
|
|
@@ -25532,7 +25485,7 @@ class TMXTileset {
|
|
|
25532
25485
|
this.margin = +tileset.margin || 0;
|
|
25533
25486
|
|
|
25534
25487
|
// set tile offset properties (if any)
|
|
25535
|
-
this.tileoffset = new Vector2d
|
|
25488
|
+
this.tileoffset = new Vector2d();
|
|
25536
25489
|
|
|
25537
25490
|
/**
|
|
25538
25491
|
* Tileset contains animated tiles
|
|
@@ -25787,8 +25740,6 @@ class TMXTileset {
|
|
|
25787
25740
|
}
|
|
25788
25741
|
}
|
|
25789
25742
|
|
|
25790
|
-
var TMXTileset$1 = TMXTileset;
|
|
25791
|
-
|
|
25792
25743
|
// bitmask constants to check for flipped & rotated tiles
|
|
25793
25744
|
const TMX_CLEAR_BIT_MASK = ~(0x80000000 | 0x40000000 | 0x20000000);
|
|
25794
25745
|
|
|
@@ -25796,7 +25747,7 @@ const TMX_CLEAR_BIT_MASK = ~(0x80000000 | 0x40000000 | 0x20000000);
|
|
|
25796
25747
|
* @classdesc
|
|
25797
25748
|
* an object containing all tileset
|
|
25798
25749
|
*/
|
|
25799
|
-
class TMXTilesetGroup {
|
|
25750
|
+
class TMXTilesetGroup {
|
|
25800
25751
|
|
|
25801
25752
|
constructor() {
|
|
25802
25753
|
this.tilesets = [];
|
|
@@ -25862,8 +25813,6 @@ class TMXTilesetGroup {
|
|
|
25862
25813
|
}
|
|
25863
25814
|
}
|
|
25864
25815
|
|
|
25865
|
-
var TMXTilesetGroup$1 = TMXTilesetGroup;
|
|
25866
|
-
|
|
25867
25816
|
/**
|
|
25868
25817
|
* @classdesc
|
|
25869
25818
|
* a TMX Object defintion, as defined in Tiled
|
|
@@ -26121,7 +26070,7 @@ class TMXObject {
|
|
|
26121
26070
|
}
|
|
26122
26071
|
|
|
26123
26072
|
// the object corresponding tile object
|
|
26124
|
-
this.tile = new Tile
|
|
26073
|
+
this.tile = new Tile(this.x, this.y, this.gid, tileset);
|
|
26125
26074
|
}
|
|
26126
26075
|
|
|
26127
26076
|
/**
|
|
@@ -26297,7 +26246,7 @@ class TMXGroup {
|
|
|
26297
26246
|
|
|
26298
26247
|
if (data.layers) {
|
|
26299
26248
|
data.layers.forEach((data) => {
|
|
26300
|
-
var layer = new TMXLayer
|
|
26249
|
+
var layer = new TMXLayer(map, data, map.tilewidth, map.tileheight, map.orientation, map.tilesets, z++);
|
|
26301
26250
|
// set a renderer
|
|
26302
26251
|
layer.setRenderer(map.getRenderer());
|
|
26303
26252
|
// resize container accordingly
|
|
@@ -26345,16 +26294,16 @@ const COLLISION_GROUP = "collision";
|
|
|
26345
26294
|
function getNewDefaultRenderer(map) {
|
|
26346
26295
|
switch (map.orientation) {
|
|
26347
26296
|
case "orthogonal":
|
|
26348
|
-
return new TMXOrthogonalRenderer
|
|
26297
|
+
return new TMXOrthogonalRenderer(map);
|
|
26349
26298
|
|
|
26350
26299
|
case "isometric":
|
|
26351
|
-
return new TMXIsometricRenderer
|
|
26300
|
+
return new TMXIsometricRenderer(map);
|
|
26352
26301
|
|
|
26353
26302
|
case "hexagonal":
|
|
26354
|
-
return new TMXHexagonalRenderer
|
|
26303
|
+
return new TMXHexagonalRenderer(map);
|
|
26355
26304
|
|
|
26356
26305
|
case "staggered":
|
|
26357
|
-
return new TMXStaggeredRenderer
|
|
26306
|
+
return new TMXStaggeredRenderer(map);
|
|
26358
26307
|
|
|
26359
26308
|
// if none found, throw an exception
|
|
26360
26309
|
default:
|
|
@@ -26367,7 +26316,7 @@ function getNewDefaultRenderer(map) {
|
|
|
26367
26316
|
* @ignore
|
|
26368
26317
|
*/
|
|
26369
26318
|
function readLayer(map, data, z) {
|
|
26370
|
-
return new TMXLayer
|
|
26319
|
+
return new TMXLayer(map, data, map.tilewidth, map.tileheight, map.orientation, map.tilesets, z);
|
|
26371
26320
|
}
|
|
26372
26321
|
|
|
26373
26322
|
/**
|
|
@@ -26406,7 +26355,7 @@ function readImageLayer(map, data, z) {
|
|
|
26406
26355
|
* @ignore
|
|
26407
26356
|
*/
|
|
26408
26357
|
function readTileset(data) {
|
|
26409
|
-
return (new TMXTileset
|
|
26358
|
+
return (new TMXTileset(data));
|
|
26410
26359
|
}
|
|
26411
26360
|
|
|
26412
26361
|
/**
|
|
@@ -26422,7 +26371,7 @@ function readObjectGroup(map, data, z) {
|
|
|
26422
26371
|
* a TMX Tile Map Object
|
|
26423
26372
|
* Tiled QT +0.7.x format
|
|
26424
26373
|
*/
|
|
26425
|
-
class TMXTileMap {
|
|
26374
|
+
class TMXTileMap {
|
|
26426
26375
|
/**
|
|
26427
26376
|
* @param {string} levelId - name of TMX map
|
|
26428
26377
|
* @param {object} data - TMX map in JSON format
|
|
@@ -26621,7 +26570,7 @@ class TMXTileMap {
|
|
|
26621
26570
|
// Tileset information
|
|
26622
26571
|
if (!this.tilesets) {
|
|
26623
26572
|
// make sure we have a TilesetGroup Object
|
|
26624
|
-
this.tilesets = new TMXTilesetGroup
|
|
26573
|
+
this.tilesets = new TMXTilesetGroup();
|
|
26625
26574
|
}
|
|
26626
26575
|
|
|
26627
26576
|
// parse all tileset objects
|
|
@@ -26773,7 +26722,7 @@ class TMXTileMap {
|
|
|
26773
26722
|
|
|
26774
26723
|
if (flatten === false) {
|
|
26775
26724
|
// create a new container
|
|
26776
|
-
targetContainer = new Container
|
|
26725
|
+
targetContainer = new Container(0, 0, this.width, this.height);
|
|
26777
26726
|
|
|
26778
26727
|
// tiled uses 0,0 by default
|
|
26779
26728
|
targetContainer.anchorPoint.set(0, 0);
|
|
@@ -26812,7 +26761,7 @@ class TMXTileMap {
|
|
|
26812
26761
|
/// specific instantiation logic/details from here
|
|
26813
26762
|
|
|
26814
26763
|
// groups can contains either text, objects or layers
|
|
26815
|
-
if (settings instanceof TMXLayer
|
|
26764
|
+
if (settings instanceof TMXLayer) {
|
|
26816
26765
|
// layers are already instantiated & initialized
|
|
26817
26766
|
obj = settings;
|
|
26818
26767
|
// z value set already
|
|
@@ -26840,7 +26789,7 @@ class TMXTileMap {
|
|
|
26840
26789
|
}
|
|
26841
26790
|
// check if a me.Tile object is embedded
|
|
26842
26791
|
obj = settings.tile.getRenderable(settings);
|
|
26843
|
-
obj.body = new Body
|
|
26792
|
+
obj.body = new Body(obj, shape);
|
|
26844
26793
|
obj.body.setStatic(true);
|
|
26845
26794
|
// set the obj z order
|
|
26846
26795
|
obj.pos.setMuted(settings.x, settings.y, settings.z);
|
|
@@ -26874,7 +26823,7 @@ class TMXTileMap {
|
|
|
26874
26823
|
// for backward compatibility
|
|
26875
26824
|
obj.class = settings.class || settings.type;
|
|
26876
26825
|
obj.id = settings.id;
|
|
26877
|
-
obj.body = new Body
|
|
26826
|
+
obj.body = new Body(obj, shape);
|
|
26878
26827
|
obj.body.setStatic(true);
|
|
26879
26828
|
obj.resize(obj.body.getBounds().width, obj.body.getBounds().height);
|
|
26880
26829
|
}
|
|
@@ -26894,7 +26843,7 @@ class TMXTileMap {
|
|
|
26894
26843
|
if (obj.isRenderable === true) {
|
|
26895
26844
|
obj.setOpacity(obj.getOpacity() * group.opacity);
|
|
26896
26845
|
// and to child renderables if any
|
|
26897
|
-
if (obj.renderable
|
|
26846
|
+
if (typeof obj.renderable !== "undefined" && obj.renderable.isRenderable === true) {
|
|
26898
26847
|
obj.renderable.setOpacity(obj.renderable.getOpacity() * group.opacity);
|
|
26899
26848
|
}
|
|
26900
26849
|
}
|
|
@@ -26946,8 +26895,6 @@ class TMXTileMap {
|
|
|
26946
26895
|
}
|
|
26947
26896
|
}
|
|
26948
26897
|
|
|
26949
|
-
var TMXTileMap$1 = TMXTileMap;
|
|
26950
|
-
|
|
26951
26898
|
// our levels
|
|
26952
26899
|
var levels = {};
|
|
26953
26900
|
// level index table
|
|
@@ -27037,7 +26984,7 @@ var level = {
|
|
|
27037
26984
|
// just load the level with the XML stuff
|
|
27038
26985
|
if (levels[levelId] == null) {
|
|
27039
26986
|
//console.log("loading "+ levelId);
|
|
27040
|
-
levels[levelId] = new TMXTileMap
|
|
26987
|
+
levels[levelId] = new TMXTileMap(levelId, loader$1.getTMX(levelId));
|
|
27041
26988
|
// level index
|
|
27042
26989
|
levelIdx.push(levelId);
|
|
27043
26990
|
}
|
|
@@ -27110,7 +27057,7 @@ var level = {
|
|
|
27110
27057
|
throw new Error("level " + levelId + " not found");
|
|
27111
27058
|
}
|
|
27112
27059
|
|
|
27113
|
-
if (levels[levelId] instanceof TMXTileMap
|
|
27060
|
+
if (levels[levelId] instanceof TMXTileMap) {
|
|
27114
27061
|
|
|
27115
27062
|
// check the status of the state mngr
|
|
27116
27063
|
var wasRunning = state$1.isRunning();
|
|
@@ -28019,7 +27966,7 @@ var loader$1 = loader;
|
|
|
28019
27966
|
* An object to display a fixed or animated sprite on screen.
|
|
28020
27967
|
* @augments Renderable
|
|
28021
27968
|
*/
|
|
28022
|
-
class Sprite extends Renderable
|
|
27969
|
+
class Sprite extends Renderable {
|
|
28023
27970
|
/**
|
|
28024
27971
|
* @param {number} x - the x coordinates of the sprite object
|
|
28025
27972
|
* @param {number} y - the y coordinates of the sprite object
|
|
@@ -28193,7 +28140,7 @@ class Sprite extends Renderable$1 {
|
|
|
28193
28140
|
}
|
|
28194
28141
|
|
|
28195
28142
|
if (typeof (settings.tint) !== "undefined") {
|
|
28196
|
-
if (settings.tint instanceof Color
|
|
28143
|
+
if (settings.tint instanceof Color) {
|
|
28197
28144
|
this.tint.copy(settings.tint);
|
|
28198
28145
|
} else {
|
|
28199
28146
|
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
@@ -28651,7 +28598,6 @@ class Sprite extends Renderable$1 {
|
|
|
28651
28598
|
);
|
|
28652
28599
|
}
|
|
28653
28600
|
}
|
|
28654
|
-
var Sprite$1 = Sprite;
|
|
28655
28601
|
|
|
28656
28602
|
/**
|
|
28657
28603
|
* create a simple 1 frame texture atlas based on the given parameters
|
|
@@ -28838,8 +28784,8 @@ class TextureAtlas {
|
|
|
28838
28784
|
atlas[frame.filename] = {
|
|
28839
28785
|
name : frame.filename, // frame name
|
|
28840
28786
|
texture : data.meta.image || "default", // the source texture
|
|
28841
|
-
offset : new Vector2d
|
|
28842
|
-
anchorPoint : (hasTextureAnchorPoint) ? new Vector2d
|
|
28787
|
+
offset : new Vector2d(s.x, s.y),
|
|
28788
|
+
anchorPoint : (hasTextureAnchorPoint) ? new Vector2d(originX / s.w, originY / s.h) : null,
|
|
28843
28789
|
trimmed : !!frame.trimmed,
|
|
28844
28790
|
width : s.w,
|
|
28845
28791
|
height : s.h,
|
|
@@ -28895,7 +28841,7 @@ class TextureAtlas {
|
|
|
28895
28841
|
atlas[name] = {
|
|
28896
28842
|
name : name,
|
|
28897
28843
|
texture : "default", // the source texture
|
|
28898
|
-
offset : new Vector2d
|
|
28844
|
+
offset : new Vector2d(
|
|
28899
28845
|
margin + (spacing + data.framewidth) * (frame % spritecount.x),
|
|
28900
28846
|
margin + (spacing + data.frameheight) * ~~(frame / spritecount.x)
|
|
28901
28847
|
),
|
|
@@ -28969,7 +28915,7 @@ class TextureAtlas {
|
|
|
28969
28915
|
|
|
28970
28916
|
atlas[name] = {
|
|
28971
28917
|
name : name,
|
|
28972
|
-
offset : new Vector2d
|
|
28918
|
+
offset : new Vector2d(x, y),
|
|
28973
28919
|
width : w,
|
|
28974
28920
|
height : h,
|
|
28975
28921
|
angle : 0
|
|
@@ -29033,7 +28979,7 @@ class TextureAtlas {
|
|
|
29033
28979
|
*/
|
|
29034
28980
|
addUVs(atlas, name, w, h) {
|
|
29035
28981
|
// ignore if using the Canvas Renderer
|
|
29036
|
-
if (renderer instanceof WebGLRenderer
|
|
28982
|
+
if (renderer instanceof WebGLRenderer) {
|
|
29037
28983
|
// Source coordinates
|
|
29038
28984
|
var s = atlas[name].offset;
|
|
29039
28985
|
var sw = atlas[name].width;
|
|
@@ -29143,7 +29089,7 @@ class TextureAtlas {
|
|
|
29143
29089
|
height = Math.max(region.height, height);
|
|
29144
29090
|
}
|
|
29145
29091
|
// instantiate a new animation sheet object
|
|
29146
|
-
return new Sprite
|
|
29092
|
+
return new Sprite(0, 0, Object.assign({
|
|
29147
29093
|
image: this,
|
|
29148
29094
|
framewidth: width,
|
|
29149
29095
|
frameheight: height,
|
|
@@ -29737,7 +29683,7 @@ var TextureCache$1 = TextureCache;
|
|
|
29737
29683
|
* a WebGL renderer object
|
|
29738
29684
|
* @augments Renderer
|
|
29739
29685
|
*/
|
|
29740
|
-
class WebGLRenderer extends Renderer
|
|
29686
|
+
class WebGLRenderer extends Renderer {
|
|
29741
29687
|
/**
|
|
29742
29688
|
* @param {object} options - The renderer parameters
|
|
29743
29689
|
* @param {number} options.width - The width of the canvas without scaling
|
|
@@ -29821,7 +29767,7 @@ class WebGLRenderer extends Renderer$1 {
|
|
|
29821
29767
|
* The current transformation matrix used for transformations on the overall scene
|
|
29822
29768
|
* @type {Matrix2d}
|
|
29823
29769
|
*/
|
|
29824
|
-
this.currentTransform = new Matrix2d
|
|
29770
|
+
this.currentTransform = new Matrix2d();
|
|
29825
29771
|
|
|
29826
29772
|
/**
|
|
29827
29773
|
* The current compositor used by the renderer
|
|
@@ -29836,7 +29782,7 @@ class WebGLRenderer extends Renderer$1 {
|
|
|
29836
29782
|
this.compositors = new Map();
|
|
29837
29783
|
|
|
29838
29784
|
// Create a default compositor
|
|
29839
|
-
var compositor = new (this.settings.compositor || WebGLCompositor
|
|
29785
|
+
var compositor = new (this.settings.compositor || WebGLCompositor)(this);
|
|
29840
29786
|
this.compositors.set("default", compositor);
|
|
29841
29787
|
this.setCompositor(compositor);
|
|
29842
29788
|
|
|
@@ -30026,7 +29972,7 @@ class WebGLRenderer extends Renderer$1 {
|
|
|
30026
29972
|
clearColor(color = "#000000", opaque = false) {
|
|
30027
29973
|
var glArray;
|
|
30028
29974
|
|
|
30029
|
-
if (color instanceof Color
|
|
29975
|
+
if (color instanceof Color) {
|
|
30030
29976
|
glArray = color.toArray();
|
|
30031
29977
|
} else {
|
|
30032
29978
|
var _color = pool$1.pull("me.Color");
|
|
@@ -30747,7 +30693,6 @@ class WebGLRenderer extends Renderer$1 {
|
|
|
30747
30693
|
}
|
|
30748
30694
|
}
|
|
30749
30695
|
}
|
|
30750
|
-
var WebGLRenderer$1 = WebGLRenderer;
|
|
30751
30696
|
|
|
30752
30697
|
/**
|
|
30753
30698
|
* video functions
|
|
@@ -30784,12 +30729,12 @@ var settings = {
|
|
|
30784
30729
|
function autoDetectRenderer(options) {
|
|
30785
30730
|
try {
|
|
30786
30731
|
if (isWebGLSupported(options)) {
|
|
30787
|
-
return new WebGLRenderer
|
|
30732
|
+
return new WebGLRenderer(options);
|
|
30788
30733
|
}
|
|
30789
30734
|
} catch (e) {
|
|
30790
30735
|
console.log("Error creating WebGL renderer :" + e.message);
|
|
30791
30736
|
}
|
|
30792
|
-
return new CanvasRenderer
|
|
30737
|
+
return new CanvasRenderer(options);
|
|
30793
30738
|
}
|
|
30794
30739
|
|
|
30795
30740
|
/**
|
|
@@ -30908,7 +30853,7 @@ let parent = null;
|
|
|
30908
30853
|
* @default <1,1>
|
|
30909
30854
|
* @memberof video
|
|
30910
30855
|
*/
|
|
30911
|
-
let scaleRatio = new Vector2d
|
|
30856
|
+
let scaleRatio = new Vector2d(1, 1);
|
|
30912
30857
|
|
|
30913
30858
|
/**
|
|
30914
30859
|
* A reference to the active Canvas or WebGL active renderer renderer
|
|
@@ -31063,7 +31008,7 @@ function init(width, height, options) {
|
|
|
31063
31008
|
renderer = autoDetectRenderer(settings);
|
|
31064
31009
|
break;
|
|
31065
31010
|
default:
|
|
31066
|
-
renderer = new CanvasRenderer
|
|
31011
|
+
renderer = new CanvasRenderer(settings);
|
|
31067
31012
|
break;
|
|
31068
31013
|
}
|
|
31069
31014
|
} catch (e) {
|
|
@@ -31097,7 +31042,7 @@ function init(width, height, options) {
|
|
|
31097
31042
|
}
|
|
31098
31043
|
|
|
31099
31044
|
if (settings.consoleHeader !== false) {
|
|
31100
|
-
var renderType = (renderer instanceof CanvasRenderer
|
|
31045
|
+
var renderType = (renderer instanceof CanvasRenderer) ? "CANVAS" : "WebGL" + renderer.WebGLVersion;
|
|
31101
31046
|
var audioType = hasWebAudio ? "Web Audio" : "HTML5 Audio";
|
|
31102
31047
|
var gpu_renderer = (typeof renderer.GPURenderer === "string") ? " (" + renderer.GPURenderer + ")" : "";
|
|
31103
31048
|
// output video information in the console
|
|
@@ -31235,7 +31180,7 @@ var utils = {
|
|
|
31235
31180
|
*/
|
|
31236
31181
|
getPixels : function (image) {
|
|
31237
31182
|
if (image instanceof HTMLImageElement) {
|
|
31238
|
-
var _context = CanvasRenderer
|
|
31183
|
+
var _context = CanvasRenderer.getContext2d(
|
|
31239
31184
|
createCanvas(image.width, image.height)
|
|
31240
31185
|
);
|
|
31241
31186
|
_context.drawImage(image, 0, 0);
|
|
@@ -31652,10 +31597,10 @@ class BasePlugin {
|
|
|
31652
31597
|
* this can be overridden by the plugin
|
|
31653
31598
|
* @public
|
|
31654
31599
|
* @type {string}
|
|
31655
|
-
* @default "14.1.
|
|
31600
|
+
* @default "14.1.1"
|
|
31656
31601
|
* @name plugin.Base#version
|
|
31657
31602
|
*/
|
|
31658
|
-
this.version = "14.1.
|
|
31603
|
+
this.version = "14.1.1";
|
|
31659
31604
|
}
|
|
31660
31605
|
}
|
|
31661
31606
|
|
|
@@ -32217,7 +32162,7 @@ let Interpolation = {
|
|
|
32217
32162
|
* author lechecacharro<br>
|
|
32218
32163
|
* author Josh Faul / http://jocafa.com/
|
|
32219
32164
|
*/
|
|
32220
|
-
class Tween {
|
|
32165
|
+
class Tween {
|
|
32221
32166
|
|
|
32222
32167
|
/**
|
|
32223
32168
|
* @param {object} object - object on which to apply the tween
|
|
@@ -32662,7 +32607,6 @@ class Tween {
|
|
|
32662
32607
|
static get Easing() { return Easing; }
|
|
32663
32608
|
static get Interpolation() { return Interpolation; }
|
|
32664
32609
|
}
|
|
32665
|
-
var Tween$1 = Tween;
|
|
32666
32610
|
|
|
32667
32611
|
// default canvas settings
|
|
32668
32612
|
var defaultAttributes = {
|
|
@@ -32817,7 +32761,7 @@ function setContextStyle(context, style, stroke = false) {
|
|
|
32817
32761
|
* a Text Metrics object that contains helper for text manipulation
|
|
32818
32762
|
* @augments Bounds
|
|
32819
32763
|
*/
|
|
32820
|
-
class TextMetrics extends Bounds
|
|
32764
|
+
class TextMetrics extends Bounds {
|
|
32821
32765
|
|
|
32822
32766
|
/**
|
|
32823
32767
|
* @param {Text|BitmapText} ancestor - the parent object that contains this TextMetrics object
|
|
@@ -32843,7 +32787,7 @@ class TextMetrics extends Bounds$1 {
|
|
|
32843
32787
|
* @returns {number} the height of a segment of inline text in CSS pixels.
|
|
32844
32788
|
*/
|
|
32845
32789
|
lineHeight() {
|
|
32846
|
-
if (this.ancestor instanceof Text
|
|
32790
|
+
if (this.ancestor instanceof Text) {
|
|
32847
32791
|
return this.ancestor.fontSize * this.ancestor.lineHeight;
|
|
32848
32792
|
} else { // it's a BitmapText
|
|
32849
32793
|
return this.ancestor.fontData.capHeight * this.ancestor.lineHeight * this.ancestor.fontScale.y;
|
|
@@ -32857,7 +32801,7 @@ class TextMetrics extends Bounds$1 {
|
|
|
32857
32801
|
* @returns {number} the width of the given segment of inline text in CSS pixels.
|
|
32858
32802
|
*/
|
|
32859
32803
|
lineWidth(text, context) {
|
|
32860
|
-
if (this.ancestor instanceof Text
|
|
32804
|
+
if (this.ancestor instanceof Text) {
|
|
32861
32805
|
return context.measureText(text).width;
|
|
32862
32806
|
} else { // it's a BitmapText
|
|
32863
32807
|
var characters = text.split("");
|
|
@@ -32974,7 +32918,6 @@ class TextMetrics extends Bounds$1 {
|
|
|
32974
32918
|
return output;
|
|
32975
32919
|
}
|
|
32976
32920
|
}
|
|
32977
|
-
var TextMetrics$1 = TextMetrics;
|
|
32978
32921
|
|
|
32979
32922
|
/*
|
|
32980
32923
|
* ASCII Table
|
|
@@ -33005,7 +32948,7 @@ var getContext2d = function (renderer$1, text) {
|
|
|
33005
32948
|
* a generic system font object.
|
|
33006
32949
|
* @augments Renderable
|
|
33007
32950
|
*/
|
|
33008
|
-
class Text extends Renderable
|
|
32951
|
+
class Text extends Renderable {
|
|
33009
32952
|
/**
|
|
33010
32953
|
* @param {number} x - position of the text object
|
|
33011
32954
|
* @param {number} y - position of the text object
|
|
@@ -33042,7 +32985,7 @@ class Text extends Renderable$1 {
|
|
|
33042
32985
|
* @default black
|
|
33043
32986
|
*/
|
|
33044
32987
|
if (typeof settings.fillStyle !== "undefined") {
|
|
33045
|
-
if (settings.fillStyle instanceof Color
|
|
32988
|
+
if (settings.fillStyle instanceof Color) {
|
|
33046
32989
|
this.fillStyle = settings.fillStyle;
|
|
33047
32990
|
} else {
|
|
33048
32991
|
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
@@ -33060,7 +33003,7 @@ class Text extends Renderable$1 {
|
|
|
33060
33003
|
* @default black
|
|
33061
33004
|
*/
|
|
33062
33005
|
if (typeof settings.strokeStyle !== "undefined") {
|
|
33063
|
-
if (settings.strokeStyle instanceof Color
|
|
33006
|
+
if (settings.strokeStyle instanceof Color) {
|
|
33064
33007
|
this.strokeStyle = settings.strokeStyle;
|
|
33065
33008
|
} else {
|
|
33066
33009
|
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
@@ -33167,7 +33110,7 @@ class Text extends Renderable$1 {
|
|
|
33167
33110
|
}
|
|
33168
33111
|
|
|
33169
33112
|
// instance to text metrics functions
|
|
33170
|
-
this.metrics = new TextMetrics
|
|
33113
|
+
this.metrics = new TextMetrics(this);
|
|
33171
33114
|
|
|
33172
33115
|
// set the text
|
|
33173
33116
|
this.setText(settings.text);
|
|
@@ -33264,7 +33207,7 @@ class Text extends Renderable$1 {
|
|
|
33264
33207
|
var width = Math.ceil(this.metrics.width),
|
|
33265
33208
|
height = Math.ceil(this.metrics.height);
|
|
33266
33209
|
|
|
33267
|
-
if (renderer instanceof WebGLRenderer
|
|
33210
|
+
if (renderer instanceof WebGLRenderer) {
|
|
33268
33211
|
// invalidate the previous corresponding texture so that it can reuploaded once changed
|
|
33269
33212
|
this.glTextureUnit = renderer.cache.getUnit(renderer.cache.get(this.canvasTexture.canvas));
|
|
33270
33213
|
renderer.currentCompositor.unbindTexture2D(null, this.glTextureUnit);
|
|
@@ -33394,7 +33337,7 @@ class Text extends Renderable$1 {
|
|
|
33394
33337
|
*/
|
|
33395
33338
|
destroy() {
|
|
33396
33339
|
if (this.offScreenCanvas === true) {
|
|
33397
|
-
if (renderer instanceof WebGLRenderer
|
|
33340
|
+
if (renderer instanceof WebGLRenderer) {
|
|
33398
33341
|
renderer.currentCompositor.deleteTexture2D(renderer.currentCompositor.getTexture2D(this.glTextureUnit));
|
|
33399
33342
|
this.glTextureUnit = undefined;
|
|
33400
33343
|
}
|
|
@@ -33410,14 +33353,13 @@ class Text extends Renderable$1 {
|
|
|
33410
33353
|
super.destroy();
|
|
33411
33354
|
}
|
|
33412
33355
|
}
|
|
33413
|
-
var Text$1 = Text;
|
|
33414
33356
|
|
|
33415
33357
|
/**
|
|
33416
33358
|
* @classdesc
|
|
33417
33359
|
* a bitmap font object
|
|
33418
33360
|
* @augments Renderable
|
|
33419
33361
|
*/
|
|
33420
|
-
class BitmapText extends Renderable
|
|
33362
|
+
class BitmapText extends Renderable {
|
|
33421
33363
|
/**
|
|
33422
33364
|
* @param {number} x - position of the text object
|
|
33423
33365
|
* @param {number} y - position of the text object
|
|
@@ -33537,7 +33479,7 @@ class BitmapText extends Renderable$1 {
|
|
|
33537
33479
|
}
|
|
33538
33480
|
|
|
33539
33481
|
// instance to text metrics functions
|
|
33540
|
-
this.metrics = new TextMetrics
|
|
33482
|
+
this.metrics = new TextMetrics(this);
|
|
33541
33483
|
|
|
33542
33484
|
// resize if necessary
|
|
33543
33485
|
if (typeof settings.size === "number" && settings.size !== 1.0) {
|
|
@@ -33599,7 +33541,7 @@ class BitmapText extends Renderable$1 {
|
|
|
33599
33541
|
return this.tint;
|
|
33600
33542
|
}
|
|
33601
33543
|
set fillStyle(value) {
|
|
33602
|
-
if (value instanceof Color
|
|
33544
|
+
if (value instanceof Color) {
|
|
33603
33545
|
this.tint.copy(value);
|
|
33604
33546
|
} else {
|
|
33605
33547
|
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
@@ -33760,7 +33702,6 @@ class BitmapText extends Renderable$1 {
|
|
|
33760
33702
|
}
|
|
33761
33703
|
|
|
33762
33704
|
}
|
|
33763
|
-
var BitmapText$1 = BitmapText;
|
|
33764
33705
|
|
|
33765
33706
|
// bitmap constants
|
|
33766
33707
|
const LOG2_PAGE_SIZE = 9;
|
|
@@ -33770,7 +33711,7 @@ const PAGE_SIZE = 1 << LOG2_PAGE_SIZE;
|
|
|
33770
33711
|
* a glyph representing a single character in a font
|
|
33771
33712
|
* @ignore
|
|
33772
33713
|
*/
|
|
33773
|
-
class Glyph {
|
|
33714
|
+
class Glyph {
|
|
33774
33715
|
/**
|
|
33775
33716
|
* @ignore
|
|
33776
33717
|
*/
|
|
@@ -33818,7 +33759,6 @@ class Glyph {
|
|
|
33818
33759
|
page[ch & PAGE_SIZE - 1] = value;
|
|
33819
33760
|
}
|
|
33820
33761
|
}
|
|
33821
|
-
var Glyph$1 = Glyph;
|
|
33822
33762
|
|
|
33823
33763
|
// bitmap constants
|
|
33824
33764
|
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 +33805,7 @@ function createSpaceGlyph(glyphs) {
|
|
|
33865
33805
|
var spaceCharCode = " ".charCodeAt(0);
|
|
33866
33806
|
var glyph = glyphs[spaceCharCode];
|
|
33867
33807
|
if (!glyph) {
|
|
33868
|
-
glyph = new Glyph
|
|
33808
|
+
glyph = new Glyph();
|
|
33869
33809
|
glyph.id = spaceCharCode;
|
|
33870
33810
|
glyph.xadvance = getFirstGlyph(glyphs).xadvance;
|
|
33871
33811
|
glyphs[spaceCharCode] = glyph;
|
|
@@ -33876,7 +33816,7 @@ function createSpaceGlyph(glyphs) {
|
|
|
33876
33816
|
* Class for storing relevant data from the font file.
|
|
33877
33817
|
* @ignore
|
|
33878
33818
|
*/
|
|
33879
|
-
class BitmapTextData {
|
|
33819
|
+
class BitmapTextData {
|
|
33880
33820
|
|
|
33881
33821
|
/**
|
|
33882
33822
|
* @param {string} data - The bitmap font data pulled from the resource loader using me.loader.getBinary()
|
|
@@ -33959,7 +33899,7 @@ class BitmapTextData {
|
|
|
33959
33899
|
glyph.setKerning(second, amount);
|
|
33960
33900
|
}
|
|
33961
33901
|
} else {
|
|
33962
|
-
glyph = new Glyph
|
|
33902
|
+
glyph = new Glyph();
|
|
33963
33903
|
|
|
33964
33904
|
var ch = parseFloat(characterValues[2]);
|
|
33965
33905
|
glyph.id = ch;
|
|
@@ -34007,14 +33947,13 @@ class BitmapTextData {
|
|
|
34007
33947
|
this.capHeight -= padY;
|
|
34008
33948
|
}
|
|
34009
33949
|
}
|
|
34010
|
-
var BitmapTextData$1 = BitmapTextData;
|
|
34011
33950
|
|
|
34012
33951
|
/**
|
|
34013
33952
|
* @classdesc
|
|
34014
33953
|
* a generic Color Layer Object. Fills the entire Canvas with the color not just the container the object belongs to.
|
|
34015
33954
|
* @augments Renderable
|
|
34016
33955
|
*/
|
|
34017
|
-
class ColorLayer extends Renderable
|
|
33956
|
+
class ColorLayer extends Renderable {
|
|
34018
33957
|
/**
|
|
34019
33958
|
* @param {string} name - Layer name
|
|
34020
33959
|
* @param {Color|string} color - CSS color
|
|
@@ -34076,14 +34015,12 @@ class ColorLayer extends Renderable$1 {
|
|
|
34076
34015
|
|
|
34077
34016
|
}
|
|
34078
34017
|
|
|
34079
|
-
var ColorLayer$1 = ColorLayer;
|
|
34080
|
-
|
|
34081
34018
|
/**
|
|
34082
34019
|
* @classdesc
|
|
34083
34020
|
* a generic Image Layer Object
|
|
34084
34021
|
* @augments Renderable
|
|
34085
34022
|
*/
|
|
34086
|
-
class ImageLayer extends Sprite
|
|
34023
|
+
class ImageLayer extends Sprite {
|
|
34087
34024
|
/**
|
|
34088
34025
|
* @param {number} x - x coordinate
|
|
34089
34026
|
* @param {number} y - y coordinate
|
|
@@ -34367,7 +34304,6 @@ class ImageLayer extends Sprite$1 {
|
|
|
34367
34304
|
}
|
|
34368
34305
|
|
|
34369
34306
|
}
|
|
34370
|
-
var ImageLayer$1 = ImageLayer;
|
|
34371
34307
|
|
|
34372
34308
|
/**
|
|
34373
34309
|
* @classdesc
|
|
@@ -34377,7 +34313,7 @@ var ImageLayer$1 = ImageLayer;
|
|
|
34377
34313
|
* @see https://en.wikipedia.org/wiki/9-slice_scaling
|
|
34378
34314
|
* @augments Sprite
|
|
34379
34315
|
*/
|
|
34380
|
-
class NineSliceSprite extends Sprite
|
|
34316
|
+
class NineSliceSprite extends Sprite {
|
|
34381
34317
|
/**
|
|
34382
34318
|
* @param {number} x - the x coordinates of the sprite object
|
|
34383
34319
|
* @param {number} y - the y coordinates of the sprite object
|
|
@@ -34604,7 +34540,6 @@ class NineSliceSprite extends Sprite$1 {
|
|
|
34604
34540
|
);
|
|
34605
34541
|
}
|
|
34606
34542
|
}
|
|
34607
|
-
var NineSliceSprite$1 = NineSliceSprite;
|
|
34608
34543
|
|
|
34609
34544
|
/**
|
|
34610
34545
|
* @classdesc
|
|
@@ -34613,7 +34548,7 @@ var NineSliceSprite$1 = NineSliceSprite;
|
|
|
34613
34548
|
* text and images.
|
|
34614
34549
|
* @augments Container
|
|
34615
34550
|
*/
|
|
34616
|
-
class UIBaseElement extends Container
|
|
34551
|
+
class UIBaseElement extends Container {
|
|
34617
34552
|
/**
|
|
34618
34553
|
*
|
|
34619
34554
|
* @param {number} x - The x position of the container
|
|
@@ -34805,14 +34740,13 @@ class UIBaseElement extends Container$1 {
|
|
|
34805
34740
|
timer$1.clearTimeout(this.holdTimeout);
|
|
34806
34741
|
}
|
|
34807
34742
|
}
|
|
34808
|
-
var UIBaseElement$1 = UIBaseElement;
|
|
34809
34743
|
|
|
34810
34744
|
/**
|
|
34811
34745
|
* @classdesc
|
|
34812
34746
|
* This is a basic base text button which you can use in your Game UI.
|
|
34813
34747
|
* @augments UIBaseElement
|
|
34814
34748
|
*/
|
|
34815
|
-
class UITextButton extends UIBaseElement
|
|
34749
|
+
class UITextButton extends UIBaseElement {
|
|
34816
34750
|
/**
|
|
34817
34751
|
* A Text Button with an outlined background border, filled with background color.
|
|
34818
34752
|
* It uses a RoundRect as background and changes the background color on hovering over.
|
|
@@ -34863,14 +34797,14 @@ class UITextButton extends UIBaseElement$1 {
|
|
|
34863
34797
|
settings.offScreenCanvas = settings.offScreenCanvas || false;
|
|
34864
34798
|
settings.fillStyle = settings.fillStyle || "#ffffff";
|
|
34865
34799
|
settings.lineWidth = settings.lineWidth || 1;
|
|
34866
|
-
settings.anchorPoint = settings.anchorPoint || new Vector2d
|
|
34800
|
+
settings.anchorPoint = settings.anchorPoint || new Vector2d(0, 0);
|
|
34867
34801
|
|
|
34868
|
-
let font = new BitmapText
|
|
34802
|
+
let font = new BitmapText(x, y, settings);
|
|
34869
34803
|
let dimensions = font.measureText();
|
|
34870
34804
|
settings.borderWidth = settings.borderWidth || dimensions.width + 16;
|
|
34871
34805
|
settings.borderHeight = settings.borderHeight || dimensions.height + 16;
|
|
34872
34806
|
|
|
34873
|
-
let border = new RoundRect
|
|
34807
|
+
let border = new RoundRect(
|
|
34874
34808
|
x,
|
|
34875
34809
|
y,
|
|
34876
34810
|
settings.borderWidth,
|
|
@@ -34920,14 +34854,13 @@ class UITextButton extends UIBaseElement$1 {
|
|
|
34920
34854
|
);
|
|
34921
34855
|
}
|
|
34922
34856
|
}
|
|
34923
|
-
var UITextButton$1 = UITextButton;
|
|
34924
34857
|
|
|
34925
34858
|
/**
|
|
34926
34859
|
* @classdesc
|
|
34927
34860
|
* This is a basic sprite based button which you can use in your Game UI.
|
|
34928
34861
|
* @augments Sprite
|
|
34929
34862
|
*/
|
|
34930
|
-
class UISpriteElement extends Sprite
|
|
34863
|
+
class UISpriteElement extends Sprite {
|
|
34931
34864
|
/**
|
|
34932
34865
|
* @param {number} x - the x coordinate of the GUI Object
|
|
34933
34866
|
* @param {number} y - the y coordinate of the GUI Object
|
|
@@ -35134,14 +35067,13 @@ class UISpriteElement extends Sprite$1 {
|
|
|
35134
35067
|
timer$1.clearTimeout(this.holdTimeout);
|
|
35135
35068
|
}
|
|
35136
35069
|
}
|
|
35137
|
-
var UISpriteElement$1 = UISpriteElement;
|
|
35138
35070
|
|
|
35139
35071
|
/**
|
|
35140
35072
|
* @classdesc
|
|
35141
35073
|
* a basic collectable helper class for immovable object (e.g. a coin)
|
|
35142
35074
|
* @augments Sprite
|
|
35143
35075
|
*/
|
|
35144
|
-
class Collectable extends Sprite
|
|
35076
|
+
class Collectable extends Sprite {
|
|
35145
35077
|
/**
|
|
35146
35078
|
* @param {number} x - the x coordinates of the collectable
|
|
35147
35079
|
* @param {number} y - the y coordinates of the collectable
|
|
@@ -35165,7 +35097,7 @@ class Collectable extends Sprite$1 {
|
|
|
35165
35097
|
pool$1.pull("Vector2d", this.width, this.height)
|
|
35166
35098
|
]);
|
|
35167
35099
|
}
|
|
35168
|
-
this.body = new Body
|
|
35100
|
+
this.body = new Body(this, shape);
|
|
35169
35101
|
this.body.collisionType = collision$1.types.COLLECTABLE_OBJECT;
|
|
35170
35102
|
// by default only collides with PLAYER_OBJECT
|
|
35171
35103
|
this.body.setCollisionMask(collision$1.types.PLAYER_OBJECT);
|
|
@@ -35183,14 +35115,12 @@ class Collectable extends Sprite$1 {
|
|
|
35183
35115
|
|
|
35184
35116
|
}
|
|
35185
35117
|
|
|
35186
|
-
var Collectable$1 = Collectable;
|
|
35187
|
-
|
|
35188
35118
|
/**
|
|
35189
35119
|
* @classdesc
|
|
35190
35120
|
* trigger an event when colliding with another object
|
|
35191
35121
|
* @augments Renderable
|
|
35192
35122
|
*/
|
|
35193
|
-
class Trigger extends Renderable
|
|
35123
|
+
class Trigger extends Renderable {
|
|
35194
35124
|
/**
|
|
35195
35125
|
* @param {number} x - the x coordinates of the trigger area
|
|
35196
35126
|
* @param {number} y - the y coordinates of the trigger area
|
|
@@ -35255,7 +35185,7 @@ class Trigger extends Renderable$1 {
|
|
|
35255
35185
|
pool$1.pull("Vector2d", this.width, this.height)
|
|
35256
35186
|
]);
|
|
35257
35187
|
}
|
|
35258
|
-
this.body = new Body
|
|
35188
|
+
this.body = new Body(this, shape);
|
|
35259
35189
|
this.body.collisionType = collision$1.types.ACTION_OBJECT;
|
|
35260
35190
|
// by default only collides with PLAYER_OBJECT
|
|
35261
35191
|
this.body.setCollisionMask(collision$1.types.PLAYER_OBJECT);
|
|
@@ -35325,7 +35255,6 @@ class Trigger extends Renderable$1 {
|
|
|
35325
35255
|
}
|
|
35326
35256
|
|
|
35327
35257
|
}
|
|
35328
|
-
var Trigger$1 = Trigger;
|
|
35329
35258
|
|
|
35330
35259
|
/** @ignore */
|
|
35331
35260
|
function createGradient(light) {
|
|
@@ -35375,7 +35304,7 @@ function createGradient(light) {
|
|
|
35375
35304
|
* (multiple lights are not supported, alpha component of the ambient light is ignored)
|
|
35376
35305
|
* @see stage.lights
|
|
35377
35306
|
*/
|
|
35378
|
-
class Light2d extends Renderable
|
|
35307
|
+
class Light2d extends Renderable {
|
|
35379
35308
|
/**
|
|
35380
35309
|
* @param {number} x - The horizontal position of the light.
|
|
35381
35310
|
* @param {number} y - The vertical position of the light.
|
|
@@ -35470,7 +35399,6 @@ class Light2d extends Renderable$1 {
|
|
|
35470
35399
|
super.destroy();
|
|
35471
35400
|
}
|
|
35472
35401
|
}
|
|
35473
|
-
var Light2d$1 = Light2d;
|
|
35474
35402
|
|
|
35475
35403
|
/**
|
|
35476
35404
|
* @classdesc
|
|
@@ -35478,7 +35406,7 @@ var Light2d$1 = Light2d;
|
|
|
35478
35406
|
* @see DropTarget
|
|
35479
35407
|
* @augments Renderable
|
|
35480
35408
|
*/
|
|
35481
|
-
class Draggable extends Renderable
|
|
35409
|
+
class Draggable extends Renderable {
|
|
35482
35410
|
/**
|
|
35483
35411
|
* @param {number} x - the x coordinates of the draggable object
|
|
35484
35412
|
* @param {number} y - the y coordinates of the draggable object
|
|
@@ -35490,7 +35418,7 @@ class Draggable extends Renderable$1 {
|
|
|
35490
35418
|
this.isKinematic = false;
|
|
35491
35419
|
this.dragging = false;
|
|
35492
35420
|
this.dragId = null;
|
|
35493
|
-
this.grabOffset = new Vector2d
|
|
35421
|
+
this.grabOffset = new Vector2d(0, 0);
|
|
35494
35422
|
this.initEvents();
|
|
35495
35423
|
}
|
|
35496
35424
|
|
|
@@ -35586,7 +35514,7 @@ class Draggable extends Renderable$1 {
|
|
|
35586
35514
|
* @see Draggable
|
|
35587
35515
|
* @augments Renderable
|
|
35588
35516
|
*/
|
|
35589
|
-
class DropTarget extends Renderable
|
|
35517
|
+
class DropTarget extends Renderable {
|
|
35590
35518
|
/**
|
|
35591
35519
|
* @param {number} x - the x coordinates of the drop target
|
|
35592
35520
|
* @param {number} y - the y coordinates of the drop target
|
|
@@ -36011,7 +35939,7 @@ function createDefaultParticleTexture(w = 8, h = 8) {
|
|
|
36011
35939
|
* Particle Emitter Object.
|
|
36012
35940
|
* @augments Container
|
|
36013
35941
|
*/
|
|
36014
|
-
class ParticleEmitter extends Container
|
|
35942
|
+
class ParticleEmitter extends Container {
|
|
36015
35943
|
/**
|
|
36016
35944
|
* @param {number} x - x position of the particle emitter
|
|
36017
35945
|
* @param {number} y - y position of the particle emitter
|
|
@@ -36246,14 +36174,12 @@ class ParticleEmitter extends Container$1 {
|
|
|
36246
36174
|
}
|
|
36247
36175
|
}
|
|
36248
36176
|
|
|
36249
|
-
var ParticleEmitter$1 = ParticleEmitter;
|
|
36250
|
-
|
|
36251
36177
|
/**
|
|
36252
36178
|
* @classdesc
|
|
36253
36179
|
* Single Particle Object.
|
|
36254
36180
|
* @augments Renderable
|
|
36255
36181
|
*/
|
|
36256
|
-
class Particle extends Renderable
|
|
36182
|
+
class Particle extends Renderable {
|
|
36257
36183
|
/**
|
|
36258
36184
|
* @param {ParticleEmitter} emitter - the particle emitter
|
|
36259
36185
|
*/
|
|
@@ -36421,15 +36347,13 @@ class Particle extends Renderable$1 {
|
|
|
36421
36347
|
}
|
|
36422
36348
|
}
|
|
36423
36349
|
|
|
36424
|
-
var Particle$1 = Particle;
|
|
36425
|
-
|
|
36426
36350
|
/**
|
|
36427
36351
|
* @classdesc
|
|
36428
36352
|
* a Generic Object Entity
|
|
36429
36353
|
* @augments Renderable
|
|
36430
36354
|
* @see Renderable
|
|
36431
36355
|
*/
|
|
36432
|
-
class Entity extends Renderable
|
|
36356
|
+
class Entity extends Renderable {
|
|
36433
36357
|
/**
|
|
36434
36358
|
* @param {number} x - the x coordinates of the entity object
|
|
36435
36359
|
* @param {number} y - the y coordinates of the entity object
|
|
@@ -36467,7 +36391,7 @@ class Entity extends Renderable$1 {
|
|
|
36467
36391
|
// set the frame size to the given entity size, if not defined in settings
|
|
36468
36392
|
settings.framewidth = settings.framewidth || settings.width;
|
|
36469
36393
|
settings.frameheight = settings.frameheight || settings.height;
|
|
36470
|
-
this.renderable = new Sprite
|
|
36394
|
+
this.renderable = new Sprite(0, 0, settings);
|
|
36471
36395
|
}
|
|
36472
36396
|
|
|
36473
36397
|
// Update anchorPoint
|
|
@@ -36527,7 +36451,7 @@ class Entity extends Renderable$1 {
|
|
|
36527
36451
|
pool$1.pull("Vector2d", 0, this.height)
|
|
36528
36452
|
]);
|
|
36529
36453
|
}
|
|
36530
|
-
this.body = new Body
|
|
36454
|
+
this.body = new Body(this, settings.shapes, this.onBodyUpdate.bind(this));
|
|
36531
36455
|
|
|
36532
36456
|
// resize the entity if required
|
|
36533
36457
|
if (this.width === 0 && this.height === 0) {
|
|
@@ -36556,7 +36480,7 @@ class Entity extends Renderable$1 {
|
|
|
36556
36480
|
}
|
|
36557
36481
|
|
|
36558
36482
|
set renderable(value) {
|
|
36559
|
-
if (value instanceof Renderable
|
|
36483
|
+
if (value instanceof Renderable) {
|
|
36560
36484
|
this.children[0] = value;
|
|
36561
36485
|
this.children[0].ancestor = this;
|
|
36562
36486
|
} else {
|
|
@@ -36595,7 +36519,7 @@ class Entity extends Renderable$1 {
|
|
|
36595
36519
|
this.pos.y + this.body.getBounds().y
|
|
36596
36520
|
);
|
|
36597
36521
|
|
|
36598
|
-
if (this.renderable instanceof Renderable
|
|
36522
|
+
if (this.renderable instanceof Renderable) {
|
|
36599
36523
|
// draw the child renderable's anchorPoint at the entity's
|
|
36600
36524
|
// anchor point. the entity's anchor point is a scale from
|
|
36601
36525
|
// body position to body width/height
|
|
@@ -36616,7 +36540,7 @@ class Entity extends Renderable$1 {
|
|
|
36616
36540
|
*/
|
|
36617
36541
|
draw(renderer, viewport) {
|
|
36618
36542
|
var renderable = this.renderable;
|
|
36619
|
-
if (renderable instanceof Renderable
|
|
36543
|
+
if (renderable instanceof Renderable) {
|
|
36620
36544
|
// predraw (apply transforms)
|
|
36621
36545
|
renderable.preDraw(renderer);
|
|
36622
36546
|
|
|
@@ -36656,7 +36580,6 @@ class Entity extends Renderable$1 {
|
|
|
36656
36580
|
}
|
|
36657
36581
|
|
|
36658
36582
|
}
|
|
36659
|
-
var Entity$1 = Entity;
|
|
36660
36583
|
|
|
36661
36584
|
/*
|
|
36662
36585
|
* placeholder for all deprecated classes and corresponding alias for backward compatibility
|
|
@@ -36708,7 +36631,7 @@ function warning(deprecated, replacement, version) {
|
|
|
36708
36631
|
* @deprecated since 10.4.0
|
|
36709
36632
|
* @see TextureAtlas
|
|
36710
36633
|
*/
|
|
36711
|
-
Object.defineProperty(Renderer
|
|
36634
|
+
Object.defineProperty(Renderer.prototype, "Texture", {
|
|
36712
36635
|
/**
|
|
36713
36636
|
* @ignore
|
|
36714
36637
|
*/
|
|
@@ -36764,7 +36687,7 @@ class DroptargetEntity extends DropTarget {
|
|
|
36764
36687
|
* @deprecated since 13.1.0
|
|
36765
36688
|
* @see getCanvas();
|
|
36766
36689
|
*/
|
|
36767
|
-
Renderer
|
|
36690
|
+
Renderer.prototype.getScreenCanvas = function() {
|
|
36768
36691
|
warning("getScreenCanvas", "getCanvas", "13.1.0");
|
|
36769
36692
|
return this.getCanvas();
|
|
36770
36693
|
};
|
|
@@ -36778,7 +36701,7 @@ Renderer$1.prototype.getScreenCanvas = function() {
|
|
|
36778
36701
|
* @deprecated since 13.1.0
|
|
36779
36702
|
* @see getContext();
|
|
36780
36703
|
*/
|
|
36781
|
-
Renderer
|
|
36704
|
+
Renderer.prototype.getScreenContext = function() {
|
|
36782
36705
|
warning("getScreenContext", "getContext", "13.1.0");
|
|
36783
36706
|
return this.getContext();
|
|
36784
36707
|
};
|
|
@@ -36790,7 +36713,7 @@ Renderer$1.prototype.getScreenContext = function() {
|
|
|
36790
36713
|
* @deprecated since 14.0.0
|
|
36791
36714
|
* @see UISpriteElement
|
|
36792
36715
|
*/
|
|
36793
|
-
class GUI_Object extends UISpriteElement
|
|
36716
|
+
class GUI_Object extends UISpriteElement {
|
|
36794
36717
|
/**
|
|
36795
36718
|
* @param {number} x - the x coordinate of the GUI Object
|
|
36796
36719
|
* @param {number} y - the y coordinate of the GUI Object
|
|
@@ -36812,7 +36735,7 @@ Renderer$1.prototype.getScreenContext = function() {
|
|
|
36812
36735
|
* @name version
|
|
36813
36736
|
* @type {string}
|
|
36814
36737
|
*/
|
|
36815
|
-
const version = "14.1.
|
|
36738
|
+
const version = "14.1.1";
|
|
36816
36739
|
|
|
36817
36740
|
|
|
36818
36741
|
/**
|
|
@@ -36846,64 +36769,64 @@ function boot() {
|
|
|
36846
36769
|
}
|
|
36847
36770
|
|
|
36848
36771
|
// 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
|
|
36772
|
+
pool$1.register("me.Entity", Entity);
|
|
36773
|
+
pool$1.register("me.Collectable", Collectable);
|
|
36774
|
+
pool$1.register("me.Trigger", Trigger);
|
|
36775
|
+
pool$1.register("me.Light2d", Light2d);
|
|
36776
|
+
pool$1.register("me.Tween", Tween, true);
|
|
36777
|
+
pool$1.register("me.Color", Color, true);
|
|
36778
|
+
pool$1.register("me.Particle", Particle, true);
|
|
36779
|
+
pool$1.register("me.Sprite", Sprite);
|
|
36780
|
+
pool$1.register("me.NineSliceSprite", NineSliceSprite);
|
|
36781
|
+
pool$1.register("me.Renderable", Renderable);
|
|
36782
|
+
pool$1.register("me.Text", Text, true);
|
|
36783
|
+
pool$1.register("me.BitmapText", BitmapText);
|
|
36784
|
+
pool$1.register("me.BitmapTextData", BitmapTextData, true);
|
|
36785
|
+
pool$1.register("me.ImageLayer", ImageLayer);
|
|
36786
|
+
pool$1.register("me.ColorLayer", ColorLayer, true);
|
|
36787
|
+
pool$1.register("me.Vector2d", Vector2d, true);
|
|
36788
|
+
pool$1.register("me.Vector3d", Vector3d, true);
|
|
36789
|
+
pool$1.register("me.ObservableVector2d", ObservableVector2d, true);
|
|
36790
|
+
pool$1.register("me.ObservableVector3d", ObservableVector3d, true);
|
|
36791
|
+
pool$1.register("me.Matrix2d", Matrix2d, true);
|
|
36792
|
+
pool$1.register("me.Matrix3d", Matrix3d, true);
|
|
36793
|
+
pool$1.register("me.Rect", Rect, true);
|
|
36794
|
+
pool$1.register("me.RoundRect", RoundRect, true);
|
|
36795
|
+
pool$1.register("me.Polygon", Polygon, true);
|
|
36796
|
+
pool$1.register("me.Line", Line, true);
|
|
36797
|
+
pool$1.register("me.Point", Point, true);
|
|
36798
|
+
pool$1.register("me.Ellipse", Ellipse, true);
|
|
36799
|
+
pool$1.register("me.Bounds", Bounds, true);
|
|
36877
36800
|
|
|
36878
36801
|
// 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
|
|
36802
|
+
pool$1.register("Entity", Entity);
|
|
36803
|
+
pool$1.register("Collectable", Collectable);
|
|
36804
|
+
pool$1.register("Trigger", Trigger);
|
|
36805
|
+
pool$1.register("Light2d", Light2d);
|
|
36806
|
+
pool$1.register("Tween", Tween, true);
|
|
36807
|
+
pool$1.register("Color", Color, true);
|
|
36808
|
+
pool$1.register("Particle", Particle, true);
|
|
36809
|
+
pool$1.register("Sprite", Sprite);
|
|
36810
|
+
pool$1.register("NineSliceSprite", NineSliceSprite);
|
|
36811
|
+
pool$1.register("Renderable", Renderable);
|
|
36812
|
+
pool$1.register("Text", Text, true);
|
|
36813
|
+
pool$1.register("BitmapText", BitmapText);
|
|
36814
|
+
pool$1.register("BitmapTextData", BitmapTextData, true);
|
|
36815
|
+
pool$1.register("ImageLayer", ImageLayer);
|
|
36816
|
+
pool$1.register("ColorLayer", ColorLayer, true);
|
|
36817
|
+
pool$1.register("Vector2d", Vector2d, true);
|
|
36818
|
+
pool$1.register("Vector3d", Vector3d, true);
|
|
36819
|
+
pool$1.register("ObservableVector2d", ObservableVector2d, true);
|
|
36820
|
+
pool$1.register("ObservableVector3d", ObservableVector3d, true);
|
|
36821
|
+
pool$1.register("Matrix2d", Matrix2d, true);
|
|
36822
|
+
pool$1.register("Matrix3d", Matrix3d, true);
|
|
36823
|
+
pool$1.register("Rect", Rect, true);
|
|
36824
|
+
pool$1.register("RoundRect", RoundRect, true);
|
|
36825
|
+
pool$1.register("Polygon", Polygon, true);
|
|
36826
|
+
pool$1.register("Line", Line, true);
|
|
36827
|
+
pool$1.register("Point", Point, true);
|
|
36828
|
+
pool$1.register("Ellipse", Ellipse, true);
|
|
36829
|
+
pool$1.register("Bounds", Bounds, true);
|
|
36907
36830
|
pool$1.register("CanvasTexture", CanvasTexture$1, true);
|
|
36908
36831
|
|
|
36909
36832
|
// publish Boot notification
|
|
@@ -36926,4 +36849,4 @@ onReady(() => {
|
|
|
36926
36849
|
}
|
|
36927
36850
|
});
|
|
36928
36851
|
|
|
36929
|
-
export { BitmapText
|
|
36852
|
+
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 };
|