melonjs 10.9.0 → 10.10.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/LICENSE.md +1 -1
- package/README.md +29 -23
- package/dist/melonjs.js +812 -485
- package/dist/melonjs.min.js +4 -4
- package/dist/melonjs.module.d.ts +413 -230
- package/dist/melonjs.module.js +751 -437
- package/package.json +13 -10
- package/src/game.js +2 -2
- package/src/geometries/ellipse.js +16 -16
- package/src/geometries/line.js +4 -4
- package/src/geometries/path2d.js +10 -10
- package/src/geometries/poly.js +23 -23
- package/src/geometries/rectangle.js +22 -22
- package/src/geometries/roundrect.js +6 -6
- package/src/index.js +7 -1
- package/src/lang/deprecated.js +7 -5
- package/src/level/tiled/TMXUtils.js +1 -1
- package/src/loader/loadingscreen.js +16 -5
- package/src/math/color.js +5 -4
- package/src/particles/emitter.js +11 -12
- package/src/renderable/GUI.js +5 -5
- package/src/renderable/container.js +26 -26
- package/src/renderable/imagelayer.js +2 -2
- package/src/renderable/light2d.js +115 -0
- package/src/renderable/renderable.js +21 -20
- package/src/renderable/sprite.js +13 -13
- package/src/state/stage.js +72 -2
- package/src/text/text.js +13 -17
- package/src/video/canvas/canvas_renderer.js +69 -51
- package/src/video/renderer.js +33 -26
- package/src/video/{texture.js → texture/atlas.js} +8 -8
- package/src/video/{texture_cache.js → texture/cache.js} +4 -4
- package/src/video/texture/canvas_texture.js +87 -0
- package/src/video/webgl/webgl_renderer.js +73 -55
package/dist/melonjs.module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* melonJS Game Engine - v10.
|
|
2
|
+
* melonJS Game Engine - v10.10.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
|
|
@@ -12,7 +12,7 @@ var check = function (it) {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
15
|
-
var global$
|
|
15
|
+
var global$b =
|
|
16
16
|
// eslint-disable-next-line es-x/no-global-this -- safe
|
|
17
17
|
check(typeof globalThis == 'object' && globalThis) ||
|
|
18
18
|
check(typeof window == 'object' && window) ||
|
|
@@ -106,31 +106,28 @@ var classofRaw = function (it) {
|
|
|
106
106
|
return stringSlice(toString$2(it), 8, -1);
|
|
107
107
|
};
|
|
108
108
|
|
|
109
|
-
var global$l = global$m;
|
|
110
109
|
var uncurryThis$7 = functionUncurryThis;
|
|
111
110
|
var fails$5 = fails$8;
|
|
112
111
|
var classof = classofRaw;
|
|
113
112
|
|
|
114
|
-
var Object$
|
|
113
|
+
var $Object$2 = Object;
|
|
115
114
|
var split = uncurryThis$7(''.split);
|
|
116
115
|
|
|
117
116
|
// fallback for non-array-like ES3 and non-enumerable old V8 strings
|
|
118
117
|
var indexedObject = fails$5(function () {
|
|
119
118
|
// throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
|
|
120
119
|
// eslint-disable-next-line no-prototype-builtins -- safe
|
|
121
|
-
return
|
|
120
|
+
return !$Object$2('z').propertyIsEnumerable(0);
|
|
122
121
|
}) ? function (it) {
|
|
123
|
-
return classof(it) == 'String' ? split(it, '') : Object$
|
|
124
|
-
} : Object$
|
|
122
|
+
return classof(it) == 'String' ? split(it, '') : $Object$2(it);
|
|
123
|
+
} : $Object$2;
|
|
125
124
|
|
|
126
|
-
var
|
|
127
|
-
|
|
128
|
-
var TypeError$7 = global$k.TypeError;
|
|
125
|
+
var $TypeError$5 = TypeError;
|
|
129
126
|
|
|
130
127
|
// `RequireObjectCoercible` abstract operation
|
|
131
128
|
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
132
129
|
var requireObjectCoercible$2 = function (it) {
|
|
133
|
-
if (it == undefined) throw TypeError$
|
|
130
|
+
if (it == undefined) throw $TypeError$5("Can't call method on " + it);
|
|
134
131
|
return it;
|
|
135
132
|
};
|
|
136
133
|
|
|
@@ -154,7 +151,7 @@ var isObject$5 = function (it) {
|
|
|
154
151
|
return typeof it == 'object' ? it !== null : isCallable$9(it);
|
|
155
152
|
};
|
|
156
153
|
|
|
157
|
-
var global$
|
|
154
|
+
var global$a = global$b;
|
|
158
155
|
var isCallable$8 = isCallable$a;
|
|
159
156
|
|
|
160
157
|
var aFunction = function (argument) {
|
|
@@ -162,7 +159,7 @@ var aFunction = function (argument) {
|
|
|
162
159
|
};
|
|
163
160
|
|
|
164
161
|
var getBuiltIn$3 = function (namespace, method) {
|
|
165
|
-
return arguments.length < 2 ? aFunction(global$
|
|
162
|
+
return arguments.length < 2 ? aFunction(global$a[namespace]) : global$a[namespace] && global$a[namespace][method];
|
|
166
163
|
};
|
|
167
164
|
|
|
168
165
|
var uncurryThis$6 = functionUncurryThis;
|
|
@@ -173,11 +170,11 @@ var getBuiltIn$2 = getBuiltIn$3;
|
|
|
173
170
|
|
|
174
171
|
var engineUserAgent = getBuiltIn$2('navigator', 'userAgent') || '';
|
|
175
172
|
|
|
176
|
-
var global$
|
|
173
|
+
var global$9 = global$b;
|
|
177
174
|
var userAgent = engineUserAgent;
|
|
178
175
|
|
|
179
|
-
var process$1 = global$
|
|
180
|
-
var Deno = global$
|
|
176
|
+
var process$1 = global$9.process;
|
|
177
|
+
var Deno = global$9.Deno;
|
|
181
178
|
var versions = process$1 && process$1.versions || Deno && Deno.version;
|
|
182
179
|
var v8 = versions && versions.v8;
|
|
183
180
|
var match, version$1;
|
|
@@ -224,43 +221,39 @@ var useSymbolAsUid = NATIVE_SYMBOL$1
|
|
|
224
221
|
&& !Symbol.sham
|
|
225
222
|
&& typeof Symbol.iterator == 'symbol';
|
|
226
223
|
|
|
227
|
-
var global$h = global$m;
|
|
228
224
|
var getBuiltIn$1 = getBuiltIn$3;
|
|
229
225
|
var isCallable$7 = isCallable$a;
|
|
230
226
|
var isPrototypeOf = objectIsPrototypeOf;
|
|
231
227
|
var USE_SYMBOL_AS_UID$1 = useSymbolAsUid;
|
|
232
228
|
|
|
233
|
-
var Object$
|
|
229
|
+
var $Object$1 = Object;
|
|
234
230
|
|
|
235
231
|
var isSymbol$2 = USE_SYMBOL_AS_UID$1 ? function (it) {
|
|
236
232
|
return typeof it == 'symbol';
|
|
237
233
|
} : function (it) {
|
|
238
234
|
var $Symbol = getBuiltIn$1('Symbol');
|
|
239
|
-
return isCallable$7($Symbol) && isPrototypeOf($Symbol.prototype, Object$
|
|
235
|
+
return isCallable$7($Symbol) && isPrototypeOf($Symbol.prototype, $Object$1(it));
|
|
240
236
|
};
|
|
241
237
|
|
|
242
|
-
var
|
|
243
|
-
|
|
244
|
-
var String$2 = global$g.String;
|
|
238
|
+
var $String$1 = String;
|
|
245
239
|
|
|
246
240
|
var tryToString$1 = function (argument) {
|
|
247
241
|
try {
|
|
248
|
-
return String$
|
|
242
|
+
return $String$1(argument);
|
|
249
243
|
} catch (error) {
|
|
250
244
|
return 'Object';
|
|
251
245
|
}
|
|
252
246
|
};
|
|
253
247
|
|
|
254
|
-
var global$f = global$m;
|
|
255
248
|
var isCallable$6 = isCallable$a;
|
|
256
249
|
var tryToString = tryToString$1;
|
|
257
250
|
|
|
258
|
-
var TypeError$
|
|
251
|
+
var $TypeError$4 = TypeError;
|
|
259
252
|
|
|
260
253
|
// `Assert: IsCallable(argument) is true`
|
|
261
254
|
var aCallable$1 = function (argument) {
|
|
262
255
|
if (isCallable$6(argument)) return argument;
|
|
263
|
-
throw TypeError$
|
|
256
|
+
throw $TypeError$4(tryToString(argument) + ' is not a function');
|
|
264
257
|
};
|
|
265
258
|
|
|
266
259
|
var aCallable = aCallable$1;
|
|
@@ -272,12 +265,11 @@ var getMethod$1 = function (V, P) {
|
|
|
272
265
|
return func == null ? undefined : aCallable(func);
|
|
273
266
|
};
|
|
274
267
|
|
|
275
|
-
var global$e = global$m;
|
|
276
268
|
var call$2 = functionCall;
|
|
277
269
|
var isCallable$5 = isCallable$a;
|
|
278
270
|
var isObject$4 = isObject$5;
|
|
279
271
|
|
|
280
|
-
var TypeError$
|
|
272
|
+
var $TypeError$3 = TypeError;
|
|
281
273
|
|
|
282
274
|
// `OrdinaryToPrimitive` abstract operation
|
|
283
275
|
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
@@ -286,29 +278,29 @@ var ordinaryToPrimitive$1 = function (input, pref) {
|
|
|
286
278
|
if (pref === 'string' && isCallable$5(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
|
|
287
279
|
if (isCallable$5(fn = input.valueOf) && !isObject$4(val = call$2(fn, input))) return val;
|
|
288
280
|
if (pref !== 'string' && isCallable$5(fn = input.toString) && !isObject$4(val = call$2(fn, input))) return val;
|
|
289
|
-
throw TypeError$
|
|
281
|
+
throw $TypeError$3("Can't convert object to primitive value");
|
|
290
282
|
};
|
|
291
283
|
|
|
292
284
|
var shared$3 = {exports: {}};
|
|
293
285
|
|
|
294
|
-
var global$
|
|
286
|
+
var global$8 = global$b;
|
|
295
287
|
|
|
296
288
|
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
297
289
|
var defineProperty$1 = Object.defineProperty;
|
|
298
290
|
|
|
299
|
-
var
|
|
291
|
+
var defineGlobalProperty$3 = function (key, value) {
|
|
300
292
|
try {
|
|
301
|
-
defineProperty$1(global$
|
|
293
|
+
defineProperty$1(global$8, key, { value: value, configurable: true, writable: true });
|
|
302
294
|
} catch (error) {
|
|
303
|
-
global$
|
|
295
|
+
global$8[key] = value;
|
|
304
296
|
} return value;
|
|
305
297
|
};
|
|
306
298
|
|
|
307
|
-
var global$
|
|
308
|
-
var
|
|
299
|
+
var global$7 = global$b;
|
|
300
|
+
var defineGlobalProperty$2 = defineGlobalProperty$3;
|
|
309
301
|
|
|
310
302
|
var SHARED = '__core-js_shared__';
|
|
311
|
-
var store$3 = global$
|
|
303
|
+
var store$3 = global$7[SHARED] || defineGlobalProperty$2(SHARED, {});
|
|
312
304
|
|
|
313
305
|
var sharedStore = store$3;
|
|
314
306
|
|
|
@@ -317,22 +309,21 @@ var store$2 = sharedStore;
|
|
|
317
309
|
(shared$3.exports = function (key, value) {
|
|
318
310
|
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
319
311
|
})('versions', []).push({
|
|
320
|
-
version: '3.22.
|
|
312
|
+
version: '3.22.8',
|
|
321
313
|
mode: 'global',
|
|
322
314
|
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
|
|
323
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.22.
|
|
315
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.22.8/LICENSE',
|
|
324
316
|
source: 'https://github.com/zloirock/core-js'
|
|
325
317
|
});
|
|
326
318
|
|
|
327
|
-
var global$b = global$m;
|
|
328
319
|
var requireObjectCoercible = requireObjectCoercible$2;
|
|
329
320
|
|
|
330
|
-
var Object
|
|
321
|
+
var $Object = Object;
|
|
331
322
|
|
|
332
323
|
// `ToObject` abstract operation
|
|
333
324
|
// https://tc39.es/ecma262/#sec-toobject
|
|
334
325
|
var toObject$1 = function (argument) {
|
|
335
|
-
return Object
|
|
326
|
+
return $Object(requireObjectCoercible(argument));
|
|
336
327
|
};
|
|
337
328
|
|
|
338
329
|
var uncurryThis$5 = functionUncurryThis;
|
|
@@ -357,7 +348,7 @@ var uid$2 = function (key) {
|
|
|
357
348
|
return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString$1(++id + postfix, 36);
|
|
358
349
|
};
|
|
359
350
|
|
|
360
|
-
var global$
|
|
351
|
+
var global$6 = global$b;
|
|
361
352
|
var shared$2 = shared$3.exports;
|
|
362
353
|
var hasOwn$6 = hasOwnProperty_1;
|
|
363
354
|
var uid$1 = uid$2;
|
|
@@ -365,7 +356,7 @@ var NATIVE_SYMBOL = nativeSymbol;
|
|
|
365
356
|
var USE_SYMBOL_AS_UID = useSymbolAsUid;
|
|
366
357
|
|
|
367
358
|
var WellKnownSymbolsStore = shared$2('wks');
|
|
368
|
-
var Symbol$1 = global$
|
|
359
|
+
var Symbol$1 = global$6.Symbol;
|
|
369
360
|
var symbolFor = Symbol$1 && Symbol$1['for'];
|
|
370
361
|
var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol$1 : Symbol$1 && Symbol$1.withoutSetter || uid$1;
|
|
371
362
|
|
|
@@ -382,7 +373,6 @@ var wellKnownSymbol$1 = function (name) {
|
|
|
382
373
|
} return WellKnownSymbolsStore[name];
|
|
383
374
|
};
|
|
384
375
|
|
|
385
|
-
var global$9 = global$m;
|
|
386
376
|
var call$1 = functionCall;
|
|
387
377
|
var isObject$3 = isObject$5;
|
|
388
378
|
var isSymbol$1 = isSymbol$2;
|
|
@@ -390,7 +380,7 @@ var getMethod = getMethod$1;
|
|
|
390
380
|
var ordinaryToPrimitive = ordinaryToPrimitive$1;
|
|
391
381
|
var wellKnownSymbol = wellKnownSymbol$1;
|
|
392
382
|
|
|
393
|
-
var TypeError$
|
|
383
|
+
var $TypeError$2 = TypeError;
|
|
394
384
|
var TO_PRIMITIVE = wellKnownSymbol('toPrimitive');
|
|
395
385
|
|
|
396
386
|
// `ToPrimitive` abstract operation
|
|
@@ -403,7 +393,7 @@ var toPrimitive$1 = function (input, pref) {
|
|
|
403
393
|
if (pref === undefined) pref = 'default';
|
|
404
394
|
result = call$1(exoticToPrim, input, pref);
|
|
405
395
|
if (!isObject$3(result) || isSymbol$1(result)) return result;
|
|
406
|
-
throw TypeError$
|
|
396
|
+
throw $TypeError$2("Can't convert object to primitive value");
|
|
407
397
|
}
|
|
408
398
|
if (pref === undefined) pref = 'number';
|
|
409
399
|
return ordinaryToPrimitive(input, pref);
|
|
@@ -419,10 +409,10 @@ var toPropertyKey$2 = function (argument) {
|
|
|
419
409
|
return isSymbol(key) ? key : key + '';
|
|
420
410
|
};
|
|
421
411
|
|
|
422
|
-
var global$
|
|
412
|
+
var global$5 = global$b;
|
|
423
413
|
var isObject$2 = isObject$5;
|
|
424
414
|
|
|
425
|
-
var document$1 = global$
|
|
415
|
+
var document$1 = global$5.document;
|
|
426
416
|
// typeof document.createElement is 'object' in old IE
|
|
427
417
|
var EXISTS$1 = isObject$2(document$1) && isObject$2(document$1.createElement);
|
|
428
418
|
|
|
@@ -480,26 +470,24 @@ var v8PrototypeDefineBug = DESCRIPTORS$4 && fails$2(function () {
|
|
|
480
470
|
}).prototype != 42;
|
|
481
471
|
});
|
|
482
472
|
|
|
483
|
-
var global$7 = global$m;
|
|
484
473
|
var isObject$1 = isObject$5;
|
|
485
474
|
|
|
486
|
-
var String
|
|
487
|
-
var TypeError$
|
|
475
|
+
var $String = String;
|
|
476
|
+
var $TypeError$1 = TypeError;
|
|
488
477
|
|
|
489
478
|
// `Assert: Type(argument) is Object`
|
|
490
479
|
var anObject$2 = function (argument) {
|
|
491
480
|
if (isObject$1(argument)) return argument;
|
|
492
|
-
throw TypeError$
|
|
481
|
+
throw $TypeError$1($String(argument) + ' is not an object');
|
|
493
482
|
};
|
|
494
483
|
|
|
495
|
-
var global$6 = global$m;
|
|
496
484
|
var DESCRIPTORS$3 = descriptors;
|
|
497
485
|
var IE8_DOM_DEFINE = ie8DomDefine;
|
|
498
486
|
var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
|
|
499
487
|
var anObject$1 = anObject$2;
|
|
500
488
|
var toPropertyKey = toPropertyKey$2;
|
|
501
489
|
|
|
502
|
-
var TypeError
|
|
490
|
+
var $TypeError = TypeError;
|
|
503
491
|
// eslint-disable-next-line es-x/no-object-defineproperty -- safe
|
|
504
492
|
var $defineProperty = Object.defineProperty;
|
|
505
493
|
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
|
|
@@ -532,7 +520,7 @@ objectDefineProperty.f = DESCRIPTORS$3 ? V8_PROTOTYPE_DEFINE_BUG ? function defi
|
|
|
532
520
|
if (IE8_DOM_DEFINE) try {
|
|
533
521
|
return $defineProperty(O, P, Attributes);
|
|
534
522
|
} catch (error) { /* empty */ }
|
|
535
|
-
if ('get' in Attributes || 'set' in Attributes) throw TypeError
|
|
523
|
+
if ('get' in Attributes || 'set' in Attributes) throw $TypeError('Accessors not supported');
|
|
536
524
|
if ('value' in Attributes) O[P] = Attributes.value;
|
|
537
525
|
return O;
|
|
538
526
|
};
|
|
@@ -583,11 +571,11 @@ if (!isCallable$4(store$1.inspectSource)) {
|
|
|
583
571
|
|
|
584
572
|
var inspectSource$2 = store$1.inspectSource;
|
|
585
573
|
|
|
586
|
-
var global$
|
|
574
|
+
var global$4 = global$b;
|
|
587
575
|
var isCallable$3 = isCallable$a;
|
|
588
576
|
var inspectSource$1 = inspectSource$2;
|
|
589
577
|
|
|
590
|
-
var WeakMap$1 = global$
|
|
578
|
+
var WeakMap$1 = global$4.WeakMap;
|
|
591
579
|
|
|
592
580
|
var nativeWeakMap = isCallable$3(WeakMap$1) && /native code/.test(inspectSource$1(WeakMap$1));
|
|
593
581
|
|
|
@@ -603,7 +591,7 @@ var sharedKey$1 = function (key) {
|
|
|
603
591
|
var hiddenKeys$3 = {};
|
|
604
592
|
|
|
605
593
|
var NATIVE_WEAK_MAP = nativeWeakMap;
|
|
606
|
-
var global$
|
|
594
|
+
var global$3 = global$b;
|
|
607
595
|
var uncurryThis$2 = functionUncurryThis;
|
|
608
596
|
var isObject = isObject$5;
|
|
609
597
|
var createNonEnumerableProperty$2 = createNonEnumerableProperty$3;
|
|
@@ -613,8 +601,8 @@ var sharedKey = sharedKey$1;
|
|
|
613
601
|
var hiddenKeys$2 = hiddenKeys$3;
|
|
614
602
|
|
|
615
603
|
var OBJECT_ALREADY_INITIALIZED = 'Object already initialized';
|
|
616
|
-
var TypeError$1 = global$
|
|
617
|
-
var WeakMap = global$
|
|
604
|
+
var TypeError$1 = global$3.TypeError;
|
|
605
|
+
var WeakMap = global$3.WeakMap;
|
|
618
606
|
var set, get, has;
|
|
619
607
|
|
|
620
608
|
var enforce = function (it) {
|
|
@@ -703,11 +691,12 @@ var makeBuiltIn$1 = makeBuiltIn$2.exports = function (value, name, options) {
|
|
|
703
691
|
if (CONFIGURABLE_LENGTH && options && hasOwn$2(options, 'arity') && value.length !== options.arity) {
|
|
704
692
|
defineProperty(value, 'length', { value: options.arity });
|
|
705
693
|
}
|
|
706
|
-
|
|
707
|
-
if (
|
|
708
|
-
defineProperty(value, 'prototype', { writable: false });
|
|
709
|
-
|
|
710
|
-
|
|
694
|
+
try {
|
|
695
|
+
if (options && hasOwn$2(options, 'constructor') && options.constructor) {
|
|
696
|
+
if (DESCRIPTORS) defineProperty(value, 'prototype', { writable: false });
|
|
697
|
+
// in V8 ~ Chrome 53, prototypes of some methods, like `Array.prototype.values`, are non-writable
|
|
698
|
+
} else if (value.prototype) value.prototype = undefined;
|
|
699
|
+
} catch (error) { /* empty */ }
|
|
711
700
|
var state = enforceInternalState(value);
|
|
712
701
|
if (!hasOwn$2(state, 'source')) {
|
|
713
702
|
state.source = TEMPLATE.join(typeof name == 'string' ? name : '');
|
|
@@ -720,30 +709,25 @@ Function.prototype.toString = makeBuiltIn$1(function toString() {
|
|
|
720
709
|
return isCallable$2(this) && getInternalState(this).source || inspectSource(this);
|
|
721
710
|
}, 'toString');
|
|
722
711
|
|
|
723
|
-
var global$3 = global$m;
|
|
724
712
|
var isCallable$1 = isCallable$a;
|
|
725
713
|
var createNonEnumerableProperty$1 = createNonEnumerableProperty$3;
|
|
726
714
|
var makeBuiltIn = makeBuiltIn$2.exports;
|
|
727
|
-
var
|
|
715
|
+
var defineGlobalProperty$1 = defineGlobalProperty$3;
|
|
728
716
|
|
|
729
717
|
var defineBuiltIn$1 = function (O, key, value, options) {
|
|
730
|
-
|
|
731
|
-
var simple = options
|
|
732
|
-
var
|
|
733
|
-
var name = options && options.name !== undefined ? options.name : key;
|
|
718
|
+
if (!options) options = {};
|
|
719
|
+
var simple = options.enumerable;
|
|
720
|
+
var name = options.name !== undefined ? options.name : key;
|
|
734
721
|
if (isCallable$1(value)) makeBuiltIn(value, name, options);
|
|
735
|
-
if (
|
|
722
|
+
if (options.global) {
|
|
736
723
|
if (simple) O[key] = value;
|
|
737
|
-
else
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
}
|
|
744
|
-
if (simple) O[key] = value;
|
|
745
|
-
else createNonEnumerableProperty$1(O, key, value);
|
|
746
|
-
return O;
|
|
724
|
+
else defineGlobalProperty$1(key, value);
|
|
725
|
+
} else {
|
|
726
|
+
if (!options.unsafe) delete O[key];
|
|
727
|
+
else if (O[key]) simple = true;
|
|
728
|
+
if (simple) O[key] = value;
|
|
729
|
+
else createNonEnumerableProperty$1(O, key, value);
|
|
730
|
+
} return O;
|
|
747
731
|
};
|
|
748
732
|
|
|
749
733
|
var objectGetOwnPropertyNames = {};
|
|
@@ -751,12 +735,22 @@ var objectGetOwnPropertyNames = {};
|
|
|
751
735
|
var ceil = Math.ceil;
|
|
752
736
|
var floor = Math.floor;
|
|
753
737
|
|
|
738
|
+
// `Math.trunc` method
|
|
739
|
+
// https://tc39.es/ecma262/#sec-math.trunc
|
|
740
|
+
// eslint-disable-next-line es-x/no-math-trunc -- safe
|
|
741
|
+
var mathTrunc = Math.trunc || function trunc(x) {
|
|
742
|
+
var n = +x;
|
|
743
|
+
return (n > 0 ? floor : ceil)(n);
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
var trunc = mathTrunc;
|
|
747
|
+
|
|
754
748
|
// `ToIntegerOrInfinity` abstract operation
|
|
755
749
|
// https://tc39.es/ecma262/#sec-tointegerorinfinity
|
|
756
750
|
var toIntegerOrInfinity$2 = function (argument) {
|
|
757
751
|
var number = +argument;
|
|
758
|
-
// eslint-disable-next-line no-self-compare --
|
|
759
|
-
return number !== number || number === 0 ? 0 : (number
|
|
752
|
+
// eslint-disable-next-line no-self-compare -- NaN check
|
|
753
|
+
return number !== number || number === 0 ? 0 : trunc(number);
|
|
760
754
|
};
|
|
761
755
|
|
|
762
756
|
var toIntegerOrInfinity$1 = toIntegerOrInfinity$2;
|
|
@@ -927,28 +921,28 @@ var POLYFILL = isForced$1.POLYFILL = 'P';
|
|
|
927
921
|
|
|
928
922
|
var isForced_1 = isForced$1;
|
|
929
923
|
|
|
930
|
-
var global$2 = global$
|
|
924
|
+
var global$2 = global$b;
|
|
931
925
|
var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
|
932
926
|
var createNonEnumerableProperty = createNonEnumerableProperty$3;
|
|
933
927
|
var defineBuiltIn = defineBuiltIn$1;
|
|
934
|
-
var
|
|
928
|
+
var defineGlobalProperty = defineGlobalProperty$3;
|
|
935
929
|
var copyConstructorProperties = copyConstructorProperties$1;
|
|
936
930
|
var isForced = isForced_1;
|
|
937
931
|
|
|
938
932
|
/*
|
|
939
|
-
options.target
|
|
940
|
-
options.global
|
|
941
|
-
options.stat
|
|
942
|
-
options.proto
|
|
943
|
-
options.real
|
|
944
|
-
options.forced
|
|
945
|
-
options.bind
|
|
946
|
-
options.wrap
|
|
947
|
-
options.unsafe
|
|
948
|
-
options.sham
|
|
949
|
-
options.enumerable
|
|
950
|
-
options.
|
|
951
|
-
options.name
|
|
933
|
+
options.target - name of the target object
|
|
934
|
+
options.global - target is the global object
|
|
935
|
+
options.stat - export as static methods of target
|
|
936
|
+
options.proto - export as prototype methods of target
|
|
937
|
+
options.real - real prototype method for the `pure` version
|
|
938
|
+
options.forced - export even if the native feature is available
|
|
939
|
+
options.bind - bind methods to the target, required for the `pure` version
|
|
940
|
+
options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
|
|
941
|
+
options.unsafe - use the simple assignment of property instead of delete + defineProperty
|
|
942
|
+
options.sham - add a flag to not completely full polyfills
|
|
943
|
+
options.enumerable - export as enumerable property
|
|
944
|
+
options.dontCallGetSet - prevent calling a getter on target
|
|
945
|
+
options.name - the .name of the function if it does not match the key
|
|
952
946
|
*/
|
|
953
947
|
var _export = function (options, source) {
|
|
954
948
|
var TARGET = options.target;
|
|
@@ -958,13 +952,13 @@ var _export = function (options, source) {
|
|
|
958
952
|
if (GLOBAL) {
|
|
959
953
|
target = global$2;
|
|
960
954
|
} else if (STATIC) {
|
|
961
|
-
target = global$2[TARGET] ||
|
|
955
|
+
target = global$2[TARGET] || defineGlobalProperty(TARGET, {});
|
|
962
956
|
} else {
|
|
963
957
|
target = (global$2[TARGET] || {}).prototype;
|
|
964
958
|
}
|
|
965
959
|
if (target) for (key in source) {
|
|
966
960
|
sourceProperty = source[key];
|
|
967
|
-
if (options.
|
|
961
|
+
if (options.dontCallGetSet) {
|
|
968
962
|
descriptor = getOwnPropertyDescriptor(target, key);
|
|
969
963
|
targetProperty = descriptor && descriptor.value;
|
|
970
964
|
} else targetProperty = target[key];
|
|
@@ -983,7 +977,7 @@ var _export = function (options, source) {
|
|
|
983
977
|
};
|
|
984
978
|
|
|
985
979
|
var $ = _export;
|
|
986
|
-
var global$1 = global$
|
|
980
|
+
var global$1 = global$b;
|
|
987
981
|
|
|
988
982
|
// `globalThis` object
|
|
989
983
|
// https://tc39.es/ecma262/#sec-globalthis
|
|
@@ -2871,11 +2865,11 @@ class Color {
|
|
|
2871
2865
|
* @function
|
|
2872
2866
|
* @returns {string}
|
|
2873
2867
|
*/
|
|
2874
|
-
toHex8() {
|
|
2868
|
+
toHex8(alpha = this.alpha) {
|
|
2875
2869
|
// TODO : Memoize this function by caching its result until any of
|
|
2876
2870
|
// the r,g,b,a values are changed
|
|
2877
2871
|
|
|
2878
|
-
return "#" + toHex(this.r) + toHex(this.g) + toHex(this.b) + toHex(
|
|
2872
|
+
return "#" + toHex(this.r) + toHex(this.g) + toHex(this.b) + toHex(alpha * 255);
|
|
2879
2873
|
}
|
|
2880
2874
|
|
|
2881
2875
|
/**
|
|
@@ -2901,9 +2895,10 @@ class Color {
|
|
|
2901
2895
|
* @name toRGBA
|
|
2902
2896
|
* @memberof Color
|
|
2903
2897
|
* @function
|
|
2898
|
+
* @param {number} [alpha=1.0] alpha value [0.0 .. 1.0]
|
|
2904
2899
|
* @returns {string}
|
|
2905
2900
|
*/
|
|
2906
|
-
toRGBA() {
|
|
2901
|
+
toRGBA(alpha = this.alpha) {
|
|
2907
2902
|
// TODO : Memoize this function by caching its result until any of
|
|
2908
2903
|
// the r,g,b,a values are changed
|
|
2909
2904
|
|
|
@@ -2911,7 +2906,7 @@ class Color {
|
|
|
2911
2906
|
this.r + "," +
|
|
2912
2907
|
this.g + "," +
|
|
2913
2908
|
this.b + "," +
|
|
2914
|
-
|
|
2909
|
+
alpha +
|
|
2915
2910
|
")";
|
|
2916
2911
|
}
|
|
2917
2912
|
}
|
|
@@ -10512,7 +10507,7 @@ class Polygon {
|
|
|
10512
10507
|
* @public
|
|
10513
10508
|
* @type {Vector2d}
|
|
10514
10509
|
* @name pos
|
|
10515
|
-
* @memberof Polygon
|
|
10510
|
+
* @memberof Polygon
|
|
10516
10511
|
*/
|
|
10517
10512
|
this.pos = pool$1.pull("Vector2d");
|
|
10518
10513
|
|
|
@@ -10521,7 +10516,7 @@ class Polygon {
|
|
|
10521
10516
|
* @ignore
|
|
10522
10517
|
* @type {Bounds}
|
|
10523
10518
|
* @name _bounds
|
|
10524
|
-
* @memberof Polygon
|
|
10519
|
+
* @memberof Polygon
|
|
10525
10520
|
*/
|
|
10526
10521
|
this._bounds;
|
|
10527
10522
|
|
|
@@ -10531,7 +10526,7 @@ class Polygon {
|
|
|
10531
10526
|
* @public
|
|
10532
10527
|
* @type {Vector2d[]}
|
|
10533
10528
|
* @name points
|
|
10534
|
-
* @memberof Polygon
|
|
10529
|
+
* @memberof Polygon
|
|
10535
10530
|
*/
|
|
10536
10531
|
this.points = [];
|
|
10537
10532
|
|
|
@@ -10570,7 +10565,7 @@ class Polygon {
|
|
|
10570
10565
|
/**
|
|
10571
10566
|
* set new value to the Polygon
|
|
10572
10567
|
* @name setShape
|
|
10573
|
-
* @memberof Polygon
|
|
10568
|
+
* @memberof Polygon
|
|
10574
10569
|
* @function
|
|
10575
10570
|
* @param {number} x position of the Polygon
|
|
10576
10571
|
* @param {number} y position of the Polygon
|
|
@@ -10586,7 +10581,7 @@ class Polygon {
|
|
|
10586
10581
|
/**
|
|
10587
10582
|
* set the vertices defining this Polygon
|
|
10588
10583
|
* @name setVertices
|
|
10589
|
-
* @memberof Polygon
|
|
10584
|
+
* @memberof Polygon
|
|
10590
10585
|
* @function
|
|
10591
10586
|
* @param {Vector2d[]} vertices array of vector or vertice defining the Polygon
|
|
10592
10587
|
* @returns {Polygon} this instance for objecf chaining
|
|
@@ -10626,7 +10621,7 @@ class Polygon {
|
|
|
10626
10621
|
/**
|
|
10627
10622
|
* apply the given transformation matrix to this Polygon
|
|
10628
10623
|
* @name transform
|
|
10629
|
-
* @memberof Polygon
|
|
10624
|
+
* @memberof Polygon
|
|
10630
10625
|
* @function
|
|
10631
10626
|
* @param {Matrix2d} m the transformation matrix
|
|
10632
10627
|
* @returns {Polygon} Reference to this object for method chaining
|
|
@@ -10645,7 +10640,7 @@ class Polygon {
|
|
|
10645
10640
|
/**
|
|
10646
10641
|
* apply an isometric projection to this shape
|
|
10647
10642
|
* @name toIso
|
|
10648
|
-
* @memberof Polygon
|
|
10643
|
+
* @memberof Polygon
|
|
10649
10644
|
* @function
|
|
10650
10645
|
* @returns {Polygon} Reference to this object for method chaining
|
|
10651
10646
|
*/
|
|
@@ -10656,7 +10651,7 @@ class Polygon {
|
|
|
10656
10651
|
/**
|
|
10657
10652
|
* apply a 2d projection to this shape
|
|
10658
10653
|
* @name to2d
|
|
10659
|
-
* @memberof Polygon
|
|
10654
|
+
* @memberof Polygon
|
|
10660
10655
|
* @function
|
|
10661
10656
|
* @returns {Polygon} Reference to this object for method chaining
|
|
10662
10657
|
*/
|
|
@@ -10667,7 +10662,7 @@ class Polygon {
|
|
|
10667
10662
|
/**
|
|
10668
10663
|
* Rotate this Polygon (counter-clockwise) by the specified angle (in radians).
|
|
10669
10664
|
* @name rotate
|
|
10670
|
-
* @memberof Polygon
|
|
10665
|
+
* @memberof Polygon
|
|
10671
10666
|
* @function
|
|
10672
10667
|
* @param {number} angle The angle to rotate (in radians)
|
|
10673
10668
|
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
|
|
@@ -10689,7 +10684,7 @@ class Polygon {
|
|
|
10689
10684
|
/**
|
|
10690
10685
|
* Scale this Polygon by the given scalar.
|
|
10691
10686
|
* @name scale
|
|
10692
|
-
* @memberof Polygon
|
|
10687
|
+
* @memberof Polygon
|
|
10693
10688
|
* @function
|
|
10694
10689
|
* @param {number} x
|
|
10695
10690
|
* @param {number} [y=x]
|
|
@@ -10711,7 +10706,7 @@ class Polygon {
|
|
|
10711
10706
|
/**
|
|
10712
10707
|
* Scale this Polygon by the given vector
|
|
10713
10708
|
* @name scaleV
|
|
10714
|
-
* @memberof Polygon
|
|
10709
|
+
* @memberof Polygon
|
|
10715
10710
|
* @function
|
|
10716
10711
|
* @param {Vector2d} v
|
|
10717
10712
|
* @returns {Polygon} Reference to this object for method chaining
|
|
@@ -10724,7 +10719,7 @@ class Polygon {
|
|
|
10724
10719
|
* Computes the calculated collision polygon.
|
|
10725
10720
|
* This **must** be called if the `points` array, `angle`, or `offset` is modified manually.
|
|
10726
10721
|
* @name recalc
|
|
10727
|
-
* @memberof Polygon
|
|
10722
|
+
* @memberof Polygon
|
|
10728
10723
|
* @function
|
|
10729
10724
|
* @returns {Polygon} Reference to this object for method chaining
|
|
10730
10725
|
*/
|
|
@@ -10768,7 +10763,7 @@ class Polygon {
|
|
|
10768
10763
|
/**
|
|
10769
10764
|
* returns a list of indices for all triangles defined in this polygon
|
|
10770
10765
|
* @name getIndices
|
|
10771
|
-
* @memberof Polygon
|
|
10766
|
+
* @memberof Polygon
|
|
10772
10767
|
* @function
|
|
10773
10768
|
* @returns {Array} an array of vertex indices for all triangles forming this polygon.
|
|
10774
10769
|
*/
|
|
@@ -10782,7 +10777,7 @@ class Polygon {
|
|
|
10782
10777
|
/**
|
|
10783
10778
|
* Returns true if the vertices composing this polygon form a convex shape (vertices must be in clockwise order).
|
|
10784
10779
|
* @name isConvex
|
|
10785
|
-
* @memberof Polygon
|
|
10780
|
+
* @memberof Polygon
|
|
10786
10781
|
* @function
|
|
10787
10782
|
* @returns {boolean} true if the vertices are convex, false if not, null if not computable
|
|
10788
10783
|
*/
|
|
@@ -10829,7 +10824,7 @@ class Polygon {
|
|
|
10829
10824
|
/**
|
|
10830
10825
|
* translate the Polygon by the specified offset
|
|
10831
10826
|
* @name translate
|
|
10832
|
-
* @memberof Polygon
|
|
10827
|
+
* @memberof Polygon
|
|
10833
10828
|
* @function
|
|
10834
10829
|
* @param {number} x x offset
|
|
10835
10830
|
* @param {number} y y offset
|
|
@@ -10838,7 +10833,7 @@ class Polygon {
|
|
|
10838
10833
|
/**
|
|
10839
10834
|
* translate the Polygon by the specified vector
|
|
10840
10835
|
* @name translate
|
|
10841
|
-
* @memberof Polygon
|
|
10836
|
+
* @memberof Polygon
|
|
10842
10837
|
* @function
|
|
10843
10838
|
* @param {Vector2d} v vector offset
|
|
10844
10839
|
* @returns {Polygon} Reference to this object for method chaining
|
|
@@ -10866,14 +10861,14 @@ class Polygon {
|
|
|
10866
10861
|
/**
|
|
10867
10862
|
* Shifts the Polygon to the given position vector.
|
|
10868
10863
|
* @name shift
|
|
10869
|
-
* @memberof Polygon
|
|
10864
|
+
* @memberof Polygon
|
|
10870
10865
|
* @function
|
|
10871
10866
|
* @param {Vector2d} position
|
|
10872
10867
|
*/
|
|
10873
10868
|
/**
|
|
10874
10869
|
* Shifts the Polygon to the given x, y position.
|
|
10875
10870
|
* @name shift
|
|
10876
|
-
* @memberof Polygon
|
|
10871
|
+
* @memberof Polygon
|
|
10877
10872
|
* @function
|
|
10878
10873
|
* @param {number} x
|
|
10879
10874
|
* @param {number} y
|
|
@@ -10899,7 +10894,7 @@ class Polygon {
|
|
|
10899
10894
|
* (Note: it is highly recommended to first do a hit test on the corresponding <br>
|
|
10900
10895
|
* bounding rect, as the function can be highly consuming with complex shapes)
|
|
10901
10896
|
* @name contains
|
|
10902
|
-
* @memberof Polygon
|
|
10897
|
+
* @memberof Polygon
|
|
10903
10898
|
* @function
|
|
10904
10899
|
* @param {Vector2d} point
|
|
10905
10900
|
* @returns {boolean} true if contains
|
|
@@ -10910,7 +10905,7 @@ class Polygon {
|
|
|
10910
10905
|
* (Note: it is highly recommended to first do a hit test on the corresponding <br>
|
|
10911
10906
|
* bounding rect, as the function can be highly consuming with complex shapes)
|
|
10912
10907
|
* @name contains
|
|
10913
|
-
* @memberof Polygon
|
|
10908
|
+
* @memberof Polygon
|
|
10914
10909
|
* @function
|
|
10915
10910
|
* @param {number} x x coordinate
|
|
10916
10911
|
* @param {number} y y coordinate
|
|
@@ -10948,7 +10943,7 @@ class Polygon {
|
|
|
10948
10943
|
/**
|
|
10949
10944
|
* returns the bounding box for this shape, the smallest Rectangle object completely containing this shape.
|
|
10950
10945
|
* @name getBounds
|
|
10951
|
-
* @memberof Polygon
|
|
10946
|
+
* @memberof Polygon
|
|
10952
10947
|
* @function
|
|
10953
10948
|
* @returns {Bounds} this shape bounding box Rectangle object
|
|
10954
10949
|
*/
|
|
@@ -10963,7 +10958,7 @@ class Polygon {
|
|
|
10963
10958
|
* update the bounding box for this shape.
|
|
10964
10959
|
* @ignore
|
|
10965
10960
|
* @name updateBounds
|
|
10966
|
-
* @memberof Polygon
|
|
10961
|
+
* @memberof Polygon
|
|
10967
10962
|
* @function
|
|
10968
10963
|
* @returns {Bounds} this shape bounding box Rectangle object
|
|
10969
10964
|
*/
|
|
@@ -10979,7 +10974,7 @@ class Polygon {
|
|
|
10979
10974
|
/**
|
|
10980
10975
|
* clone this Polygon
|
|
10981
10976
|
* @name clone
|
|
10982
|
-
* @memberof Polygon
|
|
10977
|
+
* @memberof Polygon
|
|
10983
10978
|
* @function
|
|
10984
10979
|
* @returns {Polygon} new Polygon
|
|
10985
10980
|
*/
|
|
@@ -10997,7 +10992,7 @@ class Polygon {
|
|
|
10997
10992
|
* a rectangle Object
|
|
10998
10993
|
* @augments Polygon
|
|
10999
10994
|
*/
|
|
11000
|
-
class Rect extends Polygon {
|
|
10995
|
+
class Rect$1 extends Polygon {
|
|
11001
10996
|
/**
|
|
11002
10997
|
* @param {number} x position of the Rectangle
|
|
11003
10998
|
* @param {number} y position of the Rectangle
|
|
@@ -11023,7 +11018,7 @@ class Rect extends Polygon {
|
|
|
11023
11018
|
/**
|
|
11024
11019
|
* set new value to the rectangle shape
|
|
11025
11020
|
* @name setShape
|
|
11026
|
-
* @memberof Rect
|
|
11021
|
+
* @memberof Rect
|
|
11027
11022
|
* @function
|
|
11028
11023
|
* @param {number} x position of the Rectangle
|
|
11029
11024
|
* @param {number} y position of the Rectangle
|
|
@@ -11054,7 +11049,7 @@ class Rect extends Polygon {
|
|
|
11054
11049
|
* @public
|
|
11055
11050
|
* @type {number}
|
|
11056
11051
|
* @name left
|
|
11057
|
-
* @memberof Rect
|
|
11052
|
+
* @memberof Rect
|
|
11058
11053
|
*/
|
|
11059
11054
|
get left() {
|
|
11060
11055
|
return this.pos.x;
|
|
@@ -11065,7 +11060,7 @@ class Rect extends Polygon {
|
|
|
11065
11060
|
* @public
|
|
11066
11061
|
* @type {number}
|
|
11067
11062
|
* @name right
|
|
11068
|
-
* @memberof Rect
|
|
11063
|
+
* @memberof Rect
|
|
11069
11064
|
*/
|
|
11070
11065
|
get right() {
|
|
11071
11066
|
var w = this.width;
|
|
@@ -11077,7 +11072,7 @@ class Rect extends Polygon {
|
|
|
11077
11072
|
* @public
|
|
11078
11073
|
* @type {number}
|
|
11079
11074
|
* @name top
|
|
11080
|
-
* @memberof Rect
|
|
11075
|
+
* @memberof Rect
|
|
11081
11076
|
*/
|
|
11082
11077
|
get top() {
|
|
11083
11078
|
return this.pos.y;
|
|
@@ -11088,7 +11083,7 @@ class Rect extends Polygon {
|
|
|
11088
11083
|
* @public
|
|
11089
11084
|
* @type {number}
|
|
11090
11085
|
* @name bottom
|
|
11091
|
-
* @memberof Rect
|
|
11086
|
+
* @memberof Rect
|
|
11092
11087
|
*/
|
|
11093
11088
|
get bottom() {
|
|
11094
11089
|
var h = this.height;
|
|
@@ -11100,7 +11095,7 @@ class Rect extends Polygon {
|
|
|
11100
11095
|
* @public
|
|
11101
11096
|
* @type {number}
|
|
11102
11097
|
* @name width
|
|
11103
|
-
* @memberof Rect
|
|
11098
|
+
* @memberof Rect
|
|
11104
11099
|
*/
|
|
11105
11100
|
get width() {
|
|
11106
11101
|
return this.points[2].x;
|
|
@@ -11116,7 +11111,7 @@ class Rect extends Polygon {
|
|
|
11116
11111
|
* @public
|
|
11117
11112
|
* @type {number}
|
|
11118
11113
|
* @name height
|
|
11119
|
-
* @memberof Rect
|
|
11114
|
+
* @memberof Rect
|
|
11120
11115
|
*/
|
|
11121
11116
|
get height() {
|
|
11122
11117
|
return this.points[2].y;
|
|
@@ -11132,7 +11127,7 @@ class Rect extends Polygon {
|
|
|
11132
11127
|
* @public
|
|
11133
11128
|
* @type {number}
|
|
11134
11129
|
* @name centerX
|
|
11135
|
-
* @memberof Rect
|
|
11130
|
+
* @memberof Rect
|
|
11136
11131
|
*/
|
|
11137
11132
|
get centerX() {
|
|
11138
11133
|
if (isFinite(this.width)) {
|
|
@@ -11150,7 +11145,7 @@ class Rect extends Polygon {
|
|
|
11150
11145
|
* @public
|
|
11151
11146
|
* @type {number}
|
|
11152
11147
|
* @name centerY
|
|
11153
|
-
* @memberof Rect
|
|
11148
|
+
* @memberof Rect
|
|
11154
11149
|
*/
|
|
11155
11150
|
get centerY() {
|
|
11156
11151
|
if (isFinite(this.height)) {
|
|
@@ -11166,7 +11161,7 @@ class Rect extends Polygon {
|
|
|
11166
11161
|
/**
|
|
11167
11162
|
* center the rectangle position around the given coordinates
|
|
11168
11163
|
* @name centerOn
|
|
11169
|
-
* @memberof Rect
|
|
11164
|
+
* @memberof Rect
|
|
11170
11165
|
* @function
|
|
11171
11166
|
* @param {number} x the x coordinate around which to center this rectangle
|
|
11172
11167
|
* @param {number} x the y coordinate around which to center this rectangle
|
|
@@ -11181,7 +11176,7 @@ class Rect extends Polygon {
|
|
|
11181
11176
|
/**
|
|
11182
11177
|
* resize the rectangle
|
|
11183
11178
|
* @name resize
|
|
11184
|
-
* @memberof Rect
|
|
11179
|
+
* @memberof Rect
|
|
11185
11180
|
* @function
|
|
11186
11181
|
* @param {number} w new width of the rectangle
|
|
11187
11182
|
* @param {number} h new height of the rectangle
|
|
@@ -11196,7 +11191,7 @@ class Rect extends Polygon {
|
|
|
11196
11191
|
/**
|
|
11197
11192
|
* scale the rectangle
|
|
11198
11193
|
* @name scale
|
|
11199
|
-
* @memberof Rect
|
|
11194
|
+
* @memberof Rect
|
|
11200
11195
|
* @function
|
|
11201
11196
|
* @param {number} x a number representing the abscissa of the scaling vector.
|
|
11202
11197
|
* @param {number} [y=x] a number representing the ordinate of the scaling vector.
|
|
@@ -11211,18 +11206,18 @@ class Rect extends Polygon {
|
|
|
11211
11206
|
/**
|
|
11212
11207
|
* clone this rectangle
|
|
11213
11208
|
* @name clone
|
|
11214
|
-
* @memberof Rect
|
|
11209
|
+
* @memberof Rect
|
|
11215
11210
|
* @function
|
|
11216
11211
|
* @returns {Rect} new rectangle
|
|
11217
11212
|
*/
|
|
11218
11213
|
clone() {
|
|
11219
|
-
return new Rect(this.pos.x, this.pos.y, this.width, this.height);
|
|
11214
|
+
return new Rect$1(this.pos.x, this.pos.y, this.width, this.height);
|
|
11220
11215
|
}
|
|
11221
11216
|
|
|
11222
11217
|
/**
|
|
11223
11218
|
* copy the position and size of the given rectangle into this one
|
|
11224
11219
|
* @name copy
|
|
11225
|
-
* @memberof Rect
|
|
11220
|
+
* @memberof Rect
|
|
11226
11221
|
* @function
|
|
11227
11222
|
* @param {Rect} rect Source rectangle
|
|
11228
11223
|
* @returns {Rect} new rectangle
|
|
@@ -11234,7 +11229,7 @@ class Rect extends Polygon {
|
|
|
11234
11229
|
/**
|
|
11235
11230
|
* merge this rectangle with another one
|
|
11236
11231
|
* @name union
|
|
11237
|
-
* @memberof Rect
|
|
11232
|
+
* @memberof Rect
|
|
11238
11233
|
* @function
|
|
11239
11234
|
* @param {Rect} rect other rectangle to union with
|
|
11240
11235
|
* @returns {Rect} the union(ed) rectangle
|
|
@@ -11256,7 +11251,7 @@ class Rect extends Polygon {
|
|
|
11256
11251
|
/**
|
|
11257
11252
|
* check if this rectangle is intersecting with the specified one
|
|
11258
11253
|
* @name overlaps
|
|
11259
|
-
* @memberof Rect
|
|
11254
|
+
* @memberof Rect
|
|
11260
11255
|
* @function
|
|
11261
11256
|
* @param {Rect} rect
|
|
11262
11257
|
* @returns {boolean} true if overlaps
|
|
@@ -11273,7 +11268,7 @@ class Rect extends Polygon {
|
|
|
11273
11268
|
/**
|
|
11274
11269
|
* Returns true if the rectangle contains the given rectangle
|
|
11275
11270
|
* @name contains
|
|
11276
|
-
* @memberof Rect
|
|
11271
|
+
* @memberof Rect
|
|
11277
11272
|
* @function
|
|
11278
11273
|
* @param {Rect} rect
|
|
11279
11274
|
* @returns {boolean} true if contains
|
|
@@ -11282,7 +11277,7 @@ class Rect extends Polygon {
|
|
|
11282
11277
|
/**
|
|
11283
11278
|
* Returns true if the rectangle contains the given point
|
|
11284
11279
|
* @name contains
|
|
11285
|
-
* @memberof Rect
|
|
11280
|
+
* @memberof Rect
|
|
11286
11281
|
* @function
|
|
11287
11282
|
* @param {number} x x coordinate
|
|
11288
11283
|
* @param {number} y y coordinate
|
|
@@ -11292,7 +11287,7 @@ class Rect extends Polygon {
|
|
|
11292
11287
|
/**
|
|
11293
11288
|
* Returns true if the rectangle contains the given point
|
|
11294
11289
|
* @name contains
|
|
11295
|
-
* @memberof Rect
|
|
11290
|
+
* @memberof Rect
|
|
11296
11291
|
* @function
|
|
11297
11292
|
* @param {Vector2d} point
|
|
11298
11293
|
* @returns {boolean} true if contains
|
|
@@ -11305,7 +11300,7 @@ class Rect extends Polygon {
|
|
|
11305
11300
|
_x1 = _x2 = arg0;
|
|
11306
11301
|
_y1 = _y2 = arguments[1];
|
|
11307
11302
|
} else {
|
|
11308
|
-
if (arg0 instanceof Rect) {
|
|
11303
|
+
if (arg0 instanceof Rect$1) {
|
|
11309
11304
|
// me.Rect
|
|
11310
11305
|
_x1 = arg0.left;
|
|
11311
11306
|
_x2 = arg0.right;
|
|
@@ -11328,7 +11323,7 @@ class Rect extends Polygon {
|
|
|
11328
11323
|
/**
|
|
11329
11324
|
* check if this rectangle is identical to the specified one
|
|
11330
11325
|
* @name equals
|
|
11331
|
-
* @memberof Rect
|
|
11326
|
+
* @memberof Rect
|
|
11332
11327
|
* @function
|
|
11333
11328
|
* @param {Rect} rect
|
|
11334
11329
|
* @returns {boolean} true if equals
|
|
@@ -11345,7 +11340,7 @@ class Rect extends Polygon {
|
|
|
11345
11340
|
/**
|
|
11346
11341
|
* determines whether all coordinates of this rectangle are finite numbers.
|
|
11347
11342
|
* @name isFinite
|
|
11348
|
-
* @memberof Rect
|
|
11343
|
+
* @memberof Rect
|
|
11349
11344
|
* @function
|
|
11350
11345
|
* @returns {boolean} false if all coordinates are positive or negative Infinity or NaN; otherwise, true.
|
|
11351
11346
|
*/
|
|
@@ -11356,7 +11351,7 @@ class Rect extends Polygon {
|
|
|
11356
11351
|
/**
|
|
11357
11352
|
* Returns a polygon whose edges are the same as this box.
|
|
11358
11353
|
* @name toPolygon
|
|
11359
|
-
* @memberof Rect
|
|
11354
|
+
* @memberof Rect
|
|
11360
11355
|
* @function
|
|
11361
11356
|
* @returns {Polygon} a new Polygon that represents this rectangle.
|
|
11362
11357
|
*/
|
|
@@ -12767,7 +12762,7 @@ function enablePointerEvent() {
|
|
|
12767
12762
|
if (!pointerInitialized) {
|
|
12768
12763
|
|
|
12769
12764
|
// the current pointer area
|
|
12770
|
-
currentPointer = new Rect(0, 0, 1, 1);
|
|
12765
|
+
currentPointer = new Rect$1(0, 0, 1, 1);
|
|
12771
12766
|
|
|
12772
12767
|
// instantiate a pool of pointer catched
|
|
12773
12768
|
for (var v = 0; v < device$1.maxTouchPoints; v++) {
|
|
@@ -14010,7 +14005,7 @@ var input = /*#__PURE__*/Object.freeze({
|
|
|
14010
14005
|
* A base class for renderable objects.
|
|
14011
14006
|
* @augments Rect
|
|
14012
14007
|
*/
|
|
14013
|
-
class Renderable extends Rect {
|
|
14008
|
+
class Renderable extends Rect$1 {
|
|
14014
14009
|
/**
|
|
14015
14010
|
* @param {number} x position of the renderable object (accessible through inherited pos.x property)
|
|
14016
14011
|
* @param {number} y position of the renderable object (accessible through inherited pos.y property)
|
|
@@ -14379,7 +14374,7 @@ class Renderable extends Rect {
|
|
|
14379
14374
|
/**
|
|
14380
14375
|
* returns the bounding box for this renderable
|
|
14381
14376
|
* @name getBounds
|
|
14382
|
-
* @memberof Renderable
|
|
14377
|
+
* @memberof Renderable
|
|
14383
14378
|
* @function
|
|
14384
14379
|
* @returns {Bounds} bounding box Rectangle object
|
|
14385
14380
|
*/
|
|
@@ -14400,7 +14395,7 @@ class Renderable extends Rect {
|
|
|
14400
14395
|
/**
|
|
14401
14396
|
* get the renderable alpha channel value<br>
|
|
14402
14397
|
* @name getOpacity
|
|
14403
|
-
* @memberof Renderable
|
|
14398
|
+
* @memberof Renderable
|
|
14404
14399
|
* @function
|
|
14405
14400
|
* @returns {number} current opacity value between 0 and 1
|
|
14406
14401
|
*/
|
|
@@ -14411,7 +14406,7 @@ class Renderable extends Rect {
|
|
|
14411
14406
|
/**
|
|
14412
14407
|
* set the renderable alpha channel value<br>
|
|
14413
14408
|
* @name setOpacity
|
|
14414
|
-
* @memberof Renderable
|
|
14409
|
+
* @memberof Renderable
|
|
14415
14410
|
* @function
|
|
14416
14411
|
* @param {number} alpha opacity value between 0.0 and 1.0
|
|
14417
14412
|
*/
|
|
@@ -14430,7 +14425,7 @@ class Renderable extends Rect {
|
|
|
14430
14425
|
* flip the renderable on the horizontal axis (around the center of the renderable)
|
|
14431
14426
|
* @see Matrix2d#scaleX
|
|
14432
14427
|
* @name flipX
|
|
14433
|
-
* @memberof Renderable
|
|
14428
|
+
* @memberof Renderable
|
|
14434
14429
|
* @function
|
|
14435
14430
|
* @param {boolean} [flip=true] `true` to flip this renderable.
|
|
14436
14431
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -14445,7 +14440,7 @@ class Renderable extends Rect {
|
|
|
14445
14440
|
* flip the renderable on the vertical axis (around the center of the renderable)
|
|
14446
14441
|
* @see Matrix2d#scaleY
|
|
14447
14442
|
* @name flipY
|
|
14448
|
-
* @memberof Renderable
|
|
14443
|
+
* @memberof Renderable
|
|
14449
14444
|
* @function
|
|
14450
14445
|
* @param {boolean} [flip=true] `true` to flip this renderable.
|
|
14451
14446
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -14459,7 +14454,7 @@ class Renderable extends Rect {
|
|
|
14459
14454
|
/**
|
|
14460
14455
|
* multiply the renderable currentTransform with the given matrix
|
|
14461
14456
|
* @name transform
|
|
14462
|
-
* @memberof Renderable
|
|
14457
|
+
* @memberof Renderable
|
|
14463
14458
|
* @see Renderable#currentTransform
|
|
14464
14459
|
* @function
|
|
14465
14460
|
* @param {Matrix2d} m the transformation matrix
|
|
@@ -14524,7 +14519,7 @@ class Renderable extends Rect {
|
|
|
14524
14519
|
/**
|
|
14525
14520
|
* Rotate this renderable towards the given target.
|
|
14526
14521
|
* @name lookAt
|
|
14527
|
-
* @memberof Renderable
|
|
14522
|
+
* @memberof Renderable
|
|
14528
14523
|
* @function
|
|
14529
14524
|
* @param {Renderable|Vector2d|Vector3d} target the renderable or position to look at
|
|
14530
14525
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -14548,7 +14543,7 @@ class Renderable extends Rect {
|
|
|
14548
14543
|
/**
|
|
14549
14544
|
* Rotate this renderable by the specified angle (in radians).
|
|
14550
14545
|
* @name rotate
|
|
14551
|
-
* @memberof Renderable
|
|
14546
|
+
* @memberof Renderable
|
|
14552
14547
|
* @function
|
|
14553
14548
|
* @param {number} angle The angle to rotate (in radians)
|
|
14554
14549
|
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
|
|
@@ -14570,7 +14565,7 @@ class Renderable extends Rect {
|
|
|
14570
14565
|
* is an image, the image.width and image.height properties are unaltered but the currentTransform
|
|
14571
14566
|
* member will be changed.
|
|
14572
14567
|
* @name scale
|
|
14573
|
-
* @memberof Renderable
|
|
14568
|
+
* @memberof Renderable
|
|
14574
14569
|
* @function
|
|
14575
14570
|
* @param {number} x a number representing the abscissa of the scaling vector.
|
|
14576
14571
|
* @param {number} [y=x] a number representing the ordinate of the scaling vector.
|
|
@@ -14586,7 +14581,7 @@ class Renderable extends Rect {
|
|
|
14586
14581
|
/**
|
|
14587
14582
|
* scale the renderable around his anchor point
|
|
14588
14583
|
* @name scaleV
|
|
14589
|
-
* @memberof Renderable
|
|
14584
|
+
* @memberof Renderable
|
|
14590
14585
|
* @function
|
|
14591
14586
|
* @param {Vector2d} v scaling vector
|
|
14592
14587
|
* @returns {Renderable} Reference to this object for method chaining
|
|
@@ -14600,7 +14595,7 @@ class Renderable extends Rect {
|
|
|
14600
14595
|
* update function. <br>
|
|
14601
14596
|
* automatically called by the game manager {@link game}
|
|
14602
14597
|
* @name update
|
|
14603
|
-
* @memberof Renderable
|
|
14598
|
+
* @memberof Renderable
|
|
14604
14599
|
* @function
|
|
14605
14600
|
* @protected
|
|
14606
14601
|
* @param {number} dt time since the last update in milliseconds.
|
|
@@ -14614,7 +14609,7 @@ class Renderable extends Rect {
|
|
|
14614
14609
|
* update the bounding box for this shape.
|
|
14615
14610
|
* @ignore
|
|
14616
14611
|
* @name updateBounds
|
|
14617
|
-
* @memberof Renderable
|
|
14612
|
+
* @memberof Renderable
|
|
14618
14613
|
* @function
|
|
14619
14614
|
* @returns {Bounds} this shape bounding box Rectangle object
|
|
14620
14615
|
*/
|
|
@@ -14628,7 +14623,7 @@ class Renderable extends Rect {
|
|
|
14628
14623
|
* update the renderable's bounding rect (private)
|
|
14629
14624
|
* @ignore
|
|
14630
14625
|
* @name updateBoundsPos
|
|
14631
|
-
* @memberof Renderable
|
|
14626
|
+
* @memberof Renderable
|
|
14632
14627
|
* @function
|
|
14633
14628
|
*/
|
|
14634
14629
|
updateBoundsPos(newX, newY) {
|
|
@@ -14654,13 +14649,14 @@ class Renderable extends Rect {
|
|
|
14654
14649
|
if (this.ancestor instanceof Container && this.floating !== true) {
|
|
14655
14650
|
bounds.translate(this.ancestor.getAbsolutePosition());
|
|
14656
14651
|
}
|
|
14657
|
-
|
|
14652
|
+
|
|
14653
|
+
this.isDirty = true;
|
|
14658
14654
|
}
|
|
14659
14655
|
|
|
14660
14656
|
/**
|
|
14661
14657
|
* return the renderable absolute position in the game world
|
|
14662
14658
|
* @name getAbsolutePosition
|
|
14663
|
-
* @memberof Renderable
|
|
14659
|
+
* @memberof Renderable
|
|
14664
14660
|
* @function
|
|
14665
14661
|
* @returns {Vector2d}
|
|
14666
14662
|
*/
|
|
@@ -14680,7 +14676,7 @@ class Renderable extends Rect {
|
|
|
14680
14676
|
* called when the anchor point value is changed
|
|
14681
14677
|
* @private
|
|
14682
14678
|
* @name onAnchorUpdate
|
|
14683
|
-
* @memberof Renderable
|
|
14679
|
+
* @memberof Renderable
|
|
14684
14680
|
* @function
|
|
14685
14681
|
* @param {number} x the new X value to be set for the anchor
|
|
14686
14682
|
* @param {number} y the new Y value to be set for the anchor
|
|
@@ -14698,7 +14694,7 @@ class Renderable extends Rect {
|
|
|
14698
14694
|
* (apply defined transforms, anchor point). <br>
|
|
14699
14695
|
* automatically called by the game manager {@link game}
|
|
14700
14696
|
* @name preDraw
|
|
14701
|
-
* @memberof Renderable
|
|
14697
|
+
* @memberof Renderable
|
|
14702
14698
|
* @function
|
|
14703
14699
|
* @protected
|
|
14704
14700
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
@@ -14754,7 +14750,7 @@ class Renderable extends Rect {
|
|
|
14754
14750
|
* object draw. <br>
|
|
14755
14751
|
* automatically called by the game manager {@link game}
|
|
14756
14752
|
* @name draw
|
|
14757
|
-
* @memberof Renderable
|
|
14753
|
+
* @memberof Renderable
|
|
14758
14754
|
* @function
|
|
14759
14755
|
* @protected
|
|
14760
14756
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
@@ -14767,7 +14763,7 @@ class Renderable extends Rect {
|
|
|
14767
14763
|
* restore the rendering context after drawing. <br>
|
|
14768
14764
|
* automatically called by the game manager {@link game}
|
|
14769
14765
|
* @name postDraw
|
|
14770
|
-
* @memberof Renderable
|
|
14766
|
+
* @memberof Renderable
|
|
14771
14767
|
* @function
|
|
14772
14768
|
* @protected
|
|
14773
14769
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
@@ -14792,7 +14788,7 @@ class Renderable extends Rect {
|
|
|
14792
14788
|
* onCollision callback, triggered in case of collision,
|
|
14793
14789
|
* when this renderable body is colliding with another one
|
|
14794
14790
|
* @name onCollision
|
|
14795
|
-
* @memberof Renderable
|
|
14791
|
+
* @memberof Renderable
|
|
14796
14792
|
* @function
|
|
14797
14793
|
* @param {collision.ResponseObject} response the collision response object
|
|
14798
14794
|
* @param {Renderable} other the other renderable touching this one (a reference to response.a or response.b)
|
|
@@ -14895,7 +14891,7 @@ class Ellipse {
|
|
|
14895
14891
|
* @public
|
|
14896
14892
|
* @type {Vector2d}
|
|
14897
14893
|
* @name pos
|
|
14898
|
-
* @memberof Ellipse
|
|
14894
|
+
* @memberof Ellipse
|
|
14899
14895
|
*/
|
|
14900
14896
|
this.pos = pool$1.pull("Vector2d");
|
|
14901
14897
|
|
|
@@ -14910,7 +14906,7 @@ class Ellipse {
|
|
|
14910
14906
|
* @public
|
|
14911
14907
|
* @type {number}
|
|
14912
14908
|
* @name radius
|
|
14913
|
-
* @memberof Ellipse
|
|
14909
|
+
* @memberof Ellipse
|
|
14914
14910
|
*/
|
|
14915
14911
|
this.radius = NaN;
|
|
14916
14912
|
|
|
@@ -14919,7 +14915,7 @@ class Ellipse {
|
|
|
14919
14915
|
* @public
|
|
14920
14916
|
* @type {Vector2d}
|
|
14921
14917
|
* @name radiusV
|
|
14922
|
-
* @memberof Ellipse
|
|
14918
|
+
* @memberof Ellipse
|
|
14923
14919
|
*/
|
|
14924
14920
|
this.radiusV = pool$1.pull("Vector2d");
|
|
14925
14921
|
|
|
@@ -14928,7 +14924,7 @@ class Ellipse {
|
|
|
14928
14924
|
* @public
|
|
14929
14925
|
* @type {Vector2d}
|
|
14930
14926
|
* @name radiusSq
|
|
14931
|
-
* @memberof Ellipse
|
|
14927
|
+
* @memberof Ellipse
|
|
14932
14928
|
*/
|
|
14933
14929
|
this.radiusSq = pool$1.pull("Vector2d");
|
|
14934
14930
|
|
|
@@ -14937,7 +14933,7 @@ class Ellipse {
|
|
|
14937
14933
|
* @public
|
|
14938
14934
|
* @type {Vector2d}
|
|
14939
14935
|
* @name ratio
|
|
14940
|
-
* @memberof Ellipse
|
|
14936
|
+
* @memberof Ellipse
|
|
14941
14937
|
*/
|
|
14942
14938
|
this.ratio = pool$1.pull("Vector2d");
|
|
14943
14939
|
|
|
@@ -14954,7 +14950,7 @@ class Ellipse {
|
|
|
14954
14950
|
/**
|
|
14955
14951
|
* set new value to the Ellipse shape
|
|
14956
14952
|
* @name setShape
|
|
14957
|
-
* @memberof Ellipse
|
|
14953
|
+
* @memberof Ellipse
|
|
14958
14954
|
* @function
|
|
14959
14955
|
* @param {number} x the center x coordinate of the ellipse
|
|
14960
14956
|
* @param {number} y the center y coordinate of the ellipse
|
|
@@ -14984,7 +14980,7 @@ class Ellipse {
|
|
|
14984
14980
|
/**
|
|
14985
14981
|
* Rotate this Ellipse (counter-clockwise) by the specified angle (in radians).
|
|
14986
14982
|
* @name rotate
|
|
14987
|
-
* @memberof Ellipse
|
|
14983
|
+
* @memberof Ellipse
|
|
14988
14984
|
* @function
|
|
14989
14985
|
* @param {number} angle The angle to rotate (in radians)
|
|
14990
14986
|
* @param {Vector2d|ObservableVector2d} [v] an optional point to rotate around
|
|
@@ -15001,7 +14997,7 @@ class Ellipse {
|
|
|
15001
14997
|
/**
|
|
15002
14998
|
* Scale this Ellipse by the specified scalar.
|
|
15003
14999
|
* @name scale
|
|
15004
|
-
* @memberof Ellipse
|
|
15000
|
+
* @memberof Ellipse
|
|
15005
15001
|
* @function
|
|
15006
15002
|
* @param {number} x
|
|
15007
15003
|
* @param {number} [y=x]
|
|
@@ -15020,7 +15016,7 @@ class Ellipse {
|
|
|
15020
15016
|
/**
|
|
15021
15017
|
* Scale this Ellipse by the specified vector.
|
|
15022
15018
|
* @name scale
|
|
15023
|
-
* @memberof Ellipse
|
|
15019
|
+
* @memberof Ellipse
|
|
15024
15020
|
* @function
|
|
15025
15021
|
* @param {Vector2d} v
|
|
15026
15022
|
* @returns {Ellipse} Reference to this object for method chaining
|
|
@@ -15032,7 +15028,7 @@ class Ellipse {
|
|
|
15032
15028
|
/**
|
|
15033
15029
|
* apply the given transformation matrix to this ellipse
|
|
15034
15030
|
* @name transform
|
|
15035
|
-
* @memberof Ellipse
|
|
15031
|
+
* @memberof Ellipse
|
|
15036
15032
|
* @function
|
|
15037
15033
|
* @param {Matrix2d} matrix the transformation matrix
|
|
15038
15034
|
* @returns {Polygon} Reference to this object for method chaining
|
|
@@ -15045,7 +15041,7 @@ class Ellipse {
|
|
|
15045
15041
|
/**
|
|
15046
15042
|
* translate the circle/ellipse by the specified offset
|
|
15047
15043
|
* @name translate
|
|
15048
|
-
* @memberof Ellipse
|
|
15044
|
+
* @memberof Ellipse
|
|
15049
15045
|
* @function
|
|
15050
15046
|
* @param {number} x x offset
|
|
15051
15047
|
* @param {number} y y offset
|
|
@@ -15054,7 +15050,7 @@ class Ellipse {
|
|
|
15054
15050
|
/**
|
|
15055
15051
|
* translate the circle/ellipse by the specified vector
|
|
15056
15052
|
* @name translate
|
|
15057
|
-
* @memberof Ellipse
|
|
15053
|
+
* @memberof Ellipse
|
|
15058
15054
|
* @function
|
|
15059
15055
|
* @param {Vector2d} v vector offset
|
|
15060
15056
|
* @returns {Ellipse} this ellipse
|
|
@@ -15082,7 +15078,7 @@ class Ellipse {
|
|
|
15082
15078
|
/**
|
|
15083
15079
|
* check if this circle/ellipse contains the specified point
|
|
15084
15080
|
* @name contains
|
|
15085
|
-
* @memberof Ellipse
|
|
15081
|
+
* @memberof Ellipse
|
|
15086
15082
|
* @function
|
|
15087
15083
|
* @param {Vector2d} point
|
|
15088
15084
|
* @returns {boolean} true if contains
|
|
@@ -15091,7 +15087,7 @@ class Ellipse {
|
|
|
15091
15087
|
/**
|
|
15092
15088
|
* check if this circle/ellipse contains the specified point
|
|
15093
15089
|
* @name contains
|
|
15094
|
-
* @memberof Ellipse
|
|
15090
|
+
* @memberof Ellipse
|
|
15095
15091
|
* @function
|
|
15096
15092
|
* @param {number} x x coordinate
|
|
15097
15093
|
* @param {number} y y coordinate
|
|
@@ -15123,7 +15119,7 @@ class Ellipse {
|
|
|
15123
15119
|
/**
|
|
15124
15120
|
* returns the bounding box for this shape, the smallest Rectangle object completely containing this shape.
|
|
15125
15121
|
* @name getBounds
|
|
15126
|
-
* @memberof Ellipse
|
|
15122
|
+
* @memberof Ellipse
|
|
15127
15123
|
* @function
|
|
15128
15124
|
* @returns {Bounds} this shape bounding box Rectangle object
|
|
15129
15125
|
*/
|
|
@@ -15137,7 +15133,7 @@ class Ellipse {
|
|
|
15137
15133
|
/**
|
|
15138
15134
|
* clone this Ellipse
|
|
15139
15135
|
* @name clone
|
|
15140
|
-
* @memberof Ellipse
|
|
15136
|
+
* @memberof Ellipse
|
|
15141
15137
|
* @function
|
|
15142
15138
|
* @returns {Ellipse} new Ellipse
|
|
15143
15139
|
*/
|
|
@@ -16229,7 +16225,7 @@ class Body {
|
|
|
16229
16225
|
* this.body.addShape(me.loader.getJSON("shapesdef").banana);
|
|
16230
16226
|
*/
|
|
16231
16227
|
addShape(shape) {
|
|
16232
|
-
if (shape instanceof Rect || shape instanceof Bounds$1) {
|
|
16228
|
+
if (shape instanceof Rect$1 || shape instanceof Bounds$1) {
|
|
16233
16229
|
var poly = shape.toPolygon();
|
|
16234
16230
|
this.shapes.push(poly);
|
|
16235
16231
|
// update the body bounds
|
|
@@ -16705,7 +16701,7 @@ var globalFloatingCounter = 0;
|
|
|
16705
16701
|
|
|
16706
16702
|
/**
|
|
16707
16703
|
* @classdesc
|
|
16708
|
-
*
|
|
16704
|
+
* Container represents a collection of child objects
|
|
16709
16705
|
* @augments Renderable
|
|
16710
16706
|
*/
|
|
16711
16707
|
class Container extends Renderable {
|
|
@@ -16878,7 +16874,7 @@ class Container extends Renderable {
|
|
|
16878
16874
|
* orginal container. Then when the me.game.world.reset() is called the renderable
|
|
16879
16875
|
* will not be in any container.
|
|
16880
16876
|
* @name addChild
|
|
16881
|
-
* @memberof Container
|
|
16877
|
+
* @memberof Container
|
|
16882
16878
|
* @function
|
|
16883
16879
|
* @param {Renderable} child
|
|
16884
16880
|
* @param {number} [z] forces the z index of the child to the specified value
|
|
@@ -16942,7 +16938,7 @@ class Container extends Renderable {
|
|
|
16942
16938
|
* Add a child to the container at the specified index<br>
|
|
16943
16939
|
* (the list won't be sorted after insertion)
|
|
16944
16940
|
* @name addChildAt
|
|
16945
|
-
* @memberof Container
|
|
16941
|
+
* @memberof Container
|
|
16946
16942
|
* @function
|
|
16947
16943
|
* @param {Renderable} child
|
|
16948
16944
|
* @param {number} index
|
|
@@ -17001,7 +16997,7 @@ class Container extends Renderable {
|
|
|
17001
16997
|
* - The index of element in the array. <br>
|
|
17002
16998
|
* - The array forEach() was called upon. <br>
|
|
17003
16999
|
* @name forEach
|
|
17004
|
-
* @memberof Container
|
|
17000
|
+
* @memberof Container
|
|
17005
17001
|
* @function
|
|
17006
17002
|
* @param {Function} callback fnction to execute on each element
|
|
17007
17003
|
* @param {object} [thisArg] value to use as this(i.e reference Object) when executing callback.
|
|
@@ -17038,7 +17034,7 @@ class Container extends Renderable {
|
|
|
17038
17034
|
/**
|
|
17039
17035
|
* Swaps the position (z-index) of 2 children
|
|
17040
17036
|
* @name swapChildren
|
|
17041
|
-
* @memberof Container
|
|
17037
|
+
* @memberof Container
|
|
17042
17038
|
* @function
|
|
17043
17039
|
* @param {Renderable} child
|
|
17044
17040
|
* @param {Renderable} child2
|
|
@@ -17066,7 +17062,7 @@ class Container extends Renderable {
|
|
|
17066
17062
|
/**
|
|
17067
17063
|
* Returns the Child at the specified index
|
|
17068
17064
|
* @name getChildAt
|
|
17069
|
-
* @memberof Container
|
|
17065
|
+
* @memberof Container
|
|
17070
17066
|
* @function
|
|
17071
17067
|
* @param {number} index
|
|
17072
17068
|
* @returns {Renderable} the child at the specified index
|
|
@@ -17083,7 +17079,7 @@ class Container extends Renderable {
|
|
|
17083
17079
|
/**
|
|
17084
17080
|
* Returns the index of the given Child
|
|
17085
17081
|
* @name getChildIndex
|
|
17086
|
-
* @memberof Container
|
|
17082
|
+
* @memberof Container
|
|
17087
17083
|
* @function
|
|
17088
17084
|
* @param {Renderable} child
|
|
17089
17085
|
* @returns {number} index
|
|
@@ -17111,7 +17107,7 @@ class Container extends Renderable {
|
|
|
17111
17107
|
/**
|
|
17112
17108
|
* Returns true if contains the specified Child
|
|
17113
17109
|
* @name hasChild
|
|
17114
|
-
* @memberof Container
|
|
17110
|
+
* @memberof Container
|
|
17115
17111
|
* @function
|
|
17116
17112
|
* @param {Renderable} child
|
|
17117
17113
|
* @returns {boolean}
|
|
@@ -17125,7 +17121,7 @@ class Container extends Renderable {
|
|
|
17125
17121
|
* note : avoid calling this function every frame since
|
|
17126
17122
|
* it parses the whole object tree each time
|
|
17127
17123
|
* @name getChildByProp
|
|
17128
|
-
* @memberof Container
|
|
17124
|
+
* @memberof Container
|
|
17129
17125
|
* @public
|
|
17130
17126
|
* @function
|
|
17131
17127
|
* @param {string} prop Property name
|
|
@@ -17177,7 +17173,7 @@ class Container extends Renderable {
|
|
|
17177
17173
|
/**
|
|
17178
17174
|
* returns the list of childs with the specified class type
|
|
17179
17175
|
* @name getChildByType
|
|
17180
|
-
* @memberof Container
|
|
17176
|
+
* @memberof Container
|
|
17181
17177
|
* @public
|
|
17182
17178
|
* @function
|
|
17183
17179
|
* @param {object} classType
|
|
@@ -17204,7 +17200,7 @@ class Container extends Renderable {
|
|
|
17204
17200
|
* note : avoid calling this function every frame since
|
|
17205
17201
|
* it parses the whole object list each time
|
|
17206
17202
|
* @name getChildByName
|
|
17207
|
-
* @memberof Container
|
|
17203
|
+
* @memberof Container
|
|
17208
17204
|
* @public
|
|
17209
17205
|
* @function
|
|
17210
17206
|
* @param {string|RegExp|number|boolean} name child name
|
|
@@ -17219,7 +17215,7 @@ class Container extends Renderable {
|
|
|
17219
17215
|
* note : avoid calling this function every frame since
|
|
17220
17216
|
* it parses the whole object list each time
|
|
17221
17217
|
* @name getChildByGUID
|
|
17222
|
-
* @memberof Container
|
|
17218
|
+
* @memberof Container
|
|
17223
17219
|
* @public
|
|
17224
17220
|
* @function
|
|
17225
17221
|
* @param {string|RegExp|number|boolean} guid child GUID
|
|
@@ -17233,7 +17229,7 @@ class Container extends Renderable {
|
|
|
17233
17229
|
/**
|
|
17234
17230
|
* return all child in this container
|
|
17235
17231
|
* @name getChildren
|
|
17236
|
-
* @memberof Container
|
|
17232
|
+
* @memberof Container
|
|
17237
17233
|
* @public
|
|
17238
17234
|
* @function
|
|
17239
17235
|
* @returns {Renderable[]} an array of renderable object
|
|
@@ -17249,7 +17245,7 @@ class Container extends Renderable {
|
|
|
17249
17245
|
* update the bounding box for this shape.
|
|
17250
17246
|
* @ignore
|
|
17251
17247
|
* @name updateBounds
|
|
17252
|
-
* @memberof Renderable
|
|
17248
|
+
* @memberof Renderable
|
|
17253
17249
|
* @function
|
|
17254
17250
|
* @returns {Bounds} this shape bounding box Rectangle object
|
|
17255
17251
|
*/
|
|
@@ -17278,7 +17274,7 @@ class Container extends Renderable {
|
|
|
17278
17274
|
* Checks if this container is root or if it's attached to the root container.
|
|
17279
17275
|
* @private
|
|
17280
17276
|
* @name isAttachedToRoot
|
|
17281
|
-
* @memberof Container
|
|
17277
|
+
* @memberof Container
|
|
17282
17278
|
* @function
|
|
17283
17279
|
* @returns {boolean}
|
|
17284
17280
|
*/
|
|
@@ -17301,7 +17297,7 @@ class Container extends Renderable {
|
|
|
17301
17297
|
* update the cointainer's bounding rect (private)
|
|
17302
17298
|
* @ignore
|
|
17303
17299
|
* @name updateBoundsPos
|
|
17304
|
-
* @memberof Container
|
|
17300
|
+
* @memberof Container
|
|
17305
17301
|
* @function
|
|
17306
17302
|
*/
|
|
17307
17303
|
updateBoundsPos(newX, newY) {
|
|
@@ -17336,7 +17332,7 @@ class Container extends Renderable {
|
|
|
17336
17332
|
/**
|
|
17337
17333
|
* Invokes the removeChildNow in a defer, to ensure the child is removed safely after the update & draw stack has completed
|
|
17338
17334
|
* @name removeChild
|
|
17339
|
-
* @memberof Container
|
|
17335
|
+
* @memberof Container
|
|
17340
17336
|
* @public
|
|
17341
17337
|
* @function
|
|
17342
17338
|
* @param {Renderable} child
|
|
@@ -17356,7 +17352,7 @@ class Container extends Renderable {
|
|
|
17356
17352
|
* (removal is immediate and unconditional)<br>
|
|
17357
17353
|
* Never use keepalive=true with objects from {@link pool}. Doing so will create a memory leak.
|
|
17358
17354
|
* @name removeChildNow
|
|
17359
|
-
* @memberof Container
|
|
17355
|
+
* @memberof Container
|
|
17360
17356
|
* @function
|
|
17361
17357
|
* @param {Renderable} child
|
|
17362
17358
|
* @param {boolean} [keepalive=False] True to prevent calling child.destroy()
|
|
@@ -17409,7 +17405,7 @@ class Container extends Renderable {
|
|
|
17409
17405
|
/**
|
|
17410
17406
|
* Automatically set the specified property of all childs to the given value
|
|
17411
17407
|
* @name setChildsProperty
|
|
17412
|
-
* @memberof Container
|
|
17408
|
+
* @memberof Container
|
|
17413
17409
|
* @function
|
|
17414
17410
|
* @param {string} prop property name
|
|
17415
17411
|
* @param {object} value property value
|
|
@@ -17427,7 +17423,7 @@ class Container extends Renderable {
|
|
|
17427
17423
|
/**
|
|
17428
17424
|
* Move the child in the group one step forward (z depth).
|
|
17429
17425
|
* @name moveUp
|
|
17430
|
-
* @memberof Container
|
|
17426
|
+
* @memberof Container
|
|
17431
17427
|
* @function
|
|
17432
17428
|
* @param {Renderable} child
|
|
17433
17429
|
*/
|
|
@@ -17444,7 +17440,7 @@ class Container extends Renderable {
|
|
|
17444
17440
|
/**
|
|
17445
17441
|
* Move the child in the group one step backward (z depth).
|
|
17446
17442
|
* @name moveDown
|
|
17447
|
-
* @memberof Container
|
|
17443
|
+
* @memberof Container
|
|
17448
17444
|
* @function
|
|
17449
17445
|
* @param {Renderable} child
|
|
17450
17446
|
*/
|
|
@@ -17461,7 +17457,7 @@ class Container extends Renderable {
|
|
|
17461
17457
|
/**
|
|
17462
17458
|
* Move the specified child to the top(z depth).
|
|
17463
17459
|
* @name moveToTop
|
|
17464
|
-
* @memberof Container
|
|
17460
|
+
* @memberof Container
|
|
17465
17461
|
* @function
|
|
17466
17462
|
* @param {Renderable} child
|
|
17467
17463
|
*/
|
|
@@ -17481,7 +17477,7 @@ class Container extends Renderable {
|
|
|
17481
17477
|
/**
|
|
17482
17478
|
* Move the specified child the bottom (z depth).
|
|
17483
17479
|
* @name moveToBottom
|
|
17484
|
-
* @memberof Container
|
|
17480
|
+
* @memberof Container
|
|
17485
17481
|
* @function
|
|
17486
17482
|
* @param {Renderable} child
|
|
17487
17483
|
*/
|
|
@@ -17501,7 +17497,7 @@ class Container extends Renderable {
|
|
|
17501
17497
|
/**
|
|
17502
17498
|
* Manually trigger the sort of all the childs in the container</p>
|
|
17503
17499
|
* @name sort
|
|
17504
|
-
* @memberof Container
|
|
17500
|
+
* @memberof Container
|
|
17505
17501
|
* @public
|
|
17506
17502
|
* @function
|
|
17507
17503
|
* @param {boolean} [recursive=false] recursively sort all containers if true
|
|
@@ -17596,7 +17592,7 @@ class Container extends Renderable {
|
|
|
17596
17592
|
* container update function. <br>
|
|
17597
17593
|
* automatically called by the game manager {@link game}
|
|
17598
17594
|
* @name update
|
|
17599
|
-
* @memberof Container
|
|
17595
|
+
* @memberof Container
|
|
17600
17596
|
* @function
|
|
17601
17597
|
* @protected
|
|
17602
17598
|
* @param {number} dt time since the last update in milliseconds.
|
|
@@ -17648,7 +17644,7 @@ class Container extends Renderable {
|
|
|
17648
17644
|
* draw the container. <br>
|
|
17649
17645
|
* automatically called by the game manager {@link game}
|
|
17650
17646
|
* @name draw
|
|
17651
|
-
* @memberof Container
|
|
17647
|
+
* @memberof Container
|
|
17652
17648
|
* @function
|
|
17653
17649
|
* @protected
|
|
17654
17650
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
@@ -18251,9 +18247,9 @@ class World extends Container {
|
|
|
18251
18247
|
}
|
|
18252
18248
|
|
|
18253
18249
|
/**
|
|
18254
|
-
*
|
|
18250
|
+
* game represents your current game, it contains all the objects,
|
|
18255
18251
|
* tilemap layers, current viewport, collision map, etc...<br>
|
|
18256
|
-
*
|
|
18252
|
+
* game is also responsible for updating (each frame) the object status and draw them.
|
|
18257
18253
|
* @namespace game
|
|
18258
18254
|
*/
|
|
18259
18255
|
|
|
@@ -18730,7 +18726,7 @@ class Camera2d extends Renderable {
|
|
|
18730
18726
|
*/
|
|
18731
18727
|
setDeadzone(w, h) {
|
|
18732
18728
|
if (typeof(this.deadzone) === "undefined") {
|
|
18733
|
-
this.deadzone = new Rect(0, 0, 0, 0);
|
|
18729
|
+
this.deadzone = new Rect$1(0, 0, 0, 0);
|
|
18734
18730
|
}
|
|
18735
18731
|
|
|
18736
18732
|
// reusing the old code for now...
|
|
@@ -19258,6 +19254,40 @@ class Stage {
|
|
|
19258
19254
|
*/
|
|
19259
19255
|
this.cameras = new Map();
|
|
19260
19256
|
|
|
19257
|
+
/**
|
|
19258
|
+
* The list of active lights in this stage.
|
|
19259
|
+
* (Note: Canvas Renderering mode will only properly support one light per stage)
|
|
19260
|
+
* @public
|
|
19261
|
+
* @type {Map<Light2d>}
|
|
19262
|
+
* @name lights
|
|
19263
|
+
* @memberof Stage
|
|
19264
|
+
* @see Light2d
|
|
19265
|
+
* @see Stage.ambientLight
|
|
19266
|
+
* @example
|
|
19267
|
+
* // create a white spot light
|
|
19268
|
+
* var whiteLight = new me.Light2d(0, 0, 140, "#fff", 0.7);
|
|
19269
|
+
* // and add the light to this current stage
|
|
19270
|
+
* this.lights.set("whiteLight", whiteLight);
|
|
19271
|
+
* // set a dark ambient light
|
|
19272
|
+
* this.ambientLight.parseCSS("#1117");
|
|
19273
|
+
* // make the light follow the mouse
|
|
19274
|
+
* me.input.registerPointerEvent("pointermove", me.game.viewport, (event) => {
|
|
19275
|
+
* whiteLight.centerOn(event.gameX, event.gameY);
|
|
19276
|
+
* });
|
|
19277
|
+
*/
|
|
19278
|
+
this.lights = new Map();
|
|
19279
|
+
|
|
19280
|
+
/**
|
|
19281
|
+
* an ambient light that will be added to the stage rendering
|
|
19282
|
+
* @public
|
|
19283
|
+
* @type {Color}
|
|
19284
|
+
* @name ambientLight
|
|
19285
|
+
* @memberof Stage
|
|
19286
|
+
* @default "#000000"
|
|
19287
|
+
* @see Light2d
|
|
19288
|
+
*/
|
|
19289
|
+
this.ambientLight = new Color(0, 0, 0, 0);
|
|
19290
|
+
|
|
19261
19291
|
/**
|
|
19262
19292
|
* The given constructor options
|
|
19263
19293
|
* @public
|
|
@@ -19313,7 +19343,13 @@ class Stage {
|
|
|
19313
19343
|
// update the camera/viewport
|
|
19314
19344
|
// iterate through all cameras
|
|
19315
19345
|
this.cameras.forEach(function(camera) {
|
|
19316
|
-
if (camera.update(dt)) {
|
|
19346
|
+
if (camera.update(dt) === true) {
|
|
19347
|
+
isDirty = true;
|
|
19348
|
+
} });
|
|
19349
|
+
|
|
19350
|
+
// update all lights
|
|
19351
|
+
this.lights.forEach((light) => {
|
|
19352
|
+
if (light.update(dt) === true) {
|
|
19317
19353
|
isDirty = true;
|
|
19318
19354
|
} });
|
|
19319
19355
|
|
|
@@ -19330,9 +19366,32 @@ class Stage {
|
|
|
19330
19366
|
*/
|
|
19331
19367
|
draw(renderer) {
|
|
19332
19368
|
// iterate through all cameras
|
|
19333
|
-
this.cameras.forEach(
|
|
19369
|
+
this.cameras.forEach((camera) => {
|
|
19334
19370
|
// render the root container
|
|
19335
19371
|
camera.draw(renderer, world);
|
|
19372
|
+
|
|
19373
|
+
// render the ambient light
|
|
19374
|
+
if (this.ambientLight.alpha !== 0) {
|
|
19375
|
+
renderer.save();
|
|
19376
|
+
// iterate through all lights
|
|
19377
|
+
this.lights.forEach((light) => {
|
|
19378
|
+
// cut out all lights visible areas
|
|
19379
|
+
renderer.setMask(light.getVisibleArea(), true);
|
|
19380
|
+
});
|
|
19381
|
+
// fill the screen with the ambient color
|
|
19382
|
+
renderer.setColor(this.ambientLight);
|
|
19383
|
+
renderer.fillRect(0, 0, camera.width, camera.height);
|
|
19384
|
+
// clear all masks
|
|
19385
|
+
renderer.clearMask();
|
|
19386
|
+
renderer.restore();
|
|
19387
|
+
}
|
|
19388
|
+
|
|
19389
|
+
// render all lights
|
|
19390
|
+
this.lights.forEach((light) => {
|
|
19391
|
+
light.preDraw(renderer, world);
|
|
19392
|
+
light.draw(renderer, world);
|
|
19393
|
+
light.postDraw(renderer, world);
|
|
19394
|
+
});
|
|
19336
19395
|
});
|
|
19337
19396
|
}
|
|
19338
19397
|
|
|
@@ -19343,6 +19402,11 @@ class Stage {
|
|
|
19343
19402
|
destroy() {
|
|
19344
19403
|
// clear all cameras
|
|
19345
19404
|
this.cameras.clear();
|
|
19405
|
+
// clear all lights
|
|
19406
|
+
this.lights.forEach((light) => {
|
|
19407
|
+
light.destroy();
|
|
19408
|
+
});
|
|
19409
|
+
this.lights.clear();
|
|
19346
19410
|
// notify the object
|
|
19347
19411
|
this.onDestroyEvent.apply(this, arguments);
|
|
19348
19412
|
}
|
|
@@ -19441,13 +19505,13 @@ class IconLogo extends Renderable {
|
|
|
19441
19505
|
constructor(x, y) {
|
|
19442
19506
|
super(x, y, 100, 85);
|
|
19443
19507
|
|
|
19444
|
-
this.
|
|
19508
|
+
this.iconTexture = pool$1.pull("CanvasTexture",
|
|
19445
19509
|
renderer.WebGLVersion > 1 ? this.width : nextPowerOfTwo(this.width),
|
|
19446
19510
|
renderer.WebGLVersion > 1 ? this.height : nextPowerOfTwo(this.height),
|
|
19447
|
-
|
|
19511
|
+
true
|
|
19448
19512
|
);
|
|
19449
19513
|
|
|
19450
|
-
var context =
|
|
19514
|
+
var context = this.iconTexture.context;
|
|
19451
19515
|
|
|
19452
19516
|
context.beginPath();
|
|
19453
19517
|
context.moveTo(0.7, 48.9);
|
|
@@ -19482,7 +19546,18 @@ class IconLogo extends Renderable {
|
|
|
19482
19546
|
* @ignore
|
|
19483
19547
|
*/
|
|
19484
19548
|
draw(renderer) {
|
|
19485
|
-
renderer.drawImage(this.
|
|
19549
|
+
renderer.drawImage(this.iconTexture.canvas, renderer.getWidth() / 2, this.pos.y);
|
|
19550
|
+
}
|
|
19551
|
+
|
|
19552
|
+
/**
|
|
19553
|
+
* Destroy function
|
|
19554
|
+
* @ignore
|
|
19555
|
+
*/
|
|
19556
|
+
destroy() {
|
|
19557
|
+
// call the parent destroy method
|
|
19558
|
+
super.destroy(arguments);
|
|
19559
|
+
pool$1.push(this.iconTexture);
|
|
19560
|
+
this.iconTexture = undefined;
|
|
19486
19561
|
}
|
|
19487
19562
|
}
|
|
19488
19563
|
|
|
@@ -20149,7 +20224,7 @@ function setTMXValue(name, type, value) {
|
|
|
20149
20224
|
match = value.split(/^eval:/i)[1];
|
|
20150
20225
|
try {
|
|
20151
20226
|
// eslint-disable-next-line
|
|
20152
|
-
value =
|
|
20227
|
+
value = Function("'use strict';return (" + match + ")")();
|
|
20153
20228
|
}
|
|
20154
20229
|
catch (e) {
|
|
20155
20230
|
throw new Error("Unable to evaluate: " + match);
|
|
@@ -21735,7 +21810,7 @@ class Sprite extends Renderable {
|
|
|
21735
21810
|
/**
|
|
21736
21811
|
* return the flickering state of the object
|
|
21737
21812
|
* @name isFlickering
|
|
21738
|
-
* @memberof Sprite
|
|
21813
|
+
* @memberof Sprite
|
|
21739
21814
|
* @function
|
|
21740
21815
|
* @returns {boolean}
|
|
21741
21816
|
*/
|
|
@@ -21746,7 +21821,7 @@ class Sprite extends Renderable {
|
|
|
21746
21821
|
/**
|
|
21747
21822
|
* make the object flicker
|
|
21748
21823
|
* @name flicker
|
|
21749
|
-
* @memberof Sprite
|
|
21824
|
+
* @memberof Sprite
|
|
21750
21825
|
* @function
|
|
21751
21826
|
* @param {number} duration expressed in milliseconds
|
|
21752
21827
|
* @param {Function} callback Function to call when flickering ends
|
|
@@ -21777,7 +21852,7 @@ class Sprite extends Renderable {
|
|
|
21777
21852
|
* logic as per the following example :<br>
|
|
21778
21853
|
* <img src="images/spritesheet_grid.png"/>
|
|
21779
21854
|
* @name addAnimation
|
|
21780
|
-
* @memberof Sprite
|
|
21855
|
+
* @memberof Sprite
|
|
21781
21856
|
* @function
|
|
21782
21857
|
* @param {string} name animation id
|
|
21783
21858
|
* @param {number[]|string[]|object[]} index list of sprite index or name
|
|
@@ -21877,7 +21952,7 @@ class Sprite extends Renderable {
|
|
|
21877
21952
|
* set the current animation
|
|
21878
21953
|
* this will always change the animation & set the frame to zero
|
|
21879
21954
|
* @name setCurrentAnimation
|
|
21880
|
-
* @memberof Sprite
|
|
21955
|
+
* @memberof Sprite
|
|
21881
21956
|
* @function
|
|
21882
21957
|
* @param {string} name animation id
|
|
21883
21958
|
* @param {string|Function} [resetAnim] animation id to switch to when complete, or callback
|
|
@@ -21938,7 +22013,7 @@ class Sprite extends Renderable {
|
|
|
21938
22013
|
/**
|
|
21939
22014
|
* reverse the given or current animation if none is specified
|
|
21940
22015
|
* @name reverseAnimation
|
|
21941
|
-
* @memberof Sprite
|
|
22016
|
+
* @memberof Sprite
|
|
21942
22017
|
* @function
|
|
21943
22018
|
* @param {string} [name] animation id
|
|
21944
22019
|
* @returns {Sprite} Reference to this object for method chaining
|
|
@@ -21957,7 +22032,7 @@ class Sprite extends Renderable {
|
|
|
21957
22032
|
/**
|
|
21958
22033
|
* return true if the specified animation is the current one.
|
|
21959
22034
|
* @name isCurrentAnimation
|
|
21960
|
-
* @memberof Sprite
|
|
22035
|
+
* @memberof Sprite
|
|
21961
22036
|
* @function
|
|
21962
22037
|
* @param {string} name animation id
|
|
21963
22038
|
* @returns {boolean}
|
|
@@ -21974,7 +22049,7 @@ class Sprite extends Renderable {
|
|
|
21974
22049
|
* change the current texture atlas region for this sprite
|
|
21975
22050
|
* @see Texture.getRegion
|
|
21976
22051
|
* @name setRegion
|
|
21977
|
-
* @memberof Sprite
|
|
22052
|
+
* @memberof Sprite
|
|
21978
22053
|
* @function
|
|
21979
22054
|
* @param {object} region typically returned through me.Texture.getRegion()
|
|
21980
22055
|
* @returns {Sprite} Reference to this object for method chaining
|
|
@@ -22006,7 +22081,7 @@ class Sprite extends Renderable {
|
|
|
22006
22081
|
/**
|
|
22007
22082
|
* force the current animation frame index.
|
|
22008
22083
|
* @name setAnimationFrame
|
|
22009
|
-
* @memberof Sprite
|
|
22084
|
+
* @memberof Sprite
|
|
22010
22085
|
* @function
|
|
22011
22086
|
* @param {number} [idx=0] animation frame index
|
|
22012
22087
|
* @returns {Sprite} Reference to this object for method chaining
|
|
@@ -22022,7 +22097,7 @@ class Sprite extends Renderable {
|
|
|
22022
22097
|
/**
|
|
22023
22098
|
* return the current animation frame index.
|
|
22024
22099
|
* @name getCurrentAnimationFrame
|
|
22025
|
-
* @memberof Sprite
|
|
22100
|
+
* @memberof Sprite
|
|
22026
22101
|
* @function
|
|
22027
22102
|
* @returns {number} current animation frame index
|
|
22028
22103
|
*/
|
|
@@ -22033,7 +22108,7 @@ class Sprite extends Renderable {
|
|
|
22033
22108
|
/**
|
|
22034
22109
|
* Returns the frame object by the index.
|
|
22035
22110
|
* @name getAnimationFrameObjectByIndex
|
|
22036
|
-
* @memberof Sprite
|
|
22111
|
+
* @memberof Sprite
|
|
22037
22112
|
* @function
|
|
22038
22113
|
* @ignore
|
|
22039
22114
|
* @param {number} id the frame id
|
|
@@ -22047,7 +22122,7 @@ class Sprite extends Renderable {
|
|
|
22047
22122
|
* update function. <br>
|
|
22048
22123
|
* automatically called by the game manager {@link game}
|
|
22049
22124
|
* @name update
|
|
22050
|
-
* @memberof Sprite
|
|
22125
|
+
* @memberof Sprite
|
|
22051
22126
|
* @function
|
|
22052
22127
|
* @protected
|
|
22053
22128
|
* @param {number} dt time since the last update in milliseconds.
|
|
@@ -22126,7 +22201,7 @@ class Sprite extends Renderable {
|
|
|
22126
22201
|
* sprite draw. <br>
|
|
22127
22202
|
* automatically called by the game manager {@link game}
|
|
22128
22203
|
* @name draw
|
|
22129
|
-
* @memberof Sprite
|
|
22204
|
+
* @memberof Sprite
|
|
22130
22205
|
* @function
|
|
22131
22206
|
* @protected
|
|
22132
22207
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
@@ -22364,7 +22439,7 @@ class Tile extends Bounds$1 {
|
|
|
22364
22439
|
* a rectangle object with rounded corners
|
|
22365
22440
|
* @augments Rect
|
|
22366
22441
|
*/
|
|
22367
|
-
class RoundRect extends Rect {
|
|
22442
|
+
class RoundRect extends Rect$1 {
|
|
22368
22443
|
/**
|
|
22369
22444
|
* @param {number} x position of the rounded rectangle
|
|
22370
22445
|
* @param {number} y position of the rounded rectangle
|
|
@@ -22393,7 +22468,7 @@ class RoundRect extends Rect {
|
|
|
22393
22468
|
* @type {number}
|
|
22394
22469
|
* @default 20
|
|
22395
22470
|
* @name radius
|
|
22396
|
-
* @memberof RoundRect
|
|
22471
|
+
* @memberof RoundRect
|
|
22397
22472
|
*/
|
|
22398
22473
|
get radius() {
|
|
22399
22474
|
return this._radius;
|
|
@@ -22412,7 +22487,7 @@ class RoundRect extends Rect {
|
|
|
22412
22487
|
/**
|
|
22413
22488
|
* copy the position, size and radius of the given rounded rectangle into this one
|
|
22414
22489
|
* @name copy
|
|
22415
|
-
* @memberof RoundRect
|
|
22490
|
+
* @memberof RoundRect
|
|
22416
22491
|
* @function
|
|
22417
22492
|
* @param {RoundRect} rrect source rounded rectangle
|
|
22418
22493
|
* @returns {RoundRect} new rectangle
|
|
@@ -22426,7 +22501,7 @@ class RoundRect extends Rect {
|
|
|
22426
22501
|
/**
|
|
22427
22502
|
* Returns true if the rounded rectangle contains the given point
|
|
22428
22503
|
* @name contains
|
|
22429
|
-
* @memberof RoundRect
|
|
22504
|
+
* @memberof RoundRect
|
|
22430
22505
|
* @function
|
|
22431
22506
|
* @param {number} x x coordinate
|
|
22432
22507
|
* @param {number} y y coordinate
|
|
@@ -22436,7 +22511,7 @@ class RoundRect extends Rect {
|
|
|
22436
22511
|
/**
|
|
22437
22512
|
* Returns true if the rounded rectangle contains the given point
|
|
22438
22513
|
* @name contains
|
|
22439
|
-
* @memberof RoundRect
|
|
22514
|
+
* @memberof RoundRect
|
|
22440
22515
|
* @function
|
|
22441
22516
|
* @param {Vector2d} point
|
|
22442
22517
|
* @returns {boolean} true if contains
|
|
@@ -22449,7 +22524,7 @@ class RoundRect extends Rect {
|
|
|
22449
22524
|
_x = arg0;
|
|
22450
22525
|
_y = arguments[1];
|
|
22451
22526
|
} else {
|
|
22452
|
-
if (arg0 instanceof Rect) {
|
|
22527
|
+
if (arg0 instanceof Rect$1) {
|
|
22453
22528
|
// good enough
|
|
22454
22529
|
return super.contains(arg0);
|
|
22455
22530
|
} else {
|
|
@@ -22497,7 +22572,7 @@ class RoundRect extends Rect {
|
|
|
22497
22572
|
/**
|
|
22498
22573
|
* check if this RoundRect is identical to the specified one
|
|
22499
22574
|
* @name equals
|
|
22500
|
-
* @memberof RoundRect
|
|
22575
|
+
* @memberof RoundRect
|
|
22501
22576
|
* @function
|
|
22502
22577
|
* @param {RoundRect} rrect
|
|
22503
22578
|
* @returns {boolean} true if equals
|
|
@@ -22509,7 +22584,7 @@ class RoundRect extends Rect {
|
|
|
22509
22584
|
/**
|
|
22510
22585
|
* clone this RoundRect
|
|
22511
22586
|
* @name clone
|
|
22512
|
-
* @memberof RoundRect
|
|
22587
|
+
* @memberof RoundRect
|
|
22513
22588
|
* @function
|
|
22514
22589
|
* @returns {RoundRect} new RoundRect
|
|
22515
22590
|
*/
|
|
@@ -22532,7 +22607,7 @@ class Line extends Polygon {
|
|
|
22532
22607
|
/**
|
|
22533
22608
|
* Returns true if the Line contains the given point
|
|
22534
22609
|
* @name contains
|
|
22535
|
-
* @memberof Line
|
|
22610
|
+
* @memberof Line
|
|
22536
22611
|
* @function
|
|
22537
22612
|
* @param {Vector2d} point
|
|
22538
22613
|
* @returns {boolean} true if contains
|
|
@@ -22541,7 +22616,7 @@ class Line extends Polygon {
|
|
|
22541
22616
|
/**
|
|
22542
22617
|
* Returns true if the Line contains the given point
|
|
22543
22618
|
* @name contains
|
|
22544
|
-
* @memberof Line
|
|
22619
|
+
* @memberof Line
|
|
22545
22620
|
* @function
|
|
22546
22621
|
* @param {number} x x coordinate
|
|
22547
22622
|
* @param {number} y y coordinate
|
|
@@ -22575,7 +22650,7 @@ class Line extends Polygon {
|
|
|
22575
22650
|
* Computes the calculated collision edges and normals.
|
|
22576
22651
|
* This **must** be called if the `points` array, `angle`, or `offset` is modified manually.
|
|
22577
22652
|
* @name recalc
|
|
22578
|
-
* @memberof Line
|
|
22653
|
+
* @memberof Line
|
|
22579
22654
|
* @function
|
|
22580
22655
|
* @returns {Line} this instance for objecf chaining
|
|
22581
22656
|
*/
|
|
@@ -22611,7 +22686,7 @@ class Line extends Polygon {
|
|
|
22611
22686
|
/**
|
|
22612
22687
|
* clone this line segment
|
|
22613
22688
|
* @name clone
|
|
22614
|
-
* @memberof Line
|
|
22689
|
+
* @memberof Line
|
|
22615
22690
|
* @function
|
|
22616
22691
|
* @returns {Line} new Line
|
|
22617
22692
|
*/
|
|
@@ -22657,7 +22732,7 @@ class Path2D$1 {
|
|
|
22657
22732
|
/**
|
|
22658
22733
|
* begin a new path
|
|
22659
22734
|
* @name beginPath
|
|
22660
|
-
* @memberof Path2D
|
|
22735
|
+
* @memberof Path2D
|
|
22661
22736
|
* @function
|
|
22662
22737
|
*/
|
|
22663
22738
|
beginPath() {
|
|
@@ -22673,7 +22748,7 @@ class Path2D$1 {
|
|
|
22673
22748
|
* It tries to draw a straight line from the current point to the start.
|
|
22674
22749
|
* If the shape has already been closed or has only one point, this function does nothing.
|
|
22675
22750
|
* @name closePath
|
|
22676
|
-
* @memberof Path2D
|
|
22751
|
+
* @memberof Path2D
|
|
22677
22752
|
* @function
|
|
22678
22753
|
*/
|
|
22679
22754
|
closePath() {
|
|
@@ -22686,7 +22761,7 @@ class Path2D$1 {
|
|
|
22686
22761
|
/**
|
|
22687
22762
|
* triangulate the shape defined by this path into an array of triangles
|
|
22688
22763
|
* @name triangulatePath
|
|
22689
|
-
* @memberof Path2D
|
|
22764
|
+
* @memberof Path2D
|
|
22690
22765
|
* @function
|
|
22691
22766
|
* @returns {Vector2d[]}
|
|
22692
22767
|
*/
|
|
@@ -22717,7 +22792,7 @@ class Path2D$1 {
|
|
|
22717
22792
|
/**
|
|
22718
22793
|
* moves the starting point of the current path to the (x, y) coordinates.
|
|
22719
22794
|
* @name moveTo
|
|
22720
|
-
* @memberof Path2D
|
|
22795
|
+
* @memberof Path2D
|
|
22721
22796
|
* @function
|
|
22722
22797
|
* @param {number} x the x-axis (horizontal) coordinate of the point.
|
|
22723
22798
|
* @param {number} y the y-axis (vertical) coordinate of the point.
|
|
@@ -22729,7 +22804,7 @@ class Path2D$1 {
|
|
|
22729
22804
|
/**
|
|
22730
22805
|
* connects the last point in the current patch to the (x, y) coordinates with a straight line.
|
|
22731
22806
|
* @name lineTo
|
|
22732
|
-
* @memberof Path2D
|
|
22807
|
+
* @memberof Path2D
|
|
22733
22808
|
* @function
|
|
22734
22809
|
* @param {number} x the x-axis coordinate of the line's end point.
|
|
22735
22810
|
* @param {number} y the y-axis coordinate of the line's end point.
|
|
@@ -22742,7 +22817,7 @@ class Path2D$1 {
|
|
|
22742
22817
|
* adds an arc to the current path which is centered at (x, y) position with the given radius,
|
|
22743
22818
|
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise (defaulting to clockwise).
|
|
22744
22819
|
* @name arc
|
|
22745
|
-
* @memberof Path2D
|
|
22820
|
+
* @memberof Path2D
|
|
22746
22821
|
* @function
|
|
22747
22822
|
* @param {number} x the horizontal coordinate of the arc's center.
|
|
22748
22823
|
* @param {number} y the vertical coordinate of the arc's center.
|
|
@@ -22792,7 +22867,7 @@ class Path2D$1 {
|
|
|
22792
22867
|
/**
|
|
22793
22868
|
* adds a circular arc to the path with the given control points and radius, connected to the previous point by a straight line.
|
|
22794
22869
|
* @name arcTo
|
|
22795
|
-
* @memberof Path2D
|
|
22870
|
+
* @memberof Path2D
|
|
22796
22871
|
* @function
|
|
22797
22872
|
* @param {number} x the x-axis coordinate of the first control point.
|
|
22798
22873
|
* @param {number} y the y-axis coordinate of the first control point.
|
|
@@ -22841,7 +22916,7 @@ class Path2D$1 {
|
|
|
22841
22916
|
* adds an elliptical arc to the path which is centered at (x, y) position with the radii radiusX and radiusY
|
|
22842
22917
|
* starting at startAngle and ending at endAngle going in the given direction by counterclockwise.
|
|
22843
22918
|
* @name ellipse
|
|
22844
|
-
* @memberof Path2D
|
|
22919
|
+
* @memberof Path2D
|
|
22845
22920
|
* @function
|
|
22846
22921
|
* @param {number} x the x-axis (horizontal) coordinate of the ellipse's center.
|
|
22847
22922
|
* @param {number} y the y-axis (vertical) coordinate of the ellipse's center.
|
|
@@ -22901,7 +22976,7 @@ class Path2D$1 {
|
|
|
22901
22976
|
/**
|
|
22902
22977
|
* creates a path for a rectangle at position (x, y) with a size that is determined by width and height.
|
|
22903
22978
|
* @name rect
|
|
22904
|
-
* @memberof Path2D
|
|
22979
|
+
* @memberof Path2D
|
|
22905
22980
|
* @function
|
|
22906
22981
|
* @param {number} x the x-axis coordinate of the rectangle's starting point.
|
|
22907
22982
|
* @param {number} y the y-axis coordinate of the rectangle's starting point.
|
|
@@ -22919,7 +22994,7 @@ class Path2D$1 {
|
|
|
22919
22994
|
/**
|
|
22920
22995
|
* adds an rounded rectangle to the current path.
|
|
22921
22996
|
* @name roundRect
|
|
22922
|
-
* @memberof Path2D
|
|
22997
|
+
* @memberof Path2D
|
|
22923
22998
|
* @function
|
|
22924
22999
|
* @param {number} x the x-axis coordinate of the rectangle's starting point.
|
|
22925
23000
|
* @param {number} y the y-axis coordinate of the rectangle's starting point.
|
|
@@ -22992,6 +23067,11 @@ class Renderer {
|
|
|
22992
23067
|
*/
|
|
22993
23068
|
this.currentScissor = new Int32Array([ 0, 0, this.settings.width, this.settings.height ]);
|
|
22994
23069
|
|
|
23070
|
+
/**
|
|
23071
|
+
* @ignore
|
|
23072
|
+
*/
|
|
23073
|
+
this.maskLevel = 0;
|
|
23074
|
+
|
|
22995
23075
|
/**
|
|
22996
23076
|
* @ignore
|
|
22997
23077
|
*/
|
|
@@ -23035,7 +23115,7 @@ class Renderer {
|
|
|
23035
23115
|
/**
|
|
23036
23116
|
* prepare the framebuffer for drawing a new frame
|
|
23037
23117
|
* @name clear
|
|
23038
|
-
* @memberof Renderer
|
|
23118
|
+
* @memberof Renderer
|
|
23039
23119
|
* @function
|
|
23040
23120
|
*/
|
|
23041
23121
|
clear() {}
|
|
@@ -23043,7 +23123,7 @@ class Renderer {
|
|
|
23043
23123
|
/**
|
|
23044
23124
|
* Reset context state
|
|
23045
23125
|
* @name reset
|
|
23046
|
-
* @memberof Renderer
|
|
23126
|
+
* @memberof Renderer
|
|
23047
23127
|
* @function
|
|
23048
23128
|
*/
|
|
23049
23129
|
reset() {
|
|
@@ -23056,12 +23136,13 @@ class Renderer {
|
|
|
23056
23136
|
this.currentScissor[1] = 0;
|
|
23057
23137
|
this.currentScissor[2] = this.backBufferCanvas.width;
|
|
23058
23138
|
this.currentScissor[3] = this.backBufferCanvas.height;
|
|
23139
|
+
this.clearMask();
|
|
23059
23140
|
}
|
|
23060
23141
|
|
|
23061
23142
|
/**
|
|
23062
23143
|
* return a reference to the system canvas
|
|
23063
23144
|
* @name getCanvas
|
|
23064
|
-
* @memberof Renderer
|
|
23145
|
+
* @memberof Renderer
|
|
23065
23146
|
* @function
|
|
23066
23147
|
* @returns {HTMLCanvasElement}
|
|
23067
23148
|
*/
|
|
@@ -23072,7 +23153,7 @@ class Renderer {
|
|
|
23072
23153
|
/**
|
|
23073
23154
|
* return a reference to the screen canvas
|
|
23074
23155
|
* @name getScreenCanvas
|
|
23075
|
-
* @memberof Renderer
|
|
23156
|
+
* @memberof Renderer
|
|
23076
23157
|
* @function
|
|
23077
23158
|
* @returns {HTMLCanvasElement}
|
|
23078
23159
|
*/
|
|
@@ -23084,7 +23165,7 @@ class Renderer {
|
|
|
23084
23165
|
* return a reference to the screen canvas corresponding 2d Context<br>
|
|
23085
23166
|
* (will return buffered context if double buffering is enabled, or a reference to the Screen Context)
|
|
23086
23167
|
* @name getScreenContext
|
|
23087
|
-
* @memberof Renderer
|
|
23168
|
+
* @memberof Renderer
|
|
23088
23169
|
* @function
|
|
23089
23170
|
* @returns {CanvasRenderingContext2D}
|
|
23090
23171
|
*/
|
|
@@ -23095,7 +23176,7 @@ class Renderer {
|
|
|
23095
23176
|
/**
|
|
23096
23177
|
* returns the current blend mode for this renderer
|
|
23097
23178
|
* @name getBlendMode
|
|
23098
|
-
* @memberof Renderer
|
|
23179
|
+
* @memberof Renderer
|
|
23099
23180
|
* @function
|
|
23100
23181
|
* @returns {string} blend mode
|
|
23101
23182
|
*/
|
|
@@ -23107,7 +23188,7 @@ class Renderer {
|
|
|
23107
23188
|
* Returns the 2D Context object of the given Canvas<br>
|
|
23108
23189
|
* Also configures anti-aliasing and blend modes based on constructor options.
|
|
23109
23190
|
* @name getContext2d
|
|
23110
|
-
* @memberof Renderer
|
|
23191
|
+
* @memberof Renderer
|
|
23111
23192
|
* @function
|
|
23112
23193
|
* @param {HTMLCanvasElement} canvas
|
|
23113
23194
|
* @param {boolean} [transparent=true] use false to disable transparency
|
|
@@ -23145,7 +23226,7 @@ class Renderer {
|
|
|
23145
23226
|
/**
|
|
23146
23227
|
* return the width of the system Canvas
|
|
23147
23228
|
* @name getWidth
|
|
23148
|
-
* @memberof Renderer
|
|
23229
|
+
* @memberof Renderer
|
|
23149
23230
|
* @function
|
|
23150
23231
|
* @returns {number}
|
|
23151
23232
|
*/
|
|
@@ -23156,7 +23237,7 @@ class Renderer {
|
|
|
23156
23237
|
/**
|
|
23157
23238
|
* return the height of the system Canvas
|
|
23158
23239
|
* @name getHeight
|
|
23159
|
-
* @memberof Renderer
|
|
23240
|
+
* @memberof Renderer
|
|
23160
23241
|
* @function
|
|
23161
23242
|
* @returns {number} height of the system Canvas
|
|
23162
23243
|
*/
|
|
@@ -23167,7 +23248,7 @@ class Renderer {
|
|
|
23167
23248
|
/**
|
|
23168
23249
|
* get the current fill & stroke style color.
|
|
23169
23250
|
* @name getColor
|
|
23170
|
-
* @memberof Renderer
|
|
23251
|
+
* @memberof Renderer
|
|
23171
23252
|
* @function
|
|
23172
23253
|
* @returns {Color} current global color
|
|
23173
23254
|
*/
|
|
@@ -23178,7 +23259,7 @@ class Renderer {
|
|
|
23178
23259
|
/**
|
|
23179
23260
|
* return the current global alpha
|
|
23180
23261
|
* @name globalAlpha
|
|
23181
|
-
* @memberof Renderer
|
|
23262
|
+
* @memberof Renderer
|
|
23182
23263
|
* @function
|
|
23183
23264
|
* @returns {number}
|
|
23184
23265
|
*/
|
|
@@ -23189,7 +23270,7 @@ class Renderer {
|
|
|
23189
23270
|
/**
|
|
23190
23271
|
* check if the given rect or bounds overlaps with the renderer screen coordinates
|
|
23191
23272
|
* @name overlaps
|
|
23192
|
-
* @memberof Renderer
|
|
23273
|
+
* @memberof Renderer
|
|
23193
23274
|
* @function
|
|
23194
23275
|
* @param {Rect|Bounds} bounds
|
|
23195
23276
|
* @returns {boolean} true if overlaps
|
|
@@ -23205,7 +23286,7 @@ class Renderer {
|
|
|
23205
23286
|
/**
|
|
23206
23287
|
* resizes the system canvas
|
|
23207
23288
|
* @name resize
|
|
23208
|
-
* @memberof Renderer
|
|
23289
|
+
* @memberof Renderer
|
|
23209
23290
|
* @function
|
|
23210
23291
|
* @param {number} width new width of the canvas
|
|
23211
23292
|
* @param {number} height new height of the canvas
|
|
@@ -23226,7 +23307,7 @@ class Renderer {
|
|
|
23226
23307
|
/**
|
|
23227
23308
|
* enable/disable image smoothing (scaling interpolation) for the given context
|
|
23228
23309
|
* @name setAntiAlias
|
|
23229
|
-
* @memberof Renderer
|
|
23310
|
+
* @memberof Renderer
|
|
23230
23311
|
* @function
|
|
23231
23312
|
* @param {CanvasRenderingContext2D} context
|
|
23232
23313
|
* @param {boolean} [enable=false]
|
|
@@ -23256,7 +23337,7 @@ class Renderer {
|
|
|
23256
23337
|
/**
|
|
23257
23338
|
* set/change the current projection matrix (WebGL only)
|
|
23258
23339
|
* @name setProjection
|
|
23259
|
-
* @memberof Renderer
|
|
23340
|
+
* @memberof Renderer
|
|
23260
23341
|
* @function
|
|
23261
23342
|
* @param {Matrix3d} matrix
|
|
23262
23343
|
*/
|
|
@@ -23267,13 +23348,17 @@ class Renderer {
|
|
|
23267
23348
|
/**
|
|
23268
23349
|
* stroke the given shape
|
|
23269
23350
|
* @name stroke
|
|
23270
|
-
* @memberof Renderer
|
|
23351
|
+
* @memberof Renderer
|
|
23271
23352
|
* @function
|
|
23272
23353
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to stroke
|
|
23273
23354
|
* @param {boolean} [fill=false] fill the shape with the current color if true
|
|
23274
23355
|
*/
|
|
23275
23356
|
stroke(shape, fill) {
|
|
23276
|
-
if (shape instanceof
|
|
23357
|
+
if (shape instanceof RoundRect) {
|
|
23358
|
+
this.strokeRoundRect(shape.left, shape.top, shape.width, shape.height, shape.radius, fill);
|
|
23359
|
+
return;
|
|
23360
|
+
}
|
|
23361
|
+
if (shape instanceof Rect$1 || shape instanceof Bounds$1) {
|
|
23277
23362
|
this.strokeRect(shape.left, shape.top, shape.width, shape.height, fill);
|
|
23278
23363
|
return;
|
|
23279
23364
|
}
|
|
@@ -23281,10 +23366,6 @@ class Renderer {
|
|
|
23281
23366
|
this.strokePolygon(shape, fill);
|
|
23282
23367
|
return;
|
|
23283
23368
|
}
|
|
23284
|
-
if (shape instanceof RoundRect) {
|
|
23285
|
-
this.strokeRoundRect(shape.left, shape.top, shape.width, shape.height, shape.radius, fill);
|
|
23286
|
-
return;
|
|
23287
|
-
}
|
|
23288
23369
|
if (shape instanceof Ellipse) {
|
|
23289
23370
|
this.strokeEllipse(
|
|
23290
23371
|
shape.pos.x,
|
|
@@ -23301,7 +23382,7 @@ class Renderer {
|
|
|
23301
23382
|
/**
|
|
23302
23383
|
* fill the given shape
|
|
23303
23384
|
* @name fill
|
|
23304
|
-
* @memberof Renderer
|
|
23385
|
+
* @memberof Renderer
|
|
23305
23386
|
* @function
|
|
23306
23387
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} shape a shape object to fill
|
|
23307
23388
|
*/
|
|
@@ -23312,7 +23393,7 @@ class Renderer {
|
|
|
23312
23393
|
/**
|
|
23313
23394
|
* tint the given image or canvas using the given color
|
|
23314
23395
|
* @name tint
|
|
23315
|
-
* @memberof Renderer
|
|
23396
|
+
* @memberof Renderer
|
|
23316
23397
|
* @function
|
|
23317
23398
|
* @param {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas} src the source image to be tinted
|
|
23318
23399
|
* @param {Color|string} color the color that will be used to tint the image
|
|
@@ -23343,9 +23424,10 @@ class Renderer {
|
|
|
23343
23424
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
23344
23425
|
* Mask are not preserved through renderer context save and restore.
|
|
23345
23426
|
* @name setMask
|
|
23346
|
-
* @memberof Renderer
|
|
23427
|
+
* @memberof Renderer
|
|
23347
23428
|
* @function
|
|
23348
23429
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
23430
|
+
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
23349
23431
|
*/
|
|
23350
23432
|
// eslint-disable-next-line no-unused-vars
|
|
23351
23433
|
setMask(mask) {}
|
|
@@ -23354,7 +23436,7 @@ class Renderer {
|
|
|
23354
23436
|
* disable (remove) the rendering mask set through setMask.
|
|
23355
23437
|
* @name clearMask
|
|
23356
23438
|
* @see Renderer#setMask
|
|
23357
|
-
* @memberof Renderer
|
|
23439
|
+
* @memberof Renderer
|
|
23358
23440
|
* @function
|
|
23359
23441
|
*/
|
|
23360
23442
|
clearMask() {}
|
|
@@ -23362,7 +23444,7 @@ class Renderer {
|
|
|
23362
23444
|
/**
|
|
23363
23445
|
* set a coloring tint for sprite based renderables
|
|
23364
23446
|
* @name setTint
|
|
23365
|
-
* @memberof Renderer
|
|
23447
|
+
* @memberof Renderer
|
|
23366
23448
|
* @function
|
|
23367
23449
|
* @param {Color} tint the tint color
|
|
23368
23450
|
* @param {number} [alpha] an alpha value to be applied to the tint
|
|
@@ -23377,7 +23459,7 @@ class Renderer {
|
|
|
23377
23459
|
* clear the rendering tint set through setTint.
|
|
23378
23460
|
* @name clearTint
|
|
23379
23461
|
* @see Renderer#setTint
|
|
23380
|
-
* @memberof Renderer
|
|
23462
|
+
* @memberof Renderer
|
|
23381
23463
|
* @function
|
|
23382
23464
|
*/
|
|
23383
23465
|
clearTint() {
|
|
@@ -23457,7 +23539,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23457
23539
|
/**
|
|
23458
23540
|
* Reset context state
|
|
23459
23541
|
* @name reset
|
|
23460
|
-
* @memberof CanvasRenderer
|
|
23542
|
+
* @memberof CanvasRenderer
|
|
23461
23543
|
* @function
|
|
23462
23544
|
*/
|
|
23463
23545
|
reset() {
|
|
@@ -23468,7 +23550,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23468
23550
|
/**
|
|
23469
23551
|
* Reset the canvas transform to identity
|
|
23470
23552
|
* @name resetTransform
|
|
23471
|
-
* @memberof CanvasRenderer
|
|
23553
|
+
* @memberof CanvasRenderer
|
|
23472
23554
|
* @function
|
|
23473
23555
|
*/
|
|
23474
23556
|
resetTransform() {
|
|
@@ -23488,7 +23570,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23488
23570
|
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
23489
23571
|
* @name setBlendMode
|
|
23490
23572
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
23491
|
-
* @memberof CanvasRenderer
|
|
23573
|
+
* @memberof CanvasRenderer
|
|
23492
23574
|
* @function
|
|
23493
23575
|
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter, "additive", "screen"
|
|
23494
23576
|
* @param {CanvasRenderingContext2D} [context]
|
|
@@ -23526,7 +23608,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23526
23608
|
/**
|
|
23527
23609
|
* prepare the framebuffer for drawing a new frame
|
|
23528
23610
|
* @name clear
|
|
23529
|
-
* @memberof CanvasRenderer
|
|
23611
|
+
* @memberof CanvasRenderer
|
|
23530
23612
|
* @function
|
|
23531
23613
|
*/
|
|
23532
23614
|
clear() {
|
|
@@ -23538,7 +23620,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23538
23620
|
/**
|
|
23539
23621
|
* render the main framebuffer on screen
|
|
23540
23622
|
* @name flush
|
|
23541
|
-
* @memberof CanvasRenderer
|
|
23623
|
+
* @memberof CanvasRenderer
|
|
23542
23624
|
* @function
|
|
23543
23625
|
*/
|
|
23544
23626
|
flush() {
|
|
@@ -23550,7 +23632,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23550
23632
|
/**
|
|
23551
23633
|
* Clears the main framebuffer with the given color
|
|
23552
23634
|
* @name clearColor
|
|
23553
|
-
* @memberof CanvasRenderer
|
|
23635
|
+
* @memberof CanvasRenderer
|
|
23554
23636
|
* @function
|
|
23555
23637
|
* @param {Color|string} [color="#000000"] CSS color.
|
|
23556
23638
|
* @param {boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
|
|
@@ -23567,7 +23649,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23567
23649
|
/**
|
|
23568
23650
|
* Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
|
|
23569
23651
|
* @name clearRect
|
|
23570
|
-
* @memberof CanvasRenderer
|
|
23652
|
+
* @memberof CanvasRenderer
|
|
23571
23653
|
* @function
|
|
23572
23654
|
* @param {number} x x axis of the coordinate for the rectangle starting point.
|
|
23573
23655
|
* @param {number} y y axis of the coordinate for the rectangle starting point.
|
|
@@ -23581,7 +23663,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23581
23663
|
/**
|
|
23582
23664
|
* Create a pattern with the specified repetition
|
|
23583
23665
|
* @name createPattern
|
|
23584
|
-
* @memberof CanvasRenderer
|
|
23666
|
+
* @memberof CanvasRenderer
|
|
23585
23667
|
* @function
|
|
23586
23668
|
* @param {Image} image Source image
|
|
23587
23669
|
* @param {string} repeat Define how the pattern should be repeated
|
|
@@ -23600,7 +23682,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23600
23682
|
/**
|
|
23601
23683
|
* Draw an image onto the main using the canvas api
|
|
23602
23684
|
* @name drawImage
|
|
23603
|
-
* @memberof CanvasRenderer
|
|
23685
|
+
* @memberof CanvasRenderer
|
|
23604
23686
|
* @function
|
|
23605
23687
|
* @param {Image} image An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas.
|
|
23606
23688
|
* @param {number} sx The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
@@ -23664,7 +23746,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23664
23746
|
/**
|
|
23665
23747
|
* Draw a pattern within the given rectangle.
|
|
23666
23748
|
* @name drawPattern
|
|
23667
|
-
* @memberof CanvasRenderer
|
|
23749
|
+
* @memberof CanvasRenderer
|
|
23668
23750
|
* @function
|
|
23669
23751
|
* @param {CanvasPattern} pattern Pattern object
|
|
23670
23752
|
* @param {number} x
|
|
@@ -23688,7 +23770,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23688
23770
|
/**
|
|
23689
23771
|
* Stroke an arc at the specified coordinates with given radius, start and end points
|
|
23690
23772
|
* @name strokeArc
|
|
23691
|
-
* @memberof CanvasRenderer
|
|
23773
|
+
* @memberof CanvasRenderer
|
|
23692
23774
|
* @function
|
|
23693
23775
|
* @param {number} x arc center point x-axis
|
|
23694
23776
|
* @param {number} y arc center point y-axis
|
|
@@ -23715,7 +23797,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23715
23797
|
/**
|
|
23716
23798
|
* Fill an arc at the specified coordinates with given radius, start and end points
|
|
23717
23799
|
* @name fillArc
|
|
23718
|
-
* @memberof CanvasRenderer
|
|
23800
|
+
* @memberof CanvasRenderer
|
|
23719
23801
|
* @function
|
|
23720
23802
|
* @param {number} x arc center point x-axis
|
|
23721
23803
|
* @param {number} y arc center point y-axis
|
|
@@ -23731,7 +23813,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23731
23813
|
/**
|
|
23732
23814
|
* Stroke an ellipse at the specified coordinates with given radius
|
|
23733
23815
|
* @name strokeEllipse
|
|
23734
|
-
* @memberof CanvasRenderer
|
|
23816
|
+
* @memberof CanvasRenderer
|
|
23735
23817
|
* @function
|
|
23736
23818
|
* @param {number} x ellipse center point x-axis
|
|
23737
23819
|
* @param {number} y ellipse center point y-axis
|
|
@@ -23773,7 +23855,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23773
23855
|
/**
|
|
23774
23856
|
* Fill an ellipse at the specified coordinates with given radius
|
|
23775
23857
|
* @name fillEllipse
|
|
23776
|
-
* @memberof CanvasRenderer
|
|
23858
|
+
* @memberof CanvasRenderer
|
|
23777
23859
|
* @function
|
|
23778
23860
|
* @param {number} x ellipse center point x-axis
|
|
23779
23861
|
* @param {number} y ellipse center point y-axis
|
|
@@ -23787,7 +23869,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23787
23869
|
/**
|
|
23788
23870
|
* Stroke a line of the given two points
|
|
23789
23871
|
* @name strokeLine
|
|
23790
|
-
* @memberof CanvasRenderer
|
|
23872
|
+
* @memberof CanvasRenderer
|
|
23791
23873
|
* @function
|
|
23792
23874
|
* @param {number} startX the start x coordinate
|
|
23793
23875
|
* @param {number} startY the start y coordinate
|
|
@@ -23809,7 +23891,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23809
23891
|
/**
|
|
23810
23892
|
* Fill a line of the given two points
|
|
23811
23893
|
* @name fillLine
|
|
23812
|
-
* @memberof CanvasRenderer
|
|
23894
|
+
* @memberof CanvasRenderer
|
|
23813
23895
|
* @function
|
|
23814
23896
|
* @param {number} startX the start x coordinate
|
|
23815
23897
|
* @param {number} startY the start y coordinate
|
|
@@ -23823,7 +23905,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23823
23905
|
/**
|
|
23824
23906
|
* Stroke the given me.Polygon on the screen
|
|
23825
23907
|
* @name strokePolygon
|
|
23826
|
-
* @memberof CanvasRenderer
|
|
23908
|
+
* @memberof CanvasRenderer
|
|
23827
23909
|
* @function
|
|
23828
23910
|
* @param {Polygon} poly the shape to draw
|
|
23829
23911
|
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
@@ -23852,7 +23934,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23852
23934
|
/**
|
|
23853
23935
|
* Fill the given me.Polygon on the screen
|
|
23854
23936
|
* @name fillPolygon
|
|
23855
|
-
* @memberof CanvasRenderer
|
|
23937
|
+
* @memberof CanvasRenderer
|
|
23856
23938
|
* @function
|
|
23857
23939
|
* @param {Polygon} poly the shape to draw
|
|
23858
23940
|
*/
|
|
@@ -23863,7 +23945,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23863
23945
|
/**
|
|
23864
23946
|
* Stroke a rectangle at the specified coordinates
|
|
23865
23947
|
* @name strokeRect
|
|
23866
|
-
* @memberof CanvasRenderer
|
|
23948
|
+
* @memberof CanvasRenderer
|
|
23867
23949
|
* @function
|
|
23868
23950
|
* @param {number} x
|
|
23869
23951
|
* @param {number} y
|
|
@@ -23884,7 +23966,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23884
23966
|
/**
|
|
23885
23967
|
* Draw a filled rectangle at the specified coordinates
|
|
23886
23968
|
* @name fillRect
|
|
23887
|
-
* @memberof CanvasRenderer
|
|
23969
|
+
* @memberof CanvasRenderer
|
|
23888
23970
|
* @function
|
|
23889
23971
|
* @param {number} x
|
|
23890
23972
|
* @param {number} y
|
|
@@ -23898,7 +23980,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23898
23980
|
/**
|
|
23899
23981
|
* Stroke a rounded rectangle at the specified coordinates
|
|
23900
23982
|
* @name strokeRoundRect
|
|
23901
|
-
* @memberof CanvasRenderer
|
|
23983
|
+
* @memberof CanvasRenderer
|
|
23902
23984
|
* @function
|
|
23903
23985
|
* @param {number} x
|
|
23904
23986
|
* @param {number} y
|
|
@@ -23922,7 +24004,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23922
24004
|
/**
|
|
23923
24005
|
* Draw a rounded filled rectangle at the specified coordinates
|
|
23924
24006
|
* @name fillRoundRect
|
|
23925
|
-
* @memberof CanvasRenderer
|
|
24007
|
+
* @memberof CanvasRenderer
|
|
23926
24008
|
* @function
|
|
23927
24009
|
* @param {number} x
|
|
23928
24010
|
* @param {number} y
|
|
@@ -23938,7 +24020,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23938
24020
|
/**
|
|
23939
24021
|
* return a reference to the system 2d Context
|
|
23940
24022
|
* @name getContext
|
|
23941
|
-
* @memberof CanvasRenderer
|
|
24023
|
+
* @memberof CanvasRenderer
|
|
23942
24024
|
* @function
|
|
23943
24025
|
* @returns {CanvasRenderingContext2D}
|
|
23944
24026
|
*/
|
|
@@ -23958,7 +24040,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23958
24040
|
/**
|
|
23959
24041
|
* save the canvas context
|
|
23960
24042
|
* @name save
|
|
23961
|
-
* @memberof CanvasRenderer
|
|
24043
|
+
* @memberof CanvasRenderer
|
|
23962
24044
|
* @function
|
|
23963
24045
|
*/
|
|
23964
24046
|
save() {
|
|
@@ -23968,7 +24050,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23968
24050
|
/**
|
|
23969
24051
|
* restores the canvas context
|
|
23970
24052
|
* @name restore
|
|
23971
|
-
* @memberof CanvasRenderer
|
|
24053
|
+
* @memberof CanvasRenderer
|
|
23972
24054
|
* @function
|
|
23973
24055
|
*/
|
|
23974
24056
|
restore() {
|
|
@@ -23983,7 +24065,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23983
24065
|
/**
|
|
23984
24066
|
* rotates the canvas context
|
|
23985
24067
|
* @name rotate
|
|
23986
|
-
* @memberof CanvasRenderer
|
|
24068
|
+
* @memberof CanvasRenderer
|
|
23987
24069
|
* @function
|
|
23988
24070
|
* @param {number} angle in radians
|
|
23989
24071
|
*/
|
|
@@ -23994,7 +24076,7 @@ class CanvasRenderer extends Renderer {
|
|
|
23994
24076
|
/**
|
|
23995
24077
|
* scales the canvas context
|
|
23996
24078
|
* @name scale
|
|
23997
|
-
* @memberof CanvasRenderer
|
|
24079
|
+
* @memberof CanvasRenderer
|
|
23998
24080
|
* @function
|
|
23999
24081
|
* @param {number} x
|
|
24000
24082
|
* @param {number} y
|
|
@@ -24007,7 +24089,7 @@ class CanvasRenderer extends Renderer {
|
|
|
24007
24089
|
* Set the current fill & stroke style color.
|
|
24008
24090
|
* By default, or upon reset, the value is set to #000000.
|
|
24009
24091
|
* @name setColor
|
|
24010
|
-
* @memberof CanvasRenderer
|
|
24092
|
+
* @memberof CanvasRenderer
|
|
24011
24093
|
* @function
|
|
24012
24094
|
* @param {Color|string} color css color value
|
|
24013
24095
|
*/
|
|
@@ -24023,7 +24105,7 @@ class CanvasRenderer extends Renderer {
|
|
|
24023
24105
|
/**
|
|
24024
24106
|
* Set the global alpha
|
|
24025
24107
|
* @name setGlobalAlpha
|
|
24026
|
-
* @memberof CanvasRenderer
|
|
24108
|
+
* @memberof CanvasRenderer
|
|
24027
24109
|
* @function
|
|
24028
24110
|
* @param {number} alpha 0.0 to 1.0 values accepted.
|
|
24029
24111
|
*/
|
|
@@ -24034,7 +24116,7 @@ class CanvasRenderer extends Renderer {
|
|
|
24034
24116
|
/**
|
|
24035
24117
|
* Return the global alpha
|
|
24036
24118
|
* @name getGlobalAlpha
|
|
24037
|
-
* @memberof CanvasRenderer
|
|
24119
|
+
* @memberof CanvasRenderer
|
|
24038
24120
|
* @function
|
|
24039
24121
|
* @returns {number} global alpha value
|
|
24040
24122
|
*/
|
|
@@ -24045,7 +24127,7 @@ class CanvasRenderer extends Renderer {
|
|
|
24045
24127
|
/**
|
|
24046
24128
|
* Set the line width on the context
|
|
24047
24129
|
* @name setLineWidth
|
|
24048
|
-
* @memberof CanvasRenderer
|
|
24130
|
+
* @memberof CanvasRenderer
|
|
24049
24131
|
* @function
|
|
24050
24132
|
* @param {number} width Line width
|
|
24051
24133
|
*/
|
|
@@ -24057,7 +24139,7 @@ class CanvasRenderer extends Renderer {
|
|
|
24057
24139
|
* Reset (overrides) the renderer transformation matrix to the
|
|
24058
24140
|
* identity one, and then apply the given transformation matrix.
|
|
24059
24141
|
* @name setTransform
|
|
24060
|
-
* @memberof CanvasRenderer
|
|
24142
|
+
* @memberof CanvasRenderer
|
|
24061
24143
|
* @function
|
|
24062
24144
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
24063
24145
|
*/
|
|
@@ -24069,7 +24151,7 @@ class CanvasRenderer extends Renderer {
|
|
|
24069
24151
|
/**
|
|
24070
24152
|
* Multiply given matrix into the renderer tranformation matrix
|
|
24071
24153
|
* @name transform
|
|
24072
|
-
* @memberof CanvasRenderer
|
|
24154
|
+
* @memberof CanvasRenderer
|
|
24073
24155
|
* @function
|
|
24074
24156
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
24075
24157
|
*/
|
|
@@ -24093,7 +24175,7 @@ class CanvasRenderer extends Renderer {
|
|
|
24093
24175
|
/**
|
|
24094
24176
|
* Translates the context to the given position
|
|
24095
24177
|
* @name translate
|
|
24096
|
-
* @memberof CanvasRenderer
|
|
24178
|
+
* @memberof CanvasRenderer
|
|
24097
24179
|
* @function
|
|
24098
24180
|
* @param {number} x
|
|
24099
24181
|
* @param {number} y
|
|
@@ -24113,7 +24195,7 @@ class CanvasRenderer extends Renderer {
|
|
|
24113
24195
|
* and restore it (with the restore() method) any time in the future.
|
|
24114
24196
|
* (<u>this is an experimental feature !</u>)
|
|
24115
24197
|
* @name clipRect
|
|
24116
|
-
* @memberof CanvasRenderer
|
|
24198
|
+
* @memberof CanvasRenderer
|
|
24117
24199
|
* @function
|
|
24118
24200
|
* @param {number} x
|
|
24119
24201
|
* @param {number} y
|
|
@@ -24146,21 +24228,28 @@ class CanvasRenderer extends Renderer {
|
|
|
24146
24228
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
24147
24229
|
* Mask are not preserved through renderer context save and restore.
|
|
24148
24230
|
* @name setMask
|
|
24149
|
-
* @memberof CanvasRenderer
|
|
24231
|
+
* @memberof CanvasRenderer
|
|
24150
24232
|
* @function
|
|
24151
24233
|
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] the shape defining the mask to be applied
|
|
24234
|
+
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
24152
24235
|
*/
|
|
24153
|
-
setMask(mask) {
|
|
24236
|
+
setMask(mask, invert = false) {
|
|
24154
24237
|
var context = this.getContext();
|
|
24155
|
-
var _x = mask.pos.x, _y = mask.pos.y;
|
|
24156
|
-
|
|
24157
|
-
context.save();
|
|
24158
24238
|
|
|
24159
|
-
|
|
24239
|
+
if (this.maskLevel === 0) {
|
|
24240
|
+
// only save context on the first mask
|
|
24241
|
+
context.save();
|
|
24242
|
+
context.beginPath();
|
|
24243
|
+
}
|
|
24160
24244
|
|
|
24161
24245
|
// https://github.com/melonjs/melonJS/issues/648
|
|
24162
|
-
if (mask instanceof
|
|
24163
|
-
|
|
24246
|
+
else if (mask instanceof RoundRect) {
|
|
24247
|
+
context.roundRect(mask.top, mask.left, mask.width, mask.height, mask.radius);
|
|
24248
|
+
} else if (mask instanceof Rect || mask instanceof Bounds$1) {
|
|
24249
|
+
context.rect(mask.top, mask.left, mask.width, mask.height);
|
|
24250
|
+
} else if (mask instanceof Ellipse) {
|
|
24251
|
+
const _x = mask.pos.x, _y = mask.pos.y,
|
|
24252
|
+
hw = mask.radiusV.x,
|
|
24164
24253
|
hh = mask.radiusV.y,
|
|
24165
24254
|
lx = _x - hw,
|
|
24166
24255
|
rx = _x + hw,
|
|
@@ -24179,31 +24268,41 @@ class CanvasRenderer extends Renderer {
|
|
|
24179
24268
|
context.bezierCurveTo(rx, ymax, xmax, by, _x, by);
|
|
24180
24269
|
context.bezierCurveTo(xmin, by, lx, ymax, lx, _y);
|
|
24181
24270
|
context.bezierCurveTo(lx, ymin, xmin, ty, _x, ty);
|
|
24182
|
-
} else if (mask instanceof RoundRect) {
|
|
24183
|
-
context.roundRect(_x, _y, mask.width, mask.height, mask.radius);
|
|
24184
24271
|
} else {
|
|
24185
|
-
|
|
24272
|
+
const _x = mask.pos.x, _y = mask.pos.y;
|
|
24186
24273
|
var point;
|
|
24274
|
+
|
|
24275
|
+
context.moveTo(_x + mask.points[0].x, _y + mask.points[0].y);
|
|
24187
24276
|
for (var i = 1; i < mask.points.length; i++) {
|
|
24188
24277
|
point = mask.points[i];
|
|
24189
24278
|
context.lineTo(_x + point.x, _y + point.y);
|
|
24190
24279
|
}
|
|
24191
24280
|
}
|
|
24192
24281
|
|
|
24193
|
-
|
|
24282
|
+
this.maskLevel++;
|
|
24283
|
+
|
|
24284
|
+
if (invert === true) {
|
|
24285
|
+
context.closePath();
|
|
24286
|
+
context.globalCompositeOperation = "destination-atop";
|
|
24287
|
+
context.fill();
|
|
24288
|
+
} else {
|
|
24289
|
+
context.clip();
|
|
24290
|
+
}
|
|
24194
24291
|
}
|
|
24195
24292
|
|
|
24196
24293
|
/**
|
|
24197
24294
|
* disable (remove) the rendering mask set through setMask.
|
|
24198
24295
|
* @name clearMask
|
|
24199
24296
|
* @see CanvasRenderer#setMask
|
|
24200
|
-
* @memberof CanvasRenderer
|
|
24297
|
+
* @memberof CanvasRenderer
|
|
24201
24298
|
* @function
|
|
24202
24299
|
*/
|
|
24203
24300
|
clearMask() {
|
|
24204
|
-
this.
|
|
24301
|
+
if (this.maskLevel > 0) {
|
|
24302
|
+
this.maskLevel = 0;
|
|
24303
|
+
this.getContext().restore();
|
|
24304
|
+
}
|
|
24205
24305
|
}
|
|
24206
|
-
|
|
24207
24306
|
}
|
|
24208
24307
|
|
|
24209
24308
|
/**
|
|
@@ -31515,8 +31614,8 @@ class WebGLRenderer extends Renderer {
|
|
|
31515
31614
|
/**
|
|
31516
31615
|
* The WebGL context
|
|
31517
31616
|
* @name gl
|
|
31518
|
-
* @memberof WebGLRenderer
|
|
31519
|
-
* type {WebGLRenderingContext}
|
|
31617
|
+
* @memberof WebGLRenderer
|
|
31618
|
+
* @type {WebGLRenderingContext}
|
|
31520
31619
|
*/
|
|
31521
31620
|
this.context = this.gl = this.getContextGL(this.getScreenCanvas(), options.transparent);
|
|
31522
31621
|
|
|
@@ -31616,7 +31715,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31616
31715
|
/**
|
|
31617
31716
|
* Reset context state
|
|
31618
31717
|
* @name reset
|
|
31619
|
-
* @memberof WebGLRenderer
|
|
31718
|
+
* @memberof WebGLRenderer
|
|
31620
31719
|
* @function
|
|
31621
31720
|
*/
|
|
31622
31721
|
reset() {
|
|
@@ -31643,7 +31742,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31643
31742
|
* @name setCompositor
|
|
31644
31743
|
* @function
|
|
31645
31744
|
* @param {WebGLCompositor|string} compositor a compositor name or instance
|
|
31646
|
-
* @memberof WebGLRenderer
|
|
31745
|
+
* @memberof WebGLRenderer
|
|
31647
31746
|
* @function
|
|
31648
31747
|
*/
|
|
31649
31748
|
setCompositor(compositor = "default") {
|
|
@@ -31669,7 +31768,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31669
31768
|
/**
|
|
31670
31769
|
* Reset the gl transform to identity
|
|
31671
31770
|
* @name resetTransform
|
|
31672
|
-
* @memberof WebGLRenderer
|
|
31771
|
+
* @memberof WebGLRenderer
|
|
31673
31772
|
* @function
|
|
31674
31773
|
*/
|
|
31675
31774
|
resetTransform() {
|
|
@@ -31716,7 +31815,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31716
31815
|
/**
|
|
31717
31816
|
* Create a pattern with the specified repetition
|
|
31718
31817
|
* @name createPattern
|
|
31719
|
-
* @memberof WebGLRenderer
|
|
31818
|
+
* @memberof WebGLRenderer
|
|
31720
31819
|
* @function
|
|
31721
31820
|
* @param {Image} image Source image
|
|
31722
31821
|
* @param {string} repeat Define how the pattern should be repeated
|
|
@@ -31749,7 +31848,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31749
31848
|
/**
|
|
31750
31849
|
* Flush the compositor to the frame buffer
|
|
31751
31850
|
* @name flush
|
|
31752
|
-
* @memberof WebGLRenderer
|
|
31851
|
+
* @memberof WebGLRenderer
|
|
31753
31852
|
* @function
|
|
31754
31853
|
*/
|
|
31755
31854
|
flush() {
|
|
@@ -31759,7 +31858,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31759
31858
|
/**
|
|
31760
31859
|
* set/change the current projection matrix (WebGL only)
|
|
31761
31860
|
* @name setProjection
|
|
31762
|
-
* @memberof WebGLRenderer
|
|
31861
|
+
* @memberof WebGLRenderer
|
|
31763
31862
|
* @function
|
|
31764
31863
|
* @param {Matrix3d} matrix
|
|
31765
31864
|
*/
|
|
@@ -31771,7 +31870,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31771
31870
|
/**
|
|
31772
31871
|
* Clears the gl context with the given color.
|
|
31773
31872
|
* @name clearColor
|
|
31774
|
-
* @memberof WebGLRenderer
|
|
31873
|
+
* @memberof WebGLRenderer
|
|
31775
31874
|
* @function
|
|
31776
31875
|
* @param {Color|string} [color="#000000"] CSS color.
|
|
31777
31876
|
* @param {boolean} [opaque=false] Allow transparency [default] or clear the surface completely [true]
|
|
@@ -31799,7 +31898,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31799
31898
|
/**
|
|
31800
31899
|
* Erase the pixels in the given rectangular area by setting them to transparent black (rgba(0,0,0,0)).
|
|
31801
31900
|
* @name clearRect
|
|
31802
|
-
* @memberof WebGLRenderer
|
|
31901
|
+
* @memberof WebGLRenderer
|
|
31803
31902
|
* @function
|
|
31804
31903
|
* @param {number} x x axis of the coordinate for the rectangle starting point.
|
|
31805
31904
|
* @param {number} y y axis of the coordinate for the rectangle starting point.
|
|
@@ -31849,7 +31948,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31849
31948
|
/**
|
|
31850
31949
|
* Draw an image to the gl context
|
|
31851
31950
|
* @name drawImage
|
|
31852
|
-
* @memberof WebGLRenderer
|
|
31951
|
+
* @memberof WebGLRenderer
|
|
31853
31952
|
* @function
|
|
31854
31953
|
* @param {Image} image An element to draw into the context. The specification permits any canvas image source (CanvasImageSource), specifically, a CSSImageValue, an HTMLImageElement, an SVGImageElement, an HTMLVideoElement, an HTMLCanvasElement, an ImageBitmap, or an OffscreenCanvas.
|
|
31855
31954
|
* @param {number} sx The X coordinate of the top left corner of the sub-rectangle of the source image to draw into the destination context.
|
|
@@ -31902,7 +32001,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31902
32001
|
/**
|
|
31903
32002
|
* Draw a pattern within the given rectangle.
|
|
31904
32003
|
* @name drawPattern
|
|
31905
|
-
* @memberof WebGLRenderer
|
|
32004
|
+
* @memberof WebGLRenderer
|
|
31906
32005
|
* @function
|
|
31907
32006
|
* @param {TextureAtlas} pattern Pattern object
|
|
31908
32007
|
* @param {number} x
|
|
@@ -31920,7 +32019,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31920
32019
|
/**
|
|
31921
32020
|
* return a reference to the screen canvas corresponding WebGL Context
|
|
31922
32021
|
* @name getScreenContext
|
|
31923
|
-
* @memberof WebGLRenderer
|
|
32022
|
+
* @memberof WebGLRenderer
|
|
31924
32023
|
* @function
|
|
31925
32024
|
* @returns {WebGLRenderingContext}
|
|
31926
32025
|
*/
|
|
@@ -31931,7 +32030,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31931
32030
|
/**
|
|
31932
32031
|
* Returns the WebGL Context object of the given Canvas
|
|
31933
32032
|
* @name getContextGL
|
|
31934
|
-
* @memberof WebGLRenderer
|
|
32033
|
+
* @memberof WebGLRenderer
|
|
31935
32034
|
* @function
|
|
31936
32035
|
* @param {HTMLCanvasElement} canvas
|
|
31937
32036
|
* @param {boolean} [transparent=true] use false to disable transparency
|
|
@@ -31989,7 +32088,7 @@ class WebGLRenderer extends Renderer {
|
|
|
31989
32088
|
* Returns the WebGLContext instance for the renderer
|
|
31990
32089
|
* return a reference to the system 2d Context
|
|
31991
32090
|
* @name getContext
|
|
31992
|
-
* @memberof WebGLRenderer
|
|
32091
|
+
* @memberof WebGLRenderer
|
|
31993
32092
|
* @function
|
|
31994
32093
|
* @returns {WebGLRenderingContext}
|
|
31995
32094
|
*/
|
|
@@ -32010,7 +32109,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32010
32109
|
* <img src="images/screen-blendmode.png" width="510"/> <br>
|
|
32011
32110
|
* @name setBlendMode
|
|
32012
32111
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/globalCompositeOperation
|
|
32013
|
-
* @memberof WebGLRenderer
|
|
32112
|
+
* @memberof WebGLRenderer
|
|
32014
32113
|
* @function
|
|
32015
32114
|
* @param {string} [mode="normal"] blend mode : "normal", "multiply", "lighter", "additive", "screen"
|
|
32016
32115
|
* @param {WebGLRenderingContext} [gl]
|
|
@@ -32061,7 +32160,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32061
32160
|
/**
|
|
32062
32161
|
* restores the canvas context
|
|
32063
32162
|
* @name restore
|
|
32064
|
-
* @memberof WebGLRenderer
|
|
32163
|
+
* @memberof WebGLRenderer
|
|
32065
32164
|
* @function
|
|
32066
32165
|
*/
|
|
32067
32166
|
restore() {
|
|
@@ -32097,7 +32196,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32097
32196
|
/**
|
|
32098
32197
|
* saves the canvas context
|
|
32099
32198
|
* @name save
|
|
32100
|
-
* @memberof WebGLRenderer
|
|
32199
|
+
* @memberof WebGLRenderer
|
|
32101
32200
|
* @function
|
|
32102
32201
|
*/
|
|
32103
32202
|
save() {
|
|
@@ -32115,7 +32214,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32115
32214
|
/**
|
|
32116
32215
|
* rotates the uniform matrix
|
|
32117
32216
|
* @name rotate
|
|
32118
|
-
* @memberof WebGLRenderer
|
|
32217
|
+
* @memberof WebGLRenderer
|
|
32119
32218
|
* @function
|
|
32120
32219
|
* @param {number} angle in radians
|
|
32121
32220
|
*/
|
|
@@ -32126,7 +32225,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32126
32225
|
/**
|
|
32127
32226
|
* scales the uniform matrix
|
|
32128
32227
|
* @name scale
|
|
32129
|
-
* @memberof WebGLRenderer
|
|
32228
|
+
* @memberof WebGLRenderer
|
|
32130
32229
|
* @function
|
|
32131
32230
|
* @param {number} x
|
|
32132
32231
|
* @param {number} y
|
|
@@ -32147,7 +32246,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32147
32246
|
/**
|
|
32148
32247
|
* Set the global alpha
|
|
32149
32248
|
* @name setGlobalAlpha
|
|
32150
|
-
* @memberof WebGLRenderer
|
|
32249
|
+
* @memberof WebGLRenderer
|
|
32151
32250
|
* @function
|
|
32152
32251
|
* @param {number} alpha 0.0 to 1.0 values accepted.
|
|
32153
32252
|
*/
|
|
@@ -32158,7 +32257,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32158
32257
|
/**
|
|
32159
32258
|
* Return the global alpha
|
|
32160
32259
|
* @name getGlobalAlpha
|
|
32161
|
-
* @memberof WebGLRenderer
|
|
32260
|
+
* @memberof WebGLRenderer
|
|
32162
32261
|
* @function
|
|
32163
32262
|
* @returns {number} global alpha value
|
|
32164
32263
|
*/
|
|
@@ -32170,7 +32269,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32170
32269
|
* Set the current fill & stroke style color.
|
|
32171
32270
|
* By default, or upon reset, the value is set to #000000.
|
|
32172
32271
|
* @name setColor
|
|
32173
|
-
* @memberof WebGLRenderer
|
|
32272
|
+
* @memberof WebGLRenderer
|
|
32174
32273
|
* @function
|
|
32175
32274
|
* @param {Color|string} color css color string.
|
|
32176
32275
|
*/
|
|
@@ -32183,7 +32282,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32183
32282
|
/**
|
|
32184
32283
|
* Set the line width
|
|
32185
32284
|
* @name setLineWidth
|
|
32186
|
-
* @memberof WebGLRenderer
|
|
32285
|
+
* @memberof WebGLRenderer
|
|
32187
32286
|
* @function
|
|
32188
32287
|
* @param {number} width Line width
|
|
32189
32288
|
*/
|
|
@@ -32194,7 +32293,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32194
32293
|
/**
|
|
32195
32294
|
* Stroke an arc at the specified coordinates with given radius, start and end points
|
|
32196
32295
|
* @name strokeArc
|
|
32197
|
-
* @memberof WebGLRenderer
|
|
32296
|
+
* @memberof WebGLRenderer
|
|
32198
32297
|
* @function
|
|
32199
32298
|
* @param {number} x arc center point x-axis
|
|
32200
32299
|
* @param {number} y arc center point y-axis
|
|
@@ -32222,7 +32321,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32222
32321
|
/**
|
|
32223
32322
|
* Fill an arc at the specified coordinates with given radius, start and end points
|
|
32224
32323
|
* @name fillArc
|
|
32225
|
-
* @memberof WebGLRenderer
|
|
32324
|
+
* @memberof WebGLRenderer
|
|
32226
32325
|
* @function
|
|
32227
32326
|
* @param {number} x arc center point x-axis
|
|
32228
32327
|
* @param {number} y arc center point y-axis
|
|
@@ -32238,7 +32337,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32238
32337
|
/**
|
|
32239
32338
|
* Stroke an ellipse at the specified coordinates with given radius
|
|
32240
32339
|
* @name strokeEllipse
|
|
32241
|
-
* @memberof WebGLRenderer
|
|
32340
|
+
* @memberof WebGLRenderer
|
|
32242
32341
|
* @function
|
|
32243
32342
|
* @param {number} x ellipse center point x-axis
|
|
32244
32343
|
* @param {number} y ellipse center point y-axis
|
|
@@ -32264,7 +32363,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32264
32363
|
/**
|
|
32265
32364
|
* Fill an ellipse at the specified coordinates with given radius
|
|
32266
32365
|
* @name fillEllipse
|
|
32267
|
-
* @memberof WebGLRenderer
|
|
32366
|
+
* @memberof WebGLRenderer
|
|
32268
32367
|
* @function
|
|
32269
32368
|
* @param {number} x ellipse center point x-axis
|
|
32270
32369
|
* @param {number} y ellipse center point y-axis
|
|
@@ -32278,7 +32377,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32278
32377
|
/**
|
|
32279
32378
|
* Stroke a line of the given two points
|
|
32280
32379
|
* @name strokeLine
|
|
32281
|
-
* @memberof WebGLRenderer
|
|
32380
|
+
* @memberof WebGLRenderer
|
|
32282
32381
|
* @function
|
|
32283
32382
|
* @param {number} startX the start x coordinate
|
|
32284
32383
|
* @param {number} startY the start y coordinate
|
|
@@ -32300,7 +32399,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32300
32399
|
/**
|
|
32301
32400
|
* Fill a line of the given two points
|
|
32302
32401
|
* @name fillLine
|
|
32303
|
-
* @memberof WebGLRenderer
|
|
32402
|
+
* @memberof WebGLRenderer
|
|
32304
32403
|
* @function
|
|
32305
32404
|
* @param {number} startX the start x coordinate
|
|
32306
32405
|
* @param {number} startY the start y coordinate
|
|
@@ -32314,7 +32413,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32314
32413
|
/**
|
|
32315
32414
|
* Stroke a me.Polygon on the screen with a specified color
|
|
32316
32415
|
* @name strokePolygon
|
|
32317
|
-
* @memberof WebGLRenderer
|
|
32416
|
+
* @memberof WebGLRenderer
|
|
32318
32417
|
* @function
|
|
32319
32418
|
* @param {Polygon} poly the shape to draw
|
|
32320
32419
|
* @param {boolean} [fill=false] also fill the shape with the current color if true
|
|
@@ -32346,7 +32445,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32346
32445
|
/**
|
|
32347
32446
|
* Fill a me.Polygon on the screen
|
|
32348
32447
|
* @name fillPolygon
|
|
32349
|
-
* @memberof WebGLRenderer
|
|
32448
|
+
* @memberof WebGLRenderer
|
|
32350
32449
|
* @function
|
|
32351
32450
|
* @param {Polygon} poly the shape to draw
|
|
32352
32451
|
*/
|
|
@@ -32357,7 +32456,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32357
32456
|
/**
|
|
32358
32457
|
* Draw a stroke rectangle at the specified coordinates
|
|
32359
32458
|
* @name strokeRect
|
|
32360
|
-
* @memberof WebGLRenderer
|
|
32459
|
+
* @memberof WebGLRenderer
|
|
32361
32460
|
* @function
|
|
32362
32461
|
* @param {number} x
|
|
32363
32462
|
* @param {number} y
|
|
@@ -32382,7 +32481,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32382
32481
|
/**
|
|
32383
32482
|
* Draw a filled rectangle at the specified coordinates
|
|
32384
32483
|
* @name fillRect
|
|
32385
|
-
* @memberof WebGLRenderer
|
|
32484
|
+
* @memberof WebGLRenderer
|
|
32386
32485
|
* @function
|
|
32387
32486
|
* @param {number} x
|
|
32388
32487
|
* @param {number} y
|
|
@@ -32396,7 +32495,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32396
32495
|
/**
|
|
32397
32496
|
* Stroke a rounded rectangle at the specified coordinates
|
|
32398
32497
|
* @name strokeRoundRect
|
|
32399
|
-
* @memberof WebGLRenderer
|
|
32498
|
+
* @memberof WebGLRenderer
|
|
32400
32499
|
* @function
|
|
32401
32500
|
* @param {number} x
|
|
32402
32501
|
* @param {number} y
|
|
@@ -32423,7 +32522,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32423
32522
|
/**
|
|
32424
32523
|
* Draw a rounded filled rectangle at the specified coordinates
|
|
32425
32524
|
* @name fillRoundRect
|
|
32426
|
-
* @memberof WebGLRenderer
|
|
32525
|
+
* @memberof WebGLRenderer
|
|
32427
32526
|
* @function
|
|
32428
32527
|
* @param {number} x
|
|
32429
32528
|
* @param {number} y
|
|
@@ -32439,7 +32538,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32439
32538
|
* Reset (overrides) the renderer transformation matrix to the
|
|
32440
32539
|
* identity one, and then apply the given transformation matrix.
|
|
32441
32540
|
* @name setTransform
|
|
32442
|
-
* @memberof WebGLRenderer
|
|
32541
|
+
* @memberof WebGLRenderer
|
|
32443
32542
|
* @function
|
|
32444
32543
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
32445
32544
|
*/
|
|
@@ -32451,7 +32550,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32451
32550
|
/**
|
|
32452
32551
|
* Multiply given matrix into the renderer tranformation matrix
|
|
32453
32552
|
* @name transform
|
|
32454
|
-
* @memberof WebGLRenderer
|
|
32553
|
+
* @memberof WebGLRenderer
|
|
32455
32554
|
* @function
|
|
32456
32555
|
* @param {Matrix2d} mat2d Matrix to transform by
|
|
32457
32556
|
*/
|
|
@@ -32469,7 +32568,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32469
32568
|
/**
|
|
32470
32569
|
* Translates the uniform matrix by the given coordinates
|
|
32471
32570
|
* @name translate
|
|
32472
|
-
* @memberof WebGLRenderer
|
|
32571
|
+
* @memberof WebGLRenderer
|
|
32473
32572
|
* @function
|
|
32474
32573
|
* @param {number} x
|
|
32475
32574
|
* @param {number} y
|
|
@@ -32492,7 +32591,7 @@ class WebGLRenderer extends Renderer {
|
|
|
32492
32591
|
* and restore it (with the restore() method) any time in the future.
|
|
32493
32592
|
* (<u>this is an experimental feature !</u>)
|
|
32494
32593
|
* @name clipRect
|
|
32495
|
-
* @memberof WebGLRenderer
|
|
32594
|
+
* @memberof WebGLRenderer
|
|
32496
32595
|
* @function
|
|
32497
32596
|
* @param {number} x
|
|
32498
32597
|
* @param {number} y
|
|
@@ -32540,31 +32639,46 @@ class WebGLRenderer extends Renderer {
|
|
|
32540
32639
|
* So, if the renderable is larger than the mask, only the intersecting part of the renderable will be visible.
|
|
32541
32640
|
* Mask are not preserved through renderer context save and restore.
|
|
32542
32641
|
* @name setMask
|
|
32543
|
-
* @memberof WebGLRenderer
|
|
32642
|
+
* @memberof WebGLRenderer
|
|
32544
32643
|
* @function
|
|
32545
|
-
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask]
|
|
32644
|
+
* @param {Rect|RoundRect|Polygon|Line|Ellipse} [mask] a shape defining the mask to be applied
|
|
32645
|
+
* @param {boolean} [invert=false] either the given shape should define what is visible (default) or the opposite
|
|
32546
32646
|
*/
|
|
32547
|
-
setMask(mask) {
|
|
32647
|
+
setMask(mask, invert = false) {
|
|
32548
32648
|
var gl = this.gl;
|
|
32549
32649
|
|
|
32550
32650
|
// flush the compositor
|
|
32551
32651
|
this.flush();
|
|
32552
32652
|
|
|
32553
|
-
|
|
32554
|
-
|
|
32555
|
-
|
|
32653
|
+
if (this.maskLevel === 0) {
|
|
32654
|
+
// Enable and setup GL state to write to stencil buffer
|
|
32655
|
+
gl.enable(gl.STENCIL_TEST);
|
|
32656
|
+
gl.clear(gl.STENCIL_BUFFER_BIT);
|
|
32657
|
+
|
|
32658
|
+
|
|
32659
|
+
}
|
|
32660
|
+
|
|
32661
|
+
this.maskLevel++;
|
|
32662
|
+
|
|
32556
32663
|
gl.colorMask(false, false, false, false);
|
|
32557
|
-
gl.stencilFunc(gl.
|
|
32664
|
+
gl.stencilFunc(gl.EQUAL, this.maskLevel, 1);
|
|
32558
32665
|
gl.stencilOp(gl.REPLACE, gl.REPLACE, gl.REPLACE);
|
|
32559
32666
|
|
|
32667
|
+
|
|
32668
|
+
// fill the given mask shape
|
|
32560
32669
|
this.fill(mask);
|
|
32561
32670
|
|
|
32562
32671
|
// flush the compositor
|
|
32563
32672
|
this.flush();
|
|
32564
32673
|
|
|
32565
|
-
// Use stencil buffer to affect next rendering object
|
|
32566
32674
|
gl.colorMask(true, true, true, true);
|
|
32567
|
-
|
|
32675
|
+
|
|
32676
|
+
// Use stencil buffer to affect next rendering object
|
|
32677
|
+
if (invert === true) {
|
|
32678
|
+
gl.stencilFunc(gl.EQUAL, this.maskLevel + 1, 1);
|
|
32679
|
+
} else {
|
|
32680
|
+
gl.stencilFunc(gl.NOTEQUAL, this.maskLevel + 1, 1);
|
|
32681
|
+
}
|
|
32568
32682
|
gl.stencilOp(gl.KEEP, gl.KEEP, gl.KEEP);
|
|
32569
32683
|
}
|
|
32570
32684
|
|
|
@@ -32572,13 +32686,16 @@ class WebGLRenderer extends Renderer {
|
|
|
32572
32686
|
* disable (remove) the rendering mask set through setMask.
|
|
32573
32687
|
* @name clearMask
|
|
32574
32688
|
* @see WebGLRenderer#setMask
|
|
32575
|
-
* @memberof WebGLRenderer
|
|
32689
|
+
* @memberof WebGLRenderer
|
|
32576
32690
|
* @function
|
|
32577
32691
|
*/
|
|
32578
32692
|
clearMask() {
|
|
32579
|
-
|
|
32580
|
-
|
|
32581
|
-
|
|
32693
|
+
if (this.maskLevel > 0) {
|
|
32694
|
+
// flush the compositor
|
|
32695
|
+
this.flush();
|
|
32696
|
+
this.maskLevel = 0;
|
|
32697
|
+
this.gl.disable(this.gl.STENCIL_TEST);
|
|
32698
|
+
}
|
|
32582
32699
|
}
|
|
32583
32700
|
}
|
|
32584
32701
|
|
|
@@ -33751,10 +33868,10 @@ class BasePlugin {
|
|
|
33751
33868
|
* this can be overridden by the plugin
|
|
33752
33869
|
* @public
|
|
33753
33870
|
* @type {string}
|
|
33754
|
-
* @default "10.
|
|
33871
|
+
* @default "10.10.0"
|
|
33755
33872
|
* @name plugin.Base#version
|
|
33756
33873
|
*/
|
|
33757
|
-
this.version = "10.
|
|
33874
|
+
this.version = "10.10.0";
|
|
33758
33875
|
}
|
|
33759
33876
|
}
|
|
33760
33877
|
|
|
@@ -34776,6 +34893,90 @@ class Tween {
|
|
|
34776
34893
|
static get Interpolation() { return Interpolation; }
|
|
34777
34894
|
}
|
|
34778
34895
|
|
|
34896
|
+
/**
|
|
34897
|
+
* Creates a Canvas Texture of the given size
|
|
34898
|
+
*/
|
|
34899
|
+
class CanvasTexture {
|
|
34900
|
+
/**
|
|
34901
|
+
* @param {number} width the desired width of the canvas
|
|
34902
|
+
* @param {number} height the desired height of the canvas
|
|
34903
|
+
* @param {number} [offscreenCanvas=true] if the the canvas should be an OffscreenCanvas
|
|
34904
|
+
*/
|
|
34905
|
+
constructor(width, height, offscreenCanvas = true) {
|
|
34906
|
+
/**
|
|
34907
|
+
* the canvas created for this CanvasTexture
|
|
34908
|
+
* @type {HTMLCanvasElement|OffscreenCanvas}
|
|
34909
|
+
*/
|
|
34910
|
+
this.canvas = createCanvas(width, height, offscreenCanvas);
|
|
34911
|
+
|
|
34912
|
+
/**
|
|
34913
|
+
* the rendering context of this CanvasTexture
|
|
34914
|
+
* @type {CanvasRenderingContext2D}
|
|
34915
|
+
*/
|
|
34916
|
+
this.context = this.canvas.getContext("2d");
|
|
34917
|
+
}
|
|
34918
|
+
|
|
34919
|
+
/**
|
|
34920
|
+
* @ignore
|
|
34921
|
+
*/
|
|
34922
|
+
onResetEvent(width, height) {
|
|
34923
|
+
this.clear();
|
|
34924
|
+
this.resize(width, height);
|
|
34925
|
+
}
|
|
34926
|
+
|
|
34927
|
+
/**
|
|
34928
|
+
* Clears the content of the canvas texture
|
|
34929
|
+
*/
|
|
34930
|
+
clear() {
|
|
34931
|
+
this.context.setTransform(1, 0, 0, 1, 0, 0);
|
|
34932
|
+
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
34933
|
+
}
|
|
34934
|
+
|
|
34935
|
+
/**
|
|
34936
|
+
* Resizes the canvas texture to the given width and height.
|
|
34937
|
+
* @param {number} width the desired width
|
|
34938
|
+
* @param {number} height the desired height
|
|
34939
|
+
*/
|
|
34940
|
+
resize(width, height) {
|
|
34941
|
+
this.canvas.width = Math.round(width);
|
|
34942
|
+
this.canvas.height = Math.round(height);
|
|
34943
|
+
}
|
|
34944
|
+
|
|
34945
|
+
/**
|
|
34946
|
+
* @ignore
|
|
34947
|
+
*/
|
|
34948
|
+
destroy() {
|
|
34949
|
+
this.context = undefined;
|
|
34950
|
+
this.canvas = undefined;
|
|
34951
|
+
}
|
|
34952
|
+
|
|
34953
|
+
/**
|
|
34954
|
+
* The width of this canvas texture in pixels
|
|
34955
|
+
* @public
|
|
34956
|
+
* @type {number}
|
|
34957
|
+
*/
|
|
34958
|
+
get width() {
|
|
34959
|
+
return this.canvas.width;
|
|
34960
|
+
}
|
|
34961
|
+
|
|
34962
|
+
set width(val) {
|
|
34963
|
+
this.canvas.width = Math.round(val);
|
|
34964
|
+
}
|
|
34965
|
+
|
|
34966
|
+
/**
|
|
34967
|
+
* The height of this canvas texture in pixels
|
|
34968
|
+
* @public
|
|
34969
|
+
* @type {number}
|
|
34970
|
+
*/
|
|
34971
|
+
get height() {
|
|
34972
|
+
return this.canvas.height;
|
|
34973
|
+
}
|
|
34974
|
+
|
|
34975
|
+
set height(val) {
|
|
34976
|
+
this.canvas.height = Math.round(val);
|
|
34977
|
+
}
|
|
34978
|
+
}
|
|
34979
|
+
|
|
34779
34980
|
/**
|
|
34780
34981
|
* apply the current text style to the given context
|
|
34781
34982
|
* @ignore
|
|
@@ -34967,7 +35168,7 @@ var toPX = [12, 24, 0.75, 1];
|
|
|
34967
35168
|
// return a valid 2d context for Text rendering/styling
|
|
34968
35169
|
var getContext2d = function (renderer, text) {
|
|
34969
35170
|
if (text.offScreenCanvas === true) {
|
|
34970
|
-
return text.context;
|
|
35171
|
+
return text.canvasTexture.context;
|
|
34971
35172
|
} else {
|
|
34972
35173
|
return renderer.getFontContext();
|
|
34973
35174
|
}
|
|
@@ -35134,8 +35335,7 @@ class Text extends Renderable {
|
|
|
35134
35335
|
|
|
35135
35336
|
if (settings.offScreenCanvas === true) {
|
|
35136
35337
|
this.offScreenCanvas = true;
|
|
35137
|
-
this.
|
|
35138
|
-
this.context = this.canvas.getContext("2d");
|
|
35338
|
+
this.canvasTexture = pool$1.pull("CanvasTexture", 2, 2, true);
|
|
35139
35339
|
}
|
|
35140
35340
|
|
|
35141
35341
|
// instance to text metrics functions
|
|
@@ -35150,10 +35350,9 @@ class Text extends Renderable {
|
|
|
35150
35350
|
// free the canvas and potential corresponding texture when deactivated
|
|
35151
35351
|
if (this.offScreenCanvas === true) {
|
|
35152
35352
|
renderer.currentCompositor.deleteTexture2D(renderer.currentCompositor.getTexture2D(this.glTextureUnit));
|
|
35153
|
-
renderer.cache.delete(this.canvas);
|
|
35154
|
-
|
|
35155
|
-
this.
|
|
35156
|
-
this.canvas = undefined;
|
|
35353
|
+
renderer.cache.delete(this.canvasTexture.canvas);
|
|
35354
|
+
pool$1.push(this.canvasTexture);
|
|
35355
|
+
this.canvasTexture = undefined;
|
|
35157
35356
|
this.glTextureUnit = undefined;
|
|
35158
35357
|
}
|
|
35159
35358
|
}
|
|
@@ -35251,7 +35450,7 @@ class Text extends Renderable {
|
|
|
35251
35450
|
|
|
35252
35451
|
if (renderer instanceof WebGLRenderer) {
|
|
35253
35452
|
// invalidate the previous corresponding texture so that it can reuploaded once changed
|
|
35254
|
-
this.glTextureUnit = renderer.cache.getUnit(renderer.cache.get(this.canvas));
|
|
35453
|
+
this.glTextureUnit = renderer.cache.getUnit(renderer.cache.get(this.canvasTexture.canvas));
|
|
35255
35454
|
renderer.currentCompositor.unbindTexture2D(null, this.glTextureUnit);
|
|
35256
35455
|
|
|
35257
35456
|
if (renderer.WebGLVersion === 1) {
|
|
@@ -35262,14 +35461,12 @@ class Text extends Renderable {
|
|
|
35262
35461
|
}
|
|
35263
35462
|
|
|
35264
35463
|
// resize the cache canvas if necessary
|
|
35265
|
-
if (this.
|
|
35266
|
-
this.
|
|
35267
|
-
this.canvas.height = height;
|
|
35268
|
-
// resizing the canvas will automatically clear its content
|
|
35269
|
-
} else {
|
|
35270
|
-
this.context.clearRect(0, 0, this.canvas.width, this.canvas.height);
|
|
35464
|
+
if (this.canvasTexture.width < width || this.canvasTexture.height < height) {
|
|
35465
|
+
this.canvasTexture.resize(width, height);
|
|
35271
35466
|
}
|
|
35272
|
-
|
|
35467
|
+
|
|
35468
|
+
this.canvasTexture.clear();
|
|
35469
|
+
this._drawFont(this.canvasTexture.context, this._text, this.pos.x - this.metrics.x, this.pos.y - this.metrics.y, false);
|
|
35273
35470
|
}
|
|
35274
35471
|
|
|
35275
35472
|
this.isDirty = true;
|
|
@@ -35333,7 +35530,7 @@ class Text extends Renderable {
|
|
|
35333
35530
|
|
|
35334
35531
|
// draw the text
|
|
35335
35532
|
if (this.offScreenCanvas === true) {
|
|
35336
|
-
renderer.drawImage(this.canvas, x, y);
|
|
35533
|
+
renderer.drawImage(this.canvasTexture.canvas, x, y);
|
|
35337
35534
|
} else {
|
|
35338
35535
|
renderer.drawFont(this._drawFont(renderer.getFontContext(), this._text, x, y, stroke));
|
|
35339
35536
|
}
|
|
@@ -36194,7 +36391,7 @@ class ImageLayer extends Sprite {
|
|
|
36194
36391
|
/**
|
|
36195
36392
|
* resize the Image Layer to match the given size
|
|
36196
36393
|
* @name resize
|
|
36197
|
-
* @memberof ImageLayer
|
|
36394
|
+
* @memberof ImageLayer
|
|
36198
36395
|
* @function
|
|
36199
36396
|
* @param {number} w new width
|
|
36200
36397
|
* @param {number} h new height
|
|
@@ -36284,7 +36481,7 @@ class ImageLayer extends Sprite {
|
|
|
36284
36481
|
* draw the ImageLayer. <br>
|
|
36285
36482
|
* automatically called by the game manager {@link game}
|
|
36286
36483
|
* @name draw
|
|
36287
|
-
* @memberof ImageLayer
|
|
36484
|
+
* @memberof ImageLayer
|
|
36288
36485
|
* @function
|
|
36289
36486
|
* @protected
|
|
36290
36487
|
* @param {CanvasRenderer|WebGLRenderer} renderer a renderer object
|
|
@@ -36658,7 +36855,7 @@ class GUI_Object extends Sprite {
|
|
|
36658
36855
|
/**
|
|
36659
36856
|
* function called when the object is pressed (to be extended)
|
|
36660
36857
|
* @name onClick
|
|
36661
|
-
* @memberof GUI_Object
|
|
36858
|
+
* @memberof GUI_Object
|
|
36662
36859
|
* @public
|
|
36663
36860
|
* @function
|
|
36664
36861
|
* @param {Pointer} event the event object
|
|
@@ -36681,7 +36878,7 @@ class GUI_Object extends Sprite {
|
|
|
36681
36878
|
/**
|
|
36682
36879
|
* function called when the pointer is over the object
|
|
36683
36880
|
* @name onOver
|
|
36684
|
-
* @memberof GUI_Object
|
|
36881
|
+
* @memberof GUI_Object
|
|
36685
36882
|
* @public
|
|
36686
36883
|
* @function
|
|
36687
36884
|
* @param {Pointer} event the event object
|
|
@@ -36702,7 +36899,7 @@ class GUI_Object extends Sprite {
|
|
|
36702
36899
|
/**
|
|
36703
36900
|
* function called when the pointer is leaving the object area
|
|
36704
36901
|
* @name onOut
|
|
36705
|
-
* @memberof GUI_Object
|
|
36902
|
+
* @memberof GUI_Object
|
|
36706
36903
|
* @public
|
|
36707
36904
|
* @function
|
|
36708
36905
|
* @param {Pointer} event the event object
|
|
@@ -36727,7 +36924,7 @@ class GUI_Object extends Sprite {
|
|
|
36727
36924
|
/**
|
|
36728
36925
|
* function called when the object is pressed and released (to be extended)
|
|
36729
36926
|
* @name onRelease
|
|
36730
|
-
* @memberof GUI_Object
|
|
36927
|
+
* @memberof GUI_Object
|
|
36731
36928
|
* @public
|
|
36732
36929
|
* @function
|
|
36733
36930
|
* @returns {boolean} return false if we need to stop propagating the event
|
|
@@ -36752,7 +36949,7 @@ class GUI_Object extends Sprite {
|
|
|
36752
36949
|
* function called when the object is pressed and held<br>
|
|
36753
36950
|
* to be extended <br>
|
|
36754
36951
|
* @name onHold
|
|
36755
|
-
* @memberof GUI_Object
|
|
36952
|
+
* @memberof GUI_Object
|
|
36756
36953
|
* @public
|
|
36757
36954
|
* @function
|
|
36758
36955
|
*/
|
|
@@ -36968,6 +37165,118 @@ class Trigger extends Renderable {
|
|
|
36968
37165
|
|
|
36969
37166
|
}
|
|
36970
37167
|
|
|
37168
|
+
/** @ignore */
|
|
37169
|
+
function createGradient(light) {
|
|
37170
|
+
var context = light.texture.context;
|
|
37171
|
+
var x1 = light.texture.width / 2;
|
|
37172
|
+
var y1 = light.texture.height / 2;
|
|
37173
|
+
var gradient = context.createRadialGradient(x1, y1, 0, x1, y1, light.radius);
|
|
37174
|
+
|
|
37175
|
+
light.texture.clear();
|
|
37176
|
+
|
|
37177
|
+
gradient.addColorStop( 0, light.color.toRGBA(light.intensity));
|
|
37178
|
+
gradient.addColorStop( 1, light.color.toRGBA(0.0));
|
|
37179
|
+
|
|
37180
|
+
context.beginPath();
|
|
37181
|
+
context.fillStyle = gradient;
|
|
37182
|
+
context.arc(x1, y1, light.radius, 0, Math.PI * 2, false);
|
|
37183
|
+
context.fill();
|
|
37184
|
+
}
|
|
37185
|
+
|
|
37186
|
+
/**
|
|
37187
|
+
* @classdesc
|
|
37188
|
+
* A 2D point light.
|
|
37189
|
+
* Note: this is a very experimental and work in progress feature, that provides a simple spot light effect.
|
|
37190
|
+
* The light effect is best rendered in WebGL, as they are few limitations when using the Canvas Renderer
|
|
37191
|
+
* (multiple lights are not supported, alpha component of the ambient light is ignored)
|
|
37192
|
+
* @see stage.lights
|
|
37193
|
+
*/
|
|
37194
|
+
class Light2d extends Renderable {
|
|
37195
|
+
/**
|
|
37196
|
+
* @param {number} x - The horizontal position of the light.
|
|
37197
|
+
* @param {number} y - The vertical position of the light.
|
|
37198
|
+
* @param {number} radius - The radius of the light.
|
|
37199
|
+
* @param {Color|string} [color="#FFF"] the color of the light
|
|
37200
|
+
* @param {number} [intensity=0.7] - The intensity of the light.
|
|
37201
|
+
*/
|
|
37202
|
+
constructor(x, y, radius, color = "#FFF", intensity = 0.7) {
|
|
37203
|
+
// call the parent constructor
|
|
37204
|
+
super(x, y, radius * 2, radius * 2);
|
|
37205
|
+
|
|
37206
|
+
/**
|
|
37207
|
+
* the color of the light
|
|
37208
|
+
* @type {Color}
|
|
37209
|
+
* @default "#FFF"
|
|
37210
|
+
*/
|
|
37211
|
+
this.color = pool$1.pull("Color").parseCSS(color);
|
|
37212
|
+
|
|
37213
|
+
/**
|
|
37214
|
+
* The radius of the light
|
|
37215
|
+
* @type {number}
|
|
37216
|
+
*/
|
|
37217
|
+
this.radius = radius;
|
|
37218
|
+
|
|
37219
|
+
/**
|
|
37220
|
+
* The intensity of the light
|
|
37221
|
+
* @type {number}
|
|
37222
|
+
* @default 0.7
|
|
37223
|
+
*/
|
|
37224
|
+
this.intensity = intensity;
|
|
37225
|
+
|
|
37226
|
+
/**
|
|
37227
|
+
* the default blend mode to be applied when rendering this light
|
|
37228
|
+
* @type {string}
|
|
37229
|
+
* @default "lighter"
|
|
37230
|
+
* @see CanvasRenderer#setBlendMode
|
|
37231
|
+
* @see WebGLRenderer#setBlendMode
|
|
37232
|
+
*/
|
|
37233
|
+
this.blendMode = "lighter";
|
|
37234
|
+
|
|
37235
|
+
/** @ignore */
|
|
37236
|
+
this.visibleArea = pool$1.pull("Ellipse", this.centerX, this.centerY, this.width, this.height);
|
|
37237
|
+
|
|
37238
|
+
/** @ignore */
|
|
37239
|
+
this.texture = pool$1.pull("CanvasTexture", this.width, this.height, false);
|
|
37240
|
+
|
|
37241
|
+
this.anchorPoint.set(0, 0);
|
|
37242
|
+
|
|
37243
|
+
createGradient(this);
|
|
37244
|
+
}
|
|
37245
|
+
|
|
37246
|
+
/**
|
|
37247
|
+
* returns a geometry representing the visible area of this light
|
|
37248
|
+
* @name getVisibleArea
|
|
37249
|
+
* @memberof Light2d
|
|
37250
|
+
* @function
|
|
37251
|
+
* @returns {Ellipse} the light visible mask
|
|
37252
|
+
*/
|
|
37253
|
+
getVisibleArea() {
|
|
37254
|
+
return this.visibleArea.setShape(this.getBounds().centerX, this.getBounds().centerY, this.width, this.height);
|
|
37255
|
+
}
|
|
37256
|
+
|
|
37257
|
+
/**
|
|
37258
|
+
* object draw (Called internally by the engine).
|
|
37259
|
+
* @ignore
|
|
37260
|
+
*/
|
|
37261
|
+
draw(renderer) {
|
|
37262
|
+
renderer.drawImage(this.texture.canvas, this.getBounds().x, this.getBounds().y);
|
|
37263
|
+
}
|
|
37264
|
+
|
|
37265
|
+
/**
|
|
37266
|
+
* Destroy function<br>
|
|
37267
|
+
* @ignore
|
|
37268
|
+
*/
|
|
37269
|
+
destroy() {
|
|
37270
|
+
pool$1.push(this.color);
|
|
37271
|
+
this.color = undefined;
|
|
37272
|
+
pool$1.push(this.texture);
|
|
37273
|
+
this.texture = undefined;
|
|
37274
|
+
pool$1.push(this.visibleArea);
|
|
37275
|
+
this.visibleArea = undefined;
|
|
37276
|
+
super.destroy();
|
|
37277
|
+
}
|
|
37278
|
+
}
|
|
37279
|
+
|
|
36971
37280
|
/**
|
|
36972
37281
|
* @classdesc
|
|
36973
37282
|
* A Draggable base object
|
|
@@ -37496,19 +37805,15 @@ const ParticleEmitterSettings = {
|
|
|
37496
37805
|
framesToSkip : 0
|
|
37497
37806
|
};
|
|
37498
37807
|
|
|
37499
|
-
// default texture used when no sprite is defined
|
|
37500
|
-
let defaultParticleTexture;
|
|
37501
|
-
|
|
37502
37808
|
/**
|
|
37503
37809
|
* @ignore
|
|
37504
37810
|
*/
|
|
37505
37811
|
function createDefaultParticleTexture(w = 8, h = 8) {
|
|
37506
|
-
|
|
37507
|
-
|
|
37508
|
-
|
|
37509
|
-
|
|
37510
|
-
|
|
37511
|
-
}
|
|
37812
|
+
var defaultParticleTexture = pool$1.pull("CanvasTexture", w, h, true);
|
|
37813
|
+
|
|
37814
|
+
defaultParticleTexture.context.fillStyle = "#fff";
|
|
37815
|
+
defaultParticleTexture.context.fillRect(0, 0, w, h);
|
|
37816
|
+
|
|
37512
37817
|
return defaultParticleTexture;
|
|
37513
37818
|
}
|
|
37514
37819
|
/**
|
|
@@ -37610,9 +37915,9 @@ class ParticleEmitter extends Container {
|
|
|
37610
37915
|
reset(settings = {}) {
|
|
37611
37916
|
Object.assign(this.settings, ParticleEmitterSettings, settings);
|
|
37612
37917
|
|
|
37613
|
-
// Cache the image reference
|
|
37614
37918
|
if (typeof this.settings.image === "undefined") {
|
|
37615
|
-
this.
|
|
37919
|
+
this._defaultParticle = createDefaultParticleTexture(settings.textureSize, settings.textureSize);
|
|
37920
|
+
this.settings.image = this._defaultParticle.canvas;
|
|
37616
37921
|
}
|
|
37617
37922
|
|
|
37618
37923
|
this.floating = this.settings.floating;
|
|
@@ -37742,6 +38047,10 @@ class ParticleEmitter extends Container {
|
|
|
37742
38047
|
// call the parent destroy method
|
|
37743
38048
|
super.destroy(arguments);
|
|
37744
38049
|
// clean emitter specific Properties
|
|
38050
|
+
if (typeof this._defaultParticle !== "undefined") {
|
|
38051
|
+
pool$1.push(this._defaultParticle);
|
|
38052
|
+
this._defaultParticle = undefined;
|
|
38053
|
+
}
|
|
37745
38054
|
this.settings.image = undefined;
|
|
37746
38055
|
this.settings = undefined;
|
|
37747
38056
|
}
|
|
@@ -38201,9 +38510,10 @@ function warning(deprecated, replacement, version) {
|
|
|
38201
38510
|
}
|
|
38202
38511
|
/**
|
|
38203
38512
|
* @public
|
|
38204
|
-
* @type {Function}
|
|
38205
38513
|
* @name turnOnPointerLock
|
|
38206
|
-
* @
|
|
38514
|
+
* @function
|
|
38515
|
+
* @returns {boolean} return true if the request was successfully submitted
|
|
38516
|
+
* @memberof device#
|
|
38207
38517
|
* @deprecated since 10.3.0
|
|
38208
38518
|
* @see input.requestPointerLock
|
|
38209
38519
|
*/
|
|
@@ -38214,9 +38524,10 @@ device$1.turnOnPointerLock = function () {
|
|
|
38214
38524
|
|
|
38215
38525
|
/**
|
|
38216
38526
|
* @public
|
|
38217
|
-
* @type {Function}
|
|
38218
38527
|
* @name turnOffPointerLock
|
|
38219
|
-
* @
|
|
38528
|
+
* @function
|
|
38529
|
+
* @returns {boolean} return true if the request was successfully submitted
|
|
38530
|
+
* @memberof device#
|
|
38220
38531
|
* @deprecated since 10.3.0
|
|
38221
38532
|
* @see input.exitPointerLock
|
|
38222
38533
|
*/
|
|
@@ -38291,7 +38602,7 @@ class DroptargetEntity extends DropTarget {
|
|
|
38291
38602
|
* @name version
|
|
38292
38603
|
* @type {string}
|
|
38293
38604
|
*/
|
|
38294
|
-
const version = "10.
|
|
38605
|
+
const version = "10.10.0";
|
|
38295
38606
|
|
|
38296
38607
|
|
|
38297
38608
|
/**
|
|
@@ -38329,6 +38640,7 @@ function boot() {
|
|
|
38329
38640
|
pool$1.register("me.Entity", Entity);
|
|
38330
38641
|
pool$1.register("me.Collectable", Collectable);
|
|
38331
38642
|
pool$1.register("me.Trigger", Trigger);
|
|
38643
|
+
pool$1.register("me.Light2d", Light2d);
|
|
38332
38644
|
pool$1.register("me.Tween", Tween, true);
|
|
38333
38645
|
pool$1.register("me.Color", Color, true);
|
|
38334
38646
|
pool$1.register("me.Particle", Particle, true);
|
|
@@ -38346,7 +38658,7 @@ function boot() {
|
|
|
38346
38658
|
pool$1.register("me.ObservableVector3d", ObservableVector3d, true);
|
|
38347
38659
|
pool$1.register("me.Matrix2d", Matrix2d, true);
|
|
38348
38660
|
pool$1.register("me.Matrix3d", Matrix3d, true);
|
|
38349
|
-
pool$1.register("me.Rect", Rect, true);
|
|
38661
|
+
pool$1.register("me.Rect", Rect$1, true);
|
|
38350
38662
|
pool$1.register("me.RoundRect", RoundRect, true);
|
|
38351
38663
|
pool$1.register("me.Polygon", Polygon, true);
|
|
38352
38664
|
pool$1.register("me.Line", Line, true);
|
|
@@ -38357,6 +38669,7 @@ function boot() {
|
|
|
38357
38669
|
pool$1.register("Entity", Entity);
|
|
38358
38670
|
pool$1.register("Collectable", Collectable);
|
|
38359
38671
|
pool$1.register("Trigger", Trigger);
|
|
38672
|
+
pool$1.register("Light2d", Light2d);
|
|
38360
38673
|
pool$1.register("Tween", Tween, true);
|
|
38361
38674
|
pool$1.register("Color", Color, true);
|
|
38362
38675
|
pool$1.register("Particle", Particle, true);
|
|
@@ -38374,12 +38687,13 @@ function boot() {
|
|
|
38374
38687
|
pool$1.register("ObservableVector3d", ObservableVector3d, true);
|
|
38375
38688
|
pool$1.register("Matrix2d", Matrix2d, true);
|
|
38376
38689
|
pool$1.register("Matrix3d", Matrix3d, true);
|
|
38377
|
-
pool$1.register("Rect", Rect, true);
|
|
38690
|
+
pool$1.register("Rect", Rect$1, true);
|
|
38378
38691
|
pool$1.register("RoundRect", RoundRect, true);
|
|
38379
38692
|
pool$1.register("Polygon", Polygon, true);
|
|
38380
38693
|
pool$1.register("Line", Line, true);
|
|
38381
38694
|
pool$1.register("Ellipse", Ellipse, true);
|
|
38382
38695
|
pool$1.register("Bounds", Bounds$1, true);
|
|
38696
|
+
pool$1.register("CanvasTexture", CanvasTexture, true);
|
|
38383
38697
|
|
|
38384
38698
|
// publish Boot notification
|
|
38385
38699
|
emit(BOOT);
|
|
@@ -38400,4 +38714,4 @@ device$1.onReady(function () {
|
|
|
38400
38714
|
}
|
|
38401
38715
|
});
|
|
38402
38716
|
|
|
38403
|
-
export { BitmapText, BitmapTextData, Body, Bounds$1 as Bounds, Camera2d, CanvasRenderer, Collectable, Color, ColorLayer, Container, Draggable, DraggableEntity, DropTarget, DroptargetEntity, Ellipse, Entity, GLShader, GUI_Object, ImageLayer, Line, math as Math, Matrix2d, Matrix3d, NineSliceSprite, ObservableVector2d, ObservableVector3d, Particle, ParticleEmitter, ParticleEmitterSettings, 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$1 as device, event$1 as event, game, initialized, input, level, loader, plugin, plugins, pool$1 as pool, save, skipAutoInit, state, timer$1 as timer, utils, version, video, warning };
|
|
38717
|
+
export { BitmapText, BitmapTextData, Body, Bounds$1 as 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, Pointer, Polygon, QuadTree, Rect$1 as 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$1 as device, event$1 as event, game, initialized, input, level, loader, plugin, plugins, pool$1 as pool, save, skipAutoInit, state, timer$1 as timer, utils, version, video, warning };
|