melonjs 15.2.0 → 15.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/melonjs.mjs/_virtual/_commonjsHelpers.js +1 -1
- package/dist/melonjs.mjs/_virtual/earcut.js +1 -1
- package/dist/melonjs.mjs/_virtual/howler.js +1 -1
- package/dist/melonjs.mjs/_virtual/index.js +1 -1
- package/dist/melonjs.mjs/application/application.js +1 -1
- package/dist/melonjs.mjs/application/header.js +1 -1
- package/dist/melonjs.mjs/application/resize.js +1 -1
- package/dist/melonjs.mjs/application/settings.js +1 -1
- package/dist/melonjs.mjs/audio/audio.js +1 -1
- package/dist/melonjs.mjs/camera/camera2d.js +1 -1
- package/dist/melonjs.mjs/const.js +1 -1
- package/dist/melonjs.mjs/entity/entity.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 +1 -1
- 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/index.js +4 -2
- package/dist/melonjs.mjs/input/gamepad.js +1 -1
- package/dist/melonjs.mjs/input/input.js +1 -1
- package/dist/melonjs.mjs/input/keyboard.js +1 -1
- package/dist/melonjs.mjs/input/pointer.js +1 -1
- package/dist/melonjs.mjs/input/pointerevent.js +1 -1
- package/dist/melonjs.mjs/lang/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 +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTile.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTileMap.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTileset.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXTilesetGroup.js +1 -1
- package/dist/melonjs.mjs/level/tiled/TMXUtils.js +124 -90
- package/dist/melonjs.mjs/level/tiled/constants.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/dist/melonjs.mjs/level/tiled/renderer/TMXRenderer.js +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 +1 -1
- package/dist/melonjs.mjs/loader/loader.js +1 -1
- package/dist/melonjs.mjs/loader/loadingscreen.js +1 -1
- package/dist/melonjs.mjs/loader/melonjs_logo.png.js +1 -1
- package/dist/melonjs.mjs/loader/parser.js +1 -1
- package/dist/melonjs.mjs/loader/settings.js +1 -1
- package/dist/melonjs.mjs/math/color.js +1 -1
- package/dist/melonjs.mjs/math/math.js +1 -1
- package/dist/melonjs.mjs/math/matrix2.js +1 -1
- package/dist/melonjs.mjs/math/matrix3.js +1 -1
- package/dist/melonjs.mjs/math/observable_vector2.js +1 -1
- package/dist/melonjs.mjs/math/observable_vector3.js +1 -1
- package/dist/melonjs.mjs/math/vector2.js +1 -1
- package/dist/melonjs.mjs/math/vector3.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/arraymultimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/@teppeis/multimaps/dist/esm/multimap.js +1 -1
- package/dist/melonjs.mjs/node_modules/earcut/src/earcut.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index.js +1 -1
- package/dist/melonjs.mjs/node_modules/eventemitter3/index2.js +1 -1
- package/dist/melonjs.mjs/node_modules/howler/dist/howler.js +1 -1
- package/dist/melonjs.mjs/particles/emitter.js +1 -1
- package/dist/melonjs.mjs/particles/particle.js +1 -1
- package/dist/melonjs.mjs/particles/settings.js +1 -1
- package/dist/melonjs.mjs/physics/body.js +1 -1
- package/dist/melonjs.mjs/physics/bounds.js +1 -1
- package/dist/melonjs.mjs/physics/collision.js +1 -1
- package/dist/melonjs.mjs/physics/detector.js +1 -1
- package/dist/melonjs.mjs/physics/quadtree.js +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 +1 -1
- package/dist/melonjs.mjs/renderable/draggable.js +1 -1
- package/dist/melonjs.mjs/renderable/dragndrop.js +1 -1
- package/dist/melonjs.mjs/renderable/imagelayer.js +1 -1
- package/dist/melonjs.mjs/renderable/light2d.js +1 -1
- package/dist/melonjs.mjs/renderable/nineslicesprite.js +1 -1
- package/dist/melonjs.mjs/renderable/renderable.js +1 -1
- package/dist/melonjs.mjs/renderable/sprite.js +1 -1
- package/dist/melonjs.mjs/renderable/trigger.js +1 -1
- package/dist/melonjs.mjs/renderable/ui/uibaseelement.js +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 +1 -1
- package/dist/melonjs.mjs/system/device.js +1 -1
- package/dist/melonjs.mjs/system/dom.js +1 -1
- package/dist/melonjs.mjs/system/event.js +1 -1
- package/dist/melonjs.mjs/system/platform.js +1 -1
- package/dist/melonjs.mjs/system/pooling.js +1 -1
- package/dist/melonjs.mjs/system/save.js +1 -1
- package/dist/melonjs.mjs/system/timer.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptext.js +1 -1
- package/dist/melonjs.mjs/text/bitmaptextdata.js +1 -1
- package/dist/melonjs.mjs/text/glyph.js +1 -1
- package/dist/melonjs.mjs/text/text.js +1 -1
- package/dist/melonjs.mjs/text/textmetrics.js +1 -1
- package/dist/melonjs.mjs/text/textstyle.js +1 -1
- package/dist/melonjs.mjs/tweens/easing.js +1 -1
- package/dist/melonjs.mjs/tweens/interpolation.js +1 -1
- package/dist/melonjs.mjs/tweens/tween.js +1 -1
- package/dist/melonjs.mjs/utils/agent.js +1 -1
- package/dist/melonjs.mjs/utils/array.js +1 -1
- package/dist/melonjs.mjs/utils/file.js +1 -1
- package/dist/melonjs.mjs/utils/function.js +1 -1
- package/dist/melonjs.mjs/utils/string.js +1 -1
- package/dist/melonjs.mjs/utils/utils.js +1 -1
- package/dist/melonjs.mjs/video/canvas/canvas_renderer.js +1 -1
- package/dist/melonjs.mjs/video/renderer.js +1 -1
- package/dist/melonjs.mjs/video/texture/atlas.js +1 -1
- package/dist/melonjs.mjs/video/texture/cache.js +1 -1
- package/dist/melonjs.mjs/video/texture/canvas_texture.js +1 -1
- package/dist/melonjs.mjs/video/utils/autodetect.js +1 -1
- package/dist/melonjs.mjs/video/video.js +3 -29
- package/dist/melonjs.mjs/video/webgl/buffer/vertex.js +1 -1
- package/dist/melonjs.mjs/video/webgl/compositors/compositor.js +1 -1
- package/dist/melonjs.mjs/video/webgl/compositors/primitive_compositor.js +1 -1
- package/dist/melonjs.mjs/video/webgl/compositors/quad_compositor.js +1 -1
- package/dist/melonjs.mjs/video/webgl/glshader.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/primitive.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.frag.js +1 -1
- package/dist/melonjs.mjs/video/webgl/shaders/quad.vert.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/attributes.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/precision.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/program.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/string.js +1 -1
- package/dist/melonjs.mjs/video/webgl/utils/uniforms.js +1 -1
- package/dist/melonjs.mjs/video/webgl/webgl_renderer.js +1 -1
- package/dist/melonjs.module.js +142 -128
- package/dist/types/index.d.ts +2 -1
- package/dist/types/level/tiled/TMXUtils.d.ts +19 -36
- package/dist/types/video/video.d.ts +1 -21
- package/package.json +3 -3
- package/src/index.js +2 -0
- package/src/level/tiled/TMXUtils.js +123 -92
- package/src/video/video.js +3 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.2.
|
|
2
|
+
* melonJS Game Engine - v15.2.1
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -9,33 +9,7 @@ import { emit, WINDOW_ONRESIZE, WINDOW_ONORIENTATION_CHANGE, WINDOW_ONSCROLL, VI
|
|
|
9
9
|
import { game, initialized } from '../index.js';
|
|
10
10
|
import { offscreenCanvas, screenOrientation } from '../system/device.js';
|
|
11
11
|
import { throttle } from '../utils/function.js';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @namespace video
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Select the HTML5 Canvas renderer
|
|
21
|
-
* @memberof video
|
|
22
|
-
* @static
|
|
23
|
-
*/
|
|
24
|
-
const CANVAS = CANVAS$1;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Select the WebGL renderer
|
|
28
|
-
* @memberof video
|
|
29
|
-
* @static
|
|
30
|
-
*/
|
|
31
|
-
const WEBGL = WEBGL$1;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Auto-select the renderer (Attempt WebGL first, with fallback to Canvas)
|
|
35
|
-
* @memberof video
|
|
36
|
-
* @static
|
|
37
|
-
*/
|
|
38
|
-
const AUTO = AUTO$1;
|
|
12
|
+
export { AUTO, CANVAS, WEBGL } from '../const.js';
|
|
39
13
|
|
|
40
14
|
/**
|
|
41
15
|
* A reference to the active Canvas or WebGL active renderer renderer
|
|
@@ -188,4 +162,4 @@ function getParent() {
|
|
|
188
162
|
return game.getParentElement();
|
|
189
163
|
}
|
|
190
164
|
|
|
191
|
-
export {
|
|
165
|
+
export { createCanvas, getParent, init, renderer };
|
package/dist/melonjs.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.2.
|
|
2
|
+
* melonJS Game Engine - v15.2.1
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -13969,7 +13969,7 @@ var audio = {
|
|
|
13969
13969
|
* @static
|
|
13970
13970
|
* @see Application
|
|
13971
13971
|
*/
|
|
13972
|
-
const CANVAS
|
|
13972
|
+
const CANVAS = 0;
|
|
13973
13973
|
|
|
13974
13974
|
/**
|
|
13975
13975
|
* constant to select select the WebGL renderer
|
|
@@ -13977,7 +13977,7 @@ const CANVAS$1 = 0;
|
|
|
13977
13977
|
* @static
|
|
13978
13978
|
* @see Application
|
|
13979
13979
|
*/
|
|
13980
|
-
const WEBGL
|
|
13980
|
+
const WEBGL = 1;
|
|
13981
13981
|
|
|
13982
13982
|
/**
|
|
13983
13983
|
* constant to auto-select the renderer (Attempt WebGL first, with fallback to Canvas)
|
|
@@ -13985,33 +13985,7 @@ const WEBGL$1 = 1;
|
|
|
13985
13985
|
* @type {number}
|
|
13986
13986
|
* @see Application
|
|
13987
13987
|
*/
|
|
13988
|
-
const AUTO
|
|
13989
|
-
|
|
13990
|
-
/**
|
|
13991
|
-
* @namespace video
|
|
13992
|
-
*/
|
|
13993
|
-
|
|
13994
|
-
|
|
13995
|
-
/**
|
|
13996
|
-
* Select the HTML5 Canvas renderer
|
|
13997
|
-
* @memberof video
|
|
13998
|
-
* @static
|
|
13999
|
-
*/
|
|
14000
|
-
const CANVAS = CANVAS$1;
|
|
14001
|
-
|
|
14002
|
-
/**
|
|
14003
|
-
* Select the WebGL renderer
|
|
14004
|
-
* @memberof video
|
|
14005
|
-
* @static
|
|
14006
|
-
*/
|
|
14007
|
-
const WEBGL = WEBGL$1;
|
|
14008
|
-
|
|
14009
|
-
/**
|
|
14010
|
-
* Auto-select the renderer (Attempt WebGL first, with fallback to Canvas)
|
|
14011
|
-
* @memberof video
|
|
14012
|
-
* @static
|
|
14013
|
-
*/
|
|
14014
|
-
const AUTO = AUTO$1;
|
|
13988
|
+
const AUTO = 2;
|
|
14015
13989
|
|
|
14016
13990
|
/**
|
|
14017
13991
|
* A reference to the active Canvas or WebGL active renderer renderer
|
|
@@ -19874,6 +19848,18 @@ const COLLISION_GROUP = "collision";
|
|
|
19874
19848
|
}
|
|
19875
19849
|
}
|
|
19876
19850
|
|
|
19851
|
+
/**
|
|
19852
|
+
* a collection of utility functions for parsing TMX maps
|
|
19853
|
+
* @namespace TMXUtils
|
|
19854
|
+
*/
|
|
19855
|
+
|
|
19856
|
+
|
|
19857
|
+
/**
|
|
19858
|
+
* the function used to decompress zlib/gzip data
|
|
19859
|
+
* @ignore
|
|
19860
|
+
*/
|
|
19861
|
+
let inflateFunction;
|
|
19862
|
+
|
|
19877
19863
|
/**
|
|
19878
19864
|
* set and interpret a TMX property value
|
|
19879
19865
|
* @ignore
|
|
@@ -19969,94 +19955,6 @@ function parseAttributes(obj, elt) {
|
|
|
19969
19955
|
}
|
|
19970
19956
|
}
|
|
19971
19957
|
|
|
19972
|
-
/**
|
|
19973
|
-
* decompress and decode zlib/gzip data
|
|
19974
|
-
* @ignore
|
|
19975
|
-
* @name decompress
|
|
19976
|
-
* @param {string} input - Base64 encoded and compressed data
|
|
19977
|
-
* @param {string} format - compressed data format ("gzip","zlib", "zstd")
|
|
19978
|
-
* @returns {Uint32Array} Decoded and decompress data
|
|
19979
|
-
*/
|
|
19980
|
-
function decompress(data, format) {
|
|
19981
|
-
if (typeof undefined === "function") {
|
|
19982
|
-
return undefined(data, format);
|
|
19983
|
-
} else {
|
|
19984
|
-
throw new Error("GZIP/ZLIB compressed TMX Tile Map not supported!");
|
|
19985
|
-
}
|
|
19986
|
-
}
|
|
19987
|
-
|
|
19988
|
-
/**
|
|
19989
|
-
* Decode a CSV encoded array into a binary array
|
|
19990
|
-
* @ignore
|
|
19991
|
-
* @name decodeCSV
|
|
19992
|
-
* @param {string} input- - CSV formatted data (only numbers, everything else will be converted to NaN)
|
|
19993
|
-
* @returns {number[]} Decoded data
|
|
19994
|
-
*/
|
|
19995
|
-
function decodeCSV(input) {
|
|
19996
|
-
let entries = input.replace("\n", "").trim().split(",");
|
|
19997
|
-
|
|
19998
|
-
let result = [];
|
|
19999
|
-
for (let i = 0; i < entries.length; i++) {
|
|
20000
|
-
result.push(+entries[i]);
|
|
20001
|
-
}
|
|
20002
|
-
return result;
|
|
20003
|
-
}
|
|
20004
|
-
|
|
20005
|
-
/**
|
|
20006
|
-
* Decode a base64 encoded string into a byte array
|
|
20007
|
-
* @ignore
|
|
20008
|
-
* @name decodeBase64AsArray
|
|
20009
|
-
* @param {string} input - Base64 encoded data
|
|
20010
|
-
* @param {number} [bytes] - number of bytes per array entry
|
|
20011
|
-
* @returns {Uint32Array} Decoded data
|
|
20012
|
-
*/
|
|
20013
|
-
function decodeBase64AsArray(input, bytes) {
|
|
20014
|
-
bytes = bytes || 1;
|
|
20015
|
-
|
|
20016
|
-
let i, j, len;
|
|
20017
|
-
let dec = globalThis.atob(input.replace(/[^A-Za-z0-9\+\/\=]/g, ""));
|
|
20018
|
-
let ar = new Uint32Array(dec.length / bytes);
|
|
20019
|
-
|
|
20020
|
-
for (i = 0, len = dec.length / bytes; i < len; i++) {
|
|
20021
|
-
ar[i] = 0;
|
|
20022
|
-
for (j = bytes - 1; j >= 0; --j) {
|
|
20023
|
-
ar[i] += dec.charCodeAt((i * bytes) + j) << (j << 3);
|
|
20024
|
-
}
|
|
20025
|
-
}
|
|
20026
|
-
return ar;
|
|
20027
|
-
}
|
|
20028
|
-
|
|
20029
|
-
/**
|
|
20030
|
-
* Decode the given data
|
|
20031
|
-
* @ignore
|
|
20032
|
-
*/
|
|
20033
|
-
function decode(data, encoding, compression) {
|
|
20034
|
-
compression = compression || "none";
|
|
20035
|
-
encoding = encoding || "none";
|
|
20036
|
-
|
|
20037
|
-
switch (encoding) {
|
|
20038
|
-
case "csv":
|
|
20039
|
-
return decodeCSV(data);
|
|
20040
|
-
|
|
20041
|
-
case "base64":
|
|
20042
|
-
if (compression !== "none") {
|
|
20043
|
-
data = decompress(data, compression);
|
|
20044
|
-
} else {
|
|
20045
|
-
data = decodeBase64AsArray(data, 4);
|
|
20046
|
-
}
|
|
20047
|
-
return data;
|
|
20048
|
-
|
|
20049
|
-
case "none":
|
|
20050
|
-
return data;
|
|
20051
|
-
|
|
20052
|
-
case "xml":
|
|
20053
|
-
throw new Error("XML encoding is deprecated, use base64 instead");
|
|
20054
|
-
|
|
20055
|
-
default:
|
|
20056
|
-
throw new Error("Unknown layer encoding: " + encoding);
|
|
20057
|
-
}
|
|
20058
|
-
}
|
|
20059
|
-
|
|
20060
19958
|
/**
|
|
20061
19959
|
* Normalize TMX format to Tiled JSON format
|
|
20062
19960
|
* @ignore
|
|
@@ -20189,9 +20087,113 @@ function normalize(obj, item) {
|
|
|
20189
20087
|
}
|
|
20190
20088
|
}
|
|
20191
20089
|
|
|
20090
|
+
|
|
20091
|
+
/**
|
|
20092
|
+
* decompress and decode zlib/gzip data
|
|
20093
|
+
* @name decompress
|
|
20094
|
+
* @memberOf TMXUtils
|
|
20095
|
+
* @param {string} input - Base64 encoded and compressed data
|
|
20096
|
+
* @param {string} format - compressed data format ("gzip","zlib", "zstd")
|
|
20097
|
+
* @returns {Uint32Array} Decoded and decompress data
|
|
20098
|
+
*/
|
|
20099
|
+
function decompress(data, format) {
|
|
20100
|
+
if (typeof inflateFunction === "function") {
|
|
20101
|
+
return inflateFunction(data, format);
|
|
20102
|
+
} else {
|
|
20103
|
+
throw new Error("GZIP/ZLIB compressed TMX Tile Map not supported!");
|
|
20104
|
+
}
|
|
20105
|
+
}
|
|
20106
|
+
|
|
20107
|
+
/**
|
|
20108
|
+
* Decode a CSV encoded array into a binary array
|
|
20109
|
+
* @name decodeCSV
|
|
20110
|
+
* @memberOf TMXUtils
|
|
20111
|
+
* @param {string} input- - CSV formatted data (only numbers, everything else will be converted to NaN)
|
|
20112
|
+
* @returns {number[]} Decoded data
|
|
20113
|
+
*/
|
|
20114
|
+
function decodeCSV(input) {
|
|
20115
|
+
let entries = input.replace("\n", "").trim().split(",");
|
|
20116
|
+
|
|
20117
|
+
let result = [];
|
|
20118
|
+
for (let i = 0; i < entries.length; i++) {
|
|
20119
|
+
result.push(+entries[i]);
|
|
20120
|
+
}
|
|
20121
|
+
return result;
|
|
20122
|
+
}
|
|
20123
|
+
|
|
20124
|
+
/**
|
|
20125
|
+
* Decode a base64 encoded string into a byte array
|
|
20126
|
+
* @name decodeBase64AsArray
|
|
20127
|
+
* @memberOf TMXUtils
|
|
20128
|
+
* @param {string} input - Base64 encoded data
|
|
20129
|
+
* @param {number} [bytes] - number of bytes per array entry
|
|
20130
|
+
* @returns {Uint32Array} Decoded data
|
|
20131
|
+
*/
|
|
20132
|
+
function decodeBase64AsArray(input, bytes) {
|
|
20133
|
+
bytes = bytes || 1;
|
|
20134
|
+
|
|
20135
|
+
let i, j, len;
|
|
20136
|
+
let dec = globalThis.atob(input.replace(/[^A-Za-z0-9\+\/\=]/g, ""));
|
|
20137
|
+
let ar = new Uint32Array(dec.length / bytes);
|
|
20138
|
+
|
|
20139
|
+
for (i = 0, len = dec.length / bytes; i < len; i++) {
|
|
20140
|
+
ar[i] = 0;
|
|
20141
|
+
for (j = bytes - 1; j >= 0; --j) {
|
|
20142
|
+
ar[i] += dec.charCodeAt((i * bytes) + j) << (j << 3);
|
|
20143
|
+
}
|
|
20144
|
+
}
|
|
20145
|
+
return ar;
|
|
20146
|
+
}
|
|
20147
|
+
|
|
20148
|
+
/**
|
|
20149
|
+
* set the function used to inflate gzip/zlib data
|
|
20150
|
+
* @param {Func} fn - inflate function
|
|
20151
|
+
*/
|
|
20152
|
+
function setInflateFunction(fn) {
|
|
20153
|
+
inflateFunction = fn;
|
|
20154
|
+
}
|
|
20155
|
+
|
|
20156
|
+
/**
|
|
20157
|
+
* Decode a encoded array into a binary array
|
|
20158
|
+
* @name decodeCSV
|
|
20159
|
+
* @memberOf TMXUtils
|
|
20160
|
+
* @param {string} data - data to be decoded
|
|
20161
|
+
* @param {string} [encoding="none"] - data encoding ("csv", "base64", "xml")
|
|
20162
|
+
* @returns {number[]} Decoded data
|
|
20163
|
+
*/
|
|
20164
|
+
function decode(data, encoding, compression) {
|
|
20165
|
+
compression = compression || "none";
|
|
20166
|
+
encoding = encoding || "none";
|
|
20167
|
+
|
|
20168
|
+
switch (encoding) {
|
|
20169
|
+
case "csv":
|
|
20170
|
+
return decodeCSV(data);
|
|
20171
|
+
|
|
20172
|
+
case "base64":
|
|
20173
|
+
if (compression !== "none") {
|
|
20174
|
+
data = decompress(data, compression);
|
|
20175
|
+
} else {
|
|
20176
|
+
data = decodeBase64AsArray(data, 4);
|
|
20177
|
+
}
|
|
20178
|
+
return data;
|
|
20179
|
+
|
|
20180
|
+
case "none":
|
|
20181
|
+
return data;
|
|
20182
|
+
|
|
20183
|
+
case "xml":
|
|
20184
|
+
throw new Error("XML encoding is deprecated, use base64 instead");
|
|
20185
|
+
|
|
20186
|
+
default:
|
|
20187
|
+
throw new Error("Unknown layer encoding: " + encoding);
|
|
20188
|
+
}
|
|
20189
|
+
}
|
|
20190
|
+
|
|
20192
20191
|
/**
|
|
20193
20192
|
* Parse a XML TMX object and returns the corresponding javascript object
|
|
20194
|
-
* @
|
|
20193
|
+
* @name parse
|
|
20194
|
+
* @memberOf TMXUtils
|
|
20195
|
+
* @param {Document} xml - XML TMX object
|
|
20196
|
+
* @returns {object} Javascript object
|
|
20195
20197
|
*/
|
|
20196
20198
|
function parse(xml) {
|
|
20197
20199
|
// Create the return object
|
|
@@ -20229,7 +20231,11 @@ function parse(xml) {
|
|
|
20229
20231
|
|
|
20230
20232
|
/**
|
|
20231
20233
|
* Apply TMX Properties to the given object
|
|
20232
|
-
* @
|
|
20234
|
+
* @name applyTMXProperties
|
|
20235
|
+
* @memberOf TMXUtils
|
|
20236
|
+
* @param {object} obj - object to apply the properties to
|
|
20237
|
+
* @param {object} data - TMX data object
|
|
20238
|
+
* @returns {object} obj
|
|
20233
20239
|
*/
|
|
20234
20240
|
function applyTMXProperties(obj, data) {
|
|
20235
20241
|
let properties = data.properties;
|
|
@@ -20259,6 +20265,14 @@ function applyTMXProperties(obj, data) {
|
|
|
20259
20265
|
}
|
|
20260
20266
|
}
|
|
20261
20267
|
|
|
20268
|
+
var TMXUtils = {
|
|
20269
|
+
__proto__: null,
|
|
20270
|
+
applyTMXProperties: applyTMXProperties,
|
|
20271
|
+
decode: decode,
|
|
20272
|
+
parse: parse,
|
|
20273
|
+
setInflateFunction: setInflateFunction
|
|
20274
|
+
};
|
|
20275
|
+
|
|
20262
20276
|
/**
|
|
20263
20277
|
* @classdesc
|
|
20264
20278
|
* a basic tile object
|
|
@@ -37773,12 +37787,12 @@ function consoleHeader(app) {
|
|
|
37773
37787
|
// override renderer settings if &webgl or &canvas is defined in the URL
|
|
37774
37788
|
let uriFragment = getUriFragment();
|
|
37775
37789
|
if (uriFragment.webgl === true || uriFragment.webgl1 === true || uriFragment.webgl2 === true) {
|
|
37776
|
-
this.settings.renderer = WEBGL
|
|
37790
|
+
this.settings.renderer = WEBGL;
|
|
37777
37791
|
if (uriFragment.webgl1 === true) {
|
|
37778
37792
|
this.settings.preferWebGL1 = true;
|
|
37779
37793
|
}
|
|
37780
37794
|
} else if (uriFragment.canvas === true) {
|
|
37781
|
-
this.settings.renderer = CANVAS
|
|
37795
|
+
this.settings.renderer = CANVAS;
|
|
37782
37796
|
}
|
|
37783
37797
|
|
|
37784
37798
|
// normalize scale
|
|
@@ -37790,8 +37804,8 @@ function consoleHeader(app) {
|
|
|
37790
37804
|
|
|
37791
37805
|
if (typeof this.settings.renderer === "number") {
|
|
37792
37806
|
switch (this.settings.renderer) {
|
|
37793
|
-
case AUTO
|
|
37794
|
-
case WEBGL
|
|
37807
|
+
case AUTO:
|
|
37808
|
+
case WEBGL:
|
|
37795
37809
|
this.renderer = autoDetectRenderer(this.settings);
|
|
37796
37810
|
break;
|
|
37797
37811
|
default:
|
|
@@ -38023,9 +38037,9 @@ class BasePlugin {
|
|
|
38023
38037
|
* define the minimum required version of melonJS<br>
|
|
38024
38038
|
* this can be overridden by the plugin
|
|
38025
38039
|
* @type {string}
|
|
38026
|
-
* @default "15.2.
|
|
38040
|
+
* @default "15.2.1"
|
|
38027
38041
|
*/
|
|
38028
|
-
this.version = "15.2.
|
|
38042
|
+
this.version = "15.2.1";
|
|
38029
38043
|
}
|
|
38030
38044
|
}
|
|
38031
38045
|
|
|
@@ -38252,7 +38266,7 @@ Renderer.prototype.getScreenContext = function() {
|
|
|
38252
38266
|
* @name version
|
|
38253
38267
|
* @type {string}
|
|
38254
38268
|
*/
|
|
38255
|
-
const version = "15.2.
|
|
38269
|
+
const version = "15.2.1";
|
|
38256
38270
|
|
|
38257
38271
|
/**
|
|
38258
38272
|
* a flag indicating that melonJS is fully initialized
|
|
@@ -38381,4 +38395,4 @@ onReady(() => {
|
|
|
38381
38395
|
}
|
|
38382
38396
|
});
|
|
38383
38397
|
|
|
38384
|
-
export { AUTO
|
|
38398
|
+
export { AUTO, Application, BitmapText, BitmapTextData, Body, Bounds, CANVAS, Camera2d, 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$1 as state, timer$1 as timer, utils, version, video };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -100,6 +100,7 @@ import TMXTileset from "./level/tiled/TMXTileset.js";
|
|
|
100
100
|
import TMXTilesetGroup from "./level/tiled/TMXTilesetGroup.js";
|
|
101
101
|
import TMXTileMap from "./level/tiled/TMXTileMap.js";
|
|
102
102
|
import TMXLayer from "./level/tiled/TMXLayer.js";
|
|
103
|
+
import * as TMXUtils from "./level/tiled/TMXUtils.js";
|
|
103
104
|
import Pointer from "./input/pointer.js";
|
|
104
105
|
import Stage from "./state/stage.js";
|
|
105
106
|
import Camera2d from "./camera/camera2d.js";
|
|
@@ -110,4 +111,4 @@ import ParticleEmitterSettings from "./particles/settings.js";
|
|
|
110
111
|
import Particle from "./particles/particle.js";
|
|
111
112
|
import Entity from "./entity/entity.js";
|
|
112
113
|
import Application from "./application/application.js";
|
|
113
|
-
export { audio, collision, device, event, loader, level, input, Math, plugin, plugins, utils, save, timer, pool, state, video, Color, Vector2d, Vector3d, ObservableVector2d, ObservableVector3d, Matrix2d, Matrix3d, Polygon, Line, Ellipse, Point, Rect, RoundRect, Tween, QuadTree, GLShader, Compositor, PrimitiveCompositor, QuadCompositor, Renderer, WebGLRenderer, CanvasRenderer, CanvasTexture, TextureAtlas, Renderable, Body, Bounds, Text, BitmapText, BitmapTextData, ColorLayer, ImageLayer, Sprite, NineSliceSprite, UIBaseElement, UITextButton, UISpriteElement, Collectable, Trigger, Light2d, Draggable, DropTarget, TMXRenderer, TMXOrthogonalRenderer, TMXIsometricRenderer, TMXHexagonalRenderer, TMXStaggeredRenderer, Tile, TMXTileset, TMXTilesetGroup, TMXTileMap, TMXLayer, Pointer, Stage, Camera2d, Container, World, ParticleEmitter, ParticleEmitterSettings, Particle, Entity, Application };
|
|
114
|
+
export { audio, collision, device, event, loader, level, input, Math, plugin, plugins, utils, save, timer, pool, state, video, Color, Vector2d, Vector3d, ObservableVector2d, ObservableVector3d, Matrix2d, Matrix3d, Polygon, Line, Ellipse, Point, Rect, RoundRect, Tween, QuadTree, GLShader, Compositor, PrimitiveCompositor, QuadCompositor, Renderer, WebGLRenderer, CanvasRenderer, CanvasTexture, TextureAtlas, Renderable, Body, Bounds, Text, BitmapText, BitmapTextData, ColorLayer, ImageLayer, Sprite, NineSliceSprite, UIBaseElement, UITextButton, UISpriteElement, Collectable, Trigger, Light2d, Draggable, DropTarget, TMXRenderer, TMXOrthogonalRenderer, TMXIsometricRenderer, TMXHexagonalRenderer, TMXStaggeredRenderer, Tile, TMXTileset, TMXTilesetGroup, TMXTileMap, TMXLayer, TMXUtils, Pointer, Stage, Camera2d, Container, World, ParticleEmitter, ParticleEmitterSettings, Particle, Entity, Application };
|
|
@@ -1,48 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* @
|
|
4
|
-
* @name decompress
|
|
5
|
-
* @param {string} input - Base64 encoded and compressed data
|
|
6
|
-
* @param {string} format - compressed data format ("gzip","zlib", "zstd")
|
|
7
|
-
* @returns {Uint32Array} Decoded and decompress data
|
|
2
|
+
* set the function used to inflate gzip/zlib data
|
|
3
|
+
* @param {Func} fn - inflate function
|
|
8
4
|
*/
|
|
9
|
-
export function
|
|
5
|
+
export function setInflateFunction(fn: Func): void;
|
|
10
6
|
/**
|
|
11
|
-
* Decode a
|
|
12
|
-
* @ignore
|
|
7
|
+
* Decode a encoded array into a binary array
|
|
13
8
|
* @name decodeCSV
|
|
14
|
-
* @
|
|
9
|
+
* @memberOf TMXUtils
|
|
10
|
+
* @param {string} data - data to be decoded
|
|
11
|
+
* @param {string} [encoding="none"] - data encoding ("csv", "base64", "xml")
|
|
15
12
|
* @returns {number[]} Decoded data
|
|
16
13
|
*/
|
|
17
|
-
export function
|
|
18
|
-
/**
|
|
19
|
-
* Decode a base64 encoded string into a byte array
|
|
20
|
-
* @ignore
|
|
21
|
-
* @name decodeBase64AsArray
|
|
22
|
-
* @param {string} input - Base64 encoded data
|
|
23
|
-
* @param {number} [bytes] - number of bytes per array entry
|
|
24
|
-
* @returns {Uint32Array} Decoded data
|
|
25
|
-
*/
|
|
26
|
-
export function decodeBase64AsArray(input: string, bytes?: number | undefined): Uint32Array;
|
|
27
|
-
/**
|
|
28
|
-
* Decode the given data
|
|
29
|
-
* @ignore
|
|
30
|
-
*/
|
|
31
|
-
export function decode(data: any, encoding: any, compression: any): any;
|
|
32
|
-
/**
|
|
33
|
-
* Normalize TMX format to Tiled JSON format
|
|
34
|
-
* @ignore
|
|
35
|
-
*/
|
|
36
|
-
export function normalize(obj: any, item: any): void;
|
|
14
|
+
export function decode(data: string, encoding?: string | undefined, compression: any): number[];
|
|
37
15
|
/**
|
|
38
16
|
* Parse a XML TMX object and returns the corresponding javascript object
|
|
39
|
-
* @
|
|
17
|
+
* @name parse
|
|
18
|
+
* @memberOf TMXUtils
|
|
19
|
+
* @param {Document} xml - XML TMX object
|
|
20
|
+
* @returns {object} Javascript object
|
|
40
21
|
*/
|
|
41
|
-
export function parse(xml:
|
|
42
|
-
text: string;
|
|
43
|
-
};
|
|
22
|
+
export function parse(xml: Document): object;
|
|
44
23
|
/**
|
|
45
24
|
* Apply TMX Properties to the given object
|
|
46
|
-
* @
|
|
25
|
+
* @name applyTMXProperties
|
|
26
|
+
* @memberOf TMXUtils
|
|
27
|
+
* @param {object} obj - object to apply the properties to
|
|
28
|
+
* @param {object} data - TMX data object
|
|
29
|
+
* @returns {object} obj
|
|
47
30
|
*/
|
|
48
|
-
export function applyTMXProperties(obj:
|
|
31
|
+
export function applyTMXProperties(obj: object, data: object): object;
|
|
@@ -64,30 +64,10 @@ export function createCanvas(width: number, height: number, returnOffscreenCanva
|
|
|
64
64
|
* @returns {HTMLElement}
|
|
65
65
|
*/
|
|
66
66
|
export function getParent(): HTMLElement;
|
|
67
|
-
/**
|
|
68
|
-
* @namespace video
|
|
69
|
-
*/
|
|
70
|
-
/**
|
|
71
|
-
* Select the HTML5 Canvas renderer
|
|
72
|
-
* @memberof video
|
|
73
|
-
* @static
|
|
74
|
-
*/
|
|
75
|
-
export const CANVAS: number;
|
|
76
|
-
/**
|
|
77
|
-
* Select the WebGL renderer
|
|
78
|
-
* @memberof video
|
|
79
|
-
* @static
|
|
80
|
-
*/
|
|
81
|
-
export const WEBGL: number;
|
|
82
|
-
/**
|
|
83
|
-
* Auto-select the renderer (Attempt WebGL first, with fallback to Canvas)
|
|
84
|
-
* @memberof video
|
|
85
|
-
* @static
|
|
86
|
-
*/
|
|
87
|
-
export const AUTO: number;
|
|
88
67
|
/**
|
|
89
68
|
* A reference to the active Canvas or WebGL active renderer renderer
|
|
90
69
|
* @memberof video
|
|
91
70
|
* @type {CanvasRenderer|WebGLRenderer}
|
|
92
71
|
*/
|
|
93
72
|
export let renderer: CanvasRenderer | WebGLRenderer;
|
|
73
|
+
export { CANVAS, WEBGL, AUTO } from "../const";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "melonjs",
|
|
3
|
-
"version": "15.2.
|
|
3
|
+
"version": "15.2.1",
|
|
4
4
|
"description": "melonJS Game Engine",
|
|
5
5
|
"homepage": "http://www.melonjs.org/",
|
|
6
6
|
"type": "module",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@babel/plugin-syntax-import-assertions": "^7.20.0",
|
|
64
64
|
"@fastify/static": "^6.10.1",
|
|
65
65
|
"@melonjs/webdoc-theme": "^1.1.1",
|
|
66
|
-
"@rollup/plugin-commonjs": "^
|
|
66
|
+
"@rollup/plugin-commonjs": "^25.0.0",
|
|
67
67
|
"@rollup/plugin-image": "^3.0.2",
|
|
68
68
|
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
69
69
|
"@rollup/plugin-replace": "^5.0.2",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"mocha": "^10.2.0",
|
|
80
80
|
"npm-self-link": "^1.1.7",
|
|
81
81
|
"puppeteer": "^20.2.0",
|
|
82
|
-
"rollup": "^3.21.
|
|
82
|
+
"rollup": "^3.21.7",
|
|
83
83
|
"rollup-plugin-bundle-size": "^1.0.3",
|
|
84
84
|
"rollup-plugin-string": "^3.0.0",
|
|
85
85
|
"terser": "^5.17.3",
|