melonjs 10.7.1 → 10.8.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 +1131 -652
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +1038 -198
- package/dist/melonjs.module.js +1234 -763
- package/package.json +7 -7
- 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 +67 -0
- package/src/index.js +5 -1
- 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/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 +1 -1
- 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/video/canvas/canvas_renderer.js +89 -34
- package/src/video/renderer.js +26 -14
- 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 +123 -181
package/dist/melonjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v10.
|
|
2
|
+
* melonJS Game Engine - v10.8.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);
|
|
@@ -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
|
/**
|
|
@@ -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,75 @@
|
|
|
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
|
+
* clone this RoundRect
|
|
22495
|
+
* @name clone
|
|
22496
|
+
* @memberof RoundRect.prototype
|
|
22497
|
+
* @function
|
|
22498
|
+
* @returns {RoundRect} new RoundRect
|
|
22499
|
+
*/
|
|
22500
|
+
RoundRect.prototype.clone = function clone () {
|
|
22501
|
+
return new RoundRect(this.pos.x, this.pos.y, this.width, this.height, this.radius);
|
|
22502
|
+
};
|
|
22503
|
+
|
|
22504
|
+
Object.defineProperties( RoundRect.prototype, prototypeAccessors );
|
|
22505
|
+
|
|
22506
|
+
return RoundRect;
|
|
22507
|
+
}(Rect));
|
|
22508
|
+
|
|
22423
22509
|
/**
|
|
22424
22510
|
* @classdesc
|
|
22425
22511
|
* a line segment Object
|
|
@@ -22484,11 +22570,11 @@
|
|
|
22484
22570
|
|
|
22485
22571
|
// Calculate the edges/normals
|
|
22486
22572
|
if (edges[0] === undefined) {
|
|
22487
|
-
edges[0] =
|
|
22573
|
+
edges[0] = pool$1.pull("Vector2d");
|
|
22488
22574
|
}
|
|
22489
22575
|
edges[0].copy(points[1]).sub(points[0]);
|
|
22490
22576
|
if (normals[0] === undefined) {
|
|
22491
|
-
normals[0] =
|
|
22577
|
+
normals[0] = pool$1.pull("Vector2d");
|
|
22492
22578
|
}
|
|
22493
22579
|
normals[0].copy(edges[0]).perp().normalize();
|
|
22494
22580
|
|
|
@@ -22517,6 +22603,323 @@
|
|
|
22517
22603
|
return Line;
|
|
22518
22604
|
}(Polygon));
|
|
22519
22605
|
|
|
22606
|
+
/**
|
|
22607
|
+
* @classdesc
|
|
22608
|
+
* a simplified path2d implementation, supporting only one path
|
|
22609
|
+
*/
|
|
22610
|
+
var Path2D = function Path2D() {
|
|
22611
|
+
/**
|
|
22612
|
+
* the points defining the current path
|
|
22613
|
+
* @public
|
|
22614
|
+
* @type {Vector2d[]}
|
|
22615
|
+
* @name points
|
|
22616
|
+
* @memberof Path2D#
|
|
22617
|
+
*/
|
|
22618
|
+
this.points = [];
|
|
22619
|
+
|
|
22620
|
+
/**
|
|
22621
|
+
* space between interpolated points for quadratic and bezier curve approx. in pixels.
|
|
22622
|
+
* @public
|
|
22623
|
+
* @type {number}
|
|
22624
|
+
* @name arcResolution
|
|
22625
|
+
* @default 5
|
|
22626
|
+
* @memberof Path2D#
|
|
22627
|
+
*/
|
|
22628
|
+
this.arcResolution = 5;
|
|
22629
|
+
|
|
22630
|
+
/* @ignore */
|
|
22631
|
+
this.vertices = [];
|
|
22632
|
+
};
|
|
22633
|
+
|
|
22634
|
+
/**
|
|
22635
|
+
* begin a new path
|
|
22636
|
+
* @name beginPath
|
|
22637
|
+
* @memberof Path2D.prototype
|
|
22638
|
+
* @function
|
|
22639
|
+
*/
|
|
22640
|
+
Path2D.prototype.beginPath = function beginPath () {
|
|
22641
|
+
// empty the cache and recycle all vectors
|
|
22642
|
+
this.points.forEach(function (point) {
|
|
22643
|
+
pool$1.push(point);
|
|
22644
|
+
});
|
|
22645
|
+
this.points.length = 0;
|
|
22646
|
+
};
|
|
22647
|
+
|
|
22648
|
+
/**
|
|
22649
|
+
* causes the point of the pen to move back to the start of the current path.
|
|
22650
|
+
* It tries to draw a straight line from the current point to the start.
|
|
22651
|
+
* If the shape has already been closed or has only one point, this function does nothing.
|
|
22652
|
+
* @name closePath
|
|
22653
|
+
* @memberof Path2D.prototype
|
|
22654
|
+
* @function
|
|
22655
|
+
*/
|
|
22656
|
+
Path2D.prototype.closePath = function closePath () {
|
|
22657
|
+
var points = this.points;
|
|
22658
|
+
if (points.length > 1 && !points[points.length-1].equals(points[0])) {
|
|
22659
|
+
points.push(pool$1.pull("Vector2d", points[0].x, points[0].y));
|
|
22660
|
+
}
|
|
22661
|
+
};
|
|
22662
|
+
|
|
22663
|
+
/**
|
|
22664
|
+
* triangulate the shape defined by this path into an array of triangles
|
|
22665
|
+
* @name triangulatePath
|
|
22666
|
+
* @memberof Path2D.prototype
|
|
22667
|
+
* @function
|
|
22668
|
+
* @returns {Vector2d[]}
|
|
22669
|
+
*/
|
|
22670
|
+
Path2D.prototype.triangulatePath = function triangulatePath () {
|
|
22671
|
+
var i = 0;
|
|
22672
|
+
var points = this.points;
|
|
22673
|
+
var vertices = this.vertices;
|
|
22674
|
+
var indices = earcut$1.exports(points.flatMap(function (p) { return [p.x, p.y]; }));
|
|
22675
|
+
|
|
22676
|
+
// calculate all vertices
|
|
22677
|
+
for (i = 0; i < indices.length; i++ ) {
|
|
22678
|
+
if (typeof vertices[i] === "undefined") {
|
|
22679
|
+
// increase cache buffer if necessary
|
|
22680
|
+
vertices[i] = pool$1.pull("Vector2d");
|
|
22681
|
+
}
|
|
22682
|
+
vertices[i].set(points[indices[i]].x, points[indices[i]].y);
|
|
22683
|
+
}
|
|
22684
|
+
|
|
22685
|
+
// recycle overhead from a previous triangulation
|
|
22686
|
+
while (vertices.length > indices.length) {
|
|
22687
|
+
pool$1.push(vertices[vertices.length-1]);
|
|
22688
|
+
vertices.length -= 1;
|
|
22689
|
+
}
|
|
22690
|
+
|
|
22691
|
+
return vertices;
|
|
22692
|
+
};
|
|
22693
|
+
|
|
22694
|
+
/**
|
|
22695
|
+
* moves the starting point of the current path to the (x, y) coordinates.
|
|
22696
|
+
* @name moveTo
|
|
22697
|
+
* @memberof Path2D.prototype
|
|
22698
|
+
* @function
|
|
22699
|
+
* @param {number} x the x-axis (horizontal) coordinate of the point.
|
|
22700
|
+
* @param {number} y the y-axis (vertical) coordinate of the point.
|
|
22701
|
+
*/
|
|
22702
|
+
Path2D.prototype.moveTo = function moveTo (x, y) {
|
|
22703
|
+
this.points.push(pool$1.pull("Vector2d", x, y));
|
|
22704
|
+
};
|
|
22705
|
+
|
|
22706
|
+
/**
|
|
22707
|
+
* connects the last point in the current patch to the (x, y) coordinates with a straight line.
|
|
22708
|
+
* @name lineTo
|
|
22709
|
+
* @memberof Path2D.prototype
|
|
22710
|
+
* @function
|
|
22711
|
+
* @param {number} x the x-axis coordinate of the line's end point.
|
|
22712
|
+
* @param {number} y the y-axis coordinate of the line's end point.
|
|
22713
|
+
*/
|
|
22714
|
+
Path2D.prototype.lineTo = function lineTo (x, y) {
|
|
22715
|
+
this.points.push(pool$1.pull("Vector2d", x, y));
|
|
22716
|
+
};
|
|
22717
|
+
|
|
22718
|
+
/**
|
|
22719
|
+
* adds an arc to the current path which is centered at (x, y) position with the given radius,
|
|
22720
|
+
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise (defaulting to clockwise).
|
|
22721
|
+
* @name arc
|
|
22722
|
+
* @memberof Path2D.prototype
|
|
22723
|
+
* @function
|
|
22724
|
+
* @param {number} x the horizontal coordinate of the arc's center.
|
|
22725
|
+
* @param {number} y the vertical coordinate of the arc's center.
|
|
22726
|
+
* @param {number} radius the arc's radius. Must be positive.
|
|
22727
|
+
* @param {number} startAngle the angle at which the arc starts in radians, measured from the positive x-axis.
|
|
22728
|
+
* @param {number} endAngle the angle at which the arc ends in radians, measured from the positive x-axis.
|
|
22729
|
+
* @param {boolean} [anticlockwise=false] an optional boolean value. If true, draws the arc counter-clockwise between the start and end angles.
|
|
22730
|
+
*/
|
|
22731
|
+
Path2D.prototype.arc = function arc (x, y, radius, startAngle, endAngle, anticlockwise) {
|
|
22732
|
+
if ( anticlockwise === void 0 ) anticlockwise = false;
|
|
22733
|
+
|
|
22734
|
+
var points = this.points;
|
|
22735
|
+
// based on from https://github.com/karellodewijk/canvas-webgl/blob/master/canvas-webgl.js
|
|
22736
|
+
//bring angles all in [0, 2*PI] range
|
|
22737
|
+
if (startAngle === endAngle) { return; }
|
|
22738
|
+
var fullCircle = anticlockwise ? Math.abs(startAngle-endAngle) >= (TAU) : Math.abs(endAngle-startAngle) >= (TAU);
|
|
22739
|
+
|
|
22740
|
+
startAngle = startAngle % (TAU);
|
|
22741
|
+
endAngle = endAngle % (TAU);
|
|
22742
|
+
|
|
22743
|
+
if (startAngle < 0) { startAngle += TAU; }
|
|
22744
|
+
if (endAngle < 0) { endAngle += TAU; }
|
|
22745
|
+
|
|
22746
|
+
if (startAngle >= endAngle) {
|
|
22747
|
+
endAngle+= TAU;
|
|
22748
|
+
}
|
|
22749
|
+
|
|
22750
|
+
var diff = endAngle - startAngle;
|
|
22751
|
+
var direction = 1;
|
|
22752
|
+
if (anticlockwise) {
|
|
22753
|
+
direction = -1;
|
|
22754
|
+
diff = TAU - diff;
|
|
22755
|
+
}
|
|
22756
|
+
|
|
22757
|
+
if (fullCircle) { diff = TAU; }
|
|
22758
|
+
|
|
22759
|
+
var length = diff * radius;
|
|
22760
|
+
var nr_of_interpolation_points = length / this.arcResolution;
|
|
22761
|
+
var dangle = diff / nr_of_interpolation_points;
|
|
22762
|
+
|
|
22763
|
+
var angle = startAngle;
|
|
22764
|
+
for (var j = 0; j < nr_of_interpolation_points; j++) {
|
|
22765
|
+
points.push(pool$1.pull("Vector2d", x + radius * Math.cos(angle), y + radius * Math.sin(angle)));
|
|
22766
|
+
angle += direction * dangle;
|
|
22767
|
+
}
|
|
22768
|
+
points.push(pool$1.pull("Vector2d", x + radius * Math.cos(endAngle), y + radius * Math.sin(endAngle)));
|
|
22769
|
+
};
|
|
22770
|
+
|
|
22771
|
+
/**
|
|
22772
|
+
* adds a circular arc to the path with the given control points and radius, connected to the previous point by a straight line.
|
|
22773
|
+
* @name arcTo
|
|
22774
|
+
* @memberof Path2D.prototype
|
|
22775
|
+
* @function
|
|
22776
|
+
* @param {number} x the x-axis coordinate of the first control point.
|
|
22777
|
+
* @param {number} y the y-axis coordinate of the first control point.
|
|
22778
|
+
* @param {number} x the x-axis coordinate of the second control point.
|
|
22779
|
+
* @param {number} y the y-axis coordinate of the second control point.
|
|
22780
|
+
* @param {number} radius the arc's radius. Must be positive.
|
|
22781
|
+
*/
|
|
22782
|
+
Path2D.prototype.arcTo = function arcTo (x1, y1, x2, y2, radius) {
|
|
22783
|
+
var points = this.points;
|
|
22784
|
+
// based on from https://github.com/karellodewijk/canvas-webgl/blob/master/canvas-webgl.js
|
|
22785
|
+
var x0 = points[points.length-1].x, y0 = points[points.length-1].y;
|
|
22786
|
+
|
|
22787
|
+
//a = -incoming vector, b = outgoing vector to x1, y1
|
|
22788
|
+
var a = [x0 - x1, y0 - y1];
|
|
22789
|
+
var b = [x2 - x1, y2 - y1];
|
|
22790
|
+
|
|
22791
|
+
//normalize
|
|
22792
|
+
var l_a = Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2));
|
|
22793
|
+
var l_b = Math.sqrt(Math.pow(b[0], 2) + Math.pow(b[1], 2));
|
|
22794
|
+
a[0] /= l_a; a[1] /= l_a; b[0] /= l_b; b[1] /= l_b;
|
|
22795
|
+
var angle = Math.atan2(a[1], a[0]) - Math.atan2(b[1], b[0]);
|
|
22796
|
+
|
|
22797
|
+
//work out tangent points using tan(θ) = opposite / adjacent; angle/2 because hypotenuse is the bisection of a,b
|
|
22798
|
+
var tan_angle_div2 = Math.tan(angle/2);
|
|
22799
|
+
var adj_l = (radius/tan_angle_div2);
|
|
22800
|
+
|
|
22801
|
+
var tangent_point1 = [x1 + a[0] * adj_l, y1 + a[1] * adj_l];
|
|
22802
|
+
var tangent_point2 = [x1 + b[0] * adj_l, y1 + b[1] * adj_l];
|
|
22803
|
+
|
|
22804
|
+
points.push(pool$1.pull("Vector2d", tangent_point1[0], tangent_point1[1]));
|
|
22805
|
+
|
|
22806
|
+
var bisec = [(a[0] + b[0]) / 2.0, (a[1] + b[1]) / 2.0];
|
|
22807
|
+
var bisec_l = Math.sqrt(Math.pow(bisec[0], 2) + Math.pow(bisec[1], 2));
|
|
22808
|
+
bisec[0] /= bisec_l; bisec[1] /= bisec_l;
|
|
22809
|
+
|
|
22810
|
+
var hyp_l = Math.sqrt(Math.pow(radius, 2) + Math.pow(adj_l, 2));
|
|
22811
|
+
var center = [x1 + hyp_l * bisec[0], y1 + hyp_l * bisec[1]];
|
|
22812
|
+
|
|
22813
|
+
var startAngle = Math.atan2(tangent_point1[1] - center[1], tangent_point1[0] - center[0]);
|
|
22814
|
+
var endAngle = Math.atan2(tangent_point2[1] - center[1], tangent_point2[0] - center[0]);
|
|
22815
|
+
|
|
22816
|
+
this.arc(center[0], center[1], radius, startAngle, endAngle);
|
|
22817
|
+
};
|
|
22818
|
+
|
|
22819
|
+
/**
|
|
22820
|
+
* adds an elliptical arc to the path which is centered at (x, y) position with the radii radiusX and radiusY
|
|
22821
|
+
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise.
|
|
22822
|
+
* @name ellipse
|
|
22823
|
+
* @memberof Path2D.prototype
|
|
22824
|
+
* @function
|
|
22825
|
+
* @param {number} x the x-axis (horizontal) coordinate of the ellipse's center.
|
|
22826
|
+
* @param {number} y the y-axis (vertical) coordinate of the ellipse's center.
|
|
22827
|
+
* @param {number} radiusX the ellipse's major-axis radius. Must be non-negative.
|
|
22828
|
+
* @param {number} radiusY the ellipse's minor-axis radius. Must be non-negative.
|
|
22829
|
+
* @param {number} rotation the rotation of the ellipse, expressed in radians.
|
|
22830
|
+
* @param {number} startAngle the angle at which the ellipse starts, measured clockwise from the positive x-axis and expressed in radians.
|
|
22831
|
+
* @param {number} endAngle the angle at which the ellipse ends, measured clockwise from the positive x-axis and expressed in radians.
|
|
22832
|
+
* @param {boolean} [anticlockwise=false] an optional boolean value which, if true, draws the ellipse counterclockwise (anticlockwise).
|
|
22833
|
+
*/
|
|
22834
|
+
Path2D.prototype.ellipse = function ellipse (x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) {
|
|
22835
|
+
if ( anticlockwise === void 0 ) anticlockwise = false;
|
|
22836
|
+
|
|
22837
|
+
var points = this.points;
|
|
22838
|
+
// based on from https://github.com/karellodewijk/canvas-webgl/blob/master/canvas-webgl.js
|
|
22839
|
+
if (startAngle === endAngle) { return; }
|
|
22840
|
+
var fullCircle = anticlockwise ? Math.abs(startAngle-endAngle) >= (TAU) : Math.abs(endAngle-startAngle) >= (TAU);
|
|
22841
|
+
|
|
22842
|
+
//bring angles all in [0, 2*PI] range
|
|
22843
|
+
startAngle = startAngle % (TAU);
|
|
22844
|
+
endAngle = endAngle % (TAU);
|
|
22845
|
+
if (startAngle < 0) { startAngle += TAU; }
|
|
22846
|
+
if (endAngle < 0) { endAngle += TAU; }
|
|
22847
|
+
|
|
22848
|
+
if (startAngle>=endAngle) {
|
|
22849
|
+
endAngle += TAU;
|
|
22850
|
+
}
|
|
22851
|
+
|
|
22852
|
+
var diff = endAngle - startAngle;
|
|
22853
|
+
|
|
22854
|
+
var direction = 1;
|
|
22855
|
+
if (anticlockwise) {
|
|
22856
|
+
direction = -1;
|
|
22857
|
+
diff = TAU - diff;
|
|
22858
|
+
}
|
|
22859
|
+
|
|
22860
|
+
if (fullCircle) { diff = TAU; }
|
|
22861
|
+
|
|
22862
|
+
var length = (diff * radiusX + diff * radiusY) / 2;
|
|
22863
|
+
var nr_of_interpolation_points = length / this.arcResolution;
|
|
22864
|
+
var dangle = diff / nr_of_interpolation_points;
|
|
22865
|
+
|
|
22866
|
+
var angle = startAngle;
|
|
22867
|
+
var cos_rotation = Math.cos(rotation);
|
|
22868
|
+
var sin_rotation = Math.sin(rotation);
|
|
22869
|
+
for (var j = 0; j < nr_of_interpolation_points; j++) {
|
|
22870
|
+
var _x1 = radiusX * Math.cos(angle);
|
|
22871
|
+
var _y1 = radiusY * Math.sin(angle);
|
|
22872
|
+
var _x2 = x + _x1 * cos_rotation - _y1 * sin_rotation;
|
|
22873
|
+
var _y2 = y + _x1 * sin_rotation + _y1 * cos_rotation;
|
|
22874
|
+
points.push(pool$1.pull("Vector2d", _x2, _y2));
|
|
22875
|
+
angle += direction * dangle;
|
|
22876
|
+
}
|
|
22877
|
+
//var x1 = radiusX * Math.cos(endAngle);
|
|
22878
|
+
//var y1 = radiusY * Math.sin(endAngle);
|
|
22879
|
+
//points.push(pool.pull("Vector2d", x + x1 * cos_rotation - y1 * sin_rotation, y + x1 * sin_rotation + y1 * cos_rotation));
|
|
22880
|
+
};
|
|
22881
|
+
|
|
22882
|
+
/**
|
|
22883
|
+
* creates a path for a rectangle at position (x, y) with a size that is determined by width and height.
|
|
22884
|
+
* @name rect
|
|
22885
|
+
* @memberof Path2D.prototype
|
|
22886
|
+
* @function
|
|
22887
|
+
* @param {number} x the x-axis coordinate of the rectangle's starting point.
|
|
22888
|
+
* @param {number} y the y-axis coordinate of the rectangle's starting point.
|
|
22889
|
+
* @param {number} width the rectangle's width. Positive values are to the right, and negative to the left.
|
|
22890
|
+
* @param {number} height the rectangle's height. Positive values are down, and negative are up.
|
|
22891
|
+
*/
|
|
22892
|
+
Path2D.prototype.rect = function rect (x, y, width, height) {
|
|
22893
|
+
this.moveTo(x, y);
|
|
22894
|
+
this.lineTo(x + width, y);
|
|
22895
|
+
this.lineTo(x + width, y + height);
|
|
22896
|
+
this.lineTo(x, y + height);
|
|
22897
|
+
this.lineTo(x, y);
|
|
22898
|
+
};
|
|
22899
|
+
|
|
22900
|
+
/**
|
|
22901
|
+
* adds an rounded rectangle to the current path.
|
|
22902
|
+
* @name roundRect
|
|
22903
|
+
* @memberof Path2D.prototype
|
|
22904
|
+
* @function
|
|
22905
|
+
* @param {number} x the x-axis coordinate of the rectangle's starting point.
|
|
22906
|
+
* @param {number} y the y-axis coordinate of the rectangle's starting point.
|
|
22907
|
+
* @param {number} width the rectangle's width. Positive values are to the right, and negative to the left.
|
|
22908
|
+
* @param {number} height the rectangle's height. Positive values are down, and negative are up.
|
|
22909
|
+
* @param {number} radius the arc's radius to draw the borders. Must be positive.
|
|
22910
|
+
*/
|
|
22911
|
+
Path2D.prototype.roundRect = function roundRect (x, y, width, height, radius) {
|
|
22912
|
+
this.moveTo(x + radius, y);
|
|
22913
|
+
this.lineTo(x + width - radius, y);
|
|
22914
|
+
this.arcTo(x + width, y, x + width, y + radius, radius);
|
|
22915
|
+
this.lineTo(x + width, y + height - radius);
|
|
22916
|
+
this.arcTo(x + width, y + height, x + width - radius, y + height, radius);
|
|
22917
|
+
this.lineTo(x + radius, y + height);
|
|
22918
|
+
this.arcTo(x, y + height, x, y + height - radius, radius);
|
|
22919
|
+
this.lineTo(x, y + radius);
|
|
22920
|
+
this.arcTo(x, y, x + radius, y, radius);
|
|
22921
|
+
};
|
|
22922
|
+
|
|
22520
22923
|
/**
|
|
22521
22924
|
* @classdesc
|
|
22522
22925
|
* a base renderer object
|
|
@@ -22534,12 +22937,20 @@
|
|
|
22534
22937
|
/**
|
|
22535
22938
|
* true if the current rendering context is valid
|
|
22536
22939
|
* @name isContextValid
|
|
22537
|
-
* @memberof Renderer
|
|
22940
|
+
* @memberof Renderer#
|
|
22538
22941
|
* @default true
|
|
22539
22942
|
* type {boolean}
|
|
22540
22943
|
*/
|
|
22541
22944
|
this.isContextValid = true;
|
|
22542
22945
|
|
|
22946
|
+
/**
|
|
22947
|
+
* The Path2D instance used by the renderer to draw primitives
|
|
22948
|
+
* @name path2D
|
|
22949
|
+
* @type {Path2D}
|
|
22950
|
+
* @memberof Renderer#
|
|
22951
|
+
*/
|
|
22952
|
+
this.path2D = new Path2D();
|
|
22953
|
+
|
|
22543
22954
|
/**
|
|
22544
22955
|
* @ignore
|
|
22545
22956
|
*/
|
|
@@ -22822,11 +23233,13 @@
|
|
|
22822
23233
|
* @name stroke
|
|
22823
23234
|
* @memberof Renderer.prototype
|
|
22824
23235
|
* @function
|
|
22825
|
-
* @param {Rect|Polygon|Line|Ellipse} shape a shape object to stroke
|
|
23236
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to stroke
|
|
22826
23237
|
* @param {boolean} [fill=false] fill the shape with the current color if true
|
|
22827
23238
|
*/
|
|
22828
23239
|
Renderer.prototype.stroke = function stroke (shape, fill) {
|
|
22829
|
-
if (shape instanceof
|
|
23240
|
+
if (shape instanceof RoundRect) {
|
|
23241
|
+
this.strokeRoundRect(shape.left, shape.top, shape.width, shape.height, shape.radius, fill);
|
|
23242
|
+
} else if (shape instanceof Rect || shape instanceof Bounds$1) {
|
|
22830
23243
|
this.strokeRect(shape.left, shape.top, shape.width, shape.height, fill);
|
|
22831
23244
|
} else if (shape instanceof Line || shape instanceof Polygon) {
|
|
22832
23245
|
this.strokePolygon(shape, fill);
|
|
@@ -22841,6 +23254,17 @@
|
|
|
22841
23254
|
}
|
|
22842
23255
|
};
|
|
22843
23256
|
|
|
23257
|
+
/**
|
|
23258
|
+
* fill the given shape
|
|
23259
|
+
* @name fill
|
|
23260
|
+
* @memberof Renderer.prototype
|
|
23261
|
+
* @function
|
|
23262
|
+
* @param {Rect|Polygon|Line|Ellipse} shape a shape object to fill
|
|
23263
|
+
*/
|
|
23264
|
+
Renderer.prototype.fill = function fill (shape) {
|
|
23265
|
+
this.stroke(shape, true);
|
|
23266
|
+
};
|
|
23267
|
+
|
|
22844
23268
|
/**
|
|
22845
23269
|
* tint the given image or canvas using the given color
|
|
22846
23270
|
* @name tint
|
|
@@ -22870,17 +23294,6 @@
|
|
|
22870
23294
|
return canvas;
|
|
22871
23295
|
};
|
|
22872
23296
|
|
|
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
23297
|
/**
|
|
22885
23298
|
* A mask limits rendering elements to the shape and position of the given mask object.
|
|
22886
23299
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
@@ -23115,7 +23528,7 @@
|
|
|
23115
23528
|
* @param {number} height The rectangle's height.
|
|
23116
23529
|
*/
|
|
23117
23530
|
CanvasRenderer.prototype.clearRect = function clearRect (x, y, width, height) {
|
|
23118
|
-
this.
|
|
23531
|
+
this.getContext().clearRect(x, y, width, height);
|
|
23119
23532
|
};
|
|
23120
23533
|
|
|
23121
23534
|
/**
|
|
@@ -23134,7 +23547,7 @@
|
|
|
23134
23547
|
* var basic = renderer.createPattern(image, "no-repeat");
|
|
23135
23548
|
*/
|
|
23136
23549
|
CanvasRenderer.prototype.createPattern = function createPattern (image, repeat) {
|
|
23137
|
-
return this.
|
|
23550
|
+
return this.getContext().createPattern(image, repeat);
|
|
23138
23551
|
};
|
|
23139
23552
|
|
|
23140
23553
|
/**
|
|
@@ -23160,10 +23573,11 @@
|
|
|
23160
23573
|
* renderer.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight);
|
|
23161
23574
|
*/
|
|
23162
23575
|
CanvasRenderer.prototype.drawImage = function drawImage (image, sx, sy, sw, sh, dx, dy, dw, dh) {
|
|
23163
|
-
if (this.
|
|
23576
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23164
23577
|
// Fast path: don't draw fully transparent
|
|
23165
23578
|
return;
|
|
23166
23579
|
}
|
|
23580
|
+
var context = this.getContext();
|
|
23167
23581
|
|
|
23168
23582
|
if (typeof sw === "undefined") {
|
|
23169
23583
|
sw = dw = image.width;
|
|
@@ -23197,7 +23611,7 @@
|
|
|
23197
23611
|
// get a tinted version of this image from the texture cache
|
|
23198
23612
|
source = this.cache.tint(image, this.currentTint.toRGB());
|
|
23199
23613
|
}
|
|
23200
|
-
|
|
23614
|
+
context.drawImage(source, sx, sy, sw, sh, dx, dy, dw, dh);
|
|
23201
23615
|
};
|
|
23202
23616
|
|
|
23203
23617
|
/**
|
|
@@ -23213,14 +23627,15 @@
|
|
|
23213
23627
|
* @see CanvasRenderer#createPattern
|
|
23214
23628
|
*/
|
|
23215
23629
|
CanvasRenderer.prototype.drawPattern = function drawPattern (pattern, x, y, width, height) {
|
|
23216
|
-
if (this.
|
|
23630
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23217
23631
|
// Fast path: don't draw fully transparent
|
|
23218
23632
|
return;
|
|
23219
23633
|
}
|
|
23220
|
-
var
|
|
23221
|
-
|
|
23222
|
-
|
|
23223
|
-
|
|
23634
|
+
var context = this.getContext();
|
|
23635
|
+
var fillStyle = context.fillStyle;
|
|
23636
|
+
context.fillStyle = pattern;
|
|
23637
|
+
context.fillRect(x, y, width, height);
|
|
23638
|
+
context.fillStyle = fillStyle;
|
|
23224
23639
|
};
|
|
23225
23640
|
|
|
23226
23641
|
/**
|
|
@@ -23239,12 +23654,12 @@
|
|
|
23239
23654
|
CanvasRenderer.prototype.strokeArc = function strokeArc (x, y, radius, start, end, antiClockwise, fill) {
|
|
23240
23655
|
if ( fill === void 0 ) fill = false;
|
|
23241
23656
|
|
|
23242
|
-
|
|
23243
|
-
|
|
23244
|
-
if (context.globalAlpha < 1 / 255) {
|
|
23657
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23245
23658
|
// Fast path: don't draw fully transparent
|
|
23246
23659
|
return;
|
|
23247
23660
|
}
|
|
23661
|
+
var context = this.getContext();
|
|
23662
|
+
|
|
23248
23663
|
context.translate(x, y);
|
|
23249
23664
|
context.beginPath();
|
|
23250
23665
|
context.arc(0, 0, radius, start, end, antiClockwise || false);
|
|
@@ -23282,12 +23697,11 @@
|
|
|
23282
23697
|
CanvasRenderer.prototype.strokeEllipse = function strokeEllipse (x, y, w, h, fill) {
|
|
23283
23698
|
if ( fill === void 0 ) fill = false;
|
|
23284
23699
|
|
|
23285
|
-
|
|
23286
|
-
|
|
23287
|
-
if (context.globalAlpha < 1 / 255) {
|
|
23700
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23288
23701
|
// Fast path: don't draw fully transparent
|
|
23289
23702
|
return;
|
|
23290
23703
|
}
|
|
23704
|
+
var context = this.getContext();
|
|
23291
23705
|
|
|
23292
23706
|
var hw = w,
|
|
23293
23707
|
hh = h,
|
|
@@ -23338,9 +23752,7 @@
|
|
|
23338
23752
|
* @param {number} endY the end y coordinate
|
|
23339
23753
|
*/
|
|
23340
23754
|
CanvasRenderer.prototype.strokeLine = function strokeLine (startX, startY, endX, endY) {
|
|
23341
|
-
|
|
23342
|
-
|
|
23343
|
-
if (context < 1 / 255) {
|
|
23755
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23344
23756
|
// Fast path: don't draw fully transparent
|
|
23345
23757
|
return;
|
|
23346
23758
|
}
|
|
@@ -23376,12 +23788,11 @@
|
|
|
23376
23788
|
CanvasRenderer.prototype.strokePolygon = function strokePolygon (poly, fill) {
|
|
23377
23789
|
if ( fill === void 0 ) fill = false;
|
|
23378
23790
|
|
|
23379
|
-
|
|
23380
|
-
|
|
23381
|
-
if (context.globalAlpha < 1 / 255) {
|
|
23791
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23382
23792
|
// Fast path: don't draw fully transparent
|
|
23383
23793
|
return;
|
|
23384
23794
|
}
|
|
23795
|
+
var context = this.getContext();
|
|
23385
23796
|
|
|
23386
23797
|
this.translate(poly.pos.x, poly.pos.y);
|
|
23387
23798
|
context.beginPath();
|
|
@@ -23422,15 +23833,13 @@
|
|
|
23422
23833
|
CanvasRenderer.prototype.strokeRect = function strokeRect (x, y, width, height, fill) {
|
|
23423
23834
|
if ( fill === void 0 ) fill = false;
|
|
23424
23835
|
|
|
23425
|
-
if (
|
|
23426
|
-
|
|
23427
|
-
|
|
23428
|
-
if (this.backBufferContext2D.globalAlpha < 1 / 255) {
|
|
23429
|
-
// Fast path: don't draw fully transparent
|
|
23430
|
-
return;
|
|
23431
|
-
}
|
|
23432
|
-
this.backBufferContext2D.strokeRect(x, y, width, height);
|
|
23836
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23837
|
+
// Fast path: don't draw fully transparent
|
|
23838
|
+
return;
|
|
23433
23839
|
}
|
|
23840
|
+
var context = this.getContext();
|
|
23841
|
+
|
|
23842
|
+
context[fill === true ? "fillRect" : "strokeRect"](x, y, width, height);
|
|
23434
23843
|
};
|
|
23435
23844
|
|
|
23436
23845
|
/**
|
|
@@ -23444,11 +23853,61 @@
|
|
|
23444
23853
|
* @param {number} height
|
|
23445
23854
|
*/
|
|
23446
23855
|
CanvasRenderer.prototype.fillRect = function fillRect (x, y, width, height) {
|
|
23447
|
-
|
|
23856
|
+
this.strokeRect(x, y, width, height, true);
|
|
23857
|
+
};
|
|
23858
|
+
|
|
23859
|
+
/**
|
|
23860
|
+
* Stroke a rounded rectangle at the specified coordinates
|
|
23861
|
+
* @name strokeRoundRect
|
|
23862
|
+
* @memberof CanvasRenderer.prototype
|
|
23863
|
+
* @function
|
|
23864
|
+
* @param {number} x
|
|
23865
|
+
* @param {number} y
|
|
23866
|
+
* @param {number} width
|
|
23867
|
+
* @param {number} height
|
|
23868
|
+
* @param {number} radius
|
|
23869
|
+
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
23870
|
+
*/
|
|
23871
|
+
CanvasRenderer.prototype.strokeRoundRect = function strokeRoundRect (x, y, width, height, radius, fill) {
|
|
23872
|
+
if ( fill === void 0 ) fill = false;
|
|
23873
|
+
|
|
23874
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
23448
23875
|
// Fast path: don't draw fully transparent
|
|
23449
23876
|
return;
|
|
23450
23877
|
}
|
|
23451
|
-
this.
|
|
23878
|
+
var context = this.getContext();
|
|
23879
|
+
|
|
23880
|
+
context.beginPath();
|
|
23881
|
+
if (typeof context.roundRect === "function") {
|
|
23882
|
+
//https://developer.chrome.com/blog/canvas2d/#round-rect
|
|
23883
|
+
context.roundRect(x, y, width, height, radius);
|
|
23884
|
+
} else {
|
|
23885
|
+
context.moveTo(x + radius, y);
|
|
23886
|
+
context.lineTo(x + width - radius, y);
|
|
23887
|
+
context.arcTo(x + width, y, x + width, y + radius, radius);
|
|
23888
|
+
context.lineTo(x + width, y + height - radius);
|
|
23889
|
+
context.arcTo(x + width, y + height, x + width - radius, y + height, radius);
|
|
23890
|
+
context.lineTo(x + radius, y + height);
|
|
23891
|
+
context.arcTo(x, y + height, x, y + height - radius, radius);
|
|
23892
|
+
context.lineTo(x, y + radius);
|
|
23893
|
+
context.arcTo(x, y, x + radius, y, radius);
|
|
23894
|
+
}
|
|
23895
|
+
context[fill === true ? "fill" : "stroke"]();
|
|
23896
|
+
};
|
|
23897
|
+
|
|
23898
|
+
/**
|
|
23899
|
+
* Draw a rounded filled rectangle at the specified coordinates
|
|
23900
|
+
* @name fillRoundRect
|
|
23901
|
+
* @memberof CanvasRenderer.prototype
|
|
23902
|
+
* @function
|
|
23903
|
+
* @param {number} x
|
|
23904
|
+
* @param {number} y
|
|
23905
|
+
* @param {number} width
|
|
23906
|
+
* @param {number} height
|
|
23907
|
+
* @param {number} radius
|
|
23908
|
+
*/
|
|
23909
|
+
CanvasRenderer.prototype.fillRoundRect = function fillRoundRect (x, y, width, height, radius) {
|
|
23910
|
+
this.strokeRoundRect(x, y, width, height, radius, true);
|
|
23452
23911
|
};
|
|
23453
23912
|
|
|
23454
23913
|
|
|
@@ -23490,7 +23949,7 @@
|
|
|
23490
23949
|
*/
|
|
23491
23950
|
CanvasRenderer.prototype.restore = function restore () {
|
|
23492
23951
|
this.backBufferContext2D.restore();
|
|
23493
|
-
this.currentColor.glArray[3] = this.
|
|
23952
|
+
this.currentColor.glArray[3] = this.getGlobalAlpha();
|
|
23494
23953
|
this.currentScissor[0] = 0;
|
|
23495
23954
|
this.currentScissor[1] = 0;
|
|
23496
23955
|
this.currentScissor[2] = this.backBufferCanvas.width;
|
|
@@ -23538,7 +23997,7 @@
|
|
|
23538
23997
|
};
|
|
23539
23998
|
|
|
23540
23999
|
/**
|
|
23541
|
-
* Set the global alpha
|
|
24000
|
+
* Set the global alpha
|
|
23542
24001
|
* @name setGlobalAlpha
|
|
23543
24002
|
* @memberof CanvasRenderer.prototype
|
|
23544
24003
|
* @function
|
|
@@ -23548,6 +24007,17 @@
|
|
|
23548
24007
|
this.backBufferContext2D.globalAlpha = this.currentColor.glArray[3] = alpha;
|
|
23549
24008
|
};
|
|
23550
24009
|
|
|
24010
|
+
/**
|
|
24011
|
+
* Return the global alpha
|
|
24012
|
+
* @name getGlobalAlpha
|
|
24013
|
+
* @memberof CanvasRenderer.prototype
|
|
24014
|
+
* @function
|
|
24015
|
+
* @returns {number} global alpha value
|
|
24016
|
+
*/
|
|
24017
|
+
CanvasRenderer.prototype.getGlobalAlpha = function getGlobalAlpha () {
|
|
24018
|
+
return this.backBufferContext2D.globalAlpha;
|
|
24019
|
+
};
|
|
24020
|
+
|
|
23551
24021
|
/**
|
|
23552
24022
|
* Set the line width on the context
|
|
23553
24023
|
* @name setLineWidth
|
|
@@ -23657,7 +24127,7 @@
|
|
|
23657
24127
|
* @param {Rect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
23658
24128
|
*/
|
|
23659
24129
|
CanvasRenderer.prototype.setMask = function setMask (mask) {
|
|
23660
|
-
var context = this.
|
|
24130
|
+
var context = this.getContext();
|
|
23661
24131
|
var _x = mask.pos.x, _y = mask.pos.y;
|
|
23662
24132
|
|
|
23663
24133
|
context.save();
|
|
@@ -24000,9 +24470,9 @@
|
|
|
24000
24470
|
var tile = null;
|
|
24001
24471
|
|
|
24002
24472
|
if (this.contains(x, y)) {
|
|
24003
|
-
var coord = this.getRenderer().pixelToTileCoords(x, y, pull("Vector2d"));
|
|
24473
|
+
var coord = this.getRenderer().pixelToTileCoords(x, y, pool$1.pull("Vector2d"));
|
|
24004
24474
|
tile = this.cellAt(coord.x, coord.y);
|
|
24005
|
-
push(coord);
|
|
24475
|
+
pool$1.push(coord);
|
|
24006
24476
|
}
|
|
24007
24477
|
return tile;
|
|
24008
24478
|
};
|
|
@@ -24142,6 +24612,8 @@
|
|
|
24142
24612
|
* a bound object contains methods for creating and manipulating axis-aligned bounding boxes (AABB).
|
|
24143
24613
|
*/
|
|
24144
24614
|
var Bounds = function Bounds(vertices) {
|
|
24615
|
+
// @ignore
|
|
24616
|
+
this._center = new Vector2d();
|
|
24145
24617
|
this.onResetEvent(vertices);
|
|
24146
24618
|
};
|
|
24147
24619
|
|
|
@@ -24160,9 +24632,6 @@
|
|
|
24160
24632
|
if (typeof vertices !== "undefined") {
|
|
24161
24633
|
this.update(vertices);
|
|
24162
24634
|
}
|
|
24163
|
-
|
|
24164
|
-
// @ignore
|
|
24165
|
-
this._center = new Vector2d();
|
|
24166
24635
|
};
|
|
24167
24636
|
|
|
24168
24637
|
/**
|
|
@@ -24588,11 +25057,11 @@
|
|
|
24588
25057
|
* @returns {Polygon} a new Polygon that represents this bounds.
|
|
24589
25058
|
*/
|
|
24590
25059
|
Bounds.prototype.toPolygon = function toPolygon () {
|
|
24591
|
-
return
|
|
24592
|
-
|
|
24593
|
-
|
|
24594
|
-
|
|
24595
|
-
|
|
25060
|
+
return pool$1.pull("Polygon", this.x, this.y, [
|
|
25061
|
+
pool$1.pull("Vector2d", 0, 0),
|
|
25062
|
+
pool$1.pull("Vector2d", this.width, 0),
|
|
25063
|
+
pool$1.pull("Vector2d", this.width, this.height),
|
|
25064
|
+
pool$1.pull("Vector2d", 0, this.height)
|
|
24596
25065
|
]);
|
|
24597
25066
|
};
|
|
24598
25067
|
|
|
@@ -24642,7 +25111,7 @@
|
|
|
24642
25111
|
* @returns {Bounds}
|
|
24643
25112
|
*/
|
|
24644
25113
|
TMXRenderer.prototype.getBounds = function getBounds (layer) {
|
|
24645
|
-
var bounds = layer instanceof TMXLayer ? pull("Bounds") : this.bounds;
|
|
25114
|
+
var bounds = layer instanceof TMXLayer ? pool$1.pull("Bounds") : this.bounds;
|
|
24646
25115
|
bounds.setMinMax(
|
|
24647
25116
|
0, 0,
|
|
24648
25117
|
this.cols * this.tilewidth,
|
|
@@ -24800,13 +25269,13 @@
|
|
|
24800
25269
|
var start = this.pixelToTileCoords(
|
|
24801
25270
|
Math.max(rect.pos.x - (layer.maxTileSize.width - layer.tilewidth), 0),
|
|
24802
25271
|
Math.max(rect.pos.y - (layer.maxTileSize.height - layer.tileheight), 0),
|
|
24803
|
-
pull("Vector2d")
|
|
25272
|
+
pool$1.pull("Vector2d")
|
|
24804
25273
|
).floorSelf();
|
|
24805
25274
|
|
|
24806
25275
|
var end = this.pixelToTileCoords(
|
|
24807
25276
|
rect.pos.x + rect.width + this.tilewidth,
|
|
24808
25277
|
rect.pos.y + rect.height + this.tileheight,
|
|
24809
|
-
pull("Vector2d")
|
|
25278
|
+
pool$1.pull("Vector2d")
|
|
24810
25279
|
).ceilSelf();
|
|
24811
25280
|
|
|
24812
25281
|
//ensure we are in the valid tile range
|
|
@@ -24844,8 +25313,8 @@
|
|
|
24844
25313
|
}
|
|
24845
25314
|
}
|
|
24846
25315
|
|
|
24847
|
-
push(start);
|
|
24848
|
-
push(end);
|
|
25316
|
+
pool$1.push(start);
|
|
25317
|
+
pool$1.push(end);
|
|
24849
25318
|
};
|
|
24850
25319
|
|
|
24851
25320
|
return TMXOrthogonalRenderer;
|
|
@@ -24894,7 +25363,7 @@
|
|
|
24894
25363
|
* @returns {Bounds}
|
|
24895
25364
|
*/
|
|
24896
25365
|
TMXIsometricRenderer.prototype.getBounds = function getBounds (layer) {
|
|
24897
|
-
var bounds = layer instanceof TMXLayer ? pull("Bounds") : this.bounds;
|
|
25366
|
+
var bounds = layer instanceof TMXLayer ? pool$1.pull("Bounds") : this.bounds;
|
|
24898
25367
|
bounds.setMinMax(
|
|
24899
25368
|
0, 0,
|
|
24900
25369
|
(this.cols + this.rows) * (this.tilewidth / 2),
|
|
@@ -24935,14 +25404,14 @@
|
|
|
24935
25404
|
TMXIsometricRenderer.prototype.adjustPosition = function adjustPosition (obj) {
|
|
24936
25405
|
var tileX = obj.x / this.hTilewidth;
|
|
24937
25406
|
var tileY = obj.y / this.tileheight;
|
|
24938
|
-
var isoPos = pull("Vector2d");
|
|
25407
|
+
var isoPos = pool$1.pull("Vector2d");
|
|
24939
25408
|
|
|
24940
25409
|
this.tileToPixelCoords(tileX, tileY, isoPos);
|
|
24941
25410
|
|
|
24942
25411
|
obj.x = isoPos.x;
|
|
24943
25412
|
obj.y = isoPos.y;
|
|
24944
25413
|
|
|
24945
|
-
push(isoPos);
|
|
25414
|
+
pool$1.push(isoPos);
|
|
24946
25415
|
};
|
|
24947
25416
|
|
|
24948
25417
|
/**
|
|
@@ -24972,18 +25441,18 @@
|
|
|
24972
25441
|
var rowItr = this.pixelToTileCoords(
|
|
24973
25442
|
rect.pos.x - tileset.tilewidth,
|
|
24974
25443
|
rect.pos.y - tileset.tileheight,
|
|
24975
|
-
pull("Vector2d")
|
|
25444
|
+
pool$1.pull("Vector2d")
|
|
24976
25445
|
).floorSelf();
|
|
24977
25446
|
var tileEnd = this.pixelToTileCoords(
|
|
24978
25447
|
rect.pos.x + rect.width + tileset.tilewidth,
|
|
24979
25448
|
rect.pos.y + rect.height + tileset.tileheight,
|
|
24980
|
-
pull("Vector2d")
|
|
25449
|
+
pool$1.pull("Vector2d")
|
|
24981
25450
|
).ceilSelf();
|
|
24982
25451
|
|
|
24983
|
-
var rectEnd = this.tileToPixelCoords(tileEnd.x, tileEnd.y, pull("Vector2d"));
|
|
25452
|
+
var rectEnd = this.tileToPixelCoords(tileEnd.x, tileEnd.y, pool$1.pull("Vector2d"));
|
|
24984
25453
|
|
|
24985
25454
|
// Determine the tile and pixel coordinates to start at
|
|
24986
|
-
var startPos = this.tileToPixelCoords(rowItr.x, rowItr.y, pull("Vector2d"));
|
|
25455
|
+
var startPos = this.tileToPixelCoords(rowItr.x, rowItr.y, pool$1.pull("Vector2d"));
|
|
24987
25456
|
startPos.x -= this.hTilewidth;
|
|
24988
25457
|
startPos.y += this.tileheight;
|
|
24989
25458
|
|
|
@@ -25050,11 +25519,11 @@
|
|
|
25050
25519
|
}
|
|
25051
25520
|
}
|
|
25052
25521
|
|
|
25053
|
-
push(columnItr);
|
|
25054
|
-
push(rowItr);
|
|
25055
|
-
push(tileEnd);
|
|
25056
|
-
push(rectEnd);
|
|
25057
|
-
push(startPos);
|
|
25522
|
+
pool$1.push(columnItr);
|
|
25523
|
+
pool$1.push(rowItr);
|
|
25524
|
+
pool$1.push(tileEnd);
|
|
25525
|
+
pool$1.push(rectEnd);
|
|
25526
|
+
pool$1.push(startPos);
|
|
25058
25527
|
};
|
|
25059
25528
|
|
|
25060
25529
|
return TMXIsometricRenderer;
|
|
@@ -25142,7 +25611,7 @@
|
|
|
25142
25611
|
* @returns {Bounds}
|
|
25143
25612
|
*/
|
|
25144
25613
|
TMXHexagonalRenderer.prototype.getBounds = function getBounds (layer) {
|
|
25145
|
-
var bounds = layer instanceof TMXLayer ? pull("Bounds") : this.bounds;
|
|
25614
|
+
var bounds = layer instanceof TMXLayer ? pool$1.pull("Bounds") : this.bounds;
|
|
25146
25615
|
|
|
25147
25616
|
// The map size is the same regardless of which indexes are shifted.
|
|
25148
25617
|
if (this.staggerX) {
|
|
@@ -25293,13 +25762,13 @@
|
|
|
25293
25762
|
}
|
|
25294
25763
|
|
|
25295
25764
|
// Start with the coordinates of a grid-aligned tile
|
|
25296
|
-
var referencePoint = pull("Vector2d",
|
|
25765
|
+
var referencePoint = pool$1.pull("Vector2d",
|
|
25297
25766
|
Math.floor(x / (this.columnwidth * 2)),
|
|
25298
25767
|
Math.floor((y / (this.rowheight * 2)))
|
|
25299
25768
|
);
|
|
25300
25769
|
|
|
25301
25770
|
// Relative x and y position on the base square of the grid-aligned tile
|
|
25302
|
-
var rel = pull("Vector2d",
|
|
25771
|
+
var rel = pool$1.pull("Vector2d",
|
|
25303
25772
|
x - referencePoint.x * (this.columnwidth * 2),
|
|
25304
25773
|
y - referencePoint.y * (this.rowheight * 2)
|
|
25305
25774
|
);
|
|
@@ -25358,8 +25827,8 @@
|
|
|
25358
25827
|
referencePoint.y + offsets[nearest].y
|
|
25359
25828
|
);
|
|
25360
25829
|
|
|
25361
|
-
push(referencePoint);
|
|
25362
|
-
push(rel);
|
|
25830
|
+
pool$1.push(referencePoint);
|
|
25831
|
+
pool$1.push(rel);
|
|
25363
25832
|
|
|
25364
25833
|
return ret;
|
|
25365
25834
|
};
|
|
@@ -25410,7 +25879,7 @@
|
|
|
25410
25879
|
*/
|
|
25411
25880
|
TMXHexagonalRenderer.prototype.drawTile = function drawTile (renderer, x, y, tmxTile) {
|
|
25412
25881
|
var tileset = tmxTile.tileset;
|
|
25413
|
-
var point = this.tileToPixelCoords(x, y, pull("Vector2d"));
|
|
25882
|
+
var point = this.tileToPixelCoords(x, y, pool$1.pull("Vector2d"));
|
|
25414
25883
|
|
|
25415
25884
|
// draw the tile
|
|
25416
25885
|
tileset.drawTile(
|
|
@@ -25420,7 +25889,7 @@
|
|
|
25420
25889
|
tmxTile
|
|
25421
25890
|
);
|
|
25422
25891
|
|
|
25423
|
-
push(point);
|
|
25892
|
+
pool$1.push(point);
|
|
25424
25893
|
};
|
|
25425
25894
|
|
|
25426
25895
|
/**
|
|
@@ -25434,7 +25903,7 @@
|
|
|
25434
25903
|
var startTile = this.pixelToTileCoords(
|
|
25435
25904
|
rect.pos.x,
|
|
25436
25905
|
rect.pos.y,
|
|
25437
|
-
pull("Vector2d")
|
|
25906
|
+
pool$1.pull("Vector2d")
|
|
25438
25907
|
);
|
|
25439
25908
|
|
|
25440
25909
|
// Compensate for the layer position
|
|
@@ -25444,7 +25913,7 @@
|
|
|
25444
25913
|
var startPos = this.tileToPixelCoords(
|
|
25445
25914
|
startTile.x + layer.pos.x,
|
|
25446
25915
|
startTile.y + layer.pos.y,
|
|
25447
|
-
pull("Vector2d")
|
|
25916
|
+
pool$1.pull("Vector2d")
|
|
25448
25917
|
);
|
|
25449
25918
|
|
|
25450
25919
|
var rowTile = startTile.clone();
|
|
@@ -25507,8 +25976,8 @@
|
|
|
25507
25976
|
|
|
25508
25977
|
startPos.y += this.rowheight;
|
|
25509
25978
|
}
|
|
25510
|
-
push(rowTile);
|
|
25511
|
-
push(rowPos);
|
|
25979
|
+
pool$1.push(rowTile);
|
|
25980
|
+
pool$1.push(rowPos);
|
|
25512
25981
|
|
|
25513
25982
|
} else {
|
|
25514
25983
|
//ensure we are in the valid tile range
|
|
@@ -25544,12 +26013,12 @@
|
|
|
25544
26013
|
}
|
|
25545
26014
|
startPos.y += this.rowheight;
|
|
25546
26015
|
}
|
|
25547
|
-
push(rowTile);
|
|
25548
|
-
push(rowPos);
|
|
26016
|
+
pool$1.push(rowTile);
|
|
26017
|
+
pool$1.push(rowPos);
|
|
25549
26018
|
}
|
|
25550
26019
|
|
|
25551
|
-
push(startTile);
|
|
25552
|
-
push(startPos);
|
|
26020
|
+
pool$1.push(startTile);
|
|
26021
|
+
pool$1.push(startPos);
|
|
25553
26022
|
};
|
|
25554
26023
|
|
|
25555
26024
|
return TMXHexagonalRenderer;
|
|
@@ -25593,7 +26062,7 @@
|
|
|
25593
26062
|
}
|
|
25594
26063
|
|
|
25595
26064
|
// Start with the coordinates of a grid-aligned tile
|
|
25596
|
-
var referencePoint = pull("Vector2d",
|
|
26065
|
+
var referencePoint = pool$1.pull("Vector2d",
|
|
25597
26066
|
Math.floor(alignedX / this.tilewidth),
|
|
25598
26067
|
Math.floor(alignedY / this.tileheight)
|
|
25599
26068
|
);
|
|
@@ -25612,7 +26081,7 @@
|
|
|
25612
26081
|
}
|
|
25613
26082
|
|
|
25614
26083
|
// Relative x and y position on the base square of the grid-aligned tile
|
|
25615
|
-
var rel = pull("Vector2d",
|
|
26084
|
+
var rel = pool$1.pull("Vector2d",
|
|
25616
26085
|
alignedX - referencePoint.x * this.tilewidth,
|
|
25617
26086
|
alignedY - referencePoint.y * this.tileheight
|
|
25618
26087
|
);
|
|
@@ -25645,8 +26114,8 @@
|
|
|
25645
26114
|
|
|
25646
26115
|
ret.div(this.tilewidth / Math.sqrt(2)).rotate(degToRad(-45)).add(referencePoint);
|
|
25647
26116
|
|
|
25648
|
-
push(referencePoint);
|
|
25649
|
-
push(rel);
|
|
26117
|
+
pool$1.push(referencePoint);
|
|
26118
|
+
pool$1.push(rel);
|
|
25650
26119
|
|
|
25651
26120
|
return ret;
|
|
25652
26121
|
};
|
|
@@ -26266,7 +26735,7 @@
|
|
|
26266
26735
|
// add an ellipse shape
|
|
26267
26736
|
if (this.isEllipse === true) {
|
|
26268
26737
|
// ellipse coordinates are the center position, so set default to the corresonding radius
|
|
26269
|
-
shapes.push((
|
|
26738
|
+
shapes.push((pool$1.pull("Ellipse",
|
|
26270
26739
|
this.width / 2,
|
|
26271
26740
|
this.height / 2,
|
|
26272
26741
|
this.width,
|
|
@@ -26276,7 +26745,7 @@
|
|
|
26276
26745
|
|
|
26277
26746
|
// add a polygon
|
|
26278
26747
|
if (this.isPolygon === true) {
|
|
26279
|
-
var _polygon =
|
|
26748
|
+
var _polygon = pool$1.pull("Polygon", 0, 0, this.points);
|
|
26280
26749
|
// make sure it's a convex polygon
|
|
26281
26750
|
if (_polygon.isConvex() === false ) {
|
|
26282
26751
|
throw new Error("collision polygones in Tiled should be defined as Convex");
|
|
@@ -26292,22 +26761,22 @@
|
|
|
26292
26761
|
for (i = 0; i < segments; i++) {
|
|
26293
26762
|
// clone the value before, as [i + 1]
|
|
26294
26763
|
// is reused later by the next segment
|
|
26295
|
-
p1 =
|
|
26296
|
-
p2 =
|
|
26764
|
+
p1 = pool$1.pull("Vector2d", p[i].x, p[i].y);
|
|
26765
|
+
p2 = pool$1.pull("Vector2d", p[i + 1].x, p[i + 1].y);
|
|
26297
26766
|
if (this.rotation !== 0) {
|
|
26298
26767
|
p1 = p1.rotate(this.rotation);
|
|
26299
26768
|
p2 = p2.rotate(this.rotation);
|
|
26300
26769
|
}
|
|
26301
|
-
shapes.push(
|
|
26770
|
+
shapes.push(pool$1.pull("Line", 0, 0, [ p1, p2 ]));
|
|
26302
26771
|
}
|
|
26303
26772
|
}
|
|
26304
26773
|
|
|
26305
26774
|
// it's a rectangle, returns a polygon object anyway
|
|
26306
26775
|
else {
|
|
26307
|
-
shapes.push((
|
|
26776
|
+
shapes.push((pool$1.pull("Polygon",
|
|
26308
26777
|
0, 0, [
|
|
26309
|
-
|
|
26310
|
-
|
|
26778
|
+
pool$1.pull("Vector2d"), pool$1.pull("Vector2d", this.width, 0),
|
|
26779
|
+
pool$1.pull("Vector2d", this.width, this.height), pool$1.pull("Vector2d", 0, this.height)
|
|
26311
26780
|
]
|
|
26312
26781
|
)).rotate(this.rotation));
|
|
26313
26782
|
}
|
|
@@ -26499,16 +26968,16 @@
|
|
|
26499
26968
|
applyTMXProperties(data.properties, data);
|
|
26500
26969
|
|
|
26501
26970
|
// create the layer
|
|
26502
|
-
var imageLayer = pull("ImageLayer",
|
|
26971
|
+
var imageLayer = pool$1.pull("ImageLayer",
|
|
26503
26972
|
// x/y is deprecated since 0.15 and replace by offsetx/y
|
|
26504
26973
|
+data.offsetx || +data.x || 0,
|
|
26505
26974
|
+data.offsety || +data.y || 0,
|
|
26506
26975
|
Object.assign({
|
|
26507
26976
|
name: data.name,
|
|
26508
26977
|
image: data.image,
|
|
26509
|
-
ratio : pull("Vector2d", +data.parallaxx || 1.0, +data.parallaxy || 1.0),
|
|
26978
|
+
ratio : pool$1.pull("Vector2d", +data.parallaxx || 1.0, +data.parallaxy || 1.0),
|
|
26510
26979
|
// convert to melonJS color format (note: this should be done earlier when parsing data)
|
|
26511
|
-
tint : typeof (data.tintcolor) !== "undefined" ? (pull("Color")).parseHex(data.tintcolor, true) : undefined,
|
|
26980
|
+
tint : typeof (data.tintcolor) !== "undefined" ? (pool$1.pull("Color")).parseHex(data.tintcolor, true) : undefined,
|
|
26512
26981
|
z: z
|
|
26513
26982
|
}, data.properties)
|
|
26514
26983
|
);
|
|
@@ -26740,7 +27209,7 @@
|
|
|
26740
27209
|
if (this.background_image) {
|
|
26741
27210
|
// add a new image layer
|
|
26742
27211
|
this.layers.push(
|
|
26743
|
-
pull("ImageLayer",
|
|
27212
|
+
pool$1.pull("ImageLayer",
|
|
26744
27213
|
0, 0, {
|
|
26745
27214
|
name : "background_image",
|
|
26746
27215
|
image : this.background_image,
|
|
@@ -26900,6 +27369,8 @@
|
|
|
26900
27369
|
var settings = group.objects[o];
|
|
26901
27370
|
// reference to the instantiated object
|
|
26902
27371
|
var obj;
|
|
27372
|
+
// a reference to the default shape
|
|
27373
|
+
var shape;
|
|
26903
27374
|
|
|
26904
27375
|
// Tiled uses 0,0 by default
|
|
26905
27376
|
if (typeof (settings.anchorPoint) === "undefined") {
|
|
@@ -26907,7 +27378,7 @@
|
|
|
26907
27378
|
}
|
|
26908
27379
|
// convert to melonJS renderable argument name
|
|
26909
27380
|
if (typeof (settings.tintcolor) !== "undefined") {
|
|
26910
|
-
settings.tint = pull("Color");
|
|
27381
|
+
settings.tint = pool$1.pull("Color");
|
|
26911
27382
|
settings.tint.parseHex(settings.tintcolor, true);
|
|
26912
27383
|
}
|
|
26913
27384
|
|
|
@@ -26925,39 +27396,57 @@
|
|
|
26925
27396
|
settings.text.anchorPoint = settings.anchorPoint;
|
|
26926
27397
|
}
|
|
26927
27398
|
if (settings.text.bitmap === true) {
|
|
26928
|
-
obj = pull("BitmapText", settings.x, settings.y, settings.text);
|
|
27399
|
+
obj = pool$1.pull("BitmapText", settings.x, settings.y, settings.text);
|
|
26929
27400
|
} else {
|
|
26930
|
-
obj = pull("Text", settings.x, settings.y, settings.text);
|
|
27401
|
+
obj = pool$1.pull("Text", settings.x, settings.y, settings.text);
|
|
26931
27402
|
}
|
|
26932
27403
|
// set the obj z order
|
|
26933
27404
|
obj.pos.z = settings.z;
|
|
26934
27405
|
} else if (typeof settings.tile === "object") {
|
|
27406
|
+
// create a default shape if none is specified
|
|
27407
|
+
shape = settings.shapes;
|
|
27408
|
+
if (typeof shape === "undefined") {
|
|
27409
|
+
shape = pool$1.pull("Polygon", 0, 0, [
|
|
27410
|
+
pool$1.pull("Vector2d", 0, 0),
|
|
27411
|
+
pool$1.pull("Vector2d", this.width, 0),
|
|
27412
|
+
pool$1.pull("Vector2d", this.width, this.height)
|
|
27413
|
+
]);
|
|
27414
|
+
}
|
|
26935
27415
|
// check if a me.Tile object is embedded
|
|
26936
27416
|
obj = settings.tile.getRenderable(settings);
|
|
26937
|
-
obj.body = new Body(obj,
|
|
27417
|
+
obj.body = new Body(obj, shape);
|
|
26938
27418
|
obj.body.setStatic(true);
|
|
26939
27419
|
// set the obj z order
|
|
26940
27420
|
obj.pos.setMuted(settings.x, settings.y, settings.z);
|
|
26941
27421
|
} else {
|
|
26942
27422
|
// pull the corresponding object from the object pool
|
|
26943
27423
|
if (typeof settings.name !== "undefined" && settings.name !== "") {
|
|
26944
|
-
obj = pull(
|
|
27424
|
+
obj = pool$1.pull(
|
|
26945
27425
|
settings.name,
|
|
26946
27426
|
settings.x, settings.y,
|
|
26947
27427
|
settings
|
|
26948
27428
|
);
|
|
26949
27429
|
} else {
|
|
26950
27430
|
// unnamed shape object
|
|
26951
|
-
obj = pull(
|
|
27431
|
+
obj = pool$1.pull(
|
|
26952
27432
|
"Renderable",
|
|
26953
27433
|
settings.x, settings.y,
|
|
26954
27434
|
settings.width, settings.height
|
|
26955
27435
|
);
|
|
27436
|
+
// create a default shape if none is specified
|
|
27437
|
+
shape = settings.shapes;
|
|
27438
|
+
if (typeof shape === "undefined") {
|
|
27439
|
+
shape = pool$1.pull("Polygon", 0, 0, [
|
|
27440
|
+
pool$1.pull("Vector2d", 0, 0),
|
|
27441
|
+
pool$1.pull("Vector2d", this.width, 0),
|
|
27442
|
+
pool$1.pull("Vector2d", this.width, this.height)
|
|
27443
|
+
]);
|
|
27444
|
+
}
|
|
26956
27445
|
obj.anchorPoint.set(0, 0);
|
|
26957
27446
|
obj.name = settings.name;
|
|
26958
27447
|
obj.type = settings.type;
|
|
26959
27448
|
obj.id = settings.id;
|
|
26960
|
-
obj.body = new Body(obj,
|
|
27449
|
+
obj.body = new Body(obj, shape);
|
|
26961
27450
|
obj.body.setStatic(true);
|
|
26962
27451
|
obj.resize(obj.body.getBounds().width, obj.body.getBounds().height);
|
|
26963
27452
|
}
|
|
@@ -27356,7 +27845,7 @@
|
|
|
27356
27845
|
}
|
|
27357
27846
|
}
|
|
27358
27847
|
else {
|
|
27359
|
-
timerId$1 = setTimeout(function() {
|
|
27848
|
+
timerId$1 = setTimeout(function () {
|
|
27360
27849
|
checkLoadStatus(onload);
|
|
27361
27850
|
}, 100);
|
|
27362
27851
|
}
|
|
@@ -27393,7 +27882,7 @@
|
|
|
27393
27882
|
function preloadFontFace(data, onload, onerror) {
|
|
27394
27883
|
var font = new FontFace(data.name, data.src);
|
|
27395
27884
|
// loading promise
|
|
27396
|
-
font.load().then(function() {
|
|
27885
|
+
font.load().then(function () {
|
|
27397
27886
|
// apply the font after the font has finished downloading
|
|
27398
27887
|
document.fonts.add(font);
|
|
27399
27888
|
document.body.style.fontFamily = data.name;
|
|
@@ -27582,12 +28071,12 @@
|
|
|
27582
28071
|
}
|
|
27583
28072
|
script.defer = true;
|
|
27584
28073
|
|
|
27585
|
-
script.onload = function() {
|
|
28074
|
+
script.onload = function () {
|
|
27586
28075
|
// callback
|
|
27587
28076
|
onload();
|
|
27588
28077
|
};
|
|
27589
28078
|
|
|
27590
|
-
script.onerror = function() {
|
|
28079
|
+
script.onerror = function () {
|
|
27591
28080
|
// callback
|
|
27592
28081
|
onerror(data.name);
|
|
27593
28082
|
};
|
|
@@ -28845,12 +29334,6 @@
|
|
|
28845
29334
|
// detect device type/platform
|
|
28846
29335
|
_detectDevice();
|
|
28847
29336
|
|
|
28848
|
-
// Mobile browser hacks
|
|
28849
|
-
if (device.isMobile) {
|
|
28850
|
-
// Prevent the webview from moving on a swipe
|
|
28851
|
-
device.enableSwipe(false);
|
|
28852
|
-
}
|
|
28853
|
-
|
|
28854
29337
|
// Touch/Gesture Event feature detection
|
|
28855
29338
|
device.TouchEvent = !!("ontouchstart" in globalThis);
|
|
28856
29339
|
device.PointerEvent = !!globalThis.PointerEvent;
|
|
@@ -28972,6 +29455,13 @@
|
|
|
28972
29455
|
);
|
|
28973
29456
|
}
|
|
28974
29457
|
}
|
|
29458
|
+
|
|
29459
|
+
// Mobile browser hacks
|
|
29460
|
+
if (device.isMobile) {
|
|
29461
|
+
// Prevent the webview from moving on a swipe
|
|
29462
|
+
device.enableSwipe(false);
|
|
29463
|
+
}
|
|
29464
|
+
|
|
28975
29465
|
}
|
|
28976
29466
|
|
|
28977
29467
|
// Initialize me.timer on Boot event
|
|
@@ -29408,13 +29898,14 @@
|
|
|
29408
29898
|
* @param {boolean} [enable=true] enable or disable swipe.
|
|
29409
29899
|
*/
|
|
29410
29900
|
enableSwipe: function enableSwipe(enable) {
|
|
29901
|
+
var moveEvent = device.PointerEvent ? "pointermove" : (device.TouchEvent ? "touchmove" : "mousemove");
|
|
29411
29902
|
if (enable !== false) {
|
|
29412
29903
|
if (swipeEnabled === false) {
|
|
29413
|
-
globalThis.document.removeEventListener(
|
|
29904
|
+
globalThis.document.removeEventListener(moveEvent, _disableSwipeFn);
|
|
29414
29905
|
swipeEnabled = true;
|
|
29415
29906
|
}
|
|
29416
29907
|
} else if (swipeEnabled === true) {
|
|
29417
|
-
globalThis.document.addEventListener(
|
|
29908
|
+
globalThis.document.addEventListener(moveEvent, _disableSwipeFn, { passive: false });
|
|
29418
29909
|
swipeEnabled = false;
|
|
29419
29910
|
}
|
|
29420
29911
|
},
|
|
@@ -29904,6 +30395,29 @@
|
|
|
29904
30395
|
|
|
29905
30396
|
var device$1 = device;
|
|
29906
30397
|
|
|
30398
|
+
/**
|
|
30399
|
+
* Hash map of GLSL data types to WebGL Uniform methods
|
|
30400
|
+
* @ignore
|
|
30401
|
+
*/
|
|
30402
|
+
var fnHash = {
|
|
30403
|
+
"bool" : "1i",
|
|
30404
|
+
"int" : "1i",
|
|
30405
|
+
"float" : "1f",
|
|
30406
|
+
"vec2" : "2fv",
|
|
30407
|
+
"vec3" : "3fv",
|
|
30408
|
+
"vec4" : "4fv",
|
|
30409
|
+
"bvec2" : "2iv",
|
|
30410
|
+
"bvec3" : "3iv",
|
|
30411
|
+
"bvec4" : "4iv",
|
|
30412
|
+
"ivec2" : "2iv",
|
|
30413
|
+
"ivec3" : "3iv",
|
|
30414
|
+
"ivec4" : "4iv",
|
|
30415
|
+
"mat2" : "Matrix2fv",
|
|
30416
|
+
"mat3" : "Matrix3fv",
|
|
30417
|
+
"mat4" : "Matrix4fv",
|
|
30418
|
+
"sampler2D" : "1i"
|
|
30419
|
+
};
|
|
30420
|
+
|
|
29907
30421
|
/**
|
|
29908
30422
|
* @ignore
|
|
29909
30423
|
*/
|
|
@@ -29967,6 +30481,7 @@
|
|
|
29967
30481
|
|
|
29968
30482
|
return uniforms;
|
|
29969
30483
|
}
|
|
30484
|
+
|
|
29970
30485
|
/**
|
|
29971
30486
|
* @ignore
|
|
29972
30487
|
*/
|
|
@@ -29983,6 +30498,7 @@
|
|
|
29983
30498
|
|
|
29984
30499
|
return attributes;
|
|
29985
30500
|
}
|
|
30501
|
+
|
|
29986
30502
|
/**
|
|
29987
30503
|
* @ignore
|
|
29988
30504
|
*/
|
|
@@ -30041,29 +30557,6 @@
|
|
|
30041
30557
|
return program;
|
|
30042
30558
|
}
|
|
30043
30559
|
|
|
30044
|
-
/**
|
|
30045
|
-
* Hash map of GLSL data types to WebGL Uniform methods
|
|
30046
|
-
* @ignore
|
|
30047
|
-
*/
|
|
30048
|
-
var fnHash = {
|
|
30049
|
-
"bool" : "1i",
|
|
30050
|
-
"int" : "1i",
|
|
30051
|
-
"float" : "1f",
|
|
30052
|
-
"vec2" : "2fv",
|
|
30053
|
-
"vec3" : "3fv",
|
|
30054
|
-
"vec4" : "4fv",
|
|
30055
|
-
"bvec2" : "2iv",
|
|
30056
|
-
"bvec3" : "3iv",
|
|
30057
|
-
"bvec4" : "4iv",
|
|
30058
|
-
"ivec2" : "2iv",
|
|
30059
|
-
"ivec3" : "3iv",
|
|
30060
|
-
"ivec4" : "4iv",
|
|
30061
|
-
"mat2" : "Matrix2fv",
|
|
30062
|
-
"mat3" : "Matrix3fv",
|
|
30063
|
-
"mat4" : "Matrix4fv",
|
|
30064
|
-
"sampler2D" : "1i"
|
|
30065
|
-
};
|
|
30066
|
-
|
|
30067
30560
|
/**
|
|
30068
30561
|
* set precision for the fiven shader source
|
|
30069
30562
|
* won't do anything if the precision is already specified
|
|
@@ -30075,6 +30568,7 @@
|
|
|
30075
30568
|
}
|
|
30076
30569
|
return src;
|
|
30077
30570
|
}
|
|
30571
|
+
|
|
30078
30572
|
/**
|
|
30079
30573
|
* clean the given source from space, comments, etc...
|
|
30080
30574
|
* @ignore
|
|
@@ -30091,6 +30585,7 @@
|
|
|
30091
30585
|
|
|
30092
30586
|
return src;
|
|
30093
30587
|
}
|
|
30588
|
+
|
|
30094
30589
|
/**
|
|
30095
30590
|
* @classdesc
|
|
30096
30591
|
* a base GL Shader object
|
|
@@ -30206,6 +30701,30 @@
|
|
|
30206
30701
|
}
|
|
30207
30702
|
};
|
|
30208
30703
|
|
|
30704
|
+
/**
|
|
30705
|
+
* activate the given vertex attribute for this shader
|
|
30706
|
+
* @name setVertexAttributes
|
|
30707
|
+
* @memberof GLShader
|
|
30708
|
+
* @function
|
|
30709
|
+
* @param {WebGLRenderingContext} gl the current WebGL rendering context
|
|
30710
|
+
* @param {object[]} attributes an array of vertex attributes
|
|
30711
|
+
* @param {number} vertexByteSize the size of a single vertex in bytes
|
|
30712
|
+
*/
|
|
30713
|
+
GLShader.prototype.setVertexAttributes = function setVertexAttributes (gl, attributes, vertexByteSize) {
|
|
30714
|
+
// set the vertex attributes
|
|
30715
|
+
for (var index = 0; index < attributes.length; ++index) {
|
|
30716
|
+
var element = attributes[index];
|
|
30717
|
+
var location = this.getAttribLocation(element.name);
|
|
30718
|
+
|
|
30719
|
+
if (location !== -1) {
|
|
30720
|
+
gl.enableVertexAttribArray(location);
|
|
30721
|
+
gl.vertexAttribPointer(location, element.size, element.type, element.normalized, vertexByteSize, element.offset);
|
|
30722
|
+
} else {
|
|
30723
|
+
gl.disableVertexAttribArray(index);
|
|
30724
|
+
}
|
|
30725
|
+
}
|
|
30726
|
+
};
|
|
30727
|
+
|
|
30209
30728
|
/**
|
|
30210
30729
|
* destroy this shader objects resources (program, attributes, uniforms)
|
|
30211
30730
|
* @name destroy
|
|
@@ -30741,20 +31260,7 @@
|
|
|
30741
31260
|
this.activeShader = shader;
|
|
30742
31261
|
this.activeShader.bind();
|
|
30743
31262
|
this.activeShader.setUniform("uProjectionMatrix", this.renderer.projectionMatrix);
|
|
30744
|
-
|
|
30745
|
-
// set the vertex attributes
|
|
30746
|
-
for (var index = 0; index < this.attributes.length; ++index) {
|
|
30747
|
-
var gl = this.gl;
|
|
30748
|
-
var element = this.attributes[index];
|
|
30749
|
-
var location = this.activeShader.getAttribLocation(element.name);
|
|
30750
|
-
|
|
30751
|
-
if (location !== -1) {
|
|
30752
|
-
gl.enableVertexAttribArray(location);
|
|
30753
|
-
gl.vertexAttribPointer(location, element.size, element.type, element.normalized, this.vertexByteSize, element.offset);
|
|
30754
|
-
} else {
|
|
30755
|
-
gl.disableVertexAttribArray(index);
|
|
30756
|
-
}
|
|
30757
|
-
}
|
|
31263
|
+
this.activeShader.setVertexAttributes(this.gl, this.attributes, this.vertexByteSize);
|
|
30758
31264
|
}
|
|
30759
31265
|
};
|
|
30760
31266
|
|
|
@@ -30917,7 +31423,7 @@
|
|
|
30917
31423
|
/**
|
|
30918
31424
|
* The WebGL version used by this renderer (1 or 2)
|
|
30919
31425
|
* @name WebGLVersion
|
|
30920
|
-
* @memberof WebGLRenderer
|
|
31426
|
+
* @memberof WebGLRenderer#
|
|
30921
31427
|
* @type {number}
|
|
30922
31428
|
* @default 1
|
|
30923
31429
|
* @readonly
|
|
@@ -30927,7 +31433,7 @@
|
|
|
30927
31433
|
/**
|
|
30928
31434
|
* The vendor string of the underlying graphics driver.
|
|
30929
31435
|
* @name GPUVendor
|
|
30930
|
-
* @memberof WebGLRenderer
|
|
31436
|
+
* @memberof WebGLRenderer#
|
|
30931
31437
|
* @type {string}
|
|
30932
31438
|
* @default null
|
|
30933
31439
|
* @readonly
|
|
@@ -30937,7 +31443,7 @@
|
|
|
30937
31443
|
/**
|
|
30938
31444
|
* The renderer string of the underlying graphics driver.
|
|
30939
31445
|
* @name GPURenderer
|
|
30940
|
-
* @memberof WebGLRenderer
|
|
31446
|
+
* @memberof WebGLRenderer#
|
|
30941
31447
|
* @type {string}
|
|
30942
31448
|
* @default null
|
|
30943
31449
|
* @readonly
|
|
@@ -30947,7 +31453,7 @@
|
|
|
30947
31453
|
/**
|
|
30948
31454
|
* The WebGL context
|
|
30949
31455
|
* @name gl
|
|
30950
|
-
* @memberof WebGLRenderer
|
|
31456
|
+
* @memberof WebGLRenderer#
|
|
30951
31457
|
* type {WebGLRenderingContext}
|
|
30952
31458
|
*/
|
|
30953
31459
|
this.context = this.gl = this.getContextGL(this.getScreenCanvas(), options.transparent);
|
|
@@ -30955,7 +31461,7 @@
|
|
|
30955
31461
|
/**
|
|
30956
31462
|
* Maximum number of texture unit supported under the current context
|
|
30957
31463
|
* @name maxTextures
|
|
30958
|
-
* @memberof WebGLRenderer
|
|
31464
|
+
* @memberof WebGLRenderer#
|
|
30959
31465
|
* @type {number}
|
|
30960
31466
|
* @readonly
|
|
30961
31467
|
*/
|
|
@@ -30981,16 +31487,6 @@
|
|
|
30981
31487
|
*/
|
|
30982
31488
|
this._blendStack = [];
|
|
30983
31489
|
|
|
30984
|
-
/**
|
|
30985
|
-
* @ignore
|
|
30986
|
-
*/
|
|
30987
|
-
this._glPoints = [
|
|
30988
|
-
new Vector2d(),
|
|
30989
|
-
new Vector2d(),
|
|
30990
|
-
new Vector2d(),
|
|
30991
|
-
new Vector2d()
|
|
30992
|
-
];
|
|
30993
|
-
|
|
30994
31490
|
/**
|
|
30995
31491
|
* The current transformation matrix used for transformations on the overall scene
|
|
30996
31492
|
* @name currentTransform
|
|
@@ -31010,7 +31506,7 @@
|
|
|
31010
31506
|
/**
|
|
31011
31507
|
* The list of active compositors
|
|
31012
31508
|
* @name compositors
|
|
31013
|
-
* @type {Map}
|
|
31509
|
+
* @type {Map<WebGLCompositor>}
|
|
31014
31510
|
* @memberof WebGLRenderer#
|
|
31015
31511
|
*/
|
|
31016
31512
|
this.compositors = new Map();
|
|
@@ -31235,10 +31731,10 @@
|
|
|
31235
31731
|
if (color instanceof Color) {
|
|
31236
31732
|
glArray = color.toArray();
|
|
31237
31733
|
} else {
|
|
31238
|
-
var _color = pull("me.Color");
|
|
31734
|
+
var _color = pool$1.pull("me.Color");
|
|
31239
31735
|
// reuse temporary the renderer default color object
|
|
31240
31736
|
glArray = _color.parseCSS(color).toArray();
|
|
31241
|
-
push(_color);
|
|
31737
|
+
pool$1.push(_color);
|
|
31242
31738
|
}
|
|
31243
31739
|
// clear gl context with the specified color
|
|
31244
31740
|
this.currentCompositor.clearColor(glArray[0], glArray[1], glArray[2], (opaque === true) ? 1.0 : glArray[3]);
|
|
@@ -31533,8 +32029,8 @@
|
|
|
31533
32029
|
this.setBlendMode(this._blendStack.pop());
|
|
31534
32030
|
|
|
31535
32031
|
// recycle objects
|
|
31536
|
-
push(color);
|
|
31537
|
-
push(matrix);
|
|
32032
|
+
pool$1.push(color);
|
|
32033
|
+
pool$1.push(matrix);
|
|
31538
32034
|
}
|
|
31539
32035
|
|
|
31540
32036
|
if (this._scissorStack.length !== 0) {
|
|
@@ -31611,6 +32107,17 @@
|
|
|
31611
32107
|
this.currentColor.alpha = alpha;
|
|
31612
32108
|
};
|
|
31613
32109
|
|
|
32110
|
+
/**
|
|
32111
|
+
* Return the global alpha
|
|
32112
|
+
* @name getGlobalAlpha
|
|
32113
|
+
* @memberof WebGLRenderer.prototype
|
|
32114
|
+
* @function
|
|
32115
|
+
* @returns {number} global alpha value
|
|
32116
|
+
*/
|
|
32117
|
+
WebGLRenderer.prototype.getGlobalAlpha = function getGlobalAlpha () {
|
|
32118
|
+
return this.currentColor.alpha;
|
|
32119
|
+
};
|
|
32120
|
+
|
|
31614
32121
|
/**
|
|
31615
32122
|
* Set the current fill & stroke style color.
|
|
31616
32123
|
* By default, or upon reset, the value is set to #000000.
|
|
@@ -31651,34 +32158,19 @@
|
|
|
31651
32158
|
*/
|
|
31652
32159
|
WebGLRenderer.prototype.strokeArc = function strokeArc (x, y, radius, start, end, antiClockwise, fill) {
|
|
31653
32160
|
if ( antiClockwise === void 0 ) antiClockwise = false;
|
|
32161
|
+
if ( fill === void 0 ) fill = false;
|
|
31654
32162
|
|
|
31655
|
-
if (
|
|
31656
|
-
|
|
32163
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
32164
|
+
// Fast path: don't draw fully transparent
|
|
32165
|
+
return;
|
|
32166
|
+
}
|
|
32167
|
+
this.path2D.beginPath();
|
|
32168
|
+
this.path2D.arc(x, y, radius, start, end, antiClockwise);
|
|
32169
|
+
if (fill === false) {
|
|
32170
|
+
this.currentCompositor.drawVertices(this.gl.LINE_STRIP, this.path2D.points);
|
|
31657
32171
|
} else {
|
|
31658
|
-
|
|
31659
|
-
|
|
31660
|
-
var i, len = Math.floor(24 * Math.sqrt(radius * 2));
|
|
31661
|
-
var theta = (end - start) / (len * 2);
|
|
31662
|
-
var theta2 = theta * 2;
|
|
31663
|
-
var cos_theta = Math.cos(theta);
|
|
31664
|
-
var sin_theta = Math.sin(theta);
|
|
31665
|
-
|
|
31666
|
-
// Grow internal points buffer if necessary
|
|
31667
|
-
for (i = points.length; i < len + 1; i++) {
|
|
31668
|
-
points.push(new Vector2d());
|
|
31669
|
-
}
|
|
31670
|
-
|
|
31671
|
-
// calculate and draw all segments
|
|
31672
|
-
for (i = 0; i < len; i++) {
|
|
31673
|
-
var angle = ((theta) + start + (theta2 * i));
|
|
31674
|
-
var cos = Math.cos(angle);
|
|
31675
|
-
var sin = -Math.sin(angle);
|
|
31676
|
-
|
|
31677
|
-
points[i].x = x + (((cos_theta * cos) + (sin_theta * sin)) * radius);
|
|
31678
|
-
points[i].y = y + (((cos_theta * -sin) + (sin_theta * cos)) * radius);
|
|
31679
|
-
}
|
|
31680
|
-
// batch draw all lines
|
|
31681
|
-
this.currentCompositor.drawVertices(this.gl.LINE_STRIP, points, len);
|
|
32172
|
+
this.path2D.closePath();
|
|
32173
|
+
this.currentCompositor.drawVertices(this.gl.TRIANGLES, this.path2D.triangulatePath());
|
|
31682
32174
|
}
|
|
31683
32175
|
};
|
|
31684
32176
|
|
|
@@ -31694,35 +32186,10 @@
|
|
|
31694
32186
|
* @param {number} end end angle in radians
|
|
31695
32187
|
* @param {boolean} [antiClockwise=false] draw arc anti-clockwise
|
|
31696
32188
|
*/
|
|
31697
|
-
WebGLRenderer.prototype.fillArc = function fillArc (x, y, radius, start, end
|
|
31698
|
-
|
|
31699
|
-
|
|
31700
|
-
|
|
31701
|
-
var len = Math.floor(24 * Math.sqrt(radius * 2));
|
|
31702
|
-
var theta = (end - start) / (len * 2);
|
|
31703
|
-
var theta2 = theta * 2;
|
|
31704
|
-
var cos_theta = Math.cos(theta);
|
|
31705
|
-
var sin_theta = Math.sin(theta);
|
|
31706
|
-
|
|
31707
|
-
// Grow internal points buffer if necessary
|
|
31708
|
-
for (i = points.length; i < len * 2; i++) {
|
|
31709
|
-
points.push(new Vector2d());
|
|
31710
|
-
}
|
|
31711
|
-
|
|
31712
|
-
// calculate and draw all segments
|
|
31713
|
-
for (i = 0; i < len - 1; i++) {
|
|
31714
|
-
var angle = ((theta) + start + (theta2 * i));
|
|
31715
|
-
var cos = Math.cos(angle);
|
|
31716
|
-
var sin = -Math.sin(angle);
|
|
31717
|
-
|
|
31718
|
-
points[index++].set(x, y);
|
|
31719
|
-
points[index++].set(
|
|
31720
|
-
x - (((cos_theta * cos) + (sin_theta * sin)) * radius),
|
|
31721
|
-
y - (((cos_theta * -sin) + (sin_theta * cos)) * radius)
|
|
31722
|
-
);
|
|
31723
|
-
}
|
|
31724
|
-
// batch draw all triangles
|
|
31725
|
-
this.currentCompositor.drawVertices(this.gl.TRIANGLE_STRIP, points, index);
|
|
32189
|
+
WebGLRenderer.prototype.fillArc = function fillArc (x, y, radius, start, end, antiClockwise) {
|
|
32190
|
+
if ( antiClockwise === void 0 ) antiClockwise = false;
|
|
32191
|
+
|
|
32192
|
+
this.strokeArc(x, y, radius, start, end, antiClockwise, true);
|
|
31726
32193
|
};
|
|
31727
32194
|
|
|
31728
32195
|
/**
|
|
@@ -31739,28 +32206,17 @@
|
|
|
31739
32206
|
WebGLRenderer.prototype.strokeEllipse = function strokeEllipse (x, y, w, h, fill) {
|
|
31740
32207
|
if ( fill === void 0 ) fill = false;
|
|
31741
32208
|
|
|
31742
|
-
if (
|
|
31743
|
-
|
|
32209
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
32210
|
+
// Fast path: don't draw fully transparent
|
|
32211
|
+
return;
|
|
32212
|
+
}
|
|
32213
|
+
this.path2D.beginPath();
|
|
32214
|
+
this.path2D.ellipse(x, y, w, h, 0, 0, 360);
|
|
32215
|
+
this.path2D.closePath();
|
|
32216
|
+
if (fill === false) {
|
|
32217
|
+
this.currentCompositor.drawVertices(this.gl.LINE_LOOP, this.path2D.points);
|
|
31744
32218
|
} else {
|
|
31745
|
-
|
|
31746
|
-
var len = Math.floor(24 * Math.sqrt(w)) ||
|
|
31747
|
-
Math.floor(12 * Math.sqrt(w + h));
|
|
31748
|
-
var segment = (TAU) / len;
|
|
31749
|
-
var points = this._glPoints,
|
|
31750
|
-
i;
|
|
31751
|
-
|
|
31752
|
-
// Grow internal points buffer if necessary
|
|
31753
|
-
for (i = points.length; i < len; i++) {
|
|
31754
|
-
points.push(new Vector2d());
|
|
31755
|
-
}
|
|
31756
|
-
|
|
31757
|
-
// calculate and draw all segments
|
|
31758
|
-
for (i = 0; i < len; i++) {
|
|
31759
|
-
points[i].x = x + (Math.sin(segment * -i) * w);
|
|
31760
|
-
points[i].y = y + (Math.cos(segment * -i) * h);
|
|
31761
|
-
}
|
|
31762
|
-
// batch draw all lines
|
|
31763
|
-
this.currentCompositor.drawVertices(this.gl.LINE_LOOP, points, len);
|
|
32219
|
+
this.currentCompositor.drawVertices(this.gl.TRIANGLES, this.path2D.triangulatePath());
|
|
31764
32220
|
}
|
|
31765
32221
|
};
|
|
31766
32222
|
|
|
@@ -31775,28 +32231,7 @@
|
|
|
31775
32231
|
* @param {number} h vertical radius of the ellipse
|
|
31776
32232
|
*/
|
|
31777
32233
|
WebGLRenderer.prototype.fillEllipse = function fillEllipse (x, y, w, h) {
|
|
31778
|
-
|
|
31779
|
-
var len = Math.floor(24 * Math.sqrt(w)) ||
|
|
31780
|
-
Math.floor(12 * Math.sqrt(w + h));
|
|
31781
|
-
var segment = (TAU) / len;
|
|
31782
|
-
var points = this._glPoints;
|
|
31783
|
-
var index = 0, i;
|
|
31784
|
-
|
|
31785
|
-
// Grow internal points buffer if necessary
|
|
31786
|
-
for (i = points.length; i < (len + 1) * 2; i++) {
|
|
31787
|
-
points.push(new Vector2d());
|
|
31788
|
-
}
|
|
31789
|
-
|
|
31790
|
-
// draw all vertices vertex coordinates
|
|
31791
|
-
for (i = 0; i < len + 1; i++) {
|
|
31792
|
-
points[index++].set(x, y);
|
|
31793
|
-
points[index++].set(
|
|
31794
|
-
x + (Math.sin(segment * i) * w),
|
|
31795
|
-
y + (Math.cos(segment * i) * h)
|
|
31796
|
-
);
|
|
31797
|
-
}
|
|
31798
|
-
// batch draw all triangles
|
|
31799
|
-
this.currentCompositor.drawVertices(this.gl.TRIANGLE_STRIP, points, index);
|
|
32234
|
+
this.strokeEllipse(x, y, w, h, false);
|
|
31800
32235
|
};
|
|
31801
32236
|
|
|
31802
32237
|
/**
|
|
@@ -31810,12 +32245,14 @@
|
|
|
31810
32245
|
* @param {number} endY the end y coordinate
|
|
31811
32246
|
*/
|
|
31812
32247
|
WebGLRenderer.prototype.strokeLine = function strokeLine (startX, startY, endX, endY) {
|
|
31813
|
-
|
|
31814
|
-
|
|
31815
|
-
|
|
31816
|
-
|
|
31817
|
-
|
|
31818
|
-
this.
|
|
32248
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
32249
|
+
// Fast path: don't draw fully transparent
|
|
32250
|
+
return;
|
|
32251
|
+
}
|
|
32252
|
+
this.path2D.beginPath();
|
|
32253
|
+
this.path2D.moveTo(startX, startY);
|
|
32254
|
+
this.path2D.lineTo(endX, endY);
|
|
32255
|
+
this.currentCompositor.drawVertices(this.gl.LINE_STRIP, this.path2D.points);
|
|
31819
32256
|
};
|
|
31820
32257
|
|
|
31821
32258
|
|
|
@@ -31844,25 +32281,27 @@
|
|
|
31844
32281
|
WebGLRenderer.prototype.strokePolygon = function strokePolygon (poly, fill) {
|
|
31845
32282
|
if ( fill === void 0 ) fill = false;
|
|
31846
32283
|
|
|
31847
|
-
if (
|
|
31848
|
-
|
|
32284
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
32285
|
+
// Fast path: don't draw fully transparent
|
|
32286
|
+
return;
|
|
32287
|
+
}
|
|
32288
|
+
this.translate(poly.pos.x, poly.pos.y);
|
|
32289
|
+
this.path2D.beginPath();
|
|
32290
|
+
this.path2D.moveTo(poly.points[0].x, poly.points[0].y);
|
|
32291
|
+
var point;
|
|
32292
|
+
for (var i = 1; i < poly.points.length; i++) {
|
|
32293
|
+
point = poly.points[i];
|
|
32294
|
+
this.path2D.lineTo(point.x, point.y);
|
|
32295
|
+
}
|
|
32296
|
+
this.path2D.lineTo(poly.points[0].x, poly.points[0].y);
|
|
32297
|
+
this.path2D.closePath();
|
|
32298
|
+
if (fill === false) {
|
|
32299
|
+
this.currentCompositor.drawVertices(this.gl.LINE_LOOP, this.path2D.points);
|
|
31849
32300
|
} else {
|
|
31850
|
-
|
|
31851
|
-
|
|
31852
|
-
i;
|
|
31853
|
-
|
|
31854
|
-
// Grow internal points buffer if necessary
|
|
31855
|
-
for (i = points.length; i < len; i++) {
|
|
31856
|
-
points.push(new Vector2d());
|
|
31857
|
-
}
|
|
31858
|
-
|
|
31859
|
-
// calculate and draw all segments
|
|
31860
|
-
for (i = 0; i < len; i++) {
|
|
31861
|
-
points[i].x = poly.pos.x + poly.points[i].x;
|
|
31862
|
-
points[i].y = poly.pos.y + poly.points[i].y;
|
|
31863
|
-
}
|
|
31864
|
-
this.currentCompositor.drawVertices(this.gl.LINE_LOOP, points, len);
|
|
32301
|
+
// draw all triangles
|
|
32302
|
+
this.currentCompositor.drawVertices(this.gl.TRIANGLES, this.path2D.triangulatePath());
|
|
31865
32303
|
}
|
|
32304
|
+
this.translate(-poly.pos.x, -poly.pos.y);
|
|
31866
32305
|
};
|
|
31867
32306
|
|
|
31868
32307
|
/**
|
|
@@ -31873,24 +32312,7 @@
|
|
|
31873
32312
|
* @param {Polygon} poly the shape to draw
|
|
31874
32313
|
*/
|
|
31875
32314
|
WebGLRenderer.prototype.fillPolygon = function fillPolygon (poly) {
|
|
31876
|
-
|
|
31877
|
-
var glPoints = this._glPoints;
|
|
31878
|
-
var indices = poly.getIndices();
|
|
31879
|
-
var x = poly.pos.x, y = poly.pos.y;
|
|
31880
|
-
var i;
|
|
31881
|
-
|
|
31882
|
-
// Grow internal points buffer if necessary
|
|
31883
|
-
for (i = glPoints.length; i < indices.length; i++) {
|
|
31884
|
-
glPoints.push(new Vector2d());
|
|
31885
|
-
}
|
|
31886
|
-
|
|
31887
|
-
// calculate all vertices
|
|
31888
|
-
for (i = 0; i < indices.length; i++ ) {
|
|
31889
|
-
glPoints[i].set(x + points[indices[i]].x, y + points[indices[i]].y);
|
|
31890
|
-
}
|
|
31891
|
-
|
|
31892
|
-
// draw all triangle
|
|
31893
|
-
this.currentCompositor.drawVertices(this.gl.TRIANGLES, glPoints, indices.length);
|
|
32315
|
+
this.strokePolygon(poly, true);
|
|
31894
32316
|
};
|
|
31895
32317
|
|
|
31896
32318
|
/**
|
|
@@ -31907,19 +32329,16 @@
|
|
|
31907
32329
|
WebGLRenderer.prototype.strokeRect = function strokeRect (x, y, width, height, fill) {
|
|
31908
32330
|
if ( fill === void 0 ) fill = false;
|
|
31909
32331
|
|
|
31910
|
-
if (
|
|
31911
|
-
|
|
32332
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
32333
|
+
// Fast path: don't draw fully transparent
|
|
32334
|
+
return;
|
|
32335
|
+
}
|
|
32336
|
+
this.path2D.beginPath();
|
|
32337
|
+
this.path2D.rect(x, y, width, height);
|
|
32338
|
+
if (fill === false) {
|
|
32339
|
+
this.currentCompositor.drawVertices(this.gl.LINE_LOOP, this.path2D.points);
|
|
31912
32340
|
} else {
|
|
31913
|
-
|
|
31914
|
-
points[0].x = x;
|
|
31915
|
-
points[0].y = y;
|
|
31916
|
-
points[1].x = x + width;
|
|
31917
|
-
points[1].y = y;
|
|
31918
|
-
points[2].x = x + width;
|
|
31919
|
-
points[2].y = y + height;
|
|
31920
|
-
points[3].x = x;
|
|
31921
|
-
points[3].y = y + height;
|
|
31922
|
-
this.currentCompositor.drawVertices(this.gl.LINE_LOOP, points, 4);
|
|
32341
|
+
this.currentCompositor.drawVertices(this.gl.TRIANGLES, this.path2D.triangulatePath());
|
|
31923
32342
|
}
|
|
31924
32343
|
};
|
|
31925
32344
|
|
|
@@ -31934,16 +32353,51 @@
|
|
|
31934
32353
|
* @param {number} height
|
|
31935
32354
|
*/
|
|
31936
32355
|
WebGLRenderer.prototype.fillRect = function fillRect (x, y, width, height) {
|
|
31937
|
-
|
|
31938
|
-
|
|
31939
|
-
|
|
31940
|
-
|
|
31941
|
-
|
|
31942
|
-
|
|
31943
|
-
|
|
31944
|
-
|
|
31945
|
-
|
|
31946
|
-
|
|
32356
|
+
this.strokeRect(x, y, width, height, true);
|
|
32357
|
+
};
|
|
32358
|
+
|
|
32359
|
+
/**
|
|
32360
|
+
* Stroke a rounded rectangle at the specified coordinates
|
|
32361
|
+
* @name strokeRoundRect
|
|
32362
|
+
* @memberof WebGLRenderer.prototype
|
|
32363
|
+
* @function
|
|
32364
|
+
* @param {number} x
|
|
32365
|
+
* @param {number} y
|
|
32366
|
+
* @param {number} width
|
|
32367
|
+
* @param {number} height
|
|
32368
|
+
* @param {number} radius
|
|
32369
|
+
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
32370
|
+
*/
|
|
32371
|
+
WebGLRenderer.prototype.strokeRoundRect = function strokeRoundRect (x, y, width, height, radius, fill) {
|
|
32372
|
+
if ( fill === void 0 ) fill = false;
|
|
32373
|
+
|
|
32374
|
+
if (this.getGlobalAlpha() < 1 / 255) {
|
|
32375
|
+
// Fast path: don't draw fully transparent
|
|
32376
|
+
return;
|
|
32377
|
+
}
|
|
32378
|
+
this.path2D.beginPath();
|
|
32379
|
+
this.path2D.roundRect(x, y, width, height, radius);
|
|
32380
|
+
if (fill === false) {
|
|
32381
|
+
this.currentCompositor.drawVertices(this.gl.LINE_LOOP, this.path2D.points);
|
|
32382
|
+
} else {
|
|
32383
|
+
this.path2D.closePath();
|
|
32384
|
+
this.currentCompositor.drawVertices(this.gl.TRIANGLES, this.path2D.triangulatePath());
|
|
32385
|
+
}
|
|
32386
|
+
};
|
|
32387
|
+
|
|
32388
|
+
/**
|
|
32389
|
+
* Draw a rounded filled rectangle at the specified coordinates
|
|
32390
|
+
* @name fillRoundRect
|
|
32391
|
+
* @memberof WebGLRenderer.prototype
|
|
32392
|
+
* @function
|
|
32393
|
+
* @param {number} x
|
|
32394
|
+
* @param {number} y
|
|
32395
|
+
* @param {number} width
|
|
32396
|
+
* @param {number} height
|
|
32397
|
+
* @param {number} radius
|
|
32398
|
+
*/
|
|
32399
|
+
WebGLRenderer.prototype.fillRoundRect = function fillRoundRect (x, y, width, height, radius) {
|
|
32400
|
+
this.strokeRoundRect(x, y, width, height, radius, true);
|
|
31947
32401
|
};
|
|
31948
32402
|
|
|
31949
32403
|
/**
|
|
@@ -33042,10 +33496,10 @@
|
|
|
33042
33496
|
* this can be overridden by the plugin
|
|
33043
33497
|
* @public
|
|
33044
33498
|
* @type {string}
|
|
33045
|
-
* @default "10.
|
|
33499
|
+
* @default "10.8.0"
|
|
33046
33500
|
* @name plugin.Base#version
|
|
33047
33501
|
*/
|
|
33048
|
-
this.version = "10.
|
|
33502
|
+
this.version = "10.8.0";
|
|
33049
33503
|
};
|
|
33050
33504
|
|
|
33051
33505
|
/**
|
|
@@ -34286,10 +34740,10 @@
|
|
|
34286
34740
|
this.fillStyle = settings.fillStyle;
|
|
34287
34741
|
} else {
|
|
34288
34742
|
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
34289
|
-
this.fillStyle = pull("Color").parseCSS(settings.fillStyle);
|
|
34743
|
+
this.fillStyle = pool$1.pull("Color").parseCSS(settings.fillStyle);
|
|
34290
34744
|
}
|
|
34291
34745
|
} else {
|
|
34292
|
-
this.fillStyle = pull("Color", 0, 0, 0);
|
|
34746
|
+
this.fillStyle = pool$1.pull("Color", 0, 0, 0);
|
|
34293
34747
|
}
|
|
34294
34748
|
|
|
34295
34749
|
/**
|
|
@@ -34303,10 +34757,10 @@
|
|
|
34303
34757
|
this.strokeStyle = settings.strokeStyle;
|
|
34304
34758
|
} else {
|
|
34305
34759
|
// string (#RGB, #ARGB, #RRGGBB, #AARRGGBB)
|
|
34306
|
-
this.strokeStyle = pull("Color").parseCSS(settings.strokeStyle);
|
|
34760
|
+
this.strokeStyle = pool$1.pull("Color").parseCSS(settings.strokeStyle);
|
|
34307
34761
|
}
|
|
34308
34762
|
} else {
|
|
34309
|
-
this.strokeStyle = pull("Color", 0, 0, 0);
|
|
34763
|
+
this.strokeStyle = pool$1.pull("Color", 0, 0, 0);
|
|
34310
34764
|
}
|
|
34311
34765
|
|
|
34312
34766
|
/**
|
|
@@ -34657,8 +35111,8 @@
|
|
|
34657
35111
|
* @ignore
|
|
34658
35112
|
*/
|
|
34659
35113
|
Text.prototype.destroy = function destroy () {
|
|
34660
|
-
push(this.fillStyle);
|
|
34661
|
-
push(this.strokeStyle);
|
|
35114
|
+
pool$1.push(this.fillStyle);
|
|
35115
|
+
pool$1.push(this.strokeStyle);
|
|
34662
35116
|
this.fillStyle = this.strokeStyle = undefined;
|
|
34663
35117
|
this.metrics = undefined;
|
|
34664
35118
|
this._text.length = 0;
|
|
@@ -34724,7 +35178,7 @@
|
|
|
34724
35178
|
* scaled font size
|
|
34725
35179
|
* @private
|
|
34726
35180
|
*/
|
|
34727
|
-
this.fontScale = pull("Vector2d", 1.0, 1.0);
|
|
35181
|
+
this.fontScale = pool$1.pull("Vector2d", 1.0, 1.0);
|
|
34728
35182
|
|
|
34729
35183
|
/**
|
|
34730
35184
|
* font image
|
|
@@ -34738,9 +35192,9 @@
|
|
|
34738
35192
|
* @private
|
|
34739
35193
|
*/
|
|
34740
35194
|
// use settings.font to retreive the data from the loader
|
|
34741
|
-
this.fontData = pull("BitmapTextData", loader.getBinary(settings.font));
|
|
35195
|
+
this.fontData = pool$1.pull("BitmapTextData", loader.getBinary(settings.font));
|
|
34742
35196
|
} else {
|
|
34743
|
-
this.fontData = pull("BitmapTextData",
|
|
35197
|
+
this.fontData = pool$1.pull("BitmapTextData",
|
|
34744
35198
|
// if starting/includes "info face" the whole data string was passed as parameter
|
|
34745
35199
|
(settings.fontData.includes("info face")) ? settings.fontData : loader.getBinary(settings.fontData)
|
|
34746
35200
|
);
|
|
@@ -34979,9 +35433,9 @@
|
|
|
34979
35433
|
* @ignore
|
|
34980
35434
|
*/
|
|
34981
35435
|
BitmapText.prototype.destroy = function destroy () {
|
|
34982
|
-
push(this.fontScale);
|
|
35436
|
+
pool$1.push(this.fontScale);
|
|
34983
35437
|
this.fontScale = undefined;
|
|
34984
|
-
push(this.fontData);
|
|
35438
|
+
pool$1.push(this.fontData);
|
|
34985
35439
|
this.fontData = undefined;
|
|
34986
35440
|
this._text.length = 0;
|
|
34987
35441
|
this.metrics = undefined;
|
|
@@ -35246,7 +35700,7 @@
|
|
|
35246
35700
|
* @name color
|
|
35247
35701
|
* @memberof ColorLayer#
|
|
35248
35702
|
*/
|
|
35249
|
-
this.color = pull("Color").parseCSS(color);
|
|
35703
|
+
this.color = pool$1.pull("Color").parseCSS(color);
|
|
35250
35704
|
|
|
35251
35705
|
this.onResetEvent(name, color, z);
|
|
35252
35706
|
|
|
@@ -35287,7 +35741,7 @@
|
|
|
35287
35741
|
* @ignore
|
|
35288
35742
|
*/
|
|
35289
35743
|
ColorLayer.prototype.destroy = function destroy () {
|
|
35290
|
-
push(this.color);
|
|
35744
|
+
pool$1.push(this.color);
|
|
35291
35745
|
this.color = undefined;
|
|
35292
35746
|
Renderable.prototype.destroy.call(this);
|
|
35293
35747
|
};
|
|
@@ -35323,7 +35777,7 @@
|
|
|
35323
35777
|
* @default <1.0,1.0>
|
|
35324
35778
|
* @name ImageLayer#ratio
|
|
35325
35779
|
*/
|
|
35326
|
-
this.ratio = pull("Vector2d", 1.0, 1.0);
|
|
35780
|
+
this.ratio = pool$1.pull("Vector2d", 1.0, 1.0);
|
|
35327
35781
|
|
|
35328
35782
|
if (typeof(settings.ratio) !== "undefined") {
|
|
35329
35783
|
// little hack for backward compatiblity
|
|
@@ -35572,7 +36026,7 @@
|
|
|
35572
36026
|
* @ignore
|
|
35573
36027
|
*/
|
|
35574
36028
|
ImageLayer.prototype.destroy = function destroy () {
|
|
35575
|
-
push(this.ratio);
|
|
36029
|
+
pool$1.push(this.ratio);
|
|
35576
36030
|
this.ratio = undefined;
|
|
35577
36031
|
off(ONCONTEXT_RESTORED, this.createPattern);
|
|
35578
36032
|
Sprite.prototype.destroy.call(this);
|
|
@@ -36007,7 +36461,15 @@
|
|
|
36007
36461
|
this.id = settings.id;
|
|
36008
36462
|
|
|
36009
36463
|
// add and configure the physic body
|
|
36010
|
-
|
|
36464
|
+
var shape = settings.shapes;
|
|
36465
|
+
if (typeof shape === "undefined") {
|
|
36466
|
+
shape = pool.pull("Polygon", 0, 0, [
|
|
36467
|
+
pool.pull("Vector2d", 0, 0),
|
|
36468
|
+
pool.pull("Vector2d", this.width, 0),
|
|
36469
|
+
pool.pull("Vector2d", this.width, this.height)
|
|
36470
|
+
]);
|
|
36471
|
+
}
|
|
36472
|
+
this.body = new Body(this, shape);
|
|
36011
36473
|
this.body.collisionType = collision.types.COLLECTABLE_OBJECT;
|
|
36012
36474
|
// by default only collides with PLAYER_OBJECT
|
|
36013
36475
|
this.body.setCollisionMask(collision.types.PLAYER_OBJECT);
|
|
@@ -36067,9 +36529,16 @@
|
|
|
36067
36529
|
}
|
|
36068
36530
|
}.bind(this));
|
|
36069
36531
|
|
|
36070
|
-
|
|
36071
|
-
|
|
36072
|
-
|
|
36532
|
+
// add and configure the physic body
|
|
36533
|
+
var shape = settings.shapes;
|
|
36534
|
+
if (typeof shape === "undefined") {
|
|
36535
|
+
shape = pool.pull("Polygon", 0, 0, [
|
|
36536
|
+
pool.pull("Vector2d", 0, 0),
|
|
36537
|
+
pool.pull("Vector2d", this.width, 0),
|
|
36538
|
+
pool.pull("Vector2d", this.width, this.height)
|
|
36539
|
+
]);
|
|
36540
|
+
}
|
|
36541
|
+
this.body = new Body(this, shape);
|
|
36073
36542
|
this.body.collisionType = collision.types.ACTION_OBJECT;
|
|
36074
36543
|
// by default only collides with PLAYER_OBJECT
|
|
36075
36544
|
this.body.setCollisionMask(collision.types.PLAYER_OBJECT);
|
|
@@ -36703,6 +37172,15 @@
|
|
|
36703
37172
|
settings.height | 1
|
|
36704
37173
|
);
|
|
36705
37174
|
|
|
37175
|
+
/**
|
|
37176
|
+
* the current (active) emitter settings
|
|
37177
|
+
* @public
|
|
37178
|
+
* @type {ParticleEmitterSettings}
|
|
37179
|
+
* @name settings
|
|
37180
|
+
* @memberof ParticleEmitter
|
|
37181
|
+
*/
|
|
37182
|
+
this.settings = {};
|
|
37183
|
+
|
|
36706
37184
|
// center the emitter around the given coordinates
|
|
36707
37185
|
this.centerOn(x, y);
|
|
36708
37186
|
|
|
@@ -36733,9 +37211,6 @@
|
|
|
36733
37211
|
// count the updates
|
|
36734
37212
|
this._updateCount = 0;
|
|
36735
37213
|
|
|
36736
|
-
// the emitter settings
|
|
36737
|
-
this.settings = {};
|
|
36738
|
-
|
|
36739
37214
|
// internally store how much time was skipped when frames are skipped
|
|
36740
37215
|
this._dt = 0;
|
|
36741
37216
|
|
|
@@ -36751,7 +37226,7 @@
|
|
|
36751
37226
|
|
|
36752
37227
|
/**
|
|
36753
37228
|
* Reset the emitter with particle emitter settings.
|
|
36754
|
-
* @param {
|
|
37229
|
+
* @param {ParticleEmitterSettings} settings [optional] object with emitter settings. See {@link ParticleEmitterSettings}
|
|
36755
37230
|
*/
|
|
36756
37231
|
ParticleEmitter.prototype.reset = function reset (settings) {
|
|
36757
37232
|
if ( settings === void 0 ) settings = {};
|
|
@@ -36787,9 +37262,9 @@
|
|
|
36787
37262
|
// Add count particles in the game world
|
|
36788
37263
|
/** @ignore */
|
|
36789
37264
|
ParticleEmitter.prototype.addParticles = function addParticles (count) {
|
|
36790
|
-
for (var i = 0; i <
|
|
37265
|
+
for (var i = 0; i < count; i++) {
|
|
36791
37266
|
// Add particle to the container
|
|
36792
|
-
this.addChild(pull("Particle", this), this.pos.z);
|
|
37267
|
+
this.addChild(pool$1.pull("Particle", this), this.pos.z);
|
|
36793
37268
|
}
|
|
36794
37269
|
this.isDirty = true;
|
|
36795
37270
|
};
|
|
@@ -36933,9 +37408,10 @@
|
|
|
36933
37408
|
emitter.settings.image.width,
|
|
36934
37409
|
emitter.settings.image.height
|
|
36935
37410
|
);
|
|
37411
|
+
this.currentTransform.identity();
|
|
36936
37412
|
} else {
|
|
36937
37413
|
// particle velocity
|
|
36938
|
-
this.vel =
|
|
37414
|
+
this.vel = pool$1.pull("Vector2d");
|
|
36939
37415
|
}
|
|
36940
37416
|
|
|
36941
37417
|
this.image = emitter.settings.image;
|
|
@@ -37154,11 +37630,11 @@
|
|
|
37154
37630
|
*/
|
|
37155
37631
|
// initialize the default body
|
|
37156
37632
|
if (typeof settings.shapes === "undefined") {
|
|
37157
|
-
settings.shapes =
|
|
37158
|
-
|
|
37159
|
-
|
|
37160
|
-
|
|
37161
|
-
|
|
37633
|
+
settings.shapes = pool$1.pull("Polygon", 0, 0, [
|
|
37634
|
+
pool$1.pull("Vector2d", 0, 0),
|
|
37635
|
+
pool$1.pull("Vector2d", this.width, 0),
|
|
37636
|
+
pool$1.pull("Vector2d", this.width, this.height),
|
|
37637
|
+
pool$1.pull("Vector2d", 0, this.height)
|
|
37162
37638
|
]);
|
|
37163
37639
|
}
|
|
37164
37640
|
this.body = new Body(this, settings.shapes, this.onBodyUpdate.bind(this));
|
|
@@ -37374,7 +37850,7 @@
|
|
|
37374
37850
|
/**
|
|
37375
37851
|
* @public
|
|
37376
37852
|
* @name Texture
|
|
37377
|
-
* @memberof Renderer
|
|
37853
|
+
* @memberof Renderer#
|
|
37378
37854
|
* @deprecated since 10.4.0
|
|
37379
37855
|
* @see TextureAtlas
|
|
37380
37856
|
*/
|
|
@@ -37439,7 +37915,7 @@
|
|
|
37439
37915
|
* @name version
|
|
37440
37916
|
* @type {string}
|
|
37441
37917
|
*/
|
|
37442
|
-
var version = "10.
|
|
37918
|
+
var version = "10.8.0";
|
|
37443
37919
|
|
|
37444
37920
|
|
|
37445
37921
|
/**
|
|
@@ -37474,58 +37950,60 @@
|
|
|
37474
37950
|
}
|
|
37475
37951
|
|
|
37476
37952
|
// register all built-ins objects into the object pool
|
|
37477
|
-
register("me.Entity", Entity);
|
|
37478
|
-
register("me.Collectable", Collectable);
|
|
37479
|
-
register("me.Trigger", Trigger);
|
|
37480
|
-
register("me.Tween", Tween, true);
|
|
37481
|
-
register("me.Color", Color, true);
|
|
37482
|
-
register("me.Particle", Particle, true);
|
|
37483
|
-
register("me.Sprite", Sprite);
|
|
37484
|
-
register("me.NineSliceSprite", NineSliceSprite);
|
|
37485
|
-
register("me.Renderable", Renderable);
|
|
37486
|
-
register("me.Text", Text, true);
|
|
37487
|
-
register("me.BitmapText", BitmapText);
|
|
37488
|
-
register("me.BitmapTextData", BitmapTextData, true);
|
|
37489
|
-
register("me.ImageLayer", ImageLayer);
|
|
37490
|
-
register("me.ColorLayer", ColorLayer, true);
|
|
37491
|
-
register("me.Vector2d", Vector2d, true);
|
|
37492
|
-
register("me.Vector3d", Vector3d, true);
|
|
37493
|
-
register("me.ObservableVector2d", ObservableVector2d, true);
|
|
37494
|
-
register("me.ObservableVector3d", ObservableVector3d, true);
|
|
37495
|
-
register("me.Matrix2d", Matrix2d, true);
|
|
37496
|
-
register("me.Matrix3d", Matrix3d, true);
|
|
37497
|
-
register("me.Rect", Rect, true);
|
|
37498
|
-
register("me.
|
|
37499
|
-
register("me.
|
|
37500
|
-
register("me.
|
|
37501
|
-
register("me.
|
|
37953
|
+
pool$1.register("me.Entity", Entity);
|
|
37954
|
+
pool$1.register("me.Collectable", Collectable);
|
|
37955
|
+
pool$1.register("me.Trigger", Trigger);
|
|
37956
|
+
pool$1.register("me.Tween", Tween, true);
|
|
37957
|
+
pool$1.register("me.Color", Color, true);
|
|
37958
|
+
pool$1.register("me.Particle", Particle, true);
|
|
37959
|
+
pool$1.register("me.Sprite", Sprite);
|
|
37960
|
+
pool$1.register("me.NineSliceSprite", NineSliceSprite);
|
|
37961
|
+
pool$1.register("me.Renderable", Renderable);
|
|
37962
|
+
pool$1.register("me.Text", Text, true);
|
|
37963
|
+
pool$1.register("me.BitmapText", BitmapText);
|
|
37964
|
+
pool$1.register("me.BitmapTextData", BitmapTextData, true);
|
|
37965
|
+
pool$1.register("me.ImageLayer", ImageLayer);
|
|
37966
|
+
pool$1.register("me.ColorLayer", ColorLayer, true);
|
|
37967
|
+
pool$1.register("me.Vector2d", Vector2d, true);
|
|
37968
|
+
pool$1.register("me.Vector3d", Vector3d, true);
|
|
37969
|
+
pool$1.register("me.ObservableVector2d", ObservableVector2d, true);
|
|
37970
|
+
pool$1.register("me.ObservableVector3d", ObservableVector3d, true);
|
|
37971
|
+
pool$1.register("me.Matrix2d", Matrix2d, true);
|
|
37972
|
+
pool$1.register("me.Matrix3d", Matrix3d, true);
|
|
37973
|
+
pool$1.register("me.Rect", Rect, true);
|
|
37974
|
+
pool$1.register("me.RoundRect", RoundRect, true);
|
|
37975
|
+
pool$1.register("me.Polygon", Polygon, true);
|
|
37976
|
+
pool$1.register("me.Line", Line, true);
|
|
37977
|
+
pool$1.register("me.Ellipse", Ellipse, true);
|
|
37978
|
+
pool$1.register("me.Bounds", Bounds$1, true);
|
|
37502
37979
|
|
|
37503
37980
|
// duplicate all entries if use with no namespace (e.g. es6)
|
|
37504
|
-
register("Entity", Entity);
|
|
37505
|
-
register("Collectable", Collectable);
|
|
37506
|
-
register("Trigger", Trigger);
|
|
37507
|
-
register("Tween", Tween, true);
|
|
37508
|
-
register("Color", Color, true);
|
|
37509
|
-
register("Particle", Particle, true);
|
|
37510
|
-
register("Sprite", Sprite);
|
|
37511
|
-
register("NineSliceSprite", NineSliceSprite);
|
|
37512
|
-
register("Renderable", Renderable);
|
|
37513
|
-
register("Text", Text, true);
|
|
37514
|
-
register("BitmapText", BitmapText);
|
|
37515
|
-
register("BitmapTextData", BitmapTextData, true);
|
|
37516
|
-
register("ImageLayer", ImageLayer);
|
|
37517
|
-
register("ColorLayer", ColorLayer, true);
|
|
37518
|
-
register("Vector2d", Vector2d, true);
|
|
37519
|
-
register("Vector3d", Vector3d, true);
|
|
37520
|
-
register("ObservableVector2d", ObservableVector2d, true);
|
|
37521
|
-
register("ObservableVector3d", ObservableVector3d, true);
|
|
37522
|
-
register("Matrix2d", Matrix2d, true);
|
|
37523
|
-
register("Matrix3d", Matrix3d, true);
|
|
37524
|
-
register("Rect", Rect, true);
|
|
37525
|
-
register("
|
|
37526
|
-
register("
|
|
37527
|
-
register("
|
|
37528
|
-
register("
|
|
37981
|
+
pool$1.register("Entity", Entity);
|
|
37982
|
+
pool$1.register("Collectable", Collectable);
|
|
37983
|
+
pool$1.register("Trigger", Trigger);
|
|
37984
|
+
pool$1.register("Tween", Tween, true);
|
|
37985
|
+
pool$1.register("Color", Color, true);
|
|
37986
|
+
pool$1.register("Particle", Particle, true);
|
|
37987
|
+
pool$1.register("Sprite", Sprite);
|
|
37988
|
+
pool$1.register("NineSliceSprite", NineSliceSprite);
|
|
37989
|
+
pool$1.register("Renderable", Renderable);
|
|
37990
|
+
pool$1.register("Text", Text, true);
|
|
37991
|
+
pool$1.register("BitmapText", BitmapText);
|
|
37992
|
+
pool$1.register("BitmapTextData", BitmapTextData, true);
|
|
37993
|
+
pool$1.register("ImageLayer", ImageLayer);
|
|
37994
|
+
pool$1.register("ColorLayer", ColorLayer, true);
|
|
37995
|
+
pool$1.register("Vector2d", Vector2d, true);
|
|
37996
|
+
pool$1.register("Vector3d", Vector3d, true);
|
|
37997
|
+
pool$1.register("ObservableVector2d", ObservableVector2d, true);
|
|
37998
|
+
pool$1.register("ObservableVector3d", ObservableVector3d, true);
|
|
37999
|
+
pool$1.register("Matrix2d", Matrix2d, true);
|
|
38000
|
+
pool$1.register("Matrix3d", Matrix3d, true);
|
|
38001
|
+
pool$1.register("Rect", Rect, true);
|
|
38002
|
+
pool$1.register("RoundRect", RoundRect, true);
|
|
38003
|
+
pool$1.register("Polygon", Polygon, true);
|
|
38004
|
+
pool$1.register("Line", Line, true);
|
|
38005
|
+
pool$1.register("Ellipse", Ellipse, true);
|
|
38006
|
+
pool$1.register("Bounds", Bounds$1, true);
|
|
37529
38007
|
|
|
37530
38008
|
// publish Boot notification
|
|
37531
38009
|
emit(BOOT);
|
|
@@ -37581,6 +38059,7 @@
|
|
|
37581
38059
|
exports.Rect = Rect;
|
|
37582
38060
|
exports.Renderable = Renderable;
|
|
37583
38061
|
exports.Renderer = Renderer;
|
|
38062
|
+
exports.RoundRect = RoundRect;
|
|
37584
38063
|
exports.Sprite = Sprite;
|
|
37585
38064
|
exports.Stage = Stage;
|
|
37586
38065
|
exports.TMXHexagonalRenderer = TMXHexagonalRenderer;
|
|
@@ -37613,7 +38092,7 @@
|
|
|
37613
38092
|
exports.loader = loader;
|
|
37614
38093
|
exports.plugin = plugin;
|
|
37615
38094
|
exports.plugins = plugins;
|
|
37616
|
-
exports.pool =
|
|
38095
|
+
exports.pool = pool$1;
|
|
37617
38096
|
exports.save = save;
|
|
37618
38097
|
exports.skipAutoInit = skipAutoInit;
|
|
37619
38098
|
exports.state = state;
|