melonjs 15.2.0 → 15.3.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/README.md +5 -5
- 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 +24 -20
- package/dist/melonjs.mjs/application/header.js +1 -1
- package/dist/melonjs.mjs/application/resize.js +10 -4
- package/dist/melonjs.mjs/application/settings.js +37 -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 +117 -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 +4 -4
- 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 +6 -14
- 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 +12 -13
- package/dist/melonjs.mjs/state/state.js +4 -14
- package/dist/melonjs.mjs/system/device.js +3 -1
- package/dist/melonjs.mjs/system/dom.js +1 -1
- package/dist/melonjs.mjs/system/event.js +24 -2
- 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 +2 -11
- package/dist/melonjs.mjs/video/renderer.js +2 -15
- 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 +4 -54
- 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 +13 -16
- package/dist/melonjs.module.js +262 -250
- package/dist/types/application/application.d.ts +4 -27
- package/dist/types/application/settings.d.ts +64 -0
- package/dist/types/index.d.ts +2 -1
- package/dist/types/level/tiled/TMXUtils.d.ts +18 -37
- package/dist/types/renderable/renderable.d.ts +1 -2
- package/dist/types/state/stage.d.ts +3 -2
- package/dist/types/system/device.d.ts +1 -0
- package/dist/types/system/event.d.ts +20 -0
- package/dist/types/video/canvas/canvas_renderer.d.ts +0 -23
- package/dist/types/video/renderer.d.ts +3 -30
- package/dist/types/video/video.d.ts +3 -57
- package/dist/types/video/webgl/webgl_renderer.d.ts +1 -34
- package/package.json +7 -7
- package/src/application/application.js +22 -18
- package/src/application/resize.js +8 -2
- package/src/application/settings.js +36 -0
- package/src/index.js +2 -0
- package/src/level/tiled/TMXUtils.js +116 -92
- package/src/math/color.js +3 -3
- package/src/renderable/renderable.js +5 -13
- package/src/state/stage.js +11 -12
- package/src/state/state.js +2 -12
- package/src/system/device.js +2 -0
- package/src/system/event.js +22 -0
- package/src/video/canvas/canvas_renderer.js +1 -10
- package/src/video/renderer.js +1 -14
- package/src/video/video.js +7 -30
- package/src/video/webgl/webgl_renderer.js +12 -15
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ Compatibility
|
|
|
31
31
|
|
|
32
32
|
Graphics
|
|
33
33
|
- 2D sprite-based graphic engine
|
|
34
|
-
- Fast WebGL
|
|
34
|
+
- [Blazing Fast](https://melonjs.discourse.group/t/melonjs-benchmark/48/4) WebGL renderer for desktop and mobile devices with fallback to Canvas rendering
|
|
35
35
|
- High DPI resolution & Canvas advanced auto scaling
|
|
36
36
|
- Sprite with 9-slice scaling option, and animation management
|
|
37
37
|
- built-in effects such as tinting and masking
|
|
@@ -167,15 +167,15 @@ melonJS 2 now only provides an ES6 Bundle :
|
|
|
167
167
|
|
|
168
168
|
>Note: if you need your application to be compatible with ES5, refer to our [boilerplate](#using-melonjs) that provides automatic transpiling to ES5.
|
|
169
169
|
|
|
170
|
-
|
|
170
|
+
The latest version of melonJS can be installed through [NPM](https://www.npmjs.com/package/melonjs) :
|
|
171
171
|
|
|
172
172
|
$ npm install melonjs
|
|
173
173
|
|
|
174
|
-
|
|
174
|
+
And then import melonjs in your project using :
|
|
175
175
|
|
|
176
|
-
$ import * as me from 'melonjs
|
|
176
|
+
$ import * as me from 'melonjs';
|
|
177
177
|
|
|
178
|
-
Or can simply be added to your html, using [jsDeliver](https://www.jsdelivr.com/package/npm/melonjs) content delivery network (CDN) :
|
|
178
|
+
Or it can simply be added to your html, using [jsDeliver](https://www.jsdelivr.com/package/npm/melonjs) content delivery network (CDN) :
|
|
179
179
|
|
|
180
180
|
```html
|
|
181
181
|
<!-- load the ES6 module bundle of melonJS v10.0 -->
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.3.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
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import { autoDetectRenderer } from '../video/utils/autodetect.js';
|
|
9
9
|
import CanvasRenderer from '../video/canvas/canvas_renderer.js';
|
|
10
10
|
import { getElement, platform, enableSwipe } from '../system/device.js';
|
|
11
|
-
import { on, emit, GAME_AFTER_UPDATE, GAME_BEFORE_DRAW, GAME_AFTER_DRAW, WINDOW_ONRESIZE, WINDOW_ONORIENTATION_CHANGE, GAME_INIT, GAME_RESET, GAME_BEFORE_UPDATE, GAME_UPDATE } from '../system/event.js';
|
|
11
|
+
import { on, emit, STATE_CHANGE, STATE_RESTART, STATE_RESUME, STAGE_RESET, GAME_AFTER_UPDATE, GAME_BEFORE_DRAW, GAME_AFTER_DRAW, WINDOW_ONRESIZE, WINDOW_ONORIENTATION_CHANGE, GAME_INIT, TICK, GAME_RESET, GAME_BEFORE_UPDATE, GAME_UPDATE } from '../system/event.js';
|
|
12
12
|
import { getUriFragment } from '../utils/utils.js';
|
|
13
13
|
import timer from '../system/timer.js';
|
|
14
14
|
import state from '../state/state.js';
|
|
@@ -28,17 +28,7 @@ import { WEBGL, CANVAS, AUTO } from '../const.js';
|
|
|
28
28
|
/**
|
|
29
29
|
* @param {number} width - The width of the canvas viewport
|
|
30
30
|
* @param {number} height - The height of the canvas viewport
|
|
31
|
-
* @param {
|
|
32
|
-
* @param {string|HTMLElement} [options.parent=document.body] - the DOM parent element to hold the canvas in the HTML file
|
|
33
|
-
* @param {number|Renderer} [options.renderer=AUTO] - renderer to use (CANVAS, WEBGL, AUTO), or a custom renderer class
|
|
34
|
-
* @param {number|string} [options.scale=1.0] - enable scaling of the canvas ('auto' for automatic scaling)
|
|
35
|
-
* @param {string} [options.scaleMethod="fit"] - screen scaling modes ('fit','fill-min','fill-max','flex','flex-width','flex-height','stretch')
|
|
36
|
-
* @param {boolean} [options.preferWebGL1=false] - if true the renderer will only use WebGL 1
|
|
37
|
-
* @param {boolean} [options.depthTest="sorting"] - ~Experimental~ the default method to sort object on the z axis in WebGL ("sorting", "z-buffer")
|
|
38
|
-
* @param {string} [options.powerPreference="default"] - a hint to the user agent indicating what configuration of GPU is suitable for the WebGL context ("default", "high-performance", "low-power"). To be noted that Safari and Chrome (since version 80) both default to "low-power" to save battery life and improve the user experience on these dual-GPU machines.
|
|
39
|
-
* @param {boolean} [options.transparent=false] - whether to allow transparent pixels in the front buffer (screen).
|
|
40
|
-
* @param {boolean} [options.antiAlias=false] - whether to enable or not video scaling interpolation
|
|
41
|
-
* @param {boolean} [options.consoleHeader=true] - whether to display melonJS version and basic device information in the console
|
|
31
|
+
* @param {Application.Settings} [options] - The optional parameters for the application and default renderer
|
|
42
32
|
* @throws Will throw an exception if it fails to instantiate a renderer
|
|
43
33
|
* @example
|
|
44
34
|
* let my game = new Application(640, 480, {renderer: me.video.AUTO}) {
|
|
@@ -173,6 +163,12 @@ import { WEBGL, CANVAS, AUTO } from '../const.js';
|
|
|
173
163
|
this.settings.zoomX = width * this.settings.scale;
|
|
174
164
|
this.settings.zoomY = height * this.settings.scale;
|
|
175
165
|
|
|
166
|
+
// identify parent element and/or the html target for resizing
|
|
167
|
+
this.parentElement = getElement(this.settings.parent);
|
|
168
|
+
if (typeof this.settings.scaleTarget !== "undefined" ) {
|
|
169
|
+
this.settings.scaleTarget = getElement(this.settings.scaleTarget);
|
|
170
|
+
}
|
|
171
|
+
|
|
176
172
|
if (typeof this.settings.renderer === "number") {
|
|
177
173
|
switch (this.settings.renderer) {
|
|
178
174
|
case AUTO:
|
|
@@ -194,7 +190,6 @@ import { WEBGL, CANVAS, AUTO } from '../const.js';
|
|
|
194
190
|
on(WINDOW_ONORIENTATION_CHANGE, () => onresize(this), this);
|
|
195
191
|
|
|
196
192
|
// add our canvas (default to document.body if settings.parent is undefined)
|
|
197
|
-
this.parentElement = getElement(this.settings.parent);
|
|
198
193
|
this.parentElement.appendChild(this.renderer.getCanvas());
|
|
199
194
|
|
|
200
195
|
// Mobile browser hacks
|
|
@@ -233,6 +228,16 @@ import { WEBGL, CANVAS, AUTO } from '../const.js';
|
|
|
233
228
|
this.isInitialized = true;
|
|
234
229
|
|
|
235
230
|
emit(GAME_INIT, this);
|
|
231
|
+
on(STATE_CHANGE, this.repaint, this);
|
|
232
|
+
on(STATE_RESTART, this.repaint, this);
|
|
233
|
+
on(STATE_RESUME, this.repaint, this);
|
|
234
|
+
on(STAGE_RESET, this.reset, this);
|
|
235
|
+
on(TICK, (time) => {
|
|
236
|
+
// update all game objects
|
|
237
|
+
this.update(time);
|
|
238
|
+
// render all game objects
|
|
239
|
+
this.draw();
|
|
240
|
+
}, this);
|
|
236
241
|
}
|
|
237
242
|
|
|
238
243
|
/**
|
|
@@ -313,9 +318,8 @@ import { WEBGL, CANVAS, AUTO } from '../const.js';
|
|
|
313
318
|
/**
|
|
314
319
|
* update all objects related to this game active scene/stage
|
|
315
320
|
* @param {number} time - current timestamp as provided by the RAF callback
|
|
316
|
-
* @param {Stage} stage - the current stage
|
|
317
321
|
*/
|
|
318
|
-
update(time
|
|
322
|
+
update(time) {
|
|
319
323
|
// handle frame skipping if required
|
|
320
324
|
if ((++this.frameCounter % this.frameRate) === 0) {
|
|
321
325
|
// reset the frame counter
|
|
@@ -339,7 +343,8 @@ import { WEBGL, CANVAS, AUTO } from '../const.js';
|
|
|
339
343
|
}
|
|
340
344
|
|
|
341
345
|
// update all objects (and pass the elapsed time since last frame)
|
|
342
|
-
this.isDirty =
|
|
346
|
+
this.isDirty = this.world.update(this.updateDelta);
|
|
347
|
+
this.isDirty = state.current().update(this.updateDelta) || this.isDirty;
|
|
343
348
|
|
|
344
349
|
this.lastUpdate = globalThis.performance.now();
|
|
345
350
|
this.updateAverageDelta = this.lastUpdate - this.lastUpdateStart;
|
|
@@ -358,9 +363,8 @@ import { WEBGL, CANVAS, AUTO } from '../const.js';
|
|
|
358
363
|
|
|
359
364
|
/**
|
|
360
365
|
* draw the active scene/stage associated to this game
|
|
361
|
-
* @param {Stage} stage - the current stage
|
|
362
366
|
*/
|
|
363
|
-
draw(
|
|
367
|
+
draw() {
|
|
364
368
|
if (this.renderer.isContextValid === true && (this.isDirty || this.isAlwaysDirty)) {
|
|
365
369
|
// publish notification
|
|
366
370
|
emit(GAME_BEFORE_DRAW, globalThis.performance.now());
|
|
@@ -369,7 +373,7 @@ import { WEBGL, CANVAS, AUTO } from '../const.js';
|
|
|
369
373
|
this.renderer.clear();
|
|
370
374
|
|
|
371
375
|
// render the stage
|
|
372
|
-
|
|
376
|
+
state.current().draw(this.renderer, this.world);
|
|
373
377
|
|
|
374
378
|
// set back to flag
|
|
375
379
|
this.isDirty = false;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.3.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
|
|
6
6
|
* @copyright (C) 2011 - 2023 Olivier Biot (AltByte Pte Ltd)
|
|
7
7
|
*/
|
|
8
|
-
import { getParentBounds, devicePixelRatio } from '../system/device.js';
|
|
8
|
+
import { getElementBounds, getParentBounds, devicePixelRatio } from '../system/device.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* scale the "displayed" canvas by the given scalar.
|
|
@@ -50,6 +50,7 @@ function onresize(game) {
|
|
|
50
50
|
let renderer = game.renderer;
|
|
51
51
|
let settings = renderer.settings;
|
|
52
52
|
let scaleX = 1, scaleY = 1;
|
|
53
|
+
let nodeBounds;
|
|
53
54
|
|
|
54
55
|
if (settings.autoScale) {
|
|
55
56
|
|
|
@@ -63,8 +64,13 @@ function onresize(game) {
|
|
|
63
64
|
canvasMaxHeight = parseInt(style.maxHeight, 10) || Infinity;
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
if (typeof game.settings.scaleTarget !== "undefined") {
|
|
68
|
+
// get the bounds of the given scale target
|
|
69
|
+
nodeBounds = getElementBounds(game.settings.scaleTarget);
|
|
70
|
+
} else {
|
|
71
|
+
// get the maximum canvas size within the parent div containing the canvas container
|
|
72
|
+
nodeBounds = getParentBounds(game.getParentElement());
|
|
73
|
+
}
|
|
68
74
|
|
|
69
75
|
let _max_width = Math.min(canvasMaxWidth, nodeBounds.width);
|
|
70
76
|
let _max_height = Math.min(canvasMaxHeight, nodeBounds.height);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.3.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
|
|
@@ -12,6 +12,7 @@ const defaultSettings = {
|
|
|
12
12
|
autoScale : false,
|
|
13
13
|
scale : 1.0,
|
|
14
14
|
scaleMethod : "manual",
|
|
15
|
+
scaleTarget : undefined,
|
|
15
16
|
transparent : false,
|
|
16
17
|
premultipliedAlpha: true,
|
|
17
18
|
blendMode : "normal",
|
|
@@ -25,4 +26,39 @@ const defaultSettings = {
|
|
|
25
26
|
legacy : false
|
|
26
27
|
};
|
|
27
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Application & Renderer Settings definition.
|
|
31
|
+
* @typedef {Object} Settings
|
|
32
|
+
* @property {string|HTMLElement} [parent=document.body] - the DOM parent element to hold the canvas in the HTML file
|
|
33
|
+
* @property {number|Renderer} [renderer=AUTO] - renderer to use (CANVAS, WEBGL, AUTO), or a custom renderer class
|
|
34
|
+
* @property {number|string} [scale=1.0] - enable scaling of the canvas ('auto' for automatic scaling)
|
|
35
|
+
* @property {string} [scaleMethod="fit"] - screen scaling modes ('fit','fill-min','fill-max','flex','flex-width','flex-height','stretch') : <br>
|
|
36
|
+
* - <i><b>`fit`</b></i> : Letterboxed; content is scaled to design aspect ratio <br>
|
|
37
|
+
* <center><img src="images/scale-fit.png"/></center><br>
|
|
38
|
+
* - <i><b>`fill-min`</b></i> : Canvas is resized to fit minimum design resolution; content is scaled to design aspect ratio <br>
|
|
39
|
+
* <center><img src="images/scale-fill-min.png"/></center><br>
|
|
40
|
+
* - <i><b>`fill-max`</b></i> : Canvas is resized to fit maximum design resolution; content is scaled to design aspect ratio <br>
|
|
41
|
+
* <center><img src="images/scale-fill-max.png"/></center><br>
|
|
42
|
+
* - <i><b>`flex`</b><</i> : Canvas width & height is resized to fit; content is scaled to design aspect ratio <br>
|
|
43
|
+
* <center><img src="images/scale-flex.png"/></center><br>
|
|
44
|
+
* - <i><b>`flex-width`</b></i> : Canvas width is resized to fit; content is scaled to design aspect ratio <br>
|
|
45
|
+
* <center><img src="images/scale-flex-width.png"/></center><br>
|
|
46
|
+
* - <i><b>`flex-height`</b></i> : Canvas height is resized to fit; content is scaled to design aspect ratio <br>
|
|
47
|
+
* <center><img src="images/scale-flex-height.png"/></center><br>
|
|
48
|
+
* - <i><b>`stretch`</b></i> : Canvas is resized to fit; content is scaled to screen aspect ratio <br>
|
|
49
|
+
* <center><img src="images/scale-stretch.png"/></center>
|
|
50
|
+
* @property {string|HTMLElement} [scaleTarget] - the HTML Element to be used as the reference target when using automatic scaling (by default melonJS will use the parent container of the div element containing the canvas)
|
|
51
|
+
* @property {boolean} [preferWebGL1=false] - if true the renderer will only use WebGL 1
|
|
52
|
+
* @property {boolean} [depthTest="sorting"] - ~Experimental~ the default method to sort object on the z axis in WebGL ("sorting", "z-buffer")
|
|
53
|
+
* @property {string} [powerPreference="default"] - a hint to the user agent indicating what configuration of GPU is suitable for the WebGL context ("default", "high-performance", "low-power"). To be noted that Safari and Chrome (since version 80) both default to "low-power" to save battery life and improve the user experience on these dual-GPU machines.
|
|
54
|
+
* @property {boolean} [transparent=false] - whether to allow transparent pixels in the front buffer (screen).
|
|
55
|
+
* @property {boolean} [antiAlias=false] - whether to enable or not video scaling interpolation
|
|
56
|
+
* @property {boolean} [consoleHeader=true] - whether to display melonJS version and basic device information in the console
|
|
57
|
+
* @param {number} [options.zoomX=width] - The actual width of the canvas with scaling applied
|
|
58
|
+
* @param {number} [options.zoomY=height] - The actual height of the canvas with scaling applied
|
|
59
|
+
* @param {Compositor} [options.compositor] - a custom compositor class (WebGL only)
|
|
60
|
+
* @see Application
|
|
61
|
+
* @memberof Application
|
|
62
|
+
*/
|
|
63
|
+
|
|
28
64
|
export { defaultSettings };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v15.
|
|
2
|
+
* melonJS Game Engine - v15.3.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
|
|
@@ -57,6 +57,8 @@ export { default as TMXTileset } from './level/tiled/TMXTileset.js';
|
|
|
57
57
|
export { default as TMXTilesetGroup } from './level/tiled/TMXTilesetGroup.js';
|
|
58
58
|
export { default as TMXTileMap } from './level/tiled/TMXTileMap.js';
|
|
59
59
|
export { default as TMXLayer } from './level/tiled/TMXLayer.js';
|
|
60
|
+
import * as TMXUtils from './level/tiled/TMXUtils.js';
|
|
61
|
+
export { TMXUtils };
|
|
60
62
|
export { default as Pointer } from './input/pointer.js';
|
|
61
63
|
export { default as Stage } from './state/stage.js';
|
|
62
64
|
export { default as Camera2d } from './camera/camera2d.js';
|
|
@@ -110,7 +112,7 @@ import { initKeyboardEvent } from './input/keyboard.js';
|
|
|
110
112
|
* @name version
|
|
111
113
|
* @type {string}
|
|
112
114
|
*/
|
|
113
|
-
const version = "15.
|
|
115
|
+
const version = "15.3.0";
|
|
114
116
|
|
|
115
117
|
/**
|
|
116
118
|
* a flag indicating that melonJS is fully initialized
|