melonjs 15.1.3 → 15.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
- package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
- package/dist/melonjs.mjs/_virtual/howler.js +1 -1
- package/dist/melonjs.mjs/_virtual/index.js +1 -1
- package/dist/melonjs.mjs/application/application.js +1 -1
- package/dist/melonjs.mjs/application/header.js +1 -1
- package/dist/melonjs.mjs/application/resize.js +1 -1
- package/dist/melonjs.mjs/application/settings.js +1 -1
- package/dist/melonjs.mjs/audio/audio.js +3 -3
- package/dist/melonjs.mjs/camera/camera2d.js +1 -1
- package/dist/melonjs.mjs/const.js +2 -2
- package/dist/melonjs.mjs/entity/entity.js +3 -6
- package/dist/melonjs.mjs/geometries/ellipse.js +1 -1
- package/dist/melonjs.mjs/geometries/line.js +1 -1
- package/dist/melonjs.mjs/geometries/path2d.js +5 -5
- package/dist/melonjs.mjs/geometries/point.js +1 -1
- package/dist/melonjs.mjs/geometries/poly.js +3 -3
- package/dist/melonjs.mjs/geometries/rectangle.js +1 -1
- package/dist/melonjs.mjs/geometries/roundrect.js +1 -1
- 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 +10 -10
- package/dist/melonjs.mjs/lang/console.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 +4 -4
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +4 -4
- package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +2 -2
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +2 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/autodetect.js +1 -1
- package/dist/melonjs.mjs/loader/cache.js +1 -1
- package/dist/melonjs.mjs/loader/loader.js +53 -67
- package/dist/melonjs.mjs/loader/loadingscreen.js +1 -1
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
- package/dist/melonjs.mjs/loader/parser.js +1 -1
- package/dist/melonjs.mjs/loader/settings.js +1 -1
- package/dist/melonjs.mjs/math/color.js +1 -1
- package/dist/melonjs.mjs/math/math.js +1 -1
- package/dist/melonjs.mjs/math/matrix2.js +1 -1
- package/dist/melonjs.mjs/math/matrix3.js +1 -1
- package/dist/melonjs.mjs/math/observable_vector2.js +1 -1
- package/dist/melonjs.mjs/math/observable_vector3.js +1 -1
- package/dist/melonjs.mjs/math/vector2.js +1 -1
- package/dist/melonjs.mjs/math/vector3.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/arraymultimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/multimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +1 -1
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
- package/dist/melonjs.mjs/particles/emitter.js +1 -1
- package/dist/melonjs.mjs/particles/particle.js +1 -1
- package/dist/melonjs.mjs/particles/settings.js +1 -1
- package/dist/melonjs.mjs/physics/body.js +1 -1
- package/dist/melonjs.mjs/physics/bounds.js +2 -2
- package/dist/melonjs.mjs/physics/collision.js +1 -1
- package/dist/melonjs.mjs/physics/detector.js +2 -2
- package/dist/melonjs.mjs/physics/quadtree.js +2 -2
- package/dist/melonjs.mjs/physics/response.js +1 -1
- package/dist/melonjs.mjs/physics/sat.js +5 -4
- package/dist/melonjs.mjs/physics/world.js +1 -1
- package/dist/melonjs.mjs/plugin/plugin.js +3 -3
- package/dist/melonjs.mjs/renderable/collectable.js +1 -1
- package/dist/melonjs.mjs/renderable/colorlayer.js +1 -1
- package/dist/melonjs.mjs/renderable/container.js +35 -25
- package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
- package/dist/melonjs.mjs/renderable/imagelayer.js +1 -1
- package/dist/melonjs.mjs/renderable/light2d.js +1 -1
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +1 -1
- package/dist/melonjs.mjs/renderable/renderable.js +6 -9
- package/dist/melonjs.mjs/renderable/sprite.js +1 -1
- package/dist/melonjs.mjs/renderable/trigger.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +7 -4
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +8 -2
- package/dist/melonjs.mjs/renderable/ui/uitextbutton.js +1 -1
- package/dist/melonjs.mjs/state/stage.js +1 -1
- 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 -3
- package/dist/melonjs.mjs/text/bitmaptextdata.js +1 -1
- package/dist/melonjs.mjs/text/glyph.js +1 -1
- package/dist/melonjs.mjs/text/text.js +2 -2
- package/dist/melonjs.mjs/text/textmetrics.js +1 -1
- package/dist/melonjs.mjs/text/textstyle.js +1 -1
- package/dist/melonjs.mjs/tweens/easing.js +1 -1
- package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
- package/dist/melonjs.mjs/tweens/tween.js +1 -1
- 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 -6
- package/dist/melonjs.mjs/video/renderer.js +1 -1
- 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 +2 -2
- package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
- package/dist/melonjs.mjs/video/video.js +10 -3
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +1 -1
- package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +1 -1
- package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +1 -1
- package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +1 -1
- package/dist/melonjs.mjs/video/webgl/glshader.js +1 -1
- 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_renderer.js +1 -1
- package/dist/melonjs.module.js +150 -152
- package/dist/types/audio/audio.d.ts +2 -2
- package/dist/types/const.d.ts +2 -2
- package/dist/types/loader/loader.d.ts +54 -55
- package/dist/types/renderable/renderable.d.ts +1 -1
- package/dist/types/video/video.d.ts +1 -1
- package/package.json +8 -8
- package/src/audio/audio.js +2 -2
- package/src/const.js +1 -1
- package/src/entity/entity.js +2 -5
- package/src/geometries/path2d.js +4 -4
- package/src/geometries/poly.js +2 -2
- package/src/input/pointerevent.js +9 -9
- package/src/level/tiled/TMXLayer.js +3 -3
- package/src/level/tiled/TMXUtils.js +3 -3
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
- package/src/loader/loader.js +52 -66
- package/src/physics/bounds.js +1 -1
- package/src/physics/detector.js +1 -1
- package/src/physics/quadtree.js +1 -1
- package/src/physics/sat.js +3 -3
- package/src/renderable/container.js +34 -24
- package/src/renderable/renderable.js +5 -8
- package/src/renderable/ui/uibaseelement.js +6 -3
- package/src/renderable/ui/uispriteelement.js +7 -1
- package/src/text/bitmaptext.js +2 -2
- package/src/text/text.js +1 -1
- package/src/video/canvas/canvas_renderer.js +2 -5
- package/src/video/texture/canvas_texture.js +1 -1
- package/src/video/video.js +1 -1
package/dist/melonjs.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.1.
|
|
2
|
+
* melonJS Game Engine - v15.1.5
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -7020,8 +7020,8 @@ var earcut$1 = /*@__PURE__*/getDefaultExportFromCjs(earcutExports);
|
|
|
7020
7020
|
|
|
7021
7021
|
//http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
|
|
7022
7022
|
for (let i = 0, j = len - 1; i < len; j = i++) {
|
|
7023
|
-
|
|
7024
|
-
|
|
7023
|
+
const iy = points[i].y + posy, ix = points[i].x + posx,
|
|
7024
|
+
jy = points[j].y + posy, jx = points[j].x + posx;
|
|
7025
7025
|
if (((iy > _y) !== (jy > _y)) && (_x < (jx - ix) * (_y - iy) / (jy - iy) + ix)) {
|
|
7026
7026
|
intersects = !intersects;
|
|
7027
7027
|
}
|
|
@@ -8449,7 +8449,7 @@ let QT_VECTOR = new Vector2d();
|
|
|
8449
8449
|
*/
|
|
8450
8450
|
hasChildren() {
|
|
8451
8451
|
for (let i = 0; i < this.nodes.length; i = i + 1) {
|
|
8452
|
-
|
|
8452
|
+
const subnode = this.nodes[i];
|
|
8453
8453
|
if (subnode.length > 0 || subnode.objects.length > 0) {
|
|
8454
8454
|
return true;
|
|
8455
8455
|
}
|
|
@@ -8670,7 +8670,7 @@ let QT_VECTOR = new Vector2d();
|
|
|
8670
8670
|
this.clear();
|
|
8671
8671
|
}
|
|
8672
8672
|
for (let i = 0; i < vertices.length; i++) {
|
|
8673
|
-
|
|
8673
|
+
const vertex = vertices[i];
|
|
8674
8674
|
if (vertex.x > this.max.x) this.max.x = vertex.x;
|
|
8675
8675
|
if (vertex.x < this.min.x) this.min.x = vertex.x;
|
|
8676
8676
|
if (vertex.y > this.max.y) this.max.y = vertex.y;
|
|
@@ -13758,7 +13758,7 @@ function hasAudio() {
|
|
|
13758
13758
|
* enable audio output <br>
|
|
13759
13759
|
* only useful if audio supported and previously disabled through
|
|
13760
13760
|
* @function audio.enable
|
|
13761
|
-
* @see audio
|
|
13761
|
+
* @see audio.disable
|
|
13762
13762
|
*/
|
|
13763
13763
|
function enable() {
|
|
13764
13764
|
unmuteAll();
|
|
@@ -14010,7 +14010,7 @@ function playTrack(sound_name, volume) {
|
|
|
14010
14010
|
/**
|
|
14011
14011
|
* stop the current audio track
|
|
14012
14012
|
* @function audio.stopTrack
|
|
14013
|
-
* @see audio
|
|
14013
|
+
* @see audio.playTrack
|
|
14014
14014
|
* @example
|
|
14015
14015
|
* // play a awesome music
|
|
14016
14016
|
* me.audio.playTrack("awesome_music");
|
|
@@ -14218,7 +14218,7 @@ const WEBGL$1 = 1;
|
|
|
14218
14218
|
/**
|
|
14219
14219
|
* constant to auto-select the renderer (Attempt WebGL first, with fallback to Canvas)
|
|
14220
14220
|
* @static
|
|
14221
|
-
* @type
|
|
14221
|
+
* @type {number}
|
|
14222
14222
|
* @see Application
|
|
14223
14223
|
*/
|
|
14224
14224
|
const AUTO$1 = 2;
|
|
@@ -14374,7 +14374,7 @@ function createCanvas(width, height, returnOffscreenCanvas = false) {
|
|
|
14374
14374
|
throw new Error("width or height was zero, Canvas could not be initialized !");
|
|
14375
14375
|
}
|
|
14376
14376
|
|
|
14377
|
-
if (
|
|
14377
|
+
if (offscreenCanvas === true && returnOffscreenCanvas === true) {
|
|
14378
14378
|
_canvas = new globalThis.OffscreenCanvas(0, 0);
|
|
14379
14379
|
// stubbing style for compatibility,
|
|
14380
14380
|
// as OffscreenCanvas is detached from the DOM
|
|
@@ -16641,7 +16641,7 @@ function enablePointerEvent() {
|
|
|
16641
16641
|
*/
|
|
16642
16642
|
function findActiveEvent(activeEventList, eventTypes) {
|
|
16643
16643
|
for (let i = 0; i < eventTypes.length; i++) {
|
|
16644
|
-
|
|
16644
|
+
const event = activeEventList.indexOf(eventTypes[i]);
|
|
16645
16645
|
if (event !== -1) {
|
|
16646
16646
|
return eventTypes[i];
|
|
16647
16647
|
}
|
|
@@ -16654,7 +16654,7 @@ function findActiveEvent(activeEventList, eventTypes) {
|
|
|
16654
16654
|
function findAllActiveEvents(activeEventList, eventTypes) {
|
|
16655
16655
|
let events = [];
|
|
16656
16656
|
for (let i = 0; i < eventTypes.length; i++) {
|
|
16657
|
-
|
|
16657
|
+
const event = activeEventList.indexOf(eventTypes[i]);
|
|
16658
16658
|
if (event !== -1) {
|
|
16659
16659
|
events.push(eventTypes[i]);
|
|
16660
16660
|
}
|
|
@@ -16724,10 +16724,10 @@ function dispatchEvent(normalizedEvents) {
|
|
|
16724
16724
|
|
|
16725
16725
|
for (let c = candidates.length, candidate; c--, (candidate = candidates[c]);) {
|
|
16726
16726
|
if (eventHandlers.has(candidate) && (candidate.isKinematic !== true)) {
|
|
16727
|
-
|
|
16728
|
-
|
|
16729
|
-
|
|
16730
|
-
|
|
16727
|
+
const handlers = eventHandlers.get(candidate);
|
|
16728
|
+
const region = handlers.region;
|
|
16729
|
+
const ancestor = region.ancestor;
|
|
16730
|
+
const bounds = region.getBounds();
|
|
16731
16731
|
let eventInBounds = false;
|
|
16732
16732
|
|
|
16733
16733
|
if (region.isFloating === true) {
|
|
@@ -16835,7 +16835,7 @@ function normalizeEvent(originalEvent) {
|
|
|
16835
16835
|
if (touchEvent && originalEvent.changedTouches) {
|
|
16836
16836
|
// iOS/Android Touch event
|
|
16837
16837
|
for (let i = 0, l = originalEvent.changedTouches.length; i < l; i++) {
|
|
16838
|
-
|
|
16838
|
+
const touchEvent = originalEvent.changedTouches[i];
|
|
16839
16839
|
_pointer = T_POINTERS.pop();
|
|
16840
16840
|
_pointer.setEvent(
|
|
16841
16841
|
originalEvent,
|
|
@@ -17113,7 +17113,7 @@ function registerPointerEvent(eventType, region, callback) {
|
|
|
17113
17113
|
// allocate array if not defined
|
|
17114
17114
|
let handlers = eventHandlers.get(region);
|
|
17115
17115
|
for (let i = 0; i < eventTypes.length; i++) {
|
|
17116
|
-
eventType = eventTypes[i];
|
|
17116
|
+
const eventType = eventTypes[i];
|
|
17117
17117
|
if (handlers.callbacks[eventType]) {
|
|
17118
17118
|
handlers.callbacks[eventType].push(callback);
|
|
17119
17119
|
} else {
|
|
@@ -17146,7 +17146,7 @@ function releasePointerEvent(eventType, region, callback) {
|
|
|
17146
17146
|
let handlers = eventHandlers.get(region);
|
|
17147
17147
|
if (typeof (handlers) !== "undefined") {
|
|
17148
17148
|
for (let i = 0; i < eventTypes.length; i++) {
|
|
17149
|
-
eventType = eventTypes[i];
|
|
17149
|
+
const eventType = eventTypes[i];
|
|
17150
17150
|
if (handlers.callbacks[eventType]) {
|
|
17151
17151
|
if (typeof (callback) !== "undefined") {
|
|
17152
17152
|
remove(handlers.callbacks[eventType], callback);
|
|
@@ -18012,12 +18012,12 @@ var input = {
|
|
|
18012
18012
|
}
|
|
18013
18013
|
|
|
18014
18014
|
/**
|
|
18015
|
-
* Whether the renderable object is floating, or contained in a floating container
|
|
18015
|
+
* Whether the renderable object is floating (i.e. used screen coordinates), or contained in a floating parent container
|
|
18016
18016
|
* @see Renderable#floating
|
|
18017
18017
|
* @type {boolean}
|
|
18018
18018
|
*/
|
|
18019
18019
|
get isFloating() {
|
|
18020
|
-
return this.floating === true || (typeof this.ancestor !== "undefined" && this.ancestor.
|
|
18020
|
+
return this.floating === true || (typeof this.ancestor !== "undefined" && this.ancestor.isFloating === true);
|
|
18021
18021
|
}
|
|
18022
18022
|
|
|
18023
18023
|
/**
|
|
@@ -18326,11 +18326,8 @@ var input = {
|
|
|
18326
18326
|
}
|
|
18327
18327
|
|
|
18328
18328
|
if (absolute === true) {
|
|
18329
|
-
|
|
18330
|
-
|
|
18331
|
-
bounds.translate(this.ancestor.getAbsolutePosition());
|
|
18332
|
-
}
|
|
18333
|
-
|
|
18329
|
+
var absPos = this.getAbsolutePosition();
|
|
18330
|
+
bounds.centerOn(absPos.x + bounds.x + bounds.width / 2, absPos.y + bounds.y + bounds.height / 2);
|
|
18334
18331
|
}
|
|
18335
18332
|
return bounds;
|
|
18336
18333
|
|
|
@@ -18359,7 +18356,7 @@ var input = {
|
|
|
18359
18356
|
}
|
|
18360
18357
|
// XXX Cache me or something
|
|
18361
18358
|
this._absPos.set(this.pos.x, this.pos.y);
|
|
18362
|
-
if (typeof this.ancestor !== "undefined" && typeof this.ancestor.
|
|
18359
|
+
if (typeof this.ancestor !== "undefined" && typeof this.ancestor.getAbsolutePosition === "function" && this.floating !== true) {
|
|
18363
18360
|
this._absPos.add(this.ancestor.getAbsolutePosition());
|
|
18364
18361
|
}
|
|
18365
18362
|
return this._absPos;
|
|
@@ -19951,7 +19948,7 @@ function parseAttributes(obj, elt) {
|
|
|
19951
19948
|
// do attributes
|
|
19952
19949
|
if (elt.attributes && elt.attributes.length > 0) {
|
|
19953
19950
|
for (let j = 0; j < elt.attributes.length; j++) {
|
|
19954
|
-
|
|
19951
|
+
const attribute = elt.attributes.item(j);
|
|
19955
19952
|
if (typeof(attribute.name) !== "undefined") {
|
|
19956
19953
|
// DOM4 (Attr no longer inherit from Node)
|
|
19957
19954
|
obj[attribute.name] = attribute.value;
|
|
@@ -20150,8 +20147,8 @@ function normalize(obj, item) {
|
|
|
20150
20147
|
var points = parse(item).points.split(" "); // <= "Unexpected lexical declaration in case block" if using let
|
|
20151
20148
|
|
|
20152
20149
|
// And normalize them into an array of vectors
|
|
20153
|
-
for (let i = 0
|
|
20154
|
-
v = points[i].split(",");
|
|
20150
|
+
for (let i = 0; i < points.length; i++) {
|
|
20151
|
+
const v = points[i].split(",");
|
|
20155
20152
|
obj[nodeName].push({
|
|
20156
20153
|
"x" : +v[0],
|
|
20157
20154
|
"y" : +v[1]
|
|
@@ -20930,10 +20927,10 @@ class TMXObject {
|
|
|
20930
20927
|
const cos_rotation = Math.cos(rotation);
|
|
20931
20928
|
const sin_rotation = Math.sin(rotation);
|
|
20932
20929
|
for (let j = 0; j < nr_of_interpolation_points; j++) {
|
|
20933
|
-
|
|
20934
|
-
|
|
20935
|
-
|
|
20936
|
-
|
|
20930
|
+
const _x1 = radiusX * Math.cos(angle);
|
|
20931
|
+
const _y1 = radiusY * Math.sin(angle);
|
|
20932
|
+
const _x2 = x + _x1 * cos_rotation - _y1 * sin_rotation;
|
|
20933
|
+
const _y2 = y + _x1 * sin_rotation + _y1 * cos_rotation;
|
|
20937
20934
|
points.push(pool.pull("Point", _x2, _y2));
|
|
20938
20935
|
angle += direction * dangle;
|
|
20939
20936
|
}
|
|
@@ -22639,9 +22636,8 @@ class TextureCache {
|
|
|
22639
22636
|
this.translate(poly.pos.x, poly.pos.y);
|
|
22640
22637
|
context.beginPath();
|
|
22641
22638
|
context.moveTo(poly.points[0].x, poly.points[0].y);
|
|
22642
|
-
let point;
|
|
22643
22639
|
for (let i = 1; i < poly.points.length; i++) {
|
|
22644
|
-
point = poly.points[i];
|
|
22640
|
+
const point = poly.points[i];
|
|
22645
22641
|
context.lineTo(point.x, point.y);
|
|
22646
22642
|
}
|
|
22647
22643
|
context.lineTo(poly.points[0].x, poly.points[0].y);
|
|
@@ -22936,11 +22932,9 @@ class TextureCache {
|
|
|
22936
22932
|
} else {
|
|
22937
22933
|
// polygon
|
|
22938
22934
|
const _x = mask.pos.x, _y = mask.pos.y;
|
|
22939
|
-
let point;
|
|
22940
|
-
|
|
22941
22935
|
context.moveTo(_x + mask.points[0].x, _y + mask.points[0].y);
|
|
22942
22936
|
for (let i = 1; i < mask.points.length; i++) {
|
|
22943
|
-
point = mask.points[i];
|
|
22937
|
+
const point = mask.points[i];
|
|
22944
22938
|
context.lineTo(_x + point.x, _y + point.y);
|
|
22945
22939
|
}
|
|
22946
22940
|
}
|
|
@@ -23004,7 +22998,7 @@ function setLayerData(layer, bounds, data) {
|
|
|
23004
22998
|
for (let y = 0; y < height; y++) {
|
|
23005
22999
|
for (let x = 0; x < width; x++) {
|
|
23006
23000
|
// get the value of the gid
|
|
23007
|
-
|
|
23001
|
+
const gid = data[idx++];
|
|
23008
23002
|
// fill the array
|
|
23009
23003
|
if (gid !== 0) {
|
|
23010
23004
|
// add a new tile to the layer
|
|
@@ -23023,7 +23017,7 @@ function preRenderLayer(layer, renderer) {
|
|
|
23023
23017
|
for (let y = 0; y < layer.rows; y++) {
|
|
23024
23018
|
for (let x = 0; x < layer.cols; x++) {
|
|
23025
23019
|
// get the value of the gid
|
|
23026
|
-
|
|
23020
|
+
const tile = layer.layerData[x][y];
|
|
23027
23021
|
// draw the tile if defined
|
|
23028
23022
|
if (tile instanceof Tile) {
|
|
23029
23023
|
// add a new tile to the layer
|
|
@@ -23090,7 +23084,7 @@ function preRenderLayer(layer, renderer) {
|
|
|
23090
23084
|
"height" : 0
|
|
23091
23085
|
};
|
|
23092
23086
|
for (let i = 0; i < this.tilesets.length; i++) {
|
|
23093
|
-
|
|
23087
|
+
const tileset = this.tilesets.getTilesetByIndex(i);
|
|
23094
23088
|
this.maxTileSize.width = Math.max(this.maxTileSize.width, tileset.tilewidth);
|
|
23095
23089
|
this.maxTileSize.height = Math.max(this.maxTileSize.height, tileset.tileheight);
|
|
23096
23090
|
}
|
|
@@ -23695,10 +23689,16 @@ let globalFloatingCounter = 0;
|
|
|
23695
23689
|
}
|
|
23696
23690
|
}
|
|
23697
23691
|
|
|
23692
|
+
// add the new child
|
|
23698
23693
|
child.ancestor = this;
|
|
23699
23694
|
this.getChildren().push(child);
|
|
23695
|
+
|
|
23696
|
+
// update child bounds to reflect the new ancestor
|
|
23700
23697
|
if (typeof child.updateBounds === "function") {
|
|
23701
|
-
|
|
23698
|
+
if (this.isFloating === true) {
|
|
23699
|
+
// only parent container can be floating
|
|
23700
|
+
child.floating = false;
|
|
23701
|
+
}
|
|
23702
23702
|
child.updateBounds();
|
|
23703
23703
|
}
|
|
23704
23704
|
|
|
@@ -23719,12 +23719,7 @@ let globalFloatingCounter = 0;
|
|
|
23719
23719
|
child.onActivateEvent();
|
|
23720
23720
|
}
|
|
23721
23721
|
|
|
23722
|
-
// force
|
|
23723
|
-
if (this.isAttachedToRoot() === true) {
|
|
23724
|
-
this.isDirty = true;
|
|
23725
|
-
}
|
|
23726
|
-
|
|
23727
|
-
// force bounds update if required
|
|
23722
|
+
// force container bounds update if required
|
|
23728
23723
|
if (this.enableChildBoundsUpdate === true) {
|
|
23729
23724
|
this.updateBounds();
|
|
23730
23725
|
}
|
|
@@ -23747,6 +23742,9 @@ let globalFloatingCounter = 0;
|
|
|
23747
23742
|
}
|
|
23748
23743
|
}
|
|
23749
23744
|
|
|
23745
|
+
// mark the container for repaint
|
|
23746
|
+
this.isDirty = true;
|
|
23747
|
+
|
|
23750
23748
|
// triggered callback if defined
|
|
23751
23749
|
this.onChildChange.call(this, this.getChildren().length - 1);
|
|
23752
23750
|
|
|
@@ -23773,20 +23771,25 @@ let globalFloatingCounter = 0;
|
|
|
23773
23771
|
child.GUID = utils.createGUID();
|
|
23774
23772
|
}
|
|
23775
23773
|
}
|
|
23776
|
-
child.ancestor = this;
|
|
23777
23774
|
|
|
23775
|
+
// add the new child
|
|
23776
|
+
child.ancestor = this;
|
|
23778
23777
|
this.getChildren().splice(index, 0, child);
|
|
23779
23778
|
|
|
23780
|
-
|
|
23781
|
-
|
|
23779
|
+
// update child bounds to reflect the new ancestor
|
|
23780
|
+
if (typeof child.updateBounds === "function") {
|
|
23781
|
+
if (this.isFloating === true) {
|
|
23782
|
+
// only parent container can be floating
|
|
23783
|
+
child.floating = false;
|
|
23784
|
+
}
|
|
23785
|
+
child.updateBounds();
|
|
23782
23786
|
}
|
|
23783
23787
|
|
|
23784
|
-
|
|
23785
|
-
|
|
23786
|
-
this.isDirty = true;
|
|
23788
|
+
if (typeof child.onActivateEvent === "function" && this.isAttachedToRoot()) {
|
|
23789
|
+
child.onActivateEvent();
|
|
23787
23790
|
}
|
|
23788
23791
|
|
|
23789
|
-
// force bounds update if required
|
|
23792
|
+
// force container bounds update if required
|
|
23790
23793
|
if (this.enableChildBoundsUpdate === true) {
|
|
23791
23794
|
this.updateBounds();
|
|
23792
23795
|
}
|
|
@@ -23809,6 +23812,9 @@ let globalFloatingCounter = 0;
|
|
|
23809
23812
|
}
|
|
23810
23813
|
}
|
|
23811
23814
|
|
|
23815
|
+
// mark the container for repaint
|
|
23816
|
+
this.isDirty = true;
|
|
23817
|
+
|
|
23812
23818
|
// triggered callback if defined
|
|
23813
23819
|
this.onChildChange.call(this, index);
|
|
23814
23820
|
|
|
@@ -24033,10 +24039,9 @@ let globalFloatingCounter = 0;
|
|
|
24033
24039
|
}
|
|
24034
24040
|
|
|
24035
24041
|
/**
|
|
24036
|
-
* update the bounding box for this
|
|
24037
|
-
* @
|
|
24038
|
-
* @
|
|
24039
|
-
* @returns {Bounds} this shape bounding box Rectangle object
|
|
24042
|
+
* update the bounding box for this container.
|
|
24043
|
+
* @param {boolean} [absolute=true] - update the bounds size and position in (world) absolute coordinates
|
|
24044
|
+
* @returns {Bounds} this container bounding box Rectangle object
|
|
24040
24045
|
*/
|
|
24041
24046
|
updateBounds(absolute = true) {
|
|
24042
24047
|
let bounds = this.getBounds();
|
|
@@ -24047,13 +24052,14 @@ let globalFloatingCounter = 0;
|
|
|
24047
24052
|
if (this.enableChildBoundsUpdate === true) {
|
|
24048
24053
|
this.forEach((child) => {
|
|
24049
24054
|
if (child.isRenderable) {
|
|
24050
|
-
let childBounds = child.
|
|
24055
|
+
let childBounds = child.updateBounds(true);
|
|
24051
24056
|
if (childBounds.isFinite()) {
|
|
24052
24057
|
bounds.addBounds(childBounds);
|
|
24053
24058
|
}
|
|
24054
24059
|
}
|
|
24055
24060
|
});
|
|
24056
24061
|
}
|
|
24062
|
+
|
|
24057
24063
|
return bounds;
|
|
24058
24064
|
}
|
|
24059
24065
|
|
|
@@ -24177,16 +24183,14 @@ let globalFloatingCounter = 0;
|
|
|
24177
24183
|
child.ancestor = undefined;
|
|
24178
24184
|
}
|
|
24179
24185
|
|
|
24180
|
-
// force repaint in case this is a static non-animated object
|
|
24181
|
-
if (this.isAttachedToRoot() === true) {
|
|
24182
|
-
this.isDirty = true;
|
|
24183
|
-
}
|
|
24184
|
-
|
|
24185
24186
|
// force bounds update if required
|
|
24186
24187
|
if (this.enableChildBoundsUpdate === true) {
|
|
24187
24188
|
this.updateBounds();
|
|
24188
24189
|
}
|
|
24189
24190
|
|
|
24191
|
+
// mark the container for repaint
|
|
24192
|
+
this.isDirty = true;
|
|
24193
|
+
|
|
24190
24194
|
// triggered callback if defined
|
|
24191
24195
|
this.onChildChange.call(this, childIndex);
|
|
24192
24196
|
}
|
|
@@ -24476,6 +24480,7 @@ let globalFloatingCounter = 0;
|
|
|
24476
24480
|
|
|
24477
24481
|
/* eslint-disable no-unused-vars */
|
|
24478
24482
|
|
|
24483
|
+
|
|
24479
24484
|
/**
|
|
24480
24485
|
* @classdesc
|
|
24481
24486
|
* The map renderer base class
|
|
@@ -25200,7 +25205,7 @@ const offsetsStaggerY = [
|
|
|
25200
25205
|
let nearest = 0;
|
|
25201
25206
|
let minDist = Number.MAX_VALUE;
|
|
25202
25207
|
for (let i = 0; i < 4; ++i) {
|
|
25203
|
-
|
|
25208
|
+
const dc = this.centers[i].sub(rel).length2();
|
|
25204
25209
|
if (dc < minDist) {
|
|
25205
25210
|
minDist = dc;
|
|
25206
25211
|
nearest = i;
|
|
@@ -26672,9 +26677,9 @@ function preloadJavascript(data, onload, onerror) {
|
|
|
26672
26677
|
|
|
26673
26678
|
/**
|
|
26674
26679
|
* onload callback
|
|
26675
|
-
* @name onload
|
|
26676
26680
|
* @default undefined
|
|
26677
26681
|
* @memberof loader
|
|
26682
|
+
* @type {function}
|
|
26678
26683
|
* @example
|
|
26679
26684
|
* // set a callback when everything is loaded
|
|
26680
26685
|
* me.loader.onload = this.loaded.bind(this);
|
|
@@ -26685,9 +26690,9 @@ let onload;
|
|
|
26685
26690
|
* onProgress callback<br>
|
|
26686
26691
|
* each time a resource is loaded, the loader will fire the specified function,
|
|
26687
26692
|
* giving the actual progress [0 ... 1], as argument, and an object describing the resource loaded
|
|
26688
|
-
* @name onProgress
|
|
26689
26693
|
* @default undefined
|
|
26690
26694
|
* @memberof loader
|
|
26695
|
+
* @type {function}
|
|
26691
26696
|
* @example
|
|
26692
26697
|
* // set a callback for progress notification
|
|
26693
26698
|
* me.loader.onProgress = this.updateProgress.bind(this);
|
|
@@ -26756,19 +26761,25 @@ function onLoadingError(res) {
|
|
|
26756
26761
|
}
|
|
26757
26762
|
|
|
26758
26763
|
/**
|
|
26759
|
-
*
|
|
26760
|
-
* @
|
|
26764
|
+
* an asset definition to be used with the loader
|
|
26765
|
+
* @typedef {object} loader.Asset
|
|
26766
|
+
* @property {string} name - name of the asset
|
|
26767
|
+
* @property {string} type - the type of the asset : "audio", binary", "image", "json", "js", "tmx", "tmj", "tsx", "tsj", "fontface"
|
|
26768
|
+
* @property {string} [src] - path and/or file name of the resource (for audio assets only the path is required)
|
|
26769
|
+
* @property {string} [data] - TMX data if not provided through a src url
|
|
26770
|
+
* @property {boolean} [stream] - Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
|
|
26771
|
+
* @see loader.preload
|
|
26772
|
+
* @see loader.load
|
|
26773
|
+
*/
|
|
26774
|
+
|
|
26775
|
+
/**
|
|
26776
|
+
* set all the specified game assets to be preloaded.
|
|
26761
26777
|
* @memberof loader
|
|
26762
|
-
* @
|
|
26763
|
-
* @param {
|
|
26764
|
-
* @param {string} res.name - internal name of the resource
|
|
26765
|
-
* @param {string} res.type - "audio", binary", "image", "json","js", "tmx", "tsx", "fontface"
|
|
26766
|
-
* @param {string} res.src - path and/or file name of the resource (for audio assets only the path is required)
|
|
26767
|
-
* @param {boolean} [res.stream] - Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
|
|
26768
|
-
* @param {Function} [onload=loader.onload] - function to be called when all resources are loaded
|
|
26778
|
+
* @param {loader.Asset[]} assets - list of assets to load
|
|
26779
|
+
* @param {Function} [onloadcb=loader.onload] - function to be called when all resources are loaded
|
|
26769
26780
|
* @param {boolean} [switchToLoadState=true] - automatically switch to the loading screen
|
|
26770
26781
|
* @example
|
|
26771
|
-
*
|
|
26782
|
+
* game.assets = [
|
|
26772
26783
|
* // PNG tileset
|
|
26773
26784
|
* {name: "tileset-platformer", type: "image", src: "data/map/tileset.png"},
|
|
26774
26785
|
* // PNG packed texture
|
|
@@ -26798,15 +26809,15 @@ function onLoadingError(res) {
|
|
|
26798
26809
|
* ];
|
|
26799
26810
|
* ...
|
|
26800
26811
|
* // set all resources to be loaded
|
|
26801
|
-
* me.loader.preload(game.
|
|
26812
|
+
* me.loader.preload(game.assets, () => this.loaded());
|
|
26802
26813
|
*/
|
|
26803
|
-
function preload(
|
|
26814
|
+
function preload(assets, onloadcb, switchToLoadState = true) {
|
|
26804
26815
|
// parse the resources
|
|
26805
|
-
for (let i = 0; i <
|
|
26816
|
+
for (let i = 0; i < assets.length; i++) {
|
|
26806
26817
|
resourceCount += load(
|
|
26807
|
-
|
|
26808
|
-
onResourceLoaded.bind(this,
|
|
26809
|
-
onLoadingError.bind(this,
|
|
26818
|
+
assets[i],
|
|
26819
|
+
onResourceLoaded.bind(this, assets[i]),
|
|
26820
|
+
onLoadingError.bind(this, assets[i])
|
|
26810
26821
|
);
|
|
26811
26822
|
}
|
|
26812
26823
|
// set the onload callback if defined
|
|
@@ -26824,15 +26835,9 @@ function preload(res, onloadcb, switchToLoadState = true) {
|
|
|
26824
26835
|
}
|
|
26825
26836
|
|
|
26826
26837
|
/**
|
|
26827
|
-
* Load a single
|
|
26828
|
-
* @name load
|
|
26838
|
+
* Load a single asset (to be used if you need to load additional asset(s) during the game)
|
|
26829
26839
|
* @memberof loader
|
|
26830
|
-
* @
|
|
26831
|
-
* @param {object} res
|
|
26832
|
-
* @param {string} res.name - internal name of the resource
|
|
26833
|
-
* @param {string} res.type - "audio", binary", "image", "json", "tmx", "tsx"
|
|
26834
|
-
* @param {string} res.src - path and/or file name of the resource (for audio assets only the path is required)
|
|
26835
|
-
* @param {boolean} [res.stream] - Set to true to force HTML5 Audio, which allows not to wait for large file to be downloaded before playing.
|
|
26840
|
+
* @param {loader.Asset} asset
|
|
26836
26841
|
* @param {Function} [onload] - function to be called when the resource is loaded
|
|
26837
26842
|
* @param {Function} [onerror] - function to be called in case of error
|
|
26838
26843
|
* @returns {number} the amount of corresponding resource to be preloaded
|
|
@@ -26850,83 +26855,79 @@ function preload(res, onloadcb, switchToLoadState = true) {
|
|
|
26850
26855
|
* me.audio.play("bgmusic");
|
|
26851
26856
|
* });
|
|
26852
26857
|
*/
|
|
26853
|
-
function load(
|
|
26858
|
+
function load(asset, onload, onerror) {
|
|
26854
26859
|
// transform the url if necessary
|
|
26855
|
-
if (typeof (baseURL[
|
|
26856
|
-
|
|
26860
|
+
if (typeof (baseURL[asset.type]) !== "undefined") {
|
|
26861
|
+
asset.src = baseURL[asset.type] + asset.src;
|
|
26857
26862
|
}
|
|
26858
26863
|
// check ressource type
|
|
26859
|
-
switch (
|
|
26864
|
+
switch (asset.type) {
|
|
26860
26865
|
case "binary":
|
|
26861
26866
|
// reuse the preloadImage fn
|
|
26862
|
-
preloadBinary.call(this,
|
|
26867
|
+
preloadBinary.call(this, asset, onload, onerror);
|
|
26863
26868
|
return 1;
|
|
26864
26869
|
|
|
26865
26870
|
case "image":
|
|
26866
26871
|
// reuse the preloadImage fn
|
|
26867
|
-
preloadImage.call(this,
|
|
26872
|
+
preloadImage.call(this, asset, onload, onerror);
|
|
26868
26873
|
return 1;
|
|
26869
26874
|
|
|
26870
26875
|
case "json":
|
|
26871
|
-
preloadJSON.call(this,
|
|
26876
|
+
preloadJSON.call(this, asset, onload, onerror);
|
|
26872
26877
|
return 1;
|
|
26873
26878
|
|
|
26874
26879
|
case "js":
|
|
26875
|
-
preloadJavascript.call(this,
|
|
26880
|
+
preloadJavascript.call(this, asset, onload, onerror);
|
|
26876
26881
|
return 1;
|
|
26877
26882
|
|
|
26878
26883
|
case "tmx":
|
|
26879
26884
|
case "tsx":
|
|
26880
|
-
preloadTMX.call(this,
|
|
26885
|
+
preloadTMX.call(this, asset, onload, onerror);
|
|
26881
26886
|
return 1;
|
|
26882
26887
|
|
|
26883
26888
|
case "audio":
|
|
26884
|
-
load$1(
|
|
26889
|
+
load$1(asset, !!asset.stream, onload, onerror);
|
|
26885
26890
|
return 1;
|
|
26886
26891
|
|
|
26887
26892
|
case "fontface":
|
|
26888
|
-
preloadFontFace.call(this,
|
|
26893
|
+
preloadFontFace.call(this, asset, onload, onerror);
|
|
26889
26894
|
return 1;
|
|
26890
26895
|
|
|
26891
26896
|
default:
|
|
26892
|
-
throw new Error("load : unknown or invalid resource type : " +
|
|
26897
|
+
throw new Error("load : unknown or invalid resource type : " + asset.type);
|
|
26893
26898
|
}
|
|
26894
26899
|
}
|
|
26895
26900
|
|
|
26896
26901
|
/**
|
|
26897
|
-
* unload specified
|
|
26898
|
-
* @name unload
|
|
26902
|
+
* unload the specified asset to free memory
|
|
26899
26903
|
* @memberof loader
|
|
26900
|
-
* @
|
|
26901
|
-
* @param {object} res
|
|
26902
|
-
* @param {string} res.name - internal name of the resource
|
|
26903
|
-
* @param {string} res.type - "audio", binary", "image", "json", "tmx", "tsx"
|
|
26904
|
+
* @param {loader.Asset} asset
|
|
26904
26905
|
* @returns {boolean} true if unloaded
|
|
26905
26906
|
* @example me.loader.unload({name: "avatar", type:"image"});
|
|
26906
26907
|
*/
|
|
26907
|
-
function unload(
|
|
26908
|
-
switch (
|
|
26908
|
+
function unload(asset) {
|
|
26909
|
+
switch (asset.type) {
|
|
26909
26910
|
case "binary":
|
|
26910
|
-
if (!(
|
|
26911
|
+
if (!(asset.name in binList)) {
|
|
26911
26912
|
return false;
|
|
26912
26913
|
}
|
|
26913
26914
|
|
|
26914
|
-
delete binList[
|
|
26915
|
+
delete binList[asset.name];
|
|
26915
26916
|
return true;
|
|
26916
26917
|
|
|
26917
26918
|
case "image":
|
|
26918
|
-
if (!(
|
|
26919
|
+
if (!(asset.name in imgList)) {
|
|
26919
26920
|
return false;
|
|
26920
26921
|
}
|
|
26921
|
-
delete imgList[
|
|
26922
|
+
delete imgList[asset.name];
|
|
26922
26923
|
return true;
|
|
26923
26924
|
|
|
26924
26925
|
case "json":
|
|
26925
|
-
if (!(
|
|
26926
|
+
if (!(asset.name in jsonList)) {
|
|
26926
26927
|
return false;
|
|
26927
26928
|
}
|
|
26928
26929
|
|
|
26929
|
-
delete jsonList[
|
|
26930
|
+
delete jsonList[asset.name];
|
|
26930
26931
|
return true;
|
|
26931
26932
|
|
|
26932
26933
|
case "js":
|
|
@@ -26939,26 +26940,24 @@ function unload(res) {
|
|
|
26939
26940
|
|
|
26940
26941
|
case "tmx":
|
|
26941
26942
|
case "tsx":
|
|
26942
|
-
if (!(
|
|
26943
|
+
if (!(asset.name in tmxList)) {
|
|
26943
26944
|
return false;
|
|
26944
26945
|
}
|
|
26945
26946
|
|
|
26946
|
-
delete tmxList[
|
|
26947
|
+
delete tmxList[asset.name];
|
|
26947
26948
|
return true;
|
|
26948
26949
|
|
|
26949
26950
|
case "audio":
|
|
26950
|
-
return unload$1(
|
|
26951
|
+
return unload$1(asset.name);
|
|
26951
26952
|
|
|
26952
26953
|
default:
|
|
26953
|
-
throw new Error("unload : unknown or invalid resource type : " +
|
|
26954
|
+
throw new Error("unload : unknown or invalid resource type : " + asset.type);
|
|
26954
26955
|
}
|
|
26955
26956
|
}
|
|
26956
26957
|
|
|
26957
26958
|
/**
|
|
26958
26959
|
* unload all resources to free memory
|
|
26959
|
-
* @name unloadAll
|
|
26960
26960
|
* @memberof loader
|
|
26961
|
-
* @public
|
|
26962
26961
|
* @example me.loader.unloadAll();
|
|
26963
26962
|
*/
|
|
26964
26963
|
function unloadAll() {
|
|
@@ -27010,9 +27009,7 @@ function unloadAll() {
|
|
|
27010
27009
|
|
|
27011
27010
|
/**
|
|
27012
27011
|
* return the specified TMX/TSX object
|
|
27013
|
-
* @name getTMX
|
|
27014
27012
|
* @memberof loader
|
|
27015
|
-
* @public
|
|
27016
27013
|
* @param {string} elt - name of the tmx/tsx element ("map1");
|
|
27017
27014
|
* @returns {object} requested element or null if not found
|
|
27018
27015
|
*/
|
|
@@ -27027,9 +27024,7 @@ function getTMX(elt) {
|
|
|
27027
27024
|
|
|
27028
27025
|
/**
|
|
27029
27026
|
* return the specified Binary object
|
|
27030
|
-
* @name getBinary
|
|
27031
27027
|
* @memberof loader
|
|
27032
|
-
* @public
|
|
27033
27028
|
* @param {string} elt - name of the binary object ("ymTrack");
|
|
27034
27029
|
* @returns {object} requested element or null if not found
|
|
27035
27030
|
*/
|
|
@@ -27044,9 +27039,7 @@ function getBinary(elt) {
|
|
|
27044
27039
|
|
|
27045
27040
|
/**
|
|
27046
27041
|
* return the specified Image Object
|
|
27047
|
-
* @name getImage
|
|
27048
27042
|
* @memberof loader
|
|
27049
|
-
* @public
|
|
27050
27043
|
* @param {string} image - name of the Image element ("tileset-platformer");
|
|
27051
27044
|
* @returns {HTMLImageElement} requested element or null if not found
|
|
27052
27045
|
*/
|
|
@@ -27062,9 +27055,7 @@ function getImage(image) {
|
|
|
27062
27055
|
|
|
27063
27056
|
/**
|
|
27064
27057
|
* return the specified JSON Object
|
|
27065
|
-
* @name getJSON
|
|
27066
27058
|
* @memberof loader
|
|
27067
|
-
* @public
|
|
27068
27059
|
* @param {string} elt - name of the json file to load
|
|
27069
27060
|
* @returns {object}
|
|
27070
27061
|
*/
|
|
@@ -32362,7 +32353,7 @@ class CanvasTexture {
|
|
|
32362
32353
|
* the rendering context of this CanvasTexture
|
|
32363
32354
|
* @type {CanvasRenderingContext2D}
|
|
32364
32355
|
*/
|
|
32365
|
-
this.context = this.canvas.getContext(
|
|
32356
|
+
this.context = this.canvas.getContext(attributes.context, { willReadFrequently: attributes.willReadFrequently });
|
|
32366
32357
|
|
|
32367
32358
|
// enable or disable antiAlias if specified
|
|
32368
32359
|
this.setAntiAlias(attributes.antiAlias);
|
|
@@ -33196,7 +33187,7 @@ class CanvasTexture {
|
|
|
33196
33187
|
|
|
33197
33188
|
/**
|
|
33198
33189
|
* UI base elements use screen coordinates by default
|
|
33199
|
-
* (Note: any child elements added to a UIBaseElement should
|
|
33190
|
+
* (Note: any child elements added to a UIBaseElement should have their floating property to false)
|
|
33200
33191
|
* @see Renderable.floating
|
|
33201
33192
|
* @type {boolean}
|
|
33202
33193
|
* @default true
|
|
@@ -33208,6 +33199,9 @@ class CanvasTexture {
|
|
|
33208
33199
|
|
|
33209
33200
|
// enable event detection
|
|
33210
33201
|
this.isKinematic = false;
|
|
33202
|
+
|
|
33203
|
+
// update container and children bounds automatically
|
|
33204
|
+
this.enableChildBoundsUpdate = true;
|
|
33211
33205
|
}
|
|
33212
33206
|
|
|
33213
33207
|
/**
|
|
@@ -33242,7 +33236,7 @@ class CanvasTexture {
|
|
|
33242
33236
|
* @returns {boolean} return false if we need to stop propagating the event
|
|
33243
33237
|
*/
|
|
33244
33238
|
onClick(event) { // eslint-disable-line no-unused-vars
|
|
33245
|
-
return
|
|
33239
|
+
return true;
|
|
33246
33240
|
}
|
|
33247
33241
|
|
|
33248
33242
|
/**
|
|
@@ -33335,7 +33329,7 @@ class CanvasTexture {
|
|
|
33335
33329
|
* @returns {boolean} return false if we need to stop propagating the event
|
|
33336
33330
|
*/
|
|
33337
33331
|
onRelease() {
|
|
33338
|
-
return
|
|
33332
|
+
return true;
|
|
33339
33333
|
}
|
|
33340
33334
|
|
|
33341
33335
|
/**
|
|
@@ -33786,7 +33780,7 @@ const toPX = [12, 24, 0.75, 1];
|
|
|
33786
33780
|
setContextStyle(context, this);
|
|
33787
33781
|
|
|
33788
33782
|
for (let i = 0; i < text.length; i++) {
|
|
33789
|
-
|
|
33783
|
+
const string = text[i].trimEnd();
|
|
33790
33784
|
// draw the string
|
|
33791
33785
|
if (this.fillStyle.alpha > 0) {
|
|
33792
33786
|
context.fillText(string, x, y);
|
|
@@ -34215,7 +34209,7 @@ const toPX = [12, 24, 0.75, 1];
|
|
|
34215
34209
|
}
|
|
34216
34210
|
|
|
34217
34211
|
if (absolute === true) {
|
|
34218
|
-
if (typeof this.ancestor !== "undefined" && typeof this.ancestor.
|
|
34212
|
+
if (typeof this.ancestor !== "undefined" && typeof this.ancestor.getAbsolutePosition === "function" && this.floating !== true) {
|
|
34219
34213
|
bounds.translate(this.ancestor.getAbsolutePosition());
|
|
34220
34214
|
}
|
|
34221
34215
|
}
|
|
@@ -34294,7 +34288,7 @@ const toPX = [12, 24, 0.75, 1];
|
|
|
34294
34288
|
|
|
34295
34289
|
for (let i = 0; i < this._text.length; i++) {
|
|
34296
34290
|
x = lX;
|
|
34297
|
-
|
|
34291
|
+
const string = this._text[i].trimEnd();
|
|
34298
34292
|
// adjust x pos based on alignment value
|
|
34299
34293
|
let stringWidth = this.metrics.lineWidth(string);
|
|
34300
34294
|
switch (this.textAlign) {
|
|
@@ -34604,7 +34598,13 @@ const toPX = [12, 24, 0.75, 1];
|
|
|
34604
34598
|
this.holdTimeout = -1;
|
|
34605
34599
|
this.released = true;
|
|
34606
34600
|
|
|
34607
|
-
|
|
34601
|
+
/**
|
|
34602
|
+
* if this UISpriteElement should use screen coordinates or local coordinates
|
|
34603
|
+
* (Note: any UISpriteElement elements added to a floating parent container should have their floating property to false)
|
|
34604
|
+
* @see Renderable.floating
|
|
34605
|
+
* @type {boolean}
|
|
34606
|
+
* @default true
|
|
34607
|
+
*/
|
|
34608
34608
|
this.floating = true;
|
|
34609
34609
|
|
|
34610
34610
|
// enable event detection
|
|
@@ -35542,6 +35542,7 @@ class DropTarget extends Renderable {
|
|
|
35542
35542
|
* Available under the MIT License - https://github.com/jriecken/sat-js
|
|
35543
35543
|
*/
|
|
35544
35544
|
|
|
35545
|
+
|
|
35545
35546
|
/**
|
|
35546
35547
|
* Constants for Vornoi regions
|
|
35547
35548
|
* @ignore
|
|
@@ -35595,7 +35596,7 @@ function flattenPointsOn(points, normal, result) {
|
|
|
35595
35596
|
let len = points.length;
|
|
35596
35597
|
for (let i = 0; i < len; i++) {
|
|
35597
35598
|
// The magnitude of the projection of the point onto the normal
|
|
35598
|
-
|
|
35599
|
+
const dot = points[i].dot(normal);
|
|
35599
35600
|
if (dot < min) { min = dot; }
|
|
35600
35601
|
if (dot > max) { max = dot; }
|
|
35601
35602
|
}
|
|
@@ -35842,8 +35843,8 @@ function testPolygonEllipse(a, polyA, b, ellipseB, response) {
|
|
|
35842
35843
|
|
|
35843
35844
|
// For each edge in the polygon:
|
|
35844
35845
|
for (let i = 0; i < len; i++) {
|
|
35845
|
-
|
|
35846
|
-
|
|
35846
|
+
const next = i === len - 1 ? 0 : i + 1;
|
|
35847
|
+
const prev = i === 0 ? len - 1 : i - 1;
|
|
35847
35848
|
let overlap = 0;
|
|
35848
35849
|
let overlapN = null;
|
|
35849
35850
|
|
|
@@ -36232,7 +36233,7 @@ class Detector {
|
|
|
36232
36233
|
if (objB.body && line.getBounds().overlaps(objB.getBounds())) {
|
|
36233
36234
|
|
|
36234
36235
|
// go trough all defined shapes in B (if any)
|
|
36235
|
-
|
|
36236
|
+
const bLen = objB.body.shapes.length;
|
|
36236
36237
|
if ( objB.body.shapes.length === 0) {
|
|
36237
36238
|
continue;
|
|
36238
36239
|
}
|
|
@@ -37363,11 +37364,8 @@ function createDefaultParticleTexture(w = 8, h = 8) {
|
|
|
37363
37364
|
}
|
|
37364
37365
|
|
|
37365
37366
|
if (absolute === true) {
|
|
37366
|
-
|
|
37367
|
-
|
|
37368
|
-
bounds.translate(this.ancestor.getAbsolutePosition());
|
|
37369
|
-
}
|
|
37370
|
-
|
|
37367
|
+
var absPos = this.getAbsolutePosition();
|
|
37368
|
+
bounds.centerOn(absPos.x + bounds.x + bounds.width / 2, absPos.y + bounds.y + bounds.height / 2);
|
|
37371
37369
|
}
|
|
37372
37370
|
|
|
37373
37371
|
return bounds;
|
|
@@ -38007,10 +38005,10 @@ class BasePlugin {
|
|
|
38007
38005
|
* this can be overridden by the plugin
|
|
38008
38006
|
* @public
|
|
38009
38007
|
* @type {string}
|
|
38010
|
-
* @default "15.1.
|
|
38008
|
+
* @default "15.1.5"
|
|
38011
38009
|
* @name plugin.Base#version
|
|
38012
38010
|
*/
|
|
38013
|
-
this.version = "15.1.
|
|
38011
|
+
this.version = "15.1.5";
|
|
38014
38012
|
}
|
|
38015
38013
|
}
|
|
38016
38014
|
|
|
@@ -38238,7 +38236,7 @@ Renderer.prototype.getScreenContext = function() {
|
|
|
38238
38236
|
* @name version
|
|
38239
38237
|
* @type {string}
|
|
38240
38238
|
*/
|
|
38241
|
-
const version = "15.1.
|
|
38239
|
+
const version = "15.1.5";
|
|
38242
38240
|
|
|
38243
38241
|
/**
|
|
38244
38242
|
* a flag indicating that melonJS is fully initialized
|