melonjs 10.10.0 → 10.11.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 +4 -3
- package/dist/melonjs.js +817 -1922
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +339 -1183
- package/dist/melonjs.module.js +745 -1846
- package/package.json +12 -15
- package/src/audio/audio.js +0 -1
- package/src/camera/camera2d.js +1 -16
- package/src/entity/entity.js +1 -4
- package/src/geometries/ellipse.js +2 -11
- package/src/geometries/line.js +1 -4
- package/src/geometries/path2d.js +0 -10
- package/src/geometries/poly.js +5 -22
- package/src/geometries/rectangle.js +2 -14
- package/src/geometries/roundrect.js +2 -6
- package/src/index.js +0 -1
- package/src/input/gamepad.js +3 -14
- package/src/input/keyboard.js +1 -9
- package/src/input/pointer.js +0 -1
- package/src/input/pointerevent.js +14 -23
- package/src/lang/deprecated.js +4 -3
- package/src/level/level.js +0 -9
- package/src/level/tiled/TMXGroup.js +0 -4
- package/src/level/tiled/TMXLayer.js +0 -8
- package/src/level/tiled/TMXObject.js +0 -3
- package/src/level/tiled/TMXTile.js +4 -5
- package/src/level/tiled/TMXTileMap.js +1 -7
- package/src/level/tiled/TMXTileset.js +0 -5
- package/src/level/tiled/TMXTilesetGroup.js +1 -4
- package/src/level/tiled/TMXUtils.js +0 -3
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +2 -3
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +0 -1
- package/src/level/tiled/renderer/TMXRenderer.js +1 -7
- package/src/loader/loader.js +0 -11
- package/src/loader/loadingscreen.js +1 -1
- package/src/math/color.js +5 -26
- package/src/math/math.js +0 -10
- package/src/math/matrix2.js +12 -27
- package/src/math/matrix3.js +1 -22
- package/src/math/observable_vector2.js +0 -29
- package/src/math/observable_vector3.js +0 -29
- package/src/math/vector2.js +3 -40
- package/src/math/vector3.js +4 -41
- package/src/particles/emitter.js +1 -1
- package/src/physics/body.js +1 -1
- package/src/physics/bounds.js +5 -19
- package/src/physics/collision.js +0 -1
- package/src/physics/detector.js +0 -4
- package/src/physics/quadtree.js +0 -7
- package/src/physics/sat.js +3 -3
- package/src/physics/world.js +0 -4
- package/src/plugin/plugin.js +0 -2
- package/src/polyfill/roundrect.js +4 -2
- package/src/renderable/GUI.js +0 -5
- package/src/renderable/collectable.js +1 -0
- package/src/renderable/container.js +0 -28
- package/src/renderable/dragndrop.js +0 -9
- package/src/renderable/imagelayer.js +1 -5
- package/src/renderable/light2d.js +1 -2
- package/src/renderable/renderable.js +0 -22
- package/src/renderable/sprite.js +0 -12
- package/src/renderable/trigger.js +1 -1
- package/src/state/stage.js +0 -4
- package/src/state/state.js +3 -20
- package/src/system/device.js +14 -53
- package/src/system/event.js +11 -0
- package/src/system/pooling.js +19 -8
- package/src/system/save.js +9 -11
- package/src/system/timer.js +239 -218
- package/src/text/bitmaptextdata.js +1 -4
- package/src/text/glyph.js +2 -2
- package/src/text/text.js +7 -5
- package/src/text/textmetrics.js +0 -2
- package/src/tweens/easing.js +1 -1
- package/src/tweens/interpolation.js +2 -2
- package/src/tweens/tween.js +1 -13
- package/src/utils/agent.js +1 -3
- package/src/utils/array.js +0 -3
- package/src/utils/file.js +0 -2
- package/src/utils/function.js +0 -2
- package/src/utils/string.js +0 -6
- package/src/utils/utils.js +0 -3
- package/src/video/canvas/canvas_renderer.js +4 -39
- package/src/video/renderer.js +1 -23
- package/src/video/texture/cache.js +0 -1
- package/src/video/texture/canvas_texture.js +16 -4
- package/src/video/video.js +3 -3
- package/src/video/webgl/glshader.js +0 -5
- package/src/video/webgl/utils/uniforms.js +3 -6
- package/src/video/webgl/webgl_compositor.js +0 -14
- package/src/video/webgl/webgl_renderer.js +0 -42
|
@@ -33,7 +33,6 @@ class Rect extends Polygon {
|
|
|
33
33
|
* set new value to the rectangle shape
|
|
34
34
|
* @name setShape
|
|
35
35
|
* @memberof Rect
|
|
36
|
-
* @function
|
|
37
36
|
* @param {number} x position of the Rectangle
|
|
38
37
|
* @param {number} y position of the Rectangle
|
|
39
38
|
* @param {number|Vector2d[]} w width of the rectangle, or an array of vector defining the rectangle
|
|
@@ -176,7 +175,6 @@ class Rect extends Polygon {
|
|
|
176
175
|
* center the rectangle position around the given coordinates
|
|
177
176
|
* @name centerOn
|
|
178
177
|
* @memberof Rect
|
|
179
|
-
* @function
|
|
180
178
|
* @param {number} x the x coordinate around which to center this rectangle
|
|
181
179
|
* @param {number} x the y coordinate around which to center this rectangle
|
|
182
180
|
* @returns {Rect} this rectangle
|
|
@@ -191,7 +189,6 @@ class Rect extends Polygon {
|
|
|
191
189
|
* resize the rectangle
|
|
192
190
|
* @name resize
|
|
193
191
|
* @memberof Rect
|
|
194
|
-
* @function
|
|
195
192
|
* @param {number} w new width of the rectangle
|
|
196
193
|
* @param {number} h new height of the rectangle
|
|
197
194
|
* @returns {Rect} this rectangle
|
|
@@ -206,7 +203,6 @@ class Rect extends Polygon {
|
|
|
206
203
|
* scale the rectangle
|
|
207
204
|
* @name scale
|
|
208
205
|
* @memberof Rect
|
|
209
|
-
* @function
|
|
210
206
|
* @param {number} x a number representing the abscissa of the scaling vector.
|
|
211
207
|
* @param {number} [y=x] a number representing the ordinate of the scaling vector.
|
|
212
208
|
* @returns {Rect} this rectangle
|
|
@@ -221,7 +217,6 @@ class Rect extends Polygon {
|
|
|
221
217
|
* clone this rectangle
|
|
222
218
|
* @name clone
|
|
223
219
|
* @memberof Rect
|
|
224
|
-
* @function
|
|
225
220
|
* @returns {Rect} new rectangle
|
|
226
221
|
*/
|
|
227
222
|
clone() {
|
|
@@ -232,7 +227,6 @@ class Rect extends Polygon {
|
|
|
232
227
|
* copy the position and size of the given rectangle into this one
|
|
233
228
|
* @name copy
|
|
234
229
|
* @memberof Rect
|
|
235
|
-
* @function
|
|
236
230
|
* @param {Rect} rect Source rectangle
|
|
237
231
|
* @returns {Rect} new rectangle
|
|
238
232
|
*/
|
|
@@ -244,7 +238,6 @@ class Rect extends Polygon {
|
|
|
244
238
|
* merge this rectangle with another one
|
|
245
239
|
* @name union
|
|
246
240
|
* @memberof Rect
|
|
247
|
-
* @function
|
|
248
241
|
* @param {Rect} rect other rectangle to union with
|
|
249
242
|
* @returns {Rect} the union(ed) rectangle
|
|
250
243
|
*/
|
|
@@ -266,7 +259,6 @@ class Rect extends Polygon {
|
|
|
266
259
|
* check if this rectangle is intersecting with the specified one
|
|
267
260
|
* @name overlaps
|
|
268
261
|
* @memberof Rect
|
|
269
|
-
* @function
|
|
270
262
|
* @param {Rect} rect
|
|
271
263
|
* @returns {boolean} true if overlaps
|
|
272
264
|
*/
|
|
@@ -283,7 +275,7 @@ class Rect extends Polygon {
|
|
|
283
275
|
* Returns true if the rectangle contains the given rectangle
|
|
284
276
|
* @name contains
|
|
285
277
|
* @memberof Rect
|
|
286
|
-
* @
|
|
278
|
+
* @method
|
|
287
279
|
* @param {Rect} rect
|
|
288
280
|
* @returns {boolean} true if contains
|
|
289
281
|
*/
|
|
@@ -292,7 +284,7 @@ class Rect extends Polygon {
|
|
|
292
284
|
* Returns true if the rectangle contains the given point
|
|
293
285
|
* @name contains
|
|
294
286
|
* @memberof Rect
|
|
295
|
-
* @
|
|
287
|
+
* @method
|
|
296
288
|
* @param {number} x x coordinate
|
|
297
289
|
* @param {number} y y coordinate
|
|
298
290
|
* @returns {boolean} true if contains
|
|
@@ -302,7 +294,6 @@ class Rect extends Polygon {
|
|
|
302
294
|
* Returns true if the rectangle contains the given point
|
|
303
295
|
* @name contains
|
|
304
296
|
* @memberof Rect
|
|
305
|
-
* @function
|
|
306
297
|
* @param {Vector2d} point
|
|
307
298
|
* @returns {boolean} true if contains
|
|
308
299
|
*/
|
|
@@ -338,7 +329,6 @@ class Rect extends Polygon {
|
|
|
338
329
|
* check if this rectangle is identical to the specified one
|
|
339
330
|
* @name equals
|
|
340
331
|
* @memberof Rect
|
|
341
|
-
* @function
|
|
342
332
|
* @param {Rect} rect
|
|
343
333
|
* @returns {boolean} true if equals
|
|
344
334
|
*/
|
|
@@ -355,7 +345,6 @@ class Rect extends Polygon {
|
|
|
355
345
|
* determines whether all coordinates of this rectangle are finite numbers.
|
|
356
346
|
* @name isFinite
|
|
357
347
|
* @memberof Rect
|
|
358
|
-
* @function
|
|
359
348
|
* @returns {boolean} false if all coordinates are positive or negative Infinity or NaN; otherwise, true.
|
|
360
349
|
*/
|
|
361
350
|
isFinite() {
|
|
@@ -366,7 +355,6 @@ class Rect extends Polygon {
|
|
|
366
355
|
* Returns a polygon whose edges are the same as this box.
|
|
367
356
|
* @name toPolygon
|
|
368
357
|
* @memberof Rect
|
|
369
|
-
* @function
|
|
370
358
|
* @returns {Polygon} a new Polygon that represents this rectangle.
|
|
371
359
|
*/
|
|
372
360
|
toPolygon() {
|
|
@@ -56,7 +56,6 @@ class RoundRect extends Rect {
|
|
|
56
56
|
* copy the position, size and radius of the given rounded rectangle into this one
|
|
57
57
|
* @name copy
|
|
58
58
|
* @memberof RoundRect
|
|
59
|
-
* @function
|
|
60
59
|
* @param {RoundRect} rrect source rounded rectangle
|
|
61
60
|
* @returns {RoundRect} new rectangle
|
|
62
61
|
*/
|
|
@@ -70,7 +69,7 @@ class RoundRect extends Rect {
|
|
|
70
69
|
* Returns true if the rounded rectangle contains the given point
|
|
71
70
|
* @name contains
|
|
72
71
|
* @memberof RoundRect
|
|
73
|
-
* @
|
|
72
|
+
* @method
|
|
74
73
|
* @param {number} x x coordinate
|
|
75
74
|
* @param {number} y y coordinate
|
|
76
75
|
* @returns {boolean} true if contains
|
|
@@ -80,7 +79,6 @@ class RoundRect extends Rect {
|
|
|
80
79
|
* Returns true if the rounded rectangle contains the given point
|
|
81
80
|
* @name contains
|
|
82
81
|
* @memberof RoundRect
|
|
83
|
-
* @function
|
|
84
82
|
* @param {Vector2d} point
|
|
85
83
|
* @returns {boolean} true if contains
|
|
86
84
|
*/
|
|
@@ -141,7 +139,6 @@ class RoundRect extends Rect {
|
|
|
141
139
|
* check if this RoundRect is identical to the specified one
|
|
142
140
|
* @name equals
|
|
143
141
|
* @memberof RoundRect
|
|
144
|
-
* @function
|
|
145
142
|
* @param {RoundRect} rrect
|
|
146
143
|
* @returns {boolean} true if equals
|
|
147
144
|
*/
|
|
@@ -153,11 +150,10 @@ class RoundRect extends Rect {
|
|
|
153
150
|
* clone this RoundRect
|
|
154
151
|
* @name clone
|
|
155
152
|
* @memberof RoundRect
|
|
156
|
-
* @function
|
|
157
153
|
* @returns {RoundRect} new RoundRect
|
|
158
154
|
*/
|
|
159
155
|
clone() {
|
|
160
|
-
return new RoundRect(this.pos.x, this.pos.y, this.width, this.height, radius);
|
|
156
|
+
return new RoundRect(this.pos.x, this.pos.y, this.width, this.height, this.radius);
|
|
161
157
|
}
|
|
162
158
|
};
|
|
163
159
|
|
package/src/index.js
CHANGED
package/src/input/gamepad.js
CHANGED
|
@@ -86,10 +86,7 @@ var remap = new Map();
|
|
|
86
86
|
|
|
87
87
|
var updateEventHandler;
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
* Default gamepad mappings
|
|
91
|
-
* @ignore
|
|
92
|
-
*/
|
|
89
|
+
// Default gamepad mappings
|
|
93
90
|
[
|
|
94
91
|
// Firefox mappings
|
|
95
92
|
[
|
|
@@ -261,18 +258,14 @@ var updateGamepads = function () {
|
|
|
261
258
|
});
|
|
262
259
|
};
|
|
263
260
|
|
|
264
|
-
|
|
265
|
-
* gamepad connected callback
|
|
266
|
-
* @ignore
|
|
267
|
-
*/
|
|
261
|
+
// gamepad connected callback
|
|
268
262
|
if (globalThis.navigator && typeof globalThis.navigator.getGamepads === "function") {
|
|
269
263
|
globalThis.addEventListener("gamepadconnected", function (e) {
|
|
270
264
|
event.emit(event.GAMEPAD_CONNECTED, e.gamepad);
|
|
271
265
|
}, false);
|
|
272
266
|
|
|
273
|
-
|
|
267
|
+
/*
|
|
274
268
|
* gamepad disconnected callback
|
|
275
|
-
* @ignore
|
|
276
269
|
*/
|
|
277
270
|
globalThis.addEventListener("gamepaddisconnected", function (e) {
|
|
278
271
|
event.emit(event.GAMEPAD_DISCONNECTED, e.gamepad);
|
|
@@ -362,7 +355,6 @@ export var GAMEPAD = {
|
|
|
362
355
|
* @name bindGamepad
|
|
363
356
|
* @memberof input
|
|
364
357
|
* @public
|
|
365
|
-
* @function
|
|
366
358
|
* @param {number} index Gamepad index
|
|
367
359
|
* @param {object} button Button/Axis definition
|
|
368
360
|
* @param {string} button.type "buttons" or "axes"
|
|
@@ -437,7 +429,6 @@ export function bindGamepad(index, button, keyCode) {
|
|
|
437
429
|
* @name unbindGamepad
|
|
438
430
|
* @memberof input
|
|
439
431
|
* @public
|
|
440
|
-
* @function
|
|
441
432
|
* @param {number} index Gamepad index
|
|
442
433
|
* @param {number} button (See {@link input.GAMEPAD.BUTTONS})
|
|
443
434
|
* @example
|
|
@@ -456,7 +447,6 @@ export function unbindGamepad(index, button) {
|
|
|
456
447
|
* @name setGamepadDeadzone
|
|
457
448
|
* @memberof input
|
|
458
449
|
* @public
|
|
459
|
-
* @function
|
|
460
450
|
* @param {number} value Deadzone value
|
|
461
451
|
*/
|
|
462
452
|
export function setGamepadDeadzone(value) {
|
|
@@ -470,7 +460,6 @@ export function setGamepadDeadzone(value) {
|
|
|
470
460
|
* @name setGamepadMapping
|
|
471
461
|
* @memberof input
|
|
472
462
|
* @public
|
|
473
|
-
* @function
|
|
474
463
|
* @param {string} id Gamepad id string
|
|
475
464
|
* @param {object} mapping A hash table
|
|
476
465
|
* @param {number[]} mapping.axes Standard analog control stick axis locations
|
package/src/input/keyboard.js
CHANGED
|
@@ -111,8 +111,7 @@ var keyUpEvent = function (e, keyCode, mouseButton) {
|
|
|
111
111
|
* @namespace KEY
|
|
112
112
|
* @memberof input
|
|
113
113
|
*/
|
|
114
|
-
export
|
|
115
|
-
/** @memberof input.KEY */
|
|
114
|
+
export const KEY = {
|
|
116
115
|
"BACKSPACE" : 8,
|
|
117
116
|
/** @memberof input.KEY */
|
|
118
117
|
"TAB" : 9,
|
|
@@ -332,7 +331,6 @@ export function initKeyboardEvent() {
|
|
|
332
331
|
* @name isKeyPressed
|
|
333
332
|
* @memberof input
|
|
334
333
|
* @public
|
|
335
|
-
* @function
|
|
336
334
|
* @param {string} action user defined corresponding action
|
|
337
335
|
* @returns {boolean} true if pressed
|
|
338
336
|
* @example
|
|
@@ -358,7 +356,6 @@ export function isKeyPressed(action) {
|
|
|
358
356
|
* @name keyStatus
|
|
359
357
|
* @memberof input
|
|
360
358
|
* @public
|
|
361
|
-
* @function
|
|
362
359
|
* @param {string} action user defined corresponding action
|
|
363
360
|
* @returns {boolean} down (true) or up(false)
|
|
364
361
|
*/
|
|
@@ -372,7 +369,6 @@ export function keyStatus(action) {
|
|
|
372
369
|
* @name triggerKeyEvent
|
|
373
370
|
* @memberof input
|
|
374
371
|
* @public
|
|
375
|
-
* @function
|
|
376
372
|
* @param {number} keycode (See {@link input.KEY})
|
|
377
373
|
* @param {boolean} [status=false] true to trigger a key down event, or false for key up event
|
|
378
374
|
* @param {number} [mouseButton] the mouse button to trigger
|
|
@@ -395,7 +391,6 @@ export function triggerKeyEvent(keycode, status, mouseButton) {
|
|
|
395
391
|
* @name bindKey
|
|
396
392
|
* @memberof input
|
|
397
393
|
* @public
|
|
398
|
-
* @function
|
|
399
394
|
* @param {number} keycode (See {@link input.KEY})
|
|
400
395
|
* @param {string} action user defined corresponding action
|
|
401
396
|
* @param {boolean} [lock=false] cancel the keypress event once read
|
|
@@ -422,7 +417,6 @@ export function bindKey(keycode, action, lock, preventDefault = preventDefaultAc
|
|
|
422
417
|
* @name getBindingKey
|
|
423
418
|
* @memberof input
|
|
424
419
|
* @public
|
|
425
|
-
* @function
|
|
426
420
|
* @param {number} keycode (See {@link input.KEY})
|
|
427
421
|
* @returns {string} user defined associated action
|
|
428
422
|
*/
|
|
@@ -435,7 +429,6 @@ export function getBindingKey(keycode) {
|
|
|
435
429
|
* @name unlockKey
|
|
436
430
|
* @memberof input
|
|
437
431
|
* @public
|
|
438
|
-
* @function
|
|
439
432
|
* @param {string} action user defined corresponding action
|
|
440
433
|
* @example
|
|
441
434
|
* // Unlock jump when touching the ground
|
|
@@ -452,7 +445,6 @@ export function unlockKey(action) {
|
|
|
452
445
|
* @name unbindKey
|
|
453
446
|
* @memberof input
|
|
454
447
|
* @public
|
|
455
|
-
* @function
|
|
456
448
|
* @param {number} keycode (See {@link input.KEY})
|
|
457
449
|
* @example
|
|
458
450
|
* me.input.unbindKey(me.input.KEY.LEFT);
|
package/src/input/pointer.js
CHANGED
|
@@ -311,7 +311,6 @@ class Pointer extends Bounds {
|
|
|
311
311
|
* initialize the Pointer object using the given Event Object
|
|
312
312
|
* @name Pointer#set
|
|
313
313
|
* @private
|
|
314
|
-
* @function
|
|
315
314
|
* @param {Event} event the original Event object
|
|
316
315
|
* @param {number} [pageX=0] the horizontal coordinate at which the event occurred, relative to the left edge of the entire document
|
|
317
316
|
* @param {number} [pageY=0] the vertical coordinate at which the event occurred, relative to the left edge of the entire document
|
|
@@ -35,17 +35,17 @@ var lastTimeStamp = 0;
|
|
|
35
35
|
var activeEventList = [];
|
|
36
36
|
|
|
37
37
|
// internal constants
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
const WHEEL = ["wheel"];
|
|
39
|
+
const POINTER_MOVE = ["pointermove", "mousemove", "touchmove"];
|
|
40
|
+
const POINTER_DOWN = ["pointerdown", "mousedown", "touchstart"];
|
|
41
|
+
const POINTER_UP = ["pointerup", "mouseup", "touchend"];
|
|
42
|
+
const POINTER_CANCEL = ["pointercancel", "mousecancel", "touchcancel"];
|
|
43
|
+
const POINTER_ENTER = ["pointerenter", "mouseenter", "touchenter"];
|
|
44
|
+
const POINTER_OVER = ["pointerover", "mouseover", "touchover"];
|
|
45
|
+
const POINTER_LEAVE = ["pointerleave", "mouseleave", "touchleave"];
|
|
46
46
|
|
|
47
47
|
// list of standard pointer event type
|
|
48
|
-
|
|
48
|
+
const pointerEventList = [
|
|
49
49
|
WHEEL[0],
|
|
50
50
|
POINTER_MOVE[0],
|
|
51
51
|
POINTER_DOWN[0],
|
|
@@ -57,7 +57,7 @@ var pointerEventList = [
|
|
|
57
57
|
];
|
|
58
58
|
|
|
59
59
|
// legacy mouse event type
|
|
60
|
-
|
|
60
|
+
const mouseEventList = [
|
|
61
61
|
WHEEL[0],
|
|
62
62
|
POINTER_MOVE[1],
|
|
63
63
|
POINTER_DOWN[1],
|
|
@@ -69,7 +69,7 @@ var mouseEventList = [
|
|
|
69
69
|
];
|
|
70
70
|
|
|
71
71
|
// iOS style touch event type
|
|
72
|
-
|
|
72
|
+
const touchEventList = [
|
|
73
73
|
POINTER_MOVE[2],
|
|
74
74
|
POINTER_DOWN[2],
|
|
75
75
|
POINTER_UP[2],
|
|
@@ -79,7 +79,7 @@ var touchEventList = [
|
|
|
79
79
|
POINTER_LEAVE[2]
|
|
80
80
|
];
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
const pointerEventMap = {
|
|
83
83
|
wheel : WHEEL,
|
|
84
84
|
pointermove: POINTER_MOVE,
|
|
85
85
|
pointerdown: POINTER_DOWN,
|
|
@@ -264,8 +264,8 @@ function dispatchEvent(normalizedEvents) {
|
|
|
264
264
|
// and put it back into our cache
|
|
265
265
|
T_POINTERS.push(pointer);
|
|
266
266
|
|
|
267
|
-
// Do not fire older events
|
|
268
|
-
if (typeof(pointer.event.timeStamp) !== "undefined") {
|
|
267
|
+
// Do not fire older touch events (not required for PointerEvent type)
|
|
268
|
+
if (pointer.isNormalized === true && typeof(pointer.event.timeStamp) !== "undefined") {
|
|
269
269
|
if (pointer.event.timeStamp < lastTimeStamp) {
|
|
270
270
|
continue;
|
|
271
271
|
}
|
|
@@ -543,7 +543,6 @@ export var throttlingInterval;
|
|
|
543
543
|
* @name globalToLocal
|
|
544
544
|
* @memberof input
|
|
545
545
|
* @public
|
|
546
|
-
* @function
|
|
547
546
|
* @param {number} x the global x coordinate to be translated.
|
|
548
547
|
* @param {number} y the global y coordinate to be translated.
|
|
549
548
|
* @param {Vector2d} [v] an optional vector object where to set the translated coordinates
|
|
@@ -576,7 +575,6 @@ export function globalToLocal(x, y, v) {
|
|
|
576
575
|
* @memberof input
|
|
577
576
|
* @see https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action
|
|
578
577
|
* @public
|
|
579
|
-
* @function
|
|
580
578
|
* @param {HTMLCanvasElement} element
|
|
581
579
|
* @param {string} [value="none"]
|
|
582
580
|
*/
|
|
@@ -592,7 +590,6 @@ export function setTouchAction(element, value) {
|
|
|
592
590
|
* @name bindPointer
|
|
593
591
|
* @memberof input
|
|
594
592
|
* @public
|
|
595
|
-
* @function
|
|
596
593
|
* @param {number} [button=input.pointer.LEFT] (accordingly to W3C values : 0,1,2 for left, middle and right buttons)
|
|
597
594
|
* @param {input.KEY} keyCode
|
|
598
595
|
* @example
|
|
@@ -623,7 +620,6 @@ export function bindPointer() {
|
|
|
623
620
|
* @name unbindPointer
|
|
624
621
|
* @memberof input
|
|
625
622
|
* @public
|
|
626
|
-
* @function
|
|
627
623
|
* @param {number} [button=input.pointer.LEFT] (accordingly to W3C values : 0,1,2 for left, middle and right buttons)
|
|
628
624
|
* @example
|
|
629
625
|
* me.input.unbindPointer(me.input.pointer.LEFT);
|
|
@@ -645,7 +641,6 @@ export function unbindPointer(button) {
|
|
|
645
641
|
* @name registerPointerEvent
|
|
646
642
|
* @memberof input
|
|
647
643
|
* @public
|
|
648
|
-
* @function
|
|
649
644
|
* @param {string} eventType The event type for which the object is registering <br>
|
|
650
645
|
* melonJS currently supports: <br>
|
|
651
646
|
* <ul>
|
|
@@ -717,7 +712,6 @@ export function registerPointerEvent(eventType, region, callback) {
|
|
|
717
712
|
* @name releasePointerEvent
|
|
718
713
|
* @memberof input
|
|
719
714
|
* @public
|
|
720
|
-
* @function
|
|
721
715
|
* @param {string} eventType The event type for which the object was registered. See {@link input.registerPointerEvent}
|
|
722
716
|
* @param {Rect|Polygon|Line|Ellipse} region the registered region to release for this event
|
|
723
717
|
* @param {Function} [callback="all"] if specified unregister the event only for the specific callback
|
|
@@ -762,7 +756,6 @@ export function releasePointerEvent(eventType, region, callback) {
|
|
|
762
756
|
* @name releaseAllPointerEvents
|
|
763
757
|
* @memberof input
|
|
764
758
|
* @public
|
|
765
|
-
* @function
|
|
766
759
|
* @param {Rect|Polygon|Line|Ellipse} region the registered region to release event from
|
|
767
760
|
* @example
|
|
768
761
|
* // release all registered event on the
|
|
@@ -782,7 +775,6 @@ export function releaseAllPointerEvents(region) {
|
|
|
782
775
|
* @name requestPointerLock
|
|
783
776
|
* @memberof input
|
|
784
777
|
* @public
|
|
785
|
-
* @function
|
|
786
778
|
* @returns {boolean} return true if the request was successfully submitted
|
|
787
779
|
* @example
|
|
788
780
|
* // register on the pointer lock change event
|
|
@@ -806,7 +798,6 @@ export function requestPointerLock() {
|
|
|
806
798
|
* @name exitPointerLock
|
|
807
799
|
* @memberof input
|
|
808
800
|
* @public
|
|
809
|
-
* @function
|
|
810
801
|
* @returns {boolean} return true if the request was successfully submitted
|
|
811
802
|
*/
|
|
812
803
|
export function exitPointerLock() {
|
package/src/lang/deprecated.js
CHANGED
|
@@ -4,7 +4,7 @@ import { TextureAtlas } from "./../video/texture/atlas.js";
|
|
|
4
4
|
import Renderer from "./../video/renderer.js";
|
|
5
5
|
import { Draggable, DropTarget } from "./../renderable/dragndrop.js";
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/*
|
|
8
8
|
* placeholder for all deprecated classes and corresponding alias for backward compatibility
|
|
9
9
|
*/
|
|
10
10
|
|
|
@@ -48,7 +48,6 @@ export function warning(deprecated, replacement, version) {
|
|
|
48
48
|
/**
|
|
49
49
|
* @public
|
|
50
50
|
* @name turnOnPointerLock
|
|
51
|
-
* @function
|
|
52
51
|
* @returns {boolean} return true if the request was successfully submitted
|
|
53
52
|
* @memberof device#
|
|
54
53
|
* @deprecated since 10.3.0
|
|
@@ -62,7 +61,6 @@ device.turnOnPointerLock = function () {
|
|
|
62
61
|
/**
|
|
63
62
|
* @public
|
|
64
63
|
* @name turnOffPointerLock
|
|
65
|
-
* @function
|
|
66
64
|
* @returns {boolean} return true if the request was successfully submitted
|
|
67
65
|
* @memberof device#
|
|
68
66
|
* @deprecated since 10.3.0
|
|
@@ -74,8 +72,11 @@ device.turnOffPointerLock = function () {
|
|
|
74
72
|
};
|
|
75
73
|
|
|
76
74
|
/**
|
|
75
|
+
* Alias of {@link TextureAtlas}
|
|
76
|
+
*
|
|
77
77
|
* @public
|
|
78
78
|
* @name Texture
|
|
79
|
+
* @class
|
|
79
80
|
* @memberof Renderer#
|
|
80
81
|
* @deprecated since 10.4.0
|
|
81
82
|
* @see TextureAtlas
|
package/src/level/level.js
CHANGED
|
@@ -56,7 +56,6 @@ function safeLoadLevel(levelId, options, restart) {
|
|
|
56
56
|
* @param {boolean} [flatten=true] if true, flatten all objects into the given container
|
|
57
57
|
* @param {boolean} [setViewportBounds=false] if true, set the viewport bounds to the map size, this should be set to true especially if adding a level to the game world container.
|
|
58
58
|
* @ignore
|
|
59
|
-
* @function
|
|
60
59
|
*/
|
|
61
60
|
function loadTMXLevel(levelId, container, flatten, setViewportBounds) {
|
|
62
61
|
var level = levels[levelId];
|
|
@@ -85,7 +84,6 @@ var level = {
|
|
|
85
84
|
* @name add
|
|
86
85
|
* @memberof level
|
|
87
86
|
* @public
|
|
88
|
-
* @function
|
|
89
87
|
* @param {string} format level format (only "tmx" supported)
|
|
90
88
|
* @param {string} levelId the level id (or name)
|
|
91
89
|
* @param {Function} [callback] a function to be called once the level is loaded
|
|
@@ -124,7 +122,6 @@ var level = {
|
|
|
124
122
|
* @name load
|
|
125
123
|
* @memberof level
|
|
126
124
|
* @public
|
|
127
|
-
* @function
|
|
128
125
|
* @param {string} levelId level id
|
|
129
126
|
* @param {object} [options] additional optional parameters
|
|
130
127
|
* @param {Container} [options.container=game.world] container in which to load the specified level
|
|
@@ -198,7 +195,6 @@ var level = {
|
|
|
198
195
|
* @name getCurrentLevelId
|
|
199
196
|
* @memberof level
|
|
200
197
|
* @public
|
|
201
|
-
* @function
|
|
202
198
|
* @returns {string}
|
|
203
199
|
*/
|
|
204
200
|
getCurrentLevelId() {
|
|
@@ -212,7 +208,6 @@ var level = {
|
|
|
212
208
|
* @name getCurrentLevel
|
|
213
209
|
* @memberof level
|
|
214
210
|
* @public
|
|
215
|
-
* @function
|
|
216
211
|
* @returns {TMXTileMap}
|
|
217
212
|
*/
|
|
218
213
|
getCurrentLevel() {
|
|
@@ -224,7 +219,6 @@ var level = {
|
|
|
224
219
|
* @name reload
|
|
225
220
|
* @memberof level
|
|
226
221
|
* @public
|
|
227
|
-
* @function
|
|
228
222
|
* @param {object} [options] additional optional parameters
|
|
229
223
|
* @param {Container} [options.container=game.world] container in which to load the specified level
|
|
230
224
|
* @param {Function} [options.onLoaded=game.onLevelLoaded] callback for when the level is fully loaded
|
|
@@ -242,7 +236,6 @@ var level = {
|
|
|
242
236
|
* @name next
|
|
243
237
|
* @memberof level
|
|
244
238
|
* @public
|
|
245
|
-
* @function
|
|
246
239
|
* @param {object} [options] additional optional parameters
|
|
247
240
|
* @param {Container} [options.container=game.world] container in which to load the specified level
|
|
248
241
|
* @param {Function} [options.onLoaded=game.onLevelLoaded] callback for when the level is fully loaded
|
|
@@ -264,7 +257,6 @@ var level = {
|
|
|
264
257
|
* @name previous
|
|
265
258
|
* @memberof level
|
|
266
259
|
* @public
|
|
267
|
-
* @function
|
|
268
260
|
* @param {object} [options] additional optional parameters
|
|
269
261
|
* @param {Container} [options.container=game.world] container in which to load the specified level
|
|
270
262
|
* @param {Function} [options.onLoaded=game.onLevelLoaded] callback for when the level is fully loaded
|
|
@@ -286,7 +278,6 @@ var level = {
|
|
|
286
278
|
* @name levelCount
|
|
287
279
|
* @memberof level
|
|
288
280
|
* @public
|
|
289
|
-
* @function
|
|
290
281
|
* @returns {number} the amount of level preloaded
|
|
291
282
|
*/
|
|
292
283
|
levelCount() {
|
|
@@ -98,9 +98,7 @@ export default class TMXGroup {
|
|
|
98
98
|
/**
|
|
99
99
|
* reset function
|
|
100
100
|
* @ignore
|
|
101
|
-
* @function
|
|
102
101
|
*/
|
|
103
|
-
|
|
104
102
|
destroy() {
|
|
105
103
|
// clear all allocated objects
|
|
106
104
|
this.objects = null;
|
|
@@ -109,7 +107,6 @@ export default class TMXGroup {
|
|
|
109
107
|
/**
|
|
110
108
|
* return the object count
|
|
111
109
|
* @ignore
|
|
112
|
-
* @function
|
|
113
110
|
*/
|
|
114
111
|
getObjectCount() {
|
|
115
112
|
return this.objects.length;
|
|
@@ -118,7 +115,6 @@ export default class TMXGroup {
|
|
|
118
115
|
/**
|
|
119
116
|
* returns the object at the specified index
|
|
120
117
|
* @ignore
|
|
121
|
-
* @function
|
|
122
118
|
*/
|
|
123
119
|
getObjectByIndex(idx) {
|
|
124
120
|
return this.objects[idx];
|
|
@@ -242,7 +242,6 @@ class TMXLayer extends Renderable {
|
|
|
242
242
|
* @name setRenderer
|
|
243
243
|
* @memberof TMXLayer
|
|
244
244
|
* @public
|
|
245
|
-
* @function
|
|
246
245
|
* @param {TMXRenderer} renderer
|
|
247
246
|
* @example
|
|
248
247
|
* // use the parent map default renderer
|
|
@@ -258,7 +257,6 @@ class TMXLayer extends Renderable {
|
|
|
258
257
|
* @name getRenderer
|
|
259
258
|
* @memberof TMXLayer
|
|
260
259
|
* @public
|
|
261
|
-
* @function
|
|
262
260
|
* @returns {TMXRenderer} renderer
|
|
263
261
|
*/
|
|
264
262
|
getRenderer() {
|
|
@@ -271,7 +269,6 @@ class TMXLayer extends Renderable {
|
|
|
271
269
|
* @name getTileId
|
|
272
270
|
* @memberof TMXLayer
|
|
273
271
|
* @public
|
|
274
|
-
* @function
|
|
275
272
|
* @param {number} x X coordinate (in world/pixels coordinates)
|
|
276
273
|
* @param {number} y Y coordinate (in world/pixels coordinates)
|
|
277
274
|
* @returns {number} TileId or null if there is no Tile at the given position
|
|
@@ -286,7 +283,6 @@ class TMXLayer extends Renderable {
|
|
|
286
283
|
* @name getTile
|
|
287
284
|
* @memberof TMXLayer
|
|
288
285
|
* @public
|
|
289
|
-
* @function
|
|
290
286
|
* @param {number} x X coordinate (in world/pixels coordinates)
|
|
291
287
|
* @param {number} y Y coordinate (in world/pixels coordinates)
|
|
292
288
|
* @returns {Tile} corresponding tile or null if there is no defined tile at the coordinate or if outside of the layer bounds
|
|
@@ -312,7 +308,6 @@ class TMXLayer extends Renderable {
|
|
|
312
308
|
* @name getTile
|
|
313
309
|
* @memberof TMXLayer
|
|
314
310
|
* @public
|
|
315
|
-
* @function
|
|
316
311
|
* @param {Tile} tile the tile object to be assigned
|
|
317
312
|
* @param {number} x x coordinate (in world/pixels coordinates)
|
|
318
313
|
* @param {number} y y coordinate (in world/pixels coordinates)
|
|
@@ -328,7 +323,6 @@ class TMXLayer extends Renderable {
|
|
|
328
323
|
* @name setTile
|
|
329
324
|
* @memberof TMXLayer
|
|
330
325
|
* @public
|
|
331
|
-
* @function
|
|
332
326
|
* @param {number} tileId tileId
|
|
333
327
|
* @param {number} x X coordinate (in world/pixels coordinates)
|
|
334
328
|
* @param {number} y Y coordinate (in world/pixels coordinates)
|
|
@@ -347,7 +341,6 @@ class TMXLayer extends Renderable {
|
|
|
347
341
|
* @name cellAt
|
|
348
342
|
* @memberof TMXLayer
|
|
349
343
|
* @public
|
|
350
|
-
* @function
|
|
351
344
|
* @param {number} x x position of the tile (in Tile unit)
|
|
352
345
|
* @param {number} y x position of the tile (in Tile unit)
|
|
353
346
|
* @param {number} [boundsCheck=true] check first if within the layer bounds
|
|
@@ -374,7 +367,6 @@ class TMXLayer extends Renderable {
|
|
|
374
367
|
* @name clearTile
|
|
375
368
|
* @memberof TMXLayer
|
|
376
369
|
* @public
|
|
377
|
-
* @function
|
|
378
370
|
* @param {number} x X coordinate (in map coordinates: row/column)
|
|
379
371
|
* @param {number} y Y coordinate (in map coordinates: row/column)
|
|
380
372
|
* @example
|
|
@@ -226,7 +226,6 @@ export default class TMXObject {
|
|
|
226
226
|
/**
|
|
227
227
|
* set the object image (for Tiled Object)
|
|
228
228
|
* @ignore
|
|
229
|
-
* @function
|
|
230
229
|
*/
|
|
231
230
|
setTile(tilesets) {
|
|
232
231
|
// get the corresponding tileset
|
|
@@ -247,7 +246,6 @@ export default class TMXObject {
|
|
|
247
246
|
* @name parseTMXShapes
|
|
248
247
|
* @memberof TMXObject
|
|
249
248
|
* @private
|
|
250
|
-
* @function
|
|
251
249
|
* @returns {Polygon[]|Line[]|Ellipse[]} an array of shape objects
|
|
252
250
|
*/
|
|
253
251
|
parseTMXShapes() {
|
|
@@ -318,7 +316,6 @@ export default class TMXObject {
|
|
|
318
316
|
/**
|
|
319
317
|
* getObjectPropertyByName
|
|
320
318
|
* @ignore
|
|
321
|
-
* @function
|
|
322
319
|
*/
|
|
323
320
|
getObjectPropertyByName(name) {
|
|
324
321
|
return this[name];
|
|
@@ -3,10 +3,10 @@ import Sprite from "./../../renderable/sprite.js";
|
|
|
3
3
|
import Bounds from "./../../physics/bounds.js";
|
|
4
4
|
|
|
5
5
|
// bitmask constants to check for flipped & rotated tiles
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const TMX_FLIP_H = 0x80000000,
|
|
7
|
+
TMX_FLIP_V = 0x40000000,
|
|
8
|
+
TMX_FLIP_AD = 0x20000000,
|
|
9
|
+
TMX_CLEAR_BIT_MASK = ~(0x80000000 | 0x40000000 | 0x20000000);
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @classdesc
|
|
@@ -132,7 +132,6 @@ class Tile extends Bounds {
|
|
|
132
132
|
* return a renderable object for this Tile object
|
|
133
133
|
* @name Tile#getRenderable
|
|
134
134
|
* @public
|
|
135
|
-
* @function
|
|
136
135
|
* @param {object} [settings] see {@link Sprite}
|
|
137
136
|
* @returns {Renderable} a me.Sprite object
|
|
138
137
|
*/
|