melonjs 17.1.0 → 17.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
- package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
- package/dist/melonjs.mjs/_virtual/howler.js +1 -1
- package/dist/melonjs.mjs/_virtual/index.js +1 -1
- package/dist/melonjs.mjs/_virtual/re.js +1 -1
- package/dist/melonjs.mjs/application/application.js +2 -2
- package/dist/melonjs.mjs/application/header.js +2 -2
- 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 +13 -9
- package/dist/melonjs.mjs/camera/camera2d.js +1 -1
- package/dist/melonjs.mjs/const.js +1 -1
- 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 +17 -17
- package/dist/melonjs.mjs/geometries/point.js +1 -1
- package/dist/melonjs.mjs/geometries/poly.js +1 -1
- package/dist/melonjs.mjs/geometries/rectangle.js +1 -1
- package/dist/melonjs.mjs/geometries/roundrect.js +1 -1
- package/dist/melonjs.mjs/geometries/toarccanvas.js +4 -6
- package/dist/melonjs.mjs/index.js +4 -4
- 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/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 +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXObject.js +2 -2
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +2 -2
- 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 +3 -3
- package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +5 -5
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +3 -3
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +1 -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 +5 -2
- package/dist/melonjs.mjs/loader/loader.js +34 -5
- package/dist/melonjs.mjs/loader/loadingscreen.js +2 -4
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/binary.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/compressed_textures/compressed_image.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/compressed_textures/parseDDS.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/compressed_textures/parseKTX.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/compressed_textures/parseKTX2.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/compressed_textures/parsePKM.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/compressed_textures/parsePVR.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/fetchdata.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/fontface.js +25 -15
- package/dist/melonjs.mjs/loader/parsers/image.js +3 -3
- package/dist/melonjs.mjs/loader/parsers/json.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/script.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/tmx.js +1 -1
- package/dist/melonjs.mjs/loader/parsers/video.js +1 -1
- package/dist/melonjs.mjs/math/color.js +6 -6
- package/dist/melonjs.mjs/math/math.js +1 -1
- package/dist/melonjs.mjs/math/matrix2.js +7 -7
- package/dist/melonjs.mjs/math/matrix3.js +2 -2
- package/dist/melonjs.mjs/math/observable_vector2.js +3 -3
- package/dist/melonjs.mjs/math/observable_vector3.js +4 -4
- package/dist/melonjs.mjs/math/vector2.js +3 -3
- package/dist/melonjs.mjs/math/vector3.js +4 -4
- 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/node_modules/semver/classes/comparator.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/classes/range.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/classes/semver.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/clean.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/cmp.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/coerce.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/compare-build.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/compare-loose.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/compare.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/diff.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/eq.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/gt.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/gte.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/inc.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/lt.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/lte.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/major.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/minor.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/neq.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/parse.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/patch.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/prerelease.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/rcompare.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/rsort.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/satisfies.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/sort.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/functions/valid.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/internal/constants.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/internal/debug.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/internal/identifiers.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/internal/parse-options.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/internal/re.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/node_modules/lru-cache/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/node_modules/yallist/iterator.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/node_modules/yallist/yallist.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/gtr.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/intersects.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/ltr.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/max-satisfying.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/min-satisfying.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/min-version.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/outside.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/simplify.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/subset.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/to-comparators.js +1 -1
- package/dist/melonjs.mjs/node_modules/semver/ranges/valid.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 +4 -4
- package/dist/melonjs.mjs/physics/bounds.js +1 -1
- 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 +1 -1
- 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 +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 +2 -2
- package/dist/melonjs.mjs/renderable/draggable.js +1 -1
- package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
- package/dist/melonjs.mjs/renderable/entity/entity.js +1 -1
- package/dist/melonjs.mjs/renderable/imagelayer.js +1 -1
- package/dist/melonjs.mjs/renderable/light2d.js +7 -7
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +1 -1
- package/dist/melonjs.mjs/renderable/renderable.js +1 -1
- package/dist/melonjs.mjs/renderable/sprite.js +1 -1
- package/dist/melonjs.mjs/renderable/text/bitmaptext.js +1 -1
- package/dist/melonjs.mjs/renderable/text/bitmaptextdata.js +1 -1
- package/dist/melonjs.mjs/renderable/text/glyph.js +1 -1
- package/dist/melonjs.mjs/renderable/text/text.js +1 -1
- package/dist/melonjs.mjs/renderable/text/textmetrics.js +1 -1
- package/dist/melonjs.mjs/renderable/text/textstyle.js +1 -1
- package/dist/melonjs.mjs/renderable/trigger.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uispriteelement.js +1 -1
- 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 +5 -5
- package/dist/melonjs.mjs/system/device.js +6 -6
- 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 +4 -2
- package/dist/melonjs.mjs/system/pooling.js +2 -2
- package/dist/melonjs.mjs/system/save.js +2 -2
- package/dist/melonjs.mjs/system/timer.js +2 -2
- package/dist/melonjs.mjs/tweens/easing.js +68 -70
- package/dist/melonjs.mjs/tweens/interpolation.js +29 -29
- package/dist/melonjs.mjs/tweens/tween.js +43 -43
- 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 +6 -5
- package/dist/melonjs.mjs/video/renderer.js +17 -69
- package/dist/melonjs.mjs/video/rendertarget/canvasrendertarget.js +12 -6
- 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/parser/aseprite.js +1 -1
- package/dist/melonjs.mjs/video/texture/parser/spritesheet.js +1 -1
- package/dist/melonjs.mjs/video/texture/parser/texturepacker.js +1 -1
- package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
- package/dist/melonjs.mjs/video/video.js +1 -1
- 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 +5 -5
- 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 +8 -7
- package/dist/melonjs.module.js +358 -369
- package/dist/types/audio/audio.d.ts +8 -4
- package/dist/types/loader/cache.d.ts +1 -0
- package/dist/types/loader/loader.d.ts +7 -0
- package/dist/types/system/platform.d.ts +2 -0
- package/dist/types/video/renderer.d.ts +5 -15
- package/dist/types/video/rendertarget/canvasrendertarget.d.ts +6 -9
- package/package.json +13 -13
- package/src/application/application.js +1 -1
- package/src/application/header.js +1 -1
- package/src/audio/audio.js +12 -8
- package/src/geometries/path2d.js +16 -16
- package/src/index.js +2 -2
- package/src/level/tiled/TMXObject.js +1 -1
- package/src/level/tiled/TMXTileMap.js +1 -1
- package/src/level/tiled/TMXUtils.js +2 -2
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +4 -4
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +2 -2
- package/src/loader/cache.js +3 -0
- package/src/loader/loader.js +33 -3
- package/src/loader/parsers/fontface.js +24 -14
- package/src/loader/parsers/image.js +2 -2
- package/src/math/color.js +5 -5
- package/src/math/matrix2.js +6 -6
- package/src/math/matrix3.js +1 -1
- package/src/math/observable_vector2.js +2 -2
- package/src/math/observable_vector3.js +3 -3
- package/src/math/vector2.js +2 -2
- package/src/math/vector3.js +3 -3
- package/src/physics/body.js +3 -3
- package/src/physics/detector.js +1 -1
- package/src/renderable/container.js +1 -1
- package/src/renderable/light2d.js +6 -6
- package/src/state/state.js +4 -4
- package/src/system/device.js +5 -5
- package/src/system/platform.js +2 -0
- package/src/system/pooling.js +1 -1
- package/src/system/save.js +1 -1
- package/src/system/timer.js +1 -1
- package/src/tweens/easing.js +67 -69
- package/src/tweens/interpolation.js +28 -28
- package/src/tweens/tween.js +42 -42
- package/src/video/canvas/canvas_renderer.js +5 -4
- package/src/video/renderer.js +16 -68
- package/src/video/rendertarget/canvasrendertarget.js +11 -5
- package/src/video/webgl/utils/precision.js +4 -4
- package/src/video/webgl/webgl_renderer.js +7 -6
package/dist/melonjs.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v17.
|
|
2
|
+
* melonJS Game Engine - v17.2.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -446,10 +446,10 @@ var SHARED = '__core-js_shared__';
|
|
|
446
446
|
var store$3 = sharedStore$2.exports = globalThis$3[SHARED] || defineGlobalProperty$2(SHARED, {});
|
|
447
447
|
|
|
448
448
|
(store$3.versions || (store$3.versions = [])).push({
|
|
449
|
-
version: '3.
|
|
449
|
+
version: '3.37.0',
|
|
450
450
|
mode: IS_PURE ? 'pure' : 'global',
|
|
451
451
|
copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
|
|
452
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
452
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.37.0/LICENSE',
|
|
453
453
|
source: 'https://github.com/zloirock/core-js'
|
|
454
454
|
});
|
|
455
455
|
|
|
@@ -2731,7 +2731,7 @@ class ObjectPool {
|
|
|
2731
2731
|
*/
|
|
2732
2732
|
push(obj, throwOnError = true) {
|
|
2733
2733
|
if (!this.poolable(obj)) {
|
|
2734
|
-
if (throwOnError === true
|
|
2734
|
+
if (throwOnError === true) {
|
|
2735
2735
|
throw new Error("me.pool: object " + obj + " cannot be recycled");
|
|
2736
2736
|
} else {
|
|
2737
2737
|
return false;
|
|
@@ -2795,9 +2795,9 @@ function toHex$1(component) {
|
|
|
2795
2795
|
function hue2rgb(p, q, t) {
|
|
2796
2796
|
if (t < 0) t += 1;
|
|
2797
2797
|
if (t > 1) t -= 1;
|
|
2798
|
-
if (t < 1/6) return p + (q - p) * 6 * t;
|
|
2799
|
-
if (t < 1/2) return q;
|
|
2800
|
-
if (t < 2/3) return p + (q - p) * (2/3 - t) * 6;
|
|
2798
|
+
if (t < 1 / 6) return p + (q - p) * 6 * t;
|
|
2799
|
+
if (t < 1 / 2) return q;
|
|
2800
|
+
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
|
|
2801
2801
|
return p;
|
|
2802
2802
|
}
|
|
2803
2803
|
|
|
@@ -3116,9 +3116,9 @@ class Color {
|
|
|
3116
3116
|
let q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
3117
3117
|
let p = 2 * l - q;
|
|
3118
3118
|
|
|
3119
|
-
r = hue2rgb(p, q, h + 1/3);
|
|
3119
|
+
r = hue2rgb(p, q, h + 1 / 3);
|
|
3120
3120
|
g = hue2rgb(p, q, h);
|
|
3121
|
-
b = hue2rgb(p, q, h - 1/3);
|
|
3121
|
+
b = hue2rgb(p, q, h - 1 / 3);
|
|
3122
3122
|
}
|
|
3123
3123
|
|
|
3124
3124
|
return this.setColor(r * 255, g * 255, b * 255);
|
|
@@ -3748,8 +3748,8 @@ class Vector2d {
|
|
|
3748
3748
|
* @returns {Vector2d} Reference to this object for method chaining
|
|
3749
3749
|
*/
|
|
3750
3750
|
lerp(v, alpha) {
|
|
3751
|
-
this.x += (
|
|
3752
|
-
this.y += (
|
|
3751
|
+
this.x += (v.x - this.x) * alpha;
|
|
3752
|
+
this.y += (v.y - this.y) * alpha;
|
|
3753
3753
|
return this;
|
|
3754
3754
|
}
|
|
3755
3755
|
|
|
@@ -4197,9 +4197,9 @@ class Vector3d {
|
|
|
4197
4197
|
* @returns {Vector3d} Reference to this object for method chaining
|
|
4198
4198
|
*/
|
|
4199
4199
|
lerp(v, alpha) {
|
|
4200
|
-
this.x += (
|
|
4201
|
-
this.y += (
|
|
4202
|
-
this.z += (
|
|
4200
|
+
this.x += (v.x - this.x) * alpha;
|
|
4201
|
+
this.y += (v.y - this.y) * alpha;
|
|
4202
|
+
this.z += (v.z - this.z) * alpha;
|
|
4203
4203
|
return this;
|
|
4204
4204
|
}
|
|
4205
4205
|
|
|
@@ -4672,8 +4672,8 @@ class ObservableVector2d extends Vector2d {
|
|
|
4672
4672
|
*/
|
|
4673
4673
|
lerp(v, alpha) {
|
|
4674
4674
|
return this._set(
|
|
4675
|
-
this._x + (
|
|
4676
|
-
this._y + (
|
|
4675
|
+
this._x + (v.x - this._x) * alpha,
|
|
4676
|
+
this._y + (v.y - this._y) * alpha
|
|
4677
4677
|
);
|
|
4678
4678
|
}
|
|
4679
4679
|
|
|
@@ -5205,9 +5205,9 @@ class ObservableVector3d extends Vector3d {
|
|
|
5205
5205
|
*/
|
|
5206
5206
|
lerp(v, alpha) {
|
|
5207
5207
|
return this._set(
|
|
5208
|
-
this._x + (
|
|
5209
|
-
this._y + (
|
|
5210
|
-
this._z + (
|
|
5208
|
+
this._x + (v.x - this._x) * alpha,
|
|
5209
|
+
this._y + (v.y - this._y) * alpha,
|
|
5210
|
+
this._z + (v.z - this._z) * alpha
|
|
5211
5211
|
);
|
|
5212
5212
|
}
|
|
5213
5213
|
|
|
@@ -5538,16 +5538,16 @@ class Matrix2d {
|
|
|
5538
5538
|
let n = a * ta + b * td + c * tg;
|
|
5539
5539
|
|
|
5540
5540
|
val[ 0 ] = ta / n;
|
|
5541
|
-
val[ 1 ] = (
|
|
5542
|
-
val[ 2 ] = (
|
|
5541
|
+
val[ 1 ] = (c * h - i * b) / n;
|
|
5542
|
+
val[ 2 ] = (f * b - c * e) / n;
|
|
5543
5543
|
|
|
5544
5544
|
val[ 3 ] = td / n;
|
|
5545
|
-
val[ 4 ] = (
|
|
5546
|
-
val[ 5 ] = (
|
|
5545
|
+
val[ 4 ] = (i * a - c * g) / n;
|
|
5546
|
+
val[ 5 ] = (c * d - f * a) / n;
|
|
5547
5547
|
|
|
5548
5548
|
val[ 6 ] = tg / n;
|
|
5549
|
-
val[ 7 ] = (
|
|
5550
|
-
val[ 8 ] = (
|
|
5549
|
+
val[ 7 ] = (b * g - h * a) / n;
|
|
5550
|
+
val[ 8 ] = (e * a - b * d) / n;
|
|
5551
5551
|
|
|
5552
5552
|
return this;
|
|
5553
5553
|
}
|
|
@@ -6267,7 +6267,7 @@ class Matrix3d {
|
|
|
6267
6267
|
let a = this.val;
|
|
6268
6268
|
let _x, _y, _z;
|
|
6269
6269
|
|
|
6270
|
-
if (arguments.length > 1
|
|
6270
|
+
if (arguments.length > 1) {
|
|
6271
6271
|
// x, y (, z)
|
|
6272
6272
|
_x = arguments[0];
|
|
6273
6273
|
_y = arguments[1];
|
|
@@ -14006,14 +14006,15 @@ function rate(sound_name, ...args) {
|
|
|
14006
14006
|
* @memberof audio
|
|
14007
14007
|
* @param {string} sound_name - audio clip name - case sensitive
|
|
14008
14008
|
* @param {number} [pan] - the panning value - A value of -1.0 is all the way left and 1.0 is all the way right.
|
|
14009
|
+
* @param {number} [id] - the sound instance ID. If none is passed, all sounds in group will be changed.
|
|
14009
14010
|
* @return {number} the current panning value
|
|
14010
14011
|
* @example
|
|
14011
14012
|
* me.audio.stereo("cling", -1);
|
|
14012
14013
|
*/
|
|
14013
|
-
function stereo(sound_name, pan) {
|
|
14014
|
+
function stereo(sound_name, pan, id) {
|
|
14014
14015
|
let sound = audioTracks[sound_name];
|
|
14015
14016
|
if (sound && typeof sound !== "undefined") {
|
|
14016
|
-
return sound.stereo(pan);
|
|
14017
|
+
return sound.stereo(pan, id);
|
|
14017
14018
|
} else {
|
|
14018
14019
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14019
14020
|
}
|
|
@@ -14026,12 +14027,13 @@ function stereo(sound_name, pan) {
|
|
|
14026
14027
|
* @param {Number} x - the x-position of the audio source.
|
|
14027
14028
|
* @param {Number} y - the y-position of the audio source.
|
|
14028
14029
|
* @param {Number} z - the z-position of the audio source.
|
|
14030
|
+
* @param {number} [id] - the sound instance ID. If none is passed, all sounds in group will be changed.
|
|
14029
14031
|
* @return {Array} the current 3D spatial position: [x, y, z]
|
|
14030
14032
|
*/
|
|
14031
|
-
function position(sound_name, x, y, z) {
|
|
14033
|
+
function position(sound_name, x, y, z, id) {
|
|
14032
14034
|
let sound = audioTracks[sound_name];
|
|
14033
14035
|
if (sound && typeof sound !== "undefined") {
|
|
14034
|
-
return sound.pos(x, y, z);
|
|
14036
|
+
return sound.pos(x, y, z, id);
|
|
14035
14037
|
} else {
|
|
14036
14038
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14037
14039
|
}
|
|
@@ -14045,12 +14047,13 @@ function position(sound_name, x, y, z) {
|
|
|
14045
14047
|
* @param {Number} x - the x-orientation of the audio source.
|
|
14046
14048
|
* @param {Number} y - the y-orientation of the audio source.
|
|
14047
14049
|
* @param {Number} z - the z-orientation of the audio source.
|
|
14050
|
+
* @param {number} [id] - the sound instance ID. If none is passed, all sounds in group will be changed.
|
|
14048
14051
|
* @return {Array} the current 3D spatial orientation: [x, y, z]
|
|
14049
14052
|
*/
|
|
14050
|
-
function orientation(sound_name, x, y, z) {
|
|
14053
|
+
function orientation(sound_name, x, y, z, id) {
|
|
14051
14054
|
let sound = audioTracks[sound_name];
|
|
14052
14055
|
if (sound && typeof sound !== "undefined") {
|
|
14053
|
-
return sound.orientation(x, y, z);
|
|
14056
|
+
return sound.orientation(x, y, z, id);
|
|
14054
14057
|
} else {
|
|
14055
14058
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14056
14059
|
}
|
|
@@ -14070,6 +14073,7 @@ function orientation(sound_name, x, y, z) {
|
|
|
14070
14073
|
* @param {string} [settings.refDistance=1] - A reference distance for reducing volume as source moves further from the listener. This is simply a variable of the distance model and has a different effect depending on which model is used and the scale of your coordinates. Generally, volume will be equal to 1 at this distance.
|
|
14071
14074
|
* @param {string} [settings.rolloffFactor=1] - How quickly the volume reduces as source moves from listener. This is simply a variable of the distance model and can be in the range of `[0, 1]` with `linear` and `[0, ∞]` with `inverse` and `exponential`.
|
|
14072
14075
|
* @param {string} [settings.panningModel="HRTF"] - Determines which spatialization algorithm is used to position audio. Can be `HRTF` or `equalpower`.
|
|
14076
|
+
* @param {number} [id] - the sound instance ID. If none is passed, all sounds in group will be changed.
|
|
14073
14077
|
* @return {Object} current panner attributes.
|
|
14074
14078
|
* @example
|
|
14075
14079
|
* me.audio.panner("cling", {
|
|
@@ -14079,10 +14083,10 @@ function orientation(sound_name, x, y, z) {
|
|
|
14079
14083
|
* distanceModel: 'exponential'
|
|
14080
14084
|
* });
|
|
14081
14085
|
*/
|
|
14082
|
-
function panner(sound_name, attributes) {
|
|
14086
|
+
function panner(sound_name, attributes, id) {
|
|
14083
14087
|
let sound = audioTracks[sound_name];
|
|
14084
14088
|
if (sound && typeof sound !== "undefined") {
|
|
14085
|
-
return sound.pannerAttr(attributes);
|
|
14089
|
+
return sound.pannerAttr(attributes, id);
|
|
14086
14090
|
} else {
|
|
14087
14091
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14088
14092
|
}
|
|
@@ -14409,7 +14413,7 @@ let hasLocalStorage$1 = false;
|
|
|
14409
14413
|
try {
|
|
14410
14414
|
// true if localStorage is supported
|
|
14411
14415
|
hasLocalStorage$1 = typeof globalThis !== "undefined" && typeof globalThis.localStorage !== "undefined";
|
|
14412
|
-
} catch
|
|
14416
|
+
} catch {
|
|
14413
14417
|
// the above generates an exception when cookies are blocked
|
|
14414
14418
|
hasLocalStorage$1 = false;
|
|
14415
14419
|
}
|
|
@@ -14605,6 +14609,7 @@ var agent$1 = {
|
|
|
14605
14609
|
* @property {boolean} isWeixin `true` if running under Wechat
|
|
14606
14610
|
* @property {boolean} nodeJS `true` if running under node.js
|
|
14607
14611
|
* @property {boolean} isMobile `true` if a mobile device
|
|
14612
|
+
* @property {boolean} webApp `true` if running as a standalone web app
|
|
14608
14613
|
*/
|
|
14609
14614
|
|
|
14610
14615
|
const ua = typeof globalThis.navigator !== "undefined" ? globalThis.navigator.userAgent : "";
|
|
@@ -14620,6 +14625,7 @@ const ejecta = (typeof globalThis.ejecta !== "undefined");
|
|
|
14620
14625
|
const isWeixin = /MicroMessenger/i.test(ua);
|
|
14621
14626
|
const nodeJS = (typeof globalThis.process !== "undefined") && (typeof globalThis.process.release !== "undefined") && (globalThis.process.release.name === "node");
|
|
14622
14627
|
const isMobile$1 = /Mobi/i.test(ua) || iOS || android || wp || BlackBerry || Kindle || false;
|
|
14628
|
+
const webApp = (typeof globalThis.navigator !== "undefined" && globalThis.navigator.standalone === true) || (typeof globalThis.matchMedia !== "undefined" && globalThis.matchMedia("(display-mode: standalone)").matches);
|
|
14623
14629
|
|
|
14624
14630
|
var device_platform = {
|
|
14625
14631
|
__proto__: null,
|
|
@@ -14635,6 +14641,7 @@ var device_platform = {
|
|
|
14635
14641
|
linux: linux,
|
|
14636
14642
|
nodeJS: nodeJS,
|
|
14637
14643
|
ua: ua,
|
|
14644
|
+
webApp: webApp,
|
|
14638
14645
|
wp: wp
|
|
14639
14646
|
};
|
|
14640
14647
|
|
|
@@ -14735,7 +14742,7 @@ function disableSwipeFn(e) {
|
|
|
14735
14742
|
function hasLocalStorage() {
|
|
14736
14743
|
try {
|
|
14737
14744
|
return !!globalThis.localStorage;
|
|
14738
|
-
} catch
|
|
14745
|
+
} catch {
|
|
14739
14746
|
// the above generates an exception when cookies are blocked
|
|
14740
14747
|
return false;
|
|
14741
14748
|
}
|
|
@@ -14745,8 +14752,8 @@ function hasOffscreenCanvas() {
|
|
|
14745
14752
|
try {
|
|
14746
14753
|
// some browser (e.g. Safari) implements WebGL1 and WebGL2 contexts only
|
|
14747
14754
|
// https://bugzilla.mozilla.org/show_bug.cgi?id=801176
|
|
14748
|
-
return (typeof globalThis.OffscreenCanvas !== "undefined") && ((new globalThis.OffscreenCanvas(0, 0).getContext(
|
|
14749
|
-
} catch
|
|
14755
|
+
return (typeof globalThis.OffscreenCanvas !== "undefined") && ((new globalThis.OffscreenCanvas(0, 0).getContext("2d")) !== null);
|
|
14756
|
+
} catch {
|
|
14750
14757
|
return false;
|
|
14751
14758
|
}
|
|
14752
14759
|
}
|
|
@@ -15122,7 +15129,7 @@ function onReady(fn) {
|
|
|
15122
15129
|
} else {
|
|
15123
15130
|
emit(BLUR);
|
|
15124
15131
|
}
|
|
15125
|
-
}, false
|
|
15132
|
+
}, false);
|
|
15126
15133
|
}
|
|
15127
15134
|
}
|
|
15128
15135
|
// call the supplied function
|
|
@@ -15390,7 +15397,7 @@ function isWebGLSupported(options) {
|
|
|
15390
15397
|
};
|
|
15391
15398
|
_supported = !! (globalThis.WebGLRenderingContext && (canvas.getContext("webgl", ctxOptions) || canvas.getContext("experimental-webgl", ctxOptions)));
|
|
15392
15399
|
WebGLSupport = _supported ? 1 : 0;
|
|
15393
|
-
} catch
|
|
15400
|
+
} catch {
|
|
15394
15401
|
WebGLSupport = 0;
|
|
15395
15402
|
}
|
|
15396
15403
|
}
|
|
@@ -16752,7 +16759,7 @@ function enablePointerEvent() {
|
|
|
16752
16759
|
// set the PointerMove/touchMove/MouseMove event
|
|
16753
16760
|
if (typeof(throttlingInterval) === "undefined") {
|
|
16754
16761
|
// set the default value
|
|
16755
|
-
throttlingInterval = ~~(1000 / timer
|
|
16762
|
+
throttlingInterval = ~~(1000 / timer.maxfps);
|
|
16756
16763
|
}
|
|
16757
16764
|
|
|
16758
16765
|
if (autoFocus === true) {
|
|
@@ -18114,12 +18121,12 @@ function setPrecision(src, precision) {
|
|
|
18114
18121
|
* @returns {boolean} "lowp", "mediump", or "highp"
|
|
18115
18122
|
*/
|
|
18116
18123
|
function getMaxShaderPrecision(gl) {
|
|
18117
|
-
if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT
|
|
18118
|
-
gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT
|
|
18124
|
+
if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT).precision > 0 &&
|
|
18125
|
+
gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.HIGH_FLOAT).precision > 0) {
|
|
18119
18126
|
return "highp";
|
|
18120
18127
|
}
|
|
18121
|
-
if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT
|
|
18122
|
-
gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT
|
|
18128
|
+
if (gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.MEDIUM_FLOAT).precision > 0 &&
|
|
18129
|
+
gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER, gl.MEDIUM_FLOAT).precision > 0) {
|
|
18123
18130
|
return "mediump";
|
|
18124
18131
|
}
|
|
18125
18132
|
return "lowp";
|
|
@@ -20138,6 +20145,9 @@ let jsonList = {};
|
|
|
20138
20145
|
// contains all the video files
|
|
20139
20146
|
let videoList = {};
|
|
20140
20147
|
|
|
20148
|
+
// contains all the font files
|
|
20149
|
+
let fontList = {};
|
|
20150
|
+
|
|
20141
20151
|
/**
|
|
20142
20152
|
* Fetches data from the specified URL.
|
|
20143
20153
|
* @param {string} url - The URL to fetch the data from.
|
|
@@ -20427,7 +20437,7 @@ function preloadImage(img, onload, onerror, settings) {
|
|
|
20427
20437
|
// callback
|
|
20428
20438
|
onload();
|
|
20429
20439
|
}
|
|
20430
|
-
} catch
|
|
20440
|
+
} catch {
|
|
20431
20441
|
// parseCompressedImage will throw an error if a format is not supported or badly formatted
|
|
20432
20442
|
}
|
|
20433
20443
|
}).catch(error => {
|
|
@@ -20495,7 +20505,7 @@ function preloadImage(img, onload, onerror, settings) {
|
|
|
20495
20505
|
|
|
20496
20506
|
// no compatible format was found
|
|
20497
20507
|
throw new Error(
|
|
20498
|
-
"No
|
|
20508
|
+
"No supported Image file format found for " + img.name
|
|
20499
20509
|
);
|
|
20500
20510
|
}
|
|
20501
20511
|
|
|
@@ -20512,6 +20522,7 @@ function preloadImage(img, onload, onerror, settings) {
|
|
|
20512
20522
|
* ]);
|
|
20513
20523
|
*/
|
|
20514
20524
|
function preloadFontFace(data, onload, onerror) {
|
|
20525
|
+
const fontFaceSet = typeof globalThis.document !== "undefined" ? globalThis.document.fonts : undefined;
|
|
20515
20526
|
|
|
20516
20527
|
if (isDataUrl(data.src) === true) {
|
|
20517
20528
|
// make sure it in the `url(data:[<mediatype>][;base64],<data>)` format as expected by FontFace
|
|
@@ -20520,23 +20531,31 @@ function preloadFontFace(data, onload, onerror) {
|
|
|
20520
20531
|
}
|
|
20521
20532
|
}
|
|
20522
20533
|
|
|
20523
|
-
|
|
20524
|
-
|
|
20525
|
-
|
|
20526
|
-
|
|
20527
|
-
|
|
20528
|
-
|
|
20529
|
-
|
|
20530
|
-
|
|
20534
|
+
if (typeof fontFaceSet !== "undefined") {
|
|
20535
|
+
// create a new font face
|
|
20536
|
+
let font = new FontFace(data.name, data.src);
|
|
20537
|
+
// loading promise
|
|
20538
|
+
font.load().then(() => {
|
|
20539
|
+
// add the font to the cache
|
|
20540
|
+
fontList[data.name] = font;
|
|
20541
|
+
// add the font to the document
|
|
20542
|
+
fontFaceSet.add(font);
|
|
20531
20543
|
// onloaded callback
|
|
20532
|
-
onload
|
|
20533
|
-
|
|
20534
|
-
|
|
20535
|
-
|
|
20544
|
+
if (typeof onload === "function") {
|
|
20545
|
+
onload();
|
|
20546
|
+
}
|
|
20547
|
+
}, () => {
|
|
20536
20548
|
// rejected
|
|
20537
|
-
onerror
|
|
20549
|
+
if (typeof onerror === "function") {
|
|
20550
|
+
onerror(data.name);
|
|
20551
|
+
}
|
|
20552
|
+
});
|
|
20553
|
+
|
|
20554
|
+
} else {
|
|
20555
|
+
if (typeof onerror === "function") {
|
|
20556
|
+
onerror(error);
|
|
20538
20557
|
}
|
|
20539
|
-
}
|
|
20558
|
+
}
|
|
20540
20559
|
|
|
20541
20560
|
return 1;
|
|
20542
20561
|
}
|
|
@@ -24010,7 +24029,7 @@ class TMXTileset {
|
|
|
24010
24029
|
// update tile animations
|
|
24011
24030
|
update(dt) {
|
|
24012
24031
|
let duration = 0,
|
|
24013
|
-
now = timer
|
|
24032
|
+
now = timer.getTime(),
|
|
24014
24033
|
result = false;
|
|
24015
24034
|
|
|
24016
24035
|
if (this._lastUpdate !== now) {
|
|
@@ -24193,7 +24212,7 @@ function setTMXValue(name, type, value) {
|
|
|
24193
24212
|
try {
|
|
24194
24213
|
value = JSON.parse(match);
|
|
24195
24214
|
}
|
|
24196
|
-
catch
|
|
24215
|
+
catch {
|
|
24197
24216
|
throw new Error("Unable to parse JSON: " + match);
|
|
24198
24217
|
}
|
|
24199
24218
|
}
|
|
@@ -24204,7 +24223,7 @@ function setTMXValue(name, type, value) {
|
|
|
24204
24223
|
// eslint-disable-next-line
|
|
24205
24224
|
value = Function("'use strict';return (" + match + ")")();
|
|
24206
24225
|
}
|
|
24207
|
-
catch
|
|
24226
|
+
catch {
|
|
24208
24227
|
throw new Error("Unable to evaluate: " + match);
|
|
24209
24228
|
}
|
|
24210
24229
|
}
|
|
@@ -24952,7 +24971,7 @@ class TMXObject {
|
|
|
24952
24971
|
let _polygon = pool.pull("Polygon", 0, 0, this.points);
|
|
24953
24972
|
let isConvex = _polygon.isConvex();
|
|
24954
24973
|
// make sure it's a convex polygon
|
|
24955
|
-
if (isConvex === false
|
|
24974
|
+
if (isConvex === false) {
|
|
24956
24975
|
throw new Error("collision polygones in Tiled should be defined as Convex");
|
|
24957
24976
|
} else if (isConvex === null) {
|
|
24958
24977
|
throw new Error("invalid polygone");
|
|
@@ -25163,12 +25182,12 @@ class Path2D {
|
|
|
25163
25182
|
break;
|
|
25164
25183
|
case "H":
|
|
25165
25184
|
// H take 1 coordinate
|
|
25166
|
-
lastPoint = points.length === 0 ? startPoint : points[points.length-1];
|
|
25185
|
+
lastPoint = points.length === 0 ? startPoint : points[points.length - 1];
|
|
25167
25186
|
this.lineTo(lastPoint.x + coordinates[0], lastPoint.y);
|
|
25168
25187
|
break;
|
|
25169
25188
|
case "V":
|
|
25170
25189
|
// V take 1 coordinate
|
|
25171
|
-
lastPoint = points.length === 0 ? startPoint : points[points.length-1];
|
|
25190
|
+
lastPoint = points.length === 0 ? startPoint : points[points.length - 1];
|
|
25172
25191
|
this.lineTo(lastPoint.x, lastPoint.y + coordinates[0]);
|
|
25173
25192
|
break;
|
|
25174
25193
|
case "M":
|
|
@@ -25220,7 +25239,7 @@ class Path2D {
|
|
|
25220
25239
|
let points = this.points;
|
|
25221
25240
|
if (points.length > 0) {
|
|
25222
25241
|
let firstPoint = points[0];
|
|
25223
|
-
if (!firstPoint.equals(points[points.length-1])) {
|
|
25242
|
+
if (!firstPoint.equals(points[points.length - 1])) {
|
|
25224
25243
|
this.lineTo(firstPoint.x, firstPoint.y);
|
|
25225
25244
|
}
|
|
25226
25245
|
this.isDirty = true;
|
|
@@ -25245,14 +25264,14 @@ class Path2D {
|
|
|
25245
25264
|
}
|
|
25246
25265
|
|
|
25247
25266
|
// calculate all vertices
|
|
25248
|
-
for (let i = 0; i < indicesLength; i++
|
|
25267
|
+
for (let i = 0; i < indicesLength; i++) {
|
|
25249
25268
|
let point = points[indices[i]];
|
|
25250
25269
|
vertices[i].set(point.x, point.y);
|
|
25251
25270
|
}
|
|
25252
25271
|
|
|
25253
25272
|
// recycle overhead from a previous triangulation
|
|
25254
25273
|
while (vertices.length > indicesLength) {
|
|
25255
|
-
pool.push(vertices[vertices.length-1]);
|
|
25274
|
+
pool.push(vertices[vertices.length - 1]);
|
|
25256
25275
|
vertices.length -= 1;
|
|
25257
25276
|
}
|
|
25258
25277
|
this.isDirty = false;
|
|
@@ -25279,7 +25298,7 @@ class Path2D {
|
|
|
25279
25298
|
lineTo(x, y) {
|
|
25280
25299
|
let points = this.points;
|
|
25281
25300
|
let startPoint = this.startPoint;
|
|
25282
|
-
let lastPoint = points.length === 0 ? startPoint : points[points.length-1];
|
|
25301
|
+
let lastPoint = points.length === 0 ? startPoint : points[points.length - 1];
|
|
25283
25302
|
|
|
25284
25303
|
if (!startPoint.equals(lastPoint)) {
|
|
25285
25304
|
points.push(pool.pull("Point", startPoint.x, startPoint.y));
|
|
@@ -25308,7 +25327,7 @@ class Path2D {
|
|
|
25308
25327
|
// based on from https://github.com/karellodewijk/canvas-webgl/blob/master/canvas-webgl.js
|
|
25309
25328
|
//bring angles all in [0, 2*PI] range
|
|
25310
25329
|
if (startAngle === endAngle) return;
|
|
25311
|
-
const fullCircle = anticlockwise ? Math.abs(startAngle-endAngle) >= (TAU) : Math.abs(endAngle-startAngle) >= (TAU);
|
|
25330
|
+
const fullCircle = anticlockwise ? Math.abs(startAngle - endAngle) >= (TAU) : Math.abs(endAngle - startAngle) >= (TAU);
|
|
25312
25331
|
|
|
25313
25332
|
startAngle = startAngle % (TAU);
|
|
25314
25333
|
endAngle = endAngle % (TAU);
|
|
@@ -25317,7 +25336,7 @@ class Path2D {
|
|
|
25317
25336
|
if (endAngle < 0) endAngle += TAU;
|
|
25318
25337
|
|
|
25319
25338
|
if (startAngle >= endAngle) {
|
|
25320
|
-
endAngle+= TAU;
|
|
25339
|
+
endAngle += TAU;
|
|
25321
25340
|
}
|
|
25322
25341
|
|
|
25323
25342
|
let diff = endAngle - startAngle;
|
|
@@ -25358,7 +25377,7 @@ class Path2D {
|
|
|
25358
25377
|
arcTo(x1, y1, x2, y2, radius) {
|
|
25359
25378
|
let points = this.points;
|
|
25360
25379
|
let startPoint = this.startPoint;
|
|
25361
|
-
let lastPoint = points.length === 0 ? startPoint : points[points.length-1];
|
|
25380
|
+
let lastPoint = points.length === 0 ? startPoint : points[points.length - 1];
|
|
25362
25381
|
|
|
25363
25382
|
// based on from https://github.com/karellodewijk/canvas-webgl/blob/master/canvas-webgl.js
|
|
25364
25383
|
let x0 = lastPoint.x, y0 = lastPoint.y;
|
|
@@ -25373,8 +25392,8 @@ class Path2D {
|
|
|
25373
25392
|
let angle = Math.atan2(a1, a0) - Math.atan2(b1, b0);
|
|
25374
25393
|
|
|
25375
25394
|
//work out tangent points using tan(θ) = opposite / adjacent; angle/2 because hypotenuse is the bisection of a,b
|
|
25376
|
-
let tan_angle_div2 = Math.tan(angle/2);
|
|
25377
|
-
let adj_l = (radius/tan_angle_div2);
|
|
25395
|
+
let tan_angle_div2 = Math.tan(angle / 2);
|
|
25396
|
+
let adj_l = (radius / tan_angle_div2);
|
|
25378
25397
|
|
|
25379
25398
|
let tangent1_pointx = x1 + a0 * adj_l, tangent1_pointy = y1 + a1 * adj_l;
|
|
25380
25399
|
let tangent2_pointx = x1 + b0 * adj_l, tangent2_pointy = y1 + b1 * adj_l;
|
|
@@ -25409,7 +25428,7 @@ class Path2D {
|
|
|
25409
25428
|
ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise = false) {
|
|
25410
25429
|
// based on from https://github.com/karellodewijk/canvas-webgl/blob/master/canvas-webgl.js
|
|
25411
25430
|
if (startAngle === endAngle) return;
|
|
25412
|
-
let fullCircle = anticlockwise ? Math.abs(startAngle-endAngle) >= (TAU) : Math.abs(endAngle-startAngle) >= (TAU);
|
|
25431
|
+
let fullCircle = anticlockwise ? Math.abs(startAngle - endAngle) >= (TAU) : Math.abs(endAngle - startAngle) >= (TAU);
|
|
25413
25432
|
|
|
25414
25433
|
//bring angles all in [0, 2*PI] range
|
|
25415
25434
|
startAngle = startAngle % (TAU);
|
|
@@ -25417,7 +25436,7 @@ class Path2D {
|
|
|
25417
25436
|
if (startAngle < 0) startAngle += TAU;
|
|
25418
25437
|
if (endAngle < 0) endAngle += TAU;
|
|
25419
25438
|
|
|
25420
|
-
if (startAngle>=endAngle) {
|
|
25439
|
+
if (startAngle >= endAngle) {
|
|
25421
25440
|
endAngle += TAU;
|
|
25422
25441
|
}
|
|
25423
25442
|
|
|
@@ -25447,7 +25466,7 @@ class Path2D {
|
|
|
25447
25466
|
const _y1 = radiusY * Math.sin(angle);
|
|
25448
25467
|
const _x2 = x + _x1 * cos_rotation - _y1 * sin_rotation;
|
|
25449
25468
|
const _y2 = y + _x1 * sin_rotation + _y1 * cos_rotation;
|
|
25450
|
-
this.lineTo(
|
|
25469
|
+
this.lineTo(_x2, _y2);
|
|
25451
25470
|
angle += angleStep;
|
|
25452
25471
|
}
|
|
25453
25472
|
// close the ellipse
|
|
@@ -25465,7 +25484,7 @@ class Path2D {
|
|
|
25465
25484
|
quadraticCurveTo(cpX, cpY, x, y) {
|
|
25466
25485
|
const points = this.points;
|
|
25467
25486
|
const startPoint = this.startPoint;
|
|
25468
|
-
const lastPoint = points.length === 0 ? startPoint : points[points.length-1];
|
|
25487
|
+
const lastPoint = points.length === 0 ? startPoint : points[points.length - 1];
|
|
25469
25488
|
const endPoint = pool.pull("Point").set(x, y);
|
|
25470
25489
|
const controlPoint = pool.pull("Point").set(cpX, cpY);
|
|
25471
25490
|
const resolution = this.arcResolution;
|
|
@@ -25493,7 +25512,7 @@ class Path2D {
|
|
|
25493
25512
|
bezierCurveTo(cp1X, cp1Y, cp2X, cp2Y, x, y) {
|
|
25494
25513
|
const points = this.points;
|
|
25495
25514
|
const startPoint = this.startPoint;
|
|
25496
|
-
const lastPoint = points.length === 0 ? startPoint : points[points.length-1];
|
|
25515
|
+
const lastPoint = points.length === 0 ? startPoint : points[points.length - 1];
|
|
25497
25516
|
const endPoint = pool.pull("Point").set(x, y);
|
|
25498
25517
|
const controlPoint1 = pool.pull("Point").set(cp1X, cp1Y);
|
|
25499
25518
|
const controlPoint2 = pool.pull("Point").set(cp2X, cp2Y);
|
|
@@ -25589,7 +25608,6 @@ function createContext(canvas, attributes) {
|
|
|
25589
25608
|
// 2d/canvas mode
|
|
25590
25609
|
context = canvas.getContext(attributes.context, { willReadFrequently: attributes.willReadFrequently });
|
|
25591
25610
|
} else if (attributes.context === "webgl") {
|
|
25592
|
-
|
|
25593
25611
|
let attr = {
|
|
25594
25612
|
alpha : attributes.transparent,
|
|
25595
25613
|
antialias : attributes.antiAlias,
|
|
@@ -25601,8 +25619,8 @@ function createContext(canvas, attributes) {
|
|
|
25601
25619
|
failIfMajorPerformanceCaveat : attributes.failIfMajorPerformanceCaveat
|
|
25602
25620
|
};
|
|
25603
25621
|
|
|
25604
|
-
// attempt to create a WebGL2 context
|
|
25605
|
-
if (attributes.preferWebGL1
|
|
25622
|
+
// attempt to create a WebGL2 context unless not requested
|
|
25623
|
+
if (attributes.preferWebGL1 !== true) {
|
|
25606
25624
|
context = canvas.getContext("webgl2", attr);
|
|
25607
25625
|
if (context) {
|
|
25608
25626
|
WebGLVersion = 2;
|
|
@@ -25637,8 +25655,10 @@ class CanvasRenderTarget {
|
|
|
25637
25655
|
/**
|
|
25638
25656
|
* @param {number} width - the desired width of the canvas
|
|
25639
25657
|
* @param {number} height - the desired height of the canvas
|
|
25640
|
-
* @param {
|
|
25641
|
-
* @param {boolean} [attributes.context="2d"] - the context type to be created ("2d", "webgl"
|
|
25658
|
+
* @param {Settings} attributes - The attributes to create both the canvas and context
|
|
25659
|
+
* @param {boolean} [attributes.context="2d"] - the context type to be created ("2d", "webgl")
|
|
25660
|
+
* @param {boolean} [attributes.preferWebGL1=false] - set to true for force using WebGL1 instead of WebGL2 (if supported)
|
|
25661
|
+
* @param {boolean} [attributes.transparent=false] - specify if the canvas contains an alpha channel
|
|
25642
25662
|
* @param {boolean} [attributes.offscreenCanvas=false] - will create an offscreenCanvas if true instead of a standard canvas
|
|
25643
25663
|
* @param {boolean} [attributes.willReadFrequently=false] - Indicates whether or not a lot of read-back operations are planned
|
|
25644
25664
|
* @param {boolean} [attributes.antiAlias=false] - Whether to enable anti-aliasing, use false (default) for a pixelated effect.
|
|
@@ -25659,6 +25679,11 @@ class CanvasRenderTarget {
|
|
|
25659
25679
|
// clean up the given attributes
|
|
25660
25680
|
this.attributes = Object.assign({}, defaultAttributes, attributes);
|
|
25661
25681
|
|
|
25682
|
+
// make sure context is defined
|
|
25683
|
+
if (typeof attributes.context === "undefined") {
|
|
25684
|
+
attributes.context = "2d";
|
|
25685
|
+
}
|
|
25686
|
+
|
|
25662
25687
|
// used the given canvas if any
|
|
25663
25688
|
if (typeof attributes.canvas !== "undefined") {
|
|
25664
25689
|
this.canvas = attributes.canvas;
|
|
@@ -25870,7 +25895,10 @@ class Renderer {
|
|
|
25870
25895
|
* @name renderTarget
|
|
25871
25896
|
* @type {CanvasRenderTarget}
|
|
25872
25897
|
*/
|
|
25873
|
-
this.renderTarget = new CanvasRenderTarget(options.width, options.height,
|
|
25898
|
+
this.renderTarget = new CanvasRenderTarget(options.width, options.height,
|
|
25899
|
+
// support case when a global canvas is available, e.g. webapp adapter for wechat
|
|
25900
|
+
typeof globalThis.canvas !== "undefined" ? Object.assign(options, { canvas: globalThis.canvas }) : options
|
|
25901
|
+
);
|
|
25874
25902
|
|
|
25875
25903
|
/**
|
|
25876
25904
|
* The given constructor options
|
|
@@ -25936,19 +25964,6 @@ class Renderer {
|
|
|
25936
25964
|
*/
|
|
25937
25965
|
this.currentBlendMode = "none";
|
|
25938
25966
|
|
|
25939
|
-
// create the main screen canvas
|
|
25940
|
-
if (platform.ejecta === true) {
|
|
25941
|
-
// a main canvas is already automatically created by Ejecta
|
|
25942
|
-
this.canvas = globalThis.document.getElementById("canvas");
|
|
25943
|
-
} else if (typeof globalThis.canvas !== "undefined") {
|
|
25944
|
-
// a global canvas is available, e.g. webapp adapter for wechat
|
|
25945
|
-
this.canvas = globalThis.canvas;
|
|
25946
|
-
} else if (typeof this.settings.canvas !== "undefined") {
|
|
25947
|
-
this.canvas = this.settings.canvas;
|
|
25948
|
-
} else {
|
|
25949
|
-
this.canvas = createCanvas(this.settings.width, this.settings.height);
|
|
25950
|
-
}
|
|
25951
|
-
|
|
25952
25967
|
// global color
|
|
25953
25968
|
this.currentColor = new Color(0, 0, 0, 1.0);
|
|
25954
25969
|
|
|
@@ -26013,7 +26028,7 @@ class Renderer {
|
|
|
26013
26028
|
}
|
|
26014
26029
|
|
|
26015
26030
|
/**
|
|
26016
|
-
* return a reference to the canvas which this renderer draws to
|
|
26031
|
+
* return a reference to the current render target corresponding canvas which this renderer draws to
|
|
26017
26032
|
* @returns {HTMLCanvasElement}
|
|
26018
26033
|
*/
|
|
26019
26034
|
getCanvas() {
|
|
@@ -26021,7 +26036,7 @@ class Renderer {
|
|
|
26021
26036
|
}
|
|
26022
26037
|
|
|
26023
26038
|
/**
|
|
26024
|
-
* return a reference to
|
|
26039
|
+
* return a reference to the current render target corresponding Context
|
|
26025
26040
|
* @returns {CanvasRenderingContext2D|WebGLRenderingContext}
|
|
26026
26041
|
*/
|
|
26027
26042
|
getContext() {
|
|
@@ -26036,42 +26051,6 @@ class Renderer {
|
|
|
26036
26051
|
return this.currentBlendMode;
|
|
26037
26052
|
}
|
|
26038
26053
|
|
|
26039
|
-
/**
|
|
26040
|
-
* Returns the 2D Context object of the given Canvas<br>
|
|
26041
|
-
* Also configures anti-aliasing and blend modes based on constructor options.
|
|
26042
|
-
* @param {HTMLCanvasElement} canvas
|
|
26043
|
-
* @param {boolean} [transparent=true] - use false to disable transparency
|
|
26044
|
-
* @returns {CanvasRenderingContext2D}
|
|
26045
|
-
*/
|
|
26046
|
-
getContext2d(canvas, transparent) {
|
|
26047
|
-
if (typeof canvas === "undefined" || canvas === null) {
|
|
26048
|
-
throw new Error(
|
|
26049
|
-
"You must pass a canvas element in order to create " +
|
|
26050
|
-
"a 2d context"
|
|
26051
|
-
);
|
|
26052
|
-
}
|
|
26053
|
-
|
|
26054
|
-
if (typeof canvas.getContext === "undefined") {
|
|
26055
|
-
throw new Error(
|
|
26056
|
-
"Your browser does not support HTML5 canvas."
|
|
26057
|
-
);
|
|
26058
|
-
}
|
|
26059
|
-
|
|
26060
|
-
if (typeof transparent !== "boolean") {
|
|
26061
|
-
transparent = true;
|
|
26062
|
-
}
|
|
26063
|
-
|
|
26064
|
-
let _context = canvas.getContext("2d", {
|
|
26065
|
-
"alpha" : transparent
|
|
26066
|
-
});
|
|
26067
|
-
|
|
26068
|
-
if (!_context.canvas) {
|
|
26069
|
-
_context.canvas = canvas;
|
|
26070
|
-
}
|
|
26071
|
-
this.setAntiAlias(_context, this.settings.antiAlias);
|
|
26072
|
-
return _context;
|
|
26073
|
-
}
|
|
26074
|
-
|
|
26075
26054
|
/**
|
|
26076
26055
|
* get the current fill & stroke style color.
|
|
26077
26056
|
* @returns {Color} current global color
|
|
@@ -26120,12 +26099,11 @@ class Renderer {
|
|
|
26120
26099
|
}
|
|
26121
26100
|
|
|
26122
26101
|
/**
|
|
26123
|
-
* enable/disable image smoothing (scaling interpolation) for the
|
|
26124
|
-
* @param {CanvasRenderingContext2D} context
|
|
26102
|
+
* enable/disable image smoothing (scaling interpolation) for the current render target
|
|
26125
26103
|
* @param {boolean} [enable=false]
|
|
26126
26104
|
*/
|
|
26127
|
-
setAntiAlias(
|
|
26128
|
-
this.renderTarget.setAntiAlias(
|
|
26105
|
+
setAntiAlias(enable) {
|
|
26106
|
+
this.renderTarget.setAntiAlias(enable);
|
|
26129
26107
|
}
|
|
26130
26108
|
|
|
26131
26109
|
/**
|
|
@@ -26188,25 +26166,22 @@ class Renderer {
|
|
|
26188
26166
|
* @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas} src - the source image to be tinted
|
|
26189
26167
|
* @param {Color|string} color - the color that will be used to tint the image
|
|
26190
26168
|
* @param {string} [mode="multiply"] - the composition mode used to tint the image
|
|
26191
|
-
* @returns {HTMLCanvasElement|OffscreenCanvas} a new canvas element representing the tinted image
|
|
26169
|
+
* @returns {HTMLCanvasElement|OffscreenCanvas} a new canvas or offscreencanvas (if supported) element representing the tinted image
|
|
26192
26170
|
*/
|
|
26193
|
-
tint(src, color, mode) {
|
|
26194
|
-
|
|
26195
|
-
let
|
|
26196
|
-
|
|
26197
|
-
context.save();
|
|
26171
|
+
tint(src, color, mode = "multiply") {
|
|
26172
|
+
const attributes = { context:"2d", offscreenCanvas: true, transparent: true, antiAlias: this.settings.antiAlias };
|
|
26173
|
+
let canvasTexture = new CanvasRenderTarget(src.width, src.height, attributes);
|
|
26174
|
+
let context = canvasTexture.context;
|
|
26198
26175
|
|
|
26199
26176
|
context.fillStyle = color instanceof Color ? color.toRGB() : color;
|
|
26200
26177
|
context.fillRect(0, 0, src.width, src.height);
|
|
26201
26178
|
|
|
26202
|
-
context.globalCompositeOperation = mode
|
|
26179
|
+
context.globalCompositeOperation = mode;
|
|
26203
26180
|
context.drawImage(src, 0, 0);
|
|
26204
26181
|
context.globalCompositeOperation = "destination-atop";
|
|
26205
26182
|
context.drawImage(src, 0, 0);
|
|
26206
26183
|
|
|
26207
|
-
|
|
26208
|
-
|
|
26209
|
-
return canvas;
|
|
26184
|
+
return canvasTexture.canvas;
|
|
26210
26185
|
}
|
|
26211
26186
|
|
|
26212
26187
|
/**
|
|
@@ -27278,12 +27253,12 @@ class CanvasRenderer extends Renderer {
|
|
|
27278
27253
|
e.preventDefault();
|
|
27279
27254
|
this.isContextValid = false;
|
|
27280
27255
|
emit(ONCONTEXT_LOST, this);
|
|
27281
|
-
}, false
|
|
27256
|
+
}, false);
|
|
27282
27257
|
// ctx.restoreContext()
|
|
27283
27258
|
this.getCanvas().addEventListener("contextrestored", () => {
|
|
27284
27259
|
this.isContextValid = true;
|
|
27285
27260
|
emit(ONCONTEXT_RESTORED, this);
|
|
27286
|
-
}, false
|
|
27261
|
+
}, false);
|
|
27287
27262
|
|
|
27288
27263
|
// reset the renderer on game reset
|
|
27289
27264
|
on(GAME_RESET, () => {
|
|
@@ -27828,12 +27803,13 @@ class CanvasRenderer extends Renderer {
|
|
|
27828
27803
|
* renderer.restore();
|
|
27829
27804
|
*/
|
|
27830
27805
|
restore() {
|
|
27806
|
+
const canvas = this.getCanvas();
|
|
27831
27807
|
this.getContext().restore();
|
|
27832
27808
|
this.currentColor.glArray[3] = this.getGlobalAlpha();
|
|
27833
27809
|
this.currentScissor[0] = 0;
|
|
27834
27810
|
this.currentScissor[1] = 0;
|
|
27835
|
-
this.currentScissor[2] =
|
|
27836
|
-
this.currentScissor[3] =
|
|
27811
|
+
this.currentScissor[2] = canvas.width;
|
|
27812
|
+
this.currentScissor[3] = canvas.height;
|
|
27837
27813
|
}
|
|
27838
27814
|
|
|
27839
27815
|
/**
|
|
@@ -29295,7 +29271,7 @@ class Container extends Renderable {
|
|
|
29295
29271
|
|
|
29296
29272
|
if (!keepalive) {
|
|
29297
29273
|
// attempt at recycling the object
|
|
29298
|
-
if (pool.push(child, false) === false
|
|
29274
|
+
if (pool.push(child, false) === false) {
|
|
29299
29275
|
// else just destroy it
|
|
29300
29276
|
if (typeof child.destroy === "function") {
|
|
29301
29277
|
child.destroy();
|
|
@@ -29839,8 +29815,8 @@ class TMXOrthogonalRenderer extends TMXRenderer {
|
|
|
29839
29815
|
}
|
|
29840
29816
|
|
|
29841
29817
|
// main drawing loop
|
|
29842
|
-
for (let y = start.y; y !== end.y; y+= incY) {
|
|
29843
|
-
for (let x = start.x; x !== end.x; x+= incX) {
|
|
29818
|
+
for (let y = start.y; y !== end.y; y += incY) {
|
|
29819
|
+
for (let x = start.x; x !== end.x; x += incX) {
|
|
29844
29820
|
let tmxTile = layer.cellAt(x, y, false);
|
|
29845
29821
|
if (tmxTile) {
|
|
29846
29822
|
this.drawTile(renderer, x, y, tmxTile);
|
|
@@ -30235,10 +30211,10 @@ class TMXHexagonalRenderer extends TMXRenderer {
|
|
|
30235
30211
|
}
|
|
30236
30212
|
} else {
|
|
30237
30213
|
if ((x & 1) ^ this.staggerEven) {
|
|
30238
|
-
ret.set(x -1, y + 1);
|
|
30214
|
+
ret.set(x - 1, y + 1);
|
|
30239
30215
|
}
|
|
30240
30216
|
else {
|
|
30241
|
-
ret.set(x -1, y);
|
|
30217
|
+
ret.set(x - 1, y);
|
|
30242
30218
|
}
|
|
30243
30219
|
}
|
|
30244
30220
|
return ret;
|
|
@@ -30472,11 +30448,11 @@ class TMXHexagonalRenderer extends TMXRenderer {
|
|
|
30472
30448
|
let staggeredRow = this.doStaggerX(startTile.x + layer.pos.x);
|
|
30473
30449
|
|
|
30474
30450
|
// main drawing loop
|
|
30475
|
-
for (; startPos.y < rect.bottom && startTile.y < endY;
|
|
30451
|
+
for (; startPos.y < rect.bottom && startTile.y < endY;) {
|
|
30476
30452
|
rowTile.setV(startTile);
|
|
30477
30453
|
rowPos.setV(startPos);
|
|
30478
30454
|
|
|
30479
|
-
for (; rowPos.x < rect.right && rowTile.x < endX; rowTile.x+=2) {
|
|
30455
|
+
for (; rowPos.x < rect.right && rowTile.x < endX; rowTile.x += 2) {
|
|
30480
30456
|
tile = layer.cellAt(rowTile.x, rowTile.y, false);
|
|
30481
30457
|
if (tile) {
|
|
30482
30458
|
// draw the tile
|
|
@@ -30885,7 +30861,7 @@ class TMXTileMap {
|
|
|
30885
30861
|
if (this.version !== "undefined" && this.version !== "") {
|
|
30886
30862
|
// deprecation warning if map tiled version is older than 1.5
|
|
30887
30863
|
if (checkVersion(this.version, "1.5") < 0) {
|
|
30888
|
-
warning("("+this.name+") Tiled Map format version 1.4 and below", "format 1.5 or higher", "10.4.4");
|
|
30864
|
+
warning("(" + this.name + ") Tiled Map format version 1.4 and below", "format 1.5 or higher", "10.4.4");
|
|
30889
30865
|
}
|
|
30890
30866
|
}
|
|
30891
30867
|
|
|
@@ -32332,8 +32308,12 @@ function unload(asset) {
|
|
|
32332
32308
|
return true;
|
|
32333
32309
|
|
|
32334
32310
|
case "fontface":
|
|
32335
|
-
|
|
32336
|
-
|
|
32311
|
+
if (typeof typeof globalThis.document !== "undefined" && typeof globalThis.document.fonts !== "undefined") {
|
|
32312
|
+
globalThis.document.fonts.delete(fontList[asset.name]);
|
|
32313
|
+
delete fontList[asset.name];
|
|
32314
|
+
return true;
|
|
32315
|
+
}
|
|
32316
|
+
return false;
|
|
32337
32317
|
|
|
32338
32318
|
case "tmx":
|
|
32339
32319
|
case "tsx":
|
|
@@ -32418,6 +32398,16 @@ function unloadAll() {
|
|
|
32418
32398
|
}
|
|
32419
32399
|
}
|
|
32420
32400
|
|
|
32401
|
+
// unload all video resources
|
|
32402
|
+
for (name in fontList) {
|
|
32403
|
+
if (fontList.hasOwnProperty(name)) {
|
|
32404
|
+
unload({
|
|
32405
|
+
"name" : name,
|
|
32406
|
+
"type" : "font"
|
|
32407
|
+
});
|
|
32408
|
+
}
|
|
32409
|
+
}
|
|
32410
|
+
|
|
32421
32411
|
// unload all audio resources
|
|
32422
32412
|
unloadAll$1();
|
|
32423
32413
|
}
|
|
@@ -32498,11 +32488,27 @@ function getVideo(elt) {
|
|
|
32498
32488
|
return null;
|
|
32499
32489
|
}
|
|
32500
32490
|
|
|
32491
|
+
/**
|
|
32492
|
+
* return the specified FontFace Object
|
|
32493
|
+
* @memberof loader
|
|
32494
|
+
* @param {string} elt - name of the font file
|
|
32495
|
+
* @returns {FontFace}
|
|
32496
|
+
*/
|
|
32497
|
+
function getFont(elt) {
|
|
32498
|
+
// force as string
|
|
32499
|
+
elt = "" + elt;
|
|
32500
|
+
if (elt in fontList) {
|
|
32501
|
+
return fontList[elt];
|
|
32502
|
+
}
|
|
32503
|
+
return null;
|
|
32504
|
+
}
|
|
32505
|
+
|
|
32501
32506
|
var loader = {
|
|
32502
32507
|
__proto__: null,
|
|
32503
32508
|
baseURL: baseURL,
|
|
32504
32509
|
get crossOrigin () { return crossOrigin$1; },
|
|
32505
32510
|
getBinary: getBinary,
|
|
32511
|
+
getFont: getFont,
|
|
32506
32512
|
getImage: getImage,
|
|
32507
32513
|
getJSON: getJSON,
|
|
32508
32514
|
getTMX: getTMX,
|
|
@@ -33540,7 +33546,7 @@ let state = {
|
|
|
33540
33546
|
* @public
|
|
33541
33547
|
* @param {boolean} [pauseTrack=false] - pause current track on screen stop.
|
|
33542
33548
|
*/
|
|
33543
|
-
stop(pauseTrack=false) {
|
|
33549
|
+
stop(pauseTrack = false) {
|
|
33544
33550
|
// only stop when we are not loading stuff
|
|
33545
33551
|
if ((_state !== this.LOADING) && this.isRunning()) {
|
|
33546
33552
|
// stop the main loop
|
|
@@ -33566,7 +33572,7 @@ let state = {
|
|
|
33566
33572
|
* @public
|
|
33567
33573
|
* @param {boolean} [music=false] - pause current music track on screen pause
|
|
33568
33574
|
*/
|
|
33569
|
-
pause(music=false) {
|
|
33575
|
+
pause(music = false) {
|
|
33570
33576
|
// only pause when we are not loading stuff
|
|
33571
33577
|
if ((_state !== this.LOADING) && !this.isPaused()) {
|
|
33572
33578
|
// stop the main loop
|
|
@@ -33591,7 +33597,7 @@ let state = {
|
|
|
33591
33597
|
* @public
|
|
33592
33598
|
* @param {boolean} [music=false] - resume current music track on screen resume
|
|
33593
33599
|
*/
|
|
33594
|
-
restart(music=false) {
|
|
33600
|
+
restart(music = false) {
|
|
33595
33601
|
if (!this.isRunning()) {
|
|
33596
33602
|
// restart the main loop
|
|
33597
33603
|
_startRunLoop();
|
|
@@ -33615,7 +33621,7 @@ let state = {
|
|
|
33615
33621
|
* @public
|
|
33616
33622
|
* @param {boolean} [music=false] - resume current music track on screen resume
|
|
33617
33623
|
*/
|
|
33618
|
-
resume(music=false) {
|
|
33624
|
+
resume(music = false) {
|
|
33619
33625
|
if (this.isPaused()) {
|
|
33620
33626
|
// resume the main loop
|
|
33621
33627
|
_resumeRunLoop();
|
|
@@ -33892,7 +33898,7 @@ class Timer {
|
|
|
33892
33898
|
this.now = 0;
|
|
33893
33899
|
this.delta = 0;
|
|
33894
33900
|
// for timeout/interval update
|
|
33895
|
-
this.step =0;
|
|
33901
|
+
this.step = 0;
|
|
33896
33902
|
this.minstep = 0;
|
|
33897
33903
|
|
|
33898
33904
|
// list of defined timer function
|
|
@@ -34098,22 +34104,6 @@ class Timer {
|
|
|
34098
34104
|
|
|
34099
34105
|
const timer = new Timer();
|
|
34100
34106
|
|
|
34101
|
-
/**
|
|
34102
|
-
* the default global Timer instance
|
|
34103
|
-
* @namespace timer
|
|
34104
|
-
* @see Timer
|
|
34105
|
-
* @example
|
|
34106
|
-
* // set a timer to call "myFunction" after 1000ms
|
|
34107
|
-
* timer.setTimeout(myFunction, 1000);
|
|
34108
|
-
* // set a timer to call "myFunction" after 1000ms (respecting the pause state) and passing param1 and param2
|
|
34109
|
-
* timer.setTimeout(myFunction, 1000, true, param1, param2);
|
|
34110
|
-
* // set a timer to call "myFunction" every 1000ms
|
|
34111
|
-
* timer.setInterval(myFunction, 1000);
|
|
34112
|
-
* // set a timer to call "myFunction" every 1000ms (respecting the pause state) and passing param1 and param2
|
|
34113
|
-
* timer.setInterval(myFunction, 1000, true, param1, param2);
|
|
34114
|
-
*/
|
|
34115
|
-
var timer$1 = timer;
|
|
34116
|
-
|
|
34117
34107
|
/**
|
|
34118
34108
|
* @classdesc
|
|
34119
34109
|
* a Generic Physic Body Object with some physic properties and behavior functionality, to add as a member of a Renderable.
|
|
@@ -34443,7 +34433,7 @@ class Body {
|
|
|
34443
34433
|
fromJSON(json, id) {
|
|
34444
34434
|
let data = json;
|
|
34445
34435
|
|
|
34446
|
-
if (typeof id !== "undefined"
|
|
34436
|
+
if (typeof id !== "undefined") {
|
|
34447
34437
|
data = json[id];
|
|
34448
34438
|
}
|
|
34449
34439
|
|
|
@@ -34720,7 +34710,7 @@ class Body {
|
|
|
34720
34710
|
update(dt) { // eslint-disable-line no-unused-vars
|
|
34721
34711
|
// apply timer.tick to delta time for linear interpolation (when enabled)
|
|
34722
34712
|
// #761 add delta time in body update
|
|
34723
|
-
let deltaTime = /* dt * */ timer
|
|
34713
|
+
let deltaTime = /* dt * */ timer.tick;
|
|
34724
34714
|
|
|
34725
34715
|
// apply force if defined
|
|
34726
34716
|
if (this.force.x !== 0) {
|
|
@@ -34738,7 +34728,7 @@ class Body {
|
|
|
34738
34728
|
|
|
34739
34729
|
this.vel.x = (
|
|
34740
34730
|
(nx < 0) ? nx :
|
|
34741
|
-
(
|
|
34731
|
+
(x > 0) ? x : 0
|
|
34742
34732
|
);
|
|
34743
34733
|
}
|
|
34744
34734
|
if (this.friction.y > 0) {
|
|
@@ -34748,7 +34738,7 @@ class Body {
|
|
|
34748
34738
|
|
|
34749
34739
|
this.vel.y = (
|
|
34750
34740
|
(ny < 0) ? ny :
|
|
34751
|
-
(
|
|
34741
|
+
(y > 0) ? y : 0
|
|
34752
34742
|
);
|
|
34753
34743
|
}
|
|
34754
34744
|
|
|
@@ -34806,8 +34796,6 @@ class Body {
|
|
|
34806
34796
|
* https://github.com/tweenjs/tween.js
|
|
34807
34797
|
*/
|
|
34808
34798
|
|
|
34809
|
-
/* eslint-disable quotes, keyword-spacing, comma-spacing, no-return-assign */
|
|
34810
|
-
|
|
34811
34799
|
/**
|
|
34812
34800
|
* Easing Function :<br>
|
|
34813
34801
|
* <p>
|
|
@@ -34853,7 +34841,7 @@ let Easing = {
|
|
|
34853
34841
|
|
|
34854
34842
|
Linear: {
|
|
34855
34843
|
/** @ignore */
|
|
34856
|
-
None: function (
|
|
34844
|
+
None: function (k) {
|
|
34857
34845
|
|
|
34858
34846
|
return k;
|
|
34859
34847
|
|
|
@@ -34863,22 +34851,22 @@ let Easing = {
|
|
|
34863
34851
|
|
|
34864
34852
|
Quadratic: {
|
|
34865
34853
|
/** @ignore */
|
|
34866
|
-
In: function (
|
|
34854
|
+
In: function (k) {
|
|
34867
34855
|
|
|
34868
34856
|
return k * k;
|
|
34869
34857
|
|
|
34870
34858
|
},
|
|
34871
34859
|
/** @ignore */
|
|
34872
|
-
Out: function (
|
|
34860
|
+
Out: function (k) {
|
|
34873
34861
|
|
|
34874
|
-
return k * (
|
|
34862
|
+
return k * (2 - k);
|
|
34875
34863
|
|
|
34876
34864
|
},
|
|
34877
34865
|
/** @ignore */
|
|
34878
|
-
InOut: function (
|
|
34866
|
+
InOut: function (k) {
|
|
34879
34867
|
|
|
34880
|
-
if (
|
|
34881
|
-
return - 0.5 * (
|
|
34868
|
+
if ((k *= 2) < 1) return 0.5 * k * k;
|
|
34869
|
+
return - 0.5 * (--k * (k - 2) - 1);
|
|
34882
34870
|
|
|
34883
34871
|
}
|
|
34884
34872
|
|
|
@@ -34886,22 +34874,22 @@ let Easing = {
|
|
|
34886
34874
|
|
|
34887
34875
|
Cubic: {
|
|
34888
34876
|
/** @ignore */
|
|
34889
|
-
In: function (
|
|
34877
|
+
In: function (k) {
|
|
34890
34878
|
|
|
34891
34879
|
return k * k * k;
|
|
34892
34880
|
|
|
34893
34881
|
},
|
|
34894
34882
|
/** @ignore */
|
|
34895
|
-
Out: function (
|
|
34883
|
+
Out: function (k) {
|
|
34896
34884
|
|
|
34897
34885
|
return --k * k * k + 1;
|
|
34898
34886
|
|
|
34899
34887
|
},
|
|
34900
34888
|
/** @ignore */
|
|
34901
|
-
InOut: function (
|
|
34889
|
+
InOut: function (k) {
|
|
34902
34890
|
|
|
34903
|
-
if (
|
|
34904
|
-
return 0.5 * (
|
|
34891
|
+
if ((k *= 2) < 1) return 0.5 * k * k * k;
|
|
34892
|
+
return 0.5 * ((k -= 2) * k * k + 2);
|
|
34905
34893
|
|
|
34906
34894
|
}
|
|
34907
34895
|
|
|
@@ -34909,22 +34897,22 @@ let Easing = {
|
|
|
34909
34897
|
|
|
34910
34898
|
Quartic: {
|
|
34911
34899
|
/** @ignore */
|
|
34912
|
-
In: function (
|
|
34900
|
+
In: function (k) {
|
|
34913
34901
|
|
|
34914
34902
|
return k * k * k * k;
|
|
34915
34903
|
|
|
34916
34904
|
},
|
|
34917
34905
|
/** @ignore */
|
|
34918
|
-
Out: function (
|
|
34906
|
+
Out: function (k) {
|
|
34919
34907
|
|
|
34920
|
-
return 1 - (
|
|
34908
|
+
return 1 - (--k * k * k * k);
|
|
34921
34909
|
|
|
34922
34910
|
},
|
|
34923
34911
|
/** @ignore */
|
|
34924
|
-
InOut: function (
|
|
34912
|
+
InOut: function (k) {
|
|
34925
34913
|
|
|
34926
|
-
if (
|
|
34927
|
-
return - 0.5 * (
|
|
34914
|
+
if ((k *= 2) < 1) return 0.5 * k * k * k * k;
|
|
34915
|
+
return - 0.5 * ((k -= 2) * k * k * k - 2);
|
|
34928
34916
|
|
|
34929
34917
|
}
|
|
34930
34918
|
|
|
@@ -34932,22 +34920,22 @@ let Easing = {
|
|
|
34932
34920
|
|
|
34933
34921
|
Quintic: {
|
|
34934
34922
|
/** @ignore */
|
|
34935
|
-
In: function (
|
|
34923
|
+
In: function (k) {
|
|
34936
34924
|
|
|
34937
34925
|
return k * k * k * k * k;
|
|
34938
34926
|
|
|
34939
34927
|
},
|
|
34940
34928
|
/** @ignore */
|
|
34941
|
-
Out: function (
|
|
34929
|
+
Out: function (k) {
|
|
34942
34930
|
|
|
34943
34931
|
return --k * k * k * k * k + 1;
|
|
34944
34932
|
|
|
34945
34933
|
},
|
|
34946
34934
|
/** @ignore */
|
|
34947
|
-
InOut: function (
|
|
34935
|
+
InOut: function (k) {
|
|
34948
34936
|
|
|
34949
|
-
if (
|
|
34950
|
-
return 0.5 * (
|
|
34937
|
+
if ((k *= 2) < 1) return 0.5 * k * k * k * k * k;
|
|
34938
|
+
return 0.5 * ((k -= 2) * k * k * k * k + 2);
|
|
34951
34939
|
|
|
34952
34940
|
}
|
|
34953
34941
|
|
|
@@ -34955,21 +34943,21 @@ let Easing = {
|
|
|
34955
34943
|
|
|
34956
34944
|
Sinusoidal: {
|
|
34957
34945
|
/** @ignore */
|
|
34958
|
-
In: function (
|
|
34946
|
+
In: function (k) {
|
|
34959
34947
|
|
|
34960
|
-
return 1 - Math.cos(
|
|
34948
|
+
return 1 - Math.cos(k * Math.PI / 2);
|
|
34961
34949
|
|
|
34962
34950
|
},
|
|
34963
34951
|
/** @ignore */
|
|
34964
|
-
Out: function (
|
|
34952
|
+
Out: function (k) {
|
|
34965
34953
|
|
|
34966
|
-
return Math.sin(
|
|
34954
|
+
return Math.sin(k * Math.PI / 2);
|
|
34967
34955
|
|
|
34968
34956
|
},
|
|
34969
34957
|
/** @ignore */
|
|
34970
|
-
InOut: function (
|
|
34958
|
+
InOut: function (k) {
|
|
34971
34959
|
|
|
34972
|
-
return 0.5 * (
|
|
34960
|
+
return 0.5 * (1 - Math.cos(Math.PI * k));
|
|
34973
34961
|
|
|
34974
34962
|
}
|
|
34975
34963
|
|
|
@@ -34977,24 +34965,24 @@ let Easing = {
|
|
|
34977
34965
|
|
|
34978
34966
|
Exponential: {
|
|
34979
34967
|
/** @ignore */
|
|
34980
|
-
In: function (
|
|
34968
|
+
In: function (k) {
|
|
34981
34969
|
|
|
34982
|
-
return k === 0 ? 0 : Math.pow(
|
|
34970
|
+
return k === 0 ? 0 : Math.pow(1024, k - 1);
|
|
34983
34971
|
|
|
34984
34972
|
},
|
|
34985
34973
|
/** @ignore */
|
|
34986
|
-
Out: function (
|
|
34974
|
+
Out: function (k) {
|
|
34987
34975
|
|
|
34988
|
-
return k === 1 ? 1 : 1 - Math.pow(
|
|
34976
|
+
return k === 1 ? 1 : 1 - Math.pow(2, - 10 * k);
|
|
34989
34977
|
|
|
34990
34978
|
},
|
|
34991
34979
|
/** @ignore */
|
|
34992
|
-
InOut: function (
|
|
34980
|
+
InOut: function (k) {
|
|
34993
34981
|
|
|
34994
|
-
if (
|
|
34995
|
-
if (
|
|
34996
|
-
if (
|
|
34997
|
-
return 0.5 * (
|
|
34982
|
+
if (k === 0) return 0;
|
|
34983
|
+
if (k === 1) return 1;
|
|
34984
|
+
if ((k *= 2) < 1) return 0.5 * Math.pow(1024, k - 1);
|
|
34985
|
+
return 0.5 * (- Math.pow(2, - 10 * (k - 1)) + 2);
|
|
34998
34986
|
|
|
34999
34987
|
}
|
|
35000
34988
|
|
|
@@ -35002,22 +34990,22 @@ let Easing = {
|
|
|
35002
34990
|
|
|
35003
34991
|
Circular: {
|
|
35004
34992
|
/** @ignore */
|
|
35005
|
-
In: function (
|
|
34993
|
+
In: function (k) {
|
|
35006
34994
|
|
|
35007
|
-
return 1 - Math.sqrt(
|
|
34995
|
+
return 1 - Math.sqrt(1 - k * k);
|
|
35008
34996
|
|
|
35009
34997
|
},
|
|
35010
34998
|
/** @ignore */
|
|
35011
|
-
Out: function (
|
|
34999
|
+
Out: function (k) {
|
|
35012
35000
|
|
|
35013
|
-
return Math.sqrt(
|
|
35001
|
+
return Math.sqrt(1 - (--k * k));
|
|
35014
35002
|
|
|
35015
35003
|
},
|
|
35016
35004
|
/** @ignore */
|
|
35017
|
-
InOut: function (
|
|
35005
|
+
InOut: function (k) {
|
|
35018
35006
|
|
|
35019
|
-
if (
|
|
35020
|
-
return 0.5 * (
|
|
35007
|
+
if ((k *= 2) < 1) return - 0.5 * (Math.sqrt(1 - k * k) - 1);
|
|
35008
|
+
return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
|
|
35021
35009
|
|
|
35022
35010
|
}
|
|
35023
35011
|
|
|
@@ -35025,7 +35013,7 @@ let Easing = {
|
|
|
35025
35013
|
|
|
35026
35014
|
Elastic: {
|
|
35027
35015
|
/** @ignore */
|
|
35028
|
-
In: function (
|
|
35016
|
+
In: function (k) {
|
|
35029
35017
|
if (k === 0) {
|
|
35030
35018
|
return 0;
|
|
35031
35019
|
}
|
|
@@ -35035,7 +35023,7 @@ let Easing = {
|
|
|
35035
35023
|
return -Math.pow(2, 10 * (k - 1)) * Math.sin((k - 1.1) * 5 * Math.PI);
|
|
35036
35024
|
},
|
|
35037
35025
|
/** @ignore */
|
|
35038
|
-
Out: function (
|
|
35026
|
+
Out: function (k) {
|
|
35039
35027
|
if (k === 0) {
|
|
35040
35028
|
return 0;
|
|
35041
35029
|
}
|
|
@@ -35046,7 +35034,7 @@ let Easing = {
|
|
|
35046
35034
|
|
|
35047
35035
|
},
|
|
35048
35036
|
/** @ignore */
|
|
35049
|
-
InOut: function (
|
|
35037
|
+
InOut: function (k) {
|
|
35050
35038
|
if (k === 0) {
|
|
35051
35039
|
return 0;
|
|
35052
35040
|
}
|
|
@@ -35064,25 +35052,25 @@ let Easing = {
|
|
|
35064
35052
|
|
|
35065
35053
|
Back: {
|
|
35066
35054
|
/** @ignore */
|
|
35067
|
-
In: function (
|
|
35055
|
+
In: function (k) {
|
|
35068
35056
|
|
|
35069
35057
|
const s = 1.70158;
|
|
35070
|
-
return k * k * (
|
|
35058
|
+
return k * k * ((s + 1) * k - s);
|
|
35071
35059
|
|
|
35072
35060
|
},
|
|
35073
35061
|
/** @ignore */
|
|
35074
|
-
Out: function (
|
|
35062
|
+
Out: function (k) {
|
|
35075
35063
|
|
|
35076
35064
|
const s = 1.70158;
|
|
35077
|
-
return --k * k * (
|
|
35065
|
+
return --k * k * ((s + 1) * k + s) + 1;
|
|
35078
35066
|
|
|
35079
35067
|
},
|
|
35080
35068
|
/** @ignore */
|
|
35081
|
-
InOut: function (
|
|
35069
|
+
InOut: function (k) {
|
|
35082
35070
|
|
|
35083
35071
|
const s = 1.70158 * 1.525;
|
|
35084
|
-
if (
|
|
35085
|
-
return 0.5 * (
|
|
35072
|
+
if ((k *= 2) < 1) return 0.5 * (k * k * ((s + 1) * k - s));
|
|
35073
|
+
return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
|
|
35086
35074
|
|
|
35087
35075
|
}
|
|
35088
35076
|
|
|
@@ -35090,38 +35078,38 @@ let Easing = {
|
|
|
35090
35078
|
|
|
35091
35079
|
Bounce: {
|
|
35092
35080
|
/** @ignore */
|
|
35093
|
-
In: function (
|
|
35081
|
+
In: function (k) {
|
|
35094
35082
|
|
|
35095
|
-
return 1 - Easing.Bounce.Out(
|
|
35083
|
+
return 1 - Easing.Bounce.Out(1 - k);
|
|
35096
35084
|
|
|
35097
35085
|
},
|
|
35098
35086
|
/** @ignore */
|
|
35099
|
-
Out: function (
|
|
35087
|
+
Out: function (k) {
|
|
35100
35088
|
|
|
35101
|
-
if (
|
|
35089
|
+
if (k < (1 / 2.75)) {
|
|
35102
35090
|
|
|
35103
35091
|
return 7.5625 * k * k;
|
|
35104
35092
|
|
|
35105
|
-
} else if (
|
|
35093
|
+
} else if (k < (2 / 2.75)) {
|
|
35106
35094
|
|
|
35107
|
-
return 7.5625 * (
|
|
35095
|
+
return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
|
|
35108
35096
|
|
|
35109
|
-
} else if (
|
|
35097
|
+
} else if (k < (2.5 / 2.75)) {
|
|
35110
35098
|
|
|
35111
|
-
return 7.5625 * (
|
|
35099
|
+
return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
|
|
35112
35100
|
|
|
35113
35101
|
} else {
|
|
35114
35102
|
|
|
35115
|
-
return 7.5625 * (
|
|
35103
|
+
return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
|
|
35116
35104
|
|
|
35117
35105
|
}
|
|
35118
35106
|
|
|
35119
35107
|
},
|
|
35120
35108
|
/** @ignore */
|
|
35121
|
-
InOut: function (
|
|
35109
|
+
InOut: function (k) {
|
|
35122
35110
|
|
|
35123
|
-
if (
|
|
35124
|
-
return Easing.Bounce.Out(
|
|
35111
|
+
if (k < 0.5) return Easing.Bounce.In(k * 2) * 0.5;
|
|
35112
|
+
return Easing.Bounce.Out(k * 2 - 1) * 0.5 + 0.5;
|
|
35125
35113
|
|
|
35126
35114
|
}
|
|
35127
35115
|
|
|
@@ -35149,45 +35137,45 @@ let Easing = {
|
|
|
35149
35137
|
*/
|
|
35150
35138
|
let Interpolation = {
|
|
35151
35139
|
/** @ignore */
|
|
35152
|
-
Linear: function (
|
|
35140
|
+
Linear: function (v, k) {
|
|
35153
35141
|
|
|
35154
|
-
let m = v.length - 1, f = m * k, i = Math.floor(
|
|
35142
|
+
let m = v.length - 1, f = m * k, i = Math.floor(f), fn = Interpolation.Utils.Linear;
|
|
35155
35143
|
|
|
35156
|
-
if (
|
|
35157
|
-
if (
|
|
35144
|
+
if (k < 0) return fn(v[ 0 ], v[ 1 ], f);
|
|
35145
|
+
if (k > 1) return fn(v[ m ], v[ m - 1 ], m - f);
|
|
35158
35146
|
|
|
35159
|
-
return fn(
|
|
35147
|
+
return fn(v[ i ], v[ i + 1 > m ? m : i + 1 ], f - i);
|
|
35160
35148
|
|
|
35161
35149
|
},
|
|
35162
35150
|
/** @ignore */
|
|
35163
|
-
Bezier: function (
|
|
35151
|
+
Bezier: function (v, k) {
|
|
35164
35152
|
|
|
35165
35153
|
let b = 0, n = v.length - 1, pw = Math.pow, bn = Interpolation.Utils.Bernstein, i;
|
|
35166
35154
|
|
|
35167
|
-
for (
|
|
35168
|
-
b += pw(
|
|
35155
|
+
for (i = 0; i <= n; i++) {
|
|
35156
|
+
b += pw(1 - k, n - i) * pw(k, i) * v[ i ] * bn(n, i);
|
|
35169
35157
|
}
|
|
35170
35158
|
|
|
35171
35159
|
return b;
|
|
35172
35160
|
|
|
35173
35161
|
},
|
|
35174
35162
|
/** @ignore */
|
|
35175
|
-
CatmullRom: function (
|
|
35163
|
+
CatmullRom: function (v, k) {
|
|
35176
35164
|
|
|
35177
|
-
let m = v.length - 1, f = m * k, i = Math.floor(
|
|
35165
|
+
let m = v.length - 1, f = m * k, i = Math.floor(f), fn = Interpolation.Utils.CatmullRom;
|
|
35178
35166
|
|
|
35179
|
-
if (
|
|
35167
|
+
if (v[ 0 ] === v[ m ]) {
|
|
35180
35168
|
|
|
35181
|
-
if (
|
|
35169
|
+
if (k < 0) i = Math.floor(f = m * (1 + k));
|
|
35182
35170
|
|
|
35183
|
-
return fn(
|
|
35171
|
+
return fn(v[ (i - 1 + m) % m ], v[ i ], v[ (i + 1) % m ], v[ (i + 2) % m ], f - i);
|
|
35184
35172
|
|
|
35185
35173
|
} else {
|
|
35186
35174
|
|
|
35187
|
-
if (
|
|
35188
|
-
if (
|
|
35175
|
+
if (k < 0) return v[ 0 ] - (fn(v[ 0 ], v[ 0 ], v[ 1 ], v[ 1 ], -f) - v[ 0 ]);
|
|
35176
|
+
if (k > 1) return v[ m ] - (fn(v[ m ], v[ m ], v[ m - 1 ], v[ m - 1 ], f - m) - v[ m ]);
|
|
35189
35177
|
|
|
35190
|
-
return fn(
|
|
35178
|
+
return fn(v[ i ? i - 1 : 0 ], v[ i ], v[ m < i + 1 ? m : i + 1 ], v[ m < i + 2 ? m : i + 2 ], f - i);
|
|
35191
35179
|
|
|
35192
35180
|
}
|
|
35193
35181
|
|
|
@@ -35195,39 +35183,39 @@ let Interpolation = {
|
|
|
35195
35183
|
|
|
35196
35184
|
Utils: {
|
|
35197
35185
|
/** @ignore */
|
|
35198
|
-
Linear: function (
|
|
35186
|
+
Linear: function (p0, p1, t) {
|
|
35199
35187
|
|
|
35200
|
-
return (
|
|
35188
|
+
return (p1 - p0) * t + p0;
|
|
35201
35189
|
|
|
35202
35190
|
},
|
|
35203
35191
|
/** @ignore */
|
|
35204
|
-
Bernstein: function (
|
|
35192
|
+
Bernstein: function (n, i) {
|
|
35205
35193
|
|
|
35206
35194
|
let fc = Interpolation.Utils.Factorial;
|
|
35207
|
-
return fc(
|
|
35195
|
+
return fc(n) / fc(i) / fc(n - i);
|
|
35208
35196
|
|
|
35209
35197
|
},
|
|
35210
35198
|
/* @ignore */
|
|
35211
|
-
Factorial: (
|
|
35199
|
+
Factorial: (function () {
|
|
35212
35200
|
|
|
35213
35201
|
let a = [ 1 ];
|
|
35214
35202
|
|
|
35215
|
-
return function (
|
|
35203
|
+
return function (n) {
|
|
35216
35204
|
|
|
35217
35205
|
let s = 1, i;
|
|
35218
|
-
if (
|
|
35219
|
-
for (
|
|
35206
|
+
if (a[ n ]) return a[ n ];
|
|
35207
|
+
for (i = n; i > 1; i--) s *= i;
|
|
35220
35208
|
a[ n ] = s;
|
|
35221
35209
|
return s;
|
|
35222
35210
|
|
|
35223
35211
|
};
|
|
35224
35212
|
|
|
35225
|
-
}
|
|
35213
|
+
})(),
|
|
35226
35214
|
/** @ignore */
|
|
35227
|
-
CatmullRom: function (
|
|
35215
|
+
CatmullRom: function (p0, p1, p2, p3, t) {
|
|
35228
35216
|
|
|
35229
|
-
let v0 = (
|
|
35230
|
-
return (
|
|
35217
|
+
let v0 = (p2 - p0) * 0.5, v1 = (p3 - p1) * 0.5, t2 = t * t, t3 = t * t2;
|
|
35218
|
+
return (2 * p1 - 2 * p2 + v0 + v1) * t3 + (- 3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 + v0 * t + p1;
|
|
35231
35219
|
}
|
|
35232
35220
|
}
|
|
35233
35221
|
|
|
@@ -35267,7 +35255,7 @@ class Tween {
|
|
|
35267
35255
|
* autoStart : true
|
|
35268
35256
|
* }).onComplete(myFunc);
|
|
35269
35257
|
*/
|
|
35270
|
-
constructor (
|
|
35258
|
+
constructor (object) {
|
|
35271
35259
|
this.setProperties(object);
|
|
35272
35260
|
}
|
|
35273
35261
|
|
|
@@ -35275,7 +35263,7 @@ class Tween {
|
|
|
35275
35263
|
* reset the tween object to default value
|
|
35276
35264
|
* @ignore
|
|
35277
35265
|
*/
|
|
35278
|
-
onResetEvent(
|
|
35266
|
+
onResetEvent(object) {
|
|
35279
35267
|
this.setProperties(object);
|
|
35280
35268
|
}
|
|
35281
35269
|
|
|
@@ -35311,7 +35299,7 @@ class Tween {
|
|
|
35311
35299
|
this.isRenderable = false;
|
|
35312
35300
|
|
|
35313
35301
|
// Set all starting values present on the target object
|
|
35314
|
-
for (
|
|
35302
|
+
for (let field in object) {
|
|
35315
35303
|
if (typeof object !== "object") {
|
|
35316
35304
|
this._valuesStart[ field ] = parseFloat(object[field]);
|
|
35317
35305
|
}
|
|
@@ -35361,7 +35349,7 @@ class Tween {
|
|
|
35361
35349
|
* @param {boolean} [options.autoStart] - allow this tween to start automatically. Otherwise call me.Tween.start().
|
|
35362
35350
|
* @returns {Tween} this instance for object chaining
|
|
35363
35351
|
*/
|
|
35364
|
-
to(
|
|
35352
|
+
to(properties, options) {
|
|
35365
35353
|
|
|
35366
35354
|
this._valuesEnd = properties;
|
|
35367
35355
|
|
|
@@ -35394,7 +35382,7 @@ class Tween {
|
|
|
35394
35382
|
* @param {number} [time] - the current time when the tween was started
|
|
35395
35383
|
* @returns {Tween} this instance for object chaining
|
|
35396
35384
|
*/
|
|
35397
|
-
start(
|
|
35385
|
+
start(time = timer.getTime()) {
|
|
35398
35386
|
|
|
35399
35387
|
this._onStartCallbackFired = false;
|
|
35400
35388
|
|
|
@@ -35403,25 +35391,25 @@ class Tween {
|
|
|
35403
35391
|
|
|
35404
35392
|
this._startTime = time + this._delayTime;
|
|
35405
35393
|
|
|
35406
|
-
for (
|
|
35394
|
+
for (let property in this._valuesEnd) {
|
|
35407
35395
|
|
|
35408
35396
|
// check if an Array was provided as property value
|
|
35409
|
-
if (
|
|
35397
|
+
if (this._valuesEnd[ property ] instanceof Array) {
|
|
35410
35398
|
|
|
35411
|
-
if (
|
|
35399
|
+
if (this._valuesEnd[ property ].length === 0) {
|
|
35412
35400
|
|
|
35413
35401
|
continue;
|
|
35414
35402
|
|
|
35415
35403
|
}
|
|
35416
35404
|
|
|
35417
35405
|
// create a local copy of the Array with the start value at the front
|
|
35418
|
-
this._valuesEnd[ property ] = [ this._object[ property ] ].concat(
|
|
35406
|
+
this._valuesEnd[ property ] = [ this._object[ property ] ].concat(this._valuesEnd[ property ]);
|
|
35419
35407
|
|
|
35420
35408
|
}
|
|
35421
35409
|
|
|
35422
35410
|
this._valuesStart[ property ] = this._object[ property ];
|
|
35423
35411
|
|
|
35424
|
-
if (
|
|
35412
|
+
if ((this._valuesStart[ property ] instanceof Array) === false) {
|
|
35425
35413
|
this._valuesStart[ property ] *= 1.0; // Ensures we're using numbers, not strings
|
|
35426
35414
|
}
|
|
35427
35415
|
|
|
@@ -35453,7 +35441,7 @@ class Tween {
|
|
|
35453
35441
|
* @param {number} amount - delay amount expressed in milliseconds
|
|
35454
35442
|
* @returns {Tween} this instance for object chaining
|
|
35455
35443
|
*/
|
|
35456
|
-
delay(
|
|
35444
|
+
delay(amount) {
|
|
35457
35445
|
|
|
35458
35446
|
this._delayTime = amount;
|
|
35459
35447
|
return this;
|
|
@@ -35468,7 +35456,7 @@ class Tween {
|
|
|
35468
35456
|
* @param {number} times - amount of times the tween should be repeated
|
|
35469
35457
|
* @returns {Tween} this instance for object chaining
|
|
35470
35458
|
*/
|
|
35471
|
-
repeat(
|
|
35459
|
+
repeat(times) {
|
|
35472
35460
|
|
|
35473
35461
|
this._repeat = times;
|
|
35474
35462
|
return this;
|
|
@@ -35485,7 +35473,7 @@ class Tween {
|
|
|
35485
35473
|
* @param {boolean} yoyo
|
|
35486
35474
|
* @returns {Tween} this instance for object chaining
|
|
35487
35475
|
*/
|
|
35488
|
-
yoyo(
|
|
35476
|
+
yoyo(yoyo) {
|
|
35489
35477
|
|
|
35490
35478
|
this._yoyo = yoyo;
|
|
35491
35479
|
return this;
|
|
@@ -35500,7 +35488,7 @@ class Tween {
|
|
|
35500
35488
|
* @param {Tween.Easing} easing - easing function
|
|
35501
35489
|
* @returns {Tween} this instance for object chaining
|
|
35502
35490
|
*/
|
|
35503
|
-
easing(
|
|
35491
|
+
easing(easing) {
|
|
35504
35492
|
if (typeof easing !== "function") {
|
|
35505
35493
|
throw new Error("invalid easing function for me.Tween.easing()");
|
|
35506
35494
|
}
|
|
@@ -35516,7 +35504,7 @@ class Tween {
|
|
|
35516
35504
|
* @param {Tween.Interpolation} interpolation - interpolation function
|
|
35517
35505
|
* @returns {Tween} this instance for object chaining
|
|
35518
35506
|
*/
|
|
35519
|
-
interpolation(
|
|
35507
|
+
interpolation(interpolation) {
|
|
35520
35508
|
this._interpolationFunction = interpolation;
|
|
35521
35509
|
return this;
|
|
35522
35510
|
}
|
|
@@ -35542,7 +35530,7 @@ class Tween {
|
|
|
35542
35530
|
* @param {Function} onStartCallback - callback
|
|
35543
35531
|
* @returns {Tween} this instance for object chaining
|
|
35544
35532
|
*/
|
|
35545
|
-
onStart(
|
|
35533
|
+
onStart(onStartCallback) {
|
|
35546
35534
|
this._onStartCallback = onStartCallback;
|
|
35547
35535
|
return this;
|
|
35548
35536
|
}
|
|
@@ -35555,7 +35543,7 @@ class Tween {
|
|
|
35555
35543
|
* @param {Function} onUpdateCallback - callback
|
|
35556
35544
|
* @returns {Tween} this instance for object chaining
|
|
35557
35545
|
*/
|
|
35558
|
-
onUpdate(
|
|
35546
|
+
onUpdate(onUpdateCallback) {
|
|
35559
35547
|
this._onUpdateCallback = onUpdateCallback;
|
|
35560
35548
|
return this;
|
|
35561
35549
|
}
|
|
@@ -35568,13 +35556,13 @@ class Tween {
|
|
|
35568
35556
|
* @param {Function} onCompleteCallback - callback
|
|
35569
35557
|
* @returns {Tween} this instance for object chaining
|
|
35570
35558
|
*/
|
|
35571
|
-
onComplete(
|
|
35559
|
+
onComplete(onCompleteCallback) {
|
|
35572
35560
|
this._onCompleteCallback = onCompleteCallback;
|
|
35573
35561
|
return this;
|
|
35574
35562
|
}
|
|
35575
35563
|
|
|
35576
35564
|
/** @ignore */
|
|
35577
|
-
update(
|
|
35565
|
+
update(dt) {
|
|
35578
35566
|
|
|
35579
35567
|
// the original Tween implementation expect
|
|
35580
35568
|
// a timestamp and not a time delta
|
|
@@ -35583,17 +35571,17 @@ class Tween {
|
|
|
35583
35571
|
|
|
35584
35572
|
let property;
|
|
35585
35573
|
|
|
35586
|
-
if (
|
|
35574
|
+
if (time < this._startTime) {
|
|
35587
35575
|
|
|
35588
35576
|
return true;
|
|
35589
35577
|
|
|
35590
35578
|
}
|
|
35591
35579
|
|
|
35592
|
-
if (
|
|
35580
|
+
if (this._onStartCallbackFired === false) {
|
|
35593
35581
|
|
|
35594
|
-
if (
|
|
35582
|
+
if (this._onStartCallback !== null) {
|
|
35595
35583
|
|
|
35596
|
-
this._onStartCallback.call(
|
|
35584
|
+
this._onStartCallback.call(this._object);
|
|
35597
35585
|
|
|
35598
35586
|
}
|
|
35599
35587
|
|
|
@@ -35601,54 +35589,54 @@ class Tween {
|
|
|
35601
35589
|
|
|
35602
35590
|
}
|
|
35603
35591
|
|
|
35604
|
-
let elapsed = (
|
|
35592
|
+
let elapsed = (time - this._startTime) / this._duration;
|
|
35605
35593
|
elapsed = elapsed > 1 ? 1 : elapsed;
|
|
35606
35594
|
|
|
35607
|
-
let value = this._easingFunction(
|
|
35595
|
+
let value = this._easingFunction(elapsed);
|
|
35608
35596
|
|
|
35609
|
-
for (
|
|
35597
|
+
for (property in this._valuesEnd) {
|
|
35610
35598
|
|
|
35611
35599
|
let start = this._valuesStart[ property ] || 0;
|
|
35612
35600
|
let end = this._valuesEnd[ property ];
|
|
35613
35601
|
|
|
35614
|
-
if (
|
|
35602
|
+
if (end instanceof Array) {
|
|
35615
35603
|
|
|
35616
|
-
this._object[ property ] = this._interpolationFunction(
|
|
35604
|
+
this._object[ property ] = this._interpolationFunction(end, value);
|
|
35617
35605
|
|
|
35618
35606
|
} else {
|
|
35619
35607
|
|
|
35620
35608
|
// Parses relative end values with start as base (e.g.: +10, -3)
|
|
35621
|
-
if (
|
|
35609
|
+
if (typeof(end) === "string") {
|
|
35622
35610
|
end = start + parseFloat(end);
|
|
35623
35611
|
}
|
|
35624
35612
|
|
|
35625
35613
|
// protect against non numeric properties.
|
|
35626
|
-
if (
|
|
35627
|
-
this._object[ property ] = start + (
|
|
35614
|
+
if (typeof(end) === "number") {
|
|
35615
|
+
this._object[ property ] = start + (end - start) * value;
|
|
35628
35616
|
}
|
|
35629
35617
|
|
|
35630
35618
|
}
|
|
35631
35619
|
|
|
35632
35620
|
}
|
|
35633
35621
|
|
|
35634
|
-
if (
|
|
35622
|
+
if (this._onUpdateCallback !== null) {
|
|
35635
35623
|
|
|
35636
|
-
this._onUpdateCallback.call(
|
|
35624
|
+
this._onUpdateCallback.call(this._object, value);
|
|
35637
35625
|
|
|
35638
35626
|
}
|
|
35639
35627
|
|
|
35640
|
-
if (
|
|
35628
|
+
if (elapsed === 1) {
|
|
35641
35629
|
|
|
35642
|
-
if (
|
|
35630
|
+
if (this._repeat > 0) {
|
|
35643
35631
|
|
|
35644
|
-
if (
|
|
35632
|
+
if (isFinite(this._repeat)) {
|
|
35645
35633
|
this._repeat--;
|
|
35646
35634
|
}
|
|
35647
35635
|
|
|
35648
35636
|
// reassign starting values, restart by making startTime = now
|
|
35649
|
-
for (
|
|
35637
|
+
for (property in this._valuesStartRepeat) {
|
|
35650
35638
|
|
|
35651
|
-
if (
|
|
35639
|
+
if (typeof(this._valuesEnd[ property ]) === "string") {
|
|
35652
35640
|
this._valuesStartRepeat[ property ] = this._valuesStartRepeat[ property ] + parseFloat(this._valuesEnd[ property ]);
|
|
35653
35641
|
}
|
|
35654
35642
|
|
|
@@ -35673,15 +35661,15 @@ class Tween {
|
|
|
35673
35661
|
// remove the tween from the world container
|
|
35674
35662
|
game.world.removeChildNow(this);
|
|
35675
35663
|
|
|
35676
|
-
if (
|
|
35664
|
+
if (this._onCompleteCallback !== null) {
|
|
35677
35665
|
|
|
35678
|
-
this._onCompleteCallback.call(
|
|
35666
|
+
this._onCompleteCallback.call(this._object);
|
|
35679
35667
|
|
|
35680
35668
|
}
|
|
35681
35669
|
|
|
35682
|
-
for (
|
|
35670
|
+
for (let i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i ++) {
|
|
35683
35671
|
|
|
35684
|
-
this._chainedTweens[ i ].start(
|
|
35672
|
+
this._chainedTweens[ i ].start(time);
|
|
35685
35673
|
|
|
35686
35674
|
}
|
|
35687
35675
|
|
|
@@ -36519,13 +36507,13 @@ class WebGLRenderer extends Renderer {
|
|
|
36519
36507
|
e.preventDefault();
|
|
36520
36508
|
this.isContextValid = false;
|
|
36521
36509
|
emit(ONCONTEXT_LOST, this);
|
|
36522
|
-
}, false
|
|
36510
|
+
}, false);
|
|
36523
36511
|
// ctx.restoreContext()
|
|
36524
36512
|
this.getCanvas().addEventListener("webglcontextrestored", () => {
|
|
36525
36513
|
this.reset();
|
|
36526
36514
|
this.isContextValid = true;
|
|
36527
36515
|
emit(ONCONTEXT_RESTORED, this);
|
|
36528
|
-
}, false
|
|
36516
|
+
}, false);
|
|
36529
36517
|
|
|
36530
36518
|
// reset the renderer on game reset
|
|
36531
36519
|
on(GAME_RESET, () => {
|
|
@@ -37050,12 +37038,13 @@ class WebGLRenderer extends Renderer {
|
|
|
37050
37038
|
// FIXME : prevent `scissor` object realloc and GC
|
|
37051
37039
|
this.currentScissor.set(this._scissorStack.pop());
|
|
37052
37040
|
} else {
|
|
37041
|
+
const canvas = this.getCanvas();
|
|
37053
37042
|
// turn off scissor test
|
|
37054
37043
|
this.gl.disable(this.gl.SCISSOR_TEST);
|
|
37055
37044
|
this.currentScissor[0] = 0;
|
|
37056
37045
|
this.currentScissor[1] = 0;
|
|
37057
|
-
this.currentScissor[2] =
|
|
37058
|
-
this.currentScissor[3] =
|
|
37046
|
+
this.currentScissor[2] = canvas.width;
|
|
37047
|
+
this.currentScissor[3] = canvas.height;
|
|
37059
37048
|
}
|
|
37060
37049
|
}
|
|
37061
37050
|
|
|
@@ -37260,7 +37249,7 @@ class WebGLRenderer extends Renderer {
|
|
|
37260
37249
|
this.path2D.beginPath();
|
|
37261
37250
|
for (let i = 0; i < len - 1; i++) {
|
|
37262
37251
|
const curPoint = points[i];
|
|
37263
|
-
const nextPoint = points[i+1];
|
|
37252
|
+
const nextPoint = points[i + 1];
|
|
37264
37253
|
this.path2D.moveTo(curPoint.x, curPoint.y);
|
|
37265
37254
|
this.path2D.lineTo(nextPoint.x, nextPoint.y);
|
|
37266
37255
|
}
|
|
@@ -37452,7 +37441,7 @@ class WebGLRenderer extends Renderer {
|
|
|
37452
37441
|
gl.scissor(
|
|
37453
37442
|
// scissor does not account for currentTransform, so manually adjust
|
|
37454
37443
|
x + this.currentTransform.tx,
|
|
37455
|
-
canvas.height -height -y -this.currentTransform.ty,
|
|
37444
|
+
canvas.height - height - y - this.currentTransform.ty,
|
|
37456
37445
|
width,
|
|
37457
37446
|
height
|
|
37458
37447
|
);
|
|
@@ -38184,8 +38173,8 @@ class UIBaseElement extends Container {
|
|
|
38184
38173
|
this.isDirty = true;
|
|
38185
38174
|
this.released = false;
|
|
38186
38175
|
if (this.isHoldable) {
|
|
38187
|
-
timer
|
|
38188
|
-
this.holdTimeout = timer
|
|
38176
|
+
timer.clearTimeout(this.holdTimeout);
|
|
38177
|
+
this.holdTimeout = timer.setTimeout(
|
|
38189
38178
|
() => this.hold(),
|
|
38190
38179
|
this.holdThreshold,
|
|
38191
38180
|
false
|
|
@@ -38288,7 +38277,7 @@ class UIBaseElement extends Container {
|
|
|
38288
38277
|
if (this.released === false) {
|
|
38289
38278
|
this.released = true;
|
|
38290
38279
|
this.isDirty = true;
|
|
38291
|
-
timer
|
|
38280
|
+
timer.clearTimeout(this.holdTimeout);
|
|
38292
38281
|
this.holdTimeout = -1;
|
|
38293
38282
|
return this.onRelease(event);
|
|
38294
38283
|
}
|
|
@@ -38307,7 +38296,7 @@ class UIBaseElement extends Container {
|
|
|
38307
38296
|
* @ignore
|
|
38308
38297
|
*/
|
|
38309
38298
|
hold() {
|
|
38310
|
-
timer
|
|
38299
|
+
timer.clearTimeout(this.holdTimeout);
|
|
38311
38300
|
this.holdTimeout = -1;
|
|
38312
38301
|
this.isDirty = true;
|
|
38313
38302
|
if (!this.released) {
|
|
@@ -38348,7 +38337,7 @@ class UIBaseElement extends Container {
|
|
|
38348
38337
|
releasePointerEvent("pointercancel", this);
|
|
38349
38338
|
releasePointerEvent("pointerenter", this);
|
|
38350
38339
|
releasePointerEvent("pointerleave", this);
|
|
38351
|
-
timer
|
|
38340
|
+
timer.clearTimeout(this.holdTimeout);
|
|
38352
38341
|
this.holdTimeout = -1;
|
|
38353
38342
|
|
|
38354
38343
|
// unregister on the global pointermove event
|
|
@@ -39594,8 +39583,8 @@ class UISpriteElement extends Sprite {
|
|
|
39594
39583
|
this.isDirty = true;
|
|
39595
39584
|
this.released = false;
|
|
39596
39585
|
if (this.isHoldable) {
|
|
39597
|
-
timer
|
|
39598
|
-
this.holdTimeout = timer
|
|
39586
|
+
timer.clearTimeout(this.holdTimeout);
|
|
39587
|
+
this.holdTimeout = timer.setTimeout(() => this.hold(), this.holdThreshold, false);
|
|
39599
39588
|
this.released = false;
|
|
39600
39589
|
}
|
|
39601
39590
|
return this.onClick(event);
|
|
@@ -39656,7 +39645,7 @@ class UISpriteElement extends Sprite {
|
|
|
39656
39645
|
if (this.released === false) {
|
|
39657
39646
|
this.released = true;
|
|
39658
39647
|
this.isDirty = true;
|
|
39659
|
-
timer
|
|
39648
|
+
timer.clearTimeout(this.holdTimeout);
|
|
39660
39649
|
this.holdTimeout = -1;
|
|
39661
39650
|
return this.onRelease(event);
|
|
39662
39651
|
}
|
|
@@ -39675,7 +39664,7 @@ class UISpriteElement extends Sprite {
|
|
|
39675
39664
|
* @ignore
|
|
39676
39665
|
*/
|
|
39677
39666
|
hold() {
|
|
39678
|
-
timer
|
|
39667
|
+
timer.clearTimeout(this.holdTimeout);
|
|
39679
39668
|
this.holdTimeout = -1;
|
|
39680
39669
|
this.isDirty = true;
|
|
39681
39670
|
if (!this.released) {
|
|
@@ -39714,7 +39703,7 @@ class UISpriteElement extends Sprite {
|
|
|
39714
39703
|
releasePointerEvent("pointercancel", this);
|
|
39715
39704
|
releasePointerEvent("pointerenter", this);
|
|
39716
39705
|
releasePointerEvent("pointerleave", this);
|
|
39717
|
-
timer
|
|
39706
|
+
timer.clearTimeout(this.holdTimeout);
|
|
39718
39707
|
this.holdTimeout = -1;
|
|
39719
39708
|
}
|
|
39720
39709
|
}
|
|
@@ -39929,20 +39918,20 @@ function createGradient(light) {
|
|
|
39929
39918
|
if (radiusX >= radiusY) {
|
|
39930
39919
|
scaleX = 1;
|
|
39931
39920
|
invScaleX = 1;
|
|
39932
|
-
scaleY = radiusY/radiusX;
|
|
39933
|
-
invScaleY = radiusX/radiusY;
|
|
39921
|
+
scaleY = radiusY / radiusX;
|
|
39922
|
+
invScaleY = radiusX / radiusY;
|
|
39934
39923
|
gradient = context.createRadialGradient(x1, y1 * invScaleY, 0, x1, radiusY * invScaleY, radiusX);
|
|
39935
39924
|
}
|
|
39936
39925
|
else {
|
|
39937
39926
|
scaleY = 1;
|
|
39938
39927
|
invScaleY = 1;
|
|
39939
|
-
scaleX = radiusX/radiusY;
|
|
39940
|
-
invScaleX = radiusY/radiusX;
|
|
39928
|
+
scaleX = radiusX / radiusY;
|
|
39929
|
+
invScaleX = radiusY / radiusX;
|
|
39941
39930
|
gradient = context.createRadialGradient(x1 * invScaleX, y1, 0, x1 * invScaleX, y1, radiusY);
|
|
39942
39931
|
}
|
|
39943
39932
|
|
|
39944
|
-
gradient.addColorStop(
|
|
39945
|
-
gradient.addColorStop(
|
|
39933
|
+
gradient.addColorStop(0, light.color.toRGBA(light.intensity));
|
|
39934
|
+
gradient.addColorStop(1, light.color.toRGBA(0.0));
|
|
39946
39935
|
|
|
39947
39936
|
context.fillStyle = gradient;
|
|
39948
39937
|
|
|
@@ -41212,7 +41201,7 @@ class Detector {
|
|
|
41212
41201
|
|
|
41213
41202
|
// go trough all defined shapes in B (if any)
|
|
41214
41203
|
const bLen = objB.body.shapes.length;
|
|
41215
|
-
if (
|
|
41204
|
+
if (objB.body.shapes.length === 0) {
|
|
41216
41205
|
continue;
|
|
41217
41206
|
}
|
|
41218
41207
|
|
|
@@ -42108,7 +42097,7 @@ class Particle extends Renderable {
|
|
|
42108
42097
|
this.onlyInViewport = emitter.settings.onlyInViewport;
|
|
42109
42098
|
|
|
42110
42099
|
// cache inverse of the expected delta time
|
|
42111
|
-
this._deltaInv = timer
|
|
42100
|
+
this._deltaInv = timer.maxfps / 1000;
|
|
42112
42101
|
|
|
42113
42102
|
// Set the start particle rotation as defined in emitter
|
|
42114
42103
|
// if the particle not follow trajectory
|
|
@@ -42639,7 +42628,7 @@ function consoleHeader(app) {
|
|
|
42639
42628
|
language
|
|
42640
42629
|
);
|
|
42641
42630
|
|
|
42642
|
-
console.log(
|
|
42631
|
+
console.log("resolution: " + "requested " + app.settings.width + "x" + app.settings.height +
|
|
42643
42632
|
", got " + app.renderer.width + "x" + app.renderer.height
|
|
42644
42633
|
);
|
|
42645
42634
|
}
|
|
@@ -42813,7 +42802,7 @@ class Application {
|
|
|
42813
42802
|
|
|
42814
42803
|
// identify parent element and/or the html target for resizing
|
|
42815
42804
|
this.parentElement = getElement(this.settings.parent);
|
|
42816
|
-
if (typeof this.settings.scaleTarget !== "undefined"
|
|
42805
|
+
if (typeof this.settings.scaleTarget !== "undefined") {
|
|
42817
42806
|
this.settings.scaleTarget = getElement(this.settings.scaleTarget);
|
|
42818
42807
|
}
|
|
42819
42808
|
|
|
@@ -42961,7 +42950,7 @@ class Application {
|
|
|
42961
42950
|
updateFrameRate() {
|
|
42962
42951
|
// reset the frame counter
|
|
42963
42952
|
this.frameCounter = 0;
|
|
42964
|
-
this.frameRate = ~~(0.5 + 60 / timer
|
|
42953
|
+
this.frameRate = ~~(0.5 + 60 / timer.maxfps);
|
|
42965
42954
|
|
|
42966
42955
|
// set step size based on the updatesPerSecond
|
|
42967
42956
|
this.stepSize = (1000 / this.world.fps);
|
|
@@ -42970,7 +42959,7 @@ class Application {
|
|
|
42970
42959
|
|
|
42971
42960
|
// display should always re-draw when update speed doesn't match fps
|
|
42972
42961
|
// this means the user intends to write position prediction drawing logic
|
|
42973
|
-
this.isAlwaysDirty = (timer
|
|
42962
|
+
this.isAlwaysDirty = (timer.maxfps > this.world.fps);
|
|
42974
42963
|
}
|
|
42975
42964
|
|
|
42976
42965
|
/**
|
|
@@ -43001,13 +42990,13 @@ class Application {
|
|
|
43001
42990
|
// publish notification
|
|
43002
42991
|
emit(GAME_BEFORE_UPDATE, time);
|
|
43003
42992
|
|
|
43004
|
-
this.accumulator += timer
|
|
42993
|
+
this.accumulator += timer.getDelta();
|
|
43005
42994
|
this.accumulator = Math.min(this.accumulator, this.accumulatorMax);
|
|
43006
42995
|
|
|
43007
|
-
this.updateDelta = (timer
|
|
43008
|
-
this.accumulatorUpdateDelta = (timer
|
|
42996
|
+
this.updateDelta = (timer.interpolation) ? timer.getDelta() : this.stepSize;
|
|
42997
|
+
this.accumulatorUpdateDelta = (timer.interpolation) ? this.updateDelta : Math.max(this.updateDelta, this.updateAverageDelta);
|
|
43009
42998
|
|
|
43010
|
-
while (this.accumulator >= this.accumulatorUpdateDelta || timer
|
|
42999
|
+
while (this.accumulator >= this.accumulatorUpdateDelta || timer.interpolation) {
|
|
43011
43000
|
this.lastUpdateStart = globalThis.performance.now();
|
|
43012
43001
|
|
|
43013
43002
|
// game update event
|
|
@@ -43023,7 +43012,7 @@ class Application {
|
|
|
43023
43012
|
this.updateAverageDelta = this.lastUpdate - this.lastUpdateStart;
|
|
43024
43013
|
|
|
43025
43014
|
this.accumulator -= this.accumulatorUpdateDelta;
|
|
43026
|
-
if (timer
|
|
43015
|
+
if (timer.interpolation) {
|
|
43027
43016
|
this.accumulator = 0;
|
|
43028
43017
|
break;
|
|
43029
43018
|
}
|
|
@@ -43088,9 +43077,9 @@ class BasePlugin {
|
|
|
43088
43077
|
* define the minimum required version of melonJS<br>
|
|
43089
43078
|
* this can be overridden by the plugin
|
|
43090
43079
|
* @type {string}
|
|
43091
|
-
* @default "17.
|
|
43080
|
+
* @default "17.2.0"
|
|
43092
43081
|
*/
|
|
43093
|
-
this.version = "17.
|
|
43082
|
+
this.version = "17.2.0";
|
|
43094
43083
|
|
|
43095
43084
|
/**
|
|
43096
43085
|
* a reference to the app/game that registered this plugin
|
|
@@ -43393,7 +43382,7 @@ class CanvasTexture extends CanvasRenderTarget {
|
|
|
43393
43382
|
* @name version
|
|
43394
43383
|
* @type {string}
|
|
43395
43384
|
*/
|
|
43396
|
-
const version = "17.
|
|
43385
|
+
const version = "17.2.0";
|
|
43397
43386
|
|
|
43398
43387
|
/**
|
|
43399
43388
|
* a flag indicating that melonJS is fully initialized
|
|
@@ -43434,7 +43423,7 @@ function boot() {
|
|
|
43434
43423
|
}
|
|
43435
43424
|
|
|
43436
43425
|
// output melonJS version in the console
|
|
43437
|
-
console.log("melonJS 2 (v" + version + ") | http://melonjs.org"
|
|
43426
|
+
console.log("melonJS 2 (v" + version + ") | http://melonjs.org");
|
|
43438
43427
|
|
|
43439
43428
|
// register all built-ins objects into the object pool
|
|
43440
43429
|
pool.register("me.Entity", Entity);
|
|
@@ -43501,7 +43490,7 @@ function boot() {
|
|
|
43501
43490
|
emit(BOOT);
|
|
43502
43491
|
|
|
43503
43492
|
// enable/disable the cache
|
|
43504
|
-
setNocache(
|
|
43493
|
+
setNocache(getUriFragment().nocache || false);
|
|
43505
43494
|
|
|
43506
43495
|
// automatically enable keyboard events
|
|
43507
43496
|
initKeyboardEvent();
|
|
@@ -43522,4 +43511,4 @@ onReady(() => {
|
|
|
43522
43511
|
}
|
|
43523
43512
|
});
|
|
43524
43513
|
|
|
43525
|
-
export { AUTO, Application, BitmapText, BitmapTextData, Body, Bounds, CANVAS, Camera2d, CanvasRenderTarget, CanvasRenderer, CanvasTexture, Collectable, Color, ColorLayer, Compositor, Container, Draggable, DraggableEntity, DropTarget, DroptargetEntity, Ellipse, Entity, GLShader, GUI_Object, ImageLayer, Light2d, Line, math as Math, Matrix2d, Matrix3d, NineSliceSprite, ObservableVector2d, ObservableVector3d, Particle, ParticleEmitter, ParticleEmitterSettings, Point, Pointer, Polygon, PrimitiveCompositor, QuadCompositor, QuadTree, Rect, Renderable, Renderer, RoundRect, Sprite, Stage, TMXHexagonalRenderer, TMXIsometricRenderer, TMXLayer, TMXOrthogonalRenderer, TMXRenderer, TMXStaggeredRenderer, TMXTileMap, TMXTileset, TMXTilesetGroup, TMXUtils, Text, TextureAtlas, Tile, Trigger, Tween, UIBaseElement, UISpriteElement, UITextButton, Vector2d, Vector3d, WEBGL, WebGLRenderer, World, audio, boot, collision, device, event, game, initialized, input, level, loader, plugin, cache as plugins, pool, save, skipAutoInit, state, timer
|
|
43514
|
+
export { AUTO, Application, BitmapText, BitmapTextData, Body, Bounds, CANVAS, Camera2d, CanvasRenderTarget, CanvasRenderer, CanvasTexture, Collectable, Color, ColorLayer, Compositor, Container, Draggable, DraggableEntity, DropTarget, DroptargetEntity, Ellipse, Entity, GLShader, GUI_Object, ImageLayer, Light2d, Line, math as Math, Matrix2d, Matrix3d, NineSliceSprite, ObservableVector2d, ObservableVector3d, Particle, ParticleEmitter, ParticleEmitterSettings, Point, Pointer, Polygon, PrimitiveCompositor, QuadCompositor, QuadTree, Rect, Renderable, Renderer, RoundRect, Sprite, Stage, TMXHexagonalRenderer, TMXIsometricRenderer, TMXLayer, TMXOrthogonalRenderer, TMXRenderer, TMXStaggeredRenderer, TMXTileMap, TMXTileset, TMXTilesetGroup, TMXUtils, Text, TextureAtlas, Tile, Trigger, Tween, UIBaseElement, UISpriteElement, UITextButton, Vector2d, Vector3d, WEBGL, WebGLRenderer, World, audio, boot, collision, device, event, game, initialized, input, level, loader, plugin, cache as plugins, pool, save, skipAutoInit, state, timer, utils, version, video };
|