melonjs 10.7.0 → 10.9.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 +1488 -666
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +929 -202
- package/dist/melonjs.module.js +1575 -777
- package/package.json +9 -9
- package/src/camera/camera2d.js +1 -1
- package/src/entity/entity.js +6 -7
- package/src/geometries/ellipse.js +10 -11
- package/src/geometries/line.js +3 -3
- package/src/geometries/path2d.js +319 -0
- package/src/geometries/poly.js +11 -11
- package/src/geometries/rectangle.js +15 -15
- package/src/geometries/roundrect.js +164 -0
- package/src/index.js +5 -1
- package/src/input/gamepad.js +2 -2
- package/src/input/pointerevent.js +1 -1
- package/src/lang/deprecated.js +1 -1
- package/src/level/tiled/TMXLayer.js +1 -1
- package/src/level/tiled/TMXObject.js +9 -12
- package/src/level/tiled/TMXTileMap.js +23 -4
- package/src/level/tiled/renderer/TMXHexagonalRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXIsometricRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXOrthogonalRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXRenderer.js +1 -1
- package/src/level/tiled/renderer/TMXStaggeredRenderer.js +1 -1
- package/src/loader/loader.js +4 -4
- package/src/loader/loadingscreen.js +1 -1
- package/src/math/color.js +1 -1
- package/src/math/matrix2.js +1 -1
- package/src/math/matrix3.js +1 -1
- package/src/math/observable_vector2.js +1 -1
- package/src/math/observable_vector3.js +1 -1
- package/src/math/vector2.js +1 -1
- package/src/math/vector3.js +1 -1
- package/src/particles/emitter.js +23 -14
- package/src/particles/particle.js +3 -2
- package/src/physics/body.js +67 -51
- package/src/physics/bounds.js +8 -9
- package/src/physics/world.js +1 -1
- package/src/polyfill/index.js +1 -0
- package/src/polyfill/roundrect.js +235 -0
- package/src/renderable/collectable.js +9 -2
- package/src/renderable/colorlayer.js +1 -1
- package/src/renderable/container.js +1 -1
- package/src/renderable/imagelayer.js +1 -1
- package/src/renderable/renderable.js +2 -2
- package/src/renderable/sprite.js +2 -3
- package/src/renderable/trigger.js +10 -4
- package/src/state/stage.js +1 -1
- package/src/state/state.js +1 -1
- package/src/system/device.js +10 -8
- package/src/system/pooling.js +156 -149
- package/src/text/bitmaptext.js +1 -1
- package/src/text/text.js +1 -1
- package/src/utils/utils.js +2 -2
- package/src/video/canvas/canvas_renderer.js +83 -39
- package/src/video/renderer.js +36 -16
- package/src/video/texture.js +1 -1
- package/src/video/webgl/glshader.js +29 -193
- package/src/video/webgl/utils/attributes.js +16 -0
- package/src/video/webgl/utils/precision.js +11 -0
- package/src/video/webgl/utils/program.js +58 -0
- package/src/video/webgl/utils/string.js +16 -0
- package/src/video/webgl/utils/uniforms.js +87 -0
- package/src/video/webgl/webgl_compositor.js +1 -14
- package/src/video/webgl/webgl_renderer.js +124 -182
package/dist/melonjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v10.
|
|
2
|
+
* melonJS Game Engine - v10.9.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
|
|
@@ -323,10 +323,10 @@
|
|
|
323
323
|
(shared$3.exports = function (key, value) {
|
|
324
324
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
325
325
|
})('versions', []).push({
|
|
326
|
-
version: '3.22.
|
|
326
|
+
version: '3.22.5',
|
|
327
327
|
mode: 'global',
|
|
328
328
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
329
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.22.
|
|
329
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.22.5/LICENSE',
|
|
330
330
|
source: 'https://github.com/zloirock/core-js'
|
|
331
331
|
});
|
|
332
332
|
|
|
@@ -436,19 +436,19 @@
|
|
|
436
436
|
return EXISTS$1 ? document$1.createElement(it) : {};
|
|
437
437
|
};
|
|
438
438
|
|
|
439
|
-
var DESCRIPTORS$
|
|
439
|
+
var DESCRIPTORS$6 = descriptors;
|
|
440
440
|
var fails$3 = fails$8;
|
|
441
441
|
var createElement = documentCreateElement;
|
|
442
442
|
|
|
443
443
|
// Thanks to IE8 for its funny defineProperty
|
|
444
|
-
var ie8DomDefine = !DESCRIPTORS$
|
|
444
|
+
var ie8DomDefine = !DESCRIPTORS$6 && !fails$3(function () {
|
|
445
445
|
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
446
446
|
return Object.defineProperty(createElement('div'), 'a', {
|
|
447
447
|
get: function () { return 7; }
|
|
448
448
|
}).a != 7;
|
|
449
449
|
});
|
|
450
450
|
|
|
451
|
-
var DESCRIPTORS$
|
|
451
|
+
var DESCRIPTORS$5 = descriptors;
|
|
452
452
|
var call = functionCall;
|
|
453
453
|
var propertyIsEnumerableModule = objectPropertyIsEnumerable;
|
|
454
454
|
var createPropertyDescriptor$1 = createPropertyDescriptor$2;
|
|
@@ -462,7 +462,7 @@
|
|
|
462
462
|
|
|
463
463
|
// `Object.getOwnPropertyDescriptor` method
|
|
464
464
|
// https://tc39.es/ecma262/#sec-object.getownpropertydescriptor
|
|
465
|
-
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$
|
|
465
|
+
objectGetOwnPropertyDescriptor.f = DESCRIPTORS$5 ? $getOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
|
466
466
|
O = toIndexedObject$2(O);
|
|
467
467
|
P = toPropertyKey$1(P);
|
|
468
468
|
if (IE8_DOM_DEFINE$1) { try {
|
|
@@ -473,12 +473,12 @@
|
|
|
473
473
|
|
|
474
474
|
var objectDefineProperty = {};
|
|
475
475
|
|
|
476
|
-
var DESCRIPTORS$
|
|
476
|
+
var DESCRIPTORS$4 = descriptors;
|
|
477
477
|
var fails$2 = fails$8;
|
|
478
478
|
|
|
479
479
|
// V8 ~ Chrome 36-
|
|
480
480
|
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
481
|
-
var v8PrototypeDefineBug = DESCRIPTORS$
|
|
481
|
+
var v8PrototypeDefineBug = DESCRIPTORS$4 && fails$2(function () {
|
|
482
482
|
// eslint-disable-next-line es-x/no-object-defineproperty -- required for testing
|
|
483
483
|
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
484
484
|
value: 42,
|
|
@@ -499,7 +499,7 @@
|
|
|
499
499
|
};
|
|
500
500
|
|
|
501
501
|
var global$6 = global$m;
|
|
502
|
-
var DESCRIPTORS$
|
|
502
|
+
var DESCRIPTORS$3 = descriptors;
|
|
503
503
|
var IE8_DOM_DEFINE = ie8DomDefine;
|
|
504
504
|
var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
|
|
505
505
|
var anObject$1 = anObject$2;
|
|
@@ -516,7 +516,7 @@
|
|
|
516
516
|
|
|
517
517
|
// `Object.defineProperty` method
|
|
518
518
|
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
519
|
-
objectDefineProperty.f = DESCRIPTORS$
|
|
519
|
+
objectDefineProperty.f = DESCRIPTORS$3 ? V8_PROTOTYPE_DEFINE_BUG ? function defineProperty(O, P, Attributes) {
|
|
520
520
|
anObject$1(O);
|
|
521
521
|
P = toPropertyKey(P);
|
|
522
522
|
anObject$1(Attributes);
|
|
@@ -543,11 +543,11 @@
|
|
|
543
543
|
return O;
|
|
544
544
|
};
|
|
545
545
|
|
|
546
|
-
var DESCRIPTORS$
|
|
546
|
+
var DESCRIPTORS$2 = descriptors;
|
|
547
547
|
var definePropertyModule$1 = objectDefineProperty;
|
|
548
548
|
var createPropertyDescriptor = createPropertyDescriptor$2;
|
|
549
549
|
|
|
550
|
-
var createNonEnumerableProperty$3 = DESCRIPTORS$
|
|
550
|
+
var createNonEnumerableProperty$3 = DESCRIPTORS$2 ? function (object, key, value) {
|
|
551
551
|
return definePropertyModule$1.f(object, key, createPropertyDescriptor(1, value));
|
|
552
552
|
} : function (object, key, value) {
|
|
553
553
|
object[key] = value;
|
|
@@ -556,17 +556,17 @@
|
|
|
556
556
|
|
|
557
557
|
var makeBuiltIn$2 = {exports: {}};
|
|
558
558
|
|
|
559
|
-
var DESCRIPTORS = descriptors;
|
|
559
|
+
var DESCRIPTORS$1 = descriptors;
|
|
560
560
|
var hasOwn$4 = hasOwnProperty_1;
|
|
561
561
|
|
|
562
562
|
var FunctionPrototype = Function.prototype;
|
|
563
563
|
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
564
|
-
var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor;
|
|
564
|
+
var getDescriptor = DESCRIPTORS$1 && Object.getOwnPropertyDescriptor;
|
|
565
565
|
|
|
566
566
|
var EXISTS = hasOwn$4(FunctionPrototype, 'name');
|
|
567
567
|
// additional protection from minified / mangled / dropped function names
|
|
568
568
|
var PROPER = EXISTS && (function something() { /* empty */ }).name === 'something';
|
|
569
|
-
var CONFIGURABLE = EXISTS && (!DESCRIPTORS || (DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable));
|
|
569
|
+
var CONFIGURABLE = EXISTS && (!DESCRIPTORS$1 || (DESCRIPTORS$1 && getDescriptor(FunctionPrototype, 'name').configurable));
|
|
570
570
|
|
|
571
571
|
var functionName = {
|
|
572
572
|
EXISTS: EXISTS,
|
|
@@ -681,15 +681,17 @@
|
|
|
681
681
|
var fails$1 = fails$8;
|
|
682
682
|
var isCallable$2 = isCallable$a;
|
|
683
683
|
var hasOwn$2 = hasOwnProperty_1;
|
|
684
|
-
var
|
|
684
|
+
var DESCRIPTORS = descriptors;
|
|
685
685
|
var CONFIGURABLE_FUNCTION_NAME = functionName.CONFIGURABLE;
|
|
686
686
|
var inspectSource = inspectSource$2;
|
|
687
687
|
var InternalStateModule = internalState;
|
|
688
688
|
|
|
689
689
|
var enforceInternalState = InternalStateModule.enforce;
|
|
690
690
|
var getInternalState = InternalStateModule.get;
|
|
691
|
+
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
692
|
+
var defineProperty = Object.defineProperty;
|
|
691
693
|
|
|
692
|
-
var CONFIGURABLE_LENGTH = !fails$1(function () {
|
|
694
|
+
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails$1(function () {
|
|
693
695
|
return defineProperty(function () { /* empty */ }, 'length', { value: 8 }).length !== 8;
|
|
694
696
|
});
|
|
695
697
|
|
|
@@ -707,6 +709,11 @@
|
|
|
707
709
|
if (CONFIGURABLE_LENGTH && options && hasOwn$2(options, 'arity') && value.length !== options.arity) {
|
|
708
710
|
defineProperty(value, 'length', { value: options.arity });
|
|
709
711
|
}
|
|
712
|
+
if (options && hasOwn$2(options, 'constructor') && options.constructor) {
|
|
713
|
+
if (DESCRIPTORS) { try {
|
|
714
|
+
defineProperty(value, 'prototype', { writable: false });
|
|
715
|
+
} catch (error) { /* empty */ } }
|
|
716
|
+
} else { value.prototype = undefined; }
|
|
710
717
|
var state = enforceInternalState(value);
|
|
711
718
|
if (!hasOwn$2(state, 'source')) {
|
|
712
719
|
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
|
@@ -828,17 +835,17 @@
|
|
|
828
835
|
var indexOf = arrayIncludes.indexOf;
|
|
829
836
|
var hiddenKeys$1 = hiddenKeys$3;
|
|
830
837
|
|
|
831
|
-
var push
|
|
838
|
+
var push = uncurryThis$1([].push);
|
|
832
839
|
|
|
833
840
|
var objectKeysInternal = function (object, names) {
|
|
834
841
|
var O = toIndexedObject(object);
|
|
835
842
|
var i = 0;
|
|
836
843
|
var result = [];
|
|
837
844
|
var key;
|
|
838
|
-
for (key in O) { !hasOwn$1(hiddenKeys$1, key) && hasOwn$1(O, key) && push
|
|
845
|
+
for (key in O) { !hasOwn$1(hiddenKeys$1, key) && hasOwn$1(O, key) && push(result, key); }
|
|
839
846
|
// Don't enum bug & hidden keys
|
|
840
847
|
while (names.length > i) { if (hasOwn$1(O, key = names[i++])) {
|
|
841
|
-
~indexOf(result, key) || push
|
|
848
|
+
~indexOf(result, key) || push(result, key);
|
|
842
849
|
} }
|
|
843
850
|
return result;
|
|
844
851
|
};
|
|
@@ -1600,10 +1607,8 @@
|
|
|
1600
1607
|
throttle: throttle
|
|
1601
1608
|
});
|
|
1602
1609
|
|
|
1603
|
-
var objectClass = {};
|
|
1604
|
-
var instance_counter = 0;
|
|
1605
|
-
|
|
1606
1610
|
/**
|
|
1611
|
+
* @classdesc
|
|
1607
1612
|
* This object is used for object pooling - a technique that might speed up your game if used properly.<br>
|
|
1608
1613
|
* If some of your classes will be instantiated and removed a lot at a time, it is a
|
|
1609
1614
|
* good idea to add the class to this object pool. A separate pool for that class
|
|
@@ -1614,43 +1619,46 @@
|
|
|
1614
1619
|
* which means, that on level loading the engine will try to instantiate every object
|
|
1615
1620
|
* found in the map, based on the user defined name in each Object Properties<br>
|
|
1616
1621
|
* <img src="images/object_properties.png"/><br>
|
|
1617
|
-
* @
|
|
1622
|
+
* @see {@link pool} a default global instance of ObjectPool
|
|
1618
1623
|
*/
|
|
1624
|
+
var ObjectPool = function ObjectPool() {
|
|
1625
|
+
this.objectClass = {};
|
|
1626
|
+
this.instance_counter = 0;
|
|
1627
|
+
};
|
|
1619
1628
|
|
|
1620
1629
|
/**
|
|
1621
1630
|
* register an object to the pool. <br>
|
|
1622
1631
|
* Pooling must be set to true if more than one such objects will be created. <br>
|
|
1623
1632
|
* (Note: for an object to be poolable, it must implements a `onResetEvent` method)
|
|
1624
|
-
* @function pool.register
|
|
1625
1633
|
* @param {string} className as defined in the Name field of the Object Properties (in Tiled)
|
|
1626
1634
|
* @param {object} classObj corresponding Class to be instantiated
|
|
1627
1635
|
* @param {boolean} [recycling=false] enables object recycling for the specified class
|
|
1628
1636
|
* @example
|
|
1629
1637
|
* // implement CherryEntity
|
|
1630
1638
|
* class CherryEntity extends Spritesheet {
|
|
1631
|
-
*
|
|
1632
|
-
*
|
|
1633
|
-
*
|
|
1634
|
-
*
|
|
1639
|
+
*onResetEvent() {
|
|
1640
|
+
* // reset object mutable properties
|
|
1641
|
+
* this.lifeBar = 100;
|
|
1642
|
+
*}
|
|
1635
1643
|
* };
|
|
1636
1644
|
* // add our users defined entities in the object pool and enable object recycling
|
|
1637
1645
|
* me.pool.register("cherryentity", CherryEntity, true);
|
|
1638
1646
|
*/
|
|
1639
|
-
function register(className, classObj, recycling) {
|
|
1640
|
-
|
|
1647
|
+
ObjectPool.prototype.register = function register (className, classObj, recycling) {
|
|
1648
|
+
if ( recycling === void 0 ) recycling = false;
|
|
1641
1649
|
|
|
1642
1650
|
if (typeof (classObj) !== "undefined") {
|
|
1643
|
-
objectClass[className] = {
|
|
1651
|
+
this.objectClass[className] = {
|
|
1644
1652
|
"class" : classObj,
|
|
1645
1653
|
"pool" : (recycling ? [] : undefined)
|
|
1646
1654
|
};
|
|
1647
1655
|
} else {
|
|
1648
1656
|
throw new Error("Cannot register object '" + className + "', invalid class");
|
|
1649
1657
|
}
|
|
1650
|
-
}
|
|
1658
|
+
};
|
|
1659
|
+
|
|
1651
1660
|
/**
|
|
1652
1661
|
* Pull a new instance of the requested object (if added into the object pool)
|
|
1653
|
-
* @function pool.pull
|
|
1654
1662
|
* @param {string} name as used in {@link pool.register}
|
|
1655
1663
|
* @param {object} [...arguments] arguments to be passed when instantiating/reinitializing the object
|
|
1656
1664
|
* @returns {object} the instance of the requested object
|
|
@@ -1670,14 +1678,14 @@
|
|
|
1670
1678
|
* me.game.world.removeChild(enemy);
|
|
1671
1679
|
* me.game.world.removeChild(bullet);
|
|
1672
1680
|
*/
|
|
1673
|
-
function pull(name) {
|
|
1674
|
-
|
|
1681
|
+
ObjectPool.prototype.pull = function pull (name) {
|
|
1682
|
+
var arguments$1 = arguments;
|
|
1675
1683
|
|
|
1676
1684
|
var args = new Array(arguments.length);
|
|
1677
1685
|
for (var i = 0; i < arguments.length; i++) {
|
|
1678
1686
|
args[i] = arguments$1[i];
|
|
1679
1687
|
}
|
|
1680
|
-
var className = objectClass[name];
|
|
1688
|
+
var className = this.objectClass[name];
|
|
1681
1689
|
if (className) {
|
|
1682
1690
|
var proto = className["class"],
|
|
1683
1691
|
poolArray = className.pool,
|
|
@@ -1690,7 +1698,7 @@
|
|
|
1690
1698
|
if (typeof(obj.onResetEvent) === "function") {
|
|
1691
1699
|
obj.onResetEvent.apply(obj, args);
|
|
1692
1700
|
}
|
|
1693
|
-
instance_counter--;
|
|
1701
|
+
this.instance_counter--;
|
|
1694
1702
|
}
|
|
1695
1703
|
else {
|
|
1696
1704
|
// create a new instance
|
|
@@ -1703,36 +1711,36 @@
|
|
|
1703
1711
|
return obj;
|
|
1704
1712
|
}
|
|
1705
1713
|
throw new Error("Cannot instantiate object of type '" + name + "'");
|
|
1706
|
-
}
|
|
1714
|
+
};
|
|
1715
|
+
|
|
1707
1716
|
/**
|
|
1708
1717
|
* purge the object pool from any inactive object <br>
|
|
1709
1718
|
* Object pooling must be enabled for this function to work<br>
|
|
1710
1719
|
* note: this will trigger the garbage collector
|
|
1711
|
-
* @function pool.purge
|
|
1712
1720
|
*/
|
|
1713
|
-
function purge() {
|
|
1714
|
-
for (var className in objectClass) {
|
|
1715
|
-
if (objectClass[className]) {
|
|
1716
|
-
objectClass[className].pool = [];
|
|
1721
|
+
ObjectPool.prototype.purge = function purge () {
|
|
1722
|
+
for (var className in this.objectClass) {
|
|
1723
|
+
if (this.objectClass[className]) {
|
|
1724
|
+
this.objectClass[className].pool = [];
|
|
1717
1725
|
}
|
|
1718
1726
|
}
|
|
1719
|
-
instance_counter = 0;
|
|
1720
|
-
}
|
|
1727
|
+
this.instance_counter = 0;
|
|
1728
|
+
};
|
|
1729
|
+
|
|
1721
1730
|
/**
|
|
1722
1731
|
* Push back an object instance into the object pool <br>
|
|
1723
1732
|
* Object pooling for the object class must be enabled,
|
|
1724
1733
|
* and object must have been instantiated using {@link pool#pull},
|
|
1725
1734
|
* otherwise this function won't work
|
|
1726
|
-
* @function pool.push
|
|
1727
1735
|
* @throws will throw an error if the object cannot be recycled
|
|
1728
1736
|
* @param {object} obj instance to be recycled
|
|
1729
1737
|
* @param {boolean} [throwOnError=true] throw an exception if the object cannot be recycled
|
|
1730
1738
|
* @returns {boolean} true if the object was successfully recycled in the object pool
|
|
1731
1739
|
*/
|
|
1732
|
-
function push(obj, throwOnError) {
|
|
1733
|
-
|
|
1740
|
+
ObjectPool.prototype.push = function push (obj, throwOnError) {
|
|
1741
|
+
if ( throwOnError === void 0 ) throwOnError = true;
|
|
1734
1742
|
|
|
1735
|
-
if (!poolable(obj)) {
|
|
1743
|
+
if (!this.poolable(obj)) {
|
|
1736
1744
|
if (throwOnError === true ) {
|
|
1737
1745
|
throw new Error("me.pool: object " + obj + " cannot be recycled");
|
|
1738
1746
|
} else {
|
|
@@ -1741,59 +1749,53 @@
|
|
|
1741
1749
|
}
|
|
1742
1750
|
|
|
1743
1751
|
// store back the object instance for later recycling
|
|
1744
|
-
objectClass[obj.className].pool.push(obj);
|
|
1745
|
-
instance_counter++;
|
|
1752
|
+
this.objectClass[obj.className].pool.push(obj);
|
|
1753
|
+
this.instance_counter++;
|
|
1746
1754
|
|
|
1747
1755
|
return true;
|
|
1748
|
-
}
|
|
1756
|
+
};
|
|
1757
|
+
|
|
1749
1758
|
/**
|
|
1750
1759
|
* Check if an object with the provided name is registered
|
|
1751
|
-
* @function pool.exists
|
|
1752
1760
|
* @param {string} name of the registered object class
|
|
1753
1761
|
* @returns {boolean} true if the classname is registered
|
|
1754
1762
|
*/
|
|
1755
|
-
function exists(name) {
|
|
1756
|
-
return name in objectClass;
|
|
1757
|
-
}
|
|
1763
|
+
ObjectPool.prototype.exists = function exists (name) {
|
|
1764
|
+
return name in this.objectClass;
|
|
1765
|
+
};
|
|
1758
1766
|
/**
|
|
1759
1767
|
* Check if an object is poolable
|
|
1760
1768
|
* (was properly registered with the recycling feature enable)
|
|
1761
|
-
* @
|
|
1762
|
-
* @see pool.register
|
|
1769
|
+
* @see register
|
|
1763
1770
|
* @param {object} obj object to be checked
|
|
1764
1771
|
* @returns {boolean} true if the object is poolable
|
|
1765
1772
|
* @example
|
|
1766
1773
|
* if (!me.pool.poolable(myCherryEntity)) {
|
|
1767
|
-
*
|
|
1774
|
+
* // object was not properly registered
|
|
1768
1775
|
* }
|
|
1769
1776
|
*/
|
|
1770
|
-
function poolable(obj) {
|
|
1777
|
+
ObjectPool.prototype.poolable = function poolable (obj) {
|
|
1771
1778
|
var className = obj.className;
|
|
1772
1779
|
return (typeof className !== "undefined") &&
|
|
1773
1780
|
(typeof obj.onResetEvent === "function") &&
|
|
1774
|
-
(className in objectClass) &&
|
|
1775
|
-
(objectClass[className].pool !== "undefined");
|
|
1781
|
+
(className in this.objectClass) &&
|
|
1782
|
+
(this.objectClass[className].pool !== "undefined");
|
|
1783
|
+
|
|
1784
|
+
};
|
|
1776
1785
|
|
|
1777
|
-
}
|
|
1778
1786
|
/**
|
|
1779
1787
|
* returns the amount of object instance currently in the pool
|
|
1780
|
-
* @function pool.getInstanceCount
|
|
1781
1788
|
* @returns {number} amount of object instance
|
|
1782
1789
|
*/
|
|
1783
|
-
function getInstanceCount() {
|
|
1784
|
-
return instance_counter;
|
|
1785
|
-
}
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
push: push,
|
|
1793
|
-
exists: exists,
|
|
1794
|
-
poolable: poolable,
|
|
1795
|
-
getInstanceCount: getInstanceCount
|
|
1796
|
-
});
|
|
1790
|
+
ObjectPool.prototype.getInstanceCount = function getInstanceCount () {
|
|
1791
|
+
return this.instance_counter;
|
|
1792
|
+
};
|
|
1793
|
+
/**
|
|
1794
|
+
* a default global object pool instance
|
|
1795
|
+
* @public
|
|
1796
|
+
* @type {ObjectPool}
|
|
1797
|
+
*/
|
|
1798
|
+
var pool$1 = new ObjectPool();
|
|
1797
1799
|
|
|
1798
1800
|
/**
|
|
1799
1801
|
* @classdesc
|
|
@@ -2310,7 +2312,7 @@
|
|
|
2310
2312
|
* @returns {Vector2d} new me.Vector2d
|
|
2311
2313
|
*/
|
|
2312
2314
|
Vector2d.prototype.clone = function clone () {
|
|
2313
|
-
return pull("Vector2d", this.x, this.y);
|
|
2315
|
+
return pool$1.pull("Vector2d", this.x, this.y);
|
|
2314
2316
|
};
|
|
2315
2317
|
|
|
2316
2318
|
/**
|
|
@@ -2610,7 +2612,7 @@
|
|
|
2610
2612
|
* @returns {Color} Reference to the newly cloned object
|
|
2611
2613
|
*/
|
|
2612
2614
|
Color.prototype.clone = function clone () {
|
|
2613
|
-
return pull("Color").copy(this);
|
|
2615
|
+
return pool$1.pull("Color").copy(this);
|
|
2614
2616
|
};
|
|
2615
2617
|
|
|
2616
2618
|
/**
|
|
@@ -3290,12 +3292,12 @@
|
|
|
3290
3292
|
*/
|
|
3291
3293
|
Matrix3d.prototype.applyInverse = function applyInverse (v) {
|
|
3292
3294
|
// invert the current matrix
|
|
3293
|
-
var im = pull("Matrix3d", this).invert();
|
|
3295
|
+
var im = pool$1.pull("Matrix3d", this).invert();
|
|
3294
3296
|
|
|
3295
3297
|
// apply the inverted matrix
|
|
3296
3298
|
im.apply(v);
|
|
3297
3299
|
|
|
3298
|
-
push(im);
|
|
3300
|
+
pool$1.push(im);
|
|
3299
3301
|
|
|
3300
3302
|
return v;
|
|
3301
3303
|
};
|
|
@@ -3602,7 +3604,7 @@
|
|
|
3602
3604
|
* @returns {Matrix3d}
|
|
3603
3605
|
*/
|
|
3604
3606
|
Matrix3d.prototype.clone = function clone () {
|
|
3605
|
-
return pull("Matrix3d", this);
|
|
3607
|
+
return pool$1.pull("Matrix3d", this);
|
|
3606
3608
|
};
|
|
3607
3609
|
|
|
3608
3610
|
/**
|
|
@@ -4111,7 +4113,7 @@
|
|
|
4111
4113
|
* @returns {Matrix2d}
|
|
4112
4114
|
*/
|
|
4113
4115
|
Matrix2d.prototype.clone = function clone () {
|
|
4114
|
-
return pull("Matrix2d", this);
|
|
4116
|
+
return pool$1.pull("Matrix2d", this);
|
|
4115
4117
|
};
|
|
4116
4118
|
|
|
4117
4119
|
/**
|
|
@@ -8711,7 +8713,7 @@
|
|
|
8711
8713
|
* @returns {ObservableVector2d} new me.ObservableVector2d
|
|
8712
8714
|
*/
|
|
8713
8715
|
ObservableVector2d.prototype.clone = function clone () {
|
|
8714
|
-
return pull("ObservableVector2d", this._x, this._y, {onUpdate: this.onUpdate, scope: this.scope});
|
|
8716
|
+
return pool$1.pull("ObservableVector2d", this._x, this._y, {onUpdate: this.onUpdate, scope: this.scope});
|
|
8715
8717
|
};
|
|
8716
8718
|
|
|
8717
8719
|
/**
|
|
@@ -8722,7 +8724,7 @@
|
|
|
8722
8724
|
* @returns {Vector2d} new me.Vector2d
|
|
8723
8725
|
*/
|
|
8724
8726
|
ObservableVector2d.prototype.toVector2d = function toVector2d () {
|
|
8725
|
-
return pull("Vector2d", this._x, this._y);
|
|
8727
|
+
return pool$1.pull("Vector2d", this._x, this._y);
|
|
8726
8728
|
};
|
|
8727
8729
|
|
|
8728
8730
|
/**
|
|
@@ -9297,7 +9299,7 @@
|
|
|
9297
9299
|
* @returns {Vector3d} new me.Vector3d
|
|
9298
9300
|
*/
|
|
9299
9301
|
Vector3d.prototype.clone = function clone () {
|
|
9300
|
-
return pull("Vector3d", this.x, this.y, this.z);
|
|
9302
|
+
return pool$1.pull("Vector3d", this.x, this.y, this.z);
|
|
9301
9303
|
};
|
|
9302
9304
|
|
|
9303
9305
|
/**
|
|
@@ -9836,7 +9838,7 @@
|
|
|
9836
9838
|
* @returns {ObservableVector3d} new me.ObservableVector3d
|
|
9837
9839
|
*/
|
|
9838
9840
|
ObservableVector3d.prototype.clone = function clone () {
|
|
9839
|
-
return pull("ObservableVector3d",
|
|
9841
|
+
return pool$1.pull("ObservableVector3d",
|
|
9840
9842
|
this._x,
|
|
9841
9843
|
this._y,
|
|
9842
9844
|
this._z,
|
|
@@ -9852,7 +9854,7 @@
|
|
|
9852
9854
|
* @returns {Vector3d} new me.Vector3d
|
|
9853
9855
|
*/
|
|
9854
9856
|
ObservableVector3d.prototype.toVector3d = function toVector3d () {
|
|
9855
|
-
return pull("Vector3d", this._x, this._y, this._z);
|
|
9857
|
+
return pool$1.pull("Vector3d", this._x, this._y, this._z);
|
|
9856
9858
|
};
|
|
9857
9859
|
|
|
9858
9860
|
/**
|
|
@@ -10572,16 +10574,16 @@
|
|
|
10572
10574
|
* @public
|
|
10573
10575
|
* @type {Vector2d}
|
|
10574
10576
|
* @name pos
|
|
10575
|
-
* @memberof Polygon
|
|
10577
|
+
* @memberof Polygon.prototype
|
|
10576
10578
|
*/
|
|
10577
|
-
this.pos =
|
|
10579
|
+
this.pos = pool$1.pull("Vector2d");
|
|
10578
10580
|
|
|
10579
10581
|
/**
|
|
10580
10582
|
* The bounding rectangle for this shape
|
|
10581
10583
|
* @ignore
|
|
10582
10584
|
* @type {Bounds}
|
|
10583
10585
|
* @name _bounds
|
|
10584
|
-
* @memberof Polygon
|
|
10586
|
+
* @memberof Polygon.prototype
|
|
10585
10587
|
*/
|
|
10586
10588
|
this._bounds;
|
|
10587
10589
|
|
|
@@ -10591,7 +10593,7 @@
|
|
|
10591
10593
|
* @public
|
|
10592
10594
|
* @type {Vector2d[]}
|
|
10593
10595
|
* @name points
|
|
10594
|
-
* @memberof Polygon
|
|
10596
|
+
* @memberof Polygon.prototype
|
|
10595
10597
|
*/
|
|
10596
10598
|
this.points = [];
|
|
10597
10599
|
|
|
@@ -10666,13 +10668,13 @@
|
|
|
10666
10668
|
if (typeof vertices[0] === "object") {
|
|
10667
10669
|
// array of {x,y} object
|
|
10668
10670
|
vertices.forEach(function (vertice) {
|
|
10669
|
-
this$1$1.points.push(
|
|
10671
|
+
this$1$1.points.push(pool$1.pull("Vector2d", vertice.x, vertice.y));
|
|
10670
10672
|
});
|
|
10671
10673
|
|
|
10672
10674
|
} else {
|
|
10673
10675
|
// it's a flat array
|
|
10674
10676
|
for (var p = 0; p < vertices.length; p += 2) {
|
|
10675
|
-
this.points.push(
|
|
10677
|
+
this.points.push(pool$1.pull("Vector2d", vertices[p], vertices[p + 1]));
|
|
10676
10678
|
}
|
|
10677
10679
|
}
|
|
10678
10680
|
} else {
|
|
@@ -10807,12 +10809,12 @@
|
|
|
10807
10809
|
// Calculate the edges/normals
|
|
10808
10810
|
for (i = 0; i < len; i++) {
|
|
10809
10811
|
if (edges[i] === undefined) {
|
|
10810
|
-
edges[i] =
|
|
10812
|
+
edges[i] = pool$1.pull("Vector2d");
|
|
10811
10813
|
}
|
|
10812
10814
|
edges[i].copy(points[(i + 1) % len]).sub(points[i]);
|
|
10813
10815
|
|
|
10814
10816
|
if (normals[i] === undefined) {
|
|
10815
|
-
normals[i] =
|
|
10817
|
+
normals[i] = pool$1.pull("Vector2d");
|
|
10816
10818
|
}
|
|
10817
10819
|
normals[i].copy(edges[i]).perp().normalize();
|
|
10818
10820
|
}
|
|
@@ -10928,14 +10930,14 @@
|
|
|
10928
10930
|
/**
|
|
10929
10931
|
* Shifts the Polygon to the given position vector.
|
|
10930
10932
|
* @name shift
|
|
10931
|
-
* @memberof Polygon
|
|
10933
|
+
* @memberof Polygon.prototype
|
|
10932
10934
|
* @function
|
|
10933
10935
|
* @param {Vector2d} position
|
|
10934
10936
|
*/
|
|
10935
10937
|
/**
|
|
10936
10938
|
* Shifts the Polygon to the given x, y position.
|
|
10937
10939
|
* @name shift
|
|
10938
|
-
* @memberof Polygon
|
|
10940
|
+
* @memberof Polygon.prototype
|
|
10939
10941
|
* @function
|
|
10940
10942
|
* @param {number} x
|
|
10941
10943
|
* @param {number} y
|
|
@@ -11016,7 +11018,7 @@
|
|
|
11016
11018
|
*/
|
|
11017
11019
|
Polygon.prototype.getBounds = function getBounds () {
|
|
11018
11020
|
if (typeof this._bounds === "undefined") {
|
|
11019
|
-
this._bounds = pull("Bounds");
|
|
11021
|
+
this._bounds = pool$1.pull("Bounds");
|
|
11020
11022
|
}
|
|
11021
11023
|
return this._bounds;
|
|
11022
11024
|
};
|
|
@@ -11062,10 +11064,10 @@
|
|
|
11062
11064
|
function Rect(x, y, w, h) {
|
|
11063
11065
|
// parent constructor
|
|
11064
11066
|
Polygon.call(this, x, y, [
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11067
|
+
pool$1.pull("Vector2d", 0, 0), // 0, 0
|
|
11068
|
+
pool$1.pull("Vector2d", w, 0), // 1, 0
|
|
11069
|
+
pool$1.pull("Vector2d", w, h), // 1, 1
|
|
11070
|
+
pool$1.pull("Vector2d", 0, h) ]);
|
|
11069
11071
|
this.shapeType = "Rectangle";
|
|
11070
11072
|
}
|
|
11071
11073
|
|
|
@@ -11114,7 +11116,7 @@
|
|
|
11114
11116
|
* @public
|
|
11115
11117
|
* @type {number}
|
|
11116
11118
|
* @name left
|
|
11117
|
-
* @memberof Rect
|
|
11119
|
+
* @memberof Rect.prototype
|
|
11118
11120
|
*/
|
|
11119
11121
|
prototypeAccessors.left.get = function () {
|
|
11120
11122
|
return this.pos.x;
|
|
@@ -11125,7 +11127,7 @@
|
|
|
11125
11127
|
* @public
|
|
11126
11128
|
* @type {number}
|
|
11127
11129
|
* @name right
|
|
11128
|
-
* @memberof Rect
|
|
11130
|
+
* @memberof Rect.prototype
|
|
11129
11131
|
*/
|
|
11130
11132
|
prototypeAccessors.right.get = function () {
|
|
11131
11133
|
var w = this.width;
|
|
@@ -11137,7 +11139,7 @@
|
|
|
11137
11139
|
* @public
|
|
11138
11140
|
* @type {number}
|
|
11139
11141
|
* @name top
|
|
11140
|
-
* @memberof Rect
|
|
11142
|
+
* @memberof Rect.prototype
|
|
11141
11143
|
*/
|
|
11142
11144
|
prototypeAccessors.top.get = function () {
|
|
11143
11145
|
return this.pos.y;
|
|
@@ -11148,7 +11150,7 @@
|
|
|
11148
11150
|
* @public
|
|
11149
11151
|
* @type {number}
|
|
11150
11152
|
* @name bottom
|
|
11151
|
-
* @memberof Rect
|
|
11153
|
+
* @memberof Rect.prototype
|
|
11152
11154
|
*/
|
|
11153
11155
|
prototypeAccessors.bottom.get = function () {
|
|
11154
11156
|
var h = this.height;
|
|
@@ -11160,7 +11162,7 @@
|
|
|
11160
11162
|
* @public
|
|
11161
11163
|
* @type {number}
|
|
11162
11164
|
* @name width
|
|
11163
|
-
* @memberof Rect
|
|
11165
|
+
* @memberof Rect.prototype
|
|
11164
11166
|
*/
|
|
11165
11167
|
prototypeAccessors.width.get = function () {
|
|
11166
11168
|
return this.points[2].x;
|
|
@@ -11176,7 +11178,7 @@
|
|
|
11176
11178
|
* @public
|
|
11177
11179
|
* @type {number}
|
|
11178
11180
|
* @name height
|
|
11179
|
-
* @memberof Rect
|
|
11181
|
+
* @memberof Rect.prototype
|
|
11180
11182
|
*/
|
|
11181
11183
|
prototypeAccessors.height.get = function () {
|
|
11182
11184
|
return this.points[2].y;
|
|
@@ -11192,7 +11194,7 @@
|
|
|
11192
11194
|
* @public
|
|
11193
11195
|
* @type {number}
|
|
11194
11196
|
* @name centerX
|
|
11195
|
-
* @memberof Rect
|
|
11197
|
+
* @memberof Rect.prototype
|
|
11196
11198
|
*/
|
|
11197
11199
|
prototypeAccessors.centerX.get = function () {
|
|
11198
11200
|
if (isFinite(this.width)) {
|
|
@@ -11210,7 +11212,7 @@
|
|
|
11210
11212
|
* @public
|
|
11211
11213
|
* @type {number}
|
|
11212
11214
|
* @name centerY
|
|
11213
|
-
* @memberof Rect
|
|
11215
|
+
* @memberof Rect.prototype
|
|
11214
11216
|
*/
|
|
11215
11217
|
prototypeAccessors.centerY.get = function () {
|
|
11216
11218
|
if (isFinite(this.height)) {
|
|
@@ -11354,7 +11356,7 @@
|
|
|
11354
11356
|
/**
|
|
11355
11357
|
* Returns true if the rectangle contains the given point
|
|
11356
11358
|
* @name contains
|
|
11357
|
-
* @memberof Rect
|
|
11359
|
+
* @memberof Rect.prototype
|
|
11358
11360
|
* @function
|
|
11359
11361
|
* @param {Vector2d} point
|
|
11360
11362
|
* @returns {boolean} true if contains
|
|
@@ -11423,7 +11425,7 @@
|
|
|
11423
11425
|
* @returns {Polygon} a new Polygon that represents this rectangle.
|
|
11424
11426
|
*/
|
|
11425
11427
|
Rect.prototype.toPolygon = function toPolygon () {
|
|
11426
|
-
return
|
|
11428
|
+
return pool$1.pull("Polygon",
|
|
11427
11429
|
this.pos.x, this.pos.y, this.points
|
|
11428
11430
|
);
|
|
11429
11431
|
};
|
|
@@ -11899,6 +11901,8 @@
|
|
|
11899
11901
|
* a bound object contains methods for creating and manipulating axis-aligned bounding boxes (AABB).
|
|
11900
11902
|
*/
|
|
11901
11903
|
var Bounds$1 = function Bounds(vertices) {
|
|
11904
|
+
// @ignore
|
|
11905
|
+
this._center = new Vector2d();
|
|
11902
11906
|
this.onResetEvent(vertices);
|
|
11903
11907
|
};
|
|
11904
11908
|
|
|
@@ -11917,9 +11921,6 @@
|
|
|
11917
11921
|
if (typeof vertices !== "undefined") {
|
|
11918
11922
|
this.update(vertices);
|
|
11919
11923
|
}
|
|
11920
|
-
|
|
11921
|
-
// @ignore
|
|
11922
|
-
this._center = new Vector2d();
|
|
11923
11924
|
};
|
|
11924
11925
|
|
|
11925
11926
|
/**
|
|
@@ -12345,11 +12346,11 @@
|
|
|
12345
12346
|
* @returns {Polygon} a new Polygon that represents this bounds.
|
|
12346
12347
|
*/
|
|
12347
12348
|
Bounds$1.prototype.toPolygon = function toPolygon () {
|
|
12348
|
-
return
|
|
12349
|
-
|
|
12350
|
-
|
|
12351
|
-
|
|
12352
|
-
|
|
12349
|
+
return pool$1.pull("Polygon", this.x, this.y, [
|
|
12350
|
+
pool$1.pull("Vector2d", 0, 0),
|
|
12351
|
+
pool$1.pull("Vector2d", this.width, 0),
|
|
12352
|
+
pool$1.pull("Vector2d", this.width, this.height),
|
|
12353
|
+
pool$1.pull("Vector2d", 0, this.height)
|
|
12353
12354
|
]);
|
|
12354
12355
|
};
|
|
12355
12356
|
|
|
@@ -13058,11 +13059,11 @@
|
|
|
13058
13059
|
if (typeof region.currentTransform !== "undefined") {
|
|
13059
13060
|
if (!region.currentTransform.isIdentity()) {
|
|
13060
13061
|
var invV = region.currentTransform.applyInverse(
|
|
13061
|
-
pull("Vector2d", gameX, gameY)
|
|
13062
|
+
pool$1.pull("Vector2d", gameX, gameY)
|
|
13062
13063
|
);
|
|
13063
13064
|
gameX = invV.x;
|
|
13064
13065
|
gameY = invV.y;
|
|
13065
|
-
push(invV);
|
|
13066
|
+
pool$1.push(invV);
|
|
13066
13067
|
}
|
|
13067
13068
|
}
|
|
13068
13069
|
eventInBounds = bounds.contains(gameX, gameY);
|
|
@@ -13291,7 +13292,7 @@
|
|
|
13291
13292
|
* };
|
|
13292
13293
|
*/
|
|
13293
13294
|
function globalToLocal(x, y, v) {
|
|
13294
|
-
v = v || pull("Vector2d");
|
|
13295
|
+
v = v || pool$1.pull("Vector2d");
|
|
13295
13296
|
var rect = device$1.getElementBounds(renderer.getScreenCanvas());
|
|
13296
13297
|
var pixelRatio = device$1.devicePixelRatio;
|
|
13297
13298
|
x -= rect.left + (globalThis.pageXOffset || 0);
|
|
@@ -13599,8 +13600,8 @@
|
|
|
13599
13600
|
function addMapping(id, mapping) {
|
|
13600
13601
|
var expanded_id = id.replace(vendorProductRE, function (_, a, b) {
|
|
13601
13602
|
return (
|
|
13602
|
-
"000".
|
|
13603
|
-
"000".
|
|
13603
|
+
"000".slice(a.length - 1) + a + "-" +
|
|
13604
|
+
"000".slice(b.length - 1) + b + "-"
|
|
13604
13605
|
);
|
|
13605
13606
|
});
|
|
13606
13607
|
var sparse_id = id.replace(vendorProductRE, function (_, a, b) {
|
|
@@ -14165,7 +14166,7 @@
|
|
|
14165
14166
|
* @name currentTransform
|
|
14166
14167
|
* @memberof Renderable#
|
|
14167
14168
|
*/
|
|
14168
|
-
this.currentTransform = pull("Matrix2d");
|
|
14169
|
+
this.currentTransform = pool$1.pull("Matrix2d");
|
|
14169
14170
|
}
|
|
14170
14171
|
this.currentTransform.identity();
|
|
14171
14172
|
|
|
@@ -14254,7 +14255,7 @@
|
|
|
14254
14255
|
* @name anchorPoint
|
|
14255
14256
|
* @memberof Renderable#
|
|
14256
14257
|
*/
|
|
14257
|
-
this.anchorPoint = pull("ObservableVector2d", 0.5, 0.5, { onUpdate: this.onAnchorUpdate, scope: this });
|
|
14258
|
+
this.anchorPoint = pool$1.pull("ObservableVector2d", 0.5, 0.5, { onUpdate: this.onAnchorUpdate, scope: this });
|
|
14258
14259
|
}
|
|
14259
14260
|
|
|
14260
14261
|
/**
|
|
@@ -14304,7 +14305,7 @@
|
|
|
14304
14305
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
14305
14306
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
14306
14307
|
* @public
|
|
14307
|
-
* @type {Rect|Polygon|Line|Ellipse}
|
|
14308
|
+
* @type {Rect|RoundRect|Polygon|Line|Ellipse}
|
|
14308
14309
|
* @name mask
|
|
14309
14310
|
* @default undefined
|
|
14310
14311
|
* @memberof Renderable#
|
|
@@ -14339,7 +14340,7 @@
|
|
|
14339
14340
|
* // remove the tint
|
|
14340
14341
|
* this.tint.setColor(255, 255, 255);
|
|
14341
14342
|
*/
|
|
14342
|
-
this.tint = pull("Color", 255, 255, 255, 1.0);
|
|
14343
|
+
this.tint = pool$1.pull("Color", 255, 255, 255, 1.0);
|
|
14343
14344
|
|
|
14344
14345
|
/**
|
|
14345
14346
|
* the blend mode to be applied to this renderable (see renderer setBlendMode for available blend mode)
|
|
@@ -14373,7 +14374,7 @@
|
|
|
14373
14374
|
* @name pos
|
|
14374
14375
|
* @memberof Renderable#
|
|
14375
14376
|
*/
|
|
14376
|
-
this.pos = pull("ObservableVector3d", x, y, 0, { onUpdate: this.updateBoundsPos, scope: this});
|
|
14377
|
+
this.pos = pool$1.pull("ObservableVector3d", x, y, 0, { onUpdate: this.updateBoundsPos, scope: this});
|
|
14377
14378
|
}
|
|
14378
14379
|
|
|
14379
14380
|
/**
|
|
@@ -14754,7 +14755,7 @@
|
|
|
14754
14755
|
*/
|
|
14755
14756
|
Renderable.prototype.getAbsolutePosition = function getAbsolutePosition () {
|
|
14756
14757
|
if (typeof this._absPos === "undefined") {
|
|
14757
|
-
this._absPos = pull("Vector2d");
|
|
14758
|
+
this._absPos = pool$1.pull("Vector2d");
|
|
14758
14759
|
}
|
|
14759
14760
|
// XXX Cache me or something
|
|
14760
14761
|
this._absPos.set(this.pos.x, this.pos.y);
|
|
@@ -14909,32 +14910,32 @@
|
|
|
14909
14910
|
*/
|
|
14910
14911
|
Renderable.prototype.destroy = function destroy () {
|
|
14911
14912
|
// allow recycling object properties
|
|
14912
|
-
push(this.currentTransform);
|
|
14913
|
+
pool$1.push(this.currentTransform);
|
|
14913
14914
|
this.currentTransform = undefined;
|
|
14914
14915
|
|
|
14915
|
-
push(this.anchorPoint);
|
|
14916
|
+
pool$1.push(this.anchorPoint);
|
|
14916
14917
|
this.anchorPoint = undefined;
|
|
14917
14918
|
|
|
14918
|
-
push(this.pos);
|
|
14919
|
+
pool$1.push(this.pos);
|
|
14919
14920
|
this.pos = undefined;
|
|
14920
14921
|
|
|
14921
14922
|
if (typeof this._absPos !== "undefined") {
|
|
14922
|
-
push(this._absPos);
|
|
14923
|
+
pool$1.push(this._absPos);
|
|
14923
14924
|
this._absPos = undefined;
|
|
14924
14925
|
}
|
|
14925
14926
|
|
|
14926
|
-
push(this._bounds);
|
|
14927
|
+
pool$1.push(this._bounds);
|
|
14927
14928
|
this._bounds = undefined;
|
|
14928
14929
|
|
|
14929
14930
|
this.onVisibilityChange = undefined;
|
|
14930
14931
|
|
|
14931
14932
|
if (typeof this.mask !== "undefined") {
|
|
14932
|
-
push(this.mask);
|
|
14933
|
+
pool$1.push(this.mask);
|
|
14933
14934
|
this.mask = undefined;
|
|
14934
14935
|
}
|
|
14935
14936
|
|
|
14936
14937
|
if (typeof this.tint !== "undefined") {
|
|
14937
|
-
push(this.tint);
|
|
14938
|
+
pool$1.push(this.tint);
|
|
14938
14939
|
this.tint = undefined;
|
|
14939
14940
|
}
|
|
14940
14941
|
|
|
@@ -14979,9 +14980,9 @@
|
|
|
14979
14980
|
* @public
|
|
14980
14981
|
* @type {Vector2d}
|
|
14981
14982
|
* @name pos
|
|
14982
|
-
* @memberof Ellipse
|
|
14983
|
+
* @memberof Ellipse.prototype
|
|
14983
14984
|
*/
|
|
14984
|
-
this.pos =
|
|
14985
|
+
this.pos = pool$1.pull("Vector2d");
|
|
14985
14986
|
|
|
14986
14987
|
/**
|
|
14987
14988
|
* The bounding rectangle for this shape
|
|
@@ -14994,7 +14995,7 @@
|
|
|
14994
14995
|
* @public
|
|
14995
14996
|
* @type {number}
|
|
14996
14997
|
* @name radius
|
|
14997
|
-
* @memberof Ellipse
|
|
14998
|
+
* @memberof Ellipse.prototype
|
|
14998
14999
|
*/
|
|
14999
15000
|
this.radius = NaN;
|
|
15000
15001
|
|
|
@@ -15003,27 +15004,27 @@
|
|
|
15003
15004
|
* @public
|
|
15004
15005
|
* @type {Vector2d}
|
|
15005
15006
|
* @name radiusV
|
|
15006
|
-
* @memberof Ellipse
|
|
15007
|
+
* @memberof Ellipse.prototype
|
|
15007
15008
|
*/
|
|
15008
|
-
this.radiusV =
|
|
15009
|
+
this.radiusV = pool$1.pull("Vector2d");
|
|
15009
15010
|
|
|
15010
15011
|
/**
|
|
15011
15012
|
* Radius squared, for pythagorean theorom
|
|
15012
15013
|
* @public
|
|
15013
15014
|
* @type {Vector2d}
|
|
15014
15015
|
* @name radiusSq
|
|
15015
|
-
* @memberof Ellipse
|
|
15016
|
+
* @memberof Ellipse.prototype
|
|
15016
15017
|
*/
|
|
15017
|
-
this.radiusSq =
|
|
15018
|
+
this.radiusSq = pool$1.pull("Vector2d");
|
|
15018
15019
|
|
|
15019
15020
|
/**
|
|
15020
15021
|
* x/y scaling ratio for ellipse
|
|
15021
15022
|
* @public
|
|
15022
15023
|
* @type {Vector2d}
|
|
15023
15024
|
* @name ratio
|
|
15024
|
-
* @memberof Ellipse
|
|
15025
|
+
* @memberof Ellipse.prototype
|
|
15025
15026
|
*/
|
|
15026
|
-
this.ratio =
|
|
15027
|
+
this.ratio = pool$1.pull("Vector2d");
|
|
15027
15028
|
|
|
15028
15029
|
// the shape type
|
|
15029
15030
|
this.shapeType = "Ellipse";
|
|
@@ -15213,7 +15214,7 @@
|
|
|
15213
15214
|
*/
|
|
15214
15215
|
Ellipse.prototype.getBounds = function getBounds () {
|
|
15215
15216
|
if (typeof this._bounds === "undefined") {
|
|
15216
|
-
this._bounds = pull("Bounds");
|
|
15217
|
+
this._bounds = pool$1.pull("Bounds");
|
|
15217
15218
|
}
|
|
15218
15219
|
return this._bounds;
|
|
15219
15220
|
};
|
|
@@ -16100,7 +16101,7 @@
|
|
|
16100
16101
|
* @public
|
|
16101
16102
|
* @type {Bounds}
|
|
16102
16103
|
*/
|
|
16103
|
-
this.bounds =
|
|
16104
|
+
this.bounds = pool$1.pull("Bounds");
|
|
16104
16105
|
}
|
|
16105
16106
|
|
|
16106
16107
|
if (typeof this.shapes === "undefined") {
|
|
@@ -16134,55 +16135,54 @@
|
|
|
16134
16135
|
*/
|
|
16135
16136
|
this.collisionType = collision.types.ENEMY_OBJECT;
|
|
16136
16137
|
|
|
16137
|
-
/**
|
|
16138
|
-
* body velocity
|
|
16139
|
-
* @public
|
|
16140
|
-
* @type {Vector2d}
|
|
16141
|
-
* @default <0,0>
|
|
16142
|
-
*/
|
|
16143
16138
|
if (typeof this.vel === "undefined") {
|
|
16144
|
-
|
|
16139
|
+
/**
|
|
16140
|
+
* body velocity
|
|
16141
|
+
* @public
|
|
16142
|
+
* @type {Vector2d}
|
|
16143
|
+
* @default <0,0>
|
|
16144
|
+
*/
|
|
16145
|
+
this.vel = pool$1.pull("Vector2d");
|
|
16145
16146
|
}
|
|
16146
16147
|
this.vel.set(0, 0);
|
|
16147
16148
|
|
|
16148
|
-
/**
|
|
16149
|
-
* body force or acceleration (automatically) applied to the body.
|
|
16150
|
-
* when defining a force, user should also define a max velocity
|
|
16151
|
-
* @public
|
|
16152
|
-
* @type {Vector2d}
|
|
16153
|
-
* @default <0,0>
|
|
16154
|
-
* @see Body.setMaxVelocity
|
|
16155
|
-
* @example
|
|
16156
|
-
* // define a default maximum acceleration, initial force and friction
|
|
16157
|
-
* this.body.force.set(0, 0);
|
|
16158
|
-
* this.body.friction.set(0.4, 0);
|
|
16159
|
-
* this.body.setMaxVelocity(3, 15);
|
|
16160
|
-
*
|
|
16161
|
-
* // apply a postive or negative force when pressing left of right key
|
|
16162
|
-
* update(dt) {
|
|
16163
|
-
* if (me.input.isKeyPressed("left")){
|
|
16164
|
-
* this.body.force.x = -this.body.maxVel.x;
|
|
16165
|
-
* } else if (me.input.isKeyPressed("right")) {
|
|
16166
|
-
* this.body.force.x = this.body.maxVel.x;
|
|
16167
|
-
* } else {
|
|
16168
|
-
* this.body.force.x = 0;
|
|
16169
|
-
* }
|
|
16170
|
-
* }
|
|
16171
|
-
*/
|
|
16172
16149
|
if (typeof this.force === "undefined") {
|
|
16173
|
-
|
|
16150
|
+
/**
|
|
16151
|
+
* body force or acceleration (automatically) applied to the body.
|
|
16152
|
+
* when defining a force, user should also define a max velocity
|
|
16153
|
+
* @public
|
|
16154
|
+
* @type {Vector2d}
|
|
16155
|
+
* @default <0,0>
|
|
16156
|
+
* @see Body.setMaxVelocity
|
|
16157
|
+
* @example
|
|
16158
|
+
* // define a default maximum acceleration, initial force and friction
|
|
16159
|
+
* this.body.force.set(0, 0);
|
|
16160
|
+
* this.body.friction.set(0.4, 0);
|
|
16161
|
+
* this.body.setMaxVelocity(3, 15);
|
|
16162
|
+
*
|
|
16163
|
+
* // apply a postive or negative force when pressing left of right key
|
|
16164
|
+
* update(dt) {
|
|
16165
|
+
* if (me.input.isKeyPressed("left")){
|
|
16166
|
+
* this.body.force.x = -this.body.maxVel.x;
|
|
16167
|
+
* } else if (me.input.isKeyPressed("right")) {
|
|
16168
|
+
* this.body.force.x = this.body.maxVel.x;
|
|
16169
|
+
* } else {
|
|
16170
|
+
* this.body.force.x = 0;
|
|
16171
|
+
* }
|
|
16172
|
+
* }
|
|
16173
|
+
*/
|
|
16174
|
+
this.force = pool$1.pull("Vector2d");
|
|
16174
16175
|
}
|
|
16175
16176
|
this.force.set(0, 0);
|
|
16176
16177
|
|
|
16177
|
-
|
|
16178
|
-
/**
|
|
16179
|
-
* body friction
|
|
16180
|
-
* @public
|
|
16181
|
-
* @type {Vector2d}
|
|
16182
|
-
* @default <0,0>
|
|
16183
|
-
*/
|
|
16184
16178
|
if (typeof this.friction === "undefined") {
|
|
16185
|
-
|
|
16179
|
+
/**
|
|
16180
|
+
* body friction
|
|
16181
|
+
* @public
|
|
16182
|
+
* @type {Vector2d}
|
|
16183
|
+
* @default <0,0>
|
|
16184
|
+
*/
|
|
16185
|
+
this.friction = pool$1.pull("Vector2d");
|
|
16186
16186
|
}
|
|
16187
16187
|
this.friction.set(0, 0);
|
|
16188
16188
|
|
|
@@ -16203,14 +16203,14 @@
|
|
|
16203
16203
|
*/
|
|
16204
16204
|
this.mass = 1;
|
|
16205
16205
|
|
|
16206
|
-
/**
|
|
16207
|
-
* max velocity (to limit body velocity)
|
|
16208
|
-
* @public
|
|
16209
|
-
* @type {Vector2d}
|
|
16210
|
-
* @default <490,490>
|
|
16211
|
-
*/
|
|
16212
16206
|
if (typeof this.maxVel === "undefined") {
|
|
16213
|
-
|
|
16207
|
+
/**
|
|
16208
|
+
* max velocity (to limit body velocity)
|
|
16209
|
+
* @public
|
|
16210
|
+
* @type {Vector2d}
|
|
16211
|
+
* @default <490,490>
|
|
16212
|
+
*/
|
|
16213
|
+
this.maxVel = pool$1.pull("Vector2d");
|
|
16214
16214
|
}
|
|
16215
16215
|
// cap by default to half the default gravity force
|
|
16216
16216
|
this.maxVel.set(490, 490);
|
|
@@ -16365,7 +16365,7 @@
|
|
|
16365
16365
|
polygon.setShape(0, 0, vertices);
|
|
16366
16366
|
} else {
|
|
16367
16367
|
// this will replace any other non polygon shape type if defined
|
|
16368
|
-
this.shapes[index] =
|
|
16368
|
+
this.shapes[index] = pool$1.pull("Polygon", 0, 0, vertices);
|
|
16369
16369
|
}
|
|
16370
16370
|
|
|
16371
16371
|
// update the body bounds to take in account the new vertices
|
|
@@ -16763,11 +16763,28 @@
|
|
|
16763
16763
|
* @ignore
|
|
16764
16764
|
*/
|
|
16765
16765
|
Body.prototype.destroy = function destroy () {
|
|
16766
|
+
// push back instance into object pool
|
|
16767
|
+
pool$1.push(this.bounds);
|
|
16768
|
+
pool$1.push(this.vel);
|
|
16769
|
+
pool$1.push(this.force);
|
|
16770
|
+
pool$1.push(this.friction);
|
|
16771
|
+
pool$1.push(this.maxVel);
|
|
16772
|
+
this.shapes.forEach(function (shape) {
|
|
16773
|
+
pool$1.push(shape);
|
|
16774
|
+
});
|
|
16775
|
+
|
|
16776
|
+
// set to undefined
|
|
16766
16777
|
this.onBodyUpdate = undefined;
|
|
16767
16778
|
this.ancestor = undefined;
|
|
16768
16779
|
this.bounds = undefined;
|
|
16769
|
-
this.
|
|
16780
|
+
this.vel = undefined;
|
|
16781
|
+
this.force = undefined;
|
|
16782
|
+
this.friction = undefined;
|
|
16783
|
+
this.maxVel = undefined;
|
|
16770
16784
|
this.shapes.length = 0;
|
|
16785
|
+
|
|
16786
|
+
// reset some variable to default
|
|
16787
|
+
this.setStatic(false);
|
|
16771
16788
|
};
|
|
16772
16789
|
|
|
16773
16790
|
/**
|
|
@@ -16894,7 +16911,7 @@
|
|
|
16894
16911
|
* // add a red background color to this container
|
|
16895
16912
|
* this.backgroundColor.setColor(255, 0, 0);
|
|
16896
16913
|
*/
|
|
16897
|
-
this.backgroundColor = pull("Color", 0, 0, 0, 0.0);
|
|
16914
|
+
this.backgroundColor = pool$1.pull("Color", 0, 0, 0, 0.0);
|
|
16898
16915
|
|
|
16899
16916
|
/**
|
|
16900
16917
|
* Used by the debug panel plugin
|
|
@@ -17460,7 +17477,7 @@
|
|
|
17460
17477
|
|
|
17461
17478
|
if (!keepalive) {
|
|
17462
17479
|
// attempt at recycling the object
|
|
17463
|
-
if (push(child, false) === false ) {
|
|
17480
|
+
if (pool$1.push(child, false) === false ) {
|
|
17464
17481
|
// else just destroy it
|
|
17465
17482
|
if (typeof child.destroy === "function") {
|
|
17466
17483
|
child.destroy();
|
|
@@ -18223,7 +18240,7 @@
|
|
|
18223
18240
|
* @name bodies
|
|
18224
18241
|
* @memberof World
|
|
18225
18242
|
* @public
|
|
18226
|
-
* @type {Set}
|
|
18243
|
+
* @type {Set<Body>}
|
|
18227
18244
|
*/
|
|
18228
18245
|
this.bodies = new Set();
|
|
18229
18246
|
|
|
@@ -18630,7 +18647,7 @@
|
|
|
18630
18647
|
* @name bounds
|
|
18631
18648
|
* @memberof Camera2d
|
|
18632
18649
|
*/
|
|
18633
|
-
this.bounds = pull("Bounds");
|
|
18650
|
+
this.bounds = pool$1.pull("Bounds");
|
|
18634
18651
|
|
|
18635
18652
|
/**
|
|
18636
18653
|
* enable or disable damping
|
|
@@ -19127,8 +19144,8 @@
|
|
|
19127
19144
|
Camera2d.prototype.fadeOut = function fadeOut (color, duration, onComplete) {
|
|
19128
19145
|
if ( duration === void 0 ) duration = 1000;
|
|
19129
19146
|
|
|
19130
|
-
this._fadeOut.color = pull("Color").copy(color);
|
|
19131
|
-
this._fadeOut.tween = pull("Tween", this._fadeOut.color)
|
|
19147
|
+
this._fadeOut.color = pool$1.pull("Color").copy(color);
|
|
19148
|
+
this._fadeOut.tween = pool$1.pull("Tween", this._fadeOut.color)
|
|
19132
19149
|
.to({ alpha: 0.0 }, duration)
|
|
19133
19150
|
.onComplete(onComplete || null);
|
|
19134
19151
|
this._fadeOut.tween.isPersistent = true;
|
|
@@ -19151,10 +19168,10 @@
|
|
|
19151
19168
|
Camera2d.prototype.fadeIn = function fadeIn (color, duration, onComplete) {
|
|
19152
19169
|
if ( duration === void 0 ) duration = 1000;
|
|
19153
19170
|
|
|
19154
|
-
this._fadeIn.color = pull("Color").copy(color);
|
|
19171
|
+
this._fadeIn.color = pool$1.pull("Color").copy(color);
|
|
19155
19172
|
var _alpha = this._fadeIn.color.alpha;
|
|
19156
19173
|
this._fadeIn.color.alpha = 0.0;
|
|
19157
|
-
this._fadeIn.tween = pull("Tween", this._fadeIn.color)
|
|
19174
|
+
this._fadeIn.tween = pool$1.pull("Tween", this._fadeIn.color)
|
|
19158
19175
|
.to({ alpha: _alpha }, duration)
|
|
19159
19176
|
.onComplete(onComplete || null);
|
|
19160
19177
|
this._fadeIn.tween.isPersistent = true;
|
|
@@ -19210,7 +19227,7 @@
|
|
|
19210
19227
|
*/
|
|
19211
19228
|
Camera2d.prototype.localToWorld = function localToWorld (x, y, v) {
|
|
19212
19229
|
// TODO memoization for one set of coords (multitouch)
|
|
19213
|
-
v = v || pull("Vector2d");
|
|
19230
|
+
v = v || pool$1.pull("Vector2d");
|
|
19214
19231
|
v.set(x, y).add(this.pos).sub(world.pos);
|
|
19215
19232
|
if (!this.currentTransform.isIdentity()) {
|
|
19216
19233
|
this.invCurrentTransform.apply(v);
|
|
@@ -19231,7 +19248,7 @@
|
|
|
19231
19248
|
*/
|
|
19232
19249
|
Camera2d.prototype.worldToLocal = function worldToLocal (x, y, v) {
|
|
19233
19250
|
// TODO memoization for one set of coords (multitouch)
|
|
19234
|
-
v = v || pull("Vector2d");
|
|
19251
|
+
v = v || pool$1.pull("Vector2d");
|
|
19235
19252
|
v.set(x, y);
|
|
19236
19253
|
if (!this.currentTransform.isIdentity()) {
|
|
19237
19254
|
this.currentTransform.apply(v);
|
|
@@ -19256,7 +19273,7 @@
|
|
|
19256
19273
|
// remove the tween if over
|
|
19257
19274
|
if (this._fadeIn.color.alpha === 1.0) {
|
|
19258
19275
|
this._fadeIn.tween = null;
|
|
19259
|
-
push(this._fadeIn.color);
|
|
19276
|
+
pool$1.push(this._fadeIn.color);
|
|
19260
19277
|
this._fadeIn.color = null;
|
|
19261
19278
|
}
|
|
19262
19279
|
}
|
|
@@ -19273,7 +19290,7 @@
|
|
|
19273
19290
|
// remove the tween if over
|
|
19274
19291
|
if (this._fadeOut.color.alpha === 0.0) {
|
|
19275
19292
|
this._fadeOut.tween = null;
|
|
19276
|
-
push(this._fadeOut.color);
|
|
19293
|
+
pool$1.push(this._fadeOut.color);
|
|
19277
19294
|
this._fadeOut.color = null;
|
|
19278
19295
|
}
|
|
19279
19296
|
}
|
|
@@ -19344,7 +19361,7 @@
|
|
|
19344
19361
|
* Cameras will be renderered based on this order defined in this list.
|
|
19345
19362
|
* Only the "default" camera will be resized when the window or canvas is resized.
|
|
19346
19363
|
* @public
|
|
19347
|
-
* @type {Map}
|
|
19364
|
+
* @type {Map<Camera2d>}
|
|
19348
19365
|
* @name cameras
|
|
19349
19366
|
* @memberof Stage
|
|
19350
19367
|
*/
|
|
@@ -19618,7 +19635,7 @@
|
|
|
19618
19635
|
|
|
19619
19636
|
), 2);
|
|
19620
19637
|
|
|
19621
|
-
var logo1 = pull("Text",
|
|
19638
|
+
var logo1 = pool$1.pull("Text",
|
|
19622
19639
|
renderer.getWidth() / 2,
|
|
19623
19640
|
(renderer.getHeight() / 2) + 16, {
|
|
19624
19641
|
font: "century gothic",
|
|
@@ -19632,7 +19649,7 @@
|
|
|
19632
19649
|
);
|
|
19633
19650
|
logo1.anchorPoint.set(0, 0);
|
|
19634
19651
|
|
|
19635
|
-
var logo2 = pull("Text",
|
|
19652
|
+
var logo2 = pool$1.pull("Text",
|
|
19636
19653
|
renderer.getWidth() / 2,
|
|
19637
19654
|
(renderer.getHeight() / 2) + 16, {
|
|
19638
19655
|
font: "century gothic",
|
|
@@ -20175,7 +20192,7 @@
|
|
|
20175
20192
|
// if fading effect
|
|
20176
20193
|
if (_fade.duration && _stages[state].transition) {
|
|
20177
20194
|
/** @ignore */
|
|
20178
|
-
_onSwitchComplete = function() {
|
|
20195
|
+
_onSwitchComplete = function () {
|
|
20179
20196
|
viewport.fadeOut(_fade.color, _fade.duration);
|
|
20180
20197
|
};
|
|
20181
20198
|
viewport.fadeIn(
|
|
@@ -21331,7 +21348,7 @@
|
|
|
21331
21348
|
var height = image.height;
|
|
21332
21349
|
|
|
21333
21350
|
// calculate the sprite count (line, col)
|
|
21334
|
-
var spritecount = pull("Vector2d",
|
|
21351
|
+
var spritecount = pool$1.pull("Vector2d",
|
|
21335
21352
|
~~((width - margin + spacing) / (data.framewidth + spacing)),
|
|
21336
21353
|
~~((height - margin + spacing) / (data.frameheight + spacing))
|
|
21337
21354
|
);
|
|
@@ -21374,7 +21391,7 @@
|
|
|
21374
21391
|
this.addUVs(atlas, name, width, height);
|
|
21375
21392
|
}
|
|
21376
21393
|
|
|
21377
|
-
push(spritecount);
|
|
21394
|
+
pool$1.push(spritecount);
|
|
21378
21395
|
|
|
21379
21396
|
return atlas;
|
|
21380
21397
|
};
|
|
@@ -21549,7 +21566,7 @@
|
|
|
21549
21566
|
if ( nineSlice === void 0 ) nineSlice = false;
|
|
21550
21567
|
|
|
21551
21568
|
// instantiate a new sprite object
|
|
21552
|
-
return pull(
|
|
21569
|
+
return pool$1.pull(
|
|
21553
21570
|
nineSlice === true ? "me.NineSliceSprite" : "me.Sprite",
|
|
21554
21571
|
0, 0,
|
|
21555
21572
|
Object.assign({
|
|
@@ -21657,7 +21674,7 @@
|
|
|
21657
21674
|
* @name offset
|
|
21658
21675
|
* @memberof Sprite#
|
|
21659
21676
|
*/
|
|
21660
|
-
this.offset = pull("Vector2d", 0, 0);
|
|
21677
|
+
this.offset = pool$1.pull("Vector2d", 0, 0);
|
|
21661
21678
|
|
|
21662
21679
|
/**
|
|
21663
21680
|
* The source texture object this sprite object is using
|
|
@@ -21682,7 +21699,7 @@
|
|
|
21682
21699
|
// length of the current animation name
|
|
21683
21700
|
length : 0,
|
|
21684
21701
|
//current frame texture offset
|
|
21685
|
-
offset :
|
|
21702
|
+
offset : pool$1.pull("Vector2d"),
|
|
21686
21703
|
// current frame size
|
|
21687
21704
|
width : 0,
|
|
21688
21705
|
height : 0,
|
|
@@ -22178,7 +22195,7 @@
|
|
|
22178
22195
|
* @ignore
|
|
22179
22196
|
*/
|
|
22180
22197
|
Sprite.prototype.destroy = function destroy () {
|
|
22181
|
-
push(this.offset);
|
|
22198
|
+
pool$1.push(this.offset);
|
|
22182
22199
|
this.offset = undefined;
|
|
22183
22200
|
Renderable.prototype.destroy.call(this);
|
|
22184
22201
|
};
|
|
@@ -22420,6 +22437,172 @@
|
|
|
22420
22437
|
return Tile;
|
|
22421
22438
|
}(Bounds$1));
|
|
22422
22439
|
|
|
22440
|
+
// https://developer.chrome.com/blog/canvas2d/#round-rect
|
|
22441
|
+
|
|
22442
|
+
/**
|
|
22443
|
+
* @classdesc
|
|
22444
|
+
* a rectangle object with rounded corners
|
|
22445
|
+
* @augments Rect
|
|
22446
|
+
*/
|
|
22447
|
+
var RoundRect = /*@__PURE__*/(function (Rect) {
|
|
22448
|
+
function RoundRect(x, y, width, height, radius) {
|
|
22449
|
+
if ( radius === void 0 ) radius = 20;
|
|
22450
|
+
|
|
22451
|
+
// parent constructor
|
|
22452
|
+
Rect.call(this, x, y, width, height);
|
|
22453
|
+
|
|
22454
|
+
// set the corner radius
|
|
22455
|
+
this.radius = radius;
|
|
22456
|
+
}
|
|
22457
|
+
|
|
22458
|
+
if ( Rect ) RoundRect.__proto__ = Rect;
|
|
22459
|
+
RoundRect.prototype = Object.create( Rect && Rect.prototype );
|
|
22460
|
+
RoundRect.prototype.constructor = RoundRect;
|
|
22461
|
+
|
|
22462
|
+
var prototypeAccessors = { radius: { configurable: true } };
|
|
22463
|
+
|
|
22464
|
+
/** @ignore */
|
|
22465
|
+
RoundRect.prototype.onResetEvent = function onResetEvent (x, y, w, h, radius) {
|
|
22466
|
+
Rect.prototype.setShape.call(this, x, y, w, h);
|
|
22467
|
+
this.radius = radius;
|
|
22468
|
+
};
|
|
22469
|
+
|
|
22470
|
+
|
|
22471
|
+
/**
|
|
22472
|
+
* the radius of the rounded corner
|
|
22473
|
+
* @public
|
|
22474
|
+
* @type {number}
|
|
22475
|
+
* @default 20
|
|
22476
|
+
* @name radius
|
|
22477
|
+
* @memberof RoundRect.prototype
|
|
22478
|
+
*/
|
|
22479
|
+
prototypeAccessors.radius.get = function () {
|
|
22480
|
+
return this._radius;
|
|
22481
|
+
};
|
|
22482
|
+
prototypeAccessors.radius.set = function (value) {
|
|
22483
|
+
// verify the rectangle is at least as wide and tall as the rounded corners.
|
|
22484
|
+
if (this.width < 2 * value) {
|
|
22485
|
+
value = this.width / 2;
|
|
22486
|
+
}
|
|
22487
|
+
if (this.height < 2 * value) {
|
|
22488
|
+
value = this.height / 2;
|
|
22489
|
+
}
|
|
22490
|
+
this._radius = value;
|
|
22491
|
+
};
|
|
22492
|
+
|
|
22493
|
+
/**
|
|
22494
|
+
* copy the position, size and radius of the given rounded rectangle into this one
|
|
22495
|
+
* @name copy
|
|
22496
|
+
* @memberof RoundRect.prototype
|
|
22497
|
+
* @function
|
|
22498
|
+
* @param {RoundRect} rrect source rounded rectangle
|
|
22499
|
+
* @returns {RoundRect} new rectangle
|
|
22500
|
+
*/
|
|
22501
|
+
RoundRect.prototype.copy = function copy (rrect) {
|
|
22502
|
+
Rect.prototype.setShape.call(this, rrect.pos.x, rrect.pos.y, rrect.width, rrect.height);
|
|
22503
|
+
this.radius = rrect.radius;
|
|
22504
|
+
return this;
|
|
22505
|
+
};
|
|
22506
|
+
|
|
22507
|
+
/**
|
|
22508
|
+
* Returns true if the rounded rectangle contains the given point
|
|
22509
|
+
* @name contains
|
|
22510
|
+
* @memberof RoundRect.prototype
|
|
22511
|
+
* @function
|
|
22512
|
+
* @param {number} x x coordinate
|
|
22513
|
+
* @param {number} y y coordinate
|
|
22514
|
+
* @returns {boolean} true if contains
|
|
22515
|
+
*/
|
|
22516
|
+
|
|
22517
|
+
/**
|
|
22518
|
+
* Returns true if the rounded rectangle contains the given point
|
|
22519
|
+
* @name contains
|
|
22520
|
+
* @memberof RoundRect.prototype
|
|
22521
|
+
* @function
|
|
22522
|
+
* @param {Vector2d} point
|
|
22523
|
+
* @returns {boolean} true if contains
|
|
22524
|
+
*/
|
|
22525
|
+
RoundRect.prototype.contains = function contains () {
|
|
22526
|
+
var arg0 = arguments[0];
|
|
22527
|
+
var _x, _y;
|
|
22528
|
+
if (arguments.length === 2) {
|
|
22529
|
+
// x, y
|
|
22530
|
+
_x = arg0;
|
|
22531
|
+
_y = arguments[1];
|
|
22532
|
+
} else {
|
|
22533
|
+
if (arg0 instanceof Rect) {
|
|
22534
|
+
// good enough
|
|
22535
|
+
return Rect.prototype.contains.call(this, arg0);
|
|
22536
|
+
} else {
|
|
22537
|
+
// vector
|
|
22538
|
+
_x = arg0.x;
|
|
22539
|
+
_y = arg0.y;
|
|
22540
|
+
}
|
|
22541
|
+
}
|
|
22542
|
+
|
|
22543
|
+
// check whether point is outside the bounding box
|
|
22544
|
+
if (_x < this.left || _x >= this.right || _y < this.top || _y >= this.bottom) {
|
|
22545
|
+
return false; // outside bounding box
|
|
22546
|
+
}
|
|
22547
|
+
|
|
22548
|
+
// check whether point is within the bounding box minus radius
|
|
22549
|
+
if ((_x >= this.left + this.radius && _x <= this.right - this.radius) || (_y >= this.top + this.radius && _y <= this.bottom - this.radius)) {
|
|
22550
|
+
return true;
|
|
22551
|
+
}
|
|
22552
|
+
|
|
22553
|
+
// check whether point is in one of the rounded corner areas
|
|
22554
|
+
var tx, ty;
|
|
22555
|
+
var radiusX = Math.max(0, Math.min(this.radius, this.width / 2));
|
|
22556
|
+
var radiusY = Math.max(0, Math.min(this.radius, this.height / 2));
|
|
22557
|
+
|
|
22558
|
+
if (_x < this.left + radiusX && _y < this.top + radiusY) {
|
|
22559
|
+
tx = _x - this.left - radiusX;
|
|
22560
|
+
ty = _y - this.top - radiusY;
|
|
22561
|
+
} else if (_x > this.right - radiusX && _y < this.top + radiusY) {
|
|
22562
|
+
tx = _x - this.right + radiusX;
|
|
22563
|
+
ty = _y - this.top - radiusY;
|
|
22564
|
+
} else if (_x > this.right - radiusX && _y > this.bottom - radiusY) {
|
|
22565
|
+
tx = _x - this.right + radiusX;
|
|
22566
|
+
ty = _y - this.bottom + radiusY;
|
|
22567
|
+
} else if (_x < this.left + radiusX && _y > this.bottom - radiusY) {
|
|
22568
|
+
tx = _x - this.left - radiusX;
|
|
22569
|
+
ty = _y - this.bottom + radiusY;
|
|
22570
|
+
} else {
|
|
22571
|
+
return false; // inside and not within the rounded corner area
|
|
22572
|
+
}
|
|
22573
|
+
|
|
22574
|
+
// Pythagorean theorem.
|
|
22575
|
+
return ((tx * tx) + (ty * ty) <= (radiusX * radiusY));
|
|
22576
|
+
};
|
|
22577
|
+
|
|
22578
|
+
/**
|
|
22579
|
+
* check if this RoundRect is identical to the specified one
|
|
22580
|
+
* @name equals
|
|
22581
|
+
* @memberof RoundRect.prototype
|
|
22582
|
+
* @function
|
|
22583
|
+
* @param {RoundRect} rrect
|
|
22584
|
+
* @returns {boolean} true if equals
|
|
22585
|
+
*/
|
|
22586
|
+
RoundRect.prototype.equals = function equals (rrect) {
|
|
22587
|
+
return Rect.prototype.equals.call(this, rrect) && this.radius === rrect.radius;
|
|
22588
|
+
};
|
|
22589
|
+
|
|
22590
|
+
/**
|
|
22591
|
+
* clone this RoundRect
|
|
22592
|
+
* @name clone
|
|
22593
|
+
* @memberof RoundRect.prototype
|
|
22594
|
+
* @function
|
|
22595
|
+
* @returns {RoundRect} new RoundRect
|
|
22596
|
+
*/
|
|
22597
|
+
RoundRect.prototype.clone = function clone () {
|
|
22598
|
+
return new RoundRect(this.pos.x, this.pos.y, this.width, this.height, radius);
|
|
22599
|
+
};
|
|
22600
|
+
|
|
22601
|
+
Object.defineProperties( RoundRect.prototype, prototypeAccessors );
|
|
22602
|
+
|
|
22603
|
+
return RoundRect;
|
|
22604
|
+
}(Rect));
|
|
22605
|
+
|
|
22423
22606
|
/**
|
|
22424
22607
|
* @classdesc
|
|
22425
22608
|
* a line segment Object
|
|
@@ -22484,11 +22667,11 @@
|
|
|
22484
22667
|
|
|
22485
22668
|
// Calculate the edges/normals
|
|
22486
22669
|
if (edges[0] === undefined) {
|
|
22487
|
-
edges[0] =
|
|
22670
|
+
edges[0] = pool$1.pull("Vector2d");
|
|
22488
22671
|
}
|
|
22489
22672
|
edges[0].copy(points[1]).sub(points[0]);
|
|
22490
22673
|
if (normals[0] === undefined) {
|
|
22491
|
-
normals[0] =
|
|
22674
|
+
normals[0] = pool$1.pull("Vector2d");
|
|
22492
22675
|
}
|
|
22493
22676
|
normals[0].copy(edges[0]).perp().normalize();
|
|
22494
22677
|
|
|
@@ -22517,6 +22700,323 @@
|
|
|
22517
22700
|
return Line;
|
|
22518
22701
|
}(Polygon));
|
|
22519
22702
|
|
|
22703
|
+
/**
|
|
22704
|
+
* @classdesc
|
|
22705
|
+
* a simplified path2d implementation, supporting only one path
|
|
22706
|
+
*/
|
|
22707
|
+
var Path2D$1 = function Path2D() {
|
|
22708
|
+
/**
|
|
22709
|
+
* the points defining the current path
|
|
22710
|
+
* @public
|
|
22711
|
+
* @type {Vector2d[]}
|
|
22712
|
+
* @name points
|
|
22713
|
+
* @memberof Path2D#
|
|
22714
|
+
*/
|
|
22715
|
+
this.points = [];
|
|
22716
|
+
|
|
22717
|
+
/**
|
|
22718
|
+
* space between interpolated points for quadratic and bezier curve approx. in pixels.
|
|
22719
|
+
* @public
|
|
22720
|
+
* @type {number}
|
|
22721
|
+
* @name arcResolution
|
|
22722
|
+
* @default 5
|
|
22723
|
+
* @memberof Path2D#
|
|
22724
|
+
*/
|
|
22725
|
+
this.arcResolution = 5;
|
|
22726
|
+
|
|
22727
|
+
/* @ignore */
|
|
22728
|
+
this.vertices = [];
|
|
22729
|
+
};
|
|
22730
|
+
|
|
22731
|
+
/**
|
|
22732
|
+
* begin a new path
|
|
22733
|
+
* @name beginPath
|
|
22734
|
+
* @memberof Path2D.prototype
|
|
22735
|
+
* @function
|
|
22736
|
+
*/
|
|
22737
|
+
Path2D$1.prototype.beginPath = function beginPath () {
|
|
22738
|
+
// empty the cache and recycle all vectors
|
|
22739
|
+
this.points.forEach(function (point) {
|
|
22740
|
+
pool$1.push(point);
|
|
22741
|
+
});
|
|
22742
|
+
this.points.length = 0;
|
|
22743
|
+
};
|
|
22744
|
+
|
|
22745
|
+
/**
|
|
22746
|
+
* causes the point of the pen to move back to the start of the current path.
|
|
22747
|
+
* It tries to draw a straight line from the current point to the start.
|
|
22748
|
+
* If the shape has already been closed or has only one point, this function does nothing.
|
|
22749
|
+
* @name closePath
|
|
22750
|
+
* @memberof Path2D.prototype
|
|
22751
|
+
* @function
|
|
22752
|
+
*/
|
|
22753
|
+
Path2D$1.prototype.closePath = function closePath () {
|
|
22754
|
+
var points = this.points;
|
|
22755
|
+
if (points.length > 1 && !points[points.length-1].equals(points[0])) {
|
|
22756
|
+
points.push(pool$1.pull("Vector2d", points[0].x, points[0].y));
|
|
22757
|
+
}
|
|
22758
|
+
};
|
|
22759
|
+
|
|
22760
|
+
/**
|
|
22761
|
+
* triangulate the shape defined by this path into an array of triangles
|
|
22762
|
+
* @name triangulatePath
|
|
22763
|
+
* @memberof Path2D.prototype
|
|
22764
|
+
* @function
|
|
22765
|
+
* @returns {Vector2d[]}
|
|
22766
|
+
*/
|
|
22767
|
+
Path2D$1.prototype.triangulatePath = function triangulatePath () {
|
|
22768
|
+
var i = 0;
|
|
22769
|
+
var points = this.points;
|
|
22770
|
+
var vertices = this.vertices;
|
|
22771
|
+
var indices = earcut$1.exports(points.flatMap(function (p) { return [p.x, p.y]; }));
|
|
22772
|
+
|
|
22773
|
+
// calculate all vertices
|
|
22774
|
+
for (i = 0; i < indices.length; i++ ) {
|
|
22775
|
+
if (typeof vertices[i] === "undefined") {
|
|
22776
|
+
// increase cache buffer if necessary
|
|
22777
|
+
vertices[i] = pool$1.pull("Vector2d");
|
|
22778
|
+
}
|
|
22779
|
+
vertices[i].set(points[indices[i]].x, points[indices[i]].y);
|
|
22780
|
+
}
|
|
22781
|
+
|
|
22782
|
+
// recycle overhead from a previous triangulation
|
|
22783
|
+
while (vertices.length > indices.length) {
|
|
22784
|
+
pool$1.push(vertices[vertices.length-1]);
|
|
22785
|
+
vertices.length -= 1;
|
|
22786
|
+
}
|
|
22787
|
+
|
|
22788
|
+
return vertices;
|
|
22789
|
+
};
|
|
22790
|
+
|
|
22791
|
+
/**
|
|
22792
|
+
* moves the starting point of the current path to the (x, y) coordinates.
|
|
22793
|
+
* @name moveTo
|
|
22794
|
+
* @memberof Path2D.prototype
|
|
22795
|
+
* @function
|
|
22796
|
+
* @param {number} x the x-axis (horizontal) coordinate of the point.
|
|
22797
|
+
* @param {number} y the y-axis (vertical) coordinate of the point.
|
|
22798
|
+
*/
|
|
22799
|
+
Path2D$1.prototype.moveTo = function moveTo (x, y) {
|
|
22800
|
+
this.points.push(pool$1.pull("Vector2d", x, y));
|
|
22801
|
+
};
|
|
22802
|
+
|
|
22803
|
+
/**
|
|
22804
|
+
* connects the last point in the current patch to the (x, y) coordinates with a straight line.
|
|
22805
|
+
* @name lineTo
|
|
22806
|
+
* @memberof Path2D.prototype
|
|
22807
|
+
* @function
|
|
22808
|
+
* @param {number} x the x-axis coordinate of the line's end point.
|
|
22809
|
+
* @param {number} y the y-axis coordinate of the line's end point.
|
|
22810
|
+
*/
|
|
22811
|
+
Path2D$1.prototype.lineTo = function lineTo (x, y) {
|
|
22812
|
+
this.points.push(pool$1.pull("Vector2d", x, y));
|
|
22813
|
+
};
|
|
22814
|
+
|
|
22815
|
+
/**
|
|
22816
|
+
* adds an arc to the current path which is centered at (x, y) position with the given radius,
|
|
22817
|
+
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise (defaulting to clockwise).
|
|
22818
|
+
* @name arc
|
|
22819
|
+
* @memberof Path2D.prototype
|
|
22820
|
+
* @function
|
|
22821
|
+
* @param {number} x the horizontal coordinate of the arc's center.
|
|
22822
|
+
* @param {number} y the vertical coordinate of the arc's center.
|
|
22823
|
+
* @param {number} radius the arc's radius. Must be positive.
|
|
22824
|
+
* @param {number} startAngle the angle at which the arc starts in radians, measured from the positive x-axis.
|
|
22825
|
+
* @param {number} endAngle the angle at which the arc ends in radians, measured from the positive x-axis.
|
|
22826
|
+
* @param {boolean} [anticlockwise=false] an optional boolean value. If true, draws the arc counter-clockwise between the start and end angles.
|
|
22827
|
+
*/
|
|
22828
|
+
Path2D$1.prototype.arc = function arc (x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
22829
|
+
if ( anticlockwise === void 0 ) anticlockwise = false;
|
|
22830
|
+
|
|
22831
|
+
var points = this.points;
|
|
22832
|
+
// based on from https://github.com/karellodewijk/canvas-webgl/blob/master/canvas-webgl.js
|
|
22833
|
+
//bring angles all in [0, 2*PI] range
|
|
22834
|
+
if (startAngle === endAngle) { return; }
|
|
22835
|
+
var fullCircle = anticlockwise ? Math.abs(startAngle-endAngle) >= (TAU) : Math.abs(endAngle-startAngle) >= (TAU);
|
|
22836
|
+
|
|
22837
|
+
startAngle = startAngle % (TAU);
|
|
22838
|
+
endAngle = endAngle % (TAU);
|
|
22839
|
+
|
|
22840
|
+
if (startAngle < 0) { startAngle += TAU; }
|
|
22841
|
+
if (endAngle < 0) { endAngle += TAU; }
|
|
22842
|
+
|
|
22843
|
+
if (startAngle >= endAngle) {
|
|
22844
|
+
endAngle+= TAU;
|
|
22845
|
+
}
|
|
22846
|
+
|
|
22847
|
+
var diff = endAngle - startAngle;
|
|
22848
|
+
var direction = 1;
|
|
22849
|
+
if (anticlockwise) {
|
|
22850
|
+
direction = -1;
|
|
22851
|
+
diff = TAU - diff;
|
|
22852
|
+
}
|
|
22853
|
+
|
|
22854
|
+
if (fullCircle) { diff = TAU; }
|
|
22855
|
+
|
|
22856
|
+
var length = diff * radius;
|
|
22857
|
+
var nr_of_interpolation_points = length / this.arcResolution;
|
|
22858
|
+
var dangle = diff / nr_of_interpolation_points;
|
|
22859
|
+
|
|
22860
|
+
var angle = startAngle;
|
|
22861
|
+
for (var j = 0; j < nr_of_interpolation_points; j++) {
|
|
22862
|
+
points.push(pool$1.pull("Vector2d", x + radius * Math.cos(angle), y + radius * Math.sin(angle)));
|
|
22863
|
+
angle += direction * dangle;
|
|
22864
|
+
}
|
|
22865
|
+
points.push(pool$1.pull("Vector2d", x + radius * Math.cos(endAngle), y + radius * Math.sin(endAngle)));
|
|
22866
|
+
};
|
|
22867
|
+
|
|
22868
|
+
/**
|
|
22869
|
+
* adds a circular arc to the path with the given control points and radius, connected to the previous point by a straight line.
|
|
22870
|
+
* @name arcTo
|
|
22871
|
+
* @memberof Path2D.prototype
|
|
22872
|
+
* @function
|
|
22873
|
+
* @param {number} x the x-axis coordinate of the first control point.
|
|
22874
|
+
* @param {number} y the y-axis coordinate of the first control point.
|
|
22875
|
+
* @param {number} x the x-axis coordinate of the second control point.
|
|
22876
|
+
* @param {number} y the y-axis coordinate of the second control point.
|
|
22877
|
+
* @param {number} radius the arc's radius. Must be positive.
|
|
22878
|
+
*/
|
|
22879
|
+
Path2D$1.prototype.arcTo = function arcTo (x1, y1, x2, y2, radius) {
|
|
22880
|
+
var points = this.points;
|
|
22881
|
+
// based on from https://github.com/karellodewijk/canvas-webgl/blob/master/canvas-webgl.js
|
|
22882
|
+
var x0 = points[points.length-1].x, y0 = points[points.length-1].y;
|
|
22883
|
+
|
|
22884
|
+
//a = -incoming vector, b = outgoing vector to x1, y1
|
|
22885
|
+
var a = [x0 - x1, y0 - y1];
|
|
22886
|
+
var b = [x2 - x1, y2 - y1];
|
|
22887
|
+
|
|
22888
|
+
//normalize
|
|
22889
|
+
var l_a = Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2));
|
|
22890
|
+
var l_b = Math.sqrt(Math.pow(b[0], 2) + Math.pow(b[1], 2));
|
|
22891
|
+
a[0] /= l_a; a[1] /= l_a; b[0] /= l_b; b[1] /= l_b;
|
|
22892
|
+
var angle = Math.atan2(a[1], a[0]) - Math.atan2(b[1], b[0]);
|
|
22893
|
+
|
|
22894
|
+
//work out tangent points using tan(θ) = opposite / adjacent; angle/2 because hypotenuse is the bisection of a,b
|
|
22895
|
+
var tan_angle_div2 = Math.tan(angle/2);
|
|
22896
|
+
var adj_l = (radius/tan_angle_div2);
|
|
22897
|
+
|
|
22898
|
+
var tangent_point1 = [x1 + a[0] * adj_l, y1 + a[1] * adj_l];
|
|
22899
|
+
var tangent_point2 = [x1 + b[0] * adj_l, y1 + b[1] * adj_l];
|
|
22900
|
+
|
|
22901
|
+
points.push(pool$1.pull("Vector2d", tangent_point1[0], tangent_point1[1]));
|
|
22902
|
+
|
|
22903
|
+
var bisec = [(a[0] + b[0]) / 2.0, (a[1] + b[1]) / 2.0];
|
|
22904
|
+
var bisec_l = Math.sqrt(Math.pow(bisec[0], 2) + Math.pow(bisec[1], 2));
|
|
22905
|
+
bisec[0] /= bisec_l; bisec[1] /= bisec_l;
|
|
22906
|
+
|
|
22907
|
+
var hyp_l = Math.sqrt(Math.pow(radius, 2) + Math.pow(adj_l, 2));
|
|
22908
|
+
var center = [x1 + hyp_l * bisec[0], y1 + hyp_l * bisec[1]];
|
|
22909
|
+
|
|
22910
|
+
var startAngle = Math.atan2(tangent_point1[1] - center[1], tangent_point1[0] - center[0]);
|
|
22911
|
+
var endAngle = Math.atan2(tangent_point2[1] - center[1], tangent_point2[0] - center[0]);
|
|
22912
|
+
|
|
22913
|
+
this.arc(center[0], center[1], radius, startAngle, endAngle);
|
|
22914
|
+
};
|
|
22915
|
+
|
|
22916
|
+
/**
|
|
22917
|
+
* adds an elliptical arc to the path which is centered at (x, y) position with the radii radiusX and radiusY
|
|
22918
|
+
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise.
|
|
22919
|
+
* @name ellipse
|
|
22920
|
+
* @memberof Path2D.prototype
|
|
22921
|
+
* @function
|
|
22922
|
+
* @param {number} x the x-axis (horizontal) coordinate of the ellipse's center.
|
|
22923
|
+
* @param {number} y the y-axis (vertical) coordinate of the ellipse's center.
|
|
22924
|
+
* @param {number} radiusX the ellipse's major-axis radius. Must be non-negative.
|
|
22925
|
+
* @param {number} radiusY the ellipse's minor-axis radius. Must be non-negative.
|
|
22926
|
+
* @param {number} rotation the rotation of the ellipse, expressed in radians.
|
|
22927
|
+
* @param {number} startAngle the angle at which the ellipse starts, measured clockwise from the positive x-axis and expressed in radians.
|
|
22928
|
+
* @param {number} endAngle the angle at which the ellipse ends, measured clockwise from the positive x-axis and expressed in radians.
|
|
22929
|
+
* @param {boolean} [anticlockwise=false] an optional boolean value which, if true, draws the ellipse counterclockwise (anticlockwise).
|
|
22930
|
+
*/
|
|
22931
|
+
Path2D$1.prototype.ellipse = function ellipse (x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
22932
|
+
if ( anticlockwise === void 0 ) anticlockwise = false;
|
|
22933
|
+
|
|
22934
|
+
var points = this.points;
|
|
22935
|
+
// based on from https://github.com/karellodewijk/canvas-webgl/blob/master/canvas-webgl.js
|
|
22936
|
+
if (startAngle === endAngle) { return; }
|
|
22937
|
+
var fullCircle = anticlockwise ? Math.abs(startAngle-endAngle) >= (TAU) : Math.abs(endAngle-startAngle) >= (TAU);
|
|
22938
|
+
|
|
22939
|
+
//bring angles all in [0, 2*PI] range
|
|
22940
|
+
startAngle = startAngle % (TAU);
|
|
22941
|
+
endAngle = endAngle % (TAU);
|
|
22942
|
+
if (startAngle < 0) { startAngle += TAU; }
|
|
22943
|
+
if (endAngle < 0) { endAngle += TAU; }
|
|
22944
|
+
|
|
22945
|
+
if (startAngle>=endAngle) {
|
|
22946
|
+
endAngle += TAU;
|
|
22947
|
+
}
|
|
22948
|
+
|
|
22949
|
+
var diff = endAngle - startAngle;
|
|
22950
|
+
|
|
22951
|
+
var direction = 1;
|
|
22952
|
+
if (anticlockwise) {
|
|
22953
|
+
direction = -1;
|
|
22954
|
+
diff = TAU - diff;
|
|
22955
|
+
}
|
|
22956
|
+
|
|
22957
|
+
if (fullCircle) { diff = TAU; }
|
|
22958
|
+
|
|
22959
|
+
var length = (diff * radiusX + diff * radiusY) / 2;
|
|
22960
|
+
var nr_of_interpolation_points = length / this.arcResolution;
|
|
22961
|
+
var dangle = diff / nr_of_interpolation_points;
|
|
22962
|
+
|
|
22963
|
+
var angle = startAngle;
|
|
22964
|
+
var cos_rotation = Math.cos(rotation);
|
|
22965
|
+
var sin_rotation = Math.sin(rotation);
|
|
22966
|
+
for (var j = 0; j < nr_of_interpolation_points; j++) {
|
|
22967
|
+
var _x1 = radiusX * Math.cos(angle);
|
|
22968
|
+
var _y1 = radiusY * Math.sin(angle);
|
|
22969
|
+
var _x2 = x + _x1 * cos_rotation - _y1 * sin_rotation;
|
|
22970
|
+
var _y2 = y + _x1 * sin_rotation + _y1 * cos_rotation;
|
|
22971
|
+
points.push(pool$1.pull("Vector2d", _x2, _y2));
|
|
22972
|
+
angle += direction * dangle;
|
|
22973
|
+
}
|
|
22974
|
+
//var x1 = radiusX * Math.cos(endAngle);
|
|
22975
|
+
//var y1 = radiusY * Math.sin(endAngle);
|
|
22976
|
+
//points.push(pool.pull("Vector2d", x + x1 * cos_rotation - y1 * sin_rotation, y + x1 * sin_rotation + y1 * cos_rotation));
|
|
22977
|
+
};
|
|
22978
|
+
|
|
22979
|
+
/**
|
|
22980
|
+
* creates a path for a rectangle at position (x, y) with a size that is determined by width and height.
|
|
22981
|
+
* @name rect
|
|
22982
|
+
* @memberof Path2D.prototype
|
|
22983
|
+
* @function
|
|
22984
|
+
* @param {number} x the x-axis coordinate of the rectangle's starting point.
|
|
22985
|
+
* @param {number} y the y-axis coordinate of the rectangle's starting point.
|
|
22986
|
+
* @param {number} width the rectangle's width. Positive values are to the right, and negative to the left.
|
|
22987
|
+
* @param {number} height the rectangle's height. Positive values are down, and negative are up.
|
|
22988
|
+
*/
|
|
22989
|
+
Path2D$1.prototype.rect = function rect (x, y, width, height) {
|
|
22990
|
+
this.moveTo(x, y);
|
|
22991
|
+
this.lineTo(x + width, y);
|
|
22992
|
+
this.lineTo(x + width, y + height);
|
|
22993
|
+
this.lineTo(x, y + height);
|
|
22994
|
+
this.lineTo(x, y);
|
|
22995
|
+
};
|
|
22996
|
+
|
|
22997
|
+
/**
|
|
22998
|
+
* adds an rounded rectangle to the current path.
|
|
22999
|
+
* @name roundRect
|
|
23000
|
+
* @memberof Path2D.prototype
|
|
23001
|
+
* @function
|
|
23002
|
+
* @param {number} x the x-axis coordinate of the rectangle's starting point.
|
|
23003
|
+
* @param {number} y the y-axis coordinate of the rectangle's starting point.
|
|
23004
|
+
* @param {number} width the rectangle's width. Positive values are to the right, and negative to the left.
|
|
23005
|
+
* @param {number} height the rectangle's height. Positive values are down, and negative are up.
|
|
23006
|
+
* @param {number} radius the arc's radius to draw the borders. Must be positive.
|
|
23007
|
+
*/
|
|
23008
|
+
Path2D$1.prototype.roundRect = function roundRect (x, y, width, height, radius) {
|
|
23009
|
+
this.moveTo(x + radius, y);
|
|
23010
|
+
this.lineTo(x + width - radius, y);
|
|
23011
|
+
this.arcTo(x + width, y, x + width, y + radius, radius);
|
|
23012
|
+
this.lineTo(x + width, y + height - radius);
|
|
23013
|
+
this.arcTo(x + width, y + height, x + width - radius, y + height, radius);
|
|
23014
|
+
this.lineTo(x + radius, y + height);
|
|
23015
|
+
this.arcTo(x, y + height, x, y + height - radius, radius);
|
|
23016
|
+
this.lineTo(x, y + radius);
|
|
23017
|
+
this.arcTo(x, y, x + radius, y, radius);
|
|
23018
|
+
};
|
|
23019
|
+
|
|
22520
23020
|
/**
|
|
22521
23021
|
* @classdesc
|
|
22522
23022
|
* a base renderer object
|
|
@@ -22534,12 +23034,20 @@
|
|
|
22534
23034
|
/**
|
|
22535
23035
|
* true if the current rendering context is valid
|
|
22536
23036
|
* @name isContextValid
|
|
22537
|
-
* @memberof Renderer
|
|
23037
|
+
* @memberof Renderer#
|
|
22538
23038
|
* @default true
|
|
22539
23039
|
* type {boolean}
|
|
22540
23040
|
*/
|
|
22541
23041
|
this.isContextValid = true;
|
|
22542
23042
|
|
|
23043
|
+
/**
|
|
23044
|
+
* The Path2D instance used by the renderer to draw primitives
|
|
23045
|
+
* @name path2D
|
|
23046
|
+
* @type {Path2D}
|
|
23047
|
+
* @memberof Renderer#
|
|
23048
|
+
*/
|
|
23049
|
+
this.path2D = new Path2D$1();
|
|
23050
|
+
|
|
22543
23051
|
/**
|
|
22544
23052
|
* @ignore
|
|
22545
23053
|
*/
|
|
@@ -22822,15 +23330,23 @@
|
|
|
22822
23330
|
* @name stroke
|
|
22823
23331
|
* @memberof Renderer.prototype
|
|
22824
23332
|
* @function
|
|
22825
|
-
* @param {Rect|Polygon|Line|Ellipse} shape a shape object to stroke
|
|
23333
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to stroke
|
|
22826
23334
|
* @param {boolean} [fill=false] fill the shape with the current color if true
|
|
22827
23335
|
*/
|
|
22828
23336
|
Renderer.prototype.stroke = function stroke (shape, fill) {
|
|
22829
23337
|
if (shape instanceof Rect || shape instanceof Bounds$1) {
|
|
22830
23338
|
this.strokeRect(shape.left, shape.top, shape.width, shape.height, fill);
|
|
22831
|
-
|
|
23339
|
+
return;
|
|
23340
|
+
}
|
|
23341
|
+
if (shape instanceof Line || shape instanceof Polygon) {
|
|
22832
23342
|
this.strokePolygon(shape, fill);
|
|
22833
|
-
|
|
23343
|
+
return;
|
|
23344
|
+
}
|
|
23345
|
+
if (shape instanceof RoundRect) {
|
|
23346
|
+
this.strokeRoundRect(shape.left, shape.top, shape.width, shape.height, shape.radius, fill);
|
|
23347
|
+
return;
|
|
23348
|
+
}
|
|
23349
|
+
if (shape instanceof Ellipse) {
|
|
22834
23350
|
this.strokeEllipse(
|
|
22835
23351
|
shape.pos.x,
|
|
22836
23352
|
shape.pos.y,
|
|
@@ -22838,7 +23354,20 @@
|
|
|
22838
23354
|
shape.radiusV.y,
|
|
22839
23355
|
fill
|
|
22840
23356
|
);
|
|
23357
|
+
return;
|
|
22841
23358
|
}
|
|
23359
|
+
throw new Error("Invalid geometry for fill/stroke");
|
|
23360
|
+
};
|
|
23361
|
+
|
|
23362
|
+
/**
|
|
23363
|
+
* fill the given shape
|
|
23364
|
+
* @name fill
|
|
23365
|
+
* @memberof Renderer.prototype
|
|
23366
|
+
* @function
|
|
23367
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to fill
|
|
23368
|
+
*/
|
|
23369
|
+
Renderer.prototype.fill = function fill (shape) {
|
|
23370
|
+
this.stroke(shape, true);
|
|
22842
23371
|
};
|
|
22843
23372
|
|
|
22844
23373
|
/**
|
|
@@ -22870,17 +23399,6 @@
|
|
|
22870
23399
|
return canvas;
|
|
22871
23400
|
};
|
|
22872
23401
|
|
|
22873
|
-
/**
|
|
22874
|
-
* fill the given shape
|
|
22875
|
-
* @name fill
|
|
22876
|
-
* @memberof Renderer.prototype
|
|
22877
|
-
* @function
|
|
22878
|
-
* @param {Rect|Polygon|Line|Ellipse} shape a shape object to fill
|
|
22879
|
-
*/
|
|
22880
|
-
Renderer.prototype.fill = function fill (shape) {
|
|
22881
|
-
this.stroke(shape, true);
|
|
22882
|
-
};
|
|
22883
|
-
|
|
22884
23402
|
/**
|
|
22885
23403
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
22886
23404
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
@@ -22888,7 +23406,7 @@
|
|
|
22888
23406
|
* @name setMask
|
|
22889
23407
|
* @memberof Renderer.prototype
|
|
22890
23408
|
* @function
|
|
22891
|
-
* @param {Rect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
23409
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
22892
23410
|
*/
|
|
22893
23411
|
// eslint-disable-next-line no-unused-vars
|
|
22894
23412
|
Renderer.prototype.setMask = function setMask (mask) {};
|
|
@@ -22983,7 +23501,6 @@
|
|
|
22983
23501
|
this.getScreenCanvas().addEventListener("contextrestored", function () {
|
|
22984
23502
|
this$1$1.isContextValid = true;
|
|
22985
23503
|
event.emit(event.ONCONTEXT_RESTORED, this$1$1);
|
|
22986
|
-
me.game.repaint();
|
|
22987
23504
|
}, false );
|
|
22988
23505
|
}
|
|
22989
23506
|
|
|
@@ -23116,7 +23633,7 @@
|
|
|
23116
23633
|
* @param {number} height The rectangle's height.
|
|
23117
23634
|
*/
|
|
23118
23635
|
CanvasRenderer.prototype.clearRect = function clearRect (x, y, width, height) {
|
|
23119
|
-
this.
|
|
23636
|
+
this.getContext().clearRect(x, y, width, height);
|
|
23120
23637
|
};
|
|
23121
23638
|
|
|
23122
23639
|
/**
|
|
@@ -23135,7 +23652,7 @@
|
|
|
23135
23652
|
* var basic = renderer.createPattern(image, "no-repeat");
|
|
23136
23653
|
*/
|
|
23137
23654
|
CanvasRenderer.prototype.createPattern = function createPattern (image, repeat) {
|
|
23138
|
-
return this.
|
|
23655
|
+
return this.getContext().createPattern(image, repeat);
|
|
23139
23656
|
};
|
|
23140
23657
|
|
|
23141
23658
|
/**
|
|
@@ -23161,10 +23678,11 @@
|
|
|
23161
23678
|
* renderer.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
|
|
23162
23679
|
*/
|
|
23163
23680
|
CanvasRenderer.prototype.drawImage = function drawImage (image, sx, sy, sw, sh, dx, dy, dw, dh) {
|
|
23164
|
-
if (this.
|
|
23681
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23165
23682
|
// Fast path: don't draw fully transparent
|
|
23166
23683
|
return;
|
|
23167
23684
|
}
|
|
23685
|
+
var context = this.getContext();
|
|
23168
23686
|
|
|
23169
23687
|
if (typeof sw === "undefined") {
|
|
23170
23688
|
sw = dw = image.width;
|
|
@@ -23198,7 +23716,7 @@
|
|
|
23198
23716
|
// get a tinted version of this image from the texture cache
|
|
23199
23717
|
source = this.cache.tint(image, this.currentTint.toRGB());
|
|
23200
23718
|
}
|
|
23201
|
-
|
|
23719
|
+
context.drawImage(source, sx, sy, sw, sh, dx, dy, dw, dh);
|
|
23202
23720
|
};
|
|
23203
23721
|
|
|
23204
23722
|
/**
|
|
@@ -23214,14 +23732,15 @@
|
|
|
23214
23732
|
* @see CanvasRenderer#createPattern
|
|
23215
23733
|
*/
|
|
23216
23734
|
CanvasRenderer.prototype.drawPattern = function drawPattern (pattern, x, y, width, height) {
|
|
23217
|
-
if (this.
|
|
23735
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23218
23736
|
// Fast path: don't draw fully transparent
|
|
23219
23737
|
return;
|
|
23220
23738
|
}
|
|
23221
|
-
var
|
|
23222
|
-
|
|
23223
|
-
|
|
23224
|
-
|
|
23739
|
+
var context = this.getContext();
|
|
23740
|
+
var fillStyle = context.fillStyle;
|
|
23741
|
+
context.fillStyle = pattern;
|
|
23742
|
+
context.fillRect(x, y, width, height);
|
|
23743
|
+
context.fillStyle = fillStyle;
|
|
23225
23744
|
};
|
|
23226
23745
|
|
|
23227
23746
|
/**
|
|
@@ -23240,12 +23759,12 @@
|
|
|
23240
23759
|
CanvasRenderer.prototype.strokeArc = function strokeArc (x, y, radius, start, end, antiClockwise, fill) {
|
|
23241
23760
|
if ( fill === void 0 ) fill = false;
|
|
23242
23761
|
|
|
23243
|
-
|
|
23244
|
-
|
|
23245
|
-
if (context.globalAlpha < 1 / 255) {
|
|
23762
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23246
23763
|
// Fast path: don't draw fully transparent
|
|
23247
23764
|
return;
|
|
23248
23765
|
}
|
|
23766
|
+
var context = this.getContext();
|
|
23767
|
+
|
|
23249
23768
|
context.translate(x, y);
|
|
23250
23769
|
context.beginPath();
|
|
23251
23770
|
context.arc(0, 0, radius, start, end, antiClockwise || false);
|
|
@@ -23283,12 +23802,11 @@
|
|
|
23283
23802
|
CanvasRenderer.prototype.strokeEllipse = function strokeEllipse (x, y, w, h, fill) {
|
|
23284
23803
|
if ( fill === void 0 ) fill = false;
|
|
23285
23804
|
|
|
23286
|
-
|
|
23287
|
-
|
|
23288
|
-
if (context.globalAlpha < 1 / 255) {
|
|
23805
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23289
23806
|
// Fast path: don't draw fully transparent
|
|
23290
23807
|
return;
|
|
23291
23808
|
}
|
|
23809
|
+
var context = this.getContext();
|
|
23292
23810
|
|
|
23293
23811
|
var hw = w,
|
|
23294
23812
|
hh = h,
|
|
@@ -23339,9 +23857,7 @@
|
|
|
23339
23857
|
* @param {number} endY the end y coordinate
|
|
23340
23858
|
*/
|
|
23341
23859
|
CanvasRenderer.prototype.strokeLine = function strokeLine (startX, startY, endX, endY) {
|
|
23342
|
-
|
|
23343
|
-
|
|
23344
|
-
if (context < 1 / 255) {
|
|
23860
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23345
23861
|
// Fast path: don't draw fully transparent
|
|
23346
23862
|
return;
|
|
23347
23863
|
}
|
|
@@ -23377,12 +23893,11 @@
|
|
|
23377
23893
|
CanvasRenderer.prototype.strokePolygon = function strokePolygon (poly, fill) {
|
|
23378
23894
|
if ( fill === void 0 ) fill = false;
|
|
23379
23895
|
|
|
23380
|
-
|
|
23381
|
-
|
|
23382
|
-
if (context.globalAlpha < 1 / 255) {
|
|
23896
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23383
23897
|
// Fast path: don't draw fully transparent
|
|
23384
23898
|
return;
|
|
23385
23899
|
}
|
|
23900
|
+
var context = this.getContext();
|
|
23386
23901
|
|
|
23387
23902
|
this.translate(poly.pos.x, poly.pos.y);
|
|
23388
23903
|
context.beginPath();
|
|
@@ -23423,15 +23938,13 @@
|
|
|
23423
23938
|
CanvasRenderer.prototype.strokeRect = function strokeRect (x, y, width, height, fill) {
|
|
23424
23939
|
if ( fill === void 0 ) fill = false;
|
|
23425
23940
|
|
|
23426
|
-
if (
|
|
23427
|
-
|
|
23428
|
-
|
|
23429
|
-
if (this.backBufferContext2D.globalAlpha < 1 / 255) {
|
|
23430
|
-
// Fast path: don't draw fully transparent
|
|
23431
|
-
return;
|
|
23432
|
-
}
|
|
23433
|
-
this.backBufferContext2D.strokeRect(x, y, width, height);
|
|
23941
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23942
|
+
// Fast path: don't draw fully transparent
|
|
23943
|
+
return;
|
|
23434
23944
|
}
|
|
23945
|
+
var context = this.getContext();
|
|
23946
|
+
|
|
23947
|
+
context[fill === true ? "fillRect" : "strokeRect"](x, y, width, height);
|
|
23435
23948
|
};
|
|
23436
23949
|
|
|
23437
23950
|
/**
|
|
@@ -23445,11 +23958,48 @@
|
|
|
23445
23958
|
* @param {number} height
|
|
23446
23959
|
*/
|
|
23447
23960
|
CanvasRenderer.prototype.fillRect = function fillRect (x, y, width, height) {
|
|
23448
|
-
|
|
23961
|
+
this.strokeRect(x, y, width, height, true);
|
|
23962
|
+
};
|
|
23963
|
+
|
|
23964
|
+
/**
|
|
23965
|
+
* Stroke a rounded rectangle at the specified coordinates
|
|
23966
|
+
* @name strokeRoundRect
|
|
23967
|
+
* @memberof CanvasRenderer.prototype
|
|
23968
|
+
* @function
|
|
23969
|
+
* @param {number} x
|
|
23970
|
+
* @param {number} y
|
|
23971
|
+
* @param {number} width
|
|
23972
|
+
* @param {number} height
|
|
23973
|
+
* @param {number} radius
|
|
23974
|
+
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
23975
|
+
*/
|
|
23976
|
+
CanvasRenderer.prototype.strokeRoundRect = function strokeRoundRect (x, y, width, height, radius, fill) {
|
|
23977
|
+
if ( fill === void 0 ) fill = false;
|
|
23978
|
+
|
|
23979
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23449
23980
|
// Fast path: don't draw fully transparent
|
|
23450
23981
|
return;
|
|
23451
23982
|
}
|
|
23452
|
-
this.
|
|
23983
|
+
var context = this.getContext();
|
|
23984
|
+
|
|
23985
|
+
context.beginPath();
|
|
23986
|
+
context.roundRect(x, y, width, height, radius);
|
|
23987
|
+
context[fill === true ? "fill" : "stroke"]();
|
|
23988
|
+
};
|
|
23989
|
+
|
|
23990
|
+
/**
|
|
23991
|
+
* Draw a rounded filled rectangle at the specified coordinates
|
|
23992
|
+
* @name fillRoundRect
|
|
23993
|
+
* @memberof CanvasRenderer.prototype
|
|
23994
|
+
* @function
|
|
23995
|
+
* @param {number} x
|
|
23996
|
+
* @param {number} y
|
|
23997
|
+
* @param {number} width
|
|
23998
|
+
* @param {number} height
|
|
23999
|
+
* @param {number} radius
|
|
24000
|
+
*/
|
|
24001
|
+
CanvasRenderer.prototype.fillRoundRect = function fillRoundRect (x, y, width, height, radius) {
|
|
24002
|
+
this.strokeRoundRect(x, y, width, height, radius, true);
|
|
23453
24003
|
};
|
|
23454
24004
|
|
|
23455
24005
|
|
|
@@ -23491,7 +24041,7 @@
|
|
|
23491
24041
|
*/
|
|
23492
24042
|
CanvasRenderer.prototype.restore = function restore () {
|
|
23493
24043
|
this.backBufferContext2D.restore();
|
|
23494
|
-
this.currentColor.glArray[3] = this.
|
|
24044
|
+
this.currentColor.glArray[3] = this.getGlobalAlpha();
|
|
23495
24045
|
this.currentScissor[0] = 0;
|
|
23496
24046
|
this.currentScissor[1] = 0;
|
|
23497
24047
|
this.currentScissor[2] = this.backBufferCanvas.width;
|
|
@@ -23539,7 +24089,7 @@
|
|
|
23539
24089
|
};
|
|
23540
24090
|
|
|
23541
24091
|
/**
|
|
23542
|
-
* Set the global alpha
|
|
24092
|
+
* Set the global alpha
|
|
23543
24093
|
* @name setGlobalAlpha
|
|
23544
24094
|
* @memberof CanvasRenderer.prototype
|
|
23545
24095
|
* @function
|
|
@@ -23549,6 +24099,17 @@
|
|
|
23549
24099
|
this.backBufferContext2D.globalAlpha = this.currentColor.glArray[3] = alpha;
|
|
23550
24100
|
};
|
|
23551
24101
|
|
|
24102
|
+
/**
|
|
24103
|
+
* Return the global alpha
|
|
24104
|
+
* @name getGlobalAlpha
|
|
24105
|
+
* @memberof CanvasRenderer.prototype
|
|
24106
|
+
* @function
|
|
24107
|
+
* @returns {number} global alpha value
|
|
24108
|
+
*/
|
|
24109
|
+
CanvasRenderer.prototype.getGlobalAlpha = function getGlobalAlpha () {
|
|
24110
|
+
return this.backBufferContext2D.globalAlpha;
|
|
24111
|
+
};
|
|
24112
|
+
|
|
23552
24113
|
/**
|
|
23553
24114
|
* Set the line width on the context
|
|
23554
24115
|
* @name setLineWidth
|
|
@@ -23655,14 +24216,16 @@
|
|
|
23655
24216
|
* @name setMask
|
|
23656
24217
|
* @memberof CanvasRenderer.prototype
|
|
23657
24218
|
* @function
|
|
23658
|
-
* @param {Rect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
24219
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
23659
24220
|
*/
|
|
23660
24221
|
CanvasRenderer.prototype.setMask = function setMask (mask) {
|
|
23661
|
-
var context = this.
|
|
24222
|
+
var context = this.getContext();
|
|
23662
24223
|
var _x = mask.pos.x, _y = mask.pos.y;
|
|
23663
24224
|
|
|
23664
24225
|
context.save();
|
|
23665
24226
|
|
|
24227
|
+
context.beginPath();
|
|
24228
|
+
|
|
23666
24229
|
// https://github.com/melonjs/melonJS/issues/648
|
|
23667
24230
|
if (mask instanceof Ellipse) {
|
|
23668
24231
|
var hw = mask.radiusV.x,
|
|
@@ -23679,14 +24242,14 @@
|
|
|
23679
24242
|
ymin = _y - ymagic,
|
|
23680
24243
|
ymax = _y + ymagic;
|
|
23681
24244
|
|
|
23682
|
-
context.beginPath();
|
|
23683
24245
|
context.moveTo(_x, ty);
|
|
23684
24246
|
context.bezierCurveTo(xmax, ty, rx, ymin, rx, _y);
|
|
23685
24247
|
context.bezierCurveTo(rx, ymax, xmax, by, _x, by);
|
|
23686
24248
|
context.bezierCurveTo(xmin, by, lx, ymax, lx, _y);
|
|
23687
24249
|
context.bezierCurveTo(lx, ymin, xmin, ty, _x, ty);
|
|
24250
|
+
} else if (mask instanceof RoundRect) {
|
|
24251
|
+
context.roundRect(_x, _y, mask.width, mask.height, mask.radius);
|
|
23688
24252
|
} else {
|
|
23689
|
-
context.beginPath();
|
|
23690
24253
|
context.moveTo(_x + mask.points[0].x, _y + mask.points[0].y);
|
|
23691
24254
|
var point;
|
|
23692
24255
|
for (var i = 1; i < mask.points.length; i++) {
|
|
@@ -23706,7 +24269,7 @@
|
|
|
23706
24269
|
* @function
|
|
23707
24270
|
*/
|
|
23708
24271
|
CanvasRenderer.prototype.clearMask = function clearMask () {
|
|
23709
|
-
this.
|
|
24272
|
+
this.getContext().restore();
|
|
23710
24273
|
};
|
|
23711
24274
|
|
|
23712
24275
|
return CanvasRenderer;
|
|
@@ -24001,9 +24564,9 @@
|
|
|
24001
24564
|
var tile = null;
|
|
24002
24565
|
|
|
24003
24566
|
if (this.contains(x, y)) {
|
|
24004
|
-
var coord = this.getRenderer().pixelToTileCoords(x, y, pull("Vector2d"));
|
|
24567
|
+
var coord = this.getRenderer().pixelToTileCoords(x, y, pool$1.pull("Vector2d"));
|
|
24005
24568
|
tile = this.cellAt(coord.x, coord.y);
|
|
24006
|
-
push(coord);
|
|
24569
|
+
pool$1.push(coord);
|
|
24007
24570
|
}
|
|
24008
24571
|
return tile;
|
|
24009
24572
|
};
|
|
@@ -24143,6 +24706,8 @@
|
|
|
24143
24706
|
* a bound object contains methods for creating and manipulating axis-aligned bounding boxes (AABB).
|
|
24144
24707
|
*/
|
|
24145
24708
|
var Bounds = function Bounds(vertices) {
|
|
24709
|
+
// @ignore
|
|
24710
|
+
this._center = new Vector2d();
|
|
24146
24711
|
this.onResetEvent(vertices);
|
|
24147
24712
|
};
|
|
24148
24713
|
|
|
@@ -24161,9 +24726,6 @@
|
|
|
24161
24726
|
if (typeof vertices !== "undefined") {
|
|
24162
24727
|
this.update(vertices);
|
|
24163
24728
|
}
|
|
24164
|
-
|
|
24165
|
-
// @ignore
|
|
24166
|
-
this._center = new Vector2d();
|
|
24167
24729
|
};
|
|
24168
24730
|
|
|
24169
24731
|
/**
|
|
@@ -24589,11 +25151,11 @@
|
|
|
24589
25151
|
* @returns {Polygon} a new Polygon that represents this bounds.
|
|
24590
25152
|
*/
|
|
24591
25153
|
Bounds.prototype.toPolygon = function toPolygon () {
|
|
24592
|
-
return
|
|
24593
|
-
|
|
24594
|
-
|
|
24595
|
-
|
|
24596
|
-
|
|
25154
|
+
return pool$1.pull("Polygon", this.x, this.y, [
|
|
25155
|
+
pool$1.pull("Vector2d", 0, 0),
|
|
25156
|
+
pool$1.pull("Vector2d", this.width, 0),
|
|
25157
|
+
pool$1.pull("Vector2d", this.width, this.height),
|
|
25158
|
+
pool$1.pull("Vector2d", 0, this.height)
|
|
24597
25159
|
]);
|
|
24598
25160
|
};
|
|
24599
25161
|
|
|
@@ -24643,7 +25205,7 @@
|
|
|
24643
25205
|
* @returns {Bounds}
|
|
24644
25206
|
*/
|
|
24645
25207
|
TMXRenderer.prototype.getBounds = function getBounds (layer) {
|
|
24646
|
-
var bounds = layer instanceof TMXLayer ? pull("Bounds") : this.bounds;
|
|
25208
|
+
var bounds = layer instanceof TMXLayer ? pool$1.pull("Bounds") : this.bounds;
|
|
24647
25209
|
bounds.setMinMax(
|
|
24648
25210
|
0, 0,
|
|
24649
25211
|
this.cols * this.tilewidth,
|
|
@@ -24801,13 +25363,13 @@
|
|
|
24801
25363
|
var start = this.pixelToTileCoords(
|
|
24802
25364
|
Math.max(rect.pos.x - (layer.maxTileSize.width - layer.tilewidth), 0),
|
|
24803
25365
|
Math.max(rect.pos.y - (layer.maxTileSize.height - layer.tileheight), 0),
|
|
24804
|
-
pull("Vector2d")
|
|
25366
|
+
pool$1.pull("Vector2d")
|
|
24805
25367
|
).floorSelf();
|
|
24806
25368
|
|
|
24807
25369
|
var end = this.pixelToTileCoords(
|
|
24808
25370
|
rect.pos.x + rect.width + this.tilewidth,
|
|
24809
25371
|
rect.pos.y + rect.height + this.tileheight,
|
|
24810
|
-
pull("Vector2d")
|
|
25372
|
+
pool$1.pull("Vector2d")
|
|
24811
25373
|
).ceilSelf();
|
|
24812
25374
|
|
|
24813
25375
|
//ensure we are in the valid tile range
|
|
@@ -24845,8 +25407,8 @@
|
|
|
24845
25407
|
}
|
|
24846
25408
|
}
|
|
24847
25409
|
|
|
24848
|
-
push(start);
|
|
24849
|
-
push(end);
|
|
25410
|
+
pool$1.push(start);
|
|
25411
|
+
pool$1.push(end);
|
|
24850
25412
|
};
|
|
24851
25413
|
|
|
24852
25414
|
return TMXOrthogonalRenderer;
|
|
@@ -24895,7 +25457,7 @@
|
|
|
24895
25457
|
* @returns {Bounds}
|
|
24896
25458
|
*/
|
|
24897
25459
|
TMXIsometricRenderer.prototype.getBounds = function getBounds (layer) {
|
|
24898
|
-
var bounds = layer instanceof TMXLayer ? pull("Bounds") : this.bounds;
|
|
25460
|
+
var bounds = layer instanceof TMXLayer ? pool$1.pull("Bounds") : this.bounds;
|
|
24899
25461
|
bounds.setMinMax(
|
|
24900
25462
|
0, 0,
|
|
24901
25463
|
(this.cols + this.rows) * (this.tilewidth / 2),
|
|
@@ -24936,14 +25498,14 @@
|
|
|
24936
25498
|
TMXIsometricRenderer.prototype.adjustPosition = function adjustPosition (obj) {
|
|
24937
25499
|
var tileX = obj.x / this.hTilewidth;
|
|
24938
25500
|
var tileY = obj.y / this.tileheight;
|
|
24939
|
-
var isoPos = pull("Vector2d");
|
|
25501
|
+
var isoPos = pool$1.pull("Vector2d");
|
|
24940
25502
|
|
|
24941
25503
|
this.tileToPixelCoords(tileX, tileY, isoPos);
|
|
24942
25504
|
|
|
24943
25505
|
obj.x = isoPos.x;
|
|
24944
25506
|
obj.y = isoPos.y;
|
|
24945
25507
|
|
|
24946
|
-
push(isoPos);
|
|
25508
|
+
pool$1.push(isoPos);
|
|
24947
25509
|
};
|
|
24948
25510
|
|
|
24949
25511
|
/**
|
|
@@ -24973,18 +25535,18 @@
|
|
|
24973
25535
|
var rowItr = this.pixelToTileCoords(
|
|
24974
25536
|
rect.pos.x - tileset.tilewidth,
|
|
24975
25537
|
rect.pos.y - tileset.tileheight,
|
|
24976
|
-
pull("Vector2d")
|
|
25538
|
+
pool$1.pull("Vector2d")
|
|
24977
25539
|
).floorSelf();
|
|
24978
25540
|
var tileEnd = this.pixelToTileCoords(
|
|
24979
25541
|
rect.pos.x + rect.width + tileset.tilewidth,
|
|
24980
25542
|
rect.pos.y + rect.height + tileset.tileheight,
|
|
24981
|
-
pull("Vector2d")
|
|
25543
|
+
pool$1.pull("Vector2d")
|
|
24982
25544
|
).ceilSelf();
|
|
24983
25545
|
|
|
24984
|
-
var rectEnd = this.tileToPixelCoords(tileEnd.x, tileEnd.y, pull("Vector2d"));
|
|
25546
|
+
var rectEnd = this.tileToPixelCoords(tileEnd.x, tileEnd.y, pool$1.pull("Vector2d"));
|
|
24985
25547
|
|
|
24986
25548
|
// Determine the tile and pixel coordinates to start at
|
|
24987
|
-
var startPos = this.tileToPixelCoords(rowItr.x, rowItr.y, pull("Vector2d"));
|
|
25549
|
+
var startPos = this.tileToPixelCoords(rowItr.x, rowItr.y, pool$1.pull("Vector2d"));
|
|
24988
25550
|
startPos.x -= this.hTilewidth;
|
|
24989
25551
|
startPos.y += this.tileheight;
|
|
24990
25552
|
|
|
@@ -25051,11 +25613,11 @@
|
|
|
25051
25613
|
}
|
|
25052
25614
|
}
|
|
25053
25615
|
|
|
25054
|
-
push(columnItr);
|
|
25055
|
-
push(rowItr);
|
|
25056
|
-
push(tileEnd);
|
|
25057
|
-
push(rectEnd);
|
|
25058
|
-
push(startPos);
|
|
25616
|
+
pool$1.push(columnItr);
|
|
25617
|
+
pool$1.push(rowItr);
|
|
25618
|
+
pool$1.push(tileEnd);
|
|
25619
|
+
pool$1.push(rectEnd);
|
|
25620
|
+
pool$1.push(startPos);
|
|
25059
25621
|
};
|
|
25060
25622
|
|
|
25061
25623
|
return TMXIsometricRenderer;
|
|
@@ -25143,7 +25705,7 @@
|
|
|
25143
25705
|
* @returns {Bounds}
|
|
25144
25706
|
*/
|
|
25145
25707
|
TMXHexagonalRenderer.prototype.getBounds = function getBounds (layer) {
|
|
25146
|
-
var bounds = layer instanceof TMXLayer ? pull("Bounds") : this.bounds;
|
|
25708
|
+
var bounds = layer instanceof TMXLayer ? pool$1.pull("Bounds") : this.bounds;
|
|
25147
25709
|
|
|
25148
25710
|
// The map size is the same regardless of which indexes are shifted.
|
|
25149
25711
|
if (this.staggerX) {
|
|
@@ -25294,13 +25856,13 @@
|
|
|
25294
25856
|
}
|
|
25295
25857
|
|
|
25296
25858
|
// Start with the coordinates of a grid-aligned tile
|
|
25297
|
-
var referencePoint = pull("Vector2d",
|
|
25859
|
+
var referencePoint = pool$1.pull("Vector2d",
|
|
25298
25860
|
Math.floor(x / (this.columnwidth * 2)),
|
|
25299
25861
|
Math.floor((y / (this.rowheight * 2)))
|
|
25300
25862
|
);
|
|
25301
25863
|
|
|
25302
25864
|
// Relative x and y position on the base square of the grid-aligned tile
|
|
25303
|
-
var rel = pull("Vector2d",
|
|
25865
|
+
var rel = pool$1.pull("Vector2d",
|
|
25304
25866
|
x - referencePoint.x * (this.columnwidth * 2),
|
|
25305
25867
|
y - referencePoint.y * (this.rowheight * 2)
|
|
25306
25868
|
);
|
|
@@ -25359,8 +25921,8 @@
|
|
|
25359
25921
|
referencePoint.y + offsets[nearest].y
|
|
25360
25922
|
);
|
|
25361
25923
|
|
|
25362
|
-
push(referencePoint);
|
|
25363
|
-
push(rel);
|
|
25924
|
+
pool$1.push(referencePoint);
|
|
25925
|
+
pool$1.push(rel);
|
|
25364
25926
|
|
|
25365
25927
|
return ret;
|
|
25366
25928
|
};
|
|
@@ -25411,7 +25973,7 @@
|
|
|
25411
25973
|
*/
|
|
25412
25974
|
TMXHexagonalRenderer.prototype.drawTile = function drawTile (renderer, x, y, tmxTile) {
|
|
25413
25975
|
var tileset = tmxTile.tileset;
|
|
25414
|
-
var point = this.tileToPixelCoords(x, y, pull("Vector2d"));
|
|
25976
|
+
var point = this.tileToPixelCoords(x, y, pool$1.pull("Vector2d"));
|
|
25415
25977
|
|
|
25416
25978
|
// draw the tile
|
|
25417
25979
|
tileset.drawTile(
|
|
@@ -25421,7 +25983,7 @@
|
|
|
25421
25983
|
tmxTile
|
|
25422
25984
|
);
|
|
25423
25985
|
|
|
25424
|
-
push(point);
|
|
25986
|
+
pool$1.push(point);
|
|
25425
25987
|
};
|
|
25426
25988
|
|
|
25427
25989
|
/**
|
|
@@ -25435,7 +25997,7 @@
|
|
|
25435
25997
|
var startTile = this.pixelToTileCoords(
|
|
25436
25998
|
rect.pos.x,
|
|
25437
25999
|
rect.pos.y,
|
|
25438
|
-
pull("Vector2d")
|
|
26000
|
+
pool$1.pull("Vector2d")
|
|
25439
26001
|
);
|
|
25440
26002
|
|
|
25441
26003
|
// Compensate for the layer position
|
|
@@ -25445,7 +26007,7 @@
|
|
|
25445
26007
|
var startPos = this.tileToPixelCoords(
|
|
25446
26008
|
startTile.x + layer.pos.x,
|
|
25447
26009
|
startTile.y + layer.pos.y,
|
|
25448
|
-
pull("Vector2d")
|
|
26010
|
+
pool$1.pull("Vector2d")
|
|
25449
26011
|
);
|
|
25450
26012
|
|
|
25451
26013
|
var rowTile = startTile.clone();
|
|
@@ -25508,8 +26070,8 @@
|
|
|
25508
26070
|
|
|
25509
26071
|
startPos.y += this.rowheight;
|
|
25510
26072
|
}
|
|
25511
|
-
push(rowTile);
|
|
25512
|
-
push(rowPos);
|
|
26073
|
+
pool$1.push(rowTile);
|
|
26074
|
+
pool$1.push(rowPos);
|
|
25513
26075
|
|
|
25514
26076
|
} else {
|
|
25515
26077
|
//ensure we are in the valid tile range
|
|
@@ -25545,12 +26107,12 @@
|
|
|
25545
26107
|
}
|
|
25546
26108
|
startPos.y += this.rowheight;
|
|
25547
26109
|
}
|
|
25548
|
-
push(rowTile);
|
|
25549
|
-
push(rowPos);
|
|
26110
|
+
pool$1.push(rowTile);
|
|
26111
|
+
pool$1.push(rowPos);
|
|
25550
26112
|
}
|
|
25551
26113
|
|
|
25552
|
-
push(startTile);
|
|
25553
|
-
push(startPos);
|
|
26114
|
+
pool$1.push(startTile);
|
|
26115
|
+
pool$1.push(startPos);
|
|
25554
26116
|
};
|
|
25555
26117
|
|
|
25556
26118
|
return TMXHexagonalRenderer;
|
|
@@ -25594,7 +26156,7 @@
|
|
|
25594
26156
|
}
|
|
25595
26157
|
|
|
25596
26158
|
// Start with the coordinates of a grid-aligned tile
|
|
25597
|
-
var referencePoint = pull("Vector2d",
|
|
26159
|
+
var referencePoint = pool$1.pull("Vector2d",
|
|
25598
26160
|
Math.floor(alignedX / this.tilewidth),
|
|
25599
26161
|
Math.floor(alignedY / this.tileheight)
|
|
25600
26162
|
);
|
|
@@ -25613,7 +26175,7 @@
|
|
|
25613
26175
|
}
|
|
25614
26176
|
|
|
25615
26177
|
// Relative x and y position on the base square of the grid-aligned tile
|
|
25616
|
-
var rel = pull("Vector2d",
|
|
26178
|
+
var rel = pool$1.pull("Vector2d",
|
|
25617
26179
|
alignedX - referencePoint.x * this.tilewidth,
|
|
25618
26180
|
alignedY - referencePoint.y * this.tileheight
|
|
25619
26181
|
);
|
|
@@ -25646,8 +26208,8 @@
|
|
|
25646
26208
|
|
|
25647
26209
|
ret.div(this.tilewidth / Math.sqrt(2)).rotate(degToRad(-45)).add(referencePoint);
|
|
25648
26210
|
|
|
25649
|
-
push(referencePoint);
|
|
25650
|
-
push(rel);
|
|
26211
|
+
pool$1.push(referencePoint);
|
|
26212
|
+
pool$1.push(rel);
|
|
25651
26213
|
|
|
25652
26214
|
return ret;
|
|
25653
26215
|
};
|
|
@@ -26267,7 +26829,7 @@
|
|
|
26267
26829
|
// add an ellipse shape
|
|
26268
26830
|
if (this.isEllipse === true) {
|
|
26269
26831
|
// ellipse coordinates are the center position, so set default to the corresonding radius
|
|
26270
|
-
shapes.push((
|
|
26832
|
+
shapes.push((pool$1.pull("Ellipse",
|
|
26271
26833
|
this.width / 2,
|
|
26272
26834
|
this.height / 2,
|
|
26273
26835
|
this.width,
|
|
@@ -26277,7 +26839,7 @@
|
|
|
26277
26839
|
|
|
26278
26840
|
// add a polygon
|
|
26279
26841
|
if (this.isPolygon === true) {
|
|
26280
|
-
var _polygon =
|
|
26842
|
+
var _polygon = pool$1.pull("Polygon", 0, 0, this.points);
|
|
26281
26843
|
// make sure it's a convex polygon
|
|
26282
26844
|
if (_polygon.isConvex() === false ) {
|
|
26283
26845
|
throw new Error("collision polygones in Tiled should be defined as Convex");
|
|
@@ -26293,22 +26855,22 @@
|
|
|
26293
26855
|
for (i = 0; i < segments; i++) {
|
|
26294
26856
|
// clone the value before, as [i + 1]
|
|
26295
26857
|
// is reused later by the next segment
|
|
26296
|
-
p1 =
|
|
26297
|
-
p2 =
|
|
26858
|
+
p1 = pool$1.pull("Vector2d", p[i].x, p[i].y);
|
|
26859
|
+
p2 = pool$1.pull("Vector2d", p[i + 1].x, p[i + 1].y);
|
|
26298
26860
|
if (this.rotation !== 0) {
|
|
26299
26861
|
p1 = p1.rotate(this.rotation);
|
|
26300
26862
|
p2 = p2.rotate(this.rotation);
|
|
26301
26863
|
}
|
|
26302
|
-
shapes.push(
|
|
26864
|
+
shapes.push(pool$1.pull("Line", 0, 0, [ p1, p2 ]));
|
|
26303
26865
|
}
|
|
26304
26866
|
}
|
|
26305
26867
|
|
|
26306
26868
|
// it's a rectangle, returns a polygon object anyway
|
|
26307
26869
|
else {
|
|
26308
|
-
shapes.push((
|
|
26870
|
+
shapes.push((pool$1.pull("Polygon",
|
|
26309
26871
|
0, 0, [
|
|
26310
|
-
|
|
26311
|
-
|
|
26872
|
+
pool$1.pull("Vector2d"), pool$1.pull("Vector2d", this.width, 0),
|
|
26873
|
+
pool$1.pull("Vector2d", this.width, this.height), pool$1.pull("Vector2d", 0, this.height)
|
|
26312
26874
|
]
|
|
26313
26875
|
)).rotate(this.rotation));
|
|
26314
26876
|
}
|
|
@@ -26500,16 +27062,16 @@
|
|
|
26500
27062
|
applyTMXProperties(data.properties, data);
|
|
26501
27063
|
|
|
26502
27064
|
// create the layer
|
|
26503
|
-
var imageLayer = pull("ImageLayer",
|
|
27065
|
+
var imageLayer = pool$1.pull("ImageLayer",
|
|
26504
27066
|
// x/y is deprecated since 0.15 and replace by offsetx/y
|
|
26505
27067
|
+data.offsetx || +data.x || 0,
|
|
26506
27068
|
+data.offsety || +data.y || 0,
|
|
26507
27069
|
Object.assign({
|
|
26508
27070
|
name: data.name,
|
|
26509
27071
|
image: data.image,
|
|
26510
|
-
ratio : pull("Vector2d", +data.parallaxx || 1.0, +data.parallaxy || 1.0),
|
|
27072
|
+
ratio : pool$1.pull("Vector2d", +data.parallaxx || 1.0, +data.parallaxy || 1.0),
|
|
26511
27073
|
// convert to melonJS color format (note: this should be done earlier when parsing data)
|
|
26512
|
-
tint : typeof (data.tintcolor) !== "undefined" ? (pull("Color")).parseHex(data.tintcolor, true) : undefined,
|
|
27074
|
+
tint : typeof (data.tintcolor) !== "undefined" ? (pool$1.pull("Color")).parseHex(data.tintcolor, true) : undefined,
|
|
26513
27075
|
z: z
|
|
26514
27076
|
}, data.properties)
|
|
26515
27077
|
);
|
|
@@ -26741,7 +27303,7 @@
|
|
|
26741
27303
|
if (this.background_image) {
|
|
26742
27304
|
// add a new image layer
|
|
26743
27305
|
this.layers.push(
|
|
26744
|
-
pull("ImageLayer",
|
|
27306
|
+
pool$1.pull("ImageLayer",
|
|
26745
27307
|
0, 0, {
|
|
26746
27308
|
name : "background_image",
|
|
26747
27309
|
image : this.background_image,
|
|
@@ -26901,6 +27463,8 @@
|
|
|
26901
27463
|
var settings = group.objects[o];
|
|
26902
27464
|
// reference to the instantiated object
|
|
26903
27465
|
var obj;
|
|
27466
|
+
// a reference to the default shape
|
|
27467
|
+
var shape;
|
|
26904
27468
|
|
|
26905
27469
|
// Tiled uses 0,0 by default
|
|
26906
27470
|
if (typeof (settings.anchorPoint) === "undefined") {
|
|
@@ -26908,7 +27472,7 @@
|
|
|
26908
27472
|
}
|
|
26909
27473
|
// convert to melonJS renderable argument name
|
|
26910
27474
|
if (typeof (settings.tintcolor) !== "undefined") {
|
|
26911
|
-
settings.tint = pull("Color");
|
|
27475
|
+
settings.tint = pool$1.pull("Color");
|
|
26912
27476
|
settings.tint.parseHex(settings.tintcolor, true);
|
|
26913
27477
|
}
|
|
26914
27478
|
|
|
@@ -26926,39 +27490,57 @@
|
|
|
26926
27490
|
settings.text.anchorPoint = settings.anchorPoint;
|
|
26927
27491
|
}
|
|
26928
27492
|
if (settings.text.bitmap === true) {
|
|
26929
|
-
obj = pull("BitmapText", settings.x, settings.y, settings.text);
|
|
27493
|
+
obj = pool$1.pull("BitmapText", settings.x, settings.y, settings.text);
|
|
26930
27494
|
} else {
|
|
26931
|
-
obj = pull("Text", settings.x, settings.y, settings.text);
|
|
27495
|
+
obj = pool$1.pull("Text", settings.x, settings.y, settings.text);
|
|
26932
27496
|
}
|
|
26933
27497
|
// set the obj z order
|
|
26934
27498
|
obj.pos.z = settings.z;
|
|
26935
27499
|
} else if (typeof settings.tile === "object") {
|
|
27500
|
+
// create a default shape if none is specified
|
|
27501
|
+
shape = settings.shapes;
|
|
27502
|
+
if (typeof shape === "undefined") {
|
|
27503
|
+
shape = pool$1.pull("Polygon", 0, 0, [
|
|
27504
|
+
pool$1.pull("Vector2d", 0, 0),
|
|
27505
|
+
pool$1.pull("Vector2d", this.width, 0),
|
|
27506
|
+
pool$1.pull("Vector2d", this.width, this.height)
|
|
27507
|
+
]);
|
|
27508
|
+
}
|
|
26936
27509
|
// check if a me.Tile object is embedded
|
|
26937
27510
|
obj = settings.tile.getRenderable(settings);
|
|
26938
|
-
obj.body = new Body(obj,
|
|
27511
|
+
obj.body = new Body(obj, shape);
|
|
26939
27512
|
obj.body.setStatic(true);
|
|
26940
27513
|
// set the obj z order
|
|
26941
27514
|
obj.pos.setMuted(settings.x, settings.y, settings.z);
|
|
26942
27515
|
} else {
|
|
26943
27516
|
// pull the corresponding object from the object pool
|
|
26944
27517
|
if (typeof settings.name !== "undefined" && settings.name !== "") {
|
|
26945
|
-
obj = pull(
|
|
27518
|
+
obj = pool$1.pull(
|
|
26946
27519
|
settings.name,
|
|
26947
27520
|
settings.x, settings.y,
|
|
26948
27521
|
settings
|
|
26949
27522
|
);
|
|
26950
27523
|
} else {
|
|
26951
27524
|
// unnamed shape object
|
|
26952
|
-
obj = pull(
|
|
27525
|
+
obj = pool$1.pull(
|
|
26953
27526
|
"Renderable",
|
|
26954
27527
|
settings.x, settings.y,
|
|
26955
27528
|
settings.width, settings.height
|
|
26956
27529
|
);
|
|
27530
|
+
// create a default shape if none is specified
|
|
27531
|
+
shape = settings.shapes;
|
|
27532
|
+
if (typeof shape === "undefined") {
|
|
27533
|
+
shape = pool$1.pull("Polygon", 0, 0, [
|
|
27534
|
+
pool$1.pull("Vector2d", 0, 0),
|
|
27535
|
+
pool$1.pull("Vector2d", this.width, 0),
|
|
27536
|
+
pool$1.pull("Vector2d", this.width, this.height)
|
|
27537
|
+
]);
|
|
27538
|
+
}
|
|
26957
27539
|
obj.anchorPoint.set(0, 0);
|
|
26958
27540
|
obj.name = settings.name;
|
|
26959
27541
|
obj.type = settings.type;
|
|
26960
27542
|
obj.id = settings.id;
|
|
26961
|
-
obj.body = new Body(obj,
|
|
27543
|
+
obj.body = new Body(obj, shape);
|
|
26962
27544
|
obj.body.setStatic(true);
|
|
26963
27545
|
obj.resize(obj.body.getBounds().width, obj.body.getBounds().height);
|
|
26964
27546
|
}
|
|
@@ -27357,7 +27939,7 @@
|
|
|
27357
27939
|
}
|
|
27358
27940
|
}
|
|
27359
27941
|
else {
|
|
27360
|
-
timerId$1 = setTimeout(function() {
|
|
27942
|
+
timerId$1 = setTimeout(function () {
|
|
27361
27943
|
checkLoadStatus(onload);
|
|
27362
27944
|
}, 100);
|
|
27363
27945
|
}
|
|
@@ -27394,7 +27976,7 @@
|
|
|
27394
27976
|
function preloadFontFace(data, onload, onerror) {
|
|
27395
27977
|
var font = new FontFace(data.name, data.src);
|
|
27396
27978
|
// loading promise
|
|
27397
|
-
font.load().then(function() {
|
|
27979
|
+
font.load().then(function () {
|
|
27398
27980
|
// apply the font after the font has finished downloading
|
|
27399
27981
|
document.fonts.add(font);
|
|
27400
27982
|
document.body.style.fontFamily = data.name;
|
|
@@ -27583,12 +28165,12 @@
|
|
|
27583
28165
|
}
|
|
27584
28166
|
script.defer = true;
|
|
27585
28167
|
|
|
27586
|
-
script.onload = function() {
|
|
28168
|
+
script.onload = function () {
|
|
27587
28169
|
// callback
|
|
27588
28170
|
onload();
|
|
27589
28171
|
};
|
|
27590
28172
|
|
|
27591
|
-
script.onerror = function() {
|
|
28173
|
+
script.onerror = function () {
|
|
27592
28174
|
// callback
|
|
27593
28175
|
onerror(data.name);
|
|
27594
28176
|
};
|
|
@@ -28846,12 +29428,6 @@
|
|
|
28846
29428
|
// detect device type/platform
|
|
28847
29429
|
_detectDevice();
|
|
28848
29430
|
|
|
28849
|
-
// Mobile browser hacks
|
|
28850
|
-
if (device.isMobile) {
|
|
28851
|
-
// Prevent the webview from moving on a swipe
|
|
28852
|
-
device.enableSwipe(false);
|
|
28853
|
-
}
|
|
28854
|
-
|
|
28855
29431
|
// Touch/Gesture Event feature detection
|
|
28856
29432
|
device.TouchEvent = !!("ontouchstart" in globalThis);
|
|
28857
29433
|
device.PointerEvent = !!globalThis.PointerEvent;
|
|
@@ -28973,6 +29549,13 @@
|
|
|
28973
29549
|
);
|
|
28974
29550
|
}
|
|
28975
29551
|
}
|
|
29552
|
+
|
|
29553
|
+
// Mobile browser hacks
|
|
29554
|
+
if (device.isMobile) {
|
|
29555
|
+
// Prevent the webview from moving on a swipe
|
|
29556
|
+
device.enableSwipe(false);
|
|
29557
|
+
}
|
|
29558
|
+
|
|
28976
29559
|
}
|
|
28977
29560
|
|
|
28978
29561
|
// Initialize me.timer on Boot event
|
|
@@ -29409,13 +29992,14 @@
|
|
|
29409
29992
|
* @param {boolean} [enable=true] enable or disable swipe.
|
|
29410
29993
|
*/
|
|
29411
29994
|
enableSwipe: function enableSwipe(enable) {
|
|
29995
|
+
var moveEvent = device.PointerEvent ? "pointermove" : (device.TouchEvent ? "touchmove" : "mousemove");
|
|
29412
29996
|
if (enable !== false) {
|
|
29413
29997
|
if (swipeEnabled === false) {
|
|
29414
|
-
globalThis.document.removeEventListener(
|
|
29998
|
+
globalThis.document.removeEventListener(moveEvent, _disableSwipeFn);
|
|
29415
29999
|
swipeEnabled = true;
|
|
29416
30000
|
}
|
|
29417
30001
|
} else if (swipeEnabled === true) {
|
|
29418
|
-
globalThis.document.addEventListener(
|
|
30002
|
+
globalThis.document.addEventListener(moveEvent, _disableSwipeFn, { passive: false });
|
|
29419
30003
|
swipeEnabled = false;
|
|
29420
30004
|
}
|
|
29421
30005
|
},
|
|
@@ -29905,6 +30489,29 @@
|
|
|
29905
30489
|
|
|
29906
30490
|
var device$1 = device;
|
|
29907
30491
|
|
|
30492
|
+
/**
|
|
30493
|
+
* Hash map of GLSL data types to WebGL Uniform methods
|
|
30494
|
+
* @ignore
|
|
30495
|
+
*/
|
|
30496
|
+
var fnHash = {
|
|
30497
|
+
"bool" : "1i",
|
|
30498
|
+
"int" : "1i",
|
|
30499
|
+
"float" : "1f",
|
|
30500
|
+
"vec2" : "2fv",
|
|
30501
|
+
"vec3" : "3fv",
|
|
30502
|
+
"vec4" : "4fv",
|
|
30503
|
+
"bvec2" : "2iv",
|
|
30504
|
+
"bvec3" : "3iv",
|
|
30505
|
+
"bvec4" : "4iv",
|
|
30506
|
+
"ivec2" : "2iv",
|
|
30507
|
+
"ivec3" : "3iv",
|
|
30508
|
+
"ivec4" : "4iv",
|
|
30509
|
+
"mat2" : "Matrix2fv",
|
|
30510
|
+
"mat3" : "Matrix3fv",
|
|
30511
|
+
"mat4" : "Matrix4fv",
|
|
30512
|
+
"sampler2D" : "1i"
|
|
30513
|
+
};
|
|
30514
|
+
|
|
29908
30515
|
/**
|
|
29909
30516
|
* @ignore
|
|
29910
30517
|
*/
|
|
@@ -29955,7 +30562,7 @@
|
|
|
29955
30562
|
*/
|
|
29956
30563
|
return function (val) {
|
|
29957
30564
|
var fnv = fn;
|
|
29958
|
-
if (val.length && fn.
|
|
30565
|
+
if (val.length && fn.slice(-1) !== "v") {
|
|
29959
30566
|
fnv += "v";
|
|
29960
30567
|
}
|
|
29961
30568
|
gl[fnv](locations[name], val);
|
|
@@ -29968,6 +30575,7 @@
|
|
|
29968
30575
|
|
|
29969
30576
|
return uniforms;
|
|
29970
30577
|
}
|
|
30578
|
+
|
|
29971
30579
|
/**
|
|
29972
30580
|
* @ignore
|
|
29973
30581
|
*/
|
|
@@ -29984,6 +30592,7 @@
|
|
|
29984
30592
|
|
|
29985
30593
|
return attributes;
|
|
29986
30594
|
}
|
|
30595
|
+
|
|
29987
30596
|
/**
|
|
29988
30597
|
* @ignore
|
|
29989
30598
|
*/
|
|
@@ -30042,29 +30651,6 @@
|
|
|
30042
30651
|
return program;
|
|
30043
30652
|
}
|
|
30044
30653
|
|
|
30045
|
-
/**
|
|
30046
|
-
* Hash map of GLSL data types to WebGL Uniform methods
|
|
30047
|
-
* @ignore
|
|
30048
|
-
*/
|
|
30049
|
-
var fnHash = {
|
|
30050
|
-
"bool" : "1i",
|
|
30051
|
-
"int" : "1i",
|
|
30052
|
-
"float" : "1f",
|
|
30053
|
-
"vec2" : "2fv",
|
|
30054
|
-
"vec3" : "3fv",
|
|
30055
|
-
"vec4" : "4fv",
|
|
30056
|
-
"bvec2" : "2iv",
|
|
30057
|
-
"bvec3" : "3iv",
|
|
30058
|
-
"bvec4" : "4iv",
|
|
30059
|
-
"ivec2" : "2iv",
|
|
30060
|
-
"ivec3" : "3iv",
|
|
30061
|
-
"ivec4" : "4iv",
|
|
30062
|
-
"mat2" : "Matrix2fv",
|
|
30063
|
-
"mat3" : "Matrix3fv",
|
|
30064
|
-
"mat4" : "Matrix4fv",
|
|
30065
|
-
"sampler2D" : "1i"
|
|
30066
|
-
};
|
|
30067
|
-
|
|
30068
30654
|
/**
|
|
30069
30655
|
* set precision for the fiven shader source
|
|
30070
30656
|
* won't do anything if the precision is already specified
|
|
@@ -30076,6 +30662,7 @@
|
|
|
30076
30662
|
}
|
|
30077
30663
|
return src;
|
|
30078
30664
|
}
|
|
30665
|
+
|
|
30079
30666
|
/**
|
|
30080
30667
|
* clean the given source from space, comments, etc...
|
|
30081
30668
|
* @ignore
|
|
@@ -30092,6 +30679,7 @@
|
|
|
30092
30679
|
|
|
30093
30680
|
return src;
|
|
30094
30681
|
}
|
|
30682
|
+
|
|
30095
30683
|
/**
|
|
30096
30684
|
* @classdesc
|
|
30097
30685
|
* a base GL Shader object
|
|
@@ -30207,6 +30795,30 @@
|
|
|
30207
30795
|
}
|
|
30208
30796
|
};
|
|
30209
30797
|
|
|
30798
|
+
/**
|
|
30799
|
+
* activate the given vertex attribute for this shader
|
|
30800
|
+
* @name setVertexAttributes
|
|
30801
|
+
* @memberof GLShader
|
|
30802
|
+
* @function
|
|
30803
|
+
* @param {WebGLRenderingContext} gl the current WebGL rendering context
|
|
30804
|
+
* @param {object[]} attributes an array of vertex attributes
|
|
30805
|
+
* @param {number} vertexByteSize the size of a single vertex in bytes
|
|
30806
|
+
*/
|
|
30807
|
+
GLShader.prototype.setVertexAttributes = function setVertexAttributes (gl, attributes, vertexByteSize) {
|
|
30808
|
+
// set the vertex attributes
|
|
30809
|
+
for (var index = 0; index < attributes.length; ++index) {
|
|
30810
|
+
var element = attributes[index];
|
|
30811
|
+
var location = this.getAttribLocation(element.name);
|
|
30812
|
+
|
|
30813
|
+
if (location !== -1) {
|
|
30814
|
+
gl.enableVertexAttribArray(location);
|
|
30815
|
+
gl.vertexAttribPointer(location, element.size, element.type, element.normalized, vertexByteSize, element.offset);
|
|
30816
|
+
} else {
|
|
30817
|
+
gl.disableVertexAttribArray(index);
|
|
30818
|
+
}
|
|
30819
|
+
}
|
|
30820
|
+
};
|
|
30821
|
+
|
|
30210
30822
|
/**
|
|
30211
30823
|
* destroy this shader objects resources (program, attributes, uniforms)
|
|
30212
30824
|
* @name destroy
|
|
@@ -30742,20 +31354,7 @@
|
|
|
30742
31354
|
this.activeShader = shader;
|
|
30743
31355
|
this.activeShader.bind();
|
|
30744
31356
|
this.activeShader.setUniform("uProjectionMatrix", this.renderer.projectionMatrix);
|
|
30745
|
-
|
|
30746
|
-
// set the vertex attributes
|
|
30747
|
-
for (var index = 0; index < this.attributes.length; ++index) {
|
|
30748
|
-
var gl = this.gl;
|
|
30749
|
-
var element = this.attributes[index];
|
|
30750
|
-
var location = this.activeShader.getAttribLocation(element.name);
|
|
30751
|
-
|
|
30752
|
-
if (location !== -1) {
|
|
30753
|
-
gl.enableVertexAttribArray(location);
|
|
30754
|
-
gl.vertexAttribPointer(location, element.size, element.type, element.normalized, this.vertexByteSize, element.offset);
|
|
30755
|
-
} else {
|
|
30756
|
-
gl.disableVertexAttribArray(index);
|
|
30757
|
-
}
|
|
30758
|
-
}
|
|
31357
|
+
this.activeShader.setVertexAttributes(this.gl, this.attributes, this.vertexByteSize);
|
|
30759
31358
|
}
|
|
30760
31359
|
};
|
|
30761
31360
|
|
|
@@ -30918,7 +31517,7 @@
|
|
|
30918
31517
|
/**
|
|
30919
31518
|
* The WebGL version used by this renderer (1 or 2)
|
|
30920
31519
|
* @name WebGLVersion
|
|
30921
|
-
* @memberof WebGLRenderer
|
|
31520
|
+
* @memberof WebGLRenderer#
|
|
30922
31521
|
* @type {number}
|
|
30923
31522
|
* @default 1
|
|
30924
31523
|
* @readonly
|
|
@@ -30928,7 +31527,7 @@
|
|
|
30928
31527
|
/**
|
|
30929
31528
|
* The vendor string of the underlying graphics driver.
|
|
30930
31529
|
* @name GPUVendor
|
|
30931
|
-
* @memberof WebGLRenderer
|
|
31530
|
+
* @memberof WebGLRenderer#
|
|
30932
31531
|
* @type {string}
|
|
30933
31532
|
* @default null
|
|
30934
31533
|
* @readonly
|
|
@@ -30938,7 +31537,7 @@
|
|
|
30938
31537
|
/**
|
|
30939
31538
|
* The renderer string of the underlying graphics driver.
|
|
30940
31539
|
* @name GPURenderer
|
|
30941
|
-
* @memberof WebGLRenderer
|
|
31540
|
+
* @memberof WebGLRenderer#
|
|
30942
31541
|
* @type {string}
|
|
30943
31542
|
* @default null
|
|
30944
31543
|
* @readonly
|
|
@@ -30948,7 +31547,7 @@
|
|
|
30948
31547
|
/**
|
|
30949
31548
|
* The WebGL context
|
|
30950
31549
|
* @name gl
|
|
30951
|
-
* @memberof WebGLRenderer
|
|
31550
|
+
* @memberof WebGLRenderer#
|
|
30952
31551
|
* type {WebGLRenderingContext}
|
|
30953
31552
|
*/
|
|
30954
31553
|
this.context = this.gl = this.getContextGL(this.getScreenCanvas(), options.transparent);
|
|
@@ -30956,7 +31555,7 @@
|
|
|
30956
31555
|
/**
|
|
30957
31556
|
* Maximum number of texture unit supported under the current context
|
|
30958
31557
|
* @name maxTextures
|
|
30959
|
-
* @memberof WebGLRenderer
|
|
31558
|
+
* @memberof WebGLRenderer#
|
|
30960
31559
|
* @type {number}
|
|
30961
31560
|
* @readonly
|
|
30962
31561
|
*/
|
|
@@ -30982,16 +31581,6 @@
|
|
|
30982
31581
|
*/
|
|
30983
31582
|
this._blendStack = [];
|
|
30984
31583
|
|
|
30985
|
-
/**
|
|
30986
|
-
* @ignore
|
|
30987
|
-
*/
|
|
30988
|
-
this._glPoints = [
|
|
30989
|
-
new Vector2d(),
|
|
30990
|
-
new Vector2d(),
|
|
30991
|
-
new Vector2d(),
|
|
30992
|
-
new Vector2d()
|
|
30993
|
-
];
|
|
30994
|
-
|
|
30995
31584
|
/**
|
|
30996
31585
|
* The current transformation matrix used for transformations on the overall scene
|
|
30997
31586
|
* @name currentTransform
|
|
@@ -31011,7 +31600,7 @@
|
|
|
31011
31600
|
/**
|
|
31012
31601
|
* The list of active compositors
|
|
31013
31602
|
* @name compositors
|
|
31014
|
-
* @type {Map}
|
|
31603
|
+
* @type {Map<WebGLCompositor>}
|
|
31015
31604
|
* @memberof WebGLRenderer#
|
|
31016
31605
|
*/
|
|
31017
31606
|
this.compositors = new Map();
|
|
@@ -31236,10 +31825,10 @@
|
|
|
31236
31825
|
if (color instanceof Color) {
|
|
31237
31826
|
glArray = color.toArray();
|
|
31238
31827
|
} else {
|
|
31239
|
-
var _color = pull("me.Color");
|
|
31828
|
+
var _color = pool$1.pull("me.Color");
|
|
31240
31829
|
// reuse temporary the renderer default color object
|
|
31241
31830
|
glArray = _color.parseCSS(color).toArray();
|
|
31242
|
-
push(_color);
|
|
31831
|
+
pool$1.push(_color);
|
|
31243
31832
|
}
|
|
31244
31833
|
// clear gl context with the specified color
|
|
31245
31834
|
this.currentCompositor.clearColor(glArray[0], glArray[1], glArray[2], (opaque === true) ? 1.0 : glArray[3]);
|
|
@@ -31534,8 +32123,8 @@
|
|
|
31534
32123
|
this.setBlendMode(this._blendStack.pop());
|
|
31535
32124
|
|
|
31536
32125
|
// recycle objects
|
|
31537
|
-
push(color);
|
|
31538
|
-
push(matrix);
|
|
32126
|
+
pool$1.push(color);
|
|
32127
|
+
pool$1.push(matrix);
|
|
31539
32128
|
}
|
|
31540
32129
|
|
|
31541
32130
|
if (this._scissorStack.length !== 0) {
|
|
@@ -31612,6 +32201,17 @@
|
|
|
31612
32201
|
this.currentColor.alpha = alpha;
|
|
31613
32202
|
};
|
|
31614
32203
|
|
|
32204
|
+
/**
|
|
32205
|
+
* Return the global alpha
|
|
32206
|
+
* @name getGlobalAlpha
|
|
32207
|
+
* @memberof WebGLRenderer.prototype
|
|
32208
|
+
* @function
|
|
32209
|
+
* @returns {number} global alpha value
|
|
32210
|
+
*/
|
|
32211
|
+
WebGLRenderer.prototype.getGlobalAlpha = function getGlobalAlpha () {
|
|
32212
|
+
return this.currentColor.alpha;
|
|
32213
|
+
};
|
|
32214
|
+
|
|
31615
32215
|
/**
|
|
31616
32216
|
* Set the current fill & stroke style color.
|
|
31617
32217
|
* By default, or upon reset, the value is set to #000000.
|
|
@@ -31652,34 +32252,19 @@
|
|
|
31652
32252
|
*/
|
|
31653
32253
|
WebGLRenderer.prototype.strokeArc = function strokeArc (x, y, radius, start, end, antiClockwise, fill) {
|
|
31654
32254
|
if ( antiClockwise === void 0 ) antiClockwise = false;
|
|
32255
|
+
if ( fill === void 0 ) fill = false;
|
|
31655
32256
|
|
|
31656
|
-
if (
|
|
31657
|
-
|
|
32257
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
32258
|
+
// Fast path: don't draw fully transparent
|
|
32259
|
+
return;
|
|
32260
|
+
}
|
|
32261
|
+
this.path2D.beginPath();
|
|
32262
|
+
this.path2D.arc(x, y, radius, start, end, antiClockwise);
|
|
32263
|
+
if (fill === false) {
|
|
32264
|
+
this.currentCompositor.drawVertices(this.gl.LINE_STRIP, this.path2D.points);
|
|
31658
32265
|
} else {
|
|
31659
|
-
|
|
31660
|
-
|
|
31661
|
-
var i, len = Math.floor(24 * Math.sqrt(radius * 2));
|
|
31662
|
-
var theta = (end - start) / (len * 2);
|
|
31663
|
-
var theta2 = theta * 2;
|
|
31664
|
-
var cos_theta = Math.cos(theta);
|
|
31665
|
-
var sin_theta = Math.sin(theta);
|
|
31666
|
-
|
|
31667
|
-
// Grow internal points buffer if necessary
|
|
31668
|
-
for (i = points.length; i < len + 1; i++) {
|
|
31669
|
-
points.push(new Vector2d());
|
|
31670
|
-
}
|
|
31671
|
-
|
|
31672
|
-
// calculate and draw all segments
|
|
31673
|
-
for (i = 0; i < len; i++) {
|
|
31674
|
-
var angle = ((theta) + start + (theta2 * i));
|
|
31675
|
-
var cos = Math.cos(angle);
|
|
31676
|
-
var sin = -Math.sin(angle);
|
|
31677
|
-
|
|
31678
|
-
points[i].x = x + (((cos_theta * cos) + (sin_theta * sin)) * radius);
|
|
31679
|
-
points[i].y = y + (((cos_theta * -sin) + (sin_theta * cos)) * radius);
|
|
31680
|
-
}
|
|
31681
|
-
// batch draw all lines
|
|
31682
|
-
this.currentCompositor.drawVertices(this.gl.LINE_STRIP, points, len);
|
|
32266
|
+
this.path2D.closePath();
|
|
32267
|
+
this.currentCompositor.drawVertices(this.gl.TRIANGLES, this.path2D.triangulatePath());
|
|
31683
32268
|
}
|
|
31684
32269
|
};
|
|
31685
32270
|
|
|
@@ -31695,35 +32280,10 @@
|
|
|
31695
32280
|
* @param {number} end end angle in radians
|
|
31696
32281
|
* @param {boolean} [antiClockwise=false] draw arc anti-clockwise
|
|
31697
32282
|
*/
|
|
31698
|
-
WebGLRenderer.prototype.fillArc = function fillArc (x, y, radius, start, end
|
|
31699
|
-
|
|
31700
|
-
|
|
31701
|
-
|
|
31702
|
-
var len = Math.floor(24 * Math.sqrt(radius * 2));
|
|
31703
|
-
var theta = (end - start) / (len * 2);
|
|
31704
|
-
var theta2 = theta * 2;
|
|
31705
|
-
var cos_theta = Math.cos(theta);
|
|
31706
|
-
var sin_theta = Math.sin(theta);
|
|
31707
|
-
|
|
31708
|
-
// Grow internal points buffer if necessary
|
|
31709
|
-
for (i = points.length; i < len * 2; i++) {
|
|
31710
|
-
points.push(new Vector2d());
|
|
31711
|
-
}
|
|
31712
|
-
|
|
31713
|
-
// calculate and draw all segments
|
|
31714
|
-
for (i = 0; i < len - 1; i++) {
|
|
31715
|
-
var angle = ((theta) + start + (theta2 * i));
|
|
31716
|
-
var cos = Math.cos(angle);
|
|
31717
|
-
var sin = -Math.sin(angle);
|
|
31718
|
-
|
|
31719
|
-
points[index++].set(x, y);
|
|
31720
|
-
points[index++].set(
|
|
31721
|
-
x - (((cos_theta * cos) + (sin_theta * sin)) * radius),
|
|
31722
|
-
y - (((cos_theta * -sin) + (sin_theta * cos)) * radius)
|
|
31723
|
-
);
|
|
31724
|
-
}
|
|
31725
|
-
// batch draw all triangles
|
|
31726
|
-
this.currentCompositor.drawVertices(this.gl.TRIANGLE_STRIP, points, index);
|
|
32283
|
+
WebGLRenderer.prototype.fillArc = function fillArc (x, y, radius, start, end, antiClockwise) {
|
|
32284
|
+
if ( antiClockwise === void 0 ) antiClockwise = false;
|
|
32285
|
+
|
|
32286
|
+
this.strokeArc(x, y, radius, start, end, antiClockwise, true);
|
|
31727
32287
|
};
|
|
31728
32288
|
|
|
31729
32289
|
/**
|
|
@@ -31740,28 +32300,17 @@
|
|
|
31740
32300
|
WebGLRenderer.prototype.strokeEllipse = function strokeEllipse (x, y, w, h, fill) {
|
|
31741
32301
|
if ( fill === void 0 ) fill = false;
|
|
31742
32302
|
|
|
31743
|
-
if (
|
|
31744
|
-
|
|
32303
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
32304
|
+
// Fast path: don't draw fully transparent
|
|
32305
|
+
return;
|
|
32306
|
+
}
|
|
32307
|
+
this.path2D.beginPath();
|
|
32308
|
+
this.path2D.ellipse(x, y, w, h, 0, 0, 360);
|
|
32309
|
+
this.path2D.closePath();
|
|
32310
|
+
if (fill === false) {
|
|
32311
|
+
this.currentCompositor.drawVertices(this.gl.LINE_LOOP, this.path2D.points);
|
|
31745
32312
|
} else {
|
|
31746
|
-
|
|
31747
|
-
var len = Math.floor(24 * Math.sqrt(w)) ||
|
|
31748
|
-
Math.floor(12 * Math.sqrt(w + h));
|
|
31749
|
-
var segment = (TAU) / len;
|
|
31750
|
-
var points = this._glPoints,
|
|
31751
|
-
i;
|
|
31752
|
-
|
|
31753
|
-
// Grow internal points buffer if necessary
|
|
31754
|
-
for (i = points.length; i < len; i++) {
|
|
31755
|
-
points.push(new Vector2d());
|
|
31756
|
-
}
|
|
31757
|
-
|
|
31758
|
-
// calculate and draw all segments
|
|
31759
|
-
for (i = 0; i < len; i++) {
|
|
31760
|
-
points[i].x = x + (Math.sin(segment * -i) * w);
|
|
31761
|
-
points[i].y = y + (Math.cos(segment * -i) * h);
|
|
31762
|
-
}
|
|
31763
|
-
// batch draw all lines
|
|
31764
|
-
this.currentCompositor.drawVertices(this.gl.LINE_LOOP, points, len);
|
|
32313
|
+
this.currentCompositor.drawVertices(this.gl.TRIANGLES, this.path2D.triangulatePath());
|
|
31765
32314
|
}
|
|
31766
32315
|
};
|
|
31767
32316
|
|
|
@@ -31776,28 +32325,7 @@
|
|
|
31776
32325
|
* @param {number} h vertical radius of the ellipse
|
|
31777
32326
|
*/
|
|
31778
32327
|
WebGLRenderer.prototype.fillEllipse = function fillEllipse (x, y, w, h) {
|
|
31779
|
-
|
|
31780
|
-
var len = Math.floor(24 * Math.sqrt(w)) ||
|
|
31781
|
-
Math.floor(12 * Math.sqrt(w + h));
|
|
31782
|
-
var segment = (TAU) / len;
|
|
31783
|
-
var points = this._glPoints;
|
|
31784
|
-
var index = 0, i;
|
|
31785
|
-
|
|
31786
|
-
// Grow internal points buffer if necessary
|
|
31787
|
-
for (i = points.length; i < (len + 1) * 2; i++) {
|
|
31788
|
-
points.push(new Vector2d());
|
|
31789
|
-
}
|
|
31790
|
-
|
|
31791
|
-
// draw all vertices vertex coordinates
|
|
31792
|
-
for (i = 0; i < len + 1; i++) {
|
|
31793
|
-
points[index++].set(x, y);
|
|
31794
|
-
points[index++].set(
|
|
31795
|
-
x + (Math.sin(segment * i) * w),
|
|
31796
|
-
y + (Math.cos(segment * i) * h)
|
|
31797
|
-
);
|
|
31798
|
-
}
|
|
31799
|
-
// batch draw all triangles
|
|
31800
|
-
this.currentCompositor.drawVertices(this.gl.TRIANGLE_STRIP, points, index);
|
|
32328
|
+
this.strokeEllipse(x, y, w, h, false);
|
|
31801
32329
|
};
|
|
31802
32330
|
|
|
31803
32331
|
/**
|
|
@@ -31811,12 +32339,14 @@
|
|
|
31811
32339
|
* @param {number} endY the end y coordinate
|
|
31812
32340
|
*/
|
|
31813
32341
|
WebGLRenderer.prototype.strokeLine = function strokeLine (startX, startY, endX, endY) {
|
|
31814
|
-
|
|
31815
|
-
|
|
31816
|
-
|
|
31817
|
-
|
|
31818
|
-
|
|
31819
|
-
this.
|
|
32342
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
32343
|
+
// Fast path: don't draw fully transparent
|
|
32344
|
+
return;
|
|
32345
|
+
}
|
|
32346
|
+
this.path2D.beginPath();
|
|
32347
|
+
this.path2D.moveTo(startX, startY);
|
|
32348
|
+
this.path2D.lineTo(endX, endY);
|
|
32349
|
+
this.currentCompositor.drawVertices(this.gl.LINE_STRIP, this.path2D.points);
|
|
31820
32350
|
};
|
|
31821
32351
|
|
|
31822
32352
|
|
|
@@ -31845,25 +32375,27 @@
|
|
|
31845
32375
|
WebGLRenderer.prototype.strokePolygon = function strokePolygon (poly, fill) {
|
|
31846
32376
|
if ( fill === void 0 ) fill = false;
|
|
31847
32377
|
|
|
31848
|
-
if (
|
|
31849
|
-
|
|
32378
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
32379
|
+
// Fast path: don't draw fully transparent
|
|
32380
|
+
return;
|
|
32381
|
+
}
|
|
32382
|
+
this.translate(poly.pos.x, poly.pos.y);
|
|
32383
|
+
this.path2D.beginPath();
|
|
32384
|
+
this.path2D.moveTo(poly.points[0].x, poly.points[0].y);
|
|
32385
|
+
var point;
|
|
32386
|
+
for (var i = 1; i < poly.points.length; i++) {
|
|
32387
|
+
point = poly.points[i];
|
|
32388
|
+
this.path2D.lineTo(point.x, point.y);
|
|
32389
|
+
}
|
|
32390
|
+
this.path2D.lineTo(poly.points[0].x, poly.points[0].y);
|
|
32391
|
+
this.path2D.closePath();
|
|
32392
|
+
if (fill === false) {
|
|
32393
|
+
this.currentCompositor.drawVertices(this.gl.LINE_LOOP, this.path2D.points);
|
|
31850
32394
|
} else {
|
|
31851
|
-
|
|
31852
|
-
|
|
31853
|
-
i;
|
|
31854
|
-
|
|
31855
|
-
// Grow internal points buffer if necessary
|
|
31856
|
-
for (i = points.length; i < len; i++) {
|
|
31857
|
-
points.push(new Vector2d());
|
|
31858
|
-
}
|
|
31859
|
-
|
|
31860
|
-
// calculate and draw all segments
|
|
31861
|
-
for (i = 0; i < len; i++) {
|
|
31862
|
-
points[i].x = poly.pos.x + poly.points[i].x;
|
|
31863
|
-
points[i].y = poly.pos.y + poly.points[i].y;
|
|
31864
|
-
}
|
|
31865
|
-
this.currentCompositor.drawVertices(this.gl.LINE_LOOP, points, len);
|
|
32395
|
+
// draw all triangles
|
|
32396
|
+
this.currentCompositor.drawVertices(this.gl.TRIANGLES, this.path2D.triangulatePath());
|
|
31866
32397
|
}
|
|
32398
|
+
this.translate(-poly.pos.x, -poly.pos.y);
|
|
31867
32399
|
};
|
|
31868
32400
|
|
|
31869
32401
|
/**
|
|
@@ -31874,24 +32406,7 @@
|
|
|
31874
32406
|
* @param {Polygon} poly the shape to draw
|
|
31875
32407
|
*/
|
|
31876
32408
|
WebGLRenderer.prototype.fillPolygon = function fillPolygon (poly) {
|
|
31877
|
-
|
|
31878
|
-
var glPoints = this._glPoints;
|
|
31879
|
-
var indices = poly.getIndices();
|
|
31880
|
-
var x = poly.pos.x, y = poly.pos.y;
|
|
31881
|
-
var i;
|
|
31882
|
-
|
|
31883
|
-
// Grow internal points buffer if necessary
|
|
31884
|
-
for (i = glPoints.length; i < indices.length; i++) {
|
|
31885
|
-
glPoints.push(new Vector2d());
|
|
31886
|
-
}
|
|
31887
|
-
|
|
31888
|
-
// calculate all vertices
|
|
31889
|
-
for (i = 0; i < indices.length; i++ ) {
|
|
31890
|
-
glPoints[i].set(x + points[indices[i]].x, y + points[indices[i]].y);
|
|
31891
|
-
}
|
|
31892
|
-
|
|
31893
|
-
// draw all triangle
|
|
31894
|
-
this.currentCompositor.drawVertices(this.gl.TRIANGLES, glPoints, indices.length);
|
|
32409
|
+
this.strokePolygon(poly, true);
|
|
31895
32410
|
};
|
|
31896
32411
|
|
|
31897
32412
|
/**
|
|
@@ -31908,19 +32423,16 @@
|
|
|
31908
32423
|
WebGLRenderer.prototype.strokeRect = function strokeRect (x, y, width, height, fill) {
|
|
31909
32424
|
if ( fill === void 0 ) fill = false;
|
|
31910
32425
|
|
|
31911
|
-
if (
|
|
31912
|
-
|
|
32426
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
32427
|
+
// Fast path: don't draw fully transparent
|
|
32428
|
+
return;
|
|
32429
|
+
}
|
|
32430
|
+
this.path2D.beginPath();
|
|
32431
|
+
this.path2D.rect(x, y, width, height);
|
|
32432
|
+
if (fill === false) {
|
|
32433
|
+
this.currentCompositor.drawVertices(this.gl.LINE_LOOP, this.path2D.points);
|
|
31913
32434
|
} else {
|
|
31914
|
-
|
|
31915
|
-
points[0].x = x;
|
|
31916
|
-
points[0].y = y;
|
|
31917
|
-
points[1].x = x + width;
|
|
31918
|
-
points[1].y = y;
|
|
31919
|
-
points[2].x = x + width;
|
|
31920
|
-
points[2].y = y + height;
|
|
31921
|
-
points[3].x = x;
|
|
31922
|
-
points[3].y = y + height;
|
|
31923
|
-
this.currentCompositor.drawVertices(this.gl.LINE_LOOP, points, 4);
|
|
32435
|
+
this.currentCompositor.drawVertices(this.gl.TRIANGLES, this.path2D.triangulatePath());
|
|
31924
32436
|
}
|
|
31925
32437
|
};
|
|
31926
32438
|
|
|
@@ -31935,16 +32447,51 @@
|
|
|
31935
32447
|
* @param {number} height
|
|
31936
32448
|
*/
|
|
31937
32449
|
WebGLRenderer.prototype.fillRect = function fillRect (x, y, width, height) {
|
|
31938
|
-
|
|
31939
|
-
|
|
31940
|
-
|
|
31941
|
-
|
|
31942
|
-
|
|
31943
|
-
|
|
31944
|
-
|
|
31945
|
-
|
|
31946
|
-
|
|
31947
|
-
|
|
32450
|
+
this.strokeRect(x, y, width, height, true);
|
|
32451
|
+
};
|
|
32452
|
+
|
|
32453
|
+
/**
|
|
32454
|
+
* Stroke a rounded rectangle at the specified coordinates
|
|
32455
|
+
* @name strokeRoundRect
|
|
32456
|
+
* @memberof WebGLRenderer.prototype
|
|
32457
|
+
* @function
|
|
32458
|
+
* @param {number} x
|
|
32459
|
+
* @param {number} y
|
|
32460
|
+
* @param {number} width
|
|
32461
|
+
* @param {number} height
|
|
32462
|
+
* @param {number} radius
|
|
32463
|
+
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
32464
|
+
*/
|
|
32465
|
+
WebGLRenderer.prototype.strokeRoundRect = function strokeRoundRect (x, y, width, height, radius, fill) {
|
|
32466
|
+
if ( fill === void 0 ) fill = false;
|
|
32467
|
+
|
|
32468
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
32469
|
+
// Fast path: don't draw fully transparent
|
|
32470
|
+
return;
|
|
32471
|
+
}
|
|
32472
|
+
this.path2D.beginPath();
|
|
32473
|
+
this.path2D.roundRect(x, y, width, height, radius);
|
|
32474
|
+
if (fill === false) {
|
|
32475
|
+
this.currentCompositor.drawVertices(this.gl.LINE_LOOP, this.path2D.points);
|
|
32476
|
+
} else {
|
|
32477
|
+
this.path2D.closePath();
|
|
32478
|
+
this.currentCompositor.drawVertices(this.gl.TRIANGLES, this.path2D.triangulatePath());
|
|
32479
|
+
}
|
|
32480
|
+
};
|
|
32481
|
+
|
|
32482
|
+
/**
|
|
32483
|
+
* Draw a rounded filled rectangle at the specified coordinates
|
|
32484
|
+
* @name fillRoundRect
|
|
32485
|
+
* @memberof WebGLRenderer.prototype
|
|
32486
|
+
* @function
|
|
32487
|
+
* @param {number} x
|
|
32488
|
+
* @param {number} y
|
|
32489
|
+
* @param {number} width
|
|
32490
|
+
* @param {number} height
|
|
32491
|
+
* @param {number} radius
|
|
32492
|
+
*/
|
|
32493
|
+
WebGLRenderer.prototype.fillRoundRect = function fillRoundRect (x, y, width, height, radius) {
|
|
32494
|
+
this.strokeRoundRect(x, y, width, height, radius, true);
|
|
31948
32495
|
};
|
|
31949
32496
|
|
|
31950
32497
|
/**
|
|
@@ -32054,7 +32601,7 @@
|
|
|
32054
32601
|
* @name setMask
|
|
32055
32602
|
* @memberof WebGLRenderer.prototype
|
|
32056
32603
|
* @function
|
|
32057
|
-
* @param {Rect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
32604
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
32058
32605
|
*/
|
|
32059
32606
|
WebGLRenderer.prototype.setMask = function setMask (mask) {
|
|
32060
32607
|
var gl = this.gl;
|
|
@@ -32666,14 +33213,14 @@
|
|
|
32666
33213
|
// never cache if a url is passed as parameter
|
|
32667
33214
|
var index = url.indexOf("#");
|
|
32668
33215
|
if (index !== -1) {
|
|
32669
|
-
url = url.
|
|
33216
|
+
url = url.slice(index, url.length);
|
|
32670
33217
|
} else {
|
|
32671
33218
|
return hash;
|
|
32672
33219
|
}
|
|
32673
33220
|
}
|
|
32674
33221
|
|
|
32675
33222
|
// parse the url
|
|
32676
|
-
url.
|
|
33223
|
+
url.slice(1).split("&").filter(function (value) {
|
|
32677
33224
|
return (value !== "");
|
|
32678
33225
|
}).forEach(function (value) {
|
|
32679
33226
|
var kv = value.split("=");
|
|
@@ -33029,6 +33576,256 @@
|
|
|
33029
33576
|
globalThis.cancelAnimationFrame = cancelAnimationFrame;
|
|
33030
33577
|
}
|
|
33031
33578
|
|
|
33579
|
+
/*
|
|
33580
|
+
* based on https://www.npmjs.com/package/canvas-roundrect-polyfill
|
|
33581
|
+
* @version 0.0.1
|
|
33582
|
+
*/
|
|
33583
|
+
(function () {
|
|
33584
|
+
|
|
33585
|
+
/** @ignore */
|
|
33586
|
+
function roundRect(x, y, w, h, radii) {
|
|
33587
|
+
|
|
33588
|
+
if (!([x, y, w, h].every(function (input) { return Number.isFinite(input); }))) {
|
|
33589
|
+
|
|
33590
|
+
return;
|
|
33591
|
+
|
|
33592
|
+
}
|
|
33593
|
+
|
|
33594
|
+
radii = parseRadiiArgument(radii);
|
|
33595
|
+
|
|
33596
|
+
var upperLeft, upperRight, lowerRight, lowerLeft;
|
|
33597
|
+
|
|
33598
|
+
if (radii.length === 4) {
|
|
33599
|
+
|
|
33600
|
+
upperLeft = toCornerPoint(radii[0]);
|
|
33601
|
+
upperRight = toCornerPoint(radii[1]);
|
|
33602
|
+
lowerRight = toCornerPoint(radii[2]);
|
|
33603
|
+
lowerLeft = toCornerPoint(radii[3]);
|
|
33604
|
+
|
|
33605
|
+
} else if (radii.length === 3) {
|
|
33606
|
+
|
|
33607
|
+
upperLeft = toCornerPoint(radii[0]);
|
|
33608
|
+
upperRight = toCornerPoint(radii[1]);
|
|
33609
|
+
lowerLeft = toCornerPoint(radii[1]);
|
|
33610
|
+
lowerRight = toCornerPoint(radii[2]);
|
|
33611
|
+
|
|
33612
|
+
} else if (radii.length === 2) {
|
|
33613
|
+
|
|
33614
|
+
upperLeft = toCornerPoint(radii[0]);
|
|
33615
|
+
lowerRight = toCornerPoint(radii[0]);
|
|
33616
|
+
upperRight = toCornerPoint(radii[1]);
|
|
33617
|
+
lowerLeft = toCornerPoint(radii[1]);
|
|
33618
|
+
|
|
33619
|
+
} else if (radii.length === 1) {
|
|
33620
|
+
|
|
33621
|
+
upperLeft = toCornerPoint(radii[0]);
|
|
33622
|
+
upperRight = toCornerPoint(radii[0]);
|
|
33623
|
+
lowerRight = toCornerPoint(radii[0]);
|
|
33624
|
+
lowerLeft = toCornerPoint(radii[0]);
|
|
33625
|
+
|
|
33626
|
+
} else {
|
|
33627
|
+
|
|
33628
|
+
throw new Error(radii.length + " is not a valid size for radii sequence.");
|
|
33629
|
+
|
|
33630
|
+
}
|
|
33631
|
+
|
|
33632
|
+
var corners = [upperLeft, upperRight, lowerRight, lowerLeft];
|
|
33633
|
+
var negativeCorner = corners.find(function (ref) {
|
|
33634
|
+
var x = ref.x;
|
|
33635
|
+
var y = ref.y;
|
|
33636
|
+
|
|
33637
|
+
return x < 0 || y < 0;
|
|
33638
|
+
});
|
|
33639
|
+
//const negativeValue = negativeCorner?.x < 0 ? negativeCorner.x : negativeCorner?.y
|
|
33640
|
+
|
|
33641
|
+
if (corners.some(function (ref) {
|
|
33642
|
+
var x = ref.x;
|
|
33643
|
+
var y = ref.y;
|
|
33644
|
+
|
|
33645
|
+
return !Number.isFinite(x) || !Number.isFinite(y);
|
|
33646
|
+
})) {
|
|
33647
|
+
|
|
33648
|
+
return;
|
|
33649
|
+
|
|
33650
|
+
}
|
|
33651
|
+
|
|
33652
|
+
if (negativeCorner) {
|
|
33653
|
+
|
|
33654
|
+
throw new Error("Radius value " + negativeCorner + " is negative.");
|
|
33655
|
+
|
|
33656
|
+
}
|
|
33657
|
+
|
|
33658
|
+
fixOverlappingCorners(corners);
|
|
33659
|
+
|
|
33660
|
+
if (w < 0 && h < 0) {
|
|
33661
|
+
|
|
33662
|
+
this.moveTo(x - upperLeft.x, y);
|
|
33663
|
+
this.ellipse(x + w + upperRight.x, y - upperRight.y, upperRight.x, upperRight.y, 0, -Math.PI * 1.5, -Math.PI);
|
|
33664
|
+
this.ellipse(x + w + lowerRight.x, y + h + lowerRight.y, lowerRight.x, lowerRight.y, 0, -Math.PI, -Math.PI / 2);
|
|
33665
|
+
this.ellipse(x - lowerLeft.x, y + h + lowerLeft.y, lowerLeft.x, lowerLeft.y, 0, -Math.PI / 2, 0);
|
|
33666
|
+
this.ellipse(x - upperLeft.x, y - upperLeft.y, upperLeft.x, upperLeft.y, 0, 0, -Math.PI / 2);
|
|
33667
|
+
|
|
33668
|
+
} else if (w < 0) {
|
|
33669
|
+
|
|
33670
|
+
this.moveTo(x - upperLeft.x, y);
|
|
33671
|
+
this.ellipse(x + w + upperRight.x, y + upperRight.y, upperRight.x, upperRight.y, 0, -Math.PI / 2, -Math.PI, 1);
|
|
33672
|
+
this.ellipse(x + w + lowerRight.x, y + h - lowerRight.y, lowerRight.x, lowerRight.y, 0, -Math.PI, -Math.PI * 1.5, 1);
|
|
33673
|
+
this.ellipse(x - lowerLeft.x, y + h - lowerLeft.y, lowerLeft.x, lowerLeft.y, 0, Math.PI / 2, 0, 1);
|
|
33674
|
+
this.ellipse(x - upperLeft.x, y + upperLeft.y, upperLeft.x, upperLeft.y, 0, 0, -Math.PI / 2, 1);
|
|
33675
|
+
|
|
33676
|
+
} else if (h < 0) {
|
|
33677
|
+
|
|
33678
|
+
this.moveTo(x + upperLeft.x, y);
|
|
33679
|
+
this.ellipse(x + w - upperRight.x, y - upperRight.y, upperRight.x, upperRight.y, 0, Math.PI / 2, 0, 1);
|
|
33680
|
+
this.ellipse(x + w - lowerRight.x, y + h + lowerRight.y, lowerRight.x, lowerRight.y, 0, 0, -Math.PI / 2, 1);
|
|
33681
|
+
this.ellipse(x + lowerLeft.x, y + h + lowerLeft.y, lowerLeft.x, lowerLeft.y, 0, -Math.PI / 2, -Math.PI, 1);
|
|
33682
|
+
this.ellipse(x + upperLeft.x, y - upperLeft.y, upperLeft.x, upperLeft.y, 0, -Math.PI, -Math.PI * 1.5, 1);
|
|
33683
|
+
|
|
33684
|
+
} else {
|
|
33685
|
+
|
|
33686
|
+
this.moveTo(x + upperLeft.x, y);
|
|
33687
|
+
this.ellipse(x + w - upperRight.x, y + upperRight.y, upperRight.x, upperRight.y, 0, -Math.PI / 2, 0);
|
|
33688
|
+
this.ellipse(x + w - lowerRight.x, y + h - lowerRight.y, lowerRight.x, lowerRight.y, 0, 0, Math.PI / 2);
|
|
33689
|
+
this.ellipse(x + lowerLeft.x, y + h - lowerLeft.y, lowerLeft.x, lowerLeft.y, 0, Math.PI / 2, Math.PI);
|
|
33690
|
+
this.ellipse(x + upperLeft.x, y + upperLeft.y, upperLeft.x, upperLeft.y, 0, Math.PI, Math.PI * 1.5);
|
|
33691
|
+
|
|
33692
|
+
}
|
|
33693
|
+
|
|
33694
|
+
this.closePath();
|
|
33695
|
+
this.moveTo(x, y);
|
|
33696
|
+
|
|
33697
|
+
/** @ignore */
|
|
33698
|
+
function toDOMPointInit(value) {
|
|
33699
|
+
|
|
33700
|
+
var x = value.x;
|
|
33701
|
+
var y = value.y;
|
|
33702
|
+
var z = value.z;
|
|
33703
|
+
var w = value.w;
|
|
33704
|
+
return {x: x, y: y, z: z, w: w};
|
|
33705
|
+
|
|
33706
|
+
}
|
|
33707
|
+
|
|
33708
|
+
/** @ignore */
|
|
33709
|
+
function parseRadiiArgument(value) {
|
|
33710
|
+
|
|
33711
|
+
// https://webidl.spec.whatwg.org/#es-union
|
|
33712
|
+
// with 'optional (unrestricted double or DOMPointInit
|
|
33713
|
+
// or sequence<(unrestricted double or DOMPointInit)>) radii = 0'
|
|
33714
|
+
var type = typeof value;
|
|
33715
|
+
|
|
33716
|
+
if (type === "undefined" || value === null) {
|
|
33717
|
+
|
|
33718
|
+
return [0];
|
|
33719
|
+
|
|
33720
|
+
}
|
|
33721
|
+
if (type === "function") {
|
|
33722
|
+
|
|
33723
|
+
return [NaN];
|
|
33724
|
+
|
|
33725
|
+
}
|
|
33726
|
+
if (type === "object") {
|
|
33727
|
+
|
|
33728
|
+
if (typeof value[Symbol.iterator] === "function") {
|
|
33729
|
+
|
|
33730
|
+
return [].concat( value ).map(function (elem) {
|
|
33731
|
+
// https://webidl.spec.whatwg.org/#es-union
|
|
33732
|
+
// with '(unrestricted double or DOMPointInit)'
|
|
33733
|
+
var elemType = typeof elem;
|
|
33734
|
+
if (elemType === "undefined" || elem === null) {
|
|
33735
|
+
return 0;
|
|
33736
|
+
}
|
|
33737
|
+
if (elemType === "function") {
|
|
33738
|
+
return NaN;
|
|
33739
|
+
}
|
|
33740
|
+
if (elemType === "object") {
|
|
33741
|
+
return toDOMPointInit(elem);
|
|
33742
|
+
}
|
|
33743
|
+
return toUnrestrictedNumber(elem);
|
|
33744
|
+
});
|
|
33745
|
+
|
|
33746
|
+
}
|
|
33747
|
+
|
|
33748
|
+
return [toDOMPointInit(value)];
|
|
33749
|
+
|
|
33750
|
+
}
|
|
33751
|
+
|
|
33752
|
+
return [toUnrestrictedNumber(value)];
|
|
33753
|
+
|
|
33754
|
+
}
|
|
33755
|
+
|
|
33756
|
+
/** @ignore */
|
|
33757
|
+
function toUnrestrictedNumber(value) {
|
|
33758
|
+
|
|
33759
|
+
return +value;
|
|
33760
|
+
|
|
33761
|
+
}
|
|
33762
|
+
|
|
33763
|
+
/** @ignore */
|
|
33764
|
+
function toCornerPoint(value) {
|
|
33765
|
+
|
|
33766
|
+
var asNumber = toUnrestrictedNumber(value);
|
|
33767
|
+
if (Number.isFinite(asNumber)) {
|
|
33768
|
+
|
|
33769
|
+
return {
|
|
33770
|
+
x: asNumber,
|
|
33771
|
+
y: asNumber
|
|
33772
|
+
};
|
|
33773
|
+
|
|
33774
|
+
}
|
|
33775
|
+
if (Object(value) === value) {
|
|
33776
|
+
|
|
33777
|
+
return {
|
|
33778
|
+
x: toUnrestrictedNumber(value.x || 0),
|
|
33779
|
+
y: toUnrestrictedNumber(value.y || 0)
|
|
33780
|
+
};
|
|
33781
|
+
|
|
33782
|
+
}
|
|
33783
|
+
|
|
33784
|
+
return {
|
|
33785
|
+
x: NaN,
|
|
33786
|
+
y: NaN
|
|
33787
|
+
};
|
|
33788
|
+
|
|
33789
|
+
}
|
|
33790
|
+
|
|
33791
|
+
/** @ignore */
|
|
33792
|
+
function fixOverlappingCorners(corners) {
|
|
33793
|
+
var upperLeft = corners[0];
|
|
33794
|
+
var upperRight = corners[1];
|
|
33795
|
+
var lowerRight = corners[2];
|
|
33796
|
+
var lowerLeft = corners[3];
|
|
33797
|
+
var factors = [
|
|
33798
|
+
Math.abs(w) / (upperLeft.x + upperRight.x),
|
|
33799
|
+
Math.abs(h) / (upperRight.y + lowerRight.y),
|
|
33800
|
+
Math.abs(w) / (lowerRight.x + lowerLeft.x),
|
|
33801
|
+
Math.abs(h) / (upperLeft.y + lowerLeft.y)
|
|
33802
|
+
];
|
|
33803
|
+
var minFactor = Math.min.apply(Math, factors);
|
|
33804
|
+
if (minFactor <= 1) {
|
|
33805
|
+
corners.forEach(function (radii) {
|
|
33806
|
+
radii.x *= minFactor;
|
|
33807
|
+
radii.y *= minFactor;
|
|
33808
|
+
});
|
|
33809
|
+
}
|
|
33810
|
+
}
|
|
33811
|
+
}
|
|
33812
|
+
|
|
33813
|
+
if (typeof Path2D.prototype.roundRect === "undefined") {
|
|
33814
|
+
Path2D.prototype.roundRect = roundRect;
|
|
33815
|
+
}
|
|
33816
|
+
if (globalThis.CanvasRenderingContext2D) {
|
|
33817
|
+
if (typeof globalThis.CanvasRenderingContext2D.prototype.roundRect === "undefined") {
|
|
33818
|
+
globalThis.CanvasRenderingContext2D.prototype.roundRect = roundRect;
|
|
33819
|
+
}
|
|
33820
|
+
}
|
|
33821
|
+
if (globalThis.OffscreenCanvasRenderingContext2D) {
|
|
33822
|
+
if (typeof globalThis.OffscreenCanvasRenderingContext2D.prototype.roundRect === "undefined") {
|
|
33823
|
+
globalThis.OffscreenCanvasRenderingContext2D.prototype.roundRect = roundRect;
|
|
33824
|
+
}
|
|
33825
|
+
}
|
|
33826
|
+
|
|
33827
|
+
})();
|
|
33828
|
+
|
|
33032
33829
|
/**
|
|
33033
33830
|
* This namespace is a container for all registered plugins.
|
|
33034
33831
|
* @see plugin.register
|
|
@@ -33043,10 +33840,10 @@
|
|
|
33043
33840
|
* this can be overridden by the plugin
|
|
33044
33841
|
* @public
|
|
33045
33842
|
* @type {string}
|
|
33046
|
-
* @default "10.
|
|
33843
|
+
* @default "10.9.0"
|
|
33047
33844
|
* @name plugin.Base#version
|
|
33048
33845
|
*/
|
|
33049
|
-
this.version = "10.
|
|
33846
|
+
this.version = "10.9.0";
|
|
33050
33847
|
};
|
|
33051
33848
|
|
|
33052
33849
|
/**
|
|
@@ -34287,10 +35084,10 @@
|
|
|
34287
35084
|
this.fillStyle = settings.fillStyle;
|
|
34288
35085
|
} else {
|
|
34289
35086
|
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
34290
|
-
this.fillStyle = pull("Color").parseCSS(settings.fillStyle);
|
|
35087
|
+
this.fillStyle = pool$1.pull("Color").parseCSS(settings.fillStyle);
|
|
34291
35088
|
}
|
|
34292
35089
|
} else {
|
|
34293
|
-
this.fillStyle = pull("Color", 0, 0, 0);
|
|
35090
|
+
this.fillStyle = pool$1.pull("Color", 0, 0, 0);
|
|
34294
35091
|
}
|
|
34295
35092
|
|
|
34296
35093
|
/**
|
|
@@ -34304,10 +35101,10 @@
|
|
|
34304
35101
|
this.strokeStyle = settings.strokeStyle;
|
|
34305
35102
|
} else {
|
|
34306
35103
|
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
34307
|
-
this.strokeStyle = pull("Color").parseCSS(settings.strokeStyle);
|
|
35104
|
+
this.strokeStyle = pool$1.pull("Color").parseCSS(settings.strokeStyle);
|
|
34308
35105
|
}
|
|
34309
35106
|
} else {
|
|
34310
|
-
this.strokeStyle = pull("Color", 0, 0, 0);
|
|
35107
|
+
this.strokeStyle = pool$1.pull("Color", 0, 0, 0);
|
|
34311
35108
|
}
|
|
34312
35109
|
|
|
34313
35110
|
/**
|
|
@@ -34658,8 +35455,8 @@
|
|
|
34658
35455
|
* @ignore
|
|
34659
35456
|
*/
|
|
34660
35457
|
Text.prototype.destroy = function destroy () {
|
|
34661
|
-
push(this.fillStyle);
|
|
34662
|
-
push(this.strokeStyle);
|
|
35458
|
+
pool$1.push(this.fillStyle);
|
|
35459
|
+
pool$1.push(this.strokeStyle);
|
|
34663
35460
|
this.fillStyle = this.strokeStyle = undefined;
|
|
34664
35461
|
this.metrics = undefined;
|
|
34665
35462
|
this._text.length = 0;
|
|
@@ -34725,7 +35522,7 @@
|
|
|
34725
35522
|
* scaled font size
|
|
34726
35523
|
* @private
|
|
34727
35524
|
*/
|
|
34728
|
-
this.fontScale = pull("Vector2d", 1.0, 1.0);
|
|
35525
|
+
this.fontScale = pool$1.pull("Vector2d", 1.0, 1.0);
|
|
34729
35526
|
|
|
34730
35527
|
/**
|
|
34731
35528
|
* font image
|
|
@@ -34739,9 +35536,9 @@
|
|
|
34739
35536
|
* @private
|
|
34740
35537
|
*/
|
|
34741
35538
|
// use settings.font to retreive the data from the loader
|
|
34742
|
-
this.fontData = pull("BitmapTextData", loader.getBinary(settings.font));
|
|
35539
|
+
this.fontData = pool$1.pull("BitmapTextData", loader.getBinary(settings.font));
|
|
34743
35540
|
} else {
|
|
34744
|
-
this.fontData = pull("BitmapTextData",
|
|
35541
|
+
this.fontData = pool$1.pull("BitmapTextData",
|
|
34745
35542
|
// if starting/includes "info face" the whole data string was passed as parameter
|
|
34746
35543
|
(settings.fontData.includes("info face")) ? settings.fontData : loader.getBinary(settings.fontData)
|
|
34747
35544
|
);
|
|
@@ -34980,9 +35777,9 @@
|
|
|
34980
35777
|
* @ignore
|
|
34981
35778
|
*/
|
|
34982
35779
|
BitmapText.prototype.destroy = function destroy () {
|
|
34983
|
-
push(this.fontScale);
|
|
35780
|
+
pool$1.push(this.fontScale);
|
|
34984
35781
|
this.fontScale = undefined;
|
|
34985
|
-
push(this.fontData);
|
|
35782
|
+
pool$1.push(this.fontData);
|
|
34986
35783
|
this.fontData = undefined;
|
|
34987
35784
|
this._text.length = 0;
|
|
34988
35785
|
this.metrics = undefined;
|
|
@@ -35247,7 +36044,7 @@
|
|
|
35247
36044
|
* @name color
|
|
35248
36045
|
* @memberof ColorLayer#
|
|
35249
36046
|
*/
|
|
35250
|
-
this.color = pull("Color").parseCSS(color);
|
|
36047
|
+
this.color = pool$1.pull("Color").parseCSS(color);
|
|
35251
36048
|
|
|
35252
36049
|
this.onResetEvent(name, color, z);
|
|
35253
36050
|
|
|
@@ -35288,7 +36085,7 @@
|
|
|
35288
36085
|
* @ignore
|
|
35289
36086
|
*/
|
|
35290
36087
|
ColorLayer.prototype.destroy = function destroy () {
|
|
35291
|
-
push(this.color);
|
|
36088
|
+
pool$1.push(this.color);
|
|
35292
36089
|
this.color = undefined;
|
|
35293
36090
|
Renderable.prototype.destroy.call(this);
|
|
35294
36091
|
};
|
|
@@ -35324,7 +36121,7 @@
|
|
|
35324
36121
|
* @default <1.0,1.0>
|
|
35325
36122
|
* @name ImageLayer#ratio
|
|
35326
36123
|
*/
|
|
35327
|
-
this.ratio = pull("Vector2d", 1.0, 1.0);
|
|
36124
|
+
this.ratio = pool$1.pull("Vector2d", 1.0, 1.0);
|
|
35328
36125
|
|
|
35329
36126
|
if (typeof(settings.ratio) !== "undefined") {
|
|
35330
36127
|
// little hack for backward compatiblity
|
|
@@ -35573,7 +36370,7 @@
|
|
|
35573
36370
|
* @ignore
|
|
35574
36371
|
*/
|
|
35575
36372
|
ImageLayer.prototype.destroy = function destroy () {
|
|
35576
|
-
push(this.ratio);
|
|
36373
|
+
pool$1.push(this.ratio);
|
|
35577
36374
|
this.ratio = undefined;
|
|
35578
36375
|
off(ONCONTEXT_RESTORED, this.createPattern);
|
|
35579
36376
|
Sprite.prototype.destroy.call(this);
|
|
@@ -36008,7 +36805,15 @@
|
|
|
36008
36805
|
this.id = settings.id;
|
|
36009
36806
|
|
|
36010
36807
|
// add and configure the physic body
|
|
36011
|
-
|
|
36808
|
+
var shape = settings.shapes;
|
|
36809
|
+
if (typeof shape === "undefined") {
|
|
36810
|
+
shape = pool.pull("Polygon", 0, 0, [
|
|
36811
|
+
pool.pull("Vector2d", 0, 0),
|
|
36812
|
+
pool.pull("Vector2d", this.width, 0),
|
|
36813
|
+
pool.pull("Vector2d", this.width, this.height)
|
|
36814
|
+
]);
|
|
36815
|
+
}
|
|
36816
|
+
this.body = new Body(this, shape);
|
|
36012
36817
|
this.body.collisionType = collision.types.COLLECTABLE_OBJECT;
|
|
36013
36818
|
// by default only collides with PLAYER_OBJECT
|
|
36014
36819
|
this.body.setCollisionMask(collision.types.PLAYER_OBJECT);
|
|
@@ -36068,9 +36873,16 @@
|
|
|
36068
36873
|
}
|
|
36069
36874
|
}.bind(this));
|
|
36070
36875
|
|
|
36071
|
-
|
|
36072
|
-
|
|
36073
|
-
|
|
36876
|
+
// add and configure the physic body
|
|
36877
|
+
var shape = settings.shapes;
|
|
36878
|
+
if (typeof shape === "undefined") {
|
|
36879
|
+
shape = pool.pull("Polygon", 0, 0, [
|
|
36880
|
+
pool.pull("Vector2d", 0, 0),
|
|
36881
|
+
pool.pull("Vector2d", this.width, 0),
|
|
36882
|
+
pool.pull("Vector2d", this.width, this.height)
|
|
36883
|
+
]);
|
|
36884
|
+
}
|
|
36885
|
+
this.body = new Body(this, shape);
|
|
36074
36886
|
this.body.collisionType = collision.types.ACTION_OBJECT;
|
|
36075
36887
|
// by default only collides with PLAYER_OBJECT
|
|
36076
36888
|
this.body.setCollisionMask(collision.types.PLAYER_OBJECT);
|
|
@@ -36704,6 +37516,15 @@
|
|
|
36704
37516
|
settings.height | 1
|
|
36705
37517
|
);
|
|
36706
37518
|
|
|
37519
|
+
/**
|
|
37520
|
+
* the current (active) emitter settings
|
|
37521
|
+
* @public
|
|
37522
|
+
* @type {ParticleEmitterSettings}
|
|
37523
|
+
* @name settings
|
|
37524
|
+
* @memberof ParticleEmitter
|
|
37525
|
+
*/
|
|
37526
|
+
this.settings = {};
|
|
37527
|
+
|
|
36707
37528
|
// center the emitter around the given coordinates
|
|
36708
37529
|
this.centerOn(x, y);
|
|
36709
37530
|
|
|
@@ -36734,9 +37555,6 @@
|
|
|
36734
37555
|
// count the updates
|
|
36735
37556
|
this._updateCount = 0;
|
|
36736
37557
|
|
|
36737
|
-
// the emitter settings
|
|
36738
|
-
this.settings = {};
|
|
36739
|
-
|
|
36740
37558
|
// internally store how much time was skipped when frames are skipped
|
|
36741
37559
|
this._dt = 0;
|
|
36742
37560
|
|
|
@@ -36752,7 +37570,7 @@
|
|
|
36752
37570
|
|
|
36753
37571
|
/**
|
|
36754
37572
|
* Reset the emitter with particle emitter settings.
|
|
36755
|
-
* @param {
|
|
37573
|
+
* @param {ParticleEmitterSettings} settings [optional] object with emitter settings. See {@link ParticleEmitterSettings}
|
|
36756
37574
|
*/
|
|
36757
37575
|
ParticleEmitter.prototype.reset = function reset (settings) {
|
|
36758
37576
|
if ( settings === void 0 ) settings = {};
|
|
@@ -36788,9 +37606,9 @@
|
|
|
36788
37606
|
// Add count particles in the game world
|
|
36789
37607
|
/** @ignore */
|
|
36790
37608
|
ParticleEmitter.prototype.addParticles = function addParticles (count) {
|
|
36791
|
-
for (var i = 0; i <
|
|
37609
|
+
for (var i = 0; i < count; i++) {
|
|
36792
37610
|
// Add particle to the container
|
|
36793
|
-
this.addChild(pull("Particle", this), this.pos.z);
|
|
37611
|
+
this.addChild(pool$1.pull("Particle", this), this.pos.z);
|
|
36794
37612
|
}
|
|
36795
37613
|
this.isDirty = true;
|
|
36796
37614
|
};
|
|
@@ -36934,9 +37752,10 @@
|
|
|
36934
37752
|
emitter.settings.image.width,
|
|
36935
37753
|
emitter.settings.image.height
|
|
36936
37754
|
);
|
|
37755
|
+
this.currentTransform.identity();
|
|
36937
37756
|
} else {
|
|
36938
37757
|
// particle velocity
|
|
36939
|
-
this.vel =
|
|
37758
|
+
this.vel = pool$1.pull("Vector2d");
|
|
36940
37759
|
}
|
|
36941
37760
|
|
|
36942
37761
|
this.image = emitter.settings.image;
|
|
@@ -37155,11 +37974,11 @@
|
|
|
37155
37974
|
*/
|
|
37156
37975
|
// initialize the default body
|
|
37157
37976
|
if (typeof settings.shapes === "undefined") {
|
|
37158
|
-
settings.shapes =
|
|
37159
|
-
|
|
37160
|
-
|
|
37161
|
-
|
|
37162
|
-
|
|
37977
|
+
settings.shapes = pool$1.pull("Polygon", 0, 0, [
|
|
37978
|
+
pool$1.pull("Vector2d", 0, 0),
|
|
37979
|
+
pool$1.pull("Vector2d", this.width, 0),
|
|
37980
|
+
pool$1.pull("Vector2d", this.width, this.height),
|
|
37981
|
+
pool$1.pull("Vector2d", 0, this.height)
|
|
37163
37982
|
]);
|
|
37164
37983
|
}
|
|
37165
37984
|
this.body = new Body(this, settings.shapes, this.onBodyUpdate.bind(this));
|
|
@@ -37375,7 +38194,7 @@
|
|
|
37375
38194
|
/**
|
|
37376
38195
|
* @public
|
|
37377
38196
|
* @name Texture
|
|
37378
|
-
* @memberof Renderer
|
|
38197
|
+
* @memberof Renderer#
|
|
37379
38198
|
* @deprecated since 10.4.0
|
|
37380
38199
|
* @see TextureAtlas
|
|
37381
38200
|
*/
|
|
@@ -37440,7 +38259,7 @@
|
|
|
37440
38259
|
* @name version
|
|
37441
38260
|
* @type {string}
|
|
37442
38261
|
*/
|
|
37443
|
-
var version = "10.
|
|
38262
|
+
var version = "10.9.0";
|
|
37444
38263
|
|
|
37445
38264
|
|
|
37446
38265
|
/**
|
|
@@ -37475,58 +38294,60 @@
|
|
|
37475
38294
|
}
|
|
37476
38295
|
|
|
37477
38296
|
// register all built-ins objects into the object pool
|
|
37478
|
-
register("me.Entity", Entity);
|
|
37479
|
-
register("me.Collectable", Collectable);
|
|
37480
|
-
register("me.Trigger", Trigger);
|
|
37481
|
-
register("me.Tween", Tween, true);
|
|
37482
|
-
register("me.Color", Color, true);
|
|
37483
|
-
register("me.Particle", Particle, true);
|
|
37484
|
-
register("me.Sprite", Sprite);
|
|
37485
|
-
register("me.NineSliceSprite", NineSliceSprite);
|
|
37486
|
-
register("me.Renderable", Renderable);
|
|
37487
|
-
register("me.Text", Text, true);
|
|
37488
|
-
register("me.BitmapText", BitmapText);
|
|
37489
|
-
register("me.BitmapTextData", BitmapTextData, true);
|
|
37490
|
-
register("me.ImageLayer", ImageLayer);
|
|
37491
|
-
register("me.ColorLayer", ColorLayer, true);
|
|
37492
|
-
register("me.Vector2d", Vector2d, true);
|
|
37493
|
-
register("me.Vector3d", Vector3d, true);
|
|
37494
|
-
register("me.ObservableVector2d", ObservableVector2d, true);
|
|
37495
|
-
register("me.ObservableVector3d", ObservableVector3d, true);
|
|
37496
|
-
register("me.Matrix2d", Matrix2d, true);
|
|
37497
|
-
register("me.Matrix3d", Matrix3d, true);
|
|
37498
|
-
register("me.Rect", Rect, true);
|
|
37499
|
-
register("me.
|
|
37500
|
-
register("me.
|
|
37501
|
-
register("me.
|
|
37502
|
-
register("me.
|
|
38297
|
+
pool$1.register("me.Entity", Entity);
|
|
38298
|
+
pool$1.register("me.Collectable", Collectable);
|
|
38299
|
+
pool$1.register("me.Trigger", Trigger);
|
|
38300
|
+
pool$1.register("me.Tween", Tween, true);
|
|
38301
|
+
pool$1.register("me.Color", Color, true);
|
|
38302
|
+
pool$1.register("me.Particle", Particle, true);
|
|
38303
|
+
pool$1.register("me.Sprite", Sprite);
|
|
38304
|
+
pool$1.register("me.NineSliceSprite", NineSliceSprite);
|
|
38305
|
+
pool$1.register("me.Renderable", Renderable);
|
|
38306
|
+
pool$1.register("me.Text", Text, true);
|
|
38307
|
+
pool$1.register("me.BitmapText", BitmapText);
|
|
38308
|
+
pool$1.register("me.BitmapTextData", BitmapTextData, true);
|
|
38309
|
+
pool$1.register("me.ImageLayer", ImageLayer);
|
|
38310
|
+
pool$1.register("me.ColorLayer", ColorLayer, true);
|
|
38311
|
+
pool$1.register("me.Vector2d", Vector2d, true);
|
|
38312
|
+
pool$1.register("me.Vector3d", Vector3d, true);
|
|
38313
|
+
pool$1.register("me.ObservableVector2d", ObservableVector2d, true);
|
|
38314
|
+
pool$1.register("me.ObservableVector3d", ObservableVector3d, true);
|
|
38315
|
+
pool$1.register("me.Matrix2d", Matrix2d, true);
|
|
38316
|
+
pool$1.register("me.Matrix3d", Matrix3d, true);
|
|
38317
|
+
pool$1.register("me.Rect", Rect, true);
|
|
38318
|
+
pool$1.register("me.RoundRect", RoundRect, true);
|
|
38319
|
+
pool$1.register("me.Polygon", Polygon, true);
|
|
38320
|
+
pool$1.register("me.Line", Line, true);
|
|
38321
|
+
pool$1.register("me.Ellipse", Ellipse, true);
|
|
38322
|
+
pool$1.register("me.Bounds", Bounds$1, true);
|
|
37503
38323
|
|
|
37504
38324
|
// duplicate all entries if use with no namespace (e.g. es6)
|
|
37505
|
-
register("Entity", Entity);
|
|
37506
|
-
register("Collectable", Collectable);
|
|
37507
|
-
register("Trigger", Trigger);
|
|
37508
|
-
register("Tween", Tween, true);
|
|
37509
|
-
register("Color", Color, true);
|
|
37510
|
-
register("Particle", Particle, true);
|
|
37511
|
-
register("Sprite", Sprite);
|
|
37512
|
-
register("NineSliceSprite", NineSliceSprite);
|
|
37513
|
-
register("Renderable", Renderable);
|
|
37514
|
-
register("Text", Text, true);
|
|
37515
|
-
register("BitmapText", BitmapText);
|
|
37516
|
-
register("BitmapTextData", BitmapTextData, true);
|
|
37517
|
-
register("ImageLayer", ImageLayer);
|
|
37518
|
-
register("ColorLayer", ColorLayer, true);
|
|
37519
|
-
register("Vector2d", Vector2d, true);
|
|
37520
|
-
register("Vector3d", Vector3d, true);
|
|
37521
|
-
register("ObservableVector2d", ObservableVector2d, true);
|
|
37522
|
-
register("ObservableVector3d", ObservableVector3d, true);
|
|
37523
|
-
register("Matrix2d", Matrix2d, true);
|
|
37524
|
-
register("Matrix3d", Matrix3d, true);
|
|
37525
|
-
register("Rect", Rect, true);
|
|
37526
|
-
register("
|
|
37527
|
-
register("
|
|
37528
|
-
register("
|
|
37529
|
-
register("
|
|
38325
|
+
pool$1.register("Entity", Entity);
|
|
38326
|
+
pool$1.register("Collectable", Collectable);
|
|
38327
|
+
pool$1.register("Trigger", Trigger);
|
|
38328
|
+
pool$1.register("Tween", Tween, true);
|
|
38329
|
+
pool$1.register("Color", Color, true);
|
|
38330
|
+
pool$1.register("Particle", Particle, true);
|
|
38331
|
+
pool$1.register("Sprite", Sprite);
|
|
38332
|
+
pool$1.register("NineSliceSprite", NineSliceSprite);
|
|
38333
|
+
pool$1.register("Renderable", Renderable);
|
|
38334
|
+
pool$1.register("Text", Text, true);
|
|
38335
|
+
pool$1.register("BitmapText", BitmapText);
|
|
38336
|
+
pool$1.register("BitmapTextData", BitmapTextData, true);
|
|
38337
|
+
pool$1.register("ImageLayer", ImageLayer);
|
|
38338
|
+
pool$1.register("ColorLayer", ColorLayer, true);
|
|
38339
|
+
pool$1.register("Vector2d", Vector2d, true);
|
|
38340
|
+
pool$1.register("Vector3d", Vector3d, true);
|
|
38341
|
+
pool$1.register("ObservableVector2d", ObservableVector2d, true);
|
|
38342
|
+
pool$1.register("ObservableVector3d", ObservableVector3d, true);
|
|
38343
|
+
pool$1.register("Matrix2d", Matrix2d, true);
|
|
38344
|
+
pool$1.register("Matrix3d", Matrix3d, true);
|
|
38345
|
+
pool$1.register("Rect", Rect, true);
|
|
38346
|
+
pool$1.register("RoundRect", RoundRect, true);
|
|
38347
|
+
pool$1.register("Polygon", Polygon, true);
|
|
38348
|
+
pool$1.register("Line", Line, true);
|
|
38349
|
+
pool$1.register("Ellipse", Ellipse, true);
|
|
38350
|
+
pool$1.register("Bounds", Bounds$1, true);
|
|
37530
38351
|
|
|
37531
38352
|
// publish Boot notification
|
|
37532
38353
|
emit(BOOT);
|
|
@@ -37582,6 +38403,7 @@
|
|
|
37582
38403
|
exports.Rect = Rect;
|
|
37583
38404
|
exports.Renderable = Renderable;
|
|
37584
38405
|
exports.Renderer = Renderer;
|
|
38406
|
+
exports.RoundRect = RoundRect;
|
|
37585
38407
|
exports.Sprite = Sprite;
|
|
37586
38408
|
exports.Stage = Stage;
|
|
37587
38409
|
exports.TMXHexagonalRenderer = TMXHexagonalRenderer;
|
|
@@ -37614,7 +38436,7 @@
|
|
|
37614
38436
|
exports.loader = loader;
|
|
37615
38437
|
exports.plugin = plugin;
|
|
37616
38438
|
exports.plugins = plugins;
|
|
37617
|
-
exports.pool =
|
|
38439
|
+
exports.pool = pool$1;
|
|
37618
38440
|
exports.save = save;
|
|
37619
38441
|
exports.skipAutoInit = skipAutoInit;
|
|
37620
38442
|
exports.state = state;
|