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
|
@@ -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
|
|
@@ -10,7 +10,6 @@ import ObservableVector3d from '../math/observable_vector3.js';
|
|
|
10
10
|
import Rect from '../geometries/rectangle.js';
|
|
11
11
|
import pool from '../system/pooling.js';
|
|
12
12
|
import { clamp } from '../math/math.js';
|
|
13
|
-
import Color from '../math/color.js';
|
|
14
13
|
import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
15
14
|
|
|
16
15
|
/**
|
|
@@ -265,6 +264,9 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
265
264
|
// viewport flag
|
|
266
265
|
this._inViewport = false;
|
|
267
266
|
|
|
267
|
+
// renderable cache tint value used by the getter/setter
|
|
268
|
+
this._tint = pool.pull("Color", 255, 255, 255, 1.0);
|
|
269
|
+
|
|
268
270
|
// ensure it's fully opaque by default
|
|
269
271
|
this.setOpacity(1.0);
|
|
270
272
|
}
|
|
@@ -289,21 +291,11 @@ import { releaseAllPointerEvents } from '../input/pointerevent.js';
|
|
|
289
291
|
* this.tint.setColor(255, 255, 255);
|
|
290
292
|
*/
|
|
291
293
|
get tint() {
|
|
292
|
-
if (typeof this._tint === "undefined") {
|
|
293
|
-
this._tint = pool.pull("Color", 255, 255, 255, 1.0);
|
|
294
|
-
}
|
|
295
294
|
return this._tint;
|
|
296
295
|
}
|
|
297
296
|
set tint(value) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}
|
|
301
|
-
if (value instanceof Color) {
|
|
302
|
-
this._tint.copy(value);
|
|
303
|
-
} else {
|
|
304
|
-
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
305
|
-
this._tint.parseCSS(value);
|
|
306
|
-
}
|
|
297
|
+
this._tint.copy(value);
|
|
298
|
+
this.isDirty = true;
|
|
307
299
|
}
|
|
308
300
|
|
|
309
301
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
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
8
|
import { renderer } from '../video/video.js';
|
|
9
|
-
import {
|
|
9
|
+
import { emit, STAGE_RESET } from '../system/event.js';
|
|
10
10
|
import Camera2d from '../camera/camera2d.js';
|
|
11
11
|
import Color from '../math/color.js';
|
|
12
12
|
|
|
@@ -94,7 +94,6 @@ let default_settings = {
|
|
|
94
94
|
* @ignore
|
|
95
95
|
*/
|
|
96
96
|
reset() {
|
|
97
|
-
|
|
98
97
|
// add all defined cameras
|
|
99
98
|
this.settings.cameras.forEach((camera) => {
|
|
100
99
|
this.cameras.set(camera.name, camera);
|
|
@@ -112,7 +111,7 @@ let default_settings = {
|
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
// reset the game
|
|
115
|
-
|
|
114
|
+
emit(STAGE_RESET, this);
|
|
116
115
|
|
|
117
116
|
// call the onReset Function
|
|
118
117
|
this.onResetEvent.apply(this, arguments);
|
|
@@ -127,8 +126,7 @@ let default_settings = {
|
|
|
127
126
|
* @returns {boolean}
|
|
128
127
|
*/
|
|
129
128
|
update(dt) {
|
|
130
|
-
|
|
131
|
-
let isDirty = game.world.update(dt);
|
|
129
|
+
let isDirty = false;
|
|
132
130
|
|
|
133
131
|
// update the camera/viewport
|
|
134
132
|
// iterate through all cameras
|
|
@@ -153,13 +151,15 @@ let default_settings = {
|
|
|
153
151
|
* @name draw
|
|
154
152
|
* @memberof Stage
|
|
155
153
|
* @ignore
|
|
156
|
-
* @param {
|
|
154
|
+
* @param {Renderer} renderer - the renderer object to draw with
|
|
155
|
+
* @param {World} world - the world object to draw
|
|
157
156
|
*/
|
|
158
|
-
draw(renderer) {
|
|
157
|
+
draw(renderer, world) {
|
|
158
|
+
|
|
159
159
|
// iterate through all cameras
|
|
160
160
|
this.cameras.forEach((camera) => {
|
|
161
161
|
// render the root container
|
|
162
|
-
camera.draw(renderer,
|
|
162
|
+
camera.draw(renderer, world);
|
|
163
163
|
|
|
164
164
|
// render the ambient light
|
|
165
165
|
if (this.ambientLight.alpha !== 0) {
|
|
@@ -179,9 +179,9 @@ let default_settings = {
|
|
|
179
179
|
|
|
180
180
|
// render all lights
|
|
181
181
|
this.lights.forEach((light) => {
|
|
182
|
-
light.preDraw(renderer,
|
|
183
|
-
light.draw(renderer,
|
|
184
|
-
light.postDraw(renderer,
|
|
182
|
+
light.preDraw(renderer, world);
|
|
183
|
+
light.draw(renderer, world);
|
|
184
|
+
light.postDraw(renderer, world);
|
|
185
185
|
});
|
|
186
186
|
});
|
|
187
187
|
}
|
|
@@ -216,7 +216,6 @@ let default_settings = {
|
|
|
216
216
|
if (typeof this.settings.onResetEvent === "function") {
|
|
217
217
|
this.settings.onResetEvent.apply(this, arguments);
|
|
218
218
|
}
|
|
219
|
-
|
|
220
219
|
}
|
|
221
220
|
|
|
222
221
|
/**
|
|
@@ -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
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { pauseTrack, resumeTrack } from '../audio/audio.js';
|
|
9
9
|
import { defer } from '../utils/function.js';
|
|
10
|
-
import { on, VIDEO_INIT, BOOT, emit, STATE_STOP, STATE_PAUSE, STATE_RESTART, STATE_RESUME, STATE_CHANGE } from '../system/event.js';
|
|
10
|
+
import { on, VIDEO_INIT, BOOT, emit, STATE_STOP, STATE_PAUSE, STATE_RESTART, STATE_RESUME, STATE_CHANGE, TICK } from '../system/event.js';
|
|
11
11
|
import { game } from '../index.js';
|
|
12
12
|
import { focus } from '../system/device.js';
|
|
13
13
|
import Stage from './stage.js';
|
|
@@ -78,11 +78,7 @@ function _pauseRunLoop() {
|
|
|
78
78
|
* @ignore
|
|
79
79
|
*/
|
|
80
80
|
function _renderFrame(time) {
|
|
81
|
-
|
|
82
|
-
// update all game objects
|
|
83
|
-
game.update(time, stage);
|
|
84
|
-
// render all game objects
|
|
85
|
-
game.draw(stage);
|
|
81
|
+
emit(TICK, time);
|
|
86
82
|
// schedule the next frame update
|
|
87
83
|
if (_animFrameId !== -1) {
|
|
88
84
|
_animFrameId = globalThis.requestAnimationFrame(_renderFrame);
|
|
@@ -131,9 +127,6 @@ function _switchState(state) {
|
|
|
131
127
|
if (_onSwitchComplete) {
|
|
132
128
|
_onSwitchComplete();
|
|
133
129
|
}
|
|
134
|
-
|
|
135
|
-
// force repaint
|
|
136
|
-
game.repaint();
|
|
137
130
|
}
|
|
138
131
|
}
|
|
139
132
|
|
|
@@ -267,7 +260,7 @@ let state = {
|
|
|
267
260
|
* default state ID for the default Stage
|
|
268
261
|
* (the default stage is the one running as soon as melonJS is started)
|
|
269
262
|
* @constant
|
|
270
|
-
* @name
|
|
263
|
+
* @name DEFAULT
|
|
271
264
|
* @memberof state
|
|
272
265
|
*/
|
|
273
266
|
DEFAULT : 9,
|
|
@@ -355,9 +348,6 @@ let state = {
|
|
|
355
348
|
// calculate the elpased time
|
|
356
349
|
_pauseTime = globalThis.performance.now() - _pauseTime;
|
|
357
350
|
|
|
358
|
-
// force repaint
|
|
359
|
-
game.repaint();
|
|
360
|
-
|
|
361
351
|
// publish the restart notification
|
|
362
352
|
emit(STATE_RESTART, _pauseTime);
|
|
363
353
|
}
|
|
@@ -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
|
|
@@ -52,6 +52,7 @@ function hasOffscreenCanvas() {
|
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* used by [un]watchAccelerometer()
|
|
55
|
+
* @ignore
|
|
55
56
|
*/
|
|
56
57
|
function onDeviceMotion(e) {
|
|
57
58
|
// Accelerometer information
|
|
@@ -62,6 +63,7 @@ function onDeviceMotion(e) {
|
|
|
62
63
|
|
|
63
64
|
/**
|
|
64
65
|
* used by [un]watchDeviceOrientation()
|
|
66
|
+
* @ignore
|
|
65
67
|
*/
|
|
66
68
|
function onDeviceRotate(e) {
|
|
67
69
|
gamma = e.gamma;
|
|
@@ -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
|
|
@@ -37,6 +37,17 @@ const DOM_READY = "dom_ready";
|
|
|
37
37
|
*/
|
|
38
38
|
const BOOT = "me.boot";
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* event generated when the system update the engine and the renderer by one step
|
|
42
|
+
* @public
|
|
43
|
+
* @constant
|
|
44
|
+
* @type {string}
|
|
45
|
+
* @name TICK
|
|
46
|
+
* @memberof event
|
|
47
|
+
* @see event.on
|
|
48
|
+
*/
|
|
49
|
+
const TICK = "me.tick";
|
|
50
|
+
|
|
40
51
|
/**
|
|
41
52
|
* event when the game is paused <br>
|
|
42
53
|
* Data passed : none <br>
|
|
@@ -96,6 +107,17 @@ const STATE_RESTART = "me.state.onRestart";
|
|
|
96
107
|
*/
|
|
97
108
|
const STATE_CHANGE = "me.state.onChange";
|
|
98
109
|
|
|
110
|
+
/**
|
|
111
|
+
* event for when a stage is resetted
|
|
112
|
+
* @public
|
|
113
|
+
* @constant
|
|
114
|
+
* @type {string}
|
|
115
|
+
* @name STAGE_RESET
|
|
116
|
+
* @memberof event
|
|
117
|
+
* @see event.on
|
|
118
|
+
*/
|
|
119
|
+
const STAGE_RESET = "me.stage.onReset";
|
|
120
|
+
|
|
99
121
|
/**
|
|
100
122
|
* event for when the video is initialized<br>
|
|
101
123
|
* Data passed : none <br>
|
|
@@ -534,4 +556,4 @@ function off(eventName, listener) {
|
|
|
534
556
|
return eventEmitter.off(eventName, listener);
|
|
535
557
|
}
|
|
536
558
|
|
|
537
|
-
export { BOOT, CANVAS_ONRESIZE, DOM_READY, DRAGEND, DRAGSTART, GAMEPAD_CONNECTED, GAMEPAD_DISCONNECTED, GAMEPAD_UPDATE, GAME_AFTER_DRAW, GAME_AFTER_UPDATE, GAME_BEFORE_DRAW, GAME_BEFORE_UPDATE, GAME_INIT, GAME_RESET, GAME_UPDATE, KEYDOWN, KEYUP, LEVEL_LOADED, LOADER_COMPLETE, LOADER_PROGRESS, ONCONTEXT_LOST, ONCONTEXT_RESTORED, POINTERLOCKCHANGE, POINTERMOVE, STATE_CHANGE, STATE_PAUSE, STATE_RESTART, STATE_RESUME, STATE_STOP, VIDEO_INIT, VIEWPORT_ONCHANGE, VIEWPORT_ONRESIZE, WINDOW_ONORIENTATION_CHANGE, WINDOW_ONRESIZE, WINDOW_ONSCROLL, emit, off, on, once };
|
|
559
|
+
export { BOOT, CANVAS_ONRESIZE, DOM_READY, DRAGEND, DRAGSTART, GAMEPAD_CONNECTED, GAMEPAD_DISCONNECTED, GAMEPAD_UPDATE, GAME_AFTER_DRAW, GAME_AFTER_UPDATE, GAME_BEFORE_DRAW, GAME_BEFORE_UPDATE, GAME_INIT, GAME_RESET, GAME_UPDATE, KEYDOWN, KEYUP, LEVEL_LOADED, LOADER_COMPLETE, LOADER_PROGRESS, ONCONTEXT_LOST, ONCONTEXT_RESTORED, POINTERLOCKCHANGE, POINTERMOVE, STAGE_RESET, STATE_CHANGE, STATE_PAUSE, STATE_RESTART, STATE_RESUME, STATE_STOP, TICK, VIDEO_INIT, VIEWPORT_ONCHANGE, VIEWPORT_ONRESIZE, WINDOW_ONORIENTATION_CHANGE, WINDOW_ONRESIZE, WINDOW_ONSCROLL, emit, off, on, once };
|
|
@@ -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
|
|
@@ -21,16 +21,7 @@ import { emit, on, ONCONTEXT_LOST, ONCONTEXT_RESTORED, GAME_RESET } from '../../
|
|
|
21
21
|
*/
|
|
22
22
|
class CanvasRenderer extends Renderer {
|
|
23
23
|
/**
|
|
24
|
-
* @param {
|
|
25
|
-
* @param {number} options.width - The width of the canvas without scaling
|
|
26
|
-
* @param {number} options.height - The height of the canvas without scaling
|
|
27
|
-
* @param {HTMLCanvasElement} [options.canvas] - The html canvas to draw to on screen
|
|
28
|
-
* @param {boolean} [options.antiAlias=false] - Whether to enable anti-aliasing
|
|
29
|
-
* @param {boolean} [options.transparent=false] - Whether to enable transparency on the canvas (performance hit when enabled)
|
|
30
|
-
* @param {boolean} [options.subPixel=false] - Whether to enable subpixel renderering (performance hit when enabled)
|
|
31
|
-
* @param {boolean} [options.textureSeamFix=true] - enable the texture seam fix when rendering Tile when antiAlias is off for the canvasRenderer
|
|
32
|
-
* @param {number} [options.zoomX=width] - The actual width of the canvas with scaling applied
|
|
33
|
-
* @param {number} [options.zoomY=height] - The actual height of the canvas with scaling applied
|
|
24
|
+
* @param {Application.Settings} [options] - optional parameters for the renderer
|
|
34
25
|
*/
|
|
35
26
|
constructor(options) {
|
|
36
27
|
// parent constructor
|
|
@@ -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
|
|
@@ -27,20 +27,7 @@ import Point from '../geometries/point.js';
|
|
|
27
27
|
*/
|
|
28
28
|
class Renderer {
|
|
29
29
|
/**
|
|
30
|
-
* @param {
|
|
31
|
-
* @param {number} options.width - The width of the canvas without scaling
|
|
32
|
-
* @param {number} options.height - The height of the canvas without scaling
|
|
33
|
-
* @param {HTMLCanvasElement} [options.canvas] - The html canvas to draw to on screen
|
|
34
|
-
* @param {boolean} [options.antiAlias=false] - Whether to enable anti-aliasing, use false (default) for a pixelated effect.
|
|
35
|
-
* @param {boolean} [options.failIfMajorPerformanceCaveat=true] - If true, the renderer will switch to CANVAS mode if the performances of a WebGL context would be dramatically lower than that of a native application making equivalent OpenGL calls.
|
|
36
|
-
* @param {boolean} [options.transparent=false] - Whether to enable transparency on the canvas
|
|
37
|
-
* @param {boolean} [options.premultipliedAlpha=true] - in WebGL, whether the renderer will assume that colors have premultiplied alpha when canvas transparency is enabled
|
|
38
|
-
* @param {boolean} [options.blendMode="normal"] - the default blend mode to use ("normal", "multiply")
|
|
39
|
-
* @param {boolean} [options.depthBuffer="sorting"] - ~Experimental~ the default method to sort object on the z axis in WebGL ("sorting", "z-buffer")
|
|
40
|
-
* @param {boolean} [options.subPixel=false] - Whether to enable subpixel rendering (performance hit when enabled)
|
|
41
|
-
* @param {boolean} [options.verbose=false] - Enable the verbose mode that provides additional details as to what the renderer is doing
|
|
42
|
-
* @param {number} [options.zoomX=width] - The actual width of the canvas with scaling applied
|
|
43
|
-
* @param {number} [options.zoomY=height] - The actual height of the canvas with scaling applied
|
|
30
|
+
* @param {Application.Settings} [options] - optional parameters for the renderer
|
|
44
31
|
*/
|
|
45
32
|
constructor(options) {
|
|
46
33
|
/**
|
|
@@ -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
|
|
@@ -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
|
|
@@ -46,34 +20,10 @@ let renderer = null;
|
|
|
46
20
|
|
|
47
21
|
/**
|
|
48
22
|
* Initialize the "video" system (create a canvas based on the given arguments, and the related renderer). <br>
|
|
49
|
-
* melonJS support various scaling mode, that can be enabled <u>once the scale option is set to <b>`auto`</b></u> : <br>
|
|
50
|
-
* - <i><b>`fit`</b></i> : Letterboxed; content is scaled to design aspect ratio <br>
|
|
51
|
-
* <center><img src="images/scale-fit.png"/></center><br>
|
|
52
|
-
* - <i><b>`fill-min`</b></i> : Canvas is resized to fit minimum design resolution; content is scaled to design aspect ratio <br>
|
|
53
|
-
* <center><img src="images/scale-fill-min.png"/></center><br>
|
|
54
|
-
* - <i><b>`fill-max`</b></i> : Canvas is resized to fit maximum design resolution; content is scaled to design aspect ratio <br>
|
|
55
|
-
* <center><img src="images/scale-fill-max.png"/></center><br>
|
|
56
|
-
* - <i><b>`flex`</b><</i> : Canvas width & height is resized to fit; content is scaled to design aspect ratio <br>
|
|
57
|
-
* <center><img src="images/scale-flex.png"/></center><br>
|
|
58
|
-
* - <i><b>`flex-width`</b></i> : Canvas width is resized to fit; content is scaled to design aspect ratio <br>
|
|
59
|
-
* <center><img src="images/scale-flex-width.png"/></center><br>
|
|
60
|
-
* - <i><b>`flex-height`</b></i> : Canvas height is resized to fit; content is scaled to design aspect ratio <br>
|
|
61
|
-
* <center><img src="images/scale-flex-height.png"/></center><br>
|
|
62
|
-
* - <i><b>`stretch`</b></i> : Canvas is resized to fit; content is scaled to screen aspect ratio
|
|
63
|
-
* <center><img src="images/scale-stretch.png"/></center><br>
|
|
64
23
|
* @memberof video
|
|
65
24
|
* @param {number} width - The width of the canvas viewport
|
|
66
25
|
* @param {number} height - The height of the canvas viewport
|
|
67
|
-
* @param {
|
|
68
|
-
* @param {string|HTMLElement} [options.parent=document.body] - the DOM parent element to hold the canvas in the HTML file
|
|
69
|
-
* @param {number|Renderer} [options.renderer=video.AUTO] - renderer to use (me.video.CANVAS, me.video.WEBGL, me.video.AUTO), or a custom renderer class
|
|
70
|
-
* @param {number|string} [options.scale=1.0] - enable scaling of the canvas ('auto' for automatic scaling)
|
|
71
|
-
* @param {string} [options.scaleMethod="fit"] - screen scaling modes ('fit','fill-min','fill-max','flex','flex-width','flex-height','stretch')
|
|
72
|
-
* @param {boolean} [options.preferWebGL1=false] - if true the renderer will only use WebGL 1
|
|
73
|
-
* @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.
|
|
74
|
-
* @param {boolean} [options.transparent=false] - whether to allow transparent pixels in the front buffer (screen).
|
|
75
|
-
* @param {boolean} [options.antiAlias=false] - whether to enable or not video scaling interpolation
|
|
76
|
-
* @param {boolean} [options.consoleHeader=true] - whether to display melonJS version and basic device information in the console
|
|
26
|
+
* @param {Application.Settings} [options] - optional parameters for the renderer
|
|
77
27
|
* @returns {boolean} false if initialization failed (canvas not supported)
|
|
78
28
|
* @example
|
|
79
29
|
* // init the video with a 640x480 canvas
|
|
@@ -188,4 +138,4 @@ function getParent() {
|
|
|
188
138
|
return game.getParentElement();
|
|
189
139
|
}
|
|
190
140
|
|
|
191
|
-
export {
|
|
141
|
+
export { createCanvas, getParent, init, renderer };
|