melonjs 13.3.0 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -6
- package/dist/melonjs.module.d.ts +13108 -11652
- package/dist/melonjs.module.js +657 -181
- package/package.json +23 -23
- 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 +1 -1
- package/src/physics/detector.js +3 -3
- package/src/physics/quadtree.js +2 -2
- 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 +27 -21
- package/src/text/bitmaptextdata.js +4 -7
- package/src/text/glyph.js +1 -2
- package/src/text/text.js +2 -3
- package/src/text/textmetrics.js +5 -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 -37899
- 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.0
|
|
3
3
|
* http://www.melonjs.org
|
|
4
4
|
* melonjs is licensed under the MIT License.
|
|
5
5
|
* http://www.opensource.org/licenses/mit-license
|
|
@@ -13,7 +13,7 @@ var check = function (it) {
|
|
|
13
13
|
|
|
14
14
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
15
15
|
var global$c =
|
|
16
|
-
// eslint-disable-next-line es
|
|
16
|
+
// eslint-disable-next-line es/no-global-this -- safe
|
|
17
17
|
check(typeof globalThis == 'object' && globalThis) ||
|
|
18
18
|
check(typeof window == 'object' && window) ||
|
|
19
19
|
// eslint-disable-next-line no-restricted-globals -- safe
|
|
@@ -36,14 +36,14 @@ var fails$8 = fails$9;
|
|
|
36
36
|
|
|
37
37
|
// Detect IE8's incomplete defineProperty implementation
|
|
38
38
|
var descriptors = !fails$8(function () {
|
|
39
|
-
// eslint-disable-next-line es
|
|
39
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
40
40
|
return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
var fails$7 = fails$9;
|
|
44
44
|
|
|
45
45
|
var functionBindNative = !fails$7(function () {
|
|
46
|
-
// eslint-disable-next-line es
|
|
46
|
+
// eslint-disable-next-line es/no-function-prototype-bind -- safe
|
|
47
47
|
var test = (function () { /* empty */ }).bind();
|
|
48
48
|
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
49
49
|
return typeof test != 'function' || test.hasOwnProperty('prototype');
|
|
@@ -60,7 +60,7 @@ var functionCall = NATIVE_BIND$1 ? call$4.bind(call$4) : function () {
|
|
|
60
60
|
var objectPropertyIsEnumerable = {};
|
|
61
61
|
|
|
62
62
|
var $propertyIsEnumerable = {}.propertyIsEnumerable;
|
|
63
|
-
// eslint-disable-next-line es
|
|
63
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
64
64
|
var getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
65
65
|
|
|
66
66
|
// Nashorn ~ JDK8 bug
|
|
@@ -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 () {
|
|
@@ -147,20 +154,34 @@ var toIndexedObject$3 = function (it) {
|
|
|
147
154
|
return IndexedObject(requireObjectCoercible$2(it));
|
|
148
155
|
};
|
|
149
156
|
|
|
157
|
+
var documentAll$2 = typeof document == 'object' && document.all;
|
|
158
|
+
|
|
159
|
+
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
160
|
+
var IS_HTMLDDA = typeof documentAll$2 == 'undefined' && documentAll$2 !== undefined;
|
|
161
|
+
|
|
162
|
+
var documentAll_1 = {
|
|
163
|
+
all: documentAll$2,
|
|
164
|
+
IS_HTMLDDA: IS_HTMLDDA
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
var $documentAll$1 = documentAll_1;
|
|
168
|
+
|
|
169
|
+
var documentAll$1 = $documentAll$1.all;
|
|
170
|
+
|
|
150
171
|
// `IsCallable` abstract operation
|
|
151
172
|
// https://tc39.es/ecma262/#sec-iscallable
|
|
152
|
-
var isCallable$b = function (argument) {
|
|
173
|
+
var isCallable$b = $documentAll$1.IS_HTMLDDA ? function (argument) {
|
|
174
|
+
return typeof argument == 'function' || argument === documentAll$1;
|
|
175
|
+
} : function (argument) {
|
|
153
176
|
return typeof argument == 'function';
|
|
154
177
|
};
|
|
155
178
|
|
|
156
179
|
var isCallable$a = isCallable$b;
|
|
180
|
+
var $documentAll = documentAll_1;
|
|
157
181
|
|
|
158
|
-
var documentAll =
|
|
159
|
-
|
|
160
|
-
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
|
161
|
-
var SPECIAL_DOCUMENT_ALL = typeof documentAll == 'undefined' && documentAll !== undefined;
|
|
182
|
+
var documentAll = $documentAll.all;
|
|
162
183
|
|
|
163
|
-
var isObject$5 =
|
|
184
|
+
var isObject$5 = $documentAll.IS_HTMLDDA ? function (it) {
|
|
164
185
|
return typeof it == 'object' ? it !== null : isCallable$a(it) || it === documentAll;
|
|
165
186
|
} : function (it) {
|
|
166
187
|
return typeof it == 'object' ? it !== null : isCallable$a(it);
|
|
@@ -177,9 +198,9 @@ var getBuiltIn$3 = function (namespace, method) {
|
|
|
177
198
|
return arguments.length < 2 ? aFunction(global$b[namespace]) : global$b[namespace] && global$b[namespace][method];
|
|
178
199
|
};
|
|
179
200
|
|
|
180
|
-
var uncurryThis$
|
|
201
|
+
var uncurryThis$7 = functionUncurryThis;
|
|
181
202
|
|
|
182
|
-
var objectIsPrototypeOf = uncurryThis$
|
|
203
|
+
var objectIsPrototypeOf = uncurryThis$7({}.isPrototypeOf);
|
|
183
204
|
|
|
184
205
|
var getBuiltIn$2 = getBuiltIn$3;
|
|
185
206
|
|
|
@@ -213,12 +234,12 @@ if (!version$1 && userAgent) {
|
|
|
213
234
|
|
|
214
235
|
var engineV8Version = version$1;
|
|
215
236
|
|
|
216
|
-
/* eslint-disable es
|
|
237
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
217
238
|
|
|
218
239
|
var V8_VERSION = engineV8Version;
|
|
219
240
|
var fails$5 = fails$9;
|
|
220
241
|
|
|
221
|
-
// eslint-disable-next-line es
|
|
242
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing
|
|
222
243
|
var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$5(function () {
|
|
223
244
|
var symbol = Symbol();
|
|
224
245
|
// Chrome 38 Symbol has incorrect toString conversion
|
|
@@ -228,7 +249,7 @@ var symbolConstructorDetection = !!Object.getOwnPropertySymbols && !fails$5(func
|
|
|
228
249
|
!Symbol.sham && V8_VERSION && V8_VERSION < 41;
|
|
229
250
|
});
|
|
230
251
|
|
|
231
|
-
/* eslint-disable es
|
|
252
|
+
/* eslint-disable es/no-symbol -- required for testing */
|
|
232
253
|
|
|
233
254
|
var NATIVE_SYMBOL$1 = symbolConstructorDetection;
|
|
234
255
|
|
|
@@ -301,7 +322,7 @@ var shared$3 = {exports: {}};
|
|
|
301
322
|
|
|
302
323
|
var global$9 = global$c;
|
|
303
324
|
|
|
304
|
-
// eslint-disable-next-line es
|
|
325
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
305
326
|
var defineProperty$1 = Object.defineProperty;
|
|
306
327
|
|
|
307
328
|
var defineGlobalProperty$3 = function (key, value) {
|
|
@@ -325,10 +346,10 @@ var store$2 = sharedStore;
|
|
|
325
346
|
(shared$3.exports = function (key, value) {
|
|
326
347
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
327
348
|
})('versions', []).push({
|
|
328
|
-
version: '3.25.
|
|
349
|
+
version: '3.25.5',
|
|
329
350
|
mode: 'global',
|
|
330
351
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
331
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.25.
|
|
352
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.25.5/LICENSE',
|
|
332
353
|
source: 'https://github.com/zloirock/core-js'
|
|
333
354
|
});
|
|
334
355
|
|
|
@@ -342,23 +363,23 @@ var toObject$1 = function (argument) {
|
|
|
342
363
|
return $Object$1(requireObjectCoercible$1(argument));
|
|
343
364
|
};
|
|
344
365
|
|
|
345
|
-
var uncurryThis$
|
|
366
|
+
var uncurryThis$6 = functionUncurryThis;
|
|
346
367
|
var toObject = toObject$1;
|
|
347
368
|
|
|
348
|
-
var hasOwnProperty = uncurryThis$
|
|
369
|
+
var hasOwnProperty = uncurryThis$6({}.hasOwnProperty);
|
|
349
370
|
|
|
350
371
|
// `HasOwnProperty` abstract operation
|
|
351
372
|
// https://tc39.es/ecma262/#sec-hasownproperty
|
|
352
|
-
// eslint-disable-next-line es
|
|
373
|
+
// eslint-disable-next-line es/no-object-hasown -- safe
|
|
353
374
|
var hasOwnProperty_1 = Object.hasOwn || function hasOwn(it, key) {
|
|
354
375
|
return hasOwnProperty(toObject(it), key);
|
|
355
376
|
};
|
|
356
377
|
|
|
357
|
-
var uncurryThis$
|
|
378
|
+
var uncurryThis$5 = functionUncurryThis;
|
|
358
379
|
|
|
359
380
|
var id = 0;
|
|
360
381
|
var postfix = Math.random();
|
|
361
|
-
var toString$3 = uncurryThis$
|
|
382
|
+
var toString$3 = uncurryThis$5(1.0.toString);
|
|
362
383
|
|
|
363
384
|
var uid$2 = function (key) {
|
|
364
385
|
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$3(++id + postfix, 36);
|
|
@@ -442,7 +463,7 @@ var createElement = documentCreateElement;
|
|
|
442
463
|
|
|
443
464
|
// Thanks to IE8 for its funny defineProperty
|
|
444
465
|
var ie8DomDefine = !DESCRIPTORS$6 && !fails$4(function () {
|
|
445
|
-
// eslint-disable-next-line es
|
|
466
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
446
467
|
return Object.defineProperty(createElement('div'), 'a', {
|
|
447
468
|
get: function () { return 7; }
|
|
448
469
|
}).a != 7;
|
|
@@ -457,7 +478,7 @@ var toPropertyKey$1 = toPropertyKey$2;
|
|
|
457
478
|
var hasOwn$5 = hasOwnProperty_1;
|
|
458
479
|
var IE8_DOM_DEFINE$1 = ie8DomDefine;
|
|
459
480
|
|
|
460
|
-
// eslint-disable-next-line es
|
|
481
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
461
482
|
var $getOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
|
462
483
|
|
|
463
484
|
// `Object.getOwnPropertyDescriptor` method
|
|
@@ -479,7 +500,7 @@ var fails$3 = fails$9;
|
|
|
479
500
|
// V8 ~ Chrome 36-
|
|
480
501
|
// https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
481
502
|
var v8PrototypeDefineBug = DESCRIPTORS$4 && fails$3(function () {
|
|
482
|
-
// eslint-disable-next-line es
|
|
503
|
+
// eslint-disable-next-line es/no-object-defineproperty -- required for testing
|
|
483
504
|
return Object.defineProperty(function () { /* empty */ }, 'prototype', {
|
|
484
505
|
value: 42,
|
|
485
506
|
writable: false
|
|
@@ -504,9 +525,9 @@ var anObject$1 = anObject$2;
|
|
|
504
525
|
var toPropertyKey = toPropertyKey$2;
|
|
505
526
|
|
|
506
527
|
var $TypeError = TypeError;
|
|
507
|
-
// eslint-disable-next-line es
|
|
528
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
508
529
|
var $defineProperty = Object.defineProperty;
|
|
509
|
-
// eslint-disable-next-line es
|
|
530
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
510
531
|
var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
511
532
|
var ENUMERABLE = 'enumerable';
|
|
512
533
|
var CONFIGURABLE$1 = 'configurable';
|
|
@@ -558,7 +579,7 @@ var DESCRIPTORS$1 = descriptors;
|
|
|
558
579
|
var hasOwn$4 = hasOwnProperty_1;
|
|
559
580
|
|
|
560
581
|
var FunctionPrototype = Function.prototype;
|
|
561
|
-
// eslint-disable-next-line es
|
|
582
|
+
// eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
|
|
562
583
|
var getDescriptor = DESCRIPTORS$1 && Object.getOwnPropertyDescriptor;
|
|
563
584
|
|
|
564
585
|
var EXISTS = hasOwn$4(FunctionPrototype, 'name');
|
|
@@ -572,11 +593,11 @@ var functionName = {
|
|
|
572
593
|
CONFIGURABLE: CONFIGURABLE
|
|
573
594
|
};
|
|
574
595
|
|
|
575
|
-
var uncurryThis$
|
|
596
|
+
var uncurryThis$4 = functionUncurryThis;
|
|
576
597
|
var isCallable$5 = isCallable$b;
|
|
577
598
|
var store$1 = sharedStore;
|
|
578
599
|
|
|
579
|
-
var functionToString = uncurryThis$
|
|
600
|
+
var functionToString = uncurryThis$4(Function.toString);
|
|
580
601
|
|
|
581
602
|
// this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper
|
|
582
603
|
if (!isCallable$5(store$1.inspectSource)) {
|
|
@@ -607,7 +628,6 @@ var hiddenKeys$3 = {};
|
|
|
607
628
|
|
|
608
629
|
var NATIVE_WEAK_MAP = weakMapBasicDetection;
|
|
609
630
|
var global$4 = global$c;
|
|
610
|
-
var uncurryThis$4 = functionUncurryThis;
|
|
611
631
|
var isObject = isObject$5;
|
|
612
632
|
var createNonEnumerableProperty$1 = createNonEnumerableProperty$2;
|
|
613
633
|
var hasOwn$3 = hasOwnProperty_1;
|
|
@@ -635,20 +655,22 @@ var getterFor = function (TYPE) {
|
|
|
635
655
|
|
|
636
656
|
if (NATIVE_WEAK_MAP || shared.state) {
|
|
637
657
|
var store = shared.state || (shared.state = new WeakMap());
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
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 */
|
|
641
663
|
set = function (it, metadata) {
|
|
642
|
-
if (
|
|
664
|
+
if (store.has(it)) throw TypeError$1(OBJECT_ALREADY_INITIALIZED);
|
|
643
665
|
metadata.facade = it;
|
|
644
|
-
|
|
666
|
+
store.set(it, metadata);
|
|
645
667
|
return metadata;
|
|
646
668
|
};
|
|
647
669
|
get = function (it) {
|
|
648
|
-
return
|
|
670
|
+
return store.get(it) || {};
|
|
649
671
|
};
|
|
650
672
|
has = function (it) {
|
|
651
|
-
return
|
|
673
|
+
return store.has(it);
|
|
652
674
|
};
|
|
653
675
|
} else {
|
|
654
676
|
var STATE = sharedKey('state');
|
|
@@ -685,7 +707,7 @@ var InternalStateModule = internalState;
|
|
|
685
707
|
|
|
686
708
|
var enforceInternalState = InternalStateModule.enforce;
|
|
687
709
|
var getInternalState = InternalStateModule.get;
|
|
688
|
-
// eslint-disable-next-line es
|
|
710
|
+
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
689
711
|
var defineProperty = Object.defineProperty;
|
|
690
712
|
|
|
691
713
|
var CONFIGURABLE_LENGTH = DESCRIPTORS && !fails$2(function () {
|
|
@@ -760,7 +782,7 @@ var floor = Math.floor;
|
|
|
760
782
|
|
|
761
783
|
// `Math.trunc` method
|
|
762
784
|
// https://tc39.es/ecma262/#sec-math.trunc
|
|
763
|
-
// eslint-disable-next-line es
|
|
785
|
+
// eslint-disable-next-line es/no-math-trunc -- safe
|
|
764
786
|
var mathTrunc = Math.trunc || function trunc(x) {
|
|
765
787
|
var n = +x;
|
|
766
788
|
return (n > 0 ? floor : ceil)(n);
|
|
@@ -879,14 +901,14 @@ var hiddenKeys = enumBugKeys.concat('length', 'prototype');
|
|
|
879
901
|
|
|
880
902
|
// `Object.getOwnPropertyNames` method
|
|
881
903
|
// https://tc39.es/ecma262/#sec-object.getownpropertynames
|
|
882
|
-
// eslint-disable-next-line es
|
|
904
|
+
// eslint-disable-next-line es/no-object-getownpropertynames -- safe
|
|
883
905
|
objectGetOwnPropertyNames.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
|
884
906
|
return internalObjectKeys(O, hiddenKeys);
|
|
885
907
|
};
|
|
886
908
|
|
|
887
909
|
var objectGetOwnPropertySymbols = {};
|
|
888
910
|
|
|
889
|
-
// eslint-disable-next-line es
|
|
911
|
+
// eslint-disable-next-line es/no-object-getownpropertysymbols -- safe
|
|
890
912
|
objectGetOwnPropertySymbols.f = Object.getOwnPropertySymbols;
|
|
891
913
|
|
|
892
914
|
var getBuiltIn = getBuiltIn$3;
|
|
@@ -1004,7 +1026,7 @@ var global$2 = global$c;
|
|
|
1004
1026
|
|
|
1005
1027
|
// `globalThis` object
|
|
1006
1028
|
// https://tc39.es/ecma262/#sec-globalthis
|
|
1007
|
-
$$4({ global: true }, {
|
|
1029
|
+
$$4({ global: true, forced: global$2.globalThis !== global$2 }, {
|
|
1008
1030
|
globalThis: global$2
|
|
1009
1031
|
});
|
|
1010
1032
|
|
|
@@ -1019,7 +1041,7 @@ var toStringTagSupport = String(test) === '[object z]';
|
|
|
1019
1041
|
|
|
1020
1042
|
var TO_STRING_TAG_SUPPORT = toStringTagSupport;
|
|
1021
1043
|
var isCallable = isCallable$b;
|
|
1022
|
-
var classofRaw = classofRaw$
|
|
1044
|
+
var classofRaw = classofRaw$2;
|
|
1023
1045
|
var wellKnownSymbol = wellKnownSymbol$3;
|
|
1024
1046
|
|
|
1025
1047
|
var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
|
@@ -1116,7 +1138,7 @@ var forcedStringTrimMethod$1 = stringTrimForced;
|
|
|
1116
1138
|
// https://tc39.es/ecma262/#String.prototype.trimleft
|
|
1117
1139
|
var stringTrimStart = forcedStringTrimMethod$1('trimStart') ? function trimStart() {
|
|
1118
1140
|
return $trimStart(this);
|
|
1119
|
-
// eslint-disable-next-line es
|
|
1141
|
+
// eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
|
|
1120
1142
|
} : ''.trimStart;
|
|
1121
1143
|
|
|
1122
1144
|
var $$3 = _export;
|
|
@@ -1124,7 +1146,7 @@ var trimStart$1 = stringTrimStart;
|
|
|
1124
1146
|
|
|
1125
1147
|
// `String.prototype.trimLeft` method
|
|
1126
1148
|
// https://tc39.es/ecma262/#sec-string.prototype.trimleft
|
|
1127
|
-
// eslint-disable-next-line es
|
|
1149
|
+
// eslint-disable-next-line es/no-string-prototype-trimleft-trimright -- safe
|
|
1128
1150
|
$$3({ target: 'String', proto: true, name: 'trimStart', forced: ''.trimLeft !== trimStart$1 }, {
|
|
1129
1151
|
trimLeft: trimStart$1
|
|
1130
1152
|
});
|
|
@@ -1136,7 +1158,7 @@ var trimStart = stringTrimStart;
|
|
|
1136
1158
|
|
|
1137
1159
|
// `String.prototype.trimStart` method
|
|
1138
1160
|
// https://tc39.es/ecma262/#sec-string.prototype.trimstart
|
|
1139
|
-
// eslint-disable-next-line es
|
|
1161
|
+
// eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
|
|
1140
1162
|
$$2({ target: 'String', proto: true, name: 'trimStart', forced: ''.trimStart !== trimStart }, {
|
|
1141
1163
|
trimStart: trimStart
|
|
1142
1164
|
});
|
|
@@ -1160,7 +1182,7 @@ var forcedStringTrimMethod = stringTrimForced;
|
|
|
1160
1182
|
// https://tc39.es/ecma262/#String.prototype.trimright
|
|
1161
1183
|
var stringTrimEnd = forcedStringTrimMethod('trimEnd') ? function trimEnd() {
|
|
1162
1184
|
return $trimEnd(this);
|
|
1163
|
-
// eslint-disable-next-line es
|
|
1185
|
+
// eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
|
|
1164
1186
|
} : ''.trimEnd;
|
|
1165
1187
|
|
|
1166
1188
|
var $$1 = _export;
|
|
@@ -1168,7 +1190,7 @@ var trimEnd$1 = stringTrimEnd;
|
|
|
1168
1190
|
|
|
1169
1191
|
// `String.prototype.trimRight` method
|
|
1170
1192
|
// https://tc39.es/ecma262/#sec-string.prototype.trimend
|
|
1171
|
-
// eslint-disable-next-line es
|
|
1193
|
+
// eslint-disable-next-line es/no-string-prototype-trimleft-trimright -- safe
|
|
1172
1194
|
$$1({ target: 'String', proto: true, name: 'trimEnd', forced: ''.trimRight !== trimEnd$1 }, {
|
|
1173
1195
|
trimRight: trimEnd$1
|
|
1174
1196
|
});
|
|
@@ -1180,7 +1202,7 @@ var trimEnd = stringTrimEnd;
|
|
|
1180
1202
|
|
|
1181
1203
|
// `String.prototype.trimEnd` method
|
|
1182
1204
|
// https://tc39.es/ecma262/#sec-string.prototype.trimend
|
|
1183
|
-
// eslint-disable-next-line es
|
|
1205
|
+
// eslint-disable-next-line es/no-string-prototype-trimstart-trimend -- safe
|
|
1184
1206
|
$({ target: 'String', proto: true, name: 'trimEnd', forced: ''.trimEnd !== trimEnd }, {
|
|
1185
1207
|
trimEnd: trimEnd
|
|
1186
1208
|
});
|
|
@@ -1211,7 +1233,7 @@ Date.now = (Date.now || function () { // thanks IE8
|
|
|
1211
1233
|
|
|
1212
1234
|
if ("now" in globalThis.performance === false) {
|
|
1213
1235
|
|
|
1214
|
-
|
|
1236
|
+
let nowOffset = Date.now();
|
|
1215
1237
|
|
|
1216
1238
|
if (performance.timing && performance.timing.navigationStart) {
|
|
1217
1239
|
nowOffset = performance.timing.navigationStart;
|
|
@@ -1238,6 +1260,7 @@ if ("now" in globalThis.performance === false) {
|
|
|
1238
1260
|
function capitalize(str) {
|
|
1239
1261
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
1240
1262
|
}
|
|
1263
|
+
|
|
1241
1264
|
/**
|
|
1242
1265
|
* returns true if the given string contains a numeric integer or float value
|
|
1243
1266
|
* @public
|
|
@@ -1252,6 +1275,7 @@ function isNumeric(str) {
|
|
|
1252
1275
|
}
|
|
1253
1276
|
return !isNaN(str) && /[+-]?([0-9]*[.])?[0-9]+/.test(str);
|
|
1254
1277
|
}
|
|
1278
|
+
|
|
1255
1279
|
/**
|
|
1256
1280
|
* returns true if the given string contains a true or false
|
|
1257
1281
|
* @public
|
|
@@ -1264,6 +1288,7 @@ function isBoolean(str) {
|
|
|
1264
1288
|
var trimmed = str.trim();
|
|
1265
1289
|
return (trimmed === "true") || (trimmed === "false");
|
|
1266
1290
|
}
|
|
1291
|
+
|
|
1267
1292
|
/**
|
|
1268
1293
|
* convert a string to the corresponding hexadecimal value
|
|
1269
1294
|
* @public
|
|
@@ -1279,6 +1304,7 @@ function toHex$1(str) {
|
|
|
1279
1304
|
}
|
|
1280
1305
|
return res;
|
|
1281
1306
|
}
|
|
1307
|
+
|
|
1282
1308
|
/**
|
|
1283
1309
|
* returns true if the given string is a data url in the `data:[<mediatype>][;base64],<data>` format.
|
|
1284
1310
|
* (this will not test the validity of the Data or Base64 encoding)
|
|
@@ -1330,12 +1356,13 @@ function prefixed(name, obj) {
|
|
|
1330
1356
|
var uc_name = capitalize(name);
|
|
1331
1357
|
|
|
1332
1358
|
var result;
|
|
1333
|
-
vendors$1.some(
|
|
1359
|
+
vendors$1.some((vendor) => {
|
|
1334
1360
|
var name = vendor + uc_name;
|
|
1335
1361
|
return (result = (name in obj) ? obj[name] : undefined);
|
|
1336
1362
|
});
|
|
1337
1363
|
return result;
|
|
1338
1364
|
}
|
|
1365
|
+
|
|
1339
1366
|
/**
|
|
1340
1367
|
* Set a vendor-prefixed property
|
|
1341
1368
|
* @public
|
|
@@ -1355,7 +1382,7 @@ function setPrefixed(name, value, obj) {
|
|
|
1355
1382
|
|
|
1356
1383
|
var uc_name = capitalize(name);
|
|
1357
1384
|
|
|
1358
|
-
vendors$1.some(
|
|
1385
|
+
vendors$1.some((vendor) => {
|
|
1359
1386
|
var name = vendor + uc_name;
|
|
1360
1387
|
if (name in obj) {
|
|
1361
1388
|
obj[name] = value;
|
|
@@ -1433,6 +1460,7 @@ const EPSILON = 0.000001;
|
|
|
1433
1460
|
function isPowerOfTwo(val) {
|
|
1434
1461
|
return (val & (val - 1)) === 0;
|
|
1435
1462
|
}
|
|
1463
|
+
|
|
1436
1464
|
/**
|
|
1437
1465
|
* returns the next power of two for the given value
|
|
1438
1466
|
* @public
|
|
@@ -1451,6 +1479,7 @@ function nextPowerOfTwo(val) {
|
|
|
1451
1479
|
val ++;
|
|
1452
1480
|
return val;
|
|
1453
1481
|
}
|
|
1482
|
+
|
|
1454
1483
|
/**
|
|
1455
1484
|
* Converts an angle in degrees to an angle in radians
|
|
1456
1485
|
* @public
|
|
@@ -1465,6 +1494,7 @@ function nextPowerOfTwo(val) {
|
|
|
1465
1494
|
function degToRad(angle) {
|
|
1466
1495
|
return angle * DEG_TO_RAD;
|
|
1467
1496
|
}
|
|
1497
|
+
|
|
1468
1498
|
/**
|
|
1469
1499
|
* Converts an angle in radians to an angle in degrees.
|
|
1470
1500
|
* @public
|
|
@@ -1479,6 +1509,7 @@ function degToRad(angle) {
|
|
|
1479
1509
|
function radToDeg(radians) {
|
|
1480
1510
|
return radians * RAD_TO_DEG;
|
|
1481
1511
|
}
|
|
1512
|
+
|
|
1482
1513
|
/**
|
|
1483
1514
|
* clamp the given value
|
|
1484
1515
|
* @public
|
|
@@ -1492,6 +1523,7 @@ function radToDeg(radians) {
|
|
|
1492
1523
|
function clamp(val, low, high) {
|
|
1493
1524
|
return val < low ? low : val > high ? high : +val;
|
|
1494
1525
|
}
|
|
1526
|
+
|
|
1495
1527
|
/**
|
|
1496
1528
|
* return a random integer between min (included) and max (excluded)
|
|
1497
1529
|
* @public
|
|
@@ -1507,6 +1539,7 @@ function clamp(val, low, high) {
|
|
|
1507
1539
|
function random$1(min, max) {
|
|
1508
1540
|
return (~~(Math.random() * (max - min)) + min);
|
|
1509
1541
|
}
|
|
1542
|
+
|
|
1510
1543
|
/**
|
|
1511
1544
|
* return a random float between min, max (exclusive)
|
|
1512
1545
|
* @public
|
|
@@ -1522,6 +1555,7 @@ function random$1(min, max) {
|
|
|
1522
1555
|
function randomFloat(min, max) {
|
|
1523
1556
|
return (Math.random() * (max - min)) + min;
|
|
1524
1557
|
}
|
|
1558
|
+
|
|
1525
1559
|
/**
|
|
1526
1560
|
* return a weighted random between min, max (exclusive)
|
|
1527
1561
|
* @public
|
|
@@ -1537,6 +1571,7 @@ function randomFloat(min, max) {
|
|
|
1537
1571
|
function weightedRandom$1(min, max) {
|
|
1538
1572
|
return (~~(Math.pow(Math.random(), 2) * (max - min)) + min);
|
|
1539
1573
|
}
|
|
1574
|
+
|
|
1540
1575
|
/**
|
|
1541
1576
|
* round a value to the specified number of digit
|
|
1542
1577
|
* @public
|
|
@@ -1554,6 +1589,7 @@ function round(num, dec = 0) {
|
|
|
1554
1589
|
var powres = Math.pow(10, dec);
|
|
1555
1590
|
return (~~(0.5 + num * powres) / powres);
|
|
1556
1591
|
}
|
|
1592
|
+
|
|
1557
1593
|
/**
|
|
1558
1594
|
* check if the given value is close to the expected one
|
|
1559
1595
|
* @public
|
|
@@ -1616,6 +1652,7 @@ function remove(arr, obj) {
|
|
|
1616
1652
|
}
|
|
1617
1653
|
return arr;
|
|
1618
1654
|
}
|
|
1655
|
+
|
|
1619
1656
|
/**
|
|
1620
1657
|
* return a random array element
|
|
1621
1658
|
* @public
|
|
@@ -1631,6 +1668,7 @@ function remove(arr, obj) {
|
|
|
1631
1668
|
function random(arr) {
|
|
1632
1669
|
return arr[random$1(0, arr.length)];
|
|
1633
1670
|
}
|
|
1671
|
+
|
|
1634
1672
|
/**
|
|
1635
1673
|
* return a weighted random array element, favoring the earlier entries
|
|
1636
1674
|
* @public
|
|
@@ -1671,6 +1709,7 @@ const REMOVE_EXT = /\.[^\.]*$/;
|
|
|
1671
1709
|
function getBasename(path) {
|
|
1672
1710
|
return path.replace(REMOVE_PATH, "").replace(REMOVE_EXT, "");
|
|
1673
1711
|
}
|
|
1712
|
+
|
|
1674
1713
|
/**
|
|
1675
1714
|
* return the extension of the file in the given path
|
|
1676
1715
|
* @public
|
|
@@ -1712,6 +1751,7 @@ var fileUtils = /*#__PURE__*/Object.freeze({
|
|
|
1712
1751
|
function defer(func, thisArg, ...args) {
|
|
1713
1752
|
return setTimeout(func.bind(thisArg), 0.01, ...args);
|
|
1714
1753
|
}
|
|
1754
|
+
|
|
1715
1755
|
/**
|
|
1716
1756
|
* returns a function that, when invoked will only be triggered at most
|
|
1717
1757
|
* once during a given window of time
|
|
@@ -1737,7 +1777,7 @@ function throttle(fn, delay, no_trailing) {
|
|
|
1737
1777
|
if (no_trailing === false) {
|
|
1738
1778
|
// hold on to it
|
|
1739
1779
|
clearTimeout(deferTimer);
|
|
1740
|
-
deferTimer = setTimeout(
|
|
1780
|
+
deferTimer = setTimeout(() => {
|
|
1741
1781
|
last = now;
|
|
1742
1782
|
return fn.apply(null, args);
|
|
1743
1783
|
}, elasped);
|
|
@@ -1907,7 +1947,7 @@ class ObjectPool {
|
|
|
1907
1947
|
*/
|
|
1908
1948
|
exists(name) {
|
|
1909
1949
|
return name in this.objectClass;
|
|
1910
|
-
}
|
|
1950
|
+
}
|
|
1911
1951
|
|
|
1912
1952
|
/**
|
|
1913
1953
|
* Check if an object is poolable
|
|
@@ -2459,6 +2499,7 @@ class Vector2d {
|
|
|
2459
2499
|
function toHex(component) {
|
|
2460
2500
|
return "0123456789ABCDEF".charAt((component - (component % 16)) >> 4) + "0123456789ABCDEF".charAt(component % 16);
|
|
2461
2501
|
}
|
|
2502
|
+
|
|
2462
2503
|
function hue2rgb(p, q, t) {
|
|
2463
2504
|
if (t < 0) t += 1;
|
|
2464
2505
|
if (t > 1) t -= 1;
|
|
@@ -2627,7 +2668,7 @@ var cssToRGB = new Map();
|
|
|
2627
2668
|
[ "wheat", [ 245, 222, 179 ] ],
|
|
2628
2669
|
[ "whitesmoke", [ 245, 245, 245 ] ],
|
|
2629
2670
|
[ "yellowgreen", [ 154, 205, 50 ] ]
|
|
2630
|
-
].forEach(
|
|
2671
|
+
].forEach((value) => {
|
|
2631
2672
|
cssToRGB.set(value[0], value[1]);
|
|
2632
2673
|
});
|
|
2633
2674
|
|
|
@@ -5041,6 +5082,7 @@ const ONCONTEXT_RESTORED = "renderer.contextrestored";
|
|
|
5041
5082
|
function emit(eventName, ...args) {
|
|
5042
5083
|
return eventEmitter.emit(eventName, ...args);
|
|
5043
5084
|
}
|
|
5085
|
+
|
|
5044
5086
|
/**
|
|
5045
5087
|
* Add a listener for a given event.
|
|
5046
5088
|
* @function event.on
|
|
@@ -5055,6 +5097,7 @@ function emit(eventName, ...args) {
|
|
|
5055
5097
|
function on(eventName, listener, context) {
|
|
5056
5098
|
return eventEmitter.on(eventName, listener, context);
|
|
5057
5099
|
}
|
|
5100
|
+
|
|
5058
5101
|
/**
|
|
5059
5102
|
* Add a one-time listener for a given event.
|
|
5060
5103
|
* @function event.once
|
|
@@ -5069,6 +5112,7 @@ function on(eventName, listener, context) {
|
|
|
5069
5112
|
function once(eventName, listener, context) {
|
|
5070
5113
|
return eventEmitter.once(eventName, listener, context);
|
|
5071
5114
|
}
|
|
5115
|
+
|
|
5072
5116
|
/**
|
|
5073
5117
|
* remove the given listener for a given event.
|
|
5074
5118
|
* @function event.off
|
|
@@ -5187,7 +5231,7 @@ on(BOOT, () => {
|
|
|
5187
5231
|
|
|
5188
5232
|
if (typeof me_save_content === "string" && me_save_content.length > 0) {
|
|
5189
5233
|
var keys = JSON.parse(me_save_content) || [];
|
|
5190
|
-
keys.forEach(
|
|
5234
|
+
keys.forEach((key) => {
|
|
5191
5235
|
data[key] = JSON.parse(globalThis.localStorage.getItem("me.save." + key));
|
|
5192
5236
|
});
|
|
5193
5237
|
}
|
|
@@ -5210,7 +5254,7 @@ var save = {
|
|
|
5210
5254
|
add(props) {
|
|
5211
5255
|
var obj = save;
|
|
5212
5256
|
|
|
5213
|
-
Object.keys(props).forEach(
|
|
5257
|
+
Object.keys(props).forEach((key) => {
|
|
5214
5258
|
if (isReserved(key)) {
|
|
5215
5259
|
return;
|
|
5216
5260
|
}
|
|
@@ -5308,6 +5352,7 @@ function _domReady() {
|
|
|
5308
5352
|
isDOMReady = true;
|
|
5309
5353
|
}
|
|
5310
5354
|
}
|
|
5355
|
+
|
|
5311
5356
|
// https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded_event
|
|
5312
5357
|
function DOMContentLoaded(fn) {
|
|
5313
5358
|
// If the DOM is already ready
|
|
@@ -5407,6 +5452,7 @@ function disableSwipeFn(e) {
|
|
|
5407
5452
|
}
|
|
5408
5453
|
return false;
|
|
5409
5454
|
}
|
|
5455
|
+
|
|
5410
5456
|
function hasLocalStorage() {
|
|
5411
5457
|
try {
|
|
5412
5458
|
return !!globalThis.localStorage;
|
|
@@ -5435,6 +5481,7 @@ function onDeviceMotion(e) {
|
|
|
5435
5481
|
accelerationY = e.accelerationIncludingGravity.y;
|
|
5436
5482
|
accelerationZ = e.accelerationIncludingGravity.z;
|
|
5437
5483
|
}
|
|
5484
|
+
|
|
5438
5485
|
/**
|
|
5439
5486
|
* used by [un]watchDeviceOrientation()
|
|
5440
5487
|
*/
|
|
@@ -5443,6 +5490,7 @@ function onDeviceRotate(e) {
|
|
|
5443
5490
|
beta = e.beta;
|
|
5444
5491
|
alpha = e.alpha;
|
|
5445
5492
|
}
|
|
5493
|
+
|
|
5446
5494
|
/**
|
|
5447
5495
|
* the device platform type
|
|
5448
5496
|
* @name platform
|
|
@@ -5813,6 +5861,7 @@ let stopOnBlur = false;
|
|
|
5813
5861
|
function onReady(fn) {
|
|
5814
5862
|
DOMContentLoaded(fn);
|
|
5815
5863
|
}
|
|
5864
|
+
|
|
5816
5865
|
/**
|
|
5817
5866
|
* enable/disable swipe on WebView.
|
|
5818
5867
|
* @function enableSwipe
|
|
@@ -5832,6 +5881,7 @@ function enableSwipe(enable) {
|
|
|
5832
5881
|
swipeEnabled = false;
|
|
5833
5882
|
}
|
|
5834
5883
|
}
|
|
5884
|
+
|
|
5835
5885
|
/**
|
|
5836
5886
|
* Returns true if the browser/device is in full screen mode.
|
|
5837
5887
|
* @function isFullscreen
|
|
@@ -5846,6 +5896,7 @@ function isFullscreen() {
|
|
|
5846
5896
|
return false;
|
|
5847
5897
|
}
|
|
5848
5898
|
}
|
|
5899
|
+
|
|
5849
5900
|
/**
|
|
5850
5901
|
* Triggers a fullscreen request. Requires fullscreen support from the browser/device.
|
|
5851
5902
|
* @function requestFullscreen
|
|
@@ -5871,6 +5922,7 @@ function requestFullscreen(element) {
|
|
|
5871
5922
|
element.requestFullscreen();
|
|
5872
5923
|
}
|
|
5873
5924
|
}
|
|
5925
|
+
|
|
5874
5926
|
/**
|
|
5875
5927
|
* Exit fullscreen mode. Requires fullscreen support from the browser/device.
|
|
5876
5928
|
* @function exitFullscreen
|
|
@@ -5882,6 +5934,7 @@ function exitFullscreen() {
|
|
|
5882
5934
|
document.exitFullscreen();
|
|
5883
5935
|
}
|
|
5884
5936
|
}
|
|
5937
|
+
|
|
5885
5938
|
/**
|
|
5886
5939
|
* Return a string representing the orientation of the device screen.
|
|
5887
5940
|
* It can be "any", "natural", "landscape", "portrait", "portrait-primary", "portrait-secondary", "landscape-primary", "landscape-secondary"
|
|
@@ -5917,6 +5970,7 @@ function getScreenOrientation() {
|
|
|
5917
5970
|
// fallback to window size check
|
|
5918
5971
|
return (globalThis.outerWidth > globalThis.outerHeight) ? LANDSCAPE : PORTRAIT;
|
|
5919
5972
|
}
|
|
5973
|
+
|
|
5920
5974
|
/**
|
|
5921
5975
|
* locks the device screen into the specified orientation.<br>
|
|
5922
5976
|
* This method only works for installed Web apps or for Web pages in full-screen mode.
|
|
@@ -5937,6 +5991,7 @@ function lockOrientation(orientation) {
|
|
|
5937
5991
|
}
|
|
5938
5992
|
return false;
|
|
5939
5993
|
}
|
|
5994
|
+
|
|
5940
5995
|
/**
|
|
5941
5996
|
* unlocks the device screen into the specified orientation.<br>
|
|
5942
5997
|
* This method only works for installed Web apps or for Web pages in full-screen mode.
|
|
@@ -5956,6 +6011,7 @@ function unlockOrientation() {
|
|
|
5956
6011
|
}
|
|
5957
6012
|
return false;
|
|
5958
6013
|
}
|
|
6014
|
+
|
|
5959
6015
|
/**
|
|
5960
6016
|
* return true if the device screen orientation is in Portrait mode
|
|
5961
6017
|
* @function isPortrait
|
|
@@ -5966,6 +6022,7 @@ function unlockOrientation() {
|
|
|
5966
6022
|
function isPortrait() {
|
|
5967
6023
|
return getScreenOrientation().includes("portrait");
|
|
5968
6024
|
}
|
|
6025
|
+
|
|
5969
6026
|
/**
|
|
5970
6027
|
* return true if the device screen orientation is in Portrait mode
|
|
5971
6028
|
* @function isLandscape
|
|
@@ -5976,6 +6033,7 @@ function isPortrait() {
|
|
|
5976
6033
|
function isLandscape() {
|
|
5977
6034
|
return getScreenOrientation().includes("landscape");
|
|
5978
6035
|
}
|
|
6036
|
+
|
|
5979
6037
|
/**
|
|
5980
6038
|
* return the device storage
|
|
5981
6039
|
* @function getStorage
|
|
@@ -5994,6 +6052,7 @@ function getStorage(type = "local") {
|
|
|
5994
6052
|
throw new Error("storage type " + type + " not supported");
|
|
5995
6053
|
}
|
|
5996
6054
|
}
|
|
6055
|
+
|
|
5997
6056
|
/**
|
|
5998
6057
|
* return the parent DOM element for the given parent name or HTMLElement object
|
|
5999
6058
|
* @function getParentElement
|
|
@@ -6011,6 +6070,7 @@ function getParentElement(element) {
|
|
|
6011
6070
|
|
|
6012
6071
|
return target;
|
|
6013
6072
|
}
|
|
6073
|
+
|
|
6014
6074
|
/**
|
|
6015
6075
|
* return the DOM element for the given element name or HTMLElement object
|
|
6016
6076
|
* @function getElement
|
|
@@ -6038,6 +6098,7 @@ function getElement(element) {
|
|
|
6038
6098
|
|
|
6039
6099
|
return target;
|
|
6040
6100
|
}
|
|
6101
|
+
|
|
6041
6102
|
/**
|
|
6042
6103
|
* returns the size of the given HTMLElement and its position relative to the viewport
|
|
6043
6104
|
* <br><img src="images/element-box-diagram.png"/>
|
|
@@ -6055,7 +6116,9 @@ function getElementBounds(element) {
|
|
|
6055
6116
|
domRect.width = domRect.right = globalThis.innerWidth;
|
|
6056
6117
|
domRect.height = domRect.bottom = globalThis.innerHeight;
|
|
6057
6118
|
return domRect;
|
|
6058
|
-
}
|
|
6119
|
+
}
|
|
6120
|
+
}
|
|
6121
|
+
|
|
6059
6122
|
/**
|
|
6060
6123
|
* returns the size of the given HTMLElement Parent and its position relative to the viewport
|
|
6061
6124
|
* <br><img src="images/element-box-diagram.png"/>
|
|
@@ -6069,6 +6132,7 @@ function getElementBounds(element) {
|
|
|
6069
6132
|
function getParentBounds(element) {
|
|
6070
6133
|
return getElementBounds(getParentElement(element));
|
|
6071
6134
|
}
|
|
6135
|
+
|
|
6072
6136
|
/**
|
|
6073
6137
|
* returns true if the device supports WebGL
|
|
6074
6138
|
* @function isWebGLSupported
|
|
@@ -6093,6 +6157,7 @@ function isWebGLSupported(options) {
|
|
|
6093
6157
|
|
|
6094
6158
|
return _supported;
|
|
6095
6159
|
}
|
|
6160
|
+
|
|
6096
6161
|
/**
|
|
6097
6162
|
* return the highest precision format supported by this device for GL Shaders
|
|
6098
6163
|
* @function getMaxShaderPrecision
|
|
@@ -6112,6 +6177,7 @@ function getMaxShaderPrecision(gl) {
|
|
|
6112
6177
|
}
|
|
6113
6178
|
return "lowp";
|
|
6114
6179
|
}
|
|
6180
|
+
|
|
6115
6181
|
/**
|
|
6116
6182
|
* Makes a request to bring this device window to the front.
|
|
6117
6183
|
* @function focus
|
|
@@ -6127,6 +6193,7 @@ function focus() {
|
|
|
6127
6193
|
globalThis.focus();
|
|
6128
6194
|
}
|
|
6129
6195
|
}
|
|
6196
|
+
|
|
6130
6197
|
/**
|
|
6131
6198
|
* Enable monitor of the device accelerator to detect the amount of physical force of acceleration the device is receiving.
|
|
6132
6199
|
* (one some device a first user gesture will be required before calling this function)
|
|
@@ -6169,6 +6236,7 @@ function watchAccelerometer() {
|
|
|
6169
6236
|
}
|
|
6170
6237
|
return accelInitialized;
|
|
6171
6238
|
}
|
|
6239
|
+
|
|
6172
6240
|
/**
|
|
6173
6241
|
* unwatch Accelerometor event
|
|
6174
6242
|
* @function unwatchAccelerometer
|
|
@@ -6182,6 +6250,7 @@ function unwatchAccelerometer() {
|
|
|
6182
6250
|
accelInitialized = false;
|
|
6183
6251
|
}
|
|
6184
6252
|
}
|
|
6253
|
+
|
|
6185
6254
|
/**
|
|
6186
6255
|
* Enable monitor of the device orientation to detect the current orientation of the device as compared to the Earth coordinate frame.
|
|
6187
6256
|
* (one some device a first user gesture will be required before calling this function)
|
|
@@ -6220,6 +6289,7 @@ function watchDeviceOrientation() {
|
|
|
6220
6289
|
}
|
|
6221
6290
|
return deviceOrientationInitialized;
|
|
6222
6291
|
}
|
|
6292
|
+
|
|
6223
6293
|
/**
|
|
6224
6294
|
* unwatch Device orientation event
|
|
6225
6295
|
* @function unwatchDeviceOrientation
|
|
@@ -6232,6 +6302,7 @@ function unwatchDeviceOrientation() {
|
|
|
6232
6302
|
deviceOrientationInitialized = false;
|
|
6233
6303
|
}
|
|
6234
6304
|
}
|
|
6305
|
+
|
|
6235
6306
|
/**
|
|
6236
6307
|
* the vibrate method pulses the vibration hardware on the device, <br>
|
|
6237
6308
|
* If the device doesn't support vibration, this method has no effect. <br>
|
|
@@ -6350,14 +6421,14 @@ function extractUniforms(gl, shader) {
|
|
|
6350
6421
|
match;
|
|
6351
6422
|
|
|
6352
6423
|
// Detect all uniform names and types
|
|
6353
|
-
[ shader.vertex, shader.fragment ].forEach(
|
|
6424
|
+
[ shader.vertex, shader.fragment ].forEach((shader) => {
|
|
6354
6425
|
while ((match = uniRx.exec(shader))) {
|
|
6355
6426
|
uniformsData[match[2]] = match[1];
|
|
6356
6427
|
}
|
|
6357
6428
|
});
|
|
6358
6429
|
|
|
6359
6430
|
// Get uniform references
|
|
6360
|
-
Object.keys(uniformsData).forEach(
|
|
6431
|
+
Object.keys(uniformsData).forEach((name) => {
|
|
6361
6432
|
var type = uniformsData[name];
|
|
6362
6433
|
locations[name] = gl.getUniformLocation(shader.program, name);
|
|
6363
6434
|
|
|
@@ -6430,6 +6501,7 @@ function compileShader(gl, type, source) {
|
|
|
6430
6501
|
|
|
6431
6502
|
return shader;
|
|
6432
6503
|
}
|
|
6504
|
+
|
|
6433
6505
|
/**
|
|
6434
6506
|
* Compile GLSL into a shader object
|
|
6435
6507
|
* @ignore
|
|
@@ -8432,7 +8504,7 @@ class Polygon {
|
|
|
8432
8504
|
*/
|
|
8433
8505
|
clone() {
|
|
8434
8506
|
var copy = [];
|
|
8435
|
-
this.points.forEach(
|
|
8507
|
+
this.points.forEach((point) => {
|
|
8436
8508
|
copy.push(point.clone());
|
|
8437
8509
|
});
|
|
8438
8510
|
return new Polygon(this.pos.x, this.pos.y, copy);
|
|
@@ -9319,7 +9391,7 @@ class Line extends Polygon {
|
|
|
9319
9391
|
*/
|
|
9320
9392
|
clone() {
|
|
9321
9393
|
var copy = [];
|
|
9322
|
-
this.points.forEach(
|
|
9394
|
+
this.points.forEach((point) => {
|
|
9323
9395
|
copy.push(point.clone());
|
|
9324
9396
|
});
|
|
9325
9397
|
return new Line(this.pos.x, this.pos.y, copy);
|
|
@@ -10214,7 +10286,7 @@ class Renderer {
|
|
|
10214
10286
|
this.currentBlendMode = "none";
|
|
10215
10287
|
|
|
10216
10288
|
// create the main screen canvas
|
|
10217
|
-
if (
|
|
10289
|
+
if (platform.ejecta === true) {
|
|
10218
10290
|
// a main canvas is already automatically created by Ejecta
|
|
10219
10291
|
this.canvas = document.getElementById("canvas");
|
|
10220
10292
|
} else if (typeof globalThis.canvas !== "undefined") {
|
|
@@ -13864,6 +13936,7 @@ let stopOnAudioError = true;
|
|
|
13864
13936
|
|
|
13865
13937
|
return !howler.Howler.noAudio;
|
|
13866
13938
|
}
|
|
13939
|
+
|
|
13867
13940
|
/**
|
|
13868
13941
|
* check if the given audio format is supported
|
|
13869
13942
|
* @function audio.hasFormat
|
|
@@ -13873,6 +13946,7 @@ let stopOnAudioError = true;
|
|
|
13873
13946
|
function hasFormat(codec) {
|
|
13874
13947
|
return hasAudio() && howler.Howler.codecs(codec);
|
|
13875
13948
|
}
|
|
13949
|
+
|
|
13876
13950
|
/**
|
|
13877
13951
|
* check if audio (HTML5 or WebAudio) is supported
|
|
13878
13952
|
* @function audio.hasAudio
|
|
@@ -13881,6 +13955,7 @@ function hasFormat(codec) {
|
|
|
13881
13955
|
function hasAudio() {
|
|
13882
13956
|
return !howler.Howler.noAudio;
|
|
13883
13957
|
}
|
|
13958
|
+
|
|
13884
13959
|
/**
|
|
13885
13960
|
* enable audio output <br>
|
|
13886
13961
|
* only useful if audio supported and previously disabled through
|
|
@@ -13890,6 +13965,7 @@ function hasAudio() {
|
|
|
13890
13965
|
function enable() {
|
|
13891
13966
|
unmuteAll();
|
|
13892
13967
|
}
|
|
13968
|
+
|
|
13893
13969
|
/**
|
|
13894
13970
|
* disable audio output
|
|
13895
13971
|
* @function audio.disable
|
|
@@ -13897,6 +13973,7 @@ function enable() {
|
|
|
13897
13973
|
function disable() {
|
|
13898
13974
|
muteAll();
|
|
13899
13975
|
}
|
|
13976
|
+
|
|
13900
13977
|
/**
|
|
13901
13978
|
* Load an audio file.<br>
|
|
13902
13979
|
* <br>
|
|
@@ -13942,6 +14019,7 @@ function load(sound, html5, onload_cb, onerror_cb) {
|
|
|
13942
14019
|
|
|
13943
14020
|
return 1;
|
|
13944
14021
|
}
|
|
14022
|
+
|
|
13945
14023
|
/**
|
|
13946
14024
|
* play the specified sound
|
|
13947
14025
|
* @function audio.play
|
|
@@ -13982,6 +14060,7 @@ function play(sound_name, loop = false, onend, volume) {
|
|
|
13982
14060
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
13983
14061
|
}
|
|
13984
14062
|
}
|
|
14063
|
+
|
|
13985
14064
|
/**
|
|
13986
14065
|
* Fade a currently playing sound between two volumee.
|
|
13987
14066
|
* @function audio.fade
|
|
@@ -13999,6 +14078,7 @@ function fade(sound_name, from, to, duration, id) {
|
|
|
13999
14078
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14000
14079
|
}
|
|
14001
14080
|
}
|
|
14081
|
+
|
|
14002
14082
|
/**
|
|
14003
14083
|
* get/set the position of playback for a sound.
|
|
14004
14084
|
* @function audio.seek
|
|
@@ -14020,6 +14100,7 @@ function seek(sound_name, ...args) {
|
|
|
14020
14100
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14021
14101
|
}
|
|
14022
14102
|
}
|
|
14103
|
+
|
|
14023
14104
|
/**
|
|
14024
14105
|
* get or set the rate of playback for a sound.
|
|
14025
14106
|
* @function audio.rate
|
|
@@ -14041,6 +14122,7 @@ function rate(sound_name, ...args) {
|
|
|
14041
14122
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14042
14123
|
}
|
|
14043
14124
|
}
|
|
14125
|
+
|
|
14044
14126
|
/**
|
|
14045
14127
|
* stop the specified sound on all channels
|
|
14046
14128
|
* @function audio.stop
|
|
@@ -14063,6 +14145,7 @@ function stop(sound_name, id) {
|
|
|
14063
14145
|
howler.Howler.stop();
|
|
14064
14146
|
}
|
|
14065
14147
|
}
|
|
14148
|
+
|
|
14066
14149
|
/**
|
|
14067
14150
|
* pause the specified sound on all channels<br>
|
|
14068
14151
|
* this function does not reset the currentTime property
|
|
@@ -14080,6 +14163,7 @@ function pause(sound_name, id) {
|
|
|
14080
14163
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14081
14164
|
}
|
|
14082
14165
|
}
|
|
14166
|
+
|
|
14083
14167
|
/**
|
|
14084
14168
|
* resume the specified sound on all channels<br>
|
|
14085
14169
|
* @function audio.resume
|
|
@@ -14103,6 +14187,7 @@ function resume(sound_name, id) {
|
|
|
14103
14187
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14104
14188
|
}
|
|
14105
14189
|
}
|
|
14190
|
+
|
|
14106
14191
|
/**
|
|
14107
14192
|
* play the specified audio track<br>
|
|
14108
14193
|
* this function automatically set the loop property to true<br>
|
|
@@ -14123,6 +14208,7 @@ function playTrack(sound_name, volume) {
|
|
|
14123
14208
|
volume
|
|
14124
14209
|
);
|
|
14125
14210
|
}
|
|
14211
|
+
|
|
14126
14212
|
/**
|
|
14127
14213
|
* stop the current audio track
|
|
14128
14214
|
* @function audio.stopTrack
|
|
@@ -14139,6 +14225,7 @@ function stopTrack() {
|
|
|
14139
14225
|
current_track_id = null;
|
|
14140
14226
|
}
|
|
14141
14227
|
}
|
|
14228
|
+
|
|
14142
14229
|
/**
|
|
14143
14230
|
* pause the current audio track
|
|
14144
14231
|
* @function audio.pauseTrack
|
|
@@ -14150,6 +14237,7 @@ function pauseTrack() {
|
|
|
14150
14237
|
audioTracks[current_track_id].pause();
|
|
14151
14238
|
}
|
|
14152
14239
|
}
|
|
14240
|
+
|
|
14153
14241
|
/**
|
|
14154
14242
|
* resume the previously paused audio track
|
|
14155
14243
|
* @function audio.resumeTrack
|
|
@@ -14166,6 +14254,7 @@ function resumeTrack() {
|
|
|
14166
14254
|
audioTracks[current_track_id].play();
|
|
14167
14255
|
}
|
|
14168
14256
|
}
|
|
14257
|
+
|
|
14169
14258
|
/**
|
|
14170
14259
|
* returns the current track Id
|
|
14171
14260
|
* @function audio.getCurrentTrack
|
|
@@ -14174,6 +14263,7 @@ function resumeTrack() {
|
|
|
14174
14263
|
function getCurrentTrack() {
|
|
14175
14264
|
return current_track_id;
|
|
14176
14265
|
}
|
|
14266
|
+
|
|
14177
14267
|
/**
|
|
14178
14268
|
* set the default global volume
|
|
14179
14269
|
* @function audio.setVolume
|
|
@@ -14182,6 +14272,7 @@ function getCurrentTrack() {
|
|
|
14182
14272
|
function setVolume(volume) {
|
|
14183
14273
|
howler.Howler.volume(volume);
|
|
14184
14274
|
}
|
|
14275
|
+
|
|
14185
14276
|
/**
|
|
14186
14277
|
* get the default global volume
|
|
14187
14278
|
* @function audio.getVolume
|
|
@@ -14190,6 +14281,7 @@ function setVolume(volume) {
|
|
|
14190
14281
|
function getVolume() {
|
|
14191
14282
|
return howler.Howler.volume();
|
|
14192
14283
|
}
|
|
14284
|
+
|
|
14193
14285
|
/**
|
|
14194
14286
|
* mute or unmute the specified sound, but does not pause the playback.
|
|
14195
14287
|
* @function audio.mute
|
|
@@ -14210,6 +14302,7 @@ function mute(sound_name, id, mute) {
|
|
|
14210
14302
|
throw new Error("audio clip " + sound_name + " does not exist");
|
|
14211
14303
|
}
|
|
14212
14304
|
}
|
|
14305
|
+
|
|
14213
14306
|
/**
|
|
14214
14307
|
* unmute the specified sound
|
|
14215
14308
|
* @function audio.unmute
|
|
@@ -14219,6 +14312,7 @@ function mute(sound_name, id, mute) {
|
|
|
14219
14312
|
function unmute(sound_name, id) {
|
|
14220
14313
|
mute(sound_name, id, false);
|
|
14221
14314
|
}
|
|
14315
|
+
|
|
14222
14316
|
/**
|
|
14223
14317
|
* mute all audio
|
|
14224
14318
|
* @function audio.muteAll
|
|
@@ -14226,6 +14320,7 @@ function unmute(sound_name, id) {
|
|
|
14226
14320
|
function muteAll() {
|
|
14227
14321
|
howler.Howler.mute(true);
|
|
14228
14322
|
}
|
|
14323
|
+
|
|
14229
14324
|
/**
|
|
14230
14325
|
* unmute all audio
|
|
14231
14326
|
* @function audio.unmuteAll
|
|
@@ -14233,6 +14328,7 @@ function muteAll() {
|
|
|
14233
14328
|
function unmuteAll() {
|
|
14234
14329
|
howler.Howler.mute(false);
|
|
14235
14330
|
}
|
|
14331
|
+
|
|
14236
14332
|
/**
|
|
14237
14333
|
* Returns true if audio is muted globally.
|
|
14238
14334
|
* @function audio.muted
|
|
@@ -14241,6 +14337,7 @@ function unmuteAll() {
|
|
|
14241
14337
|
function muted() {
|
|
14242
14338
|
return howler.Howler._muted;
|
|
14243
14339
|
}
|
|
14340
|
+
|
|
14244
14341
|
/**
|
|
14245
14342
|
* unload specified audio track to free memory
|
|
14246
14343
|
* @function audio.unload
|
|
@@ -14259,6 +14356,7 @@ function unload(sound_name) {
|
|
|
14259
14356
|
delete audioTracks[sound_name];
|
|
14260
14357
|
return true;
|
|
14261
14358
|
}
|
|
14359
|
+
|
|
14262
14360
|
/**
|
|
14263
14361
|
* unload all audio to free memory
|
|
14264
14362
|
* @function audio.unloadAll
|
|
@@ -16188,6 +16286,7 @@ function initKeyboardEvent() {
|
|
|
16188
16286
|
}
|
|
16189
16287
|
}
|
|
16190
16288
|
}
|
|
16289
|
+
|
|
16191
16290
|
/**
|
|
16192
16291
|
* return the key press status of the specified action
|
|
16193
16292
|
* @name isKeyPressed
|
|
@@ -16212,6 +16311,7 @@ function isKeyPressed(action) {
|
|
|
16212
16311
|
}
|
|
16213
16312
|
return false;
|
|
16214
16313
|
}
|
|
16314
|
+
|
|
16215
16315
|
/**
|
|
16216
16316
|
* return the key status of the specified action
|
|
16217
16317
|
* @name keyStatus
|
|
@@ -16224,6 +16324,7 @@ function keyStatus(action) {
|
|
|
16224
16324
|
return (_keyStatus[action] > 0);
|
|
16225
16325
|
}
|
|
16226
16326
|
|
|
16327
|
+
|
|
16227
16328
|
/**
|
|
16228
16329
|
* trigger the specified key (simulated) event <br>
|
|
16229
16330
|
* @name triggerKeyEvent
|
|
@@ -16245,6 +16346,7 @@ function triggerKeyEvent(keycode, status, mouseButton) {
|
|
|
16245
16346
|
}
|
|
16246
16347
|
}
|
|
16247
16348
|
|
|
16349
|
+
|
|
16248
16350
|
/**
|
|
16249
16351
|
* associate a user defined action to a keycode
|
|
16250
16352
|
* @name bindKey
|
|
@@ -16270,6 +16372,7 @@ function bindKey(keycode, action, lock, preventDefault$1 = preventDefault) {
|
|
|
16270
16372
|
_keyLocked[action] = false;
|
|
16271
16373
|
_keyRefs[action] = {};
|
|
16272
16374
|
}
|
|
16375
|
+
|
|
16273
16376
|
/**
|
|
16274
16377
|
* return the action associated with the given keycode
|
|
16275
16378
|
* @name getBindingKey
|
|
@@ -16281,6 +16384,7 @@ function bindKey(keycode, action, lock, preventDefault$1 = preventDefault) {
|
|
|
16281
16384
|
function getBindingKey(keycode) {
|
|
16282
16385
|
return _keyBindings[keycode];
|
|
16283
16386
|
}
|
|
16387
|
+
|
|
16284
16388
|
/**
|
|
16285
16389
|
* unlock a key manually
|
|
16286
16390
|
* @name unlockKey
|
|
@@ -16296,6 +16400,7 @@ function getBindingKey(keycode) {
|
|
|
16296
16400
|
function unlockKey(action) {
|
|
16297
16401
|
_keyLocked[action] = false;
|
|
16298
16402
|
}
|
|
16403
|
+
|
|
16299
16404
|
/**
|
|
16300
16405
|
* unbind the defined keycode
|
|
16301
16406
|
* @name unbindKey
|
|
@@ -16833,7 +16938,7 @@ function enablePointerEvent() {
|
|
|
16833
16938
|
focus();
|
|
16834
16939
|
pointerEventTarget.addEventListener(
|
|
16835
16940
|
activeEventList[2], // MOUSE/POINTER DOWN
|
|
16836
|
-
|
|
16941
|
+
() => {
|
|
16837
16942
|
focus();
|
|
16838
16943
|
},
|
|
16839
16944
|
{ passive: (preventDefault === false) }
|
|
@@ -17249,6 +17354,7 @@ function globalToLocal(x, y, v) {
|
|
|
17249
17354
|
}
|
|
17250
17355
|
return v.set(x * pixelRatio, y * pixelRatio);
|
|
17251
17356
|
}
|
|
17357
|
+
|
|
17252
17358
|
/**
|
|
17253
17359
|
* enable/disable all gestures on the given element.<br>
|
|
17254
17360
|
* by default melonJS will disable browser handling of all panning and zooming gestures.
|
|
@@ -17262,6 +17368,7 @@ function globalToLocal(x, y, v) {
|
|
|
17262
17368
|
function setTouchAction(element, value) {
|
|
17263
17369
|
element.style["touch-action"] = value || "none";
|
|
17264
17370
|
}
|
|
17371
|
+
|
|
17265
17372
|
/**
|
|
17266
17373
|
* Associate a pointer event to a keycode<br>
|
|
17267
17374
|
* Left button – 0
|
|
@@ -17294,6 +17401,7 @@ function bindPointer() {
|
|
|
17294
17401
|
// map the mouse button to the keycode
|
|
17295
17402
|
pointer.bind[button] = keyCode;
|
|
17296
17403
|
}
|
|
17404
|
+
|
|
17297
17405
|
/**
|
|
17298
17406
|
* unbind the defined keycode
|
|
17299
17407
|
* @name unbindPointer
|
|
@@ -17311,6 +17419,7 @@ function unbindPointer(button) {
|
|
|
17311
17419
|
] = null;
|
|
17312
17420
|
}
|
|
17313
17421
|
|
|
17422
|
+
|
|
17314
17423
|
/**
|
|
17315
17424
|
* allows registration of event listeners on the object target. <br>
|
|
17316
17425
|
* melonJS will pass a me.Pointer object to the defined callback.
|
|
@@ -17383,6 +17492,7 @@ function registerPointerEvent(eventType, region, callback) {
|
|
|
17383
17492
|
}
|
|
17384
17493
|
}
|
|
17385
17494
|
}
|
|
17495
|
+
|
|
17386
17496
|
/**
|
|
17387
17497
|
* allows the removal of event listeners from the object target.
|
|
17388
17498
|
* @see {@link http://www.w3.org/TR/pointerevents/#list-of-pointer-events|W3C Pointer Event list}
|
|
@@ -17427,6 +17537,7 @@ function releasePointerEvent(eventType, region, callback) {
|
|
|
17427
17537
|
}
|
|
17428
17538
|
}
|
|
17429
17539
|
}
|
|
17540
|
+
|
|
17430
17541
|
/**
|
|
17431
17542
|
* allows the removal of all registered event listeners from the object target.
|
|
17432
17543
|
* @name releaseAllPointerEvents
|
|
@@ -17442,7 +17553,9 @@ function releaseAllPointerEvents(region) {
|
|
|
17442
17553
|
for (var i = 0; i < pointerEventList.length; i++) {
|
|
17443
17554
|
releasePointerEvent(pointerEventList[i], region);
|
|
17444
17555
|
}
|
|
17445
|
-
}
|
|
17556
|
+
}
|
|
17557
|
+
}
|
|
17558
|
+
|
|
17446
17559
|
/**
|
|
17447
17560
|
* request for the pointer to be locked on the parent DOM element.
|
|
17448
17561
|
* (Must be called in a click event or an event that requires user interaction)
|
|
@@ -17535,13 +17648,13 @@ var leadingZeroRE = /^0+/;
|
|
|
17535
17648
|
* @ignore
|
|
17536
17649
|
*/
|
|
17537
17650
|
function addMapping(id, mapping) {
|
|
17538
|
-
var expanded_id = id.replace(vendorProductRE,
|
|
17651
|
+
var expanded_id = id.replace(vendorProductRE, (_, a, b) => {
|
|
17539
17652
|
return (
|
|
17540
17653
|
"000".slice(a.length - 1) + a + "-" +
|
|
17541
17654
|
"000".slice(b.length - 1) + b + "-"
|
|
17542
17655
|
);
|
|
17543
17656
|
});
|
|
17544
|
-
var sparse_id = id.replace(vendorProductRE,
|
|
17657
|
+
var sparse_id = id.replace(vendorProductRE, (_, a, b) => {
|
|
17545
17658
|
return (
|
|
17546
17659
|
a.replace(leadingZeroRE, "") + "-" +
|
|
17547
17660
|
b.replace(leadingZeroRE, "") + "-"
|
|
@@ -17549,7 +17662,7 @@ function addMapping(id, mapping) {
|
|
|
17549
17662
|
});
|
|
17550
17663
|
|
|
17551
17664
|
// Normalize optional parameters
|
|
17552
|
-
mapping.analog = mapping.analog || mapping.buttons.map(
|
|
17665
|
+
mapping.analog = mapping.analog || mapping.buttons.map(() => {
|
|
17553
17666
|
return -1;
|
|
17554
17667
|
});
|
|
17555
17668
|
mapping.normalize_fn = mapping.normalize_fn || function (value) { return value; };
|
|
@@ -17612,7 +17725,7 @@ var updateEventHandler;
|
|
|
17612
17725
|
"normalize_fn" : ouyaNormalizeFn
|
|
17613
17726
|
}
|
|
17614
17727
|
]
|
|
17615
|
-
].forEach(
|
|
17728
|
+
].forEach((value) => {
|
|
17616
17729
|
addMapping(value[0], value[1]);
|
|
17617
17730
|
});
|
|
17618
17731
|
|
|
@@ -17624,7 +17737,7 @@ var updateGamepads = function () {
|
|
|
17624
17737
|
var gamepads = navigator.getGamepads();
|
|
17625
17738
|
|
|
17626
17739
|
// Trigger button bindings
|
|
17627
|
-
Object.keys(bindings).forEach(
|
|
17740
|
+
Object.keys(bindings).forEach((index) => {
|
|
17628
17741
|
var gamepad = gamepads[index];
|
|
17629
17742
|
if (!gamepad) {
|
|
17630
17743
|
return;
|
|
@@ -17638,7 +17751,7 @@ var updateGamepads = function () {
|
|
|
17638
17751
|
var binding = bindings[index];
|
|
17639
17752
|
|
|
17640
17753
|
// Iterate all buttons that have active bindings
|
|
17641
|
-
Object.keys(binding.buttons).forEach(
|
|
17754
|
+
Object.keys(binding.buttons).forEach((button) => {
|
|
17642
17755
|
var last = binding.buttons[button];
|
|
17643
17756
|
var mapped_button = button;
|
|
17644
17757
|
var mapped_axis = -1;
|
|
@@ -17685,7 +17798,7 @@ var updateGamepads = function () {
|
|
|
17685
17798
|
});
|
|
17686
17799
|
|
|
17687
17800
|
// Iterate all axes that have active bindings
|
|
17688
|
-
Object.keys(binding.axes).forEach(
|
|
17801
|
+
Object.keys(binding.axes).forEach((axis) => {
|
|
17689
17802
|
var last = binding.axes[axis];
|
|
17690
17803
|
var mapped_axis = axis;
|
|
17691
17804
|
|
|
@@ -17740,14 +17853,14 @@ var updateGamepads = function () {
|
|
|
17740
17853
|
|
|
17741
17854
|
// gamepad connected callback
|
|
17742
17855
|
if (globalThis.navigator && typeof globalThis.navigator.getGamepads === "function") {
|
|
17743
|
-
globalThis.addEventListener("gamepadconnected",
|
|
17856
|
+
globalThis.addEventListener("gamepadconnected", (e) => {
|
|
17744
17857
|
emit(GAMEPAD_CONNECTED, e.gamepad);
|
|
17745
17858
|
}, false);
|
|
17746
17859
|
|
|
17747
17860
|
/*
|
|
17748
17861
|
* gamepad disconnected callback
|
|
17749
17862
|
*/
|
|
17750
|
-
globalThis.addEventListener("gamepaddisconnected",
|
|
17863
|
+
globalThis.addEventListener("gamepaddisconnected", (e) => {
|
|
17751
17864
|
emit(GAMEPAD_DISCONNECTED, e.gamepad);
|
|
17752
17865
|
}, false);
|
|
17753
17866
|
}
|
|
@@ -17903,6 +18016,7 @@ function bindGamepad(index, button, keyCode) {
|
|
|
17903
18016
|
}
|
|
17904
18017
|
}
|
|
17905
18018
|
}
|
|
18019
|
+
|
|
17906
18020
|
/**
|
|
17907
18021
|
* unbind the defined keycode
|
|
17908
18022
|
* @name unbindGamepad
|
|
@@ -17919,6 +18033,7 @@ function unbindGamepad(index, button) {
|
|
|
17919
18033
|
}
|
|
17920
18034
|
bindings[index].buttons[button] = {};
|
|
17921
18035
|
}
|
|
18036
|
+
|
|
17922
18037
|
/**
|
|
17923
18038
|
* Set deadzone for analog gamepad inputs<br>
|
|
17924
18039
|
* The default deadzone is 0.1 (10%) Analog values less than this will be ignored
|
|
@@ -17930,6 +18045,7 @@ function unbindGamepad(index, button) {
|
|
|
17930
18045
|
function setGamepadDeadzone(value) {
|
|
17931
18046
|
deadzone = value;
|
|
17932
18047
|
}
|
|
18048
|
+
|
|
17933
18049
|
/**
|
|
17934
18050
|
* specify a custom mapping for a specific gamepad id<br>
|
|
17935
18051
|
* see below for the default mapping : <br>
|
|
@@ -19344,6 +19460,7 @@ function shouldCollide(a, b) {
|
|
|
19344
19460
|
}
|
|
19345
19461
|
|
|
19346
19462
|
|
|
19463
|
+
|
|
19347
19464
|
/**
|
|
19348
19465
|
* find all the collisions for the specified object
|
|
19349
19466
|
* @name collisionCheck
|
|
@@ -19414,6 +19531,7 @@ function collisionCheck(objA, response = globalResponse) {
|
|
|
19414
19531
|
// we could return the amount of objects we collided with ?
|
|
19415
19532
|
return collisionCounter > 0;
|
|
19416
19533
|
}
|
|
19534
|
+
|
|
19417
19535
|
/**
|
|
19418
19536
|
* Checks for object colliding with the given line
|
|
19419
19537
|
* @name rayCast
|
|
@@ -20144,7 +20262,8 @@ class Body {
|
|
|
20144
20262
|
if (shape.contains(_x, _y)) {
|
|
20145
20263
|
return true;
|
|
20146
20264
|
}
|
|
20147
|
-
}
|
|
20265
|
+
}
|
|
20266
|
+
}
|
|
20148
20267
|
return false;
|
|
20149
20268
|
}
|
|
20150
20269
|
|
|
@@ -20312,10 +20431,14 @@ class Container extends Renderable {
|
|
|
20312
20431
|
* @param {number} [width=game.viewport.width] width of the container
|
|
20313
20432
|
* @param {number} [height=game.viewport.height] height of the container
|
|
20314
20433
|
*/
|
|
20315
|
-
constructor(x = 0, y = 0, width
|
|
20434
|
+
constructor(x = 0, y = 0, width, height, root = false) {
|
|
20316
20435
|
|
|
20317
20436
|
// call the super constructor
|
|
20318
|
-
super(
|
|
20437
|
+
super(
|
|
20438
|
+
x, y,
|
|
20439
|
+
typeof width === "undefined" ? (typeof game.viewport !== "undefined" ? game.viewport.width : Infinity) : width,
|
|
20440
|
+
typeof height === "undefined" ? (typeof game.viewport !== "undefined" ? game.viewport.height : Infinity) : height
|
|
20441
|
+
);
|
|
20319
20442
|
|
|
20320
20443
|
/**
|
|
20321
20444
|
* keep track of pending sort
|
|
@@ -20456,6 +20579,7 @@ class Container extends Renderable {
|
|
|
20456
20579
|
this.removeChildNow(child);
|
|
20457
20580
|
}
|
|
20458
20581
|
}
|
|
20582
|
+
|
|
20459
20583
|
if (typeof this.currentTransform !== "undefined") {
|
|
20460
20584
|
// just reset some variables
|
|
20461
20585
|
this.currentTransform.identity();
|
|
@@ -21195,10 +21319,11 @@ class Container extends Renderable {
|
|
|
21195
21319
|
// check if object is in any active cameras
|
|
21196
21320
|
obj.inViewport = false;
|
|
21197
21321
|
// iterate through all cameras
|
|
21198
|
-
state.current().cameras.forEach(
|
|
21322
|
+
state.current().cameras.forEach((camera) => {
|
|
21199
21323
|
if (camera.isVisible(obj, isFloating)) {
|
|
21200
21324
|
obj.inViewport = true;
|
|
21201
|
-
}
|
|
21325
|
+
}
|
|
21326
|
+
});
|
|
21202
21327
|
|
|
21203
21328
|
// update our object
|
|
21204
21329
|
this.isDirty |= ((obj.inViewport || obj.alwaysUpdate) && obj.update(dt));
|
|
@@ -21315,6 +21440,7 @@ function QT_ARRAY_POP(world, bounds, max_objects = 4, max_levels = 4, level = 0)
|
|
|
21315
21440
|
return new QuadTree(world, bounds, max_objects, max_levels, level);
|
|
21316
21441
|
}
|
|
21317
21442
|
}
|
|
21443
|
+
|
|
21318
21444
|
/**
|
|
21319
21445
|
* Push back a quadtree back into the array
|
|
21320
21446
|
* @ignore
|
|
@@ -21322,6 +21448,7 @@ function QT_ARRAY_POP(world, bounds, max_objects = 4, max_levels = 4, level = 0)
|
|
|
21322
21448
|
function QT_ARRAY_PUSH(qt) {
|
|
21323
21449
|
QT_ARRAY.push(qt);
|
|
21324
21450
|
}
|
|
21451
|
+
|
|
21325
21452
|
/**
|
|
21326
21453
|
* a temporary vector object to be reused
|
|
21327
21454
|
* @ignore
|
|
@@ -21847,7 +21974,8 @@ class World extends Container {
|
|
|
21847
21974
|
if (body.update(dt) === true) {
|
|
21848
21975
|
// mark ancestor as dirty
|
|
21849
21976
|
ancestor.isDirty = true;
|
|
21850
|
-
}
|
|
21977
|
+
}
|
|
21978
|
+
// handle collisions against other objects
|
|
21851
21979
|
collisionCheck(ancestor);
|
|
21852
21980
|
// clear body force
|
|
21853
21981
|
body.force.set(0, 0);
|
|
@@ -21874,7 +22002,7 @@ class Application {
|
|
|
21874
22002
|
* @public
|
|
21875
22003
|
* @type {Camera2d}
|
|
21876
22004
|
*/
|
|
21877
|
-
this.viewport =
|
|
22005
|
+
this.viewport = undefined;
|
|
21878
22006
|
|
|
21879
22007
|
/**
|
|
21880
22008
|
* a reference to the game world, <br>
|
|
@@ -21882,7 +22010,7 @@ class Application {
|
|
|
21882
22010
|
* @public
|
|
21883
22011
|
* @type {World}
|
|
21884
22012
|
*/
|
|
21885
|
-
this.world =
|
|
22013
|
+
this.world = undefined;
|
|
21886
22014
|
|
|
21887
22015
|
/**
|
|
21888
22016
|
* when true, all objects will be added under the root world container.<br>
|
|
@@ -21974,7 +22102,7 @@ class Application {
|
|
|
21974
22102
|
* // call myFunction () everytime a level is loaded
|
|
21975
22103
|
* me.game.onLevelLoaded = this.myFunction.bind(this);
|
|
21976
22104
|
*/
|
|
21977
|
-
onLevelLoaded() {}
|
|
22105
|
+
onLevelLoaded() {}
|
|
21978
22106
|
|
|
21979
22107
|
/**
|
|
21980
22108
|
* Update the renderer framerate using the system config variables.
|
|
@@ -22932,16 +23060,18 @@ class Stage {
|
|
|
22932
23060
|
|
|
22933
23061
|
// update the camera/viewport
|
|
22934
23062
|
// iterate through all cameras
|
|
22935
|
-
this.cameras.forEach(
|
|
23063
|
+
this.cameras.forEach((camera) => {
|
|
22936
23064
|
if (camera.update(dt) === true) {
|
|
22937
23065
|
isDirty = true;
|
|
22938
|
-
}
|
|
23066
|
+
}
|
|
23067
|
+
});
|
|
22939
23068
|
|
|
22940
23069
|
// update all lights
|
|
22941
23070
|
this.lights.forEach((light) => {
|
|
22942
23071
|
if (light.update(dt) === true) {
|
|
22943
23072
|
isDirty = true;
|
|
22944
|
-
}
|
|
23073
|
+
}
|
|
23074
|
+
});
|
|
22945
23075
|
|
|
22946
23076
|
return isDirty;
|
|
22947
23077
|
}
|
|
@@ -23086,6 +23216,7 @@ class ProgressBar extends Renderable {
|
|
|
23086
23216
|
}
|
|
23087
23217
|
|
|
23088
23218
|
}
|
|
23219
|
+
|
|
23089
23220
|
/**
|
|
23090
23221
|
* a default loading screen
|
|
23091
23222
|
* @ignore
|
|
@@ -23817,6 +23948,7 @@ function parseAttributes(obj, elt) {
|
|
|
23817
23948
|
function decompress() {
|
|
23818
23949
|
throw new Error("GZIP/ZLIB compressed TMX Tile Map not supported!");
|
|
23819
23950
|
}
|
|
23951
|
+
|
|
23820
23952
|
/**
|
|
23821
23953
|
* Decode a CSV encoded array into a binary array
|
|
23822
23954
|
* @ignore
|
|
@@ -23833,6 +23965,7 @@ function decodeCSV(input) {
|
|
|
23833
23965
|
}
|
|
23834
23966
|
return result;
|
|
23835
23967
|
}
|
|
23968
|
+
|
|
23836
23969
|
/**
|
|
23837
23970
|
* Decode a base64 encoded string into a byte array
|
|
23838
23971
|
* @ignore
|
|
@@ -23856,6 +23989,7 @@ function decodeBase64AsArray(input, bytes) {
|
|
|
23856
23989
|
}
|
|
23857
23990
|
return ar;
|
|
23858
23991
|
}
|
|
23992
|
+
|
|
23859
23993
|
/**
|
|
23860
23994
|
* Decode the given data
|
|
23861
23995
|
* @ignore
|
|
@@ -23886,6 +24020,7 @@ function decode(data, encoding, compression) {
|
|
|
23886
24020
|
throw new Error("Unknown layer encoding: " + encoding);
|
|
23887
24021
|
}
|
|
23888
24022
|
}
|
|
24023
|
+
|
|
23889
24024
|
/**
|
|
23890
24025
|
* Normalize TMX format to Tiled JSON format
|
|
23891
24026
|
* @ignore
|
|
@@ -23993,6 +24128,7 @@ function normalize(obj, item) {
|
|
|
23993
24128
|
break;
|
|
23994
24129
|
}
|
|
23995
24130
|
}
|
|
24131
|
+
|
|
23996
24132
|
/**
|
|
23997
24133
|
* Parse a XML TMX object and returns the corresponding javascript object
|
|
23998
24134
|
* @ignore
|
|
@@ -24031,6 +24167,7 @@ function parse(xml) {
|
|
|
24031
24167
|
|
|
24032
24168
|
return obj;
|
|
24033
24169
|
}
|
|
24170
|
+
|
|
24034
24171
|
/**
|
|
24035
24172
|
* Apply TMX Properties to the given object
|
|
24036
24173
|
* @ignore
|
|
@@ -24203,7 +24340,7 @@ class Tile extends Bounds {
|
|
|
24203
24340
|
if (tileset.animations.has(this.tileId)) {
|
|
24204
24341
|
var frames = [];
|
|
24205
24342
|
var frameId = [];
|
|
24206
|
-
(tileset.animations.get(this.tileId).frames).forEach(
|
|
24343
|
+
(tileset.animations.get(this.tileId).frames).forEach((frame) => {
|
|
24207
24344
|
frameId.push(frame.tileid);
|
|
24208
24345
|
frames.push({
|
|
24209
24346
|
name : "" + frame.tileid,
|
|
@@ -25571,6 +25708,7 @@ class TMXRenderer {
|
|
|
25571
25708
|
}
|
|
25572
25709
|
|
|
25573
25710
|
}
|
|
25711
|
+
|
|
25574
25712
|
/* eslint-enable no-unused-vars */
|
|
25575
25713
|
|
|
25576
25714
|
/**
|
|
@@ -26742,7 +26880,7 @@ class TMXTileset {
|
|
|
26742
26880
|
if (this._lastUpdate !== now) {
|
|
26743
26881
|
this._lastUpdate = now;
|
|
26744
26882
|
|
|
26745
|
-
this.animations.forEach(
|
|
26883
|
+
this.animations.forEach((anim) => {
|
|
26746
26884
|
anim.dt += dt;
|
|
26747
26885
|
duration = anim.cur.duration;
|
|
26748
26886
|
while (anim.dt >= duration) {
|
|
@@ -27600,7 +27738,8 @@ class TMXTileMap {
|
|
|
27600
27738
|
getRenderer() {
|
|
27601
27739
|
if ((typeof(this.renderer) === "undefined") || (!this.renderer.canRender(this))) {
|
|
27602
27740
|
this.renderer = getNewDefaultRenderer(this);
|
|
27603
|
-
}
|
|
27741
|
+
}
|
|
27742
|
+
return this.renderer;
|
|
27604
27743
|
}
|
|
27605
27744
|
|
|
27606
27745
|
/**
|
|
@@ -27710,12 +27849,12 @@ class TMXTileMap {
|
|
|
27710
27849
|
}
|
|
27711
27850
|
|
|
27712
27851
|
// add all layers instances
|
|
27713
|
-
this.getLayers().forEach(
|
|
27852
|
+
this.getLayers().forEach((layer) => {
|
|
27714
27853
|
container.addChild(layer);
|
|
27715
27854
|
});
|
|
27716
27855
|
|
|
27717
27856
|
// add all Object instances
|
|
27718
|
-
this.getObjects(flatten).forEach(
|
|
27857
|
+
this.getObjects(flatten).forEach((object) => {
|
|
27719
27858
|
container.addChild(object);
|
|
27720
27859
|
});
|
|
27721
27860
|
|
|
@@ -27994,6 +28133,7 @@ function safeLoadLevel(levelId, options, restart) {
|
|
|
27994
28133
|
state.restart();
|
|
27995
28134
|
}
|
|
27996
28135
|
}
|
|
28136
|
+
|
|
27997
28137
|
/**
|
|
27998
28138
|
* Load a TMX level
|
|
27999
28139
|
* @name loadTMXLevel
|
|
@@ -28019,6 +28159,7 @@ function loadTMXLevel(levelId, container, flatten, setViewportBounds) {
|
|
|
28019
28159
|
level.addTo(container, flatten, setViewportBounds);
|
|
28020
28160
|
}
|
|
28021
28161
|
|
|
28162
|
+
|
|
28022
28163
|
/**
|
|
28023
28164
|
* a level manager. once ressources loaded, the level manager contains all references of defined levels.
|
|
28024
28165
|
* @namespace level
|
|
@@ -28262,7 +28403,7 @@ function checkLoadStatus(onload) {
|
|
|
28262
28403
|
// trigger the onload callback
|
|
28263
28404
|
// we call either the supplied callback (which takes precedence) or the global one
|
|
28264
28405
|
var callback = onload || loader.onload;
|
|
28265
|
-
setTimeout(
|
|
28406
|
+
setTimeout(() => {
|
|
28266
28407
|
callback();
|
|
28267
28408
|
emit(LOADER_COMPLETE);
|
|
28268
28409
|
}, 300);
|
|
@@ -28277,6 +28418,7 @@ function checkLoadStatus(onload) {
|
|
|
28277
28418
|
}, 100);
|
|
28278
28419
|
}
|
|
28279
28420
|
}
|
|
28421
|
+
|
|
28280
28422
|
/**
|
|
28281
28423
|
* load Images
|
|
28282
28424
|
* @example
|
|
@@ -28302,6 +28444,7 @@ function preloadImage(img, onload, onerror) {
|
|
|
28302
28444
|
}
|
|
28303
28445
|
imgList[img.name].src = img.src + loader.nocache;
|
|
28304
28446
|
}
|
|
28447
|
+
|
|
28305
28448
|
/**
|
|
28306
28449
|
* load a font face
|
|
28307
28450
|
* @example
|
|
@@ -28330,13 +28473,14 @@ function preloadFontFace(data, onload, onerror) {
|
|
|
28330
28473
|
// onloaded callback
|
|
28331
28474
|
onload();
|
|
28332
28475
|
}
|
|
28333
|
-
},
|
|
28476
|
+
}, () => {
|
|
28334
28477
|
if (typeof onerror === "function") {
|
|
28335
28478
|
// rejected
|
|
28336
28479
|
onerror(data.name);
|
|
28337
28480
|
}
|
|
28338
28481
|
});
|
|
28339
28482
|
}
|
|
28483
|
+
|
|
28340
28484
|
/**
|
|
28341
28485
|
* preload TMX files
|
|
28342
28486
|
* @ignore
|
|
@@ -28444,6 +28588,7 @@ function preloadTMX(tmxData, onload, onerror) {
|
|
|
28444
28588
|
// send the request
|
|
28445
28589
|
xmlhttp.send();
|
|
28446
28590
|
}
|
|
28591
|
+
|
|
28447
28592
|
/**
|
|
28448
28593
|
* preload JSON files
|
|
28449
28594
|
* @ignore
|
|
@@ -28480,6 +28625,7 @@ function preloadJSON(data, onload, onerror) {
|
|
|
28480
28625
|
// send the request
|
|
28481
28626
|
xmlhttp.send();
|
|
28482
28627
|
}
|
|
28628
|
+
|
|
28483
28629
|
/**
|
|
28484
28630
|
* preload Binary files
|
|
28485
28631
|
* @ignore
|
|
@@ -28510,6 +28656,7 @@ function preloadBinary(data, onload, onerror) {
|
|
|
28510
28656
|
};
|
|
28511
28657
|
httpReq.send();
|
|
28512
28658
|
}
|
|
28659
|
+
|
|
28513
28660
|
/**
|
|
28514
28661
|
* preload Binary files
|
|
28515
28662
|
* @ignore
|
|
@@ -28540,6 +28687,7 @@ function preloadJavascript(data, onload, onerror) {
|
|
|
28540
28687
|
|
|
28541
28688
|
document.getElementsByTagName("body")[0].appendChild(script);
|
|
28542
28689
|
}
|
|
28690
|
+
|
|
28543
28691
|
/**
|
|
28544
28692
|
* a small class to manage loading of stuff and manage resources
|
|
28545
28693
|
* @namespace loader
|
|
@@ -29204,6 +29352,7 @@ class Sprite extends Renderable {
|
|
|
29204
29352
|
if (typeof settings.z !== "undefined") {
|
|
29205
29353
|
this.pos.z = settings.z;
|
|
29206
29354
|
}
|
|
29355
|
+
|
|
29207
29356
|
// for sprite, addAnimation will return !=0
|
|
29208
29357
|
if (this.addAnimation("default", null) !== 0) {
|
|
29209
29358
|
// set as default
|
|
@@ -29303,7 +29452,7 @@ class Sprite extends Renderable {
|
|
|
29303
29452
|
if (index == null) {
|
|
29304
29453
|
index = [];
|
|
29305
29454
|
// create a default animation with all frame
|
|
29306
|
-
Object.keys(this.textureAtlas).forEach(
|
|
29455
|
+
Object.keys(this.textureAtlas).forEach((v, i) => {
|
|
29307
29456
|
index[i] = i;
|
|
29308
29457
|
});
|
|
29309
29458
|
}
|
|
@@ -29984,7 +30133,7 @@ class TextureAtlas {
|
|
|
29984
30133
|
region = this.getAtlas(atlas)[name];
|
|
29985
30134
|
} else {
|
|
29986
30135
|
// look for the given region in each existing atlas
|
|
29987
|
-
this.atlases.forEach(
|
|
30136
|
+
this.atlases.forEach((atlas) => {
|
|
29988
30137
|
if (typeof atlas[name] !== "undefined") {
|
|
29989
30138
|
// there should be only one
|
|
29990
30139
|
region = atlas[name];
|
|
@@ -31781,6 +31930,7 @@ function autoDetectRenderer(options) {
|
|
|
31781
31930
|
}
|
|
31782
31931
|
return new CanvasRenderer(options);
|
|
31783
31932
|
}
|
|
31933
|
+
|
|
31784
31934
|
/**
|
|
31785
31935
|
* callback for window resize event
|
|
31786
31936
|
* @ignore
|
|
@@ -31855,6 +32005,7 @@ function onresize() {
|
|
|
31855
32005
|
scale(settings.scale, settings.scale);
|
|
31856
32006
|
}
|
|
31857
32007
|
}
|
|
32008
|
+
|
|
31858
32009
|
/**
|
|
31859
32010
|
* Select the HTML5 Canvas renderer
|
|
31860
32011
|
* @name CANVAS
|
|
@@ -32006,7 +32157,7 @@ function init(width, height, options) {
|
|
|
32006
32157
|
globalThis.addEventListener(
|
|
32007
32158
|
"resize",
|
|
32008
32159
|
utils.function.throttle(
|
|
32009
|
-
|
|
32160
|
+
(e) => {
|
|
32010
32161
|
emit(WINDOW_ONRESIZE, e);
|
|
32011
32162
|
}, 100
|
|
32012
32163
|
), false
|
|
@@ -32015,7 +32166,7 @@ function init(width, height, options) {
|
|
|
32015
32166
|
// Screen Orientation API
|
|
32016
32167
|
globalThis.addEventListener(
|
|
32017
32168
|
"orientationchange",
|
|
32018
|
-
|
|
32169
|
+
(e) => {
|
|
32019
32170
|
emit(WINDOW_ONORIENTATION_CHANGE, e);
|
|
32020
32171
|
},
|
|
32021
32172
|
false
|
|
@@ -32023,7 +32174,7 @@ function init(width, height, options) {
|
|
|
32023
32174
|
// pre-fixed implementation on mozzila
|
|
32024
32175
|
globalThis.addEventListener(
|
|
32025
32176
|
"onmozorientationchange",
|
|
32026
|
-
|
|
32177
|
+
(e) => {
|
|
32027
32178
|
emit(WINDOW_ONORIENTATION_CHANGE, e);
|
|
32028
32179
|
},
|
|
32029
32180
|
false
|
|
@@ -32036,11 +32187,9 @@ function init(width, height, options) {
|
|
|
32036
32187
|
}
|
|
32037
32188
|
|
|
32038
32189
|
// Automatically update relative canvas position on scroll
|
|
32039
|
-
globalThis.addEventListener("scroll", utils.function.throttle(
|
|
32040
|
-
|
|
32041
|
-
|
|
32042
|
-
}, 100
|
|
32043
|
-
), false);
|
|
32190
|
+
globalThis.addEventListener("scroll", utils.function.throttle((e) => {
|
|
32191
|
+
emit(WINDOW_ONSCROLL, e);
|
|
32192
|
+
}, 100), false);
|
|
32044
32193
|
|
|
32045
32194
|
// register to the channel
|
|
32046
32195
|
on(WINDOW_ONRESIZE, onresize, this);
|
|
@@ -32109,6 +32258,7 @@ function init(width, height, options) {
|
|
|
32109
32258
|
|
|
32110
32259
|
return true;
|
|
32111
32260
|
}
|
|
32261
|
+
|
|
32112
32262
|
/**
|
|
32113
32263
|
* Create and return a new Canvas element
|
|
32114
32264
|
* @function video.createCanvas
|
|
@@ -32140,6 +32290,7 @@ function createCanvas(width, height, returnOffscreenCanvas = false) {
|
|
|
32140
32290
|
|
|
32141
32291
|
return _canvas;
|
|
32142
32292
|
}
|
|
32293
|
+
|
|
32143
32294
|
/**
|
|
32144
32295
|
* return a reference to the parent DOM element holding the main canvas
|
|
32145
32296
|
* @function video.getParent
|
|
@@ -32148,6 +32299,7 @@ function createCanvas(width, height, returnOffscreenCanvas = false) {
|
|
|
32148
32299
|
function getParent() {
|
|
32149
32300
|
return parent;
|
|
32150
32301
|
}
|
|
32302
|
+
|
|
32151
32303
|
/**
|
|
32152
32304
|
* scale the "displayed" canvas by the given scalar.
|
|
32153
32305
|
* this will modify the size of canvas element directly.
|
|
@@ -32312,9 +32464,9 @@ var utils = {
|
|
|
32312
32464
|
}
|
|
32313
32465
|
|
|
32314
32466
|
// parse the url
|
|
32315
|
-
url.slice(1).split("&").filter(
|
|
32467
|
+
url.slice(1).split("&").filter((value) => {
|
|
32316
32468
|
return (value !== "");
|
|
32317
|
-
}).forEach(
|
|
32469
|
+
}).forEach((value) => {
|
|
32318
32470
|
var kv = value.split("=");
|
|
32319
32471
|
var k = kv.shift();
|
|
32320
32472
|
var v = kv.join("=");
|
|
@@ -32602,6 +32754,7 @@ class Timer {
|
|
|
32602
32754
|
}
|
|
32603
32755
|
}
|
|
32604
32756
|
}
|
|
32757
|
+
|
|
32605
32758
|
const timer = new Timer();
|
|
32606
32759
|
|
|
32607
32760
|
var lastTime = 0;
|
|
@@ -32626,7 +32779,7 @@ if (!requestAnimationFrame || !cancelAnimationFrame) {
|
|
|
32626
32779
|
requestAnimationFrame = function (callback) {
|
|
32627
32780
|
var currTime = globalThis.performance.now();
|
|
32628
32781
|
var timeToCall = Math.max(0, (1000 / timer.maxfps) - (currTime - lastTime));
|
|
32629
|
-
var id = globalThis.setTimeout(
|
|
32782
|
+
var id = globalThis.setTimeout(() => {
|
|
32630
32783
|
callback(currTime + timeToCall);
|
|
32631
32784
|
}, timeToCall);
|
|
32632
32785
|
lastTime = currTime + timeToCall;
|
|
@@ -32894,10 +33047,10 @@ class BasePlugin {
|
|
|
32894
33047
|
* this can be overridden by the plugin
|
|
32895
33048
|
* @public
|
|
32896
33049
|
* @type {string}
|
|
32897
|
-
* @default "
|
|
33050
|
+
* @default "14.0.0"
|
|
32898
33051
|
* @name plugin.Base#version
|
|
32899
33052
|
*/
|
|
32900
|
-
this.version = "
|
|
33053
|
+
this.version = "14.0.0";
|
|
32901
33054
|
}
|
|
32902
33055
|
}
|
|
32903
33056
|
|
|
@@ -33778,7 +33931,7 @@ class Tween {
|
|
|
33778
33931
|
onComplete( onCompleteCallback ) {
|
|
33779
33932
|
this._onCompleteCallback = onCompleteCallback;
|
|
33780
33933
|
return this;
|
|
33781
|
-
}
|
|
33934
|
+
}
|
|
33782
33935
|
|
|
33783
33936
|
/** @ignore */
|
|
33784
33937
|
update( dt ) {
|
|
@@ -34105,9 +34258,11 @@ class TextMetrics extends Bounds {
|
|
|
34105
34258
|
for (var i = 0; i < characters.length; i++) {
|
|
34106
34259
|
var ch = characters[i].charCodeAt(0);
|
|
34107
34260
|
var glyph = this.ancestor.fontData.glyphs[ch];
|
|
34108
|
-
|
|
34109
|
-
|
|
34110
|
-
|
|
34261
|
+
if (typeof glyph !== "undefined") {
|
|
34262
|
+
var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
|
|
34263
|
+
width += (glyph.xadvance + kerning) * this.ancestor.fontScale.x;
|
|
34264
|
+
lastGlyph = glyph;
|
|
34265
|
+
}
|
|
34111
34266
|
}
|
|
34112
34267
|
return width;
|
|
34113
34268
|
}
|
|
@@ -34440,7 +34595,7 @@ class Text extends Renderable {
|
|
|
34440
34595
|
*/
|
|
34441
34596
|
setFont(font, size = 10) {
|
|
34442
34597
|
// font name and type
|
|
34443
|
-
var font_names = font.split(",").map(
|
|
34598
|
+
var font_names = font.split(",").map((value) => {
|
|
34444
34599
|
value = value.trim();
|
|
34445
34600
|
return (
|
|
34446
34601
|
!/(^".*"$)|(^'.*'$)/.test(value)
|
|
@@ -34753,6 +34908,7 @@ class BitmapText extends Renderable {
|
|
|
34753
34908
|
(settings.fontData.includes("info face")) ? settings.fontData : loader.getBinary(settings.fontData)
|
|
34754
34909
|
);
|
|
34755
34910
|
}
|
|
34911
|
+
|
|
34756
34912
|
// if floating was specified through settings
|
|
34757
34913
|
if (typeof settings.floating !== "undefined") {
|
|
34758
34914
|
this.floating = !!settings.floating;
|
|
@@ -34938,25 +35094,32 @@ class BitmapText extends Renderable {
|
|
|
34938
35094
|
// calculate the char index
|
|
34939
35095
|
var ch = string.charCodeAt(c);
|
|
34940
35096
|
var glyph = this.fontData.glyphs[ch];
|
|
34941
|
-
var glyphWidth = glyph.width;
|
|
34942
|
-
var glyphHeight = glyph.height;
|
|
34943
|
-
var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
|
|
34944
|
-
|
|
34945
|
-
// draw it
|
|
34946
|
-
if (glyphWidth !== 0 && glyphHeight !== 0) {
|
|
34947
|
-
// some browser throw an exception when drawing a 0 width or height image
|
|
34948
|
-
renderer.drawImage(this.fontImage,
|
|
34949
|
-
glyph.x, glyph.y,
|
|
34950
|
-
glyphWidth, glyphHeight,
|
|
34951
|
-
x + glyph.xoffset,
|
|
34952
|
-
y + glyph.yoffset * this.fontScale.y,
|
|
34953
|
-
glyphWidth * this.fontScale.x, glyphHeight * this.fontScale.y
|
|
34954
|
-
);
|
|
34955
|
-
}
|
|
34956
35097
|
|
|
34957
|
-
|
|
34958
|
-
|
|
34959
|
-
|
|
35098
|
+
if (typeof glyph !== "undefined") {
|
|
35099
|
+
var glyphWidth = glyph.width;
|
|
35100
|
+
var glyphHeight = glyph.height;
|
|
35101
|
+
var kerning = (lastGlyph && lastGlyph.kerning) ? lastGlyph.getKerning(ch) : 0;
|
|
35102
|
+
var scaleX = this.fontScale.x;
|
|
35103
|
+
var scaleY = this.fontScale.y;
|
|
35104
|
+
|
|
35105
|
+
// draw it
|
|
35106
|
+
if (glyphWidth !== 0 && glyphHeight !== 0) {
|
|
35107
|
+
// some browser throw an exception when drawing a 0 width or height image
|
|
35108
|
+
renderer.drawImage(this.fontImage,
|
|
35109
|
+
glyph.x, glyph.y,
|
|
35110
|
+
glyphWidth, glyphHeight,
|
|
35111
|
+
x + glyph.xoffset * scaleX,
|
|
35112
|
+
y + glyph.yoffset * scaleY,
|
|
35113
|
+
glyphWidth * scaleX, glyphHeight * scaleY
|
|
35114
|
+
);
|
|
35115
|
+
}
|
|
35116
|
+
|
|
35117
|
+
// increment position
|
|
35118
|
+
x += (glyph.xadvance + kerning) * scaleX;
|
|
35119
|
+
lastGlyph = glyph;
|
|
35120
|
+
} else {
|
|
35121
|
+
console.warn("BitmapText: no defined Glyph in for " + String.fromCharCode(ch));
|
|
35122
|
+
}
|
|
34960
35123
|
}
|
|
34961
35124
|
// increment line
|
|
34962
35125
|
y += stringHeight;
|
|
@@ -35060,6 +35223,7 @@ function getValueFromPair(string, pattern) {
|
|
|
35060
35223
|
|
|
35061
35224
|
return value[0].split("=")[1];
|
|
35062
35225
|
}
|
|
35226
|
+
|
|
35063
35227
|
/**
|
|
35064
35228
|
* Gets the first glyph in the map that is not a space character
|
|
35065
35229
|
* @ignore
|
|
@@ -35077,6 +35241,7 @@ function getFirstGlyph(glyphs) {
|
|
|
35077
35241
|
}
|
|
35078
35242
|
return null;
|
|
35079
35243
|
}
|
|
35244
|
+
|
|
35080
35245
|
/**
|
|
35081
35246
|
* Creates a glyph to use for the space character
|
|
35082
35247
|
* @ignore
|
|
@@ -35095,7 +35260,6 @@ function createSpaceGlyph(glyphs) {
|
|
|
35095
35260
|
}
|
|
35096
35261
|
}
|
|
35097
35262
|
|
|
35098
|
-
|
|
35099
35263
|
/**
|
|
35100
35264
|
* Class for storing relevant data from the font file.
|
|
35101
35265
|
* @ignore
|
|
@@ -35827,20 +35991,331 @@ class NineSliceSprite extends Sprite {
|
|
|
35827
35991
|
|
|
35828
35992
|
/**
|
|
35829
35993
|
* @classdesc
|
|
35830
|
-
*
|
|
35831
|
-
*
|
|
35832
|
-
*
|
|
35833
|
-
*
|
|
35994
|
+
* This is a basic clickable container which you can use in your game UI.
|
|
35995
|
+
* Use this for example if you want to display a button which contains
|
|
35996
|
+
* text and images.
|
|
35997
|
+
* @augments Container
|
|
35998
|
+
*/
|
|
35999
|
+
class UIBaseElement extends Container {
|
|
36000
|
+
/**
|
|
36001
|
+
*
|
|
36002
|
+
* @param {number} x The x position of the container
|
|
36003
|
+
* @param {number} y The y position of the container
|
|
36004
|
+
* @param {number} w width of the container (default: viewport width)
|
|
36005
|
+
* @param {number} h height of the container (default: viewport height)
|
|
36006
|
+
*/
|
|
36007
|
+
constructor(x, y, w, h) {
|
|
36008
|
+
super(x, y, w, h);
|
|
36009
|
+
/**
|
|
36010
|
+
* object can be clicked or not
|
|
36011
|
+
* @type {boolean}
|
|
36012
|
+
*/
|
|
36013
|
+
this.isClickable = true;
|
|
36014
|
+
|
|
36015
|
+
/**
|
|
36016
|
+
* Tap and hold threshold timeout in ms
|
|
36017
|
+
* @type {number}
|
|
36018
|
+
* @default 250
|
|
36019
|
+
*/
|
|
36020
|
+
this.holdThreshold = 250;
|
|
36021
|
+
|
|
36022
|
+
/**
|
|
36023
|
+
* object can be tap and hold
|
|
36024
|
+
* @type {boolean}
|
|
36025
|
+
* @default false
|
|
36026
|
+
*/
|
|
36027
|
+
this.isHoldable = false;
|
|
36028
|
+
|
|
36029
|
+
/**
|
|
36030
|
+
* true if the pointer is over the object
|
|
36031
|
+
* @type {boolean}
|
|
36032
|
+
* @default false
|
|
36033
|
+
*/
|
|
36034
|
+
this.hover = false;
|
|
36035
|
+
|
|
36036
|
+
// object has been updated (clicked,etc..)
|
|
36037
|
+
this.holdTimeout = null;
|
|
36038
|
+
this.released = true;
|
|
36039
|
+
|
|
36040
|
+
// GUI items use screen coordinates
|
|
36041
|
+
this.floating = true;
|
|
36042
|
+
|
|
36043
|
+
// enable event detection
|
|
36044
|
+
this.isKinematic = false;
|
|
36045
|
+
}
|
|
36046
|
+
|
|
36047
|
+
/**
|
|
36048
|
+
* function callback for the pointerdown event
|
|
36049
|
+
* @ignore
|
|
36050
|
+
*/
|
|
36051
|
+
clicked(event) {
|
|
36052
|
+
// Check if left mouse button is pressed
|
|
36053
|
+
if (event.button === 0 && this.isClickable) {
|
|
36054
|
+
this.dirty = true;
|
|
36055
|
+
this.released = false;
|
|
36056
|
+
if (this.isHoldable) {
|
|
36057
|
+
if (this.holdTimeout !== null) {
|
|
36058
|
+
timer.clearTimeout(this.holdTimeout);
|
|
36059
|
+
}
|
|
36060
|
+
this.holdTimeout = timer.setTimeout(
|
|
36061
|
+
this.hold.bind(this),
|
|
36062
|
+
this.holdThreshold,
|
|
36063
|
+
false
|
|
36064
|
+
);
|
|
36065
|
+
this.released = false;
|
|
36066
|
+
}
|
|
36067
|
+
return this.onClick(event);
|
|
36068
|
+
}
|
|
36069
|
+
}
|
|
36070
|
+
|
|
36071
|
+
/**
|
|
36072
|
+
* function called when the object is pressed (to be extended)
|
|
36073
|
+
* @param {Pointer} event the event object
|
|
36074
|
+
* @returns {boolean} return false if we need to stop propagating the event
|
|
36075
|
+
*/
|
|
36076
|
+
onClick(event) { // eslint-disable-line no-unused-vars
|
|
36077
|
+
return false;
|
|
36078
|
+
}
|
|
36079
|
+
|
|
36080
|
+
/**
|
|
36081
|
+
* function callback for the pointerEnter event
|
|
36082
|
+
* @ignore
|
|
36083
|
+
*/
|
|
36084
|
+
enter(event) {
|
|
36085
|
+
this.hover = true;
|
|
36086
|
+
this.dirty = true;
|
|
36087
|
+
return this.onOver(event);
|
|
36088
|
+
}
|
|
36089
|
+
|
|
36090
|
+
/**
|
|
36091
|
+
* function called when the pointer is over the object
|
|
36092
|
+
* @param {Pointer} event the event object
|
|
36093
|
+
*/
|
|
36094
|
+
onOver(event) { // eslint-disable-line no-unused-vars
|
|
36095
|
+
// to be extended
|
|
36096
|
+
}
|
|
36097
|
+
|
|
36098
|
+
/**
|
|
36099
|
+
* function callback for the pointerLeave event
|
|
36100
|
+
* @ignore
|
|
36101
|
+
*/
|
|
36102
|
+
leave(event) {
|
|
36103
|
+
this.hover = false;
|
|
36104
|
+
this.dirty = true;
|
|
36105
|
+
this.release(event);
|
|
36106
|
+
return this.onOut(event);
|
|
36107
|
+
}
|
|
36108
|
+
|
|
36109
|
+
/**
|
|
36110
|
+
* function called when the pointer is leaving the object area
|
|
36111
|
+
* @param {Pointer} event the event object
|
|
36112
|
+
*/
|
|
36113
|
+
onOut(event) { // eslint-disable-line no-unused-vars
|
|
36114
|
+
// to be extended
|
|
36115
|
+
}
|
|
36116
|
+
|
|
36117
|
+
/**
|
|
36118
|
+
* function callback for the pointerup event
|
|
36119
|
+
* @ignore
|
|
36120
|
+
*/
|
|
36121
|
+
release(event) {
|
|
36122
|
+
if (this.released === false) {
|
|
36123
|
+
this.released = true;
|
|
36124
|
+
this.dirty = true;
|
|
36125
|
+
timer.clearTimeout(this.holdTimeout);
|
|
36126
|
+
return this.onRelease(event);
|
|
36127
|
+
}
|
|
36128
|
+
}
|
|
36129
|
+
|
|
36130
|
+
/**
|
|
36131
|
+
* function called when the object is pressed and released (to be extended)
|
|
36132
|
+
* @returns {boolean} return false if we need to stop propagating the event
|
|
36133
|
+
*/
|
|
36134
|
+
onRelease() {
|
|
36135
|
+
return false;
|
|
36136
|
+
}
|
|
36137
|
+
|
|
36138
|
+
/**
|
|
36139
|
+
* function callback for the tap and hold timer event
|
|
36140
|
+
* @ignore
|
|
36141
|
+
*/
|
|
36142
|
+
hold() {
|
|
36143
|
+
timer.clearTimeout(this.holdTimeout);
|
|
36144
|
+
this.dirty = true;
|
|
36145
|
+
if (!this.released) {
|
|
36146
|
+
this.onHold();
|
|
36147
|
+
}
|
|
36148
|
+
}
|
|
36149
|
+
|
|
36150
|
+
/**
|
|
36151
|
+
* function called when the object is pressed and held<br>
|
|
36152
|
+
* to be extended <br>
|
|
36153
|
+
*/
|
|
36154
|
+
onHold() {}
|
|
36155
|
+
|
|
36156
|
+
/**
|
|
36157
|
+
* function called when added to the game world or a container
|
|
36158
|
+
* @ignore
|
|
36159
|
+
*/
|
|
36160
|
+
onActivateEvent() {
|
|
36161
|
+
// register pointer events
|
|
36162
|
+
registerPointerEvent(
|
|
36163
|
+
"pointerdown",
|
|
36164
|
+
this,
|
|
36165
|
+
this.clicked.bind(this)
|
|
36166
|
+
);
|
|
36167
|
+
registerPointerEvent("pointerup", this, this.release.bind(this));
|
|
36168
|
+
registerPointerEvent(
|
|
36169
|
+
"pointercancel",
|
|
36170
|
+
this,
|
|
36171
|
+
this.release.bind(this)
|
|
36172
|
+
);
|
|
36173
|
+
registerPointerEvent("pointerenter", this, this.enter.bind(this));
|
|
36174
|
+
registerPointerEvent("pointerleave", this, this.leave.bind(this));
|
|
36175
|
+
}
|
|
36176
|
+
|
|
36177
|
+
/**
|
|
36178
|
+
* function called when removed from the game world or a container
|
|
36179
|
+
* @ignore
|
|
36180
|
+
*/
|
|
36181
|
+
onDeactivateEvent() {
|
|
36182
|
+
// release pointer events
|
|
36183
|
+
releasePointerEvent("pointerdown", this.hitbox);
|
|
36184
|
+
releasePointerEvent("pointerup", this);
|
|
36185
|
+
releasePointerEvent("pointercancel", this);
|
|
36186
|
+
releasePointerEvent("pointerenter", this);
|
|
36187
|
+
releasePointerEvent("pointerleave", this);
|
|
36188
|
+
timer.clearTimeout(this.holdTimeout);
|
|
36189
|
+
}
|
|
36190
|
+
}
|
|
36191
|
+
|
|
36192
|
+
/**
|
|
36193
|
+
* @classdesc
|
|
36194
|
+
* This is a basic base text button which you can use in your Game UI.
|
|
36195
|
+
* @augments UIBaseElement
|
|
36196
|
+
*/
|
|
36197
|
+
class UITextButton extends UIBaseElement {
|
|
36198
|
+
/**
|
|
36199
|
+
* A Text Button with an outlined background border, filled with background color.
|
|
36200
|
+
* It uses a RoundRect as background and changes the background color on hovering over.
|
|
36201
|
+
* The background will be drawn with 0.5 opacity, so that the background of the button is
|
|
36202
|
+
* slightly shining through.
|
|
36203
|
+
* @param {number} x x pos of the button
|
|
36204
|
+
* @param {number} y y pos of the button
|
|
36205
|
+
* @param {string} [settings.font] The name of the BitmapText font to use
|
|
36206
|
+
* @param {number} [settings.size] The scale factor of the font (default: 1)
|
|
36207
|
+
* @param {string} [settings.text] The text to display (default: 'click me')
|
|
36208
|
+
* @param {string} [settings.bindKey] The key to bind the action to (default: none)
|
|
36209
|
+
* @param {string} [settings.backgroundColor] The css value of a background color
|
|
36210
|
+
* @param {string} [settings.hoverColor] The css value of a color to be used if the pointer hovers over the button
|
|
36211
|
+
* @param {string} [settings.borderStrokeColor] The css value of a color to be used to draw the border
|
|
36212
|
+
* @param {boolean} [settings.offScreenCanvas] Weather to use an offScreen canvas or not
|
|
36213
|
+
* @param {string} [settings.fillStyle] The css value of a tint color to be used to tint the text
|
|
36214
|
+
* @param {number} [settings.borderWidth] Width of the button
|
|
36215
|
+
* @param {number} [settings.borderHeight] Height of the button
|
|
36216
|
+
* @example
|
|
36217
|
+
* // Create a new Button
|
|
36218
|
+
* class PlayButton extends BaseTextButton {
|
|
36219
|
+
* constructor(x,y) {
|
|
36220
|
+
* super(x,y, {
|
|
36221
|
+
* font: 'my-font',
|
|
36222
|
+
* text: 'Play',
|
|
36223
|
+
* // if you omit the next two, size is calculated by the size of the text
|
|
36224
|
+
* borderWidth: 200,
|
|
36225
|
+
* borderHeight: 20,
|
|
36226
|
+
* });
|
|
36227
|
+
* }
|
|
36228
|
+
*
|
|
36229
|
+
* onClick(){
|
|
36230
|
+
* state.change(state.PLAY);
|
|
36231
|
+
* }
|
|
36232
|
+
* }
|
|
36233
|
+
*
|
|
36234
|
+
* game.world.addChild(new PlayButton(15,200));
|
|
36235
|
+
*/
|
|
36236
|
+
constructor(x, y, settings) {
|
|
36237
|
+
super(x, y);
|
|
36238
|
+
settings.font = settings.font || "24Outline";
|
|
36239
|
+
settings.size = settings.size || 1;
|
|
36240
|
+
settings.text = settings.text || "<Click Me>";
|
|
36241
|
+
settings.bindKey = settings.bindKey || -1;
|
|
36242
|
+
settings.backgroundColor = settings.backgroundColor || "#00aa00";
|
|
36243
|
+
settings.hoverColor = settings.hoverColor || "#00ff00";
|
|
36244
|
+
settings.borderStrokeColor = settings.borderStrokeColor || "#000000";
|
|
36245
|
+
settings.offScreenCanvas = settings.offScreenCanvas || false;
|
|
36246
|
+
settings.fillStyle = settings.fillStyle || "#ffffff";
|
|
36247
|
+
settings.lineWidth = settings.lineWidth || 1;
|
|
36248
|
+
settings.anchorPoint = settings.anchorPoint || new Vector2d(0, 0);
|
|
36249
|
+
|
|
36250
|
+
let font = new BitmapText(x, y, settings);
|
|
36251
|
+
let dimensions = font.measureText();
|
|
36252
|
+
settings.borderWidth = settings.borderWidth || dimensions.width + 16;
|
|
36253
|
+
settings.borderHeight = settings.borderHeight || dimensions.height + 16;
|
|
36254
|
+
|
|
36255
|
+
let border = new RoundRect(
|
|
36256
|
+
x,
|
|
36257
|
+
y,
|
|
36258
|
+
settings.borderWidth,
|
|
36259
|
+
settings.borderHeight
|
|
36260
|
+
);
|
|
36261
|
+
super.setShape(
|
|
36262
|
+
x,
|
|
36263
|
+
y,
|
|
36264
|
+
border.getBounds().width,
|
|
36265
|
+
border.getBounds().height
|
|
36266
|
+
);
|
|
36267
|
+
|
|
36268
|
+
// build up
|
|
36269
|
+
this.font = font;
|
|
36270
|
+
this.dimensions = dimensions;
|
|
36271
|
+
this.border = border;
|
|
36272
|
+
this.settings = settings;
|
|
36273
|
+
|
|
36274
|
+
// adjust text position
|
|
36275
|
+
this.font.pos.set(
|
|
36276
|
+
Math.round((border.width - dimensions.width) / 2) + this.font.pos.x,
|
|
36277
|
+
Math.round((border.height - dimensions.height) / 2) +
|
|
36278
|
+
this.font.pos.y
|
|
36279
|
+
);
|
|
36280
|
+
}
|
|
36281
|
+
|
|
36282
|
+
draw(renderer) {
|
|
36283
|
+
renderer.setGlobalAlpha(0.5);
|
|
36284
|
+
if (!this.hover) {
|
|
36285
|
+
renderer.setColor(this.settings.backgroundColor);
|
|
36286
|
+
} else {
|
|
36287
|
+
renderer.setColor(this.settings.hoverColor);
|
|
36288
|
+
}
|
|
36289
|
+
|
|
36290
|
+
renderer.fill(this.border);
|
|
36291
|
+
renderer.setGlobalAlpha(1);
|
|
36292
|
+
renderer.setColor(this.settings.borderStrokeColor);
|
|
36293
|
+
renderer.stroke(this.border);
|
|
36294
|
+
|
|
36295
|
+
// fix: supporting tint
|
|
36296
|
+
renderer.setTint(this.font.tint, this.font.getOpacity());
|
|
36297
|
+
this.font.draw(
|
|
36298
|
+
renderer,
|
|
36299
|
+
this.settings.text,
|
|
36300
|
+
this.font.pos.x,
|
|
36301
|
+
this.font.pos.y
|
|
36302
|
+
);
|
|
36303
|
+
}
|
|
36304
|
+
}
|
|
36305
|
+
|
|
36306
|
+
/**
|
|
36307
|
+
* @classdesc
|
|
36308
|
+
* This is a basic sprite based button which you can use in your Game UI.
|
|
35834
36309
|
* @augments Sprite
|
|
35835
36310
|
*/
|
|
35836
|
-
class
|
|
36311
|
+
class UISpriteElement extends Sprite {
|
|
35837
36312
|
/**
|
|
35838
36313
|
* @param {number} x the x coordinate of the GUI Object
|
|
35839
36314
|
* @param {number} y the y coordinate of the GUI Object
|
|
35840
36315
|
* @param {object} settings See {@link Sprite}
|
|
35841
36316
|
* @example
|
|
35842
36317
|
* // create a basic GUI Object
|
|
35843
|
-
* class myButton extends
|
|
36318
|
+
* class myButton extends UISpriteElement {
|
|
35844
36319
|
* constructor(x, y) {
|
|
35845
36320
|
* var settings = {}
|
|
35846
36321
|
* settings.image = "button";
|
|
@@ -35871,10 +36346,8 @@ class GUI_Object extends Sprite {
|
|
|
35871
36346
|
|
|
35872
36347
|
/**
|
|
35873
36348
|
* object can be clicked or not
|
|
35874
|
-
* @public
|
|
35875
36349
|
* @type {boolean}
|
|
35876
36350
|
* @default true
|
|
35877
|
-
* @name GUI_Object#isClickable
|
|
35878
36351
|
*/
|
|
35879
36352
|
this.isClickable = true;
|
|
35880
36353
|
|
|
@@ -35882,25 +36355,20 @@ class GUI_Object extends Sprite {
|
|
|
35882
36355
|
* Tap and hold threshold timeout in ms
|
|
35883
36356
|
* @type {number}
|
|
35884
36357
|
* @default 250
|
|
35885
|
-
* @name GUI_Object#holdThreshold
|
|
35886
36358
|
*/
|
|
35887
36359
|
this.holdThreshold = 250;
|
|
35888
36360
|
|
|
35889
36361
|
/**
|
|
35890
36362
|
* object can be tap and hold
|
|
35891
|
-
* @public
|
|
35892
36363
|
* @type {boolean}
|
|
35893
36364
|
* @default false
|
|
35894
|
-
* @name GUI_Object#isHoldable
|
|
35895
36365
|
*/
|
|
35896
36366
|
this.isHoldable = false;
|
|
35897
36367
|
|
|
35898
36368
|
/**
|
|
35899
36369
|
* true if the pointer is over the object
|
|
35900
|
-
* @public
|
|
35901
36370
|
* @type {boolean}
|
|
35902
36371
|
* @default false
|
|
35903
|
-
* @name GUI_Object#hover
|
|
35904
36372
|
*/
|
|
35905
36373
|
this.hover = false;
|
|
35906
36374
|
|
|
@@ -35937,9 +36405,6 @@ class GUI_Object extends Sprite {
|
|
|
35937
36405
|
|
|
35938
36406
|
/**
|
|
35939
36407
|
* function called when the object is pressed (to be extended)
|
|
35940
|
-
* @name onClick
|
|
35941
|
-
* @memberof GUI_Object
|
|
35942
|
-
* @public
|
|
35943
36408
|
* @param {Pointer} event the event object
|
|
35944
36409
|
* @returns {boolean} return false if we need to stop propagating the event
|
|
35945
36410
|
*/
|
|
@@ -35959,9 +36424,6 @@ class GUI_Object extends Sprite {
|
|
|
35959
36424
|
|
|
35960
36425
|
/**
|
|
35961
36426
|
* function called when the pointer is over the object
|
|
35962
|
-
* @name onOver
|
|
35963
|
-
* @memberof GUI_Object
|
|
35964
|
-
* @public
|
|
35965
36427
|
* @param {Pointer} event the event object
|
|
35966
36428
|
*/
|
|
35967
36429
|
onOver(event) { // eslint-disable-line no-unused-vars
|
|
@@ -35981,9 +36443,6 @@ class GUI_Object extends Sprite {
|
|
|
35981
36443
|
|
|
35982
36444
|
/**
|
|
35983
36445
|
* function called when the pointer is leaving the object area
|
|
35984
|
-
* @name onOut
|
|
35985
|
-
* @memberof GUI_Object
|
|
35986
|
-
* @public
|
|
35987
36446
|
* @param {Pointer} event the event object
|
|
35988
36447
|
*/
|
|
35989
36448
|
onOut(event) { // eslint-disable-line no-unused-vars
|
|
@@ -36005,9 +36464,6 @@ class GUI_Object extends Sprite {
|
|
|
36005
36464
|
|
|
36006
36465
|
/**
|
|
36007
36466
|
* function called when the object is pressed and released (to be extended)
|
|
36008
|
-
* @name onRelease
|
|
36009
|
-
* @memberof GUI_Object
|
|
36010
|
-
* @public
|
|
36011
36467
|
* @returns {boolean} return false if we need to stop propagating the event
|
|
36012
36468
|
*/
|
|
36013
36469
|
onRelease() {
|
|
@@ -36029,9 +36485,6 @@ class GUI_Object extends Sprite {
|
|
|
36029
36485
|
/**
|
|
36030
36486
|
* function called when the object is pressed and held<br>
|
|
36031
36487
|
* to be extended <br>
|
|
36032
|
-
* @name onHold
|
|
36033
|
-
* @memberof GUI_Object
|
|
36034
|
-
* @public
|
|
36035
36488
|
*/
|
|
36036
36489
|
onHold() {}
|
|
36037
36490
|
|
|
@@ -36165,11 +36618,11 @@ class Trigger extends Renderable {
|
|
|
36165
36618
|
event: "level"
|
|
36166
36619
|
};
|
|
36167
36620
|
|
|
36168
|
-
[ "type", "container", "onLoaded", "flatten", "setViewportBounds", "to" ].forEach(
|
|
36621
|
+
[ "type", "container", "onLoaded", "flatten", "setViewportBounds", "to" ].forEach((property) => {
|
|
36169
36622
|
if (typeof settings[property] !== "undefined") {
|
|
36170
36623
|
this.triggerSettings[property] = settings[property];
|
|
36171
36624
|
}
|
|
36172
|
-
}
|
|
36625
|
+
});
|
|
36173
36626
|
|
|
36174
36627
|
// add and configure the physic body
|
|
36175
36628
|
var shape = settings.shapes;
|
|
@@ -36502,6 +36955,7 @@ class Draggable extends Renderable {
|
|
|
36502
36955
|
super.destroy();
|
|
36503
36956
|
}
|
|
36504
36957
|
}
|
|
36958
|
+
|
|
36505
36959
|
/**
|
|
36506
36960
|
* @classdesc
|
|
36507
36961
|
* a base drop target object
|
|
@@ -36925,6 +37379,7 @@ function createDefaultParticleTexture(w = 8, h = 8) {
|
|
|
36925
37379
|
|
|
36926
37380
|
return defaultParticleTexture;
|
|
36927
37381
|
}
|
|
37382
|
+
|
|
36928
37383
|
/**
|
|
36929
37384
|
* @classdesc
|
|
36930
37385
|
* Particle Emitter Object.
|
|
@@ -37612,6 +38067,7 @@ function warning(deprecated, replacement, version) {
|
|
|
37612
38067
|
console.groupEnd();
|
|
37613
38068
|
}
|
|
37614
38069
|
}
|
|
38070
|
+
|
|
37615
38071
|
/**
|
|
37616
38072
|
* Alias of {@link TextureAtlas}
|
|
37617
38073
|
* @public
|
|
@@ -37696,6 +38152,25 @@ Renderer.prototype.getScreenContext = function() {
|
|
|
37696
38152
|
return this.getContext();
|
|
37697
38153
|
};
|
|
37698
38154
|
|
|
38155
|
+
/**
|
|
38156
|
+
* @classdesc
|
|
38157
|
+
* A very basic object to manage GUI elements
|
|
38158
|
+
* @augments Sprite
|
|
38159
|
+
* @deprecated since 14.0.0
|
|
38160
|
+
* @see UISpriteElement
|
|
38161
|
+
*/
|
|
38162
|
+
class GUI_Object extends UISpriteElement {
|
|
38163
|
+
/**
|
|
38164
|
+
* @param {number} x the x coordinate of the GUI Object
|
|
38165
|
+
* @param {number} y the y coordinate of the GUI Object
|
|
38166
|
+
* @param {object} settings See {@link Sprite}
|
|
38167
|
+
*/
|
|
38168
|
+
constructor(x, y, settings) {
|
|
38169
|
+
warning("GUI_Object", "UISpriteElement", "14.0.0");
|
|
38170
|
+
super(x, y, settings);
|
|
38171
|
+
}
|
|
38172
|
+
}
|
|
38173
|
+
|
|
37699
38174
|
// ES5/ES6 polyfills
|
|
37700
38175
|
|
|
37701
38176
|
|
|
@@ -37706,7 +38181,7 @@ Renderer.prototype.getScreenContext = function() {
|
|
|
37706
38181
|
* @name version
|
|
37707
38182
|
* @type {string}
|
|
37708
38183
|
*/
|
|
37709
|
-
const version = "
|
|
38184
|
+
const version = "14.0.0";
|
|
37710
38185
|
|
|
37711
38186
|
|
|
37712
38187
|
/**
|
|
@@ -37812,11 +38287,12 @@ function boot() {
|
|
|
37812
38287
|
// mark melonJS as initialized
|
|
37813
38288
|
initialized = true;
|
|
37814
38289
|
}
|
|
38290
|
+
|
|
37815
38291
|
// call the library init function when ready
|
|
37816
|
-
onReady(
|
|
38292
|
+
onReady(() => {
|
|
37817
38293
|
{
|
|
37818
38294
|
boot();
|
|
37819
38295
|
}
|
|
37820
38296
|
});
|
|
37821
38297
|
|
|
37822
|
-
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 };
|
|
38298
|
+
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 };
|