melonjs 13.4.0 → 14.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -6
- package/dist/melonjs.module.d.ts +13108 -11652
- package/dist/melonjs.module.js +642 -187
- package/package.json +21 -21
- package/src/application/application.js +3 -3
- package/src/audio/audio.js +27 -27
- package/src/camera/camera2d.js +1 -2
- package/src/entity/entity.js +1 -2
- package/src/geometries/ellipse.js +1 -2
- package/src/geometries/line.js +2 -3
- package/src/geometries/poly.js +2 -2
- package/src/geometries/rectangle.js +1 -3
- package/src/geometries/roundrect.js +1 -2
- package/src/index.js +8 -4
- package/src/input/gamepad.js +12 -12
- package/src/input/keyboard.js +8 -8
- package/src/input/pointer.js +1 -1
- package/src/input/pointerevent.js +9 -9
- package/src/lang/deprecated.js +21 -2
- package/src/level/level.js +2 -2
- package/src/level/tiled/TMXGroup.js +1 -1
- package/src/level/tiled/TMXLayer.js +1 -1
- package/src/level/tiled/TMXTile.js +2 -2
- package/src/level/tiled/TMXTileMap.js +4 -4
- package/src/level/tiled/TMXTileset.js +2 -2
- package/src/level/tiled/TMXTilesetGroup.js +1 -1
- package/src/level/tiled/TMXUtils.js +7 -7
- 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 +9 -9
- package/src/loader/loadingscreen.js +2 -2
- package/src/math/color.js +3 -3
- package/src/math/math.js +10 -10
- 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 +2 -2
- package/src/particles/particle.js +1 -1
- package/src/physics/body.js +2 -2
- package/src/physics/bounds.js +10 -7
- package/src/physics/detector.js +56 -55
- package/src/physics/quadtree.js +3 -3
- package/src/physics/world.js +2 -2
- package/src/polyfill/performance.js +1 -1
- package/src/polyfill/requestAnimationFrame.js +1 -1
- package/src/renderable/collectable.js +1 -1
- package/src/renderable/colorlayer.js +1 -1
- package/src/renderable/container.js +10 -6
- package/src/renderable/dragndrop.js +2 -2
- package/src/renderable/imagelayer.js +1 -2
- package/src/renderable/light2d.js +1 -1
- package/src/renderable/nineslicesprite.js +1 -2
- package/src/renderable/renderable.js +1 -3
- package/src/renderable/sprite.js +3 -4
- package/src/renderable/trigger.js +3 -4
- package/src/renderable/ui/uibaseelement.js +204 -0
- package/src/renderable/{GUI.js → ui/uispriteelement.js} +8 -35
- package/src/renderable/ui/uitextbutton.js +121 -0
- package/src/state/stage.js +4 -5
- package/src/system/device.js +27 -27
- package/src/system/dom.js +1 -1
- package/src/system/event.js +4 -4
- package/src/system/pooling.js +2 -3
- package/src/system/save.js +2 -2
- package/src/system/timer.js +1 -1
- package/src/text/bitmaptext.js +2 -3
- package/src/text/bitmaptextdata.js +4 -7
- package/src/text/glyph.js +1 -2
- package/src/text/text.js +2 -3
- package/src/text/textstyle.js +1 -1
- package/src/tweens/tween.js +2 -3
- package/src/utils/agent.js +4 -4
- package/src/utils/array.js +3 -3
- package/src/utils/file.js +2 -2
- package/src/utils/function.js +3 -3
- package/src/utils/string.js +5 -5
- package/src/utils/utils.js +2 -2
- package/src/video/canvas/canvas_renderer.js +1 -2
- package/src/video/renderer.js +2 -3
- package/src/video/texture/atlas.js +2 -2
- package/src/video/texture/cache.js +1 -2
- package/src/video/video.js +12 -14
- package/src/video/webgl/buffer/vertex.js +1 -2
- package/src/video/webgl/glshader.js +1 -2
- package/src/video/webgl/utils/attributes.js +1 -1
- package/src/video/webgl/utils/precision.js +1 -1
- package/src/video/webgl/utils/program.js +2 -2
- package/src/video/webgl/utils/string.js +1 -1
- package/src/video/webgl/utils/uniforms.js +3 -3
- package/src/video/webgl/webgl_compositor.js +1 -2
- package/src/video/webgl/webgl_renderer.js +1 -2
- package/dist/melonjs.js +0 -37922
- package/dist/melonjs.min.js +0 -29
package/dist/melonjs.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine -
|
|
2
|
+
* melonJS Game Engine - v14.0.1
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -85,33 +85,40 @@ var createPropertyDescriptor$2 = function (bitmap, value) {
|
|
|
85
85
|
var NATIVE_BIND = functionBindNative;
|
|
86
86
|
|
|
87
87
|
var FunctionPrototype$1 = Function.prototype;
|
|
88
|
-
var bind = FunctionPrototype$1.bind;
|
|
89
88
|
var call$3 = FunctionPrototype$1.call;
|
|
90
|
-
var
|
|
89
|
+
var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype$1.bind.bind(call$3, call$3);
|
|
91
90
|
|
|
92
|
-
var
|
|
93
|
-
return
|
|
94
|
-
} : function (fn) {
|
|
95
|
-
return fn && function () {
|
|
91
|
+
var functionUncurryThisRaw = function (fn) {
|
|
92
|
+
return NATIVE_BIND ? uncurryThisWithBind(fn) : function () {
|
|
96
93
|
return call$3.apply(fn, arguments);
|
|
97
94
|
};
|
|
98
95
|
};
|
|
99
96
|
|
|
100
|
-
var
|
|
97
|
+
var uncurryThisRaw$1 = functionUncurryThisRaw;
|
|
101
98
|
|
|
102
|
-
var toString$4 =
|
|
103
|
-
var stringSlice =
|
|
99
|
+
var toString$4 = uncurryThisRaw$1({}.toString);
|
|
100
|
+
var stringSlice = uncurryThisRaw$1(''.slice);
|
|
104
101
|
|
|
105
|
-
var classofRaw$
|
|
102
|
+
var classofRaw$2 = function (it) {
|
|
106
103
|
return stringSlice(toString$4(it), 8, -1);
|
|
107
104
|
};
|
|
108
105
|
|
|
109
|
-
var
|
|
106
|
+
var classofRaw$1 = classofRaw$2;
|
|
107
|
+
var uncurryThisRaw = functionUncurryThisRaw;
|
|
108
|
+
|
|
109
|
+
var functionUncurryThis = function (fn) {
|
|
110
|
+
// Nashorn bug:
|
|
111
|
+
// https://github.com/zloirock/core-js/issues/1128
|
|
112
|
+
// https://github.com/zloirock/core-js/issues/1130
|
|
113
|
+
if (classofRaw$1(fn) === 'Function') return uncurryThisRaw(fn);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
var uncurryThis$8 = functionUncurryThis;
|
|
110
117
|
var fails$6 = fails$9;
|
|
111
|
-
var classof$2 = classofRaw$
|
|
118
|
+
var classof$2 = classofRaw$2;
|
|
112
119
|
|
|
113
120
|
var $Object$3 = Object;
|
|
114
|
-
var split = uncurryThis$
|
|
121
|
+
var split = uncurryThis$8(''.split);
|
|
115
122
|
|
|
116
123
|
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
117
124
|
var indexedObject = fails$6(function () {
|
|
@@ -191,9 +198,9 @@ var getBuiltIn$3 = function (namespace, method) {
|
|
|
191
198
|
return arguments.length < 2 ? aFunction(global$b[namespace]) : global$b[namespace] && global$b[namespace][method];
|
|
192
199
|
};
|
|
193
200
|
|
|
194
|
-
var uncurryThis$
|
|
201
|
+
var uncurryThis$7 = functionUncurryThis;
|
|
195
202
|
|
|
196
|
-
var objectIsPrototypeOf = uncurryThis$
|
|
203
|
+
var objectIsPrototypeOf = uncurryThis$7({}.isPrototypeOf);
|
|
197
204
|
|
|
198
205
|
var getBuiltIn$2 = getBuiltIn$3;
|
|
199
206
|
|
|
@@ -339,10 +346,10 @@ var store$2 = sharedStore;
|
|
|
339
346
|
(shared$3.exports = function (key, value) {
|
|
340
347
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
341
348
|
})('versions', []).push({
|
|
342
|
-
version: '3.25.
|
|
349
|
+
version: '3.25.5',
|
|
343
350
|
mode: 'global',
|
|
344
351
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
345
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.25.
|
|
352
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.25.5/LICENSE',
|
|
346
353
|
source: 'https://github.com/zloirock/core-js'
|
|
347
354
|
});
|
|
348
355
|
|
|
@@ -356,10 +363,10 @@ var toObject$1 = function (argument) {
|
|
|
356
363
|
return $Object$1(requireObjectCoercible$1(argument));
|
|
357
364
|
};
|
|
358
365
|
|
|
359
|
-
var uncurryThis$
|
|
366
|
+
var uncurryThis$6 = functionUncurryThis;
|
|
360
367
|
var toObject = toObject$1;
|
|
361
368
|
|
|
362
|
-
var hasOwnProperty = uncurryThis$
|
|
369
|
+
var hasOwnProperty = uncurryThis$6({}.hasOwnProperty);
|
|
363
370
|
|
|
364
371
|
// `HasOwnProperty` abstract operation
|
|
365
372
|
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
@@ -368,11 +375,11 @@ var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
|
368
375
|
return hasOwnProperty(toObject(it), key);
|
|
369
376
|
};
|
|
370
377
|
|
|
371
|
-
var uncurryThis$
|
|
378
|
+
var uncurryThis$5 = functionUncurryThis;
|
|
372
379
|
|
|
373
380
|
var id = 0;
|
|
374
381
|
var postfix = Math.random();
|
|
375
|
-
var toString$3 = uncurryThis$
|
|
382
|
+
var toString$3 = uncurryThis$5(1.0.toString);
|
|
376
383
|
|
|
377
384
|
var uid$2 = function (key) {
|
|
378
385
|
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$3(++id + postfix, 36);
|
|
@@ -586,11 +593,11 @@ var functionName = {
|
|
|
586
593
|
CONFIGURABLE: CONFIGURABLE
|
|
587
594
|
};
|
|
588
595
|
|
|
589
|
-
var uncurryThis$
|
|
596
|
+
var uncurryThis$4 = functionUncurryThis;
|
|
590
597
|
var isCallable$5 = isCallable$b;
|
|
591
598
|
var store$1 = sharedStore;
|
|
592
599
|
|
|
593
|
-
var functionToString = uncurryThis$
|
|
600
|
+
var functionToString = uncurryThis$4(Function.toString);
|
|
594
601
|
|
|
595
602
|
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
596
603
|
if (!isCallable$5(store$1.inspectSource)) {
|
|
@@ -621,7 +628,6 @@ var hiddenKeys$3 = {};
|
|
|
621
628
|
|
|
622
629
|
var NATIVE_WEAK_MAP = weakMapBasicDetection;
|
|
623
630
|
var global$4 = global$c;
|
|
624
|
-
var uncurryThis$4 = functionUncurryThis;
|
|
625
631
|
var isObject = isObject$5;
|
|
626
632
|
var createNonEnumerableProperty$1 = createNonEnumerableProperty$2;
|
|
627
633
|
var hasOwn$3 = hasOwnProperty_1;
|
|
@@ -649,20 +655,22 @@ var getterFor = function (TYPE) {
|
|
|
649
655
|
|
|
650
656
|
if (NATIVE_WEAK_MAP || shared.state) {
|
|
651
657
|
var store = shared.state || (shared.state = new WeakMap());
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
658
|
+
/* eslint-disable no-self-assign -- prototype methods protection */
|
|
659
|
+
store.get = store.get;
|
|
660
|
+
store.has = store.has;
|
|
661
|
+
store.set = store.set;
|
|
662
|
+
/* eslint-enable no-self-assign -- prototype methods protection */
|
|
655
663
|
set = function (it, metadata) {
|
|
656
|
-
if (
|
|
664
|
+
if (store.has(it)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
657
665
|
metadata.facade = it;
|
|
658
|
-
|
|
666
|
+
store.set(it, metadata);
|
|
659
667
|
return metadata;
|
|
660
668
|
};
|
|
661
669
|
get = function (it) {
|
|
662
|
-
return
|
|
670
|
+
return store.get(it) || {};
|
|
663
671
|
};
|
|
664
672
|
has = function (it) {
|
|
665
|
-
return
|
|
673
|
+
return store.has(it);
|
|
666
674
|
};
|
|
667
675
|
} else {
|
|
668
676
|
var STATE = sharedKey('state');
|
|
@@ -1033,7 +1041,7 @@ var toStringTagSupport = String(test) === '[object z]';
|
|
|
1033
1041
|
|
|
1034
1042
|
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
|
|
1035
1043
|
var isCallable = isCallable$b;
|
|
1036
|
-
var classofRaw = classofRaw$
|
|
1044
|
+
var classofRaw = classofRaw$2;
|
|
1037
1045
|
var wellKnownSymbol = wellKnownSymbol$3;
|
|
1038
1046
|
|
|
1039
1047
|
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
@@ -1225,7 +1233,7 @@ Date.now = (Date.now || function () { // thanks IE8
|
|
|
1225
1233
|
|
|
1226
1234
|
if ("now" in globalThis.performance === false) {
|
|
1227
1235
|
|
|
1228
|
-
|
|
1236
|
+
let nowOffset = Date.now();
|
|
1229
1237
|
|
|
1230
1238
|
if (performance.timing && performance.timing.navigationStart) {
|
|
1231
1239
|
nowOffset = performance.timing.navigationStart;
|
|
@@ -1252,6 +1260,7 @@ if ("now" in globalThis.performance === false) {
|
|
|
1252
1260
|
function capitalize(str) {
|
|
1253
1261
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1254
1262
|
}
|
|
1263
|
+
|
|
1255
1264
|
/**
|
|
1256
1265
|
* returns true if the given string contains a numeric integer or float value
|
|
1257
1266
|
* @public
|
|
@@ -1266,6 +1275,7 @@ function isNumeric(str) {
|
|
|
1266
1275
|
}
|
|
1267
1276
|
return !isNaN(str) && /[+-]?([0-9]*[.])?[0-9]+/.test(str);
|
|
1268
1277
|
}
|
|
1278
|
+
|
|
1269
1279
|
/**
|
|
1270
1280
|
* returns true if the given string contains a true or false
|
|
1271
1281
|
* @public
|
|
@@ -1278,6 +1288,7 @@ function isBoolean(str) {
|
|
|
1278
1288
|
var trimmed = str.trim();
|
|
1279
1289
|
return (trimmed === "true") || (trimmed === "false");
|
|
1280
1290
|
}
|
|
1291
|
+
|
|
1281
1292
|
/**
|
|
1282
1293
|
* convert a string to the corresponding hexadecimal value
|
|
1283
1294
|
* @public
|
|
@@ -1293,6 +1304,7 @@ function toHex$1(str) {
|
|
|
1293
1304
|
}
|
|
1294
1305
|
return res;
|
|
1295
1306
|
}
|
|
1307
|
+
|
|
1296
1308
|
/**
|
|
1297
1309
|
* returns true if the given string is a data url in the `data:[<mediatype>][;base64],<data>` format.
|
|
1298
1310
|
* (this will not test the validity of the Data or Base64 encoding)
|
|
@@ -1344,12 +1356,13 @@ function prefixed(name, obj) {
|
|
|
1344
1356
|
var uc_name = capitalize(name);
|
|
1345
1357
|
|
|
1346
1358
|
var result;
|
|
1347
|
-
vendors$1.some(
|
|
1359
|
+
vendors$1.some((vendor) => {
|
|
1348
1360
|
var name = vendor + uc_name;
|
|
1349
1361
|
return (result = (name in obj) ? obj[name] : undefined);
|
|
1350
1362
|
});
|
|
1351
1363
|
return result;
|
|
1352
1364
|
}
|
|
1365
|
+
|
|
1353
1366
|
/**
|
|
1354
1367
|
* Set a vendor-prefixed property
|
|
1355
1368
|
* @public
|
|
@@ -1369,7 +1382,7 @@ function setPrefixed(name, value, obj) {
|
|
|
1369
1382
|
|
|
1370
1383
|
var uc_name = capitalize(name);
|
|
1371
1384
|
|
|
1372
|
-
vendors$1.some(
|
|
1385
|
+
vendors$1.some((vendor) => {
|
|
1373
1386
|
var name = vendor + uc_name;
|
|
1374
1387
|
if (name in obj) {
|
|
1375
1388
|
obj[name] = value;
|
|
@@ -1447,6 +1460,7 @@ const EPSILON = 0.000001;
|
|
|
1447
1460
|
function isPowerOfTwo(val) {
|
|
1448
1461
|
return (val & (val - 1)) === 0;
|
|
1449
1462
|
}
|
|
1463
|
+
|
|
1450
1464
|
/**
|
|
1451
1465
|
* returns the next power of two for the given value
|
|
1452
1466
|
* @public
|
|
@@ -1465,6 +1479,7 @@ function nextPowerOfTwo(val) {
|
|
|
1465
1479
|
val ++;
|
|
1466
1480
|
return val;
|
|
1467
1481
|
}
|
|
1482
|
+
|
|
1468
1483
|
/**
|
|
1469
1484
|
* Converts an angle in degrees to an angle in radians
|
|
1470
1485
|
* @public
|
|
@@ -1479,6 +1494,7 @@ function nextPowerOfTwo(val) {
|
|
|
1479
1494
|
function degToRad(angle) {
|
|
1480
1495
|
return angle * DEG_TO_RAD;
|
|
1481
1496
|
}
|
|
1497
|
+
|
|
1482
1498
|
/**
|
|
1483
1499
|
* Converts an angle in radians to an angle in degrees.
|
|
1484
1500
|
* @public
|
|
@@ -1493,6 +1509,7 @@ function degToRad(angle) {
|
|
|
1493
1509
|
function radToDeg(radians) {
|
|
1494
1510
|
return radians * RAD_TO_DEG;
|
|
1495
1511
|
}
|
|
1512
|
+
|
|
1496
1513
|
/**
|
|
1497
1514
|
* clamp the given value
|
|
1498
1515
|
* @public
|
|
@@ -1506,6 +1523,7 @@ function radToDeg(radians) {
|
|
|
1506
1523
|
function clamp(val, low, high) {
|
|
1507
1524
|
return val < low ? low : val > high ? high : +val;
|
|
1508
1525
|
}
|
|
1526
|
+
|
|
1509
1527
|
/**
|
|
1510
1528
|
* return a random integer between min (included) and max (excluded)
|
|
1511
1529
|
* @public
|
|
@@ -1521,6 +1539,7 @@ function clamp(val, low, high) {
|
|
|
1521
1539
|
function random$1(min, max) {
|
|
1522
1540
|
return (~~(Math.random() * (max - min)) + min);
|
|
1523
1541
|
}
|
|
1542
|
+
|
|
1524
1543
|
/**
|
|
1525
1544
|
* return a random float between min, max (exclusive)
|
|
1526
1545
|
* @public
|
|
@@ -1536,6 +1555,7 @@ function random$1(min, max) {
|
|
|
1536
1555
|
function randomFloat(min, max) {
|
|
1537
1556
|
return (Math.random() * (max - min)) + min;
|
|
1538
1557
|
}
|
|
1558
|
+
|
|
1539
1559
|
/**
|
|
1540
1560
|
* return a weighted random between min, max (exclusive)
|
|
1541
1561
|
* @public
|
|
@@ -1551,6 +1571,7 @@ function randomFloat(min, max) {
|
|
|
1551
1571
|
function weightedRandom$1(min, max) {
|
|
1552
1572
|
return (~~(Math.pow(Math.random(), 2) * (max - min)) + min);
|
|
1553
1573
|
}
|
|
1574
|
+
|
|
1554
1575
|
/**
|
|
1555
1576
|
* round a value to the specified number of digit
|
|
1556
1577
|
* @public
|
|
@@ -1568,6 +1589,7 @@ function round(num, dec = 0) {
|
|
|
1568
1589
|
var powres = Math.pow(10, dec);
|
|
1569
1590
|
return (~~(0.5 + num * powres) / powres);
|
|
1570
1591
|
}
|
|
1592
|
+
|
|
1571
1593
|
/**
|
|
1572
1594
|
* check if the given value is close to the expected one
|
|
1573
1595
|
* @public
|
|
@@ -1630,6 +1652,7 @@ function remove(arr, obj) {
|
|
|
1630
1652
|
}
|
|
1631
1653
|
return arr;
|
|
1632
1654
|
}
|
|
1655
|
+
|
|
1633
1656
|
/**
|
|
1634
1657
|
* return a random array element
|
|
1635
1658
|
* @public
|
|
@@ -1645,6 +1668,7 @@ function remove(arr, obj) {
|
|
|
1645
1668
|
function random(arr) {
|
|
1646
1669
|
return arr[random$1(0, arr.length)];
|
|
1647
1670
|
}
|
|
1671
|
+
|
|
1648
1672
|
/**
|
|
1649
1673
|
* return a weighted random array element, favoring the earlier entries
|
|
1650
1674
|
* @public
|
|
@@ -1685,6 +1709,7 @@ const REMOVE_EXT = /\.[^\.]*$/;
|
|
|
1685
1709
|
function getBasename(path) {
|
|
1686
1710
|
return path.replace(REMOVE_PATH, "").replace(REMOVE_EXT, "");
|
|
1687
1711
|
}
|
|
1712
|
+
|
|
1688
1713
|
/**
|
|
1689
1714
|
* return the extension of the file in the given path
|
|
1690
1715
|
* @public
|
|
@@ -1726,6 +1751,7 @@ var fileUtils = /*#__PURE__*/Object.freeze({
|
|
|
1726
1751
|
function defer(func, thisArg, ...args) {
|
|
1727
1752
|
return setTimeout(func.bind(thisArg), 0.01, ...args);
|
|
1728
1753
|
}
|
|
1754
|
+
|
|
1729
1755
|
/**
|
|
1730
1756
|
* returns a function that, when invoked will only be triggered at most
|
|
1731
1757
|
* once during a given window of time
|
|
@@ -1751,7 +1777,7 @@ function throttle(fn, delay, no_trailing) {
|
|
|
1751
1777
|
if (no_trailing === false) {
|
|
1752
1778
|
// hold on to it
|
|
1753
1779
|
clearTimeout(deferTimer);
|
|
1754
|
-
deferTimer = setTimeout(
|
|
1780
|
+
deferTimer = setTimeout(() => {
|
|
1755
1781
|
last = now;
|
|
1756
1782
|
return fn.apply(null, args);
|
|
1757
1783
|
}, elasped);
|
|
@@ -1921,7 +1947,7 @@ class ObjectPool {
|
|
|
1921
1947
|
*/
|
|
1922
1948
|
exists(name) {
|
|
1923
1949
|
return name in this.objectClass;
|
|
1924
|
-
}
|
|
1950
|
+
}
|
|
1925
1951
|
|
|
1926
1952
|
/**
|
|
1927
1953
|
* Check if an object is poolable
|
|
@@ -2473,6 +2499,7 @@ class Vector2d {
|
|
|
2473
2499
|
function toHex(component) {
|
|
2474
2500
|
return "0123456789ABCDEF".charAt((component - (component % 16)) >> 4) + "0123456789ABCDEF".charAt(component % 16);
|
|
2475
2501
|
}
|
|
2502
|
+
|
|
2476
2503
|
function hue2rgb(p, q, t) {
|
|
2477
2504
|
if (t < 0) t += 1;
|
|
2478
2505
|
if (t > 1) t -= 1;
|
|
@@ -2641,7 +2668,7 @@ var cssToRGB = new Map();
|
|
|
2641
2668
|
[ "wheat", [ 245, 222, 179 ] ],
|
|
2642
2669
|
[ "whitesmoke", [ 245, 245, 245 ] ],
|
|
2643
2670
|
[ "yellowgreen", [ 154, 205, 50 ] ]
|
|
2644
|
-
].forEach(
|
|
2671
|
+
].forEach((value) => {
|
|
2645
2672
|
cssToRGB.set(value[0], value[1]);
|
|
2646
2673
|
});
|
|
2647
2674
|
|
|
@@ -5055,6 +5082,7 @@ const ONCONTEXT_RESTORED = "renderer.contextrestored";
|
|
|
5055
5082
|
function emit(eventName, ...args) {
|
|
5056
5083
|
return eventEmitter.emit(eventName, ...args);
|
|
5057
5084
|
}
|
|
5085
|
+
|
|
5058
5086
|
/**
|
|
5059
5087
|
* Add a listener for a given event.
|
|
5060
5088
|
* @function event.on
|
|
@@ -5069,6 +5097,7 @@ function emit(eventName, ...args) {
|
|
|
5069
5097
|
function on(eventName, listener, context) {
|
|
5070
5098
|
return eventEmitter.on(eventName, listener, context);
|
|
5071
5099
|
}
|
|
5100
|
+
|
|
5072
5101
|
/**
|
|
5073
5102
|
* Add a one-time listener for a given event.
|
|
5074
5103
|
* @function event.once
|
|
@@ -5083,6 +5112,7 @@ function on(eventName, listener, context) {
|
|
|
5083
5112
|
function once(eventName, listener, context) {
|
|
5084
5113
|
return eventEmitter.once(eventName, listener, context);
|
|
5085
5114
|
}
|
|
5115
|
+
|
|
5086
5116
|
/**
|
|
5087
5117
|
* remove the given listener for a given event.
|
|
5088
5118
|
* @function event.off
|
|
@@ -5201,7 +5231,7 @@ on(BOOT, () => {
|
|
|
5201
5231
|
|
|
5202
5232
|
if (typeof me_save_content === "string" && me_save_content.length > 0) {
|
|
5203
5233
|
var keys = JSON.parse(me_save_content) || [];
|
|
5204
|
-
keys.forEach(
|
|
5234
|
+
keys.forEach((key) => {
|
|
5205
5235
|
data[key] = JSON.parse(globalThis.localStorage.getItem("me.save." + key));
|
|
5206
5236
|
});
|
|
5207
5237
|
}
|
|
@@ -5224,7 +5254,7 @@ var save = {
|
|
|
5224
5254
|
add(props) {
|
|
5225
5255
|
var obj = save;
|
|
5226
5256
|
|
|
5227
|
-
Object.keys(props).forEach(
|
|
5257
|
+
Object.keys(props).forEach((key) => {
|
|
5228
5258
|
if (isReserved(key)) {
|
|
5229
5259
|
return;
|
|
5230
5260
|
}
|
|
@@ -5322,6 +5352,7 @@ function _domReady() {
|
|
|
5322
5352
|
isDOMReady = true;
|
|
5323
5353
|
}
|
|
5324
5354
|
}
|
|
5355
|
+
|
|
5325
5356
|
// https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event
|
|
5326
5357
|
function DOMContentLoaded(fn) {
|
|
5327
5358
|
// If the DOM is already ready
|
|
@@ -5421,6 +5452,7 @@ function disableSwipeFn(e) {
|
|
|
5421
5452
|
}
|
|
5422
5453
|
return false;
|
|
5423
5454
|
}
|
|
5455
|
+
|
|
5424
5456
|
function hasLocalStorage() {
|
|
5425
5457
|
try {
|
|
5426
5458
|
return !!globalThis.localStorage;
|
|
@@ -5449,6 +5481,7 @@ function onDeviceMotion(e) {
|
|
|
5449
5481
|
accelerationY = e.accelerationIncludingGravity.y;
|
|
5450
5482
|
accelerationZ = e.accelerationIncludingGravity.z;
|
|
5451
5483
|
}
|
|
5484
|
+
|
|
5452
5485
|
/**
|
|
5453
5486
|
* used by [un]watchDeviceOrientation()
|
|
5454
5487
|
*/
|
|
@@ -5457,6 +5490,7 @@ function onDeviceRotate(e) {
|
|
|
5457
5490
|
beta = e.beta;
|
|
5458
5491
|
alpha = e.alpha;
|
|
5459
5492
|
}
|
|
5493
|
+
|
|
5460
5494
|
/**
|
|
5461
5495
|
* the device platform type
|
|
5462
5496
|
* @name platform
|
|
@@ -5827,6 +5861,7 @@ let stopOnBlur = false;
|
|
|
5827
5861
|
function onReady(fn) {
|
|
5828
5862
|
DOMContentLoaded(fn);
|
|
5829
5863
|
}
|
|
5864
|
+
|
|
5830
5865
|
/**
|
|
5831
5866
|
* enable/disable swipe on WebView.
|
|
5832
5867
|
* @function enableSwipe
|
|
@@ -5846,6 +5881,7 @@ function enableSwipe(enable) {
|
|
|
5846
5881
|
swipeEnabled = false;
|
|
5847
5882
|
}
|
|
5848
5883
|
}
|
|
5884
|
+
|
|
5849
5885
|
/**
|
|
5850
5886
|
* Returns true if the browser/device is in full screen mode.
|
|
5851
5887
|
* @function isFullscreen
|
|
@@ -5860,6 +5896,7 @@ function isFullscreen() {
|
|
|
5860
5896
|
return false;
|
|
5861
5897
|
}
|
|
5862
5898
|
}
|
|
5899
|
+
|
|
5863
5900
|
/**
|
|
5864
5901
|
* Triggers a fullscreen request. Requires fullscreen support from the browser/device.
|
|
5865
5902
|
* @function requestFullscreen
|
|
@@ -5885,6 +5922,7 @@ function requestFullscreen(element) {
|
|
|
5885
5922
|
element.requestFullscreen();
|
|
5886
5923
|
}
|
|
5887
5924
|
}
|
|
5925
|
+
|
|
5888
5926
|
/**
|
|
5889
5927
|
* Exit fullscreen mode. Requires fullscreen support from the browser/device.
|
|
5890
5928
|
* @function exitFullscreen
|
|
@@ -5896,6 +5934,7 @@ function exitFullscreen() {
|
|
|
5896
5934
|
document.exitFullscreen();
|
|
5897
5935
|
}
|
|
5898
5936
|
}
|
|
5937
|
+
|
|
5899
5938
|
/**
|
|
5900
5939
|
* Return a string representing the orientation of the device screen.
|
|
5901
5940
|
* It can be "any", "natural", "landscape", "portrait", "portrait-primary", "portrait-secondary", "landscape-primary", "landscape-secondary"
|
|
@@ -5931,6 +5970,7 @@ function getScreenOrientation() {
|
|
|
5931
5970
|
// fallback to window size check
|
|
5932
5971
|
return (globalThis.outerWidth > globalThis.outerHeight) ? LANDSCAPE : PORTRAIT;
|
|
5933
5972
|
}
|
|
5973
|
+
|
|
5934
5974
|
/**
|
|
5935
5975
|
* locks the device screen into the specified orientation.<br>
|
|
5936
5976
|
* This method only works for installed Web apps or for Web pages in full-screen mode.
|
|
@@ -5951,6 +5991,7 @@ function lockOrientation(orientation) {
|
|
|
5951
5991
|
}
|
|
5952
5992
|
return false;
|
|
5953
5993
|
}
|
|
5994
|
+
|
|
5954
5995
|
/**
|
|
5955
5996
|
* unlocks the device screen into the specified orientation.<br>
|
|
5956
5997
|
* This method only works for installed Web apps or for Web pages in full-screen mode.
|
|
@@ -5970,6 +6011,7 @@ function unlockOrientation() {
|
|
|
5970
6011
|
}
|
|
5971
6012
|
return false;
|
|
5972
6013
|
}
|
|
6014
|
+
|
|
5973
6015
|
/**
|
|
5974
6016
|
* return true if the device screen orientation is in Portrait mode
|
|
5975
6017
|
* @function isPortrait
|
|
@@ -5980,6 +6022,7 @@ function unlockOrientation() {
|
|
|
5980
6022
|
function isPortrait() {
|
|
5981
6023
|
return getScreenOrientation().includes("portrait");
|
|
5982
6024
|
}
|
|
6025
|
+
|
|
5983
6026
|
/**
|
|
5984
6027
|
* return true if the device screen orientation is in Portrait mode
|
|
5985
6028
|
* @function isLandscape
|
|
@@ -5990,6 +6033,7 @@ function isPortrait() {
|
|
|
5990
6033
|
function isLandscape() {
|
|
5991
6034
|
return getScreenOrientation().includes("landscape");
|
|
5992
6035
|
}
|
|
6036
|
+
|
|
5993
6037
|
/**
|
|
5994
6038
|
* return the device storage
|
|
5995
6039
|
* @function getStorage
|
|
@@ -6008,6 +6052,7 @@ function getStorage(type = "local") {
|
|
|
6008
6052
|
throw new Error("storage type " + type + " not supported");
|
|
6009
6053
|
}
|
|
6010
6054
|
}
|
|
6055
|
+
|
|
6011
6056
|
/**
|
|
6012
6057
|
* return the parent DOM element for the given parent name or HTMLElement object
|
|
6013
6058
|
* @function getParentElement
|
|
@@ -6025,6 +6070,7 @@ function getParentElement(element) {
|
|
|
6025
6070
|
|
|
6026
6071
|
return target;
|
|
6027
6072
|
}
|
|
6073
|
+
|
|
6028
6074
|
/**
|
|
6029
6075
|
* return the DOM element for the given element name or HTMLElement object
|
|
6030
6076
|
* @function getElement
|
|
@@ -6052,6 +6098,7 @@ function getElement(element) {
|
|
|
6052
6098
|
|
|
6053
6099
|
return target;
|
|
6054
6100
|
}
|
|
6101
|
+
|
|
6055
6102
|
/**
|
|
6056
6103
|
* returns the size of the given HTMLElement and its position relative to the viewport
|
|
6057
6104
|
* <br><img src="images/element-box-diagram.png"/>
|
|
@@ -6069,7 +6116,9 @@ function getElementBounds(element) {
|
|
|
6069
6116
|
domRect.width = domRect.right = globalThis.innerWidth;
|
|
6070
6117
|
domRect.height = domRect.bottom = globalThis.innerHeight;
|
|
6071
6118
|
return domRect;
|
|
6072
|
-
}
|
|
6119
|
+
}
|
|
6120
|
+
}
|
|
6121
|
+
|
|
6073
6122
|
/**
|
|
6074
6123
|
* returns the size of the given HTMLElement Parent and its position relative to the viewport
|
|
6075
6124
|
* <br><img src="images/element-box-diagram.png"/>
|
|
@@ -6083,6 +6132,7 @@ function getElementBounds(element) {
|
|
|
6083
6132
|
function getParentBounds(element) {
|
|
6084
6133
|
return getElementBounds(getParentElement(element));
|
|
6085
6134
|
}
|
|
6135
|
+
|
|
6086
6136
|
/**
|
|
6087
6137
|
* returns true if the device supports WebGL
|
|
6088
6138
|
* @function isWebGLSupported
|
|
@@ -6107,6 +6157,7 @@ function isWebGLSupported(options) {
|
|
|
6107
6157
|
|
|
6108
6158
|
return _supported;
|
|
6109
6159
|
}
|
|
6160
|
+
|
|
6110
6161
|
/**
|
|
6111
6162
|
* return the highest precision format supported by this device for GL Shaders
|
|
6112
6163
|
* @function getMaxShaderPrecision
|
|
@@ -6126,6 +6177,7 @@ function getMaxShaderPrecision(gl) {
|
|
|
6126
6177
|
}
|
|
6127
6178
|
return "lowp";
|
|
6128
6179
|
}
|
|
6180
|
+
|
|
6129
6181
|
/**
|
|
6130
6182
|
* Makes a request to bring this device window to the front.
|
|
6131
6183
|
* @function focus
|
|
@@ -6141,6 +6193,7 @@ function focus() {
|
|
|
6141
6193
|
globalThis.focus();
|
|
6142
6194
|
}
|
|
6143
6195
|
}
|
|
6196
|
+
|
|
6144
6197
|
/**
|
|
6145
6198
|
* Enable monitor of the device accelerator to detect the amount of physical force of acceleration the device is receiving.
|
|
6146
6199
|
* (one some device a first user gesture will be required before calling this function)
|
|
@@ -6183,6 +6236,7 @@ function watchAccelerometer() {
|
|
|
6183
6236
|
}
|
|
6184
6237
|
return accelInitialized;
|
|
6185
6238
|
}
|
|
6239
|
+
|
|
6186
6240
|
/**
|
|
6187
6241
|
* unwatch Accelerometor event
|
|
6188
6242
|
* @function unwatchAccelerometer
|
|
@@ -6196,6 +6250,7 @@ function unwatchAccelerometer() {
|
|
|
6196
6250
|
accelInitialized = false;
|
|
6197
6251
|
}
|
|
6198
6252
|
}
|
|
6253
|
+
|
|
6199
6254
|
/**
|
|
6200
6255
|
* Enable monitor of the device orientation to detect the current orientation of the device as compared to the Earth coordinate frame.
|
|
6201
6256
|
* (one some device a first user gesture will be required before calling this function)
|
|
@@ -6234,6 +6289,7 @@ function watchDeviceOrientation() {
|
|
|
6234
6289
|
}
|
|
6235
6290
|
return deviceOrientationInitialized;
|
|
6236
6291
|
}
|
|
6292
|
+
|
|
6237
6293
|
/**
|
|
6238
6294
|
* unwatch Device orientation event
|
|
6239
6295
|
* @function unwatchDeviceOrientation
|
|
@@ -6246,6 +6302,7 @@ function unwatchDeviceOrientation() {
|
|
|
6246
6302
|
deviceOrientationInitialized = false;
|
|
6247
6303
|
}
|
|
6248
6304
|
}
|
|
6305
|
+
|
|
6249
6306
|
/**
|
|
6250
6307
|
* the vibrate method pulses the vibration hardware on the device, <br>
|
|
6251
6308
|
* If the device doesn't support vibration, this method has no effect. <br>
|
|
@@ -6364,14 +6421,14 @@ function extractUniforms(gl, shader) {
|
|
|
6364
6421
|
match;
|
|
6365
6422
|
|
|
6366
6423
|
// Detect all uniform names and types
|
|
6367
|
-
[ shader.vertex, shader.fragment ].forEach(
|
|
6424
|
+
[ shader.vertex, shader.fragment ].forEach((shader) => {
|
|
6368
6425
|
while ((match = uniRx.exec(shader))) {
|
|
6369
6426
|
uniformsData[match[2]] = match[1];
|
|
6370
6427
|
}
|
|
6371
6428
|
});
|
|
6372
6429
|
|
|
6373
6430
|
// Get uniform references
|
|
6374
|
-
Object.keys(uniformsData).forEach(
|
|
6431
|
+
Object.keys(uniformsData).forEach((name) => {
|
|
6375
6432
|
var type = uniformsData[name];
|
|
6376
6433
|
locations[name] = gl.getUniformLocation(shader.program, name);
|
|
6377
6434
|
|
|
@@ -6444,6 +6501,7 @@ function compileShader(gl, type, source) {
|
|
|
6444
6501
|
|
|
6445
6502
|
return shader;
|
|
6446
6503
|
}
|
|
6504
|
+
|
|
6447
6505
|
/**
|
|
6448
6506
|
* Compile GLSL into a shader object
|
|
6449
6507
|
* @ignore
|
|
@@ -8446,7 +8504,7 @@ class Polygon {
|
|
|
8446
8504
|
*/
|
|
8447
8505
|
clone() {
|
|
8448
8506
|
var copy = [];
|
|
8449
|
-
this.points.forEach(
|
|
8507
|
+
this.points.forEach((point) => {
|
|
8450
8508
|
copy.push(point.clone());
|
|
8451
8509
|
});
|
|
8452
8510
|
return new Polygon(this.pos.x, this.pos.y, copy);
|
|
@@ -9333,7 +9391,7 @@ class Line extends Polygon {
|
|
|
9333
9391
|
*/
|
|
9334
9392
|
clone() {
|
|
9335
9393
|
var copy = [];
|
|
9336
|
-
this.points.forEach(
|
|
9394
|
+
this.points.forEach((point) => {
|
|
9337
9395
|
copy.push(point.clone());
|
|
9338
9396
|
});
|
|
9339
9397
|
return new Line(this.pos.x, this.pos.y, copy);
|
|
@@ -9578,13 +9636,16 @@ class Bounds {
|
|
|
9578
9636
|
*/
|
|
9579
9637
|
addBounds(bounds, clear = false) {
|
|
9580
9638
|
if (clear === true) {
|
|
9581
|
-
this.
|
|
9639
|
+
this.max.x = bounds.max.x;
|
|
9640
|
+
this.min.x = bounds.min.x;
|
|
9641
|
+
this.max.y = bounds.max.y;
|
|
9642
|
+
this.min.y = bounds.min.y;
|
|
9643
|
+
} else {
|
|
9644
|
+
if (bounds.max.x > this.max.x) this.max.x = bounds.max.x;
|
|
9645
|
+
if (bounds.min.x < this.min.x) this.min.x = bounds.min.x;
|
|
9646
|
+
if (bounds.max.y > this.max.y) this.max.y = bounds.max.y;
|
|
9647
|
+
if (bounds.min.y < this.min.y) this.min.y = bounds.min.y;
|
|
9582
9648
|
}
|
|
9583
|
-
|
|
9584
|
-
if (bounds.max.x > this.max.x) this.max.x = bounds.max.x;
|
|
9585
|
-
if (bounds.min.x < this.min.x) this.min.x = bounds.min.x;
|
|
9586
|
-
if (bounds.max.y > this.max.y) this.max.y = bounds.max.y;
|
|
9587
|
-
if (bounds.min.y < this.min.y) this.min.y = bounds.min.y;
|
|
9588
9649
|
}
|
|
9589
9650
|
|
|
9590
9651
|
/**
|
|
@@ -10228,7 +10289,7 @@ class Renderer {
|
|
|
10228
10289
|
this.currentBlendMode = "none";
|
|
10229
10290
|
|
|
10230
10291
|
// create the main screen canvas
|
|
10231
|
-
if (
|
|
10292
|
+
if (platform.ejecta === true) {
|
|
10232
10293
|
// a main canvas is already automatically created by Ejecta
|
|
10233
10294
|
this.canvas = document.getElementById("canvas");
|
|
10234
10295
|
} else if (typeof globalThis.canvas !== "undefined") {
|
|
@@ -13878,6 +13939,7 @@ let stopOnAudioError = true;
|
|
|
13878
13939
|
|
|
13879
13940
|
return !howler.Howler.noAudio;
|
|
13880
13941
|
}
|
|
13942
|
+
|
|
13881
13943
|
/**
|
|
13882
13944
|
* check if the given audio format is supported
|
|
13883
13945
|
* @function audio.hasFormat
|
|
@@ -13887,6 +13949,7 @@ let stopOnAudioError = true;
|
|
|
13887
13949
|
function hasFormat(codec) {
|
|
13888
13950
|
return hasAudio() && howler.Howler.codecs(codec);
|
|
13889
13951
|
}
|
|
13952
|
+
|
|
13890
13953
|
/**
|
|
13891
13954
|
* check if audio (HTML5 or WebAudio) is supported
|
|
13892
13955
|
* @function audio.hasAudio
|
|
@@ -13895,6 +13958,7 @@ function hasFormat(codec) {
|
|
|
13895
13958
|
function hasAudio() {
|
|
13896
13959
|
return !howler.Howler.noAudio;
|
|
13897
13960
|
}
|
|
13961
|
+
|
|
13898
13962
|
/**
|
|
13899
13963
|
* enable audio output <br>
|
|
13900
13964
|
* only useful if audio supported and previously disabled through
|
|
@@ -13904,6 +13968,7 @@ function hasAudio() {
|
|
|
13904
13968
|
function enable() {
|
|
13905
13969
|
unmuteAll();
|
|
13906
13970
|
}
|
|
13971
|
+
|
|
13907
13972
|
/**
|
|
13908
13973
|
* disable audio output
|
|
13909
13974
|
* @function audio.disable
|
|
@@ -13911,6 +13976,7 @@ function enable() {
|
|
|
13911
13976
|
function disable() {
|
|
13912
13977
|
muteAll();
|
|
13913
13978
|
}
|
|
13979
|
+
|
|
13914
13980
|
/**
|
|
13915
13981
|
* Load an audio file.<br>
|
|
13916
13982
|
* <br>
|
|
@@ -13956,6 +14022,7 @@ function load(sound, html5, onload_cb, onerror_cb) {
|
|
|
13956
14022
|
|
|
13957
14023
|
return 1;
|
|
13958
14024
|
}
|
|
14025
|
+
|
|
13959
14026
|
/**
|
|
13960
14027
|
* play the specified sound
|
|
13961
14028
|
* @function audio.play
|
|
@@ -13996,6 +14063,7 @@ function play(sound_name, loop = false, onend, volume) {
|
|
|
13996
14063
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
13997
14064
|
}
|
|
13998
14065
|
}
|
|
14066
|
+
|
|
13999
14067
|
/**
|
|
14000
14068
|
* Fade a currently playing sound between two volumee.
|
|
14001
14069
|
* @function audio.fade
|
|
@@ -14013,6 +14081,7 @@ function fade(sound_name, from, to, duration, id) {
|
|
|
14013
14081
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14014
14082
|
}
|
|
14015
14083
|
}
|
|
14084
|
+
|
|
14016
14085
|
/**
|
|
14017
14086
|
* get/set the position of playback for a sound.
|
|
14018
14087
|
* @function audio.seek
|
|
@@ -14034,6 +14103,7 @@ function seek(sound_name, ...args) {
|
|
|
14034
14103
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14035
14104
|
}
|
|
14036
14105
|
}
|
|
14106
|
+
|
|
14037
14107
|
/**
|
|
14038
14108
|
* get or set the rate of playback for a sound.
|
|
14039
14109
|
* @function audio.rate
|
|
@@ -14055,6 +14125,7 @@ function rate(sound_name, ...args) {
|
|
|
14055
14125
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14056
14126
|
}
|
|
14057
14127
|
}
|
|
14128
|
+
|
|
14058
14129
|
/**
|
|
14059
14130
|
* stop the specified sound on all channels
|
|
14060
14131
|
* @function audio.stop
|
|
@@ -14077,6 +14148,7 @@ function stop(sound_name, id) {
|
|
|
14077
14148
|
howler.Howler.stop();
|
|
14078
14149
|
}
|
|
14079
14150
|
}
|
|
14151
|
+
|
|
14080
14152
|
/**
|
|
14081
14153
|
* pause the specified sound on all channels<br>
|
|
14082
14154
|
* this function does not reset the currentTime property
|
|
@@ -14094,6 +14166,7 @@ function pause(sound_name, id) {
|
|
|
14094
14166
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14095
14167
|
}
|
|
14096
14168
|
}
|
|
14169
|
+
|
|
14097
14170
|
/**
|
|
14098
14171
|
* resume the specified sound on all channels<br>
|
|
14099
14172
|
* @function audio.resume
|
|
@@ -14117,6 +14190,7 @@ function resume(sound_name, id) {
|
|
|
14117
14190
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14118
14191
|
}
|
|
14119
14192
|
}
|
|
14193
|
+
|
|
14120
14194
|
/**
|
|
14121
14195
|
* play the specified audio track<br>
|
|
14122
14196
|
* this function automatically set the loop property to true<br>
|
|
@@ -14137,6 +14211,7 @@ function playTrack(sound_name, volume) {
|
|
|
14137
14211
|
volume
|
|
14138
14212
|
);
|
|
14139
14213
|
}
|
|
14214
|
+
|
|
14140
14215
|
/**
|
|
14141
14216
|
* stop the current audio track
|
|
14142
14217
|
* @function audio.stopTrack
|
|
@@ -14153,6 +14228,7 @@ function stopTrack() {
|
|
|
14153
14228
|
current_track_id = null;
|
|
14154
14229
|
}
|
|
14155
14230
|
}
|
|
14231
|
+
|
|
14156
14232
|
/**
|
|
14157
14233
|
* pause the current audio track
|
|
14158
14234
|
* @function audio.pauseTrack
|
|
@@ -14164,6 +14240,7 @@ function pauseTrack() {
|
|
|
14164
14240
|
audioTracks[current_track_id].pause();
|
|
14165
14241
|
}
|
|
14166
14242
|
}
|
|
14243
|
+
|
|
14167
14244
|
/**
|
|
14168
14245
|
* resume the previously paused audio track
|
|
14169
14246
|
* @function audio.resumeTrack
|
|
@@ -14180,6 +14257,7 @@ function resumeTrack() {
|
|
|
14180
14257
|
audioTracks[current_track_id].play();
|
|
14181
14258
|
}
|
|
14182
14259
|
}
|
|
14260
|
+
|
|
14183
14261
|
/**
|
|
14184
14262
|
* returns the current track Id
|
|
14185
14263
|
* @function audio.getCurrentTrack
|
|
@@ -14188,6 +14266,7 @@ function resumeTrack() {
|
|
|
14188
14266
|
function getCurrentTrack() {
|
|
14189
14267
|
return current_track_id;
|
|
14190
14268
|
}
|
|
14269
|
+
|
|
14191
14270
|
/**
|
|
14192
14271
|
* set the default global volume
|
|
14193
14272
|
* @function audio.setVolume
|
|
@@ -14196,6 +14275,7 @@ function getCurrentTrack() {
|
|
|
14196
14275
|
function setVolume(volume) {
|
|
14197
14276
|
howler.Howler.volume(volume);
|
|
14198
14277
|
}
|
|
14278
|
+
|
|
14199
14279
|
/**
|
|
14200
14280
|
* get the default global volume
|
|
14201
14281
|
* @function audio.getVolume
|
|
@@ -14204,6 +14284,7 @@ function setVolume(volume) {
|
|
|
14204
14284
|
function getVolume() {
|
|
14205
14285
|
return howler.Howler.volume();
|
|
14206
14286
|
}
|
|
14287
|
+
|
|
14207
14288
|
/**
|
|
14208
14289
|
* mute or unmute the specified sound, but does not pause the playback.
|
|
14209
14290
|
* @function audio.mute
|
|
@@ -14224,6 +14305,7 @@ function mute(sound_name, id, mute) {
|
|
|
14224
14305
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14225
14306
|
}
|
|
14226
14307
|
}
|
|
14308
|
+
|
|
14227
14309
|
/**
|
|
14228
14310
|
* unmute the specified sound
|
|
14229
14311
|
* @function audio.unmute
|
|
@@ -14233,6 +14315,7 @@ function mute(sound_name, id, mute) {
|
|
|
14233
14315
|
function unmute(sound_name, id) {
|
|
14234
14316
|
mute(sound_name, id, false);
|
|
14235
14317
|
}
|
|
14318
|
+
|
|
14236
14319
|
/**
|
|
14237
14320
|
* mute all audio
|
|
14238
14321
|
* @function audio.muteAll
|
|
@@ -14240,6 +14323,7 @@ function unmute(sound_name, id) {
|
|
|
14240
14323
|
function muteAll() {
|
|
14241
14324
|
howler.Howler.mute(true);
|
|
14242
14325
|
}
|
|
14326
|
+
|
|
14243
14327
|
/**
|
|
14244
14328
|
* unmute all audio
|
|
14245
14329
|
* @function audio.unmuteAll
|
|
@@ -14247,6 +14331,7 @@ function muteAll() {
|
|
|
14247
14331
|
function unmuteAll() {
|
|
14248
14332
|
howler.Howler.mute(false);
|
|
14249
14333
|
}
|
|
14334
|
+
|
|
14250
14335
|
/**
|
|
14251
14336
|
* Returns true if audio is muted globally.
|
|
14252
14337
|
* @function audio.muted
|
|
@@ -14255,6 +14340,7 @@ function unmuteAll() {
|
|
|
14255
14340
|
function muted() {
|
|
14256
14341
|
return howler.Howler._muted;
|
|
14257
14342
|
}
|
|
14343
|
+
|
|
14258
14344
|
/**
|
|
14259
14345
|
* unload specified audio track to free memory
|
|
14260
14346
|
* @function audio.unload
|
|
@@ -14273,6 +14359,7 @@ function unload(sound_name) {
|
|
|
14273
14359
|
delete audioTracks[sound_name];
|
|
14274
14360
|
return true;
|
|
14275
14361
|
}
|
|
14362
|
+
|
|
14276
14363
|
/**
|
|
14277
14364
|
* unload all audio to free memory
|
|
14278
14365
|
* @function audio.unloadAll
|
|
@@ -16202,6 +16289,7 @@ function initKeyboardEvent() {
|
|
|
16202
16289
|
}
|
|
16203
16290
|
}
|
|
16204
16291
|
}
|
|
16292
|
+
|
|
16205
16293
|
/**
|
|
16206
16294
|
* return the key press status of the specified action
|
|
16207
16295
|
* @name isKeyPressed
|
|
@@ -16226,6 +16314,7 @@ function isKeyPressed(action) {
|
|
|
16226
16314
|
}
|
|
16227
16315
|
return false;
|
|
16228
16316
|
}
|
|
16317
|
+
|
|
16229
16318
|
/**
|
|
16230
16319
|
* return the key status of the specified action
|
|
16231
16320
|
* @name keyStatus
|
|
@@ -16238,6 +16327,7 @@ function keyStatus(action) {
|
|
|
16238
16327
|
return (_keyStatus[action] > 0);
|
|
16239
16328
|
}
|
|
16240
16329
|
|
|
16330
|
+
|
|
16241
16331
|
/**
|
|
16242
16332
|
* trigger the specified key (simulated) event <br>
|
|
16243
16333
|
* @name triggerKeyEvent
|
|
@@ -16259,6 +16349,7 @@ function triggerKeyEvent(keycode, status, mouseButton) {
|
|
|
16259
16349
|
}
|
|
16260
16350
|
}
|
|
16261
16351
|
|
|
16352
|
+
|
|
16262
16353
|
/**
|
|
16263
16354
|
* associate a user defined action to a keycode
|
|
16264
16355
|
* @name bindKey
|
|
@@ -16284,6 +16375,7 @@ function bindKey(keycode, action, lock, preventDefault$1 = preventDefault) {
|
|
|
16284
16375
|
_keyLocked[action] = false;
|
|
16285
16376
|
_keyRefs[action] = {};
|
|
16286
16377
|
}
|
|
16378
|
+
|
|
16287
16379
|
/**
|
|
16288
16380
|
* return the action associated with the given keycode
|
|
16289
16381
|
* @name getBindingKey
|
|
@@ -16295,6 +16387,7 @@ function bindKey(keycode, action, lock, preventDefault$1 = preventDefault) {
|
|
|
16295
16387
|
function getBindingKey(keycode) {
|
|
16296
16388
|
return _keyBindings[keycode];
|
|
16297
16389
|
}
|
|
16390
|
+
|
|
16298
16391
|
/**
|
|
16299
16392
|
* unlock a key manually
|
|
16300
16393
|
* @name unlockKey
|
|
@@ -16310,6 +16403,7 @@ function getBindingKey(keycode) {
|
|
|
16310
16403
|
function unlockKey(action) {
|
|
16311
16404
|
_keyLocked[action] = false;
|
|
16312
16405
|
}
|
|
16406
|
+
|
|
16313
16407
|
/**
|
|
16314
16408
|
* unbind the defined keycode
|
|
16315
16409
|
* @name unbindKey
|
|
@@ -16847,7 +16941,7 @@ function enablePointerEvent() {
|
|
|
16847
16941
|
focus();
|
|
16848
16942
|
pointerEventTarget.addEventListener(
|
|
16849
16943
|
activeEventList[2], // MOUSE/POINTER DOWN
|
|
16850
|
-
|
|
16944
|
+
() => {
|
|
16851
16945
|
focus();
|
|
16852
16946
|
},
|
|
16853
16947
|
{ passive: (preventDefault === false) }
|
|
@@ -17263,6 +17357,7 @@ function globalToLocal(x, y, v) {
|
|
|
17263
17357
|
}
|
|
17264
17358
|
return v.set(x * pixelRatio, y * pixelRatio);
|
|
17265
17359
|
}
|
|
17360
|
+
|
|
17266
17361
|
/**
|
|
17267
17362
|
* enable/disable all gestures on the given element.<br>
|
|
17268
17363
|
* by default melonJS will disable browser handling of all panning and zooming gestures.
|
|
@@ -17276,6 +17371,7 @@ function globalToLocal(x, y, v) {
|
|
|
17276
17371
|
function setTouchAction(element, value) {
|
|
17277
17372
|
element.style["touch-action"] = value || "none";
|
|
17278
17373
|
}
|
|
17374
|
+
|
|
17279
17375
|
/**
|
|
17280
17376
|
* Associate a pointer event to a keycode<br>
|
|
17281
17377
|
* Left button – 0
|
|
@@ -17308,6 +17404,7 @@ function bindPointer() {
|
|
|
17308
17404
|
// map the mouse button to the keycode
|
|
17309
17405
|
pointer.bind[button] = keyCode;
|
|
17310
17406
|
}
|
|
17407
|
+
|
|
17311
17408
|
/**
|
|
17312
17409
|
* unbind the defined keycode
|
|
17313
17410
|
* @name unbindPointer
|
|
@@ -17325,6 +17422,7 @@ function unbindPointer(button) {
|
|
|
17325
17422
|
] = null;
|
|
17326
17423
|
}
|
|
17327
17424
|
|
|
17425
|
+
|
|
17328
17426
|
/**
|
|
17329
17427
|
* allows registration of event listeners on the object target. <br>
|
|
17330
17428
|
* melonJS will pass a me.Pointer object to the defined callback.
|
|
@@ -17397,6 +17495,7 @@ function registerPointerEvent(eventType, region, callback) {
|
|
|
17397
17495
|
}
|
|
17398
17496
|
}
|
|
17399
17497
|
}
|
|
17498
|
+
|
|
17400
17499
|
/**
|
|
17401
17500
|
* allows the removal of event listeners from the object target.
|
|
17402
17501
|
* @see {@link http://www.w3.org/TR/pointerevents/#list-of-pointer-events|W3C Pointer Event list}
|
|
@@ -17441,6 +17540,7 @@ function releasePointerEvent(eventType, region, callback) {
|
|
|
17441
17540
|
}
|
|
17442
17541
|
}
|
|
17443
17542
|
}
|
|
17543
|
+
|
|
17444
17544
|
/**
|
|
17445
17545
|
* allows the removal of all registered event listeners from the object target.
|
|
17446
17546
|
* @name releaseAllPointerEvents
|
|
@@ -17456,7 +17556,9 @@ function releaseAllPointerEvents(region) {
|
|
|
17456
17556
|
for (var i = 0; i < pointerEventList.length; i++) {
|
|
17457
17557
|
releasePointerEvent(pointerEventList[i], region);
|
|
17458
17558
|
}
|
|
17459
|
-
}
|
|
17559
|
+
}
|
|
17560
|
+
}
|
|
17561
|
+
|
|
17460
17562
|
/**
|
|
17461
17563
|
* request for the pointer to be locked on the parent DOM element.
|
|
17462
17564
|
* (Must be called in a click event or an event that requires user interaction)
|
|
@@ -17549,13 +17651,13 @@ var leadingZeroRE = /^0+/;
|
|
|
17549
17651
|
* @ignore
|
|
17550
17652
|
*/
|
|
17551
17653
|
function addMapping(id, mapping) {
|
|
17552
|
-
var expanded_id = id.replace(vendorProductRE,
|
|
17654
|
+
var expanded_id = id.replace(vendorProductRE, (_, a, b) => {
|
|
17553
17655
|
return (
|
|
17554
17656
|
"000".slice(a.length - 1) + a + "-" +
|
|
17555
17657
|
"000".slice(b.length - 1) + b + "-"
|
|
17556
17658
|
);
|
|
17557
17659
|
});
|
|
17558
|
-
var sparse_id = id.replace(vendorProductRE,
|
|
17660
|
+
var sparse_id = id.replace(vendorProductRE, (_, a, b) => {
|
|
17559
17661
|
return (
|
|
17560
17662
|
a.replace(leadingZeroRE, "") + "-" +
|
|
17561
17663
|
b.replace(leadingZeroRE, "") + "-"
|
|
@@ -17563,7 +17665,7 @@ function addMapping(id, mapping) {
|
|
|
17563
17665
|
});
|
|
17564
17666
|
|
|
17565
17667
|
// Normalize optional parameters
|
|
17566
|
-
mapping.analog = mapping.analog || mapping.buttons.map(
|
|
17668
|
+
mapping.analog = mapping.analog || mapping.buttons.map(() => {
|
|
17567
17669
|
return -1;
|
|
17568
17670
|
});
|
|
17569
17671
|
mapping.normalize_fn = mapping.normalize_fn || function (value) { return value; };
|
|
@@ -17626,7 +17728,7 @@ var updateEventHandler;
|
|
|
17626
17728
|
"normalize_fn" : ouyaNormalizeFn
|
|
17627
17729
|
}
|
|
17628
17730
|
]
|
|
17629
|
-
].forEach(
|
|
17731
|
+
].forEach((value) => {
|
|
17630
17732
|
addMapping(value[0], value[1]);
|
|
17631
17733
|
});
|
|
17632
17734
|
|
|
@@ -17638,7 +17740,7 @@ var updateGamepads = function () {
|
|
|
17638
17740
|
var gamepads = navigator.getGamepads();
|
|
17639
17741
|
|
|
17640
17742
|
// Trigger button bindings
|
|
17641
|
-
Object.keys(bindings).forEach(
|
|
17743
|
+
Object.keys(bindings).forEach((index) => {
|
|
17642
17744
|
var gamepad = gamepads[index];
|
|
17643
17745
|
if (!gamepad) {
|
|
17644
17746
|
return;
|
|
@@ -17652,7 +17754,7 @@ var updateGamepads = function () {
|
|
|
17652
17754
|
var binding = bindings[index];
|
|
17653
17755
|
|
|
17654
17756
|
// Iterate all buttons that have active bindings
|
|
17655
|
-
Object.keys(binding.buttons).forEach(
|
|
17757
|
+
Object.keys(binding.buttons).forEach((button) => {
|
|
17656
17758
|
var last = binding.buttons[button];
|
|
17657
17759
|
var mapped_button = button;
|
|
17658
17760
|
var mapped_axis = -1;
|
|
@@ -17699,7 +17801,7 @@ var updateGamepads = function () {
|
|
|
17699
17801
|
});
|
|
17700
17802
|
|
|
17701
17803
|
// Iterate all axes that have active bindings
|
|
17702
|
-
Object.keys(binding.axes).forEach(
|
|
17804
|
+
Object.keys(binding.axes).forEach((axis) => {
|
|
17703
17805
|
var last = binding.axes[axis];
|
|
17704
17806
|
var mapped_axis = axis;
|
|
17705
17807
|
|
|
@@ -17754,14 +17856,14 @@ var updateGamepads = function () {
|
|
|
17754
17856
|
|
|
17755
17857
|
// gamepad connected callback
|
|
17756
17858
|
if (globalThis.navigator && typeof globalThis.navigator.getGamepads === "function") {
|
|
17757
|
-
globalThis.addEventListener("gamepadconnected",
|
|
17859
|
+
globalThis.addEventListener("gamepadconnected", (e) => {
|
|
17758
17860
|
emit(GAMEPAD_CONNECTED, e.gamepad);
|
|
17759
17861
|
}, false);
|
|
17760
17862
|
|
|
17761
17863
|
/*
|
|
17762
17864
|
* gamepad disconnected callback
|
|
17763
17865
|
*/
|
|
17764
|
-
globalThis.addEventListener("gamepaddisconnected",
|
|
17866
|
+
globalThis.addEventListener("gamepaddisconnected", (e) => {
|
|
17765
17867
|
emit(GAMEPAD_DISCONNECTED, e.gamepad);
|
|
17766
17868
|
}, false);
|
|
17767
17869
|
}
|
|
@@ -17917,6 +18019,7 @@ function bindGamepad(index, button, keyCode) {
|
|
|
17917
18019
|
}
|
|
17918
18020
|
}
|
|
17919
18021
|
}
|
|
18022
|
+
|
|
17920
18023
|
/**
|
|
17921
18024
|
* unbind the defined keycode
|
|
17922
18025
|
* @name unbindGamepad
|
|
@@ -17933,6 +18036,7 @@ function unbindGamepad(index, button) {
|
|
|
17933
18036
|
}
|
|
17934
18037
|
bindings[index].buttons[button] = {};
|
|
17935
18038
|
}
|
|
18039
|
+
|
|
17936
18040
|
/**
|
|
17937
18041
|
* Set deadzone for analog gamepad inputs<br>
|
|
17938
18042
|
* The default deadzone is 0.1 (10%) Analog values less than this will be ignored
|
|
@@ -17944,6 +18048,7 @@ function unbindGamepad(index, button) {
|
|
|
17944
18048
|
function setGamepadDeadzone(value) {
|
|
17945
18049
|
deadzone = value;
|
|
17946
18050
|
}
|
|
18051
|
+
|
|
17947
18052
|
/**
|
|
17948
18053
|
* specify a custom mapping for a specific gamepad id<br>
|
|
17949
18054
|
* see below for the default mapping : <br>
|
|
@@ -19334,6 +19439,9 @@ let dummyObj = {
|
|
|
19334
19439
|
}
|
|
19335
19440
|
};
|
|
19336
19441
|
|
|
19442
|
+
let boundsA = new Bounds();
|
|
19443
|
+
let boundsB = new Bounds();
|
|
19444
|
+
|
|
19337
19445
|
// the global response object used for collisions
|
|
19338
19446
|
let globalResponse = new ResponseObject();
|
|
19339
19447
|
|
|
@@ -19348,16 +19456,21 @@ let globalResponse = new ResponseObject();
|
|
|
19348
19456
|
* @returns {boolean} true if they should collide, false otherwise
|
|
19349
19457
|
*/
|
|
19350
19458
|
function shouldCollide(a, b) {
|
|
19459
|
+
var bodyA = a.body,
|
|
19460
|
+
bodyB = b.body;
|
|
19351
19461
|
return (
|
|
19462
|
+
a !== b &&
|
|
19352
19463
|
a.isKinematic !== true && b.isKinematic !== true &&
|
|
19353
|
-
typeof
|
|
19354
|
-
|
|
19355
|
-
(
|
|
19356
|
-
(
|
|
19464
|
+
typeof bodyA === "object" && typeof bodyB === "object" &&
|
|
19465
|
+
bodyA.shapes.length > 0 && bodyB.shapes.length > 0 &&
|
|
19466
|
+
!(bodyA.isStatic === true && bodyB.isStatic === true) &&
|
|
19467
|
+
(bodyA.collisionMask & bodyB.collisionType) !== 0 &&
|
|
19468
|
+
(bodyA.collisionType & bodyB.collisionMask) !== 0
|
|
19357
19469
|
);
|
|
19358
19470
|
}
|
|
19359
19471
|
|
|
19360
19472
|
|
|
19473
|
+
|
|
19361
19474
|
/**
|
|
19362
19475
|
* find all the collisions for the specified object
|
|
19363
19476
|
* @name collisionCheck
|
|
@@ -19371,63 +19484,56 @@ function collisionCheck(objA, response = globalResponse) {
|
|
|
19371
19484
|
// retreive a list of potential colliding objects from the game world
|
|
19372
19485
|
var candidates = game.world.broadphase.retrieve(objA);
|
|
19373
19486
|
|
|
19374
|
-
|
|
19487
|
+
boundsA.addBounds(objA.getBounds(), true);
|
|
19488
|
+
boundsA.addBounds(objA.body.getBounds());
|
|
19375
19489
|
|
|
19490
|
+
candidates.forEach((objB) => {
|
|
19376
19491
|
// check if both objects "should" collide
|
|
19377
|
-
if (
|
|
19378
|
-
// fast AABB check if both bounding boxes are overlaping
|
|
19379
|
-
objA.body.getBounds().overlaps(objB.body.getBounds())) {
|
|
19492
|
+
if (shouldCollide(objA, objB)) {
|
|
19380
19493
|
|
|
19381
|
-
|
|
19382
|
-
|
|
19383
|
-
var bLen = objB.body.shapes.length;
|
|
19384
|
-
if (aLen === 0 || bLen === 0) {
|
|
19385
|
-
continue;
|
|
19386
|
-
}
|
|
19494
|
+
boundsB.addBounds(objB.getBounds(), true);
|
|
19495
|
+
boundsB.addBounds(objB.body.getBounds());
|
|
19387
19496
|
|
|
19388
|
-
|
|
19389
|
-
|
|
19390
|
-
|
|
19391
|
-
|
|
19392
|
-
|
|
19393
|
-
|
|
19394
|
-
|
|
19395
|
-
|
|
19396
|
-
|
|
19397
|
-
|
|
19398
|
-
|
|
19399
|
-
|
|
19400
|
-
|
|
19401
|
-
|
|
19402
|
-
|
|
19403
|
-
|
|
19404
|
-
|
|
19405
|
-
|
|
19406
|
-
|
|
19407
|
-
|
|
19408
|
-
|
|
19409
|
-
|
|
19410
|
-
|
|
19411
|
-
|
|
19412
|
-
|
|
19413
|
-
|
|
19414
|
-
|
|
19415
|
-
|
|
19416
|
-
|
|
19417
|
-
|
|
19418
|
-
if (objB.onCollision && objB.onCollision(response, objA) !== false && objB.body.isStatic === false) {
|
|
19419
|
-
objB.body.respondToCollision.call(objB.body, response);
|
|
19497
|
+
// fast AABB check if both bounding boxes are overlaping
|
|
19498
|
+
if (boundsA.overlaps(boundsB)) {
|
|
19499
|
+
// for each shape in body A
|
|
19500
|
+
objA.body.shapes.forEach((shapeA, indexA) => {
|
|
19501
|
+
// for each shape in body B
|
|
19502
|
+
objB.body.shapes.forEach((shapeB, indexB) => {
|
|
19503
|
+
// full SAT collision check
|
|
19504
|
+
if (SAT["test" + shapeA.shapeType + shapeB.shapeType].call(
|
|
19505
|
+
this,
|
|
19506
|
+
objA, // a reference to the object A
|
|
19507
|
+
shapeA,
|
|
19508
|
+
objB, // a reference to the object B
|
|
19509
|
+
shapeB,
|
|
19510
|
+
// clear response object before reusing
|
|
19511
|
+
response.clear()) === true
|
|
19512
|
+
) {
|
|
19513
|
+
// we touched something !
|
|
19514
|
+
collisionCounter++;
|
|
19515
|
+
|
|
19516
|
+
// set the shape index
|
|
19517
|
+
response.indexShapeA = indexA;
|
|
19518
|
+
response.indexShapeB = indexB;
|
|
19519
|
+
|
|
19520
|
+
// execute the onCollision callback
|
|
19521
|
+
if (objA.onCollision && objA.onCollision(response, objB) !== false && objA.body.isStatic === false) {
|
|
19522
|
+
objA.body.respondToCollision.call(objA.body, response);
|
|
19523
|
+
}
|
|
19524
|
+
if (objB.onCollision && objB.onCollision(response, objA) !== false && objB.body.isStatic === false) {
|
|
19525
|
+
objB.body.respondToCollision.call(objB.body, response);
|
|
19526
|
+
}
|
|
19420
19527
|
}
|
|
19421
|
-
}
|
|
19422
|
-
|
|
19423
|
-
|
|
19424
|
-
indexA++;
|
|
19425
|
-
} while (indexA < aLen);
|
|
19528
|
+
});
|
|
19529
|
+
});
|
|
19530
|
+
}
|
|
19426
19531
|
}
|
|
19427
|
-
}
|
|
19532
|
+
});
|
|
19428
19533
|
// we could return the amount of objects we collided with ?
|
|
19429
19534
|
return collisionCounter > 0;
|
|
19430
19535
|
}
|
|
19536
|
+
|
|
19431
19537
|
/**
|
|
19432
19538
|
* Checks for object colliding with the given line
|
|
19433
19539
|
* @name rayCast
|
|
@@ -20158,7 +20264,8 @@ class Body {
|
|
|
20158
20264
|
if (shape.contains(_x, _y)) {
|
|
20159
20265
|
return true;
|
|
20160
20266
|
}
|
|
20161
|
-
}
|
|
20267
|
+
}
|
|
20268
|
+
}
|
|
20162
20269
|
return false;
|
|
20163
20270
|
}
|
|
20164
20271
|
|
|
@@ -20326,10 +20433,14 @@ class Container extends Renderable {
|
|
|
20326
20433
|
* @param {number} [width=game.viewport.width] width of the container
|
|
20327
20434
|
* @param {number} [height=game.viewport.height] height of the container
|
|
20328
20435
|
*/
|
|
20329
|
-
constructor(x = 0, y = 0, width
|
|
20436
|
+
constructor(x = 0, y = 0, width, height, root = false) {
|
|
20330
20437
|
|
|
20331
20438
|
// call the super constructor
|
|
20332
|
-
super(
|
|
20439
|
+
super(
|
|
20440
|
+
x, y,
|
|
20441
|
+
typeof width === "undefined" ? (typeof game.viewport !== "undefined" ? game.viewport.width : Infinity) : width,
|
|
20442
|
+
typeof height === "undefined" ? (typeof game.viewport !== "undefined" ? game.viewport.height : Infinity) : height
|
|
20443
|
+
);
|
|
20333
20444
|
|
|
20334
20445
|
/**
|
|
20335
20446
|
* keep track of pending sort
|
|
@@ -20470,6 +20581,7 @@ class Container extends Renderable {
|
|
|
20470
20581
|
this.removeChildNow(child);
|
|
20471
20582
|
}
|
|
20472
20583
|
}
|
|
20584
|
+
|
|
20473
20585
|
if (typeof this.currentTransform !== "undefined") {
|
|
20474
20586
|
// just reset some variables
|
|
20475
20587
|
this.currentTransform.identity();
|
|
@@ -21209,10 +21321,11 @@ class Container extends Renderable {
|
|
|
21209
21321
|
// check if object is in any active cameras
|
|
21210
21322
|
obj.inViewport = false;
|
|
21211
21323
|
// iterate through all cameras
|
|
21212
|
-
state.current().cameras.forEach(
|
|
21324
|
+
state.current().cameras.forEach((camera) => {
|
|
21213
21325
|
if (camera.isVisible(obj, isFloating)) {
|
|
21214
21326
|
obj.inViewport = true;
|
|
21215
|
-
}
|
|
21327
|
+
}
|
|
21328
|
+
});
|
|
21216
21329
|
|
|
21217
21330
|
// update our object
|
|
21218
21331
|
this.isDirty |= ((obj.inViewport || obj.alwaysUpdate) && obj.update(dt));
|
|
@@ -21329,6 +21442,7 @@ function QT_ARRAY_POP(world, bounds, max_objects = 4, max_levels = 4, level = 0)
|
|
|
21329
21442
|
return new QuadTree(world, bounds, max_objects, max_levels, level);
|
|
21330
21443
|
}
|
|
21331
21444
|
}
|
|
21445
|
+
|
|
21332
21446
|
/**
|
|
21333
21447
|
* Push back a quadtree back into the array
|
|
21334
21448
|
* @ignore
|
|
@@ -21336,6 +21450,7 @@ function QT_ARRAY_POP(world, bounds, max_objects = 4, max_levels = 4, level = 0)
|
|
|
21336
21450
|
function QT_ARRAY_PUSH(qt) {
|
|
21337
21451
|
QT_ARRAY.push(qt);
|
|
21338
21452
|
}
|
|
21453
|
+
|
|
21339
21454
|
/**
|
|
21340
21455
|
* a temporary vector object to be reused
|
|
21341
21456
|
* @ignore
|
|
@@ -21442,7 +21557,7 @@ class QuadTree {
|
|
|
21442
21557
|
if (item.isFloating === true) {
|
|
21443
21558
|
pos = this.world.app.viewport.localToWorld(bounds.left, bounds.top, QT_VECTOR);
|
|
21444
21559
|
} else {
|
|
21445
|
-
pos = QT_VECTOR.set(
|
|
21560
|
+
pos = QT_VECTOR.set(bounds.left, bounds.top);
|
|
21446
21561
|
}
|
|
21447
21562
|
|
|
21448
21563
|
var index = -1,
|
|
@@ -21861,7 +21976,8 @@ class World extends Container {
|
|
|
21861
21976
|
if (body.update(dt) === true) {
|
|
21862
21977
|
// mark ancestor as dirty
|
|
21863
21978
|
ancestor.isDirty = true;
|
|
21864
|
-
}
|
|
21979
|
+
}
|
|
21980
|
+
// handle collisions against other objects
|
|
21865
21981
|
collisionCheck(ancestor);
|
|
21866
21982
|
// clear body force
|
|
21867
21983
|
body.force.set(0, 0);
|
|
@@ -21888,7 +22004,7 @@ class Application {
|
|
|
21888
22004
|
* @public
|
|
21889
22005
|
* @type {Camera2d}
|
|
21890
22006
|
*/
|
|
21891
|
-
this.viewport =
|
|
22007
|
+
this.viewport = undefined;
|
|
21892
22008
|
|
|
21893
22009
|
/**
|
|
21894
22010
|
* a reference to the game world, <br>
|
|
@@ -21896,7 +22012,7 @@ class Application {
|
|
|
21896
22012
|
* @public
|
|
21897
22013
|
* @type {World}
|
|
21898
22014
|
*/
|
|
21899
|
-
this.world =
|
|
22015
|
+
this.world = undefined;
|
|
21900
22016
|
|
|
21901
22017
|
/**
|
|
21902
22018
|
* when true, all objects will be added under the root world container.<br>
|
|
@@ -21988,7 +22104,7 @@ class Application {
|
|
|
21988
22104
|
* // call myFunction () everytime a level is loaded
|
|
21989
22105
|
* me.game.onLevelLoaded = this.myFunction.bind(this);
|
|
21990
22106
|
*/
|
|
21991
|
-
onLevelLoaded() {}
|
|
22107
|
+
onLevelLoaded() {}
|
|
21992
22108
|
|
|
21993
22109
|
/**
|
|
21994
22110
|
* Update the renderer framerate using the system config variables.
|
|
@@ -22946,16 +23062,18 @@ class Stage {
|
|
|
22946
23062
|
|
|
22947
23063
|
// update the camera/viewport
|
|
22948
23064
|
// iterate through all cameras
|
|
22949
|
-
this.cameras.forEach(
|
|
23065
|
+
this.cameras.forEach((camera) => {
|
|
22950
23066
|
if (camera.update(dt) === true) {
|
|
22951
23067
|
isDirty = true;
|
|
22952
|
-
}
|
|
23068
|
+
}
|
|
23069
|
+
});
|
|
22953
23070
|
|
|
22954
23071
|
// update all lights
|
|
22955
23072
|
this.lights.forEach((light) => {
|
|
22956
23073
|
if (light.update(dt) === true) {
|
|
22957
23074
|
isDirty = true;
|
|
22958
|
-
}
|
|
23075
|
+
}
|
|
23076
|
+
});
|
|
22959
23077
|
|
|
22960
23078
|
return isDirty;
|
|
22961
23079
|
}
|
|
@@ -23100,6 +23218,7 @@ class ProgressBar extends Renderable {
|
|
|
23100
23218
|
}
|
|
23101
23219
|
|
|
23102
23220
|
}
|
|
23221
|
+
|
|
23103
23222
|
/**
|
|
23104
23223
|
* a default loading screen
|
|
23105
23224
|
* @ignore
|
|
@@ -23831,6 +23950,7 @@ function parseAttributes(obj, elt) {
|
|
|
23831
23950
|
function decompress() {
|
|
23832
23951
|
throw new Error("GZIP/ZLIB compressed TMX Tile Map not supported!");
|
|
23833
23952
|
}
|
|
23953
|
+
|
|
23834
23954
|
/**
|
|
23835
23955
|
* Decode a CSV encoded array into a binary array
|
|
23836
23956
|
* @ignore
|
|
@@ -23847,6 +23967,7 @@ function decodeCSV(input) {
|
|
|
23847
23967
|
}
|
|
23848
23968
|
return result;
|
|
23849
23969
|
}
|
|
23970
|
+
|
|
23850
23971
|
/**
|
|
23851
23972
|
* Decode a base64 encoded string into a byte array
|
|
23852
23973
|
* @ignore
|
|
@@ -23870,6 +23991,7 @@ function decodeBase64AsArray(input, bytes) {
|
|
|
23870
23991
|
}
|
|
23871
23992
|
return ar;
|
|
23872
23993
|
}
|
|
23994
|
+
|
|
23873
23995
|
/**
|
|
23874
23996
|
* Decode the given data
|
|
23875
23997
|
* @ignore
|
|
@@ -23900,6 +24022,7 @@ function decode(data, encoding, compression) {
|
|
|
23900
24022
|
throw new Error("Unknown layer encoding: " + encoding);
|
|
23901
24023
|
}
|
|
23902
24024
|
}
|
|
24025
|
+
|
|
23903
24026
|
/**
|
|
23904
24027
|
* Normalize TMX format to Tiled JSON format
|
|
23905
24028
|
* @ignore
|
|
@@ -24007,6 +24130,7 @@ function normalize(obj, item) {
|
|
|
24007
24130
|
break;
|
|
24008
24131
|
}
|
|
24009
24132
|
}
|
|
24133
|
+
|
|
24010
24134
|
/**
|
|
24011
24135
|
* Parse a XML TMX object and returns the corresponding javascript object
|
|
24012
24136
|
* @ignore
|
|
@@ -24045,6 +24169,7 @@ function parse(xml) {
|
|
|
24045
24169
|
|
|
24046
24170
|
return obj;
|
|
24047
24171
|
}
|
|
24172
|
+
|
|
24048
24173
|
/**
|
|
24049
24174
|
* Apply TMX Properties to the given object
|
|
24050
24175
|
* @ignore
|
|
@@ -24217,7 +24342,7 @@ class Tile extends Bounds {
|
|
|
24217
24342
|
if (tileset.animations.has(this.tileId)) {
|
|
24218
24343
|
var frames = [];
|
|
24219
24344
|
var frameId = [];
|
|
24220
|
-
(tileset.animations.get(this.tileId).frames).forEach(
|
|
24345
|
+
(tileset.animations.get(this.tileId).frames).forEach((frame) => {
|
|
24221
24346
|
frameId.push(frame.tileid);
|
|
24222
24347
|
frames.push({
|
|
24223
24348
|
name : "" + frame.tileid,
|
|
@@ -25585,6 +25710,7 @@ class TMXRenderer {
|
|
|
25585
25710
|
}
|
|
25586
25711
|
|
|
25587
25712
|
}
|
|
25713
|
+
|
|
25588
25714
|
/* eslint-enable no-unused-vars */
|
|
25589
25715
|
|
|
25590
25716
|
/**
|
|
@@ -26756,7 +26882,7 @@ class TMXTileset {
|
|
|
26756
26882
|
if (this._lastUpdate !== now) {
|
|
26757
26883
|
this._lastUpdate = now;
|
|
26758
26884
|
|
|
26759
|
-
this.animations.forEach(
|
|
26885
|
+
this.animations.forEach((anim) => {
|
|
26760
26886
|
anim.dt += dt;
|
|
26761
26887
|
duration = anim.cur.duration;
|
|
26762
26888
|
while (anim.dt >= duration) {
|
|
@@ -27614,7 +27740,8 @@ class TMXTileMap {
|
|
|
27614
27740
|
getRenderer() {
|
|
27615
27741
|
if ((typeof(this.renderer) === "undefined") || (!this.renderer.canRender(this))) {
|
|
27616
27742
|
this.renderer = getNewDefaultRenderer(this);
|
|
27617
|
-
}
|
|
27743
|
+
}
|
|
27744
|
+
return this.renderer;
|
|
27618
27745
|
}
|
|
27619
27746
|
|
|
27620
27747
|
/**
|
|
@@ -27724,12 +27851,12 @@ class TMXTileMap {
|
|
|
27724
27851
|
}
|
|
27725
27852
|
|
|
27726
27853
|
// add all layers instances
|
|
27727
|
-
this.getLayers().forEach(
|
|
27854
|
+
this.getLayers().forEach((layer) => {
|
|
27728
27855
|
container.addChild(layer);
|
|
27729
27856
|
});
|
|
27730
27857
|
|
|
27731
27858
|
// add all Object instances
|
|
27732
|
-
this.getObjects(flatten).forEach(
|
|
27859
|
+
this.getObjects(flatten).forEach((object) => {
|
|
27733
27860
|
container.addChild(object);
|
|
27734
27861
|
});
|
|
27735
27862
|
|
|
@@ -28008,6 +28135,7 @@ function safeLoadLevel(levelId, options, restart) {
|
|
|
28008
28135
|
state.restart();
|
|
28009
28136
|
}
|
|
28010
28137
|
}
|
|
28138
|
+
|
|
28011
28139
|
/**
|
|
28012
28140
|
* Load a TMX level
|
|
28013
28141
|
* @name loadTMXLevel
|
|
@@ -28033,6 +28161,7 @@ function loadTMXLevel(levelId, container, flatten, setViewportBounds) {
|
|
|
28033
28161
|
level.addTo(container, flatten, setViewportBounds);
|
|
28034
28162
|
}
|
|
28035
28163
|
|
|
28164
|
+
|
|
28036
28165
|
/**
|
|
28037
28166
|
* a level manager. once ressources loaded, the level manager contains all references of defined levels.
|
|
28038
28167
|
* @namespace level
|
|
@@ -28276,7 +28405,7 @@ function checkLoadStatus(onload) {
|
|
|
28276
28405
|
// trigger the onload callback
|
|
28277
28406
|
// we call either the supplied callback (which takes precedence) or the global one
|
|
28278
28407
|
var callback = onload || loader.onload;
|
|
28279
|
-
setTimeout(
|
|
28408
|
+
setTimeout(() => {
|
|
28280
28409
|
callback();
|
|
28281
28410
|
emit(LOADER_COMPLETE);
|
|
28282
28411
|
}, 300);
|
|
@@ -28291,6 +28420,7 @@ function checkLoadStatus(onload) {
|
|
|
28291
28420
|
}, 100);
|
|
28292
28421
|
}
|
|
28293
28422
|
}
|
|
28423
|
+
|
|
28294
28424
|
/**
|
|
28295
28425
|
* load Images
|
|
28296
28426
|
* @example
|
|
@@ -28316,6 +28446,7 @@ function preloadImage(img, onload, onerror) {
|
|
|
28316
28446
|
}
|
|
28317
28447
|
imgList[img.name].src = img.src + loader.nocache;
|
|
28318
28448
|
}
|
|
28449
|
+
|
|
28319
28450
|
/**
|
|
28320
28451
|
* load a font face
|
|
28321
28452
|
* @example
|
|
@@ -28344,13 +28475,14 @@ function preloadFontFace(data, onload, onerror) {
|
|
|
28344
28475
|
// onloaded callback
|
|
28345
28476
|
onload();
|
|
28346
28477
|
}
|
|
28347
|
-
},
|
|
28478
|
+
}, () => {
|
|
28348
28479
|
if (typeof onerror === "function") {
|
|
28349
28480
|
// rejected
|
|
28350
28481
|
onerror(data.name);
|
|
28351
28482
|
}
|
|
28352
28483
|
});
|
|
28353
28484
|
}
|
|
28485
|
+
|
|
28354
28486
|
/**
|
|
28355
28487
|
* preload TMX files
|
|
28356
28488
|
* @ignore
|
|
@@ -28458,6 +28590,7 @@ function preloadTMX(tmxData, onload, onerror) {
|
|
|
28458
28590
|
// send the request
|
|
28459
28591
|
xmlhttp.send();
|
|
28460
28592
|
}
|
|
28593
|
+
|
|
28461
28594
|
/**
|
|
28462
28595
|
* preload JSON files
|
|
28463
28596
|
* @ignore
|
|
@@ -28494,6 +28627,7 @@ function preloadJSON(data, onload, onerror) {
|
|
|
28494
28627
|
// send the request
|
|
28495
28628
|
xmlhttp.send();
|
|
28496
28629
|
}
|
|
28630
|
+
|
|
28497
28631
|
/**
|
|
28498
28632
|
* preload Binary files
|
|
28499
28633
|
* @ignore
|
|
@@ -28524,6 +28658,7 @@ function preloadBinary(data, onload, onerror) {
|
|
|
28524
28658
|
};
|
|
28525
28659
|
httpReq.send();
|
|
28526
28660
|
}
|
|
28661
|
+
|
|
28527
28662
|
/**
|
|
28528
28663
|
* preload Binary files
|
|
28529
28664
|
* @ignore
|
|
@@ -28554,6 +28689,7 @@ function preloadJavascript(data, onload, onerror) {
|
|
|
28554
28689
|
|
|
28555
28690
|
document.getElementsByTagName("body")[0].appendChild(script);
|
|
28556
28691
|
}
|
|
28692
|
+
|
|
28557
28693
|
/**
|
|
28558
28694
|
* a small class to manage loading of stuff and manage resources
|
|
28559
28695
|
* @namespace loader
|
|
@@ -29218,6 +29354,7 @@ class Sprite extends Renderable {
|
|
|
29218
29354
|
if (typeof settings.z !== "undefined") {
|
|
29219
29355
|
this.pos.z = settings.z;
|
|
29220
29356
|
}
|
|
29357
|
+
|
|
29221
29358
|
// for sprite, addAnimation will return !=0
|
|
29222
29359
|
if (this.addAnimation("default", null) !== 0) {
|
|
29223
29360
|
// set as default
|
|
@@ -29317,7 +29454,7 @@ class Sprite extends Renderable {
|
|
|
29317
29454
|
if (index == null) {
|
|
29318
29455
|
index = [];
|
|
29319
29456
|
// create a default animation with all frame
|
|
29320
|
-
Object.keys(this.textureAtlas).forEach(
|
|
29457
|
+
Object.keys(this.textureAtlas).forEach((v, i) => {
|
|
29321
29458
|
index[i] = i;
|
|
29322
29459
|
});
|
|
29323
29460
|
}
|
|
@@ -29998,7 +30135,7 @@ class TextureAtlas {
|
|
|
29998
30135
|
region = this.getAtlas(atlas)[name];
|
|
29999
30136
|
} else {
|
|
30000
30137
|
// look for the given region in each existing atlas
|
|
30001
|
-
this.atlases.forEach(
|
|
30138
|
+
this.atlases.forEach((atlas) => {
|
|
30002
30139
|
if (typeof atlas[name] !== "undefined") {
|
|
30003
30140
|
// there should be only one
|
|
30004
30141
|
region = atlas[name];
|
|
@@ -31795,6 +31932,7 @@ function autoDetectRenderer(options) {
|
|
|
31795
31932
|
}
|
|
31796
31933
|
return new CanvasRenderer(options);
|
|
31797
31934
|
}
|
|
31935
|
+
|
|
31798
31936
|
/**
|
|
31799
31937
|
* callback for window resize event
|
|
31800
31938
|
* @ignore
|
|
@@ -31869,6 +32007,7 @@ function onresize() {
|
|
|
31869
32007
|
scale(settings.scale, settings.scale);
|
|
31870
32008
|
}
|
|
31871
32009
|
}
|
|
32010
|
+
|
|
31872
32011
|
/**
|
|
31873
32012
|
* Select the HTML5 Canvas renderer
|
|
31874
32013
|
* @name CANVAS
|
|
@@ -32020,7 +32159,7 @@ function init(width, height, options) {
|
|
|
32020
32159
|
globalThis.addEventListener(
|
|
32021
32160
|
"resize",
|
|
32022
32161
|
utils.function.throttle(
|
|
32023
|
-
|
|
32162
|
+
(e) => {
|
|
32024
32163
|
emit(WINDOW_ONRESIZE, e);
|
|
32025
32164
|
}, 100
|
|
32026
32165
|
), false
|
|
@@ -32029,7 +32168,7 @@ function init(width, height, options) {
|
|
|
32029
32168
|
// Screen Orientation API
|
|
32030
32169
|
globalThis.addEventListener(
|
|
32031
32170
|
"orientationchange",
|
|
32032
|
-
|
|
32171
|
+
(e) => {
|
|
32033
32172
|
emit(WINDOW_ONORIENTATION_CHANGE, e);
|
|
32034
32173
|
},
|
|
32035
32174
|
false
|
|
@@ -32037,7 +32176,7 @@ function init(width, height, options) {
|
|
|
32037
32176
|
// pre-fixed implementation on mozzila
|
|
32038
32177
|
globalThis.addEventListener(
|
|
32039
32178
|
"onmozorientationchange",
|
|
32040
|
-
|
|
32179
|
+
(e) => {
|
|
32041
32180
|
emit(WINDOW_ONORIENTATION_CHANGE, e);
|
|
32042
32181
|
},
|
|
32043
32182
|
false
|
|
@@ -32050,11 +32189,9 @@ function init(width, height, options) {
|
|
|
32050
32189
|
}
|
|
32051
32190
|
|
|
32052
32191
|
// Automatically update relative canvas position on scroll
|
|
32053
|
-
globalThis.addEventListener("scroll", utils.function.throttle(
|
|
32054
|
-
|
|
32055
|
-
|
|
32056
|
-
}, 100
|
|
32057
|
-
), false);
|
|
32192
|
+
globalThis.addEventListener("scroll", utils.function.throttle((e) => {
|
|
32193
|
+
emit(WINDOW_ONSCROLL, e);
|
|
32194
|
+
}, 100), false);
|
|
32058
32195
|
|
|
32059
32196
|
// register to the channel
|
|
32060
32197
|
on(WINDOW_ONRESIZE, onresize, this);
|
|
@@ -32123,6 +32260,7 @@ function init(width, height, options) {
|
|
|
32123
32260
|
|
|
32124
32261
|
return true;
|
|
32125
32262
|
}
|
|
32263
|
+
|
|
32126
32264
|
/**
|
|
32127
32265
|
* Create and return a new Canvas element
|
|
32128
32266
|
* @function video.createCanvas
|
|
@@ -32154,6 +32292,7 @@ function createCanvas(width, height, returnOffscreenCanvas = false) {
|
|
|
32154
32292
|
|
|
32155
32293
|
return _canvas;
|
|
32156
32294
|
}
|
|
32295
|
+
|
|
32157
32296
|
/**
|
|
32158
32297
|
* return a reference to the parent DOM element holding the main canvas
|
|
32159
32298
|
* @function video.getParent
|
|
@@ -32162,6 +32301,7 @@ function createCanvas(width, height, returnOffscreenCanvas = false) {
|
|
|
32162
32301
|
function getParent() {
|
|
32163
32302
|
return parent;
|
|
32164
32303
|
}
|
|
32304
|
+
|
|
32165
32305
|
/**
|
|
32166
32306
|
* scale the "displayed" canvas by the given scalar.
|
|
32167
32307
|
* this will modify the size of canvas element directly.
|
|
@@ -32326,9 +32466,9 @@ var utils = {
|
|
|
32326
32466
|
}
|
|
32327
32467
|
|
|
32328
32468
|
// parse the url
|
|
32329
|
-
url.slice(1).split("&").filter(
|
|
32469
|
+
url.slice(1).split("&").filter((value) => {
|
|
32330
32470
|
return (value !== "");
|
|
32331
|
-
}).forEach(
|
|
32471
|
+
}).forEach((value) => {
|
|
32332
32472
|
var kv = value.split("=");
|
|
32333
32473
|
var k = kv.shift();
|
|
32334
32474
|
var v = kv.join("=");
|
|
@@ -32616,6 +32756,7 @@ class Timer {
|
|
|
32616
32756
|
}
|
|
32617
32757
|
}
|
|
32618
32758
|
}
|
|
32759
|
+
|
|
32619
32760
|
const timer = new Timer();
|
|
32620
32761
|
|
|
32621
32762
|
var lastTime = 0;
|
|
@@ -32640,7 +32781,7 @@ if (!requestAnimationFrame || !cancelAnimationFrame) {
|
|
|
32640
32781
|
requestAnimationFrame = function (callback) {
|
|
32641
32782
|
var currTime = globalThis.performance.now();
|
|
32642
32783
|
var timeToCall = Math.max(0, (1000 / timer.maxfps) - (currTime - lastTime));
|
|
32643
|
-
var id = globalThis.setTimeout(
|
|
32784
|
+
var id = globalThis.setTimeout(() => {
|
|
32644
32785
|
callback(currTime + timeToCall);
|
|
32645
32786
|
}, timeToCall);
|
|
32646
32787
|
lastTime = currTime + timeToCall;
|
|
@@ -32908,10 +33049,10 @@ class BasePlugin {
|
|
|
32908
33049
|
* this can be overridden by the plugin
|
|
32909
33050
|
* @public
|
|
32910
33051
|
* @type {string}
|
|
32911
|
-
* @default "
|
|
33052
|
+
* @default "14.0.1"
|
|
32912
33053
|
* @name plugin.Base#version
|
|
32913
33054
|
*/
|
|
32914
|
-
this.version = "
|
|
33055
|
+
this.version = "14.0.1";
|
|
32915
33056
|
}
|
|
32916
33057
|
}
|
|
32917
33058
|
|
|
@@ -33792,7 +33933,7 @@ class Tween {
|
|
|
33792
33933
|
onComplete( onCompleteCallback ) {
|
|
33793
33934
|
this._onCompleteCallback = onCompleteCallback;
|
|
33794
33935
|
return this;
|
|
33795
|
-
}
|
|
33936
|
+
}
|
|
33796
33937
|
|
|
33797
33938
|
/** @ignore */
|
|
33798
33939
|
update( dt ) {
|
|
@@ -34456,7 +34597,7 @@ class Text extends Renderable {
|
|
|
34456
34597
|
*/
|
|
34457
34598
|
setFont(font, size = 10) {
|
|
34458
34599
|
// font name and type
|
|
34459
|
-
var font_names = font.split(",").map(
|
|
34600
|
+
var font_names = font.split(",").map((value) => {
|
|
34460
34601
|
value = value.trim();
|
|
34461
34602
|
return (
|
|
34462
34603
|
!/(^".*"$)|(^'.*'$)/.test(value)
|
|
@@ -34769,6 +34910,7 @@ class BitmapText extends Renderable {
|
|
|
34769
34910
|
(settings.fontData.includes("info face")) ? settings.fontData : loader.getBinary(settings.fontData)
|
|
34770
34911
|
);
|
|
34771
34912
|
}
|
|
34913
|
+
|
|
34772
34914
|
// if floating was specified through settings
|
|
34773
34915
|
if (typeof settings.floating !== "undefined") {
|
|
34774
34916
|
this.floating = !!settings.floating;
|
|
@@ -35083,6 +35225,7 @@ function getValueFromPair(string, pattern) {
|
|
|
35083
35225
|
|
|
35084
35226
|
return value[0].split("=")[1];
|
|
35085
35227
|
}
|
|
35228
|
+
|
|
35086
35229
|
/**
|
|
35087
35230
|
* Gets the first glyph in the map that is not a space character
|
|
35088
35231
|
* @ignore
|
|
@@ -35100,6 +35243,7 @@ function getFirstGlyph(glyphs) {
|
|
|
35100
35243
|
}
|
|
35101
35244
|
return null;
|
|
35102
35245
|
}
|
|
35246
|
+
|
|
35103
35247
|
/**
|
|
35104
35248
|
* Creates a glyph to use for the space character
|
|
35105
35249
|
* @ignore
|
|
@@ -35118,7 +35262,6 @@ function createSpaceGlyph(glyphs) {
|
|
|
35118
35262
|
}
|
|
35119
35263
|
}
|
|
35120
35264
|
|
|
35121
|
-
|
|
35122
35265
|
/**
|
|
35123
35266
|
* Class for storing relevant data from the font file.
|
|
35124
35267
|
* @ignore
|
|
@@ -35850,20 +35993,331 @@ class NineSliceSprite extends Sprite {
|
|
|
35850
35993
|
|
|
35851
35994
|
/**
|
|
35852
35995
|
* @classdesc
|
|
35853
|
-
*
|
|
35854
|
-
*
|
|
35855
|
-
*
|
|
35856
|
-
*
|
|
35996
|
+
* This is a basic clickable container which you can use in your game UI.
|
|
35997
|
+
* Use this for example if you want to display a button which contains
|
|
35998
|
+
* text and images.
|
|
35999
|
+
* @augments Container
|
|
36000
|
+
*/
|
|
36001
|
+
class UIBaseElement extends Container {
|
|
36002
|
+
/**
|
|
36003
|
+
*
|
|
36004
|
+
* @param {number} x The x position of the container
|
|
36005
|
+
* @param {number} y The y position of the container
|
|
36006
|
+
* @param {number} w width of the container (default: viewport width)
|
|
36007
|
+
* @param {number} h height of the container (default: viewport height)
|
|
36008
|
+
*/
|
|
36009
|
+
constructor(x, y, w, h) {
|
|
36010
|
+
super(x, y, w, h);
|
|
36011
|
+
/**
|
|
36012
|
+
* object can be clicked or not
|
|
36013
|
+
* @type {boolean}
|
|
36014
|
+
*/
|
|
36015
|
+
this.isClickable = true;
|
|
36016
|
+
|
|
36017
|
+
/**
|
|
36018
|
+
* Tap and hold threshold timeout in ms
|
|
36019
|
+
* @type {number}
|
|
36020
|
+
* @default 250
|
|
36021
|
+
*/
|
|
36022
|
+
this.holdThreshold = 250;
|
|
36023
|
+
|
|
36024
|
+
/**
|
|
36025
|
+
* object can be tap and hold
|
|
36026
|
+
* @type {boolean}
|
|
36027
|
+
* @default false
|
|
36028
|
+
*/
|
|
36029
|
+
this.isHoldable = false;
|
|
36030
|
+
|
|
36031
|
+
/**
|
|
36032
|
+
* true if the pointer is over the object
|
|
36033
|
+
* @type {boolean}
|
|
36034
|
+
* @default false
|
|
36035
|
+
*/
|
|
36036
|
+
this.hover = false;
|
|
36037
|
+
|
|
36038
|
+
// object has been updated (clicked,etc..)
|
|
36039
|
+
this.holdTimeout = null;
|
|
36040
|
+
this.released = true;
|
|
36041
|
+
|
|
36042
|
+
// GUI items use screen coordinates
|
|
36043
|
+
this.floating = true;
|
|
36044
|
+
|
|
36045
|
+
// enable event detection
|
|
36046
|
+
this.isKinematic = false;
|
|
36047
|
+
}
|
|
36048
|
+
|
|
36049
|
+
/**
|
|
36050
|
+
* function callback for the pointerdown event
|
|
36051
|
+
* @ignore
|
|
36052
|
+
*/
|
|
36053
|
+
clicked(event) {
|
|
36054
|
+
// Check if left mouse button is pressed
|
|
36055
|
+
if (event.button === 0 && this.isClickable) {
|
|
36056
|
+
this.dirty = true;
|
|
36057
|
+
this.released = false;
|
|
36058
|
+
if (this.isHoldable) {
|
|
36059
|
+
if (this.holdTimeout !== null) {
|
|
36060
|
+
timer.clearTimeout(this.holdTimeout);
|
|
36061
|
+
}
|
|
36062
|
+
this.holdTimeout = timer.setTimeout(
|
|
36063
|
+
this.hold.bind(this),
|
|
36064
|
+
this.holdThreshold,
|
|
36065
|
+
false
|
|
36066
|
+
);
|
|
36067
|
+
this.released = false;
|
|
36068
|
+
}
|
|
36069
|
+
return this.onClick(event);
|
|
36070
|
+
}
|
|
36071
|
+
}
|
|
36072
|
+
|
|
36073
|
+
/**
|
|
36074
|
+
* function called when the object is pressed (to be extended)
|
|
36075
|
+
* @param {Pointer} event the event object
|
|
36076
|
+
* @returns {boolean} return false if we need to stop propagating the event
|
|
36077
|
+
*/
|
|
36078
|
+
onClick(event) { // eslint-disable-line no-unused-vars
|
|
36079
|
+
return false;
|
|
36080
|
+
}
|
|
36081
|
+
|
|
36082
|
+
/**
|
|
36083
|
+
* function callback for the pointerEnter event
|
|
36084
|
+
* @ignore
|
|
36085
|
+
*/
|
|
36086
|
+
enter(event) {
|
|
36087
|
+
this.hover = true;
|
|
36088
|
+
this.dirty = true;
|
|
36089
|
+
return this.onOver(event);
|
|
36090
|
+
}
|
|
36091
|
+
|
|
36092
|
+
/**
|
|
36093
|
+
* function called when the pointer is over the object
|
|
36094
|
+
* @param {Pointer} event the event object
|
|
36095
|
+
*/
|
|
36096
|
+
onOver(event) { // eslint-disable-line no-unused-vars
|
|
36097
|
+
// to be extended
|
|
36098
|
+
}
|
|
36099
|
+
|
|
36100
|
+
/**
|
|
36101
|
+
* function callback for the pointerLeave event
|
|
36102
|
+
* @ignore
|
|
36103
|
+
*/
|
|
36104
|
+
leave(event) {
|
|
36105
|
+
this.hover = false;
|
|
36106
|
+
this.dirty = true;
|
|
36107
|
+
this.release(event);
|
|
36108
|
+
return this.onOut(event);
|
|
36109
|
+
}
|
|
36110
|
+
|
|
36111
|
+
/**
|
|
36112
|
+
* function called when the pointer is leaving the object area
|
|
36113
|
+
* @param {Pointer} event the event object
|
|
36114
|
+
*/
|
|
36115
|
+
onOut(event) { // eslint-disable-line no-unused-vars
|
|
36116
|
+
// to be extended
|
|
36117
|
+
}
|
|
36118
|
+
|
|
36119
|
+
/**
|
|
36120
|
+
* function callback for the pointerup event
|
|
36121
|
+
* @ignore
|
|
36122
|
+
*/
|
|
36123
|
+
release(event) {
|
|
36124
|
+
if (this.released === false) {
|
|
36125
|
+
this.released = true;
|
|
36126
|
+
this.dirty = true;
|
|
36127
|
+
timer.clearTimeout(this.holdTimeout);
|
|
36128
|
+
return this.onRelease(event);
|
|
36129
|
+
}
|
|
36130
|
+
}
|
|
36131
|
+
|
|
36132
|
+
/**
|
|
36133
|
+
* function called when the object is pressed and released (to be extended)
|
|
36134
|
+
* @returns {boolean} return false if we need to stop propagating the event
|
|
36135
|
+
*/
|
|
36136
|
+
onRelease() {
|
|
36137
|
+
return false;
|
|
36138
|
+
}
|
|
36139
|
+
|
|
36140
|
+
/**
|
|
36141
|
+
* function callback for the tap and hold timer event
|
|
36142
|
+
* @ignore
|
|
36143
|
+
*/
|
|
36144
|
+
hold() {
|
|
36145
|
+
timer.clearTimeout(this.holdTimeout);
|
|
36146
|
+
this.dirty = true;
|
|
36147
|
+
if (!this.released) {
|
|
36148
|
+
this.onHold();
|
|
36149
|
+
}
|
|
36150
|
+
}
|
|
36151
|
+
|
|
36152
|
+
/**
|
|
36153
|
+
* function called when the object is pressed and held<br>
|
|
36154
|
+
* to be extended <br>
|
|
36155
|
+
*/
|
|
36156
|
+
onHold() {}
|
|
36157
|
+
|
|
36158
|
+
/**
|
|
36159
|
+
* function called when added to the game world or a container
|
|
36160
|
+
* @ignore
|
|
36161
|
+
*/
|
|
36162
|
+
onActivateEvent() {
|
|
36163
|
+
// register pointer events
|
|
36164
|
+
registerPointerEvent(
|
|
36165
|
+
"pointerdown",
|
|
36166
|
+
this,
|
|
36167
|
+
this.clicked.bind(this)
|
|
36168
|
+
);
|
|
36169
|
+
registerPointerEvent("pointerup", this, this.release.bind(this));
|
|
36170
|
+
registerPointerEvent(
|
|
36171
|
+
"pointercancel",
|
|
36172
|
+
this,
|
|
36173
|
+
this.release.bind(this)
|
|
36174
|
+
);
|
|
36175
|
+
registerPointerEvent("pointerenter", this, this.enter.bind(this));
|
|
36176
|
+
registerPointerEvent("pointerleave", this, this.leave.bind(this));
|
|
36177
|
+
}
|
|
36178
|
+
|
|
36179
|
+
/**
|
|
36180
|
+
* function called when removed from the game world or a container
|
|
36181
|
+
* @ignore
|
|
36182
|
+
*/
|
|
36183
|
+
onDeactivateEvent() {
|
|
36184
|
+
// release pointer events
|
|
36185
|
+
releasePointerEvent("pointerdown", this.hitbox);
|
|
36186
|
+
releasePointerEvent("pointerup", this);
|
|
36187
|
+
releasePointerEvent("pointercancel", this);
|
|
36188
|
+
releasePointerEvent("pointerenter", this);
|
|
36189
|
+
releasePointerEvent("pointerleave", this);
|
|
36190
|
+
timer.clearTimeout(this.holdTimeout);
|
|
36191
|
+
}
|
|
36192
|
+
}
|
|
36193
|
+
|
|
36194
|
+
/**
|
|
36195
|
+
* @classdesc
|
|
36196
|
+
* This is a basic base text button which you can use in your Game UI.
|
|
36197
|
+
* @augments UIBaseElement
|
|
36198
|
+
*/
|
|
36199
|
+
class UITextButton extends UIBaseElement {
|
|
36200
|
+
/**
|
|
36201
|
+
* A Text Button with an outlined background border, filled with background color.
|
|
36202
|
+
* It uses a RoundRect as background and changes the background color on hovering over.
|
|
36203
|
+
* The background will be drawn with 0.5 opacity, so that the background of the button is
|
|
36204
|
+
* slightly shining through.
|
|
36205
|
+
* @param {number} x x pos of the button
|
|
36206
|
+
* @param {number} y y pos of the button
|
|
36207
|
+
* @param {string} [settings.font] The name of the BitmapText font to use
|
|
36208
|
+
* @param {number} [settings.size] The scale factor of the font (default: 1)
|
|
36209
|
+
* @param {string} [settings.text] The text to display (default: 'click me')
|
|
36210
|
+
* @param {string} [settings.bindKey] The key to bind the action to (default: none)
|
|
36211
|
+
* @param {string} [settings.backgroundColor] The css value of a background color
|
|
36212
|
+
* @param {string} [settings.hoverColor] The css value of a color to be used if the pointer hovers over the button
|
|
36213
|
+
* @param {string} [settings.borderStrokeColor] The css value of a color to be used to draw the border
|
|
36214
|
+
* @param {boolean} [settings.offScreenCanvas] Weather to use an offScreen canvas or not
|
|
36215
|
+
* @param {string} [settings.fillStyle] The css value of a tint color to be used to tint the text
|
|
36216
|
+
* @param {number} [settings.borderWidth] Width of the button
|
|
36217
|
+
* @param {number} [settings.borderHeight] Height of the button
|
|
36218
|
+
* @example
|
|
36219
|
+
* // Create a new Button
|
|
36220
|
+
* class PlayButton extends BaseTextButton {
|
|
36221
|
+
* constructor(x,y) {
|
|
36222
|
+
* super(x,y, {
|
|
36223
|
+
* font: 'my-font',
|
|
36224
|
+
* text: 'Play',
|
|
36225
|
+
* // if you omit the next two, size is calculated by the size of the text
|
|
36226
|
+
* borderWidth: 200,
|
|
36227
|
+
* borderHeight: 20,
|
|
36228
|
+
* });
|
|
36229
|
+
* }
|
|
36230
|
+
*
|
|
36231
|
+
* onClick(){
|
|
36232
|
+
* state.change(state.PLAY);
|
|
36233
|
+
* }
|
|
36234
|
+
* }
|
|
36235
|
+
*
|
|
36236
|
+
* game.world.addChild(new PlayButton(15,200));
|
|
36237
|
+
*/
|
|
36238
|
+
constructor(x, y, settings) {
|
|
36239
|
+
super(x, y);
|
|
36240
|
+
settings.font = settings.font || "24Outline";
|
|
36241
|
+
settings.size = settings.size || 1;
|
|
36242
|
+
settings.text = settings.text || "<Click Me>";
|
|
36243
|
+
settings.bindKey = settings.bindKey || -1;
|
|
36244
|
+
settings.backgroundColor = settings.backgroundColor || "#00aa00";
|
|
36245
|
+
settings.hoverColor = settings.hoverColor || "#00ff00";
|
|
36246
|
+
settings.borderStrokeColor = settings.borderStrokeColor || "#000000";
|
|
36247
|
+
settings.offScreenCanvas = settings.offScreenCanvas || false;
|
|
36248
|
+
settings.fillStyle = settings.fillStyle || "#ffffff";
|
|
36249
|
+
settings.lineWidth = settings.lineWidth || 1;
|
|
36250
|
+
settings.anchorPoint = settings.anchorPoint || new Vector2d(0, 0);
|
|
36251
|
+
|
|
36252
|
+
let font = new BitmapText(x, y, settings);
|
|
36253
|
+
let dimensions = font.measureText();
|
|
36254
|
+
settings.borderWidth = settings.borderWidth || dimensions.width + 16;
|
|
36255
|
+
settings.borderHeight = settings.borderHeight || dimensions.height + 16;
|
|
36256
|
+
|
|
36257
|
+
let border = new RoundRect(
|
|
36258
|
+
x,
|
|
36259
|
+
y,
|
|
36260
|
+
settings.borderWidth,
|
|
36261
|
+
settings.borderHeight
|
|
36262
|
+
);
|
|
36263
|
+
super.setShape(
|
|
36264
|
+
x,
|
|
36265
|
+
y,
|
|
36266
|
+
border.getBounds().width,
|
|
36267
|
+
border.getBounds().height
|
|
36268
|
+
);
|
|
36269
|
+
|
|
36270
|
+
// build up
|
|
36271
|
+
this.font = font;
|
|
36272
|
+
this.dimensions = dimensions;
|
|
36273
|
+
this.border = border;
|
|
36274
|
+
this.settings = settings;
|
|
36275
|
+
|
|
36276
|
+
// adjust text position
|
|
36277
|
+
this.font.pos.set(
|
|
36278
|
+
Math.round((border.width - dimensions.width) / 2) + this.font.pos.x,
|
|
36279
|
+
Math.round((border.height - dimensions.height) / 2) +
|
|
36280
|
+
this.font.pos.y
|
|
36281
|
+
);
|
|
36282
|
+
}
|
|
36283
|
+
|
|
36284
|
+
draw(renderer) {
|
|
36285
|
+
renderer.setGlobalAlpha(0.5);
|
|
36286
|
+
if (!this.hover) {
|
|
36287
|
+
renderer.setColor(this.settings.backgroundColor);
|
|
36288
|
+
} else {
|
|
36289
|
+
renderer.setColor(this.settings.hoverColor);
|
|
36290
|
+
}
|
|
36291
|
+
|
|
36292
|
+
renderer.fill(this.border);
|
|
36293
|
+
renderer.setGlobalAlpha(1);
|
|
36294
|
+
renderer.setColor(this.settings.borderStrokeColor);
|
|
36295
|
+
renderer.stroke(this.border);
|
|
36296
|
+
|
|
36297
|
+
// fix: supporting tint
|
|
36298
|
+
renderer.setTint(this.font.tint, this.font.getOpacity());
|
|
36299
|
+
this.font.draw(
|
|
36300
|
+
renderer,
|
|
36301
|
+
this.settings.text,
|
|
36302
|
+
this.font.pos.x,
|
|
36303
|
+
this.font.pos.y
|
|
36304
|
+
);
|
|
36305
|
+
}
|
|
36306
|
+
}
|
|
36307
|
+
|
|
36308
|
+
/**
|
|
36309
|
+
* @classdesc
|
|
36310
|
+
* This is a basic sprite based button which you can use in your Game UI.
|
|
35857
36311
|
* @augments Sprite
|
|
35858
36312
|
*/
|
|
35859
|
-
class
|
|
36313
|
+
class UISpriteElement extends Sprite {
|
|
35860
36314
|
/**
|
|
35861
36315
|
* @param {number} x the x coordinate of the GUI Object
|
|
35862
36316
|
* @param {number} y the y coordinate of the GUI Object
|
|
35863
36317
|
* @param {object} settings See {@link Sprite}
|
|
35864
36318
|
* @example
|
|
35865
36319
|
* // create a basic GUI Object
|
|
35866
|
-
* class myButton extends
|
|
36320
|
+
* class myButton extends UISpriteElement {
|
|
35867
36321
|
* constructor(x, y) {
|
|
35868
36322
|
* var settings = {}
|
|
35869
36323
|
* settings.image = "button";
|
|
@@ -35894,10 +36348,8 @@ class GUI_Object extends Sprite {
|
|
|
35894
36348
|
|
|
35895
36349
|
/**
|
|
35896
36350
|
* object can be clicked or not
|
|
35897
|
-
* @public
|
|
35898
36351
|
* @type {boolean}
|
|
35899
36352
|
* @default true
|
|
35900
|
-
* @name GUI_Object#isClickable
|
|
35901
36353
|
*/
|
|
35902
36354
|
this.isClickable = true;
|
|
35903
36355
|
|
|
@@ -35905,25 +36357,20 @@ class GUI_Object extends Sprite {
|
|
|
35905
36357
|
* Tap and hold threshold timeout in ms
|
|
35906
36358
|
* @type {number}
|
|
35907
36359
|
* @default 250
|
|
35908
|
-
* @name GUI_Object#holdThreshold
|
|
35909
36360
|
*/
|
|
35910
36361
|
this.holdThreshold = 250;
|
|
35911
36362
|
|
|
35912
36363
|
/**
|
|
35913
36364
|
* object can be tap and hold
|
|
35914
|
-
* @public
|
|
35915
36365
|
* @type {boolean}
|
|
35916
36366
|
* @default false
|
|
35917
|
-
* @name GUI_Object#isHoldable
|
|
35918
36367
|
*/
|
|
35919
36368
|
this.isHoldable = false;
|
|
35920
36369
|
|
|
35921
36370
|
/**
|
|
35922
36371
|
* true if the pointer is over the object
|
|
35923
|
-
* @public
|
|
35924
36372
|
* @type {boolean}
|
|
35925
36373
|
* @default false
|
|
35926
|
-
* @name GUI_Object#hover
|
|
35927
36374
|
*/
|
|
35928
36375
|
this.hover = false;
|
|
35929
36376
|
|
|
@@ -35960,9 +36407,6 @@ class GUI_Object extends Sprite {
|
|
|
35960
36407
|
|
|
35961
36408
|
/**
|
|
35962
36409
|
* function called when the object is pressed (to be extended)
|
|
35963
|
-
* @name onClick
|
|
35964
|
-
* @memberof GUI_Object
|
|
35965
|
-
* @public
|
|
35966
36410
|
* @param {Pointer} event the event object
|
|
35967
36411
|
* @returns {boolean} return false if we need to stop propagating the event
|
|
35968
36412
|
*/
|
|
@@ -35982,9 +36426,6 @@ class GUI_Object extends Sprite {
|
|
|
35982
36426
|
|
|
35983
36427
|
/**
|
|
35984
36428
|
* function called when the pointer is over the object
|
|
35985
|
-
* @name onOver
|
|
35986
|
-
* @memberof GUI_Object
|
|
35987
|
-
* @public
|
|
35988
36429
|
* @param {Pointer} event the event object
|
|
35989
36430
|
*/
|
|
35990
36431
|
onOver(event) { // eslint-disable-line no-unused-vars
|
|
@@ -36004,9 +36445,6 @@ class GUI_Object extends Sprite {
|
|
|
36004
36445
|
|
|
36005
36446
|
/**
|
|
36006
36447
|
* function called when the pointer is leaving the object area
|
|
36007
|
-
* @name onOut
|
|
36008
|
-
* @memberof GUI_Object
|
|
36009
|
-
* @public
|
|
36010
36448
|
* @param {Pointer} event the event object
|
|
36011
36449
|
*/
|
|
36012
36450
|
onOut(event) { // eslint-disable-line no-unused-vars
|
|
@@ -36028,9 +36466,6 @@ class GUI_Object extends Sprite {
|
|
|
36028
36466
|
|
|
36029
36467
|
/**
|
|
36030
36468
|
* function called when the object is pressed and released (to be extended)
|
|
36031
|
-
* @name onRelease
|
|
36032
|
-
* @memberof GUI_Object
|
|
36033
|
-
* @public
|
|
36034
36469
|
* @returns {boolean} return false if we need to stop propagating the event
|
|
36035
36470
|
*/
|
|
36036
36471
|
onRelease() {
|
|
@@ -36052,9 +36487,6 @@ class GUI_Object extends Sprite {
|
|
|
36052
36487
|
/**
|
|
36053
36488
|
* function called when the object is pressed and held<br>
|
|
36054
36489
|
* to be extended <br>
|
|
36055
|
-
* @name onHold
|
|
36056
|
-
* @memberof GUI_Object
|
|
36057
|
-
* @public
|
|
36058
36490
|
*/
|
|
36059
36491
|
onHold() {}
|
|
36060
36492
|
|
|
@@ -36188,11 +36620,11 @@ class Trigger extends Renderable {
|
|
|
36188
36620
|
event: "level"
|
|
36189
36621
|
};
|
|
36190
36622
|
|
|
36191
|
-
[ "type", "container", "onLoaded", "flatten", "setViewportBounds", "to" ].forEach(
|
|
36623
|
+
[ "type", "container", "onLoaded", "flatten", "setViewportBounds", "to" ].forEach((property) => {
|
|
36192
36624
|
if (typeof settings[property] !== "undefined") {
|
|
36193
36625
|
this.triggerSettings[property] = settings[property];
|
|
36194
36626
|
}
|
|
36195
|
-
}
|
|
36627
|
+
});
|
|
36196
36628
|
|
|
36197
36629
|
// add and configure the physic body
|
|
36198
36630
|
var shape = settings.shapes;
|
|
@@ -36525,6 +36957,7 @@ class Draggable extends Renderable {
|
|
|
36525
36957
|
super.destroy();
|
|
36526
36958
|
}
|
|
36527
36959
|
}
|
|
36960
|
+
|
|
36528
36961
|
/**
|
|
36529
36962
|
* @classdesc
|
|
36530
36963
|
* a base drop target object
|
|
@@ -36948,6 +37381,7 @@ function createDefaultParticleTexture(w = 8, h = 8) {
|
|
|
36948
37381
|
|
|
36949
37382
|
return defaultParticleTexture;
|
|
36950
37383
|
}
|
|
37384
|
+
|
|
36951
37385
|
/**
|
|
36952
37386
|
* @classdesc
|
|
36953
37387
|
* Particle Emitter Object.
|
|
@@ -37635,6 +38069,7 @@ function warning(deprecated, replacement, version) {
|
|
|
37635
38069
|
console.groupEnd();
|
|
37636
38070
|
}
|
|
37637
38071
|
}
|
|
38072
|
+
|
|
37638
38073
|
/**
|
|
37639
38074
|
* Alias of {@link TextureAtlas}
|
|
37640
38075
|
* @public
|
|
@@ -37719,6 +38154,25 @@ Renderer.prototype.getScreenContext = function() {
|
|
|
37719
38154
|
return this.getContext();
|
|
37720
38155
|
};
|
|
37721
38156
|
|
|
38157
|
+
/**
|
|
38158
|
+
* @classdesc
|
|
38159
|
+
* A very basic object to manage GUI elements
|
|
38160
|
+
* @augments Sprite
|
|
38161
|
+
* @deprecated since 14.0.0
|
|
38162
|
+
* @see UISpriteElement
|
|
38163
|
+
*/
|
|
38164
|
+
class GUI_Object extends UISpriteElement {
|
|
38165
|
+
/**
|
|
38166
|
+
* @param {number} x the x coordinate of the GUI Object
|
|
38167
|
+
* @param {number} y the y coordinate of the GUI Object
|
|
38168
|
+
* @param {object} settings See {@link Sprite}
|
|
38169
|
+
*/
|
|
38170
|
+
constructor(x, y, settings) {
|
|
38171
|
+
warning("GUI_Object", "UISpriteElement", "14.0.0");
|
|
38172
|
+
super(x, y, settings);
|
|
38173
|
+
}
|
|
38174
|
+
}
|
|
38175
|
+
|
|
37722
38176
|
// ES5/ES6 polyfills
|
|
37723
38177
|
|
|
37724
38178
|
|
|
@@ -37729,7 +38183,7 @@ Renderer.prototype.getScreenContext = function() {
|
|
|
37729
38183
|
* @name version
|
|
37730
38184
|
* @type {string}
|
|
37731
38185
|
*/
|
|
37732
|
-
const version = "
|
|
38186
|
+
const version = "14.0.1";
|
|
37733
38187
|
|
|
37734
38188
|
|
|
37735
38189
|
/**
|
|
@@ -37835,11 +38289,12 @@ function boot() {
|
|
|
37835
38289
|
// mark melonJS as initialized
|
|
37836
38290
|
initialized = true;
|
|
37837
38291
|
}
|
|
38292
|
+
|
|
37838
38293
|
// call the library init function when ready
|
|
37839
|
-
onReady(
|
|
38294
|
+
onReady(() => {
|
|
37840
38295
|
{
|
|
37841
38296
|
boot();
|
|
37842
38297
|
}
|
|
37843
38298
|
});
|
|
37844
38299
|
|
|
37845
|
-
export { BitmapText, BitmapTextData, Body, Bounds, Camera2d, CanvasRenderer, Collectable, Color, ColorLayer, Container, Draggable, DraggableEntity, DropTarget, DroptargetEntity, Ellipse, Entity, GLShader, GUI_Object, ImageLayer, Light2d, Line, math as Math, Matrix2d, Matrix3d, NineSliceSprite, ObservableVector2d, ObservableVector3d, Particle, ParticleEmitter, ParticleEmitterSettings, Point, Pointer, Polygon, QuadTree, Rect, Renderable, Renderer, RoundRect, Sprite, Stage, TMXHexagonalRenderer, TMXIsometricRenderer, TMXLayer, TMXOrthogonalRenderer, TMXRenderer, TMXStaggeredRenderer, TMXTileMap, TMXTileset, TMXTilesetGroup, Text, TextureAtlas, Tile, Trigger, Tween, Vector2d, Vector3d, WebGLCompositor, WebGLRenderer, World, audio, boot, collision, device, event, game, initialized, input, level, loader, plugin, plugins, pool, save, skipAutoInit, state, timer, utils, version, video, warning };
|
|
38300
|
+
export { BitmapText, BitmapTextData, Body, Bounds, Camera2d, CanvasRenderer, Collectable, Color, ColorLayer, Container, Draggable, DraggableEntity, DropTarget, DroptargetEntity, Ellipse, Entity, GLShader, GUI_Object, ImageLayer, Light2d, Line, math as Math, Matrix2d, Matrix3d, NineSliceSprite, ObservableVector2d, ObservableVector3d, Particle, ParticleEmitter, ParticleEmitterSettings, Point, Pointer, Polygon, QuadTree, Rect, Renderable, Renderer, RoundRect, Sprite, Stage, TMXHexagonalRenderer, TMXIsometricRenderer, TMXLayer, TMXOrthogonalRenderer, TMXRenderer, TMXStaggeredRenderer, TMXTileMap, TMXTileset, TMXTilesetGroup, Text, TextureAtlas, Tile, Trigger, Tween, UIBaseElement, UISpriteElement, UITextButton, Vector2d, Vector3d, WebGLCompositor, WebGLRenderer, World, audio, boot, collision, device, event, game, initialized, input, level, loader, plugin, plugins, pool, save, skipAutoInit, state, timer, utils, version, video, warning };
|