melonjs 10.11.0 → 10.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/melonjs.js +151 -121
- package/dist/melonjs.min.js +3 -3
- package/dist/melonjs.module.d.ts +197 -111
- package/dist/melonjs.module.js +147 -123
- package/package.json +7 -7
- package/src/entity/entity.js +5 -7
- package/src/geometries/ellipse.js +1 -1
- package/src/geometries/path2d.js +4 -4
- package/src/geometries/poly.js +1 -2
- package/src/geometries/rectangle.js +1 -1
- package/src/physics/body.js +3 -4
- package/src/physics/collision.js +1 -12
- package/src/physics/detector.js +6 -52
- package/src/physics/response.js +48 -0
- package/src/physics/sat.js +1 -1
- package/src/renderable/GUI.js +6 -4
- package/src/renderable/colorlayer.js +9 -7
- package/src/renderable/container.js +12 -10
- package/src/renderable/dragndrop.js +1 -1
- package/src/renderable/imagelayer.js +5 -5
- package/src/renderable/light2d.js +7 -3
- package/src/renderable/renderable.js +6 -6
- package/src/renderable/sprite.js +4 -4
- package/src/renderable/trigger.js +9 -2
- package/src/state/state.js +19 -3
- package/src/system/pooling.js +1 -1
- package/src/text/text.js +6 -3
- package/src/video/texture/atlas.js +2 -0
package/dist/melonjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v10.
|
|
2
|
+
* melonJS Game Engine - v10.12.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
|
|
@@ -315,10 +315,10 @@
|
|
|
315
315
|
(shared$3.exports = function (key, value) {
|
|
316
316
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
317
317
|
})('versions', []).push({
|
|
318
|
-
version: '3.23.
|
|
318
|
+
version: '3.23.1',
|
|
319
319
|
mode: 'global',
|
|
320
320
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
321
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.23.
|
|
321
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.23.1/LICENSE',
|
|
322
322
|
source: 'https://github.com/zloirock/core-js'
|
|
323
323
|
});
|
|
324
324
|
|
|
@@ -1753,7 +1753,7 @@
|
|
|
1753
1753
|
return (typeof className !== "undefined") &&
|
|
1754
1754
|
(typeof obj.onResetEvent === "function") &&
|
|
1755
1755
|
(className in this.objectClass) &&
|
|
1756
|
-
(this.objectClass[className].pool !== "undefined");
|
|
1756
|
+
(typeof this.objectClass[className].pool !== "undefined");
|
|
1757
1757
|
|
|
1758
1758
|
};
|
|
1759
1759
|
|
|
@@ -10364,7 +10364,7 @@
|
|
|
10364
10364
|
* (which means that all angles are less than 180 degrees), as described here below : <br>
|
|
10365
10365
|
* <center><img src="images/convex_polygon.png"/></center><br>
|
|
10366
10366
|
*
|
|
10367
|
-
* A polygon's `winding` is clockwise
|
|
10367
|
+
* A polygon's `winding` is clockwise if its vertices (points) are declared turning to the right. The image above shows COUNTERCLOCKWISE winding.
|
|
10368
10368
|
*/
|
|
10369
10369
|
var Polygon = function Polygon(x, y, points) {
|
|
10370
10370
|
/**
|
|
@@ -11010,7 +11010,7 @@
|
|
|
11010
11010
|
* @name centerOn
|
|
11011
11011
|
* @memberof Rect
|
|
11012
11012
|
* @param {number} x the x coordinate around which to center this rectangle
|
|
11013
|
-
* @param {number}
|
|
11013
|
+
* @param {number} y the y coordinate around which to center this rectangle
|
|
11014
11014
|
* @returns {Rect} this rectangle
|
|
11015
11015
|
*/
|
|
11016
11016
|
Rect.prototype.centerOn = function centerOn (x, y) {
|
|
@@ -14549,14 +14549,14 @@
|
|
|
14549
14549
|
};
|
|
14550
14550
|
|
|
14551
14551
|
/**
|
|
14552
|
-
*
|
|
14553
|
-
* automatically called by the game manager {@link game}
|
|
14552
|
+
* draw this renderable (automatically called by melonJS)
|
|
14554
14553
|
* @name draw
|
|
14555
14554
|
* @memberof Renderable
|
|
14556
14555
|
* @protected
|
|
14557
|
-
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer
|
|
14556
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
14557
|
+
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
14558
14558
|
*/
|
|
14559
|
-
Renderable.prototype.draw = function draw (renderer) { // eslint-disable-line no-unused-vars
|
|
14559
|
+
Renderable.prototype.draw = function draw (renderer, viewport) { // eslint-disable-line no-unused-vars
|
|
14560
14560
|
// empty one !
|
|
14561
14561
|
};
|
|
14562
14562
|
|
|
@@ -14589,7 +14589,7 @@
|
|
|
14589
14589
|
* when this renderable body is colliding with another one
|
|
14590
14590
|
* @name onCollision
|
|
14591
14591
|
* @memberof Renderable
|
|
14592
|
-
* @param {
|
|
14592
|
+
* @param {ResponseObject} response the collision response object
|
|
14593
14593
|
* @param {Renderable} other the other renderable touching this one (a reference to response.a or response.b)
|
|
14594
14594
|
* @returns {boolean} true if the object should respond to the collision (its position and velocity will be corrected)
|
|
14595
14595
|
* @example
|
|
@@ -14606,7 +14606,7 @@
|
|
|
14606
14606
|
* return true;
|
|
14607
14607
|
* },
|
|
14608
14608
|
*/
|
|
14609
|
-
Renderable.prototype.onCollision = function onCollision () {
|
|
14609
|
+
Renderable.prototype.onCollision = function onCollision (response, other) { // eslint-disable-line no-unused-vars
|
|
14610
14610
|
return false;
|
|
14611
14611
|
};
|
|
14612
14612
|
|
|
@@ -14822,7 +14822,7 @@
|
|
|
14822
14822
|
* @param {Matrix2d} matrix the transformation matrix
|
|
14823
14823
|
* @returns {Polygon} Reference to this object for method chaining
|
|
14824
14824
|
*/
|
|
14825
|
-
Ellipse.prototype.transform = function transform (
|
|
14825
|
+
Ellipse.prototype.transform = function transform (matrix) { // eslint-disable-line no-unused-vars
|
|
14826
14826
|
// TODO
|
|
14827
14827
|
return this;
|
|
14828
14828
|
};
|
|
@@ -15389,7 +15389,7 @@
|
|
|
15389
15389
|
*/
|
|
15390
15390
|
function testEllipsePolygon(a, ellipseA, b, polyB, response) {
|
|
15391
15391
|
// Test the polygon against the circle.
|
|
15392
|
-
var result =
|
|
15392
|
+
var result = testPolygonEllipse(b, polyB, a, ellipseA, response);
|
|
15393
15393
|
if (result && response) {
|
|
15394
15394
|
// Swap A and B in the response.
|
|
15395
15395
|
var resa = response.a;
|
|
@@ -15412,36 +15412,6 @@
|
|
|
15412
15412
|
testEllipsePolygon: testEllipsePolygon
|
|
15413
15413
|
});
|
|
15414
15414
|
|
|
15415
|
-
// a dummy object when using Line for raycasting
|
|
15416
|
-
var dummyObj = {
|
|
15417
|
-
pos : new Vector2d(0, 0),
|
|
15418
|
-
ancestor : {
|
|
15419
|
-
_absPos : new Vector2d(0, 0),
|
|
15420
|
-
getAbsolutePosition : function () {
|
|
15421
|
-
return this._absPos;
|
|
15422
|
-
}
|
|
15423
|
-
}
|
|
15424
|
-
};
|
|
15425
|
-
|
|
15426
|
-
/**
|
|
15427
|
-
* a function used to determine if two objects should collide (based on both respective objects collision mask and type).<br>
|
|
15428
|
-
* you can redefine this function if you need any specific rules over what should collide with what.
|
|
15429
|
-
* @name shouldCollide
|
|
15430
|
-
* @memberof collision
|
|
15431
|
-
* @ignore
|
|
15432
|
-
* @param {Renderable} a a reference to the object A.
|
|
15433
|
-
* @param {Renderable} b a reference to the object B.
|
|
15434
|
-
* @returns {boolean} true if they should collide, false otherwise
|
|
15435
|
-
*/
|
|
15436
|
-
function shouldCollide(a, b) {
|
|
15437
|
-
return (
|
|
15438
|
-
a.isKinematic !== true && b.isKinematic !== true &&
|
|
15439
|
-
typeof a.body === "object" && typeof b.body === "object" &&
|
|
15440
|
-
!(a.body.isStatic === true && b.body.isStatic === true) &&
|
|
15441
|
-
(a.body.collisionMask & b.body.collisionType) !== 0 &&
|
|
15442
|
-
(a.body.collisionType & b.body.collisionMask) !== 0
|
|
15443
|
-
);
|
|
15444
|
-
}
|
|
15445
15415
|
/**
|
|
15446
15416
|
* @classdesc
|
|
15447
15417
|
* An object representing the result of an intersection.
|
|
@@ -15455,7 +15425,6 @@
|
|
|
15455
15425
|
* @property {number} indexShapeA The index of the colliding shape for the object a body
|
|
15456
15426
|
* @property {number} indexShapeB The index of the colliding shape for the object b body
|
|
15457
15427
|
* @name ResponseObject
|
|
15458
|
-
* @memberof collision
|
|
15459
15428
|
* @public
|
|
15460
15429
|
*/
|
|
15461
15430
|
var ResponseObject = function ResponseObject() {
|
|
@@ -15476,7 +15445,6 @@
|
|
|
15476
15445
|
* Response object for multiple intersection tests <br>
|
|
15477
15446
|
* (recommended as it will avoid allocating extra memory) <br>
|
|
15478
15447
|
* @name clear
|
|
15479
|
-
* @memberof collision.ResponseObject
|
|
15480
15448
|
* @public
|
|
15481
15449
|
* @returns {object} this object for chaining
|
|
15482
15450
|
*/
|
|
@@ -15489,15 +15457,47 @@
|
|
|
15489
15457
|
return this;
|
|
15490
15458
|
};
|
|
15491
15459
|
|
|
15492
|
-
//
|
|
15460
|
+
// a dummy object when using Line for raycasting
|
|
15461
|
+
var dummyObj = {
|
|
15462
|
+
pos : new Vector2d(0, 0),
|
|
15463
|
+
ancestor : {
|
|
15464
|
+
_absPos : new Vector2d(0, 0),
|
|
15465
|
+
getAbsolutePosition : function () {
|
|
15466
|
+
return this._absPos;
|
|
15467
|
+
}
|
|
15468
|
+
}
|
|
15469
|
+
};
|
|
15470
|
+
|
|
15471
|
+
// the global response object used for collisions
|
|
15493
15472
|
var globalResponse = new ResponseObject();
|
|
15494
15473
|
|
|
15474
|
+
/**
|
|
15475
|
+
* a function used to determine if two objects should collide (based on both respective objects collision mask and type).<br>
|
|
15476
|
+
* you can redefine this function if you need any specific rules over what should collide with what.
|
|
15477
|
+
* @name shouldCollide
|
|
15478
|
+
* @memberof collision
|
|
15479
|
+
* @ignore
|
|
15480
|
+
* @param {Renderable} a a reference to the object A.
|
|
15481
|
+
* @param {Renderable} b a reference to the object B.
|
|
15482
|
+
* @returns {boolean} true if they should collide, false otherwise
|
|
15483
|
+
*/
|
|
15484
|
+
function shouldCollide(a, b) {
|
|
15485
|
+
return (
|
|
15486
|
+
a.isKinematic !== true && b.isKinematic !== true &&
|
|
15487
|
+
typeof a.body === "object" && typeof b.body === "object" &&
|
|
15488
|
+
!(a.body.isStatic === true && b.body.isStatic === true) &&
|
|
15489
|
+
(a.body.collisionMask & b.body.collisionType) !== 0 &&
|
|
15490
|
+
(a.body.collisionType & b.body.collisionMask) !== 0
|
|
15491
|
+
);
|
|
15492
|
+
}
|
|
15493
|
+
|
|
15494
|
+
|
|
15495
15495
|
/**
|
|
15496
15496
|
* find all the collisions for the specified object
|
|
15497
15497
|
* @name collisionCheck
|
|
15498
15498
|
* @ignore
|
|
15499
15499
|
* @param {Renderable} objA object to be tested for collision
|
|
15500
|
-
* @param {
|
|
15500
|
+
* @param {ResponseObject} [response] a user defined response object that will be populated if they intersect.
|
|
15501
15501
|
* @returns {boolean} in case of collision, false otherwise
|
|
15502
15502
|
*/
|
|
15503
15503
|
function collisionCheck(objA, response) {
|
|
@@ -15731,17 +15731,6 @@
|
|
|
15731
15731
|
ALL_OBJECT : 0xFFFFFFFF // all objects
|
|
15732
15732
|
},
|
|
15733
15733
|
|
|
15734
|
-
|
|
15735
|
-
/**
|
|
15736
|
-
* a global instance of a response object used for collision detection <br>
|
|
15737
|
-
* this object will be reused amongst collision detection call if not user-defined response is specified
|
|
15738
|
-
* @name response
|
|
15739
|
-
* @memberof collision
|
|
15740
|
-
* @public
|
|
15741
|
-
* @type {collision.ResponseObject}
|
|
15742
|
-
*/
|
|
15743
|
-
response : globalResponse,
|
|
15744
|
-
|
|
15745
15734
|
/**
|
|
15746
15735
|
* Checks for object colliding with the given line
|
|
15747
15736
|
* @name rayCast
|
|
@@ -15774,6 +15763,7 @@
|
|
|
15774
15763
|
/**
|
|
15775
15764
|
* @classdesc
|
|
15776
15765
|
* a Generic Physic Body Object with some physic properties and behavior functionality, to as a member of a Renderable.
|
|
15766
|
+
* @see Renderable.body
|
|
15777
15767
|
*/
|
|
15778
15768
|
var Body = function Body(ancestor, shapes, onBodyUpdate) {
|
|
15779
15769
|
|
|
@@ -16202,7 +16192,7 @@
|
|
|
16202
16192
|
|
|
16203
16193
|
/**
|
|
16204
16194
|
* the built-in function to solve the collision response
|
|
16205
|
-
* @param {object} response the collision response object (see {@link
|
|
16195
|
+
* @param {object} response the collision response object (see {@link ResponseObject})
|
|
16206
16196
|
*/
|
|
16207
16197
|
Body.prototype.respondToCollision = function respondToCollision (response) {
|
|
16208
16198
|
// the overlap vector
|
|
@@ -16339,7 +16329,6 @@
|
|
|
16339
16329
|
* cap the body velocity (body.maxVel property) to the specified value<br>
|
|
16340
16330
|
* @param {number} x max velocity on x axis
|
|
16341
16331
|
* @param {number} y max velocity on y axis
|
|
16342
|
-
* @protected
|
|
16343
16332
|
*/
|
|
16344
16333
|
Body.prototype.setMaxVelocity = function setMaxVelocity (x, y) {
|
|
16345
16334
|
this.maxVel.x = x;
|
|
@@ -16350,7 +16339,6 @@
|
|
|
16350
16339
|
* set the body default friction
|
|
16351
16340
|
* @param {number} x horizontal friction
|
|
16352
16341
|
* @param {number} y vertical friction
|
|
16353
|
-
* @protected
|
|
16354
16342
|
*/
|
|
16355
16343
|
Body.prototype.setFriction = function setFriction (x, y) {
|
|
16356
16344
|
if ( x === void 0 ) x = 0;
|
|
@@ -16461,7 +16449,7 @@
|
|
|
16461
16449
|
pool.push(this.friction);
|
|
16462
16450
|
pool.push(this.maxVel);
|
|
16463
16451
|
this.shapes.forEach(function (shape) {
|
|
16464
|
-
pool.push(shape);
|
|
16452
|
+
pool.push(shape, false);
|
|
16465
16453
|
});
|
|
16466
16454
|
|
|
16467
16455
|
// set to undefined
|
|
@@ -16574,7 +16562,7 @@
|
|
|
16574
16562
|
* @memberof Container#
|
|
16575
16563
|
* @param {number} index added or removed child index
|
|
16576
16564
|
*/
|
|
16577
|
-
this.onChildChange = function (
|
|
16565
|
+
this.onChildChange = function (index) { // eslint-disable-line no-unused-vars
|
|
16578
16566
|
// to be extended
|
|
16579
16567
|
};
|
|
16580
16568
|
|
|
@@ -16662,8 +16650,10 @@
|
|
|
16662
16650
|
* Adding a child to the container will automatically remove it from its other container.
|
|
16663
16651
|
* Meaning a child can only have one parent. This is important if you add a renderable
|
|
16664
16652
|
* to a container then add it to the me.game.world container it will move it out of the
|
|
16665
|
-
* orginal container.
|
|
16666
|
-
* will not be in any container.
|
|
16653
|
+
* orginal container. Then when the me.game.world.reset() is called the renderable
|
|
16654
|
+
* will not be in any container. <br>
|
|
16655
|
+
* if the given child implements a onActivateEvent method, that method will be called
|
|
16656
|
+
* once the child is added to this container.
|
|
16667
16657
|
* @name addChild
|
|
16668
16658
|
* @memberof Container
|
|
16669
16659
|
* @param {Renderable} child
|
|
@@ -17109,7 +17099,8 @@
|
|
|
17109
17099
|
};
|
|
17110
17100
|
|
|
17111
17101
|
/**
|
|
17112
|
-
* Invokes the removeChildNow in a defer, to ensure the child is removed safely after the update & draw stack has completed
|
|
17102
|
+
* Invokes the removeChildNow in a defer, to ensure the child is removed safely after the update & draw stack has completed. <br>
|
|
17103
|
+
* if the given child implements a onDeactivateEvent() method, that method will be called once the child is removed from this container.
|
|
17113
17104
|
* @name removeChild
|
|
17114
17105
|
* @memberof Container
|
|
17115
17106
|
* @public
|
|
@@ -17411,15 +17402,14 @@
|
|
|
17411
17402
|
};
|
|
17412
17403
|
|
|
17413
17404
|
/**
|
|
17414
|
-
|
|
17415
|
-
* automatically called by the game manager {@link game}
|
|
17405
|
+
* draw this renderable (automatically called by melonJS)
|
|
17416
17406
|
* @name draw
|
|
17417
17407
|
* @memberof Container
|
|
17418
17408
|
* @protected
|
|
17419
|
-
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer
|
|
17420
|
-
* @param {
|
|
17409
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
17410
|
+
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
17421
17411
|
*/
|
|
17422
|
-
Container.prototype.draw = function draw (renderer,
|
|
17412
|
+
Container.prototype.draw = function draw (renderer, viewport) {
|
|
17423
17413
|
var isFloating = false;
|
|
17424
17414
|
var bounds = this.getBounds();
|
|
17425
17415
|
|
|
@@ -17461,7 +17451,7 @@
|
|
|
17461
17451
|
obj.preDraw(renderer);
|
|
17462
17452
|
|
|
17463
17453
|
// draw the object
|
|
17464
|
-
obj.draw(renderer,
|
|
17454
|
+
obj.draw(renderer, viewport);
|
|
17465
17455
|
|
|
17466
17456
|
// postdraw (clean-up);
|
|
17467
17457
|
obj.postDraw(renderer);
|
|
@@ -19821,6 +19811,26 @@
|
|
|
19821
19811
|
}
|
|
19822
19812
|
},
|
|
19823
19813
|
|
|
19814
|
+
/**
|
|
19815
|
+
* returns the stage associated with the specified state
|
|
19816
|
+
* (or the current one if none is specified)
|
|
19817
|
+
* @name set
|
|
19818
|
+
* @memberof state
|
|
19819
|
+
* @public
|
|
19820
|
+
* @param {number} [state] State ID (see constants)
|
|
19821
|
+
* @returns {Stage}
|
|
19822
|
+
*/
|
|
19823
|
+
get: function get(state) {
|
|
19824
|
+
if ( state === void 0 ) state = _state;
|
|
19825
|
+
|
|
19826
|
+
if (typeof _stages[state] !== "undefined") {
|
|
19827
|
+
return _stages[state].stage;
|
|
19828
|
+
} else {
|
|
19829
|
+
return undefined;
|
|
19830
|
+
}
|
|
19831
|
+
|
|
19832
|
+
},
|
|
19833
|
+
|
|
19824
19834
|
/**
|
|
19825
19835
|
* return a reference to the current stage<br>
|
|
19826
19836
|
* useful to call a object specific method
|
|
@@ -19830,9 +19840,7 @@
|
|
|
19830
19840
|
* @returns {Stage}
|
|
19831
19841
|
*/
|
|
19832
19842
|
current: function current() {
|
|
19833
|
-
|
|
19834
|
-
return _stages[_state].stage;
|
|
19835
|
-
}
|
|
19843
|
+
return this.get();
|
|
19836
19844
|
},
|
|
19837
19845
|
|
|
19838
19846
|
/**
|
|
@@ -21205,6 +21213,8 @@
|
|
|
21205
21213
|
* add uvs mapping for the given region
|
|
21206
21214
|
* @param {object} atlas the atlas dictionnary where the region is define
|
|
21207
21215
|
* @param {object} name region (or frame) name
|
|
21216
|
+
* @param {number} w the width of the region
|
|
21217
|
+
* @param {number} h the height of the region
|
|
21208
21218
|
* @returns {Float32Array} the created region UVs
|
|
21209
21219
|
*/
|
|
21210
21220
|
TextureAtlas.prototype.addUVs = function addUVs (atlas, name, w, h) {
|
|
@@ -21885,14 +21895,14 @@
|
|
|
21885
21895
|
};
|
|
21886
21896
|
|
|
21887
21897
|
/**
|
|
21888
|
-
*
|
|
21889
|
-
* automatically called by the game manager {@link game}
|
|
21898
|
+
* draw this srite (automatically called by melonJS)
|
|
21890
21899
|
* @name draw
|
|
21891
21900
|
* @memberof Sprite
|
|
21892
21901
|
* @protected
|
|
21893
|
-
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer
|
|
21902
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
21903
|
+
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
21894
21904
|
*/
|
|
21895
|
-
Sprite.prototype.draw = function draw (renderer) {
|
|
21905
|
+
Sprite.prototype.draw = function draw (renderer, viewport) { // eslint-disable-line no-unused-vars
|
|
21896
21906
|
// do nothing if we are flickering
|
|
21897
21907
|
if (this._flicker.isFlickering) {
|
|
21898
21908
|
this._flicker.state = !this._flicker.state;
|
|
@@ -22539,10 +22549,10 @@
|
|
|
22539
22549
|
* adds a circular arc to the path with the given control points and radius, connected to the previous point by a straight line.
|
|
22540
22550
|
* @name arcTo
|
|
22541
22551
|
* @memberof Path2D
|
|
22542
|
-
* @param {number}
|
|
22543
|
-
* @param {number}
|
|
22544
|
-
* @param {number}
|
|
22545
|
-
* @param {number}
|
|
22552
|
+
* @param {number} x1 the x-axis coordinate of the first control point.
|
|
22553
|
+
* @param {number} y1 the y-axis coordinate of the first control point.
|
|
22554
|
+
* @param {number} x2 the x-axis coordinate of the second control point.
|
|
22555
|
+
* @param {number} y2 the y-axis coordinate of the second control point.
|
|
22546
22556
|
* @param {number} radius the arc's radius. Must be positive.
|
|
22547
22557
|
*/
|
|
22548
22558
|
Path2D.prototype.arcTo = function arcTo (x1, y1, x2, y2, radius) {
|
|
@@ -32891,10 +32901,10 @@
|
|
|
32891
32901
|
* this can be overridden by the plugin
|
|
32892
32902
|
* @public
|
|
32893
32903
|
* @type {string}
|
|
32894
|
-
* @default "10.
|
|
32904
|
+
* @default "10.12.0"
|
|
32895
32905
|
* @name plugin.Base#version
|
|
32896
32906
|
*/
|
|
32897
|
-
this.version = "10.
|
|
32907
|
+
this.version = "10.12.0";
|
|
32898
32908
|
};
|
|
32899
32909
|
|
|
32900
32910
|
/**
|
|
@@ -34176,11 +34186,14 @@
|
|
|
34176
34186
|
var toPX = [12, 24, 0.75, 1];
|
|
34177
34187
|
|
|
34178
34188
|
// return a valid 2d context for Text rendering/styling
|
|
34179
|
-
var getContext2d = function (renderer, text) {
|
|
34189
|
+
var getContext2d = function (renderer$1, text) {
|
|
34180
34190
|
if (text.offScreenCanvas === true) {
|
|
34181
34191
|
return text.canvasTexture.context;
|
|
34182
34192
|
} else {
|
|
34183
|
-
|
|
34193
|
+
if (typeof renderer$1 === "undefined") {
|
|
34194
|
+
renderer$1 = renderer;
|
|
34195
|
+
}
|
|
34196
|
+
return renderer$1.getFontContext();
|
|
34184
34197
|
}
|
|
34185
34198
|
};
|
|
34186
34199
|
|
|
@@ -34477,15 +34490,14 @@
|
|
|
34477
34490
|
|
|
34478
34491
|
/**
|
|
34479
34492
|
* measure the given text size in pixels
|
|
34480
|
-
* @param {CanvasRenderer|WebGLRenderer}
|
|
34493
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer reference to the active renderer
|
|
34481
34494
|
* @param {string} [text] the text to be measured
|
|
34482
34495
|
* @returns {TextMetrics} a TextMetrics object defining the dimensions of the given piece of text
|
|
34483
34496
|
*/
|
|
34484
|
-
Text.prototype.measureText = function measureText (renderer
|
|
34485
|
-
if ( renderer$1 === void 0 ) renderer$1 = renderer;
|
|
34497
|
+
Text.prototype.measureText = function measureText (renderer, text) {
|
|
34486
34498
|
if ( text === void 0 ) text = this._text;
|
|
34487
34499
|
|
|
34488
|
-
return this.metrics.measureText(text, getContext2d(renderer
|
|
34500
|
+
return this.metrics.measureText(text, getContext2d(renderer, this));
|
|
34489
34501
|
};
|
|
34490
34502
|
|
|
34491
34503
|
|
|
@@ -34498,6 +34510,10 @@
|
|
|
34498
34510
|
* @param {boolean} [stroke=false] draw stroke the the text if true
|
|
34499
34511
|
*/
|
|
34500
34512
|
Text.prototype.draw = function draw (renderer, text, x, y, stroke) {
|
|
34513
|
+
if ( x === void 0 ) x = this.pos.x;
|
|
34514
|
+
if ( y === void 0 ) y = this.pos.y;
|
|
34515
|
+
if ( stroke === void 0 ) stroke = false;
|
|
34516
|
+
|
|
34501
34517
|
// "hacky patch" for backward compatibilty
|
|
34502
34518
|
if (typeof this.ancestor === "undefined") {
|
|
34503
34519
|
|
|
@@ -35191,15 +35207,18 @@
|
|
|
35191
35207
|
};
|
|
35192
35208
|
|
|
35193
35209
|
/**
|
|
35194
|
-
* draw
|
|
35195
|
-
* @
|
|
35210
|
+
* draw this color layer (automatically called by melonJS)
|
|
35211
|
+
* @name draw
|
|
35212
|
+
* @memberof ColorLayer
|
|
35213
|
+
* @protected
|
|
35214
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
35215
|
+
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
35196
35216
|
*/
|
|
35197
|
-
ColorLayer.prototype.draw = function draw (renderer,
|
|
35198
|
-
var vpos = viewport.pos;
|
|
35217
|
+
ColorLayer.prototype.draw = function draw (renderer, viewport) {
|
|
35199
35218
|
renderer.save();
|
|
35200
35219
|
renderer.clipRect(
|
|
35201
|
-
|
|
35202
|
-
|
|
35220
|
+
0, 0,
|
|
35221
|
+
viewport.width, viewport.height
|
|
35203
35222
|
);
|
|
35204
35223
|
renderer.clearColor(this.color);
|
|
35205
35224
|
renderer.restore();
|
|
@@ -35367,7 +35386,7 @@
|
|
|
35367
35386
|
* @param {number} h new height
|
|
35368
35387
|
*/
|
|
35369
35388
|
ImageLayer.prototype.resize = function resize (w, h) {
|
|
35370
|
-
Sprite.prototype.resize.call(
|
|
35389
|
+
return Sprite.prototype.resize.call(
|
|
35371
35390
|
this, this.repeatX ? Infinity : w,
|
|
35372
35391
|
this.repeatY ? Infinity : h
|
|
35373
35392
|
);
|
|
@@ -35446,14 +35465,14 @@
|
|
|
35446
35465
|
};
|
|
35447
35466
|
|
|
35448
35467
|
/**
|
|
35449
|
-
* draw
|
|
35450
|
-
* automatically called by the game manager {@link game}
|
|
35468
|
+
* draw this ImageLayer (automatically called by melonJS)
|
|
35451
35469
|
* @name draw
|
|
35452
35470
|
* @memberof ImageLayer
|
|
35453
35471
|
* @protected
|
|
35454
|
-
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer
|
|
35472
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
35473
|
+
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
35455
35474
|
*/
|
|
35456
|
-
ImageLayer.prototype.draw = function draw (renderer) {
|
|
35475
|
+
ImageLayer.prototype.draw = function draw (renderer, viewport) {
|
|
35457
35476
|
var width = this.width,
|
|
35458
35477
|
height = this.height,
|
|
35459
35478
|
bw = viewport.bounds.width,
|
|
@@ -35785,7 +35804,7 @@
|
|
|
35785
35804
|
* @param {Pointer} event the event object
|
|
35786
35805
|
* @returns {boolean} return false if we need to stop propagating the event
|
|
35787
35806
|
*/
|
|
35788
|
-
GUI_Object.prototype.onClick = function onClick (
|
|
35807
|
+
GUI_Object.prototype.onClick = function onClick (event) { // eslint-disable-line no-unused-vars
|
|
35789
35808
|
return false;
|
|
35790
35809
|
};
|
|
35791
35810
|
|
|
@@ -35806,7 +35825,9 @@
|
|
|
35806
35825
|
* @public
|
|
35807
35826
|
* @param {Pointer} event the event object
|
|
35808
35827
|
*/
|
|
35809
|
-
GUI_Object.prototype.onOver = function onOver (
|
|
35828
|
+
GUI_Object.prototype.onOver = function onOver (event) { // eslint-disable-line no-unused-vars
|
|
35829
|
+
// to be extended
|
|
35830
|
+
};
|
|
35810
35831
|
|
|
35811
35832
|
/**
|
|
35812
35833
|
* function callback for the pointerLeave event
|
|
@@ -35826,8 +35847,8 @@
|
|
|
35826
35847
|
* @public
|
|
35827
35848
|
* @param {Pointer} event the event object
|
|
35828
35849
|
*/
|
|
35829
|
-
GUI_Object.prototype.onOut = function onOut (
|
|
35830
|
-
|
|
35850
|
+
GUI_Object.prototype.onOut = function onOut (event) { // eslint-disable-line no-unused-vars
|
|
35851
|
+
// to be extended
|
|
35831
35852
|
};
|
|
35832
35853
|
|
|
35833
35854
|
/**
|
|
@@ -36056,8 +36077,15 @@
|
|
|
36056
36077
|
}
|
|
36057
36078
|
};
|
|
36058
36079
|
|
|
36059
|
-
/**
|
|
36060
|
-
|
|
36080
|
+
/**
|
|
36081
|
+
* onCollision callback, triggered in case of collision with this trigger
|
|
36082
|
+
* @name onCollision
|
|
36083
|
+
* @memberof Trigger
|
|
36084
|
+
* @param {ResponseObject} response the collision response object
|
|
36085
|
+
* @param {Renderable} other the other renderable touching this one (a reference to response.a or response.b)
|
|
36086
|
+
* @returns {boolean} true if the object should respond to the collision (its position and velocity will be corrected)
|
|
36087
|
+
*/
|
|
36088
|
+
Trigger.prototype.onCollision = function onCollision (response, other) { // eslint-disable-line no-unused-vars
|
|
36061
36089
|
if (this.name === "Trigger") {
|
|
36062
36090
|
this.triggerEvent.apply(this);
|
|
36063
36091
|
}
|
|
@@ -36156,10 +36184,14 @@
|
|
|
36156
36184
|
};
|
|
36157
36185
|
|
|
36158
36186
|
/**
|
|
36159
|
-
*
|
|
36160
|
-
* @
|
|
36187
|
+
* draw this Light2d (automatically called by melonJS)
|
|
36188
|
+
* @name draw
|
|
36189
|
+
* @memberof Light2d
|
|
36190
|
+
* @protected
|
|
36191
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
36192
|
+
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
36161
36193
|
*/
|
|
36162
|
-
Light2d.prototype.draw = function draw (renderer) {
|
|
36194
|
+
Light2d.prototype.draw = function draw (renderer, viewport) { // eslint-disable-line no-unused-vars
|
|
36163
36195
|
renderer.drawImage(this.texture.canvas, this.getBounds().x, this.getBounds().y);
|
|
36164
36196
|
};
|
|
36165
36197
|
|
|
@@ -36374,7 +36406,7 @@
|
|
|
36374
36406
|
* @memberof DropTarget
|
|
36375
36407
|
* @param {Draggable} draggable the draggable object that is dropped
|
|
36376
36408
|
*/
|
|
36377
|
-
DropTarget.prototype.drop = function drop () {
|
|
36409
|
+
DropTarget.prototype.drop = function drop (draggable) { // eslint-disable-line no-unused-vars
|
|
36378
36410
|
|
|
36379
36411
|
};
|
|
36380
36412
|
|
|
@@ -37286,23 +37318,21 @@
|
|
|
37286
37318
|
};
|
|
37287
37319
|
|
|
37288
37320
|
/**
|
|
37289
|
-
*
|
|
37290
|
-
* not to be called by the end user<br>
|
|
37291
|
-
* called by the game manager on each game loop
|
|
37321
|
+
* draw this entity (automatically called by melonJS)
|
|
37292
37322
|
* @name draw
|
|
37293
37323
|
* @memberof Entity
|
|
37294
37324
|
* @protected
|
|
37295
|
-
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer
|
|
37296
|
-
* @param {
|
|
37325
|
+
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer instance
|
|
37326
|
+
* @param {Camera2d} [viewport] the viewport to (re)draw
|
|
37297
37327
|
*/
|
|
37298
|
-
Entity.prototype.draw = function draw (renderer,
|
|
37328
|
+
Entity.prototype.draw = function draw (renderer, viewport) {
|
|
37299
37329
|
var renderable = this.renderable;
|
|
37300
37330
|
if (renderable instanceof Renderable) {
|
|
37301
37331
|
// predraw (apply transforms)
|
|
37302
37332
|
renderable.preDraw(renderer);
|
|
37303
37333
|
|
|
37304
37334
|
// draw the object
|
|
37305
|
-
renderable.draw(renderer,
|
|
37335
|
+
renderable.draw(renderer, viewport);
|
|
37306
37336
|
|
|
37307
37337
|
// postdraw (clean-up);
|
|
37308
37338
|
renderable.postDraw(renderer);
|
|
@@ -37478,7 +37508,7 @@
|
|
|
37478
37508
|
* @name version
|
|
37479
37509
|
* @type {string}
|
|
37480
37510
|
*/
|
|
37481
|
-
var version = "10.
|
|
37511
|
+
var version = "10.12.0";
|
|
37482
37512
|
|
|
37483
37513
|
|
|
37484
37514
|
/**
|