@vpmedia/phaser 1.105.0 → 1.107.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +238 -244
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation.d.ts +2 -2
- package/dist/phaser/core/animation.d.ts.map +1 -1
- package/dist/phaser/core/animation_manager.d.ts +2 -2
- package/dist/phaser/core/animation_manager.d.ts.map +1 -1
- package/dist/phaser/core/animation_parser.d.ts +2 -2
- package/dist/phaser/core/animation_parser.d.ts.map +1 -1
- package/dist/phaser/core/array_set.d.ts.map +1 -1
- package/dist/phaser/core/cache.d.ts +6 -6
- package/dist/phaser/core/cache.d.ts.map +1 -1
- package/dist/phaser/core/device.d.ts.map +1 -1
- package/dist/phaser/core/device_util.d.ts.map +1 -1
- package/dist/phaser/core/dom.d.ts +2 -2
- package/dist/phaser/core/dom.d.ts.map +1 -1
- package/dist/phaser/core/event_manager.d.ts.map +1 -1
- package/dist/phaser/core/factory.d.ts +1 -1
- package/dist/phaser/core/factory.d.ts.map +1 -1
- package/dist/phaser/core/frame.d.ts.map +1 -1
- package/dist/phaser/core/frame_data.d.ts.map +1 -1
- package/dist/phaser/core/frame_util.d.ts.map +1 -1
- package/dist/phaser/core/game.d.ts +1 -1
- package/dist/phaser/core/game.d.ts.map +1 -1
- package/dist/phaser/core/input.d.ts +3 -3
- package/dist/phaser/core/input.d.ts.map +1 -1
- package/dist/phaser/core/input_handler.d.ts +8 -8
- package/dist/phaser/core/input_handler.d.ts.map +1 -1
- package/dist/phaser/core/input_mouse.d.ts +8 -8
- package/dist/phaser/core/input_mouse.d.ts.map +1 -1
- package/dist/phaser/core/input_mspointer.d.ts +6 -6
- package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
- package/dist/phaser/core/input_pointer.d.ts +3 -3
- package/dist/phaser/core/input_pointer.d.ts.map +1 -1
- package/dist/phaser/core/input_touch.d.ts +7 -7
- package/dist/phaser/core/input_touch.d.ts.map +1 -1
- package/dist/phaser/core/loader.d.ts +16 -6
- package/dist/phaser/core/loader.d.ts.map +1 -1
- package/dist/phaser/core/loader_parser.d.ts +4 -4
- package/dist/phaser/core/loader_parser.d.ts.map +1 -1
- package/dist/phaser/core/raf.d.ts.map +1 -1
- package/dist/phaser/core/scale_manager.d.ts +5 -5
- package/dist/phaser/core/scale_manager.d.ts.map +1 -1
- package/dist/phaser/core/scene.d.ts +3 -3
- package/dist/phaser/core/scene.d.ts.map +1 -1
- package/dist/phaser/core/scene_manager.d.ts.map +1 -1
- package/dist/phaser/core/signal.d.ts +7 -7
- package/dist/phaser/core/signal.d.ts.map +1 -1
- package/dist/phaser/core/signal_binding.d.ts +1 -1
- package/dist/phaser/core/signal_binding.d.ts.map +1 -1
- package/dist/phaser/core/sound.d.ts +3 -3
- package/dist/phaser/core/sound.d.ts.map +1 -1
- package/dist/phaser/core/sound_manager.d.ts +1 -1
- package/dist/phaser/core/sound_manager.d.ts.map +1 -1
- package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
- package/dist/phaser/core/stage.d.ts.map +1 -1
- package/dist/phaser/core/time.d.ts.map +1 -1
- package/dist/phaser/core/timer.d.ts +5 -5
- package/dist/phaser/core/timer.d.ts.map +1 -1
- package/dist/phaser/core/timer_event.d.ts.map +1 -1
- package/dist/phaser/core/tween.d.ts +1 -1
- package/dist/phaser/core/tween.d.ts.map +1 -1
- package/dist/phaser/core/tween_data.d.ts +1 -1
- package/dist/phaser/core/tween_data.d.ts.map +1 -1
- package/dist/phaser/core/tween_easing.d.ts.map +1 -1
- package/dist/phaser/core/tween_manager.d.ts +1 -1
- package/dist/phaser/core/tween_manager.d.ts.map +1 -1
- package/dist/phaser/core/world.d.ts.map +1 -1
- package/dist/phaser/display/bitmap_text.d.ts +3 -3
- package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
- package/dist/phaser/display/button.d.ts +12 -11
- package/dist/phaser/display/button.d.ts.map +1 -1
- package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/graphics.d.ts +3 -3
- package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
- package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
- package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
- package/dist/phaser/display/canvas/renderer.d.ts +2 -2
- package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/tinter.d.ts +1 -1
- package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/dist/phaser/display/canvas/util.d.ts +1 -1
- package/dist/phaser/display/canvas/util.d.ts.map +1 -1
- package/dist/phaser/display/display_object.d.ts +12 -21
- package/dist/phaser/display/display_object.d.ts.map +1 -1
- package/dist/phaser/display/graphics.d.ts +1 -1
- package/dist/phaser/display/graphics.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/dist/phaser/display/group.d.ts +3 -3
- package/dist/phaser/display/group.d.ts.map +1 -1
- package/dist/phaser/display/image.d.ts +8 -8
- package/dist/phaser/display/image.d.ts.map +1 -1
- package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/sprite_util.d.ts +5 -5
- package/dist/phaser/display/sprite_util.d.ts.map +1 -1
- package/dist/phaser/display/text.d.ts +8 -7
- package/dist/phaser/display/text.d.ts.map +1 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts +5 -5
- package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +3 -2
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics.d.ts +4 -3
- package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/render_texture.d.ts +2 -2
- package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader_manager.d.ts +2 -1
- package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts +2 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/dist/phaser/display/webgl/util.d.ts +8 -4
- package/dist/phaser/display/webgl/util.d.ts.map +1 -1
- package/dist/phaser/geom/circle.d.ts +1 -1
- package/dist/phaser/geom/circle.d.ts.map +1 -1
- package/dist/phaser/geom/ellipse.d.ts +1 -1
- package/dist/phaser/geom/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/line.d.ts +3 -3
- package/dist/phaser/geom/line.d.ts.map +1 -1
- package/dist/phaser/geom/matrix.d.ts +3 -3
- package/dist/phaser/geom/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/point.d.ts.map +1 -1
- package/dist/phaser/geom/polygon.d.ts +1 -1
- package/dist/phaser/geom/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/rectangle.d.ts +2 -2
- package/dist/phaser/geom/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/circle.d.ts +3 -3
- package/dist/phaser/geom/util/circle.d.ts.map +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/util/line.d.ts +3 -3
- package/dist/phaser/geom/util/line.d.ts.map +1 -1
- package/dist/phaser/geom/util/matrix.d.ts +1 -1
- package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/util/point.d.ts +15 -15
- package/dist/phaser/geom/util/point.d.ts.map +1 -1
- package/dist/phaser/geom/util/polygon.d.ts +1 -1
- package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts +5 -5
- package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/rounded_rectangle.d.ts +1 -1
- package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/util/math.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/index.ts +8 -0
- package/src/phaser/core/animation.ts +16 -8
- package/src/phaser/core/animation_manager.ts +11 -5
- package/src/phaser/core/cache.ts +9 -8
- package/src/phaser/core/device.ts +24 -24
- package/src/phaser/core/device_util.ts +4 -2
- package/src/phaser/core/dom.ts +2 -2
- package/src/phaser/core/factory.ts +3 -5
- package/src/phaser/core/game.ts +21 -34
- package/src/phaser/core/input.ts +9 -5
- package/src/phaser/core/input_handler.ts +22 -7
- package/src/phaser/core/input_mouse.ts +8 -84
- package/src/phaser/core/input_mspointer.ts +22 -18
- package/src/phaser/core/input_pointer.ts +48 -48
- package/src/phaser/core/input_touch.ts +7 -7
- package/src/phaser/core/loader.ts +46 -31
- package/src/phaser/core/loader_parser.ts +34 -8
- package/src/phaser/core/scale_manager.ts +5 -5
- package/src/phaser/core/scene.ts +5 -5
- package/src/phaser/core/signal.ts +15 -9
- package/src/phaser/core/signal_binding.ts +8 -1
- package/src/phaser/core/sound.ts +18 -21
- package/src/phaser/core/sound_manager.ts +3 -3
- package/src/phaser/core/sound_sprite.ts +7 -7
- package/src/phaser/core/stage.ts +6 -6
- package/src/phaser/core/time.ts +28 -28
- package/src/phaser/core/timer.ts +4 -4
- package/src/phaser/core/tween.ts +31 -9
- package/src/phaser/core/tween_data.ts +2 -2
- package/src/phaser/core/tween_manager.ts +7 -7
- package/src/phaser/display/bitmap_text.ts +6 -6
- package/src/phaser/display/button.ts +38 -19
- package/src/phaser/display/canvas/buffer.ts +4 -4
- package/src/phaser/display/canvas/renderer.ts +2 -2
- package/src/phaser/display/canvas/util.ts +21 -13
- package/src/phaser/display/display_object.ts +17 -31
- package/src/phaser/display/graphics.ts +9 -9
- package/src/phaser/display/graphics_data.ts +19 -11
- package/src/phaser/display/group.ts +8 -8
- package/src/phaser/display/image.ts +26 -20
- package/src/phaser/display/sprite_util.ts +16 -4
- package/src/phaser/display/text.ts +9 -9
- package/src/phaser/display/webgl/blend_manager.ts +2 -2
- package/src/phaser/display/webgl/earcut.ts +31 -6
- package/src/phaser/display/webgl/fast_sprite_batch.ts +19 -17
- package/src/phaser/display/webgl/filter_manager.ts +3 -3
- package/src/phaser/display/webgl/filter_texture.ts +4 -4
- package/src/phaser/display/webgl/graphics.ts +11 -3
- package/src/phaser/display/webgl/graphics_data.ts +9 -9
- package/src/phaser/display/webgl/render_texture.ts +9 -3
- package/src/phaser/display/webgl/shader/complex.ts +5 -5
- package/src/phaser/display/webgl/shader/fast.ts +6 -6
- package/src/phaser/display/webgl/shader/normal.ts +11 -11
- package/src/phaser/display/webgl/shader/primitive.ts +5 -5
- package/src/phaser/display/webgl/shader/strip.ts +5 -5
- package/src/phaser/display/webgl/shader_manager.ts +12 -11
- package/src/phaser/display/webgl/sprite_batch.ts +18 -17
- package/src/phaser/display/webgl/stencil_manager.ts +18 -6
- package/src/phaser/display/webgl/texture.ts +6 -1
- package/src/phaser/display/webgl/util.ts +17 -4
- package/src/phaser/geom/circle.ts +1 -1
- package/src/phaser/geom/ellipse.ts +1 -1
- package/src/phaser/geom/line.ts +2 -2
- package/src/phaser/geom/matrix.ts +3 -3
- package/src/phaser/geom/polygon.ts +1 -1
- package/src/phaser/geom/rectangle.ts +2 -2
- package/src/phaser/geom/util/circle.ts +8 -3
- package/src/phaser/geom/util/line.ts +9 -2
- package/src/phaser/geom/util/matrix.ts +1 -1
- package/src/phaser/geom/util/point.ts +23 -16
- package/src/phaser/geom/util/polygon.ts +1 -1
- package/src/phaser/geom/util/rectangle.ts +13 -6
- package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -567,7 +567,7 @@ var Matrix = class {
|
|
|
567
567
|
* @returns {Float32Array} A Float32Array containing the matrix elements.
|
|
568
568
|
*/
|
|
569
569
|
toArray(transpose = false, output = null) {
|
|
570
|
-
const result = output || new Float32Array(9);
|
|
570
|
+
const result = output || /* @__PURE__ */ new Float32Array(9);
|
|
571
571
|
if (transpose) {
|
|
572
572
|
result[0] = this.a;
|
|
573
573
|
result[1] = this.b;
|
|
@@ -1447,12 +1447,13 @@ const getRGB = (color) => {
|
|
|
1447
1447
|
};
|
|
1448
1448
|
/** Converts a color value (string or number) to an object with various color formats. */
|
|
1449
1449
|
const valueToColor = (value, out) => {
|
|
1450
|
-
if (typeof value === "string")
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1450
|
+
if (typeof value === "string") {
|
|
1451
|
+
if (value.indexOf("rgb") === 0) webToColor(value, out);
|
|
1452
|
+
else {
|
|
1453
|
+
out.a = 1;
|
|
1454
|
+
hexToColor(value, out);
|
|
1455
|
+
}
|
|
1456
|
+
} else if (typeof value === "number") {
|
|
1456
1457
|
const tempColor = getRGB(value);
|
|
1457
1458
|
out.r = tempColor.r;
|
|
1458
1459
|
out.g = tempColor.g;
|
|
@@ -1897,35 +1898,26 @@ var DisplayObject = class {
|
|
|
1897
1898
|
rotation = 0;
|
|
1898
1899
|
/** @type {number} */
|
|
1899
1900
|
alpha = 1;
|
|
1900
|
-
/** @type {Rectangle} */
|
|
1901
1901
|
hitArea = null;
|
|
1902
|
-
/** @type {DisplayObject} */
|
|
1903
1902
|
parent = null;
|
|
1904
1903
|
/** @type {number} */
|
|
1905
1904
|
worldAlpha = 1;
|
|
1906
1905
|
worldTransform;
|
|
1907
1906
|
worldScale;
|
|
1908
|
-
/** @type {Rectangle} */
|
|
1909
1907
|
filterArea = null;
|
|
1910
1908
|
/** @type {number} */
|
|
1911
1909
|
_sr = 0;
|
|
1912
1910
|
/** @type {number} */
|
|
1913
1911
|
_cr = 1;
|
|
1914
1912
|
cachedBounds;
|
|
1915
|
-
/** @type {Rectangle} */
|
|
1916
1913
|
currentBounds = null;
|
|
1917
|
-
/** @type {import('./graphics.js').Graphics} */
|
|
1918
1914
|
_mask = null;
|
|
1919
|
-
/** @type {object[]} */
|
|
1920
1915
|
_filters = null;
|
|
1921
|
-
/** @type {object} */
|
|
1922
1916
|
_filterBlock = null;
|
|
1923
1917
|
children;
|
|
1924
1918
|
/** @type {boolean} */
|
|
1925
1919
|
ignoreChildInput = false;
|
|
1926
|
-
/** @type {string | null} */
|
|
1927
1920
|
name = null;
|
|
1928
|
-
/** @type {object | null} */
|
|
1929
1921
|
data = null;
|
|
1930
1922
|
game;
|
|
1931
1923
|
type;
|
|
@@ -2147,9 +2139,7 @@ var DisplayObject = class {
|
|
|
2147
2139
|
updateTransform(parent = null) {
|
|
2148
2140
|
if (!parent && !this.parent) return this;
|
|
2149
2141
|
if (!this.game || !this.visible) return this;
|
|
2150
|
-
|
|
2151
|
-
if (parent) p = parent;
|
|
2152
|
-
else if (!this.parent) p = this.game.world;
|
|
2142
|
+
const p = parent ?? this.parent ?? this.game.world;
|
|
2153
2143
|
const pt = p.worldTransform;
|
|
2154
2144
|
const wt = this.worldTransform;
|
|
2155
2145
|
let a;
|
|
@@ -2492,7 +2482,7 @@ var DisplayObject = class {
|
|
|
2492
2482
|
set mask(value) {
|
|
2493
2483
|
if (this._mask) this._mask.isMask = false;
|
|
2494
2484
|
this._mask = value;
|
|
2495
|
-
if (value)
|
|
2485
|
+
if (value) value.isMask = true;
|
|
2496
2486
|
}
|
|
2497
2487
|
/**
|
|
2498
2488
|
* Gets the x offset for this display object (based on anchor point).
|
|
@@ -3163,8 +3153,10 @@ var Animation = class {
|
|
|
3163
3153
|
*/
|
|
3164
3154
|
next(quantity = 1) {
|
|
3165
3155
|
let frame = this._frameIndex + quantity;
|
|
3166
|
-
if (frame >= this._frames.length)
|
|
3167
|
-
|
|
3156
|
+
if (frame >= this._frames.length) {
|
|
3157
|
+
if (this.loop) frame %= this._frames.length;
|
|
3158
|
+
else frame = this._frames.length - 1;
|
|
3159
|
+
}
|
|
3168
3160
|
if (frame !== this._frameIndex) {
|
|
3169
3161
|
this._frameIndex = frame;
|
|
3170
3162
|
this.updateCurrentFrame(true);
|
|
@@ -3176,8 +3168,10 @@ var Animation = class {
|
|
|
3176
3168
|
*/
|
|
3177
3169
|
previous(quantity = 1) {
|
|
3178
3170
|
let frame = this._frameIndex - quantity;
|
|
3179
|
-
if (frame < 0)
|
|
3180
|
-
|
|
3171
|
+
if (frame < 0) {
|
|
3172
|
+
if (this.loop) frame = this._frames.length + frame;
|
|
3173
|
+
else frame += 1;
|
|
3174
|
+
}
|
|
3181
3175
|
if (frame !== this._frameIndex) {
|
|
3182
3176
|
this._frameIndex = frame;
|
|
3183
3177
|
this.updateCurrentFrame(true);
|
|
@@ -3412,8 +3406,10 @@ var AnimationManager = class {
|
|
|
3412
3406
|
*/
|
|
3413
3407
|
add(name, frameList, frameRate = 60, loop = false, useNumericIndex = void 0) {
|
|
3414
3408
|
const frames = frameList || [];
|
|
3415
|
-
if (useNumericIndex === void 0)
|
|
3416
|
-
|
|
3409
|
+
if (useNumericIndex === void 0) {
|
|
3410
|
+
if (frames && typeof frames[0] === "number") useNumericIndex = true;
|
|
3411
|
+
else useNumericIndex = false;
|
|
3412
|
+
}
|
|
3417
3413
|
this._outputFrames = [];
|
|
3418
3414
|
this._frameData.getFrameIndexes(frames, useNumericIndex, this._outputFrames);
|
|
3419
3415
|
this._anims[name] = new Animation(this.game, this.sprite, name, this._frameData, this._outputFrames, frameRate, loop);
|
|
@@ -3562,7 +3558,7 @@ var AnimationManager = class {
|
|
|
3562
3558
|
if (typeof value === "number" && this._frameData && this._frameData.getFrame(value) !== null) {
|
|
3563
3559
|
this.currentFrame = this._frameData.getFrame(value);
|
|
3564
3560
|
if (this.currentFrame) this.sprite.setFrame(this.currentFrame);
|
|
3565
|
-
} else this.game.logger.exception("AnimationManager", new Error(ENGINE_ERROR_CANNOT_SET_FRAME), { tags: { "asset.key": value } });
|
|
3561
|
+
} else this.game.logger.exception("AnimationManager", /* @__PURE__ */ new Error(ENGINE_ERROR_CANNOT_SET_FRAME), { tags: { "asset.key": value } });
|
|
3566
3562
|
}
|
|
3567
3563
|
/**
|
|
3568
3564
|
* Gets the current frame name.
|
|
@@ -3582,7 +3578,7 @@ var AnimationManager = class {
|
|
|
3582
3578
|
this._frameIndex = this.currentFrame.index;
|
|
3583
3579
|
this.sprite.setFrame(this.currentFrame);
|
|
3584
3580
|
}
|
|
3585
|
-
} else this.game.logger.exception("AnimationManager", new Error(ENGINE_ERROR_CANNOT_SET_FRAME_NAME), { tags: { "asset.key": value } });
|
|
3581
|
+
} else this.game.logger.exception("AnimationManager", /* @__PURE__ */ new Error(ENGINE_ERROR_CANNOT_SET_FRAME_NAME), { tags: { "asset.key": value } });
|
|
3586
3582
|
}
|
|
3587
3583
|
};
|
|
3588
3584
|
//#endregion
|
|
@@ -3985,7 +3981,7 @@ var Image$1 = class extends DisplayObject {
|
|
|
3985
3981
|
this.destroy();
|
|
3986
3982
|
return;
|
|
3987
3983
|
}
|
|
3988
|
-
if (!this.exists || !this.parent
|
|
3984
|
+
if (!this.exists || !this.parent?.exists) {
|
|
3989
3985
|
this.renderOrderID = -1;
|
|
3990
3986
|
return;
|
|
3991
3987
|
}
|
|
@@ -4004,7 +4000,7 @@ var Image$1 = class extends DisplayObject {
|
|
|
4004
4000
|
*/
|
|
4005
4001
|
loadTexture(key, frame = 0, stopAnimation = true) {
|
|
4006
4002
|
if (key === -1) {
|
|
4007
|
-
key = frame;
|
|
4003
|
+
key = frame ?? 0;
|
|
4008
4004
|
frame = 0;
|
|
4009
4005
|
} else frame = frame || 0;
|
|
4010
4006
|
if (stopAnimation) this.animations.stop();
|
|
@@ -4065,11 +4061,11 @@ var Image$1 = class extends DisplayObject {
|
|
|
4065
4061
|
}
|
|
4066
4062
|
/**
|
|
4067
4063
|
* Resizes the frame of this image.
|
|
4068
|
-
* @param {DisplayObject}
|
|
4064
|
+
* @param {DisplayObject} _parent - The parent display object.
|
|
4069
4065
|
* @param {number} width - The new width of the frame.
|
|
4070
4066
|
* @param {number} height - The new height of the frame.
|
|
4071
4067
|
*/
|
|
4072
|
-
resizeFrame(
|
|
4068
|
+
resizeFrame(_parent, width, height) {
|
|
4073
4069
|
this.texture.frame.resize(width, height);
|
|
4074
4070
|
this.texture.setFrame(this.texture.frame);
|
|
4075
4071
|
}
|
|
@@ -4301,7 +4297,7 @@ var BitmapText = class extends DisplayObject {
|
|
|
4301
4297
|
this.destroy();
|
|
4302
4298
|
return;
|
|
4303
4299
|
}
|
|
4304
|
-
if (!this.exists || !this.parent
|
|
4300
|
+
if (!this.exists || !this.parent?.exists) {
|
|
4305
4301
|
this.renderOrderID = -1;
|
|
4306
4302
|
return;
|
|
4307
4303
|
}
|
|
@@ -4476,10 +4472,10 @@ var BitmapText = class extends DisplayObject {
|
|
|
4476
4472
|
/**
|
|
4477
4473
|
* Adds a color to a specific position in the text.
|
|
4478
4474
|
* @param {string} value - The color to apply (in hex format or CSS color name).
|
|
4479
|
-
* @param {number}
|
|
4475
|
+
* @param {number} _position - The character position to apply the color to.
|
|
4480
4476
|
* @returns {BitmapText} This bitmap text instance for chaining.
|
|
4481
4477
|
*/
|
|
4482
|
-
addColor(value,
|
|
4478
|
+
addColor(value, _position) {
|
|
4483
4479
|
const color = typeof value === "string" ? Number.parseInt(value.replace("#", ""), 16) : value;
|
|
4484
4480
|
if (color !== this._tint) {
|
|
4485
4481
|
this._tint = color;
|
|
@@ -4927,6 +4923,7 @@ var InputHandler = class {
|
|
|
4927
4923
|
if (!this.enabled) return false;
|
|
4928
4924
|
if (pointerId === void 0 || pointerId === null) {
|
|
4929
4925
|
for (let i = 0; i < 10; i += 1) if (this._pointerData[i].isOut) return true;
|
|
4926
|
+
return false;
|
|
4930
4927
|
}
|
|
4931
4928
|
return this._pointerData[pointerId].isOut;
|
|
4932
4929
|
}
|
|
@@ -4991,7 +4988,7 @@ var InputHandler = class {
|
|
|
4991
4988
|
*/
|
|
4992
4989
|
checkPixel(x, y, pointer) {
|
|
4993
4990
|
if (this.sprite.texture.baseTexture.source) {
|
|
4994
|
-
if (x === null
|
|
4991
|
+
if (x === null || y === null) {
|
|
4995
4992
|
this.game.input.getLocalPosition(this.sprite, pointer, this._tempPoint);
|
|
4996
4993
|
x = this._tempPoint.x;
|
|
4997
4994
|
y = this._tempPoint.y;
|
|
@@ -5106,14 +5103,16 @@ var InputHandler = class {
|
|
|
5106
5103
|
if (this.sprite && this.sprite.parent && this.sprite.parent.type === 7) this.sprite.parent.onChildInputDown.dispatch(this.sprite, pointer);
|
|
5107
5104
|
if (this.sprite === null) return;
|
|
5108
5105
|
}
|
|
5109
|
-
if (this.draggable && this.isDragged === false)
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
this.
|
|
5115
|
-
|
|
5116
|
-
|
|
5106
|
+
if (this.draggable && this.isDragged === false) {
|
|
5107
|
+
if (this.dragTimeThreshold === 0 && this.dragDistanceThreshold === 0) this.startDrag(pointer);
|
|
5108
|
+
else {
|
|
5109
|
+
this._pendingDrag = true;
|
|
5110
|
+
this._dragDistancePass = this.dragDistanceThreshold === 0;
|
|
5111
|
+
if (this.dragTimeThreshold > 0) {
|
|
5112
|
+
this._dragTimePass = false;
|
|
5113
|
+
this.game.time.events.add(this.dragTimeThreshold, this.dragTimeElapsed, this, pointer);
|
|
5114
|
+
} else this._dragTimePass = true;
|
|
5115
|
+
}
|
|
5117
5116
|
}
|
|
5118
5117
|
if (this.bringToTop) this.sprite.bringToTop();
|
|
5119
5118
|
}
|
|
@@ -5544,10 +5543,10 @@ var Button = class extends Image$1 {
|
|
|
5544
5543
|
}
|
|
5545
5544
|
/**
|
|
5546
5545
|
* Handles the input over event for this button.
|
|
5547
|
-
* @param {object}
|
|
5546
|
+
* @param {object} _sprite - The sprite that triggered the event.
|
|
5548
5547
|
* @param {object} pointer - The pointer that triggered the event.
|
|
5549
5548
|
*/
|
|
5550
|
-
onInputOverHandler(
|
|
5549
|
+
onInputOverHandler(_sprite, pointer) {
|
|
5551
5550
|
if (pointer.justReleased() && (this.justReleasedPreventsOver & pointer.pointerMode) === pointer.pointerMode) return;
|
|
5552
5551
|
this.changeStateFrame(STATE_OVER);
|
|
5553
5552
|
if (this.onOverMouseOnly && !pointer.isMouse) return;
|
|
@@ -5555,34 +5554,36 @@ var Button = class extends Image$1 {
|
|
|
5555
5554
|
}
|
|
5556
5555
|
/**
|
|
5557
5556
|
* Handles the input out event for this button.
|
|
5558
|
-
* @param {object}
|
|
5557
|
+
* @param {object} _sprite - The sprite that triggered the event.
|
|
5559
5558
|
* @param {object} pointer - The pointer that triggered the event.
|
|
5560
5559
|
*/
|
|
5561
|
-
onInputOutHandler(
|
|
5560
|
+
onInputOutHandler(_sprite, pointer) {
|
|
5562
5561
|
this.changeStateFrame(STATE_OUT);
|
|
5563
5562
|
if (this.onInputOut) this.onInputOut.dispatch(this, pointer);
|
|
5564
5563
|
}
|
|
5565
5564
|
/**
|
|
5566
5565
|
* Handles the input down event for this button.
|
|
5567
|
-
* @param {object}
|
|
5566
|
+
* @param {object} _sprite - The sprite that triggered the event.
|
|
5568
5567
|
* @param {object} pointer - The pointer that triggered the event.
|
|
5569
5568
|
*/
|
|
5570
|
-
onInputDownHandler(
|
|
5569
|
+
onInputDownHandler(_sprite, pointer) {
|
|
5571
5570
|
this.changeStateFrame(STATE_DOWN);
|
|
5572
5571
|
if (this.onInputDown) this.onInputDown.dispatch(this, pointer);
|
|
5573
5572
|
}
|
|
5574
5573
|
/**
|
|
5575
5574
|
* Handles the input up event for this button.
|
|
5576
|
-
* @param {object}
|
|
5575
|
+
* @param {object} _sprite - The sprite that triggered the event.
|
|
5577
5576
|
* @param {object} pointer - The pointer that triggered the event.
|
|
5578
5577
|
* @param {boolean} isOver - Whether the pointer is currently over the button (default: true).
|
|
5579
5578
|
*/
|
|
5580
|
-
onInputUpHandler(
|
|
5579
|
+
onInputUpHandler(_sprite, pointer, isOver) {
|
|
5581
5580
|
if (this.onInputUp) this.onInputUp.dispatch(this, pointer, isOver);
|
|
5582
5581
|
if (this.freezeFrames) return;
|
|
5583
5582
|
if (this.forceOut === true || (this.forceOut & pointer.pointerMode) === pointer.pointerMode) this.changeStateFrame(STATE_OUT);
|
|
5584
|
-
else if (!this.changeStateFrame(STATE_UP))
|
|
5585
|
-
|
|
5583
|
+
else if (!this.changeStateFrame(STATE_UP)) {
|
|
5584
|
+
if (isOver) this.changeStateFrame(STATE_OVER);
|
|
5585
|
+
else this.changeStateFrame(STATE_OUT);
|
|
5586
|
+
}
|
|
5586
5587
|
}
|
|
5587
5588
|
/**
|
|
5588
5589
|
* Gets whether input is currently enabled for this button.
|
|
@@ -6685,7 +6686,7 @@ function zOrder(x, y, minX, minY, size) {
|
|
|
6685
6686
|
* @param {number} minY - The minimum y-coordinate of the bounding box.
|
|
6686
6687
|
* @param {number} size - The size of the bounding box.
|
|
6687
6688
|
*/
|
|
6688
|
-
function indexCurve(start, minX, minY, size) {
|
|
6689
|
+
function indexCurve(start, minX = 0, minY = 0, size = 0) {
|
|
6689
6690
|
let p = start;
|
|
6690
6691
|
do {
|
|
6691
6692
|
if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, size);
|
|
@@ -6882,7 +6883,7 @@ function isEar(ear) {
|
|
|
6882
6883
|
* @param {number} size - TBD.
|
|
6883
6884
|
* @returns {boolean} TBD.
|
|
6884
6885
|
*/
|
|
6885
|
-
function isEarHashed(ear, minX, minY, size) {
|
|
6886
|
+
function isEarHashed(ear, minX = 0, minY = 0, size = 0) {
|
|
6886
6887
|
const a = ear.prev;
|
|
6887
6888
|
const b = ear;
|
|
6888
6889
|
const c = ear.next;
|
|
@@ -7021,6 +7022,7 @@ function eliminateHoles(data, holeIndices, outerNode, dim) {
|
|
|
7021
7022
|
start = holeIndices[i] * dim;
|
|
7022
7023
|
end = i < len - 1 ? holeIndices[i + 1] * dim : data.length;
|
|
7023
7024
|
list = linkedList(data, start, end, dim, false);
|
|
7025
|
+
if (!list) continue;
|
|
7024
7026
|
if (list === list.next) list.steiner = true;
|
|
7025
7027
|
queue.push(getLeftmost(list));
|
|
7026
7028
|
}
|
|
@@ -7065,7 +7067,7 @@ function cureLocalIntersections(start, triangles, dim) {
|
|
|
7065
7067
|
* @param {number} minY - The minimum y-coordinate of the bounding box.
|
|
7066
7068
|
* @param {number} size - The size of the bounding box.
|
|
7067
7069
|
*/
|
|
7068
|
-
function splitEarcut(start, triangles, dim, minX, minY, size) {
|
|
7070
|
+
function splitEarcut(start, triangles, dim, minX = 0, minY = 0, size = 0) {
|
|
7069
7071
|
let a = start;
|
|
7070
7072
|
do {
|
|
7071
7073
|
let b = a.next.next;
|
|
@@ -7552,8 +7554,7 @@ const buildCircle = (graphicsData, webGLData) => {
|
|
|
7552
7554
|
width = circleData.width;
|
|
7553
7555
|
height = circleData.height;
|
|
7554
7556
|
}
|
|
7555
|
-
const
|
|
7556
|
-
const seg = Math.PI * 2 / totalSegs;
|
|
7557
|
+
const seg = Math.PI * 2 / 40;
|
|
7557
7558
|
if (graphicsData.fill) {
|
|
7558
7559
|
const color = hex2rgb(graphicsData.fillColor);
|
|
7559
7560
|
const alpha = graphicsData.fillAlpha;
|
|
@@ -7564,7 +7565,7 @@ const buildCircle = (graphicsData, webGLData) => {
|
|
|
7564
7565
|
const indices = webGLData.indices;
|
|
7565
7566
|
let vecPos = verts.length / 6;
|
|
7566
7567
|
indices.push(vecPos);
|
|
7567
|
-
for (let i = 0; i <
|
|
7568
|
+
for (let i = 0; i < 41; i += 1) {
|
|
7568
7569
|
verts.push(x, y, r, g, b, alpha);
|
|
7569
7570
|
verts.push(x + Math.sin(seg * i) * width, y + Math.cos(seg * i) * height, r, g, b, alpha);
|
|
7570
7571
|
indices.push(vecPos, vecPos + 1);
|
|
@@ -7575,7 +7576,7 @@ const buildCircle = (graphicsData, webGLData) => {
|
|
|
7575
7576
|
if (graphicsData.lineWidth) {
|
|
7576
7577
|
const tempPoints = graphicsData.points;
|
|
7577
7578
|
graphicsData.points = [];
|
|
7578
|
-
for (let i = 0; i <
|
|
7579
|
+
for (let i = 0; i < 41; i += 1) graphicsData.points.push(x + Math.sin(seg * i) * width, y + Math.cos(seg * i) * height);
|
|
7579
7580
|
buildLine(graphicsData, webGLData);
|
|
7580
7581
|
graphicsData.points = tempPoints;
|
|
7581
7582
|
}
|
|
@@ -7677,15 +7678,17 @@ const updateGraphics = (graphics, gl) => {
|
|
|
7677
7678
|
if (data.points[0] !== data.points[data.points.length - 2] || data.points[1] !== data.points[data.points.length - 1]) data.points.push(data.points[0], data.points[1]);
|
|
7678
7679
|
}
|
|
7679
7680
|
if (data.fill) {
|
|
7680
|
-
if (data.points.length >= stencilBufferLimit)
|
|
7681
|
-
|
|
7682
|
-
|
|
7681
|
+
if (data.points.length >= stencilBufferLimit) {
|
|
7682
|
+
if (data.points.length < stencilBufferLimit * 2) {
|
|
7683
|
+
webGLData = switchMode(webGL, 0);
|
|
7684
|
+
if (!buildPoly(data, webGLData)) {
|
|
7685
|
+
webGLData = switchMode(webGL, 1);
|
|
7686
|
+
buildComplexPoly(data, webGLData);
|
|
7687
|
+
}
|
|
7688
|
+
} else {
|
|
7683
7689
|
webGLData = switchMode(webGL, 1);
|
|
7684
7690
|
buildComplexPoly(data, webGLData);
|
|
7685
7691
|
}
|
|
7686
|
-
} else {
|
|
7687
|
-
webGLData = switchMode(webGL, 1);
|
|
7688
|
-
buildComplexPoly(data, webGLData);
|
|
7689
7692
|
}
|
|
7690
7693
|
}
|
|
7691
7694
|
if (data.lineWidth > 0) {
|
|
@@ -7935,11 +7938,13 @@ var Graphics = class extends DisplayObject {
|
|
|
7935
7938
|
this.lineWidth = lineWidth || 0;
|
|
7936
7939
|
this.lineColor = color || 0;
|
|
7937
7940
|
this.lineAlpha = alpha === void 0 ? 1 : alpha;
|
|
7938
|
-
if (this.currentPath)
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7941
|
+
if (this.currentPath) {
|
|
7942
|
+
if (this.currentPath.shape.points.length) this.drawShape(new Polygon(this.currentPath.shape.points.slice(-2)));
|
|
7943
|
+
else {
|
|
7944
|
+
this.currentPath.lineWidth = this.lineWidth;
|
|
7945
|
+
this.currentPath.lineColor = this.lineColor;
|
|
7946
|
+
this.currentPath.lineAlpha = this.lineAlpha;
|
|
7947
|
+
}
|
|
7943
7948
|
}
|
|
7944
7949
|
return this;
|
|
7945
7950
|
}
|
|
@@ -8570,25 +8575,26 @@ var Graphics = class extends DisplayObject {
|
|
|
8570
8575
|
const point3 = new Point();
|
|
8571
8576
|
let points = [];
|
|
8572
8577
|
let i;
|
|
8573
|
-
if (!indices)
|
|
8574
|
-
vertices[i
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
else for (i = 0; i < vertices.length / 6; i += 1) {
|
|
8579
|
-
point1.x = vertices[i * 6 + 0];
|
|
8580
|
-
point1.y = vertices[i * 6 + 1];
|
|
8581
|
-
point2.x = vertices[i * 6 + 2];
|
|
8582
|
-
point2.y = vertices[i * 6 + 3];
|
|
8583
|
-
point3.x = vertices[i * 6 + 4];
|
|
8584
|
-
point3.y = vertices[i * 6 + 5];
|
|
8585
|
-
this.drawTriangle([
|
|
8586
|
-
point1,
|
|
8587
|
-
point2,
|
|
8588
|
-
point3
|
|
8578
|
+
if (!indices) {
|
|
8579
|
+
if (vertices[0] instanceof Point) for (i = 0; i < vertices.length / 3; i += 1) this.drawTriangle([
|
|
8580
|
+
vertices[i * 3],
|
|
8581
|
+
vertices[i * 3 + 1],
|
|
8582
|
+
vertices[i * 3 + 2]
|
|
8589
8583
|
], cull);
|
|
8590
|
-
|
|
8591
|
-
|
|
8584
|
+
else for (i = 0; i < vertices.length / 6; i += 1) {
|
|
8585
|
+
point1.x = vertices[i * 6 + 0];
|
|
8586
|
+
point1.y = vertices[i * 6 + 1];
|
|
8587
|
+
point2.x = vertices[i * 6 + 2];
|
|
8588
|
+
point2.y = vertices[i * 6 + 3];
|
|
8589
|
+
point3.x = vertices[i * 6 + 4];
|
|
8590
|
+
point3.y = vertices[i * 6 + 5];
|
|
8591
|
+
this.drawTriangle([
|
|
8592
|
+
point1,
|
|
8593
|
+
point2,
|
|
8594
|
+
point3
|
|
8595
|
+
], cull);
|
|
8596
|
+
}
|
|
8597
|
+
} else if (vertices[0] instanceof Point) for (i = 0; i < indices.length / 3; i += 1) {
|
|
8592
8598
|
points.push(vertices[indices[i * 3]]);
|
|
8593
8599
|
points.push(vertices[indices[i * 3 + 1]]);
|
|
8594
8600
|
points.push(vertices[indices[i * 3 + 2]]);
|
|
@@ -8819,7 +8825,7 @@ var Group = class extends DisplayObject {
|
|
|
8819
8825
|
this.destroy();
|
|
8820
8826
|
return;
|
|
8821
8827
|
}
|
|
8822
|
-
if (!this.exists || !this.parent
|
|
8828
|
+
if (!this.exists || !this.parent?.exists) {
|
|
8823
8829
|
this.renderOrderID = -1;
|
|
8824
8830
|
return;
|
|
8825
8831
|
}
|
|
@@ -9326,7 +9332,8 @@ var Text = class extends Image$1 {
|
|
|
9326
9332
|
if (wordWidth <= currentLineWidth) break;
|
|
9327
9333
|
}
|
|
9328
9334
|
if (!newWord.length) throw new Error("This text's wordWrapWidth setting is less than a single character!");
|
|
9329
|
-
|
|
9335
|
+
const secondPart = word.substr(newWord.length);
|
|
9336
|
+
words[j] = secondPart;
|
|
9330
9337
|
out += newWord;
|
|
9331
9338
|
}
|
|
9332
9339
|
const offset = words[j].length ? j : j + 1;
|
|
@@ -9566,12 +9573,10 @@ var Text = class extends Image$1 {
|
|
|
9566
9573
|
determineFontProperties(font) {
|
|
9567
9574
|
let properties = this.getFontPropertiesCache()[font];
|
|
9568
9575
|
if (properties) return properties;
|
|
9569
|
-
const METRICS_STRING = "|ÉqÅ";
|
|
9570
|
-
const BASELINE_SYMBOL = "M";
|
|
9571
9576
|
/** @type {CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D} */
|
|
9572
9577
|
const context = this.getFontPropertiesContext();
|
|
9573
9578
|
context.font = font;
|
|
9574
|
-
const metrics = context.measureText(
|
|
9579
|
+
const metrics = context.measureText("|ÉqÅM");
|
|
9575
9580
|
properties = {
|
|
9576
9581
|
ascent: Math.ceil(metrics.actualBoundingBoxAscent),
|
|
9577
9582
|
descent: Math.ceil(metrics.actualBoundingBoxDescent),
|
|
@@ -10121,8 +10126,7 @@ var GameObjectFactory = class {
|
|
|
10121
10126
|
* @returns {Image} The created Image object.
|
|
10122
10127
|
*/
|
|
10123
10128
|
image(x, y, key, frame, group = null) {
|
|
10124
|
-
|
|
10125
|
-
return group.add(new Image$1(this.game, x, y, key, frame));
|
|
10129
|
+
return (group ?? this.game.world).add(new Image$1(this.game, x, y, key, frame));
|
|
10126
10130
|
}
|
|
10127
10131
|
/**
|
|
10128
10132
|
* Creates a new Group object.
|
|
@@ -10246,9 +10250,8 @@ const create = (parent, width, height, id, skipPool) => {
|
|
|
10246
10250
|
*/
|
|
10247
10251
|
const setTouchAction = (canvas, value = "none") => {
|
|
10248
10252
|
value = value || "none";
|
|
10249
|
-
canvas.style.
|
|
10250
|
-
canvas.style
|
|
10251
|
-
canvas.style["touch-action"] = value;
|
|
10253
|
+
canvas.style.setProperty("-ms-touch-action", value);
|
|
10254
|
+
canvas.style.setProperty("touch-action", value);
|
|
10252
10255
|
return canvas;
|
|
10253
10256
|
};
|
|
10254
10257
|
/**
|
|
@@ -10259,13 +10262,13 @@ const setTouchAction = (canvas, value = "none") => {
|
|
|
10259
10262
|
*/
|
|
10260
10263
|
const setUserSelect = (canvas, value = "none") => {
|
|
10261
10264
|
value = value || "none";
|
|
10262
|
-
canvas.style
|
|
10263
|
-
canvas.style
|
|
10264
|
-
canvas.style
|
|
10265
|
-
canvas.style
|
|
10266
|
-
canvas.style
|
|
10267
|
-
canvas.style
|
|
10268
|
-
canvas.style
|
|
10265
|
+
canvas.style.setProperty("-webkit-touch-callout", value);
|
|
10266
|
+
canvas.style.setProperty("-webkit-user-select", value);
|
|
10267
|
+
canvas.style.setProperty("-khtml-user-select", value);
|
|
10268
|
+
canvas.style.setProperty("-moz-user-select", value);
|
|
10269
|
+
canvas.style.setProperty("-ms-user-select", value);
|
|
10270
|
+
canvas.style.setProperty("user-select", value);
|
|
10271
|
+
canvas.style.setProperty("-webkit-tap-highlight-color", "rgba(0, 0, 0, 0)");
|
|
10269
10272
|
return canvas;
|
|
10270
10273
|
};
|
|
10271
10274
|
/**
|
|
@@ -10306,9 +10309,10 @@ const getSmoothingPrefix = (context) => {
|
|
|
10306
10309
|
"mozI",
|
|
10307
10310
|
"oI"
|
|
10308
10311
|
];
|
|
10312
|
+
const smoothingFlags = context;
|
|
10309
10313
|
for (let i = 0; i < VENDORS.length; i += 1) {
|
|
10310
10314
|
const s = `${VENDORS[i]}mageSmoothingEnabled`;
|
|
10311
|
-
if (context &&
|
|
10315
|
+
if (context && smoothingFlags[s]) return s;
|
|
10312
10316
|
}
|
|
10313
10317
|
return null;
|
|
10314
10318
|
};
|
|
@@ -10330,7 +10334,7 @@ var CanvasRenderer = class {
|
|
|
10330
10334
|
renderSession;
|
|
10331
10335
|
/**
|
|
10332
10336
|
* Creates a new CanvasRenderer instance.
|
|
10333
|
-
* @param {import('../../core/game.js').Game}
|
|
10337
|
+
* @param {import('../../core/game.js').Game} _game - The game instance.
|
|
10334
10338
|
*/
|
|
10335
10339
|
constructor(game) {
|
|
10336
10340
|
detectCapabilities(game);
|
|
@@ -10450,7 +10454,7 @@ var CanvasRenderer = class {
|
|
|
10450
10454
|
* Initializes the WebGL context for rendering.
|
|
10451
10455
|
* @param {import('../../core/game.js').Game} game - The game instance.
|
|
10452
10456
|
*/
|
|
10453
|
-
initContext(
|
|
10457
|
+
initContext(_game) {}
|
|
10454
10458
|
};
|
|
10455
10459
|
//#endregion
|
|
10456
10460
|
//#region src/phaser/display/webgl/blend_manager.ts
|
|
@@ -10606,6 +10610,7 @@ const getWebGLContextErrorName = (errorCode) => {
|
|
|
10606
10610
|
const compileShader = (gl, shaderSrc, shaderType) => {
|
|
10607
10611
|
const src = Array.isArray(shaderSrc) ? shaderSrc.join("\n") : shaderSrc;
|
|
10608
10612
|
const shader = gl.createShader(shaderType);
|
|
10613
|
+
if (!shader) return null;
|
|
10609
10614
|
gl.shaderSource(shader, src);
|
|
10610
10615
|
gl.compileShader(shader);
|
|
10611
10616
|
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
|
@@ -10644,6 +10649,7 @@ const compileProgram = (gl, vertexSrc, fragmentSrc) => {
|
|
|
10644
10649
|
const fragmentShader = compileFragmentShader(gl, fragmentSrc);
|
|
10645
10650
|
const vertexShader = compileVertexShader(gl, vertexSrc);
|
|
10646
10651
|
const shaderProgram = gl.createProgram();
|
|
10652
|
+
if (!shaderProgram || !vertexShader || !fragmentShader) return null;
|
|
10647
10653
|
gl.attachShader(shaderProgram, vertexShader);
|
|
10648
10654
|
gl.attachShader(shaderProgram, fragmentShader);
|
|
10649
10655
|
gl.linkProgram(shaderProgram);
|
|
@@ -10974,18 +10980,21 @@ var NormalShader = class {
|
|
|
10974
10980
|
for (let i = 0; i < keys.length; i += 1) {
|
|
10975
10981
|
const key = keys[i];
|
|
10976
10982
|
uniform = this.uniforms[key];
|
|
10977
|
-
if (uniform.glValueLength === 1)
|
|
10978
|
-
|
|
10979
|
-
|
|
10983
|
+
if (uniform.glValueLength === 1) {
|
|
10984
|
+
if (uniform.glMatrix === true) uniform.glFunc.call(gl, uniform.uniformLocation, uniform.transpose, uniform.value);
|
|
10985
|
+
else uniform.glFunc.call(gl, uniform.uniformLocation, uniform.value);
|
|
10986
|
+
} else if (uniform.glValueLength === 2) uniform.glFunc.call(gl, uniform.uniformLocation, uniform.value.x, uniform.value.y);
|
|
10980
10987
|
else if (uniform.glValueLength === 3) uniform.glFunc.call(gl, uniform.uniformLocation, uniform.value.x, uniform.value.y, uniform.value.z);
|
|
10981
10988
|
else if (uniform.glValueLength === 4) uniform.glFunc.call(gl, uniform.uniformLocation, uniform.value.x, uniform.value.y, uniform.value.z, uniform.value.w);
|
|
10982
|
-
else if (uniform.type === "sampler2D")
|
|
10983
|
-
|
|
10984
|
-
|
|
10985
|
-
|
|
10986
|
-
|
|
10987
|
-
|
|
10988
|
-
|
|
10989
|
+
else if (uniform.type === "sampler2D") {
|
|
10990
|
+
if (uniform._init) {
|
|
10991
|
+
gl.activeTexture(gl[`TEXTURE${this.textureCount}`]);
|
|
10992
|
+
if (uniform.value.baseTexture._dirty[gl.id]) window.PhaserRegistry.INSTANCES[gl.id].updateTexture(uniform.value.baseTexture);
|
|
10993
|
+
else gl.bindTexture(gl.TEXTURE_2D, uniform.value.baseTexture._glTextures[gl.id]);
|
|
10994
|
+
gl.uniform1i(uniform.uniformLocation, this.textureCount);
|
|
10995
|
+
this.textureCount += 1;
|
|
10996
|
+
} else this.initSampler2D(uniform);
|
|
10997
|
+
}
|
|
10989
10998
|
}
|
|
10990
10999
|
}
|
|
10991
11000
|
/**
|
|
@@ -12210,7 +12219,8 @@ const jsonBitmapFont = (json, baseTexture, xSpacing, ySpacing) => {
|
|
|
12210
12219
|
};
|
|
12211
12220
|
});
|
|
12212
12221
|
if (json.font.kernings && json.font.kernings.kerning) json.font.kernings.kerning.forEach((kerning) => {
|
|
12213
|
-
data.chars[
|
|
12222
|
+
const char = data.chars[Number.parseInt(kerning._second, 10)];
|
|
12223
|
+
if (char) char.kerning[Number.parseInt(kerning._first, 10)] = Number.parseInt(kerning._amount, 10);
|
|
12214
12224
|
});
|
|
12215
12225
|
return finalizeBitmapFont(baseTexture, data);
|
|
12216
12226
|
};
|
|
@@ -12287,18 +12297,19 @@ var Cache = class {
|
|
|
12287
12297
|
* @returns {object} The cached image object.
|
|
12288
12298
|
*/
|
|
12289
12299
|
addImage(key, url, data) {
|
|
12300
|
+
const resolvedUrl = url ?? "";
|
|
12290
12301
|
if (this.checkImageKey(key)) this.removeImage(key);
|
|
12291
12302
|
const img = {
|
|
12292
12303
|
key,
|
|
12293
|
-
url,
|
|
12304
|
+
url: resolvedUrl,
|
|
12294
12305
|
data,
|
|
12295
12306
|
base: new BaseTexture(data),
|
|
12296
12307
|
frame: new Frame(0, 0, 0, data.width, data.height, key),
|
|
12297
12308
|
frameData: new FrameData()
|
|
12298
12309
|
};
|
|
12299
|
-
img.frameData.addFrame(new Frame(0, 0, 0, data.width, data.height,
|
|
12310
|
+
img.frameData.addFrame(new Frame(0, 0, 0, data.width, data.height, resolvedUrl));
|
|
12300
12311
|
this._cache.image[key] = img;
|
|
12301
|
-
this._resolveURL(
|
|
12312
|
+
this._resolveURL(resolvedUrl, img);
|
|
12302
12313
|
return img;
|
|
12303
12314
|
}
|
|
12304
12315
|
/**
|
|
@@ -12531,11 +12542,11 @@ var Cache = class {
|
|
|
12531
12542
|
* TBD.
|
|
12532
12543
|
* @param {string} key - TBD.
|
|
12533
12544
|
* @param {number} cache - TBD.
|
|
12534
|
-
* @param {string}
|
|
12545
|
+
* @param {string} _method - TBD.
|
|
12535
12546
|
* @param {string} property - TBD.
|
|
12536
12547
|
* @returns {*} TBD.
|
|
12537
12548
|
*/
|
|
12538
|
-
getItem(key, cache,
|
|
12549
|
+
getItem(key, cache, _method, property = null) {
|
|
12539
12550
|
if (this.checkKey(cache, key)) {
|
|
12540
12551
|
if (!property) return this._cacheMap[cache][key];
|
|
12541
12552
|
return this._cacheMap[cache][key][property];
|
|
@@ -13057,14 +13068,15 @@ const checkFullScreenSupport = (device) => {
|
|
|
13057
13068
|
"mozCancelFullScreen",
|
|
13058
13069
|
"mozExitFullscreen"
|
|
13059
13070
|
];
|
|
13060
|
-
const
|
|
13061
|
-
for (let i = 0; i < fs.length; i += 1) if (
|
|
13071
|
+
const elementApi = document.createElement("div");
|
|
13072
|
+
for (let i = 0; i < fs.length; i += 1) if (elementApi[fs[i]]) {
|
|
13062
13073
|
device.fullscreen = true;
|
|
13063
13074
|
device.requestFullscreen = fs[i];
|
|
13064
13075
|
break;
|
|
13065
13076
|
}
|
|
13066
13077
|
if (device.fullscreen) {
|
|
13067
|
-
|
|
13078
|
+
const documentApi = document;
|
|
13079
|
+
for (let i = 0; i < cfs.length; i += 1) if (documentApi[cfs[i]]) {
|
|
13068
13080
|
device.cancelFullscreen = cfs[i];
|
|
13069
13081
|
break;
|
|
13070
13082
|
}
|
|
@@ -13603,10 +13615,10 @@ var MSPointer = class {
|
|
|
13603
13615
|
canvas.removeEventListener("pointerdown", this._onMSPointerDown, false);
|
|
13604
13616
|
canvas.removeEventListener("pointermove", this._onMSPointerMove, false);
|
|
13605
13617
|
canvas.removeEventListener("pointerup", this._onMSPointerUp, false);
|
|
13606
|
-
window.removeEventListener("MSPointerUp", this._onMSPointerUpGlobal, true);
|
|
13618
|
+
if (this._onMSPointerUpGlobal) window.removeEventListener("MSPointerUp", this._onMSPointerUpGlobal, true);
|
|
13607
13619
|
canvas.removeEventListener("MSPointerOver", this._onMSPointerOver, true);
|
|
13608
13620
|
canvas.removeEventListener("MSPointerOut", this._onMSPointerOut, true);
|
|
13609
|
-
window.removeEventListener("pointerup", this._onMSPointerUpGlobal, true);
|
|
13621
|
+
if (this._onMSPointerUpGlobal) window.removeEventListener("pointerup", this._onMSPointerUpGlobal, true);
|
|
13610
13622
|
canvas.removeEventListener("pointerover", this._onMSPointerOver, true);
|
|
13611
13623
|
canvas.removeEventListener("pointerout", this._onMSPointerOut, true);
|
|
13612
13624
|
}
|
|
@@ -14934,10 +14946,12 @@ var Loader = class {
|
|
|
14934
14946
|
this.game.logger.warn(`Loader: Invalid or no key given of type ${type}`);
|
|
14935
14947
|
return this;
|
|
14936
14948
|
}
|
|
14937
|
-
if (url === void 0 || url === null)
|
|
14938
|
-
|
|
14939
|
-
|
|
14940
|
-
|
|
14949
|
+
if (url === void 0 || url === null) {
|
|
14950
|
+
if (extension) url = key + extension;
|
|
14951
|
+
else {
|
|
14952
|
+
this.game.logger.warn(`Loader: No URL given for file type: ${type} key: ${key}`);
|
|
14953
|
+
return this;
|
|
14954
|
+
}
|
|
14941
14955
|
}
|
|
14942
14956
|
const file = {
|
|
14943
14957
|
type,
|
|
@@ -14951,11 +14965,8 @@ var Loader = class {
|
|
|
14951
14965
|
error: false
|
|
14952
14966
|
};
|
|
14953
14967
|
if (properties) {
|
|
14954
|
-
const
|
|
14955
|
-
for (
|
|
14956
|
-
const prop = keys[i];
|
|
14957
|
-
file[prop] = properties[prop];
|
|
14958
|
-
}
|
|
14968
|
+
const extraProperties = properties;
|
|
14969
|
+
for (const prop of Object.keys(extraProperties)) file[prop] = extraProperties[prop];
|
|
14959
14970
|
}
|
|
14960
14971
|
const fileIndex = this.getAssetIndex(type, key);
|
|
14961
14972
|
if (overwrite && fileIndex > -1) {
|
|
@@ -15377,9 +15388,7 @@ var Loader = class {
|
|
|
15377
15388
|
case "bitmapFont":
|
|
15378
15389
|
this.bitmapFont(file.key, file.textureURL, file.fontDataURL ? file.fontDataURL : file.atlasURL, file.atlasData, file.xSpacing, file.ySpacing);
|
|
15379
15390
|
break;
|
|
15380
|
-
case "atlas":
|
|
15381
|
-
this.atlas(file.key, file.textureURL, file.atlasURL, file.atlasData, TEXTURE_ATLAS_JSON_HASH);
|
|
15382
|
-
break;
|
|
15391
|
+
case "atlas": this.atlas(file.key, file.textureURL, file.atlasURL, file.atlasData, TEXTURE_ATLAS_JSON_HASH);
|
|
15383
15392
|
}
|
|
15384
15393
|
}
|
|
15385
15394
|
}
|
|
@@ -15422,10 +15431,7 @@ var Loader = class {
|
|
|
15422
15431
|
case "xml":
|
|
15423
15432
|
this.xhrLoad(file, this.transformUrl(file.url, file), "text", this.xmlLoadComplete);
|
|
15424
15433
|
break;
|
|
15425
|
-
case "text":
|
|
15426
|
-
this.xhrLoad(file, this.transformUrl(file.url, file), "text", this.fileComplete);
|
|
15427
|
-
break;
|
|
15428
|
-
default: break;
|
|
15434
|
+
case "text": this.xhrLoad(file, this.transformUrl(file.url, file), "text", this.fileComplete);
|
|
15429
15435
|
}
|
|
15430
15436
|
}
|
|
15431
15437
|
/**
|
|
@@ -15477,13 +15483,15 @@ var Loader = class {
|
|
|
15477
15483
|
onerror = onerror || this.fileError;
|
|
15478
15484
|
xhr.onload = () => {
|
|
15479
15485
|
try {
|
|
15480
|
-
if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599)
|
|
15481
|
-
|
|
15482
|
-
|
|
15483
|
-
|
|
15484
|
-
|
|
15485
|
-
|
|
15486
|
-
|
|
15486
|
+
if (xhr.readyState === 4 && xhr.status >= 400 && xhr.status <= 599) {
|
|
15487
|
+
if (scope.isUseRetry && (!file.numRetry || file.numRetry < scope.maxRetry)) {
|
|
15488
|
+
setTimeout(() => {
|
|
15489
|
+
file.numRetry = !file.numRetry ? 1 : file.numRetry += 1;
|
|
15490
|
+
scope.xhrLoad(file, url, type, onload, onerror);
|
|
15491
|
+
}, 1e3);
|
|
15492
|
+
return null;
|
|
15493
|
+
} else return onerror.call(scope, file, xhr);
|
|
15494
|
+
}
|
|
15487
15495
|
return onload.call(scope, file, xhr);
|
|
15488
15496
|
} catch (error) {
|
|
15489
15497
|
const typedError = error instanceof Error ? error : new Error(String(error));
|
|
@@ -15608,8 +15616,6 @@ var Loader = class {
|
|
|
15608
15616
|
case "text":
|
|
15609
15617
|
file.data = xhr.responseText;
|
|
15610
15618
|
this.cache.addText(file.key, file.url, file.data);
|
|
15611
|
-
break;
|
|
15612
|
-
default: break;
|
|
15613
15619
|
}
|
|
15614
15620
|
if (loadNext) this.asyncComplete(file);
|
|
15615
15621
|
}
|
|
@@ -16232,8 +16238,10 @@ var ScaleManager = class {
|
|
|
16232
16238
|
* @param {object} config - TBD.
|
|
16233
16239
|
*/
|
|
16234
16240
|
parseConfig(config) {
|
|
16235
|
-
if (config.scaleMode !== void 0)
|
|
16236
|
-
|
|
16241
|
+
if (config.scaleMode !== void 0) {
|
|
16242
|
+
if (this._booted) this.scaleMode = config.scaleMode;
|
|
16243
|
+
else this._pendingScaleMode = config.scaleMode;
|
|
16244
|
+
}
|
|
16237
16245
|
if (config.fullScreenScaleMode !== void 0) this.fullScreenScaleMode = config.fullScreenScaleMode;
|
|
16238
16246
|
if (config.fullScreenTarget) this.fullScreenTarget = config.fullScreenTarget;
|
|
16239
16247
|
else this.fullScreenTarget = document.documentElement;
|
|
@@ -16436,8 +16444,10 @@ var ScaleManager = class {
|
|
|
16436
16444
|
this.incorrectOrientation = this.forceLandscape && !this.isLandscape || this.forcePortrait && !this.isPortrait;
|
|
16437
16445
|
const changed = previousOrientation !== this.screenOrientation;
|
|
16438
16446
|
const correctnessChanged = previouslyIncorrect !== this.incorrectOrientation;
|
|
16439
|
-
if (correctnessChanged)
|
|
16440
|
-
|
|
16447
|
+
if (correctnessChanged) {
|
|
16448
|
+
if (this.incorrectOrientation) this.enterIncorrectOrientation.dispatch();
|
|
16449
|
+
else this.leaveIncorrectOrientation.dispatch();
|
|
16450
|
+
}
|
|
16441
16451
|
if (changed || correctnessChanged) this.onOrientationChange.dispatch(this, previousOrientation, previouslyIncorrect);
|
|
16442
16452
|
return changed || correctnessChanged;
|
|
16443
16453
|
}
|
|
@@ -16474,12 +16484,13 @@ var ScaleManager = class {
|
|
|
16474
16484
|
}
|
|
16475
16485
|
if (this.incorrectOrientation) this.setMaximum();
|
|
16476
16486
|
else if (scaleMode === 0) this.setExactFit();
|
|
16477
|
-
else if (scaleMode === 2)
|
|
16478
|
-
this.
|
|
16479
|
-
|
|
16480
|
-
|
|
16481
|
-
|
|
16482
|
-
|
|
16487
|
+
else if (scaleMode === 2) {
|
|
16488
|
+
if (!this.isFullScreen && this.boundingParent && this.compatibility.canExpandParent) {
|
|
16489
|
+
this.setShowAll(true);
|
|
16490
|
+
this.resetCanvas();
|
|
16491
|
+
this.setShowAll();
|
|
16492
|
+
} else this.setShowAll();
|
|
16493
|
+
} else if (scaleMode === 1) {
|
|
16483
16494
|
this.width = this.game.width;
|
|
16484
16495
|
this.height = this.game.height;
|
|
16485
16496
|
} else if (scaleMode === 4) {
|
|
@@ -16586,8 +16597,10 @@ var ScaleManager = class {
|
|
|
16586
16597
|
this.height = Math.max(this.minHeight || 0, Math.min(this.maxHeight || this.height, this.height));
|
|
16587
16598
|
}
|
|
16588
16599
|
this.resetCanvas();
|
|
16589
|
-
if (!this.compatibility.noMargins)
|
|
16590
|
-
|
|
16600
|
+
if (!this.compatibility.noMargins) {
|
|
16601
|
+
if (this.isFullScreen && this._createdFullScreenTarget) this.alignCanvas(true, true);
|
|
16602
|
+
else this.alignCanvas(this.pageAlignHorizontally, this.pageAlignVertically);
|
|
16603
|
+
}
|
|
16591
16604
|
this.updateScalingAndBounds();
|
|
16592
16605
|
}
|
|
16593
16606
|
/**
|
|
@@ -16837,12 +16850,14 @@ var ScaleManager = class {
|
|
|
16837
16850
|
* TBD.
|
|
16838
16851
|
*/
|
|
16839
16852
|
set fullScreenScaleMode(value) {
|
|
16840
|
-
if (value !== this._fullScreenScaleMode)
|
|
16841
|
-
this.
|
|
16842
|
-
|
|
16843
|
-
|
|
16844
|
-
|
|
16845
|
-
|
|
16853
|
+
if (value !== this._fullScreenScaleMode) {
|
|
16854
|
+
if (this.isFullScreen) {
|
|
16855
|
+
this.prepScreenMode(false);
|
|
16856
|
+
this._fullScreenScaleMode = value;
|
|
16857
|
+
this.prepScreenMode(true);
|
|
16858
|
+
this.queueUpdate(true);
|
|
16859
|
+
} else this._fullScreenScaleMode = value;
|
|
16860
|
+
}
|
|
16846
16861
|
}
|
|
16847
16862
|
/**
|
|
16848
16863
|
* TBD.
|
|
@@ -16935,10 +16950,10 @@ var Scene = class {
|
|
|
16935
16950
|
update() {}
|
|
16936
16951
|
/**
|
|
16937
16952
|
* Handle scene resize.
|
|
16938
|
-
* @param {number}
|
|
16939
|
-
* @param {number}
|
|
16953
|
+
* @param {number} _width - The new width of the scene.
|
|
16954
|
+
* @param {number} _height - The new height of the scene.
|
|
16940
16955
|
*/
|
|
16941
|
-
resize(
|
|
16956
|
+
resize(_width, _height) {}
|
|
16942
16957
|
/**
|
|
16943
16958
|
* Update the scene while paused.
|
|
16944
16959
|
* This method is called every frame while the scene is paused.
|
|
@@ -17014,8 +17029,10 @@ var SceneManager = class {
|
|
|
17014
17029
|
newState.game = this.game;
|
|
17015
17030
|
} else if (typeof state === "function") newState = new state(this.game);
|
|
17016
17031
|
this.states[key] = newState;
|
|
17017
|
-
if (autoStart)
|
|
17018
|
-
|
|
17032
|
+
if (autoStart) {
|
|
17033
|
+
if (this.game.isBooted) this.start(key);
|
|
17034
|
+
else this._pendingState = key;
|
|
17035
|
+
}
|
|
17019
17036
|
return newState;
|
|
17020
17037
|
}
|
|
17021
17038
|
/**
|
|
@@ -17283,7 +17300,6 @@ var Sound = class {
|
|
|
17283
17300
|
this.key = key;
|
|
17284
17301
|
this.loop = loop;
|
|
17285
17302
|
this.markers = {};
|
|
17286
|
-
this.context = null;
|
|
17287
17303
|
this.autoplay = false;
|
|
17288
17304
|
this.totalDuration = 0;
|
|
17289
17305
|
this.startTime = 0;
|
|
@@ -17303,20 +17319,14 @@ var Sound = class {
|
|
|
17303
17319
|
this.allowMultiple = false;
|
|
17304
17320
|
/** @type {GainNode} */
|
|
17305
17321
|
this.externalNode = null;
|
|
17306
|
-
/** @type {GainNode} */
|
|
17307
|
-
this.masterGainNode = null;
|
|
17308
|
-
/** @type {GainNode} */
|
|
17309
|
-
this.gainNode = null;
|
|
17310
|
-
/** @type {AudioBufferSourceNode} */
|
|
17311
|
-
this._sound = null;
|
|
17312
17322
|
this._markedToDelete = false;
|
|
17313
17323
|
this._removeFromSoundManager = false;
|
|
17314
17324
|
this.context = this.game.sound.context;
|
|
17315
17325
|
this.masterGainNode = this.game.sound.masterGain;
|
|
17316
|
-
|
|
17317
|
-
|
|
17318
|
-
|
|
17319
|
-
if (connect
|
|
17326
|
+
const gainNode = this.context.createGain === void 0 ? this.context.createGainNode() : this.context.createGain();
|
|
17327
|
+
this.gainNode = gainNode;
|
|
17328
|
+
gainNode.gain.value = volume * this.game.sound.volume;
|
|
17329
|
+
if (connect && this.masterGainNode) gainNode.connect(this.masterGainNode);
|
|
17320
17330
|
this.onPlay = new Signal();
|
|
17321
17331
|
this.onPause = new Signal();
|
|
17322
17332
|
this.onResume = new Signal();
|
|
@@ -17458,24 +17468,25 @@ var Sound = class {
|
|
|
17458
17468
|
this.isPlaying = false;
|
|
17459
17469
|
}
|
|
17460
17470
|
if (marker === "" && Object.keys(this.markers).length > 0) return this;
|
|
17461
|
-
if (marker !== "")
|
|
17462
|
-
this.
|
|
17463
|
-
|
|
17464
|
-
|
|
17465
|
-
|
|
17466
|
-
|
|
17467
|
-
|
|
17468
|
-
|
|
17469
|
-
|
|
17470
|
-
|
|
17471
|
-
|
|
17472
|
-
|
|
17473
|
-
|
|
17471
|
+
if (marker !== "") {
|
|
17472
|
+
if (this.markers[marker]) {
|
|
17473
|
+
this.currentMarker = marker;
|
|
17474
|
+
this.position = this.markers[marker].start;
|
|
17475
|
+
this.volume = this.markers[marker].volume;
|
|
17476
|
+
this.loop = this.markers[marker].loop;
|
|
17477
|
+
this.duration = this.markers[marker].duration;
|
|
17478
|
+
this.durationMS = this.markers[marker].durationMS;
|
|
17479
|
+
if (volume !== void 0) this.volume = volume;
|
|
17480
|
+
if (loop !== void 0) this.loop = loop;
|
|
17481
|
+
this._tempMarker = marker;
|
|
17482
|
+
this._tempPosition = this.position;
|
|
17483
|
+
this._tempVolume = this.volume;
|
|
17484
|
+
this._tempLoop = this.loop;
|
|
17485
|
+
} else {
|
|
17486
|
+
this.game.logger.warn(`Sound.play: audio marker ${marker} does not exist`);
|
|
17487
|
+
return this;
|
|
17488
|
+
}
|
|
17474
17489
|
} else {
|
|
17475
|
-
this.game.logger.warn(`Sound.play: audio marker ${marker} does not exist`);
|
|
17476
|
-
return this;
|
|
17477
|
-
}
|
|
17478
|
-
else {
|
|
17479
17490
|
position = position || 0;
|
|
17480
17491
|
if (volume === void 0) volume = this._volume;
|
|
17481
17492
|
if (loop === void 0) ({loop} = this);
|
|
@@ -17497,7 +17508,7 @@ var Sound = class {
|
|
|
17497
17508
|
this._sound.buffer = this._buffer;
|
|
17498
17509
|
if (this.loop && marker === "") this._sound.loop = true;
|
|
17499
17510
|
if (!this.loop && marker === "") this._sound.onended = this.onEndedHandler.bind(this);
|
|
17500
|
-
this.totalDuration = this._sound.buffer
|
|
17511
|
+
this.totalDuration = this._sound.buffer?.duration ?? 0;
|
|
17501
17512
|
if (this.duration === 0) {
|
|
17502
17513
|
this.duration = this.totalDuration;
|
|
17503
17514
|
this.durationMS = Math.ceil(this.totalDuration * 1e3);
|
|
@@ -17823,7 +17834,7 @@ var SoundManager = class {
|
|
|
17823
17834
|
this.game.logger.exception("SoundManager", typedError);
|
|
17824
17835
|
}
|
|
17825
17836
|
if (!this.context) {
|
|
17826
|
-
this.game.logger.exception("SoundManager", new Error(ENGINE_ERROR_CREATING_AUDIO_CONTEXT));
|
|
17837
|
+
this.game.logger.exception("SoundManager", /* @__PURE__ */ new Error(ENGINE_ERROR_CREATING_AUDIO_CONTEXT));
|
|
17827
17838
|
setAudioDisabledState();
|
|
17828
17839
|
return;
|
|
17829
17840
|
}
|
|
@@ -19047,9 +19058,10 @@ var TweenData = class {
|
|
|
19047
19058
|
* @returns {number} The tween status (TWEEN_PENDING, TWEEN_RUNNING, or TWEEN_COMPLETE).
|
|
19048
19059
|
*/
|
|
19049
19060
|
update(time) {
|
|
19050
|
-
if (!this.isRunning)
|
|
19051
|
-
|
|
19052
|
-
|
|
19061
|
+
if (!this.isRunning) {
|
|
19062
|
+
if (time >= this.startTime) this.isRunning = true;
|
|
19063
|
+
else return 0;
|
|
19064
|
+
} else if (time < this.startTime) return 1;
|
|
19053
19065
|
const ms = this.game.time.elapsedMS;
|
|
19054
19066
|
if (this.parent.reverse) {
|
|
19055
19067
|
this.dt -= ms * this.parent.timeScale;
|
|
@@ -19277,7 +19289,8 @@ var Tween = class {
|
|
|
19277
19289
|
const keys = Object.keys(this.timeline[i].vEnd);
|
|
19278
19290
|
for (let k = 0; k < keys.length; k += 1) {
|
|
19279
19291
|
const property = keys[k];
|
|
19280
|
-
|
|
19292
|
+
const targetProperties = this.target;
|
|
19293
|
+
this.properties[property] = targetProperties[property] || 0;
|
|
19281
19294
|
if (!Array.isArray(this.properties[property])) this.properties[property] *= 1;
|
|
19282
19295
|
}
|
|
19283
19296
|
}
|
|
@@ -19315,7 +19328,7 @@ var Tween = class {
|
|
|
19315
19328
|
*/
|
|
19316
19329
|
updateTweenData(property, value, index = 0) {
|
|
19317
19330
|
if (this.timeline.length === 0) return this;
|
|
19318
|
-
if (index === -1) for (
|
|
19331
|
+
if (index === -1) for (const timelineEntry of this.timeline) timelineEntry[property] = value;
|
|
19319
19332
|
else this.timeline[index][property] = value;
|
|
19320
19333
|
return this;
|
|
19321
19334
|
}
|
|
@@ -19536,7 +19549,8 @@ var Tween = class {
|
|
|
19536
19549
|
const keys = Object.keys(this.timeline[i].vEnd);
|
|
19537
19550
|
for (let k = 0; k < keys.length; k += 1) {
|
|
19538
19551
|
const property = keys[k];
|
|
19539
|
-
|
|
19552
|
+
const targetProperties = this.target;
|
|
19553
|
+
this.properties[property] = targetProperties[property] || 0;
|
|
19540
19554
|
if (!Array.isArray(this.properties[property])) this.properties[property] *= 1;
|
|
19541
19555
|
}
|
|
19542
19556
|
}
|
|
@@ -19804,8 +19818,7 @@ const ElasticInOut = (k) => {
|
|
|
19804
19818
|
* @returns {number} TBD.
|
|
19805
19819
|
*/
|
|
19806
19820
|
const BackIn = (k) => {
|
|
19807
|
-
|
|
19808
|
-
return k * k * ((s + 1) * k - s);
|
|
19821
|
+
return k * k * (2.70158 * k - 1.70158);
|
|
19809
19822
|
};
|
|
19810
19823
|
/**
|
|
19811
19824
|
* TBD.
|
|
@@ -19813,8 +19826,7 @@ const BackIn = (k) => {
|
|
|
19813
19826
|
* @returns {number} TBD.
|
|
19814
19827
|
*/
|
|
19815
19828
|
const BackOut = (k) => {
|
|
19816
|
-
|
|
19817
|
-
return --k * k * ((s + 1) * k + s) + 1;
|
|
19829
|
+
return --k * k * (2.70158 * k + 1.70158) + 1;
|
|
19818
19830
|
};
|
|
19819
19831
|
/**
|
|
19820
19832
|
* TBD.
|
|
@@ -19822,9 +19834,9 @@ const BackOut = (k) => {
|
|
|
19822
19834
|
* @returns {number} TBD.
|
|
19823
19835
|
*/
|
|
19824
19836
|
const BackInOut = (k) => {
|
|
19825
|
-
const s =
|
|
19826
|
-
if ((k *= 2) < 1) return .5 * (k * k * (
|
|
19827
|
-
return .5 * ((k -= 2) * k * (
|
|
19837
|
+
const s = 2.5949095;
|
|
19838
|
+
if ((k *= 2) < 1) return .5 * (k * k * (3.5949095 * k - s));
|
|
19839
|
+
return .5 * ((k -= 2) * k * (3.5949095 * k + s) + 2);
|
|
19828
19840
|
};
|
|
19829
19841
|
/**
|
|
19830
19842
|
* TBD.
|
|
@@ -20111,27 +20123,9 @@ var Game = class {
|
|
|
20111
20123
|
this.parent = "";
|
|
20112
20124
|
this.width = 800;
|
|
20113
20125
|
this.height = 600;
|
|
20114
|
-
this.renderer = null;
|
|
20115
|
-
this.state = null;
|
|
20116
20126
|
this.isBooted = false;
|
|
20117
20127
|
this.paused = false;
|
|
20118
|
-
this.raf = null;
|
|
20119
|
-
this.add = null;
|
|
20120
|
-
this.cache = null;
|
|
20121
|
-
this.input = null;
|
|
20122
|
-
this.load = null;
|
|
20123
|
-
this.scale = null;
|
|
20124
|
-
this.sound = null;
|
|
20125
|
-
this.stage = null;
|
|
20126
|
-
this.time = null;
|
|
20127
|
-
this.tweens = null;
|
|
20128
|
-
this.world = null;
|
|
20129
20128
|
this.device = new Device();
|
|
20130
|
-
/** @type {Logger} */
|
|
20131
|
-
this.logger = null;
|
|
20132
|
-
/** @type {HTMLCanvasElement} */
|
|
20133
|
-
this.canvas = null;
|
|
20134
|
-
/** @type {CanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext} */
|
|
20135
20129
|
this.context = null;
|
|
20136
20130
|
this.onPause = new Signal();
|
|
20137
20131
|
this.onResume = new Signal();
|
|
@@ -20187,9 +20181,9 @@ var Game = class {
|
|
|
20187
20181
|
if (this.config.canvas) this.canvas = this.config.canvas;
|
|
20188
20182
|
else this.canvas = create(this, this.width, this.height, this.config.canvasID, true);
|
|
20189
20183
|
if (this.config.canvasStyle) {
|
|
20190
|
-
const
|
|
20191
|
-
for (const property of
|
|
20192
|
-
} else this.canvas.style
|
|
20184
|
+
const canvasStyle = this.config.canvasStyle;
|
|
20185
|
+
for (const property of Object.keys(canvasStyle)) this.canvas.style.setProperty(property, canvasStyle[property]);
|
|
20186
|
+
} else this.canvas.style.setProperty("-webkit-full-screen", "width: 100%; height: 100%");
|
|
20193
20187
|
}
|
|
20194
20188
|
/**
|
|
20195
20189
|
* Initializes the renderer and sets up the rendering context.
|
|
@@ -20701,6 +20695,6 @@ var Line = class {
|
|
|
20701
20695
|
}
|
|
20702
20696
|
};
|
|
20703
20697
|
//#endregion
|
|
20704
|
-
export { Animation, AnimationManager, BaseTexture, BitmapText, Button, Circle, const_exports as Const, DisplayObject, ENGINE_ERROR_CANNOT_SET_FRAME, ENGINE_ERROR_CANNOT_SET_FRAME_NAME, ENGINE_ERROR_CREATING_AUDIO_CONTEXT, ENGINE_ERROR_CREATING_CANVAS_2D_CONTEXT, ENGINE_ERROR_CREATING_WEBGL_CONTEXT, ENGINE_ERROR_GETTING_DOCUMENT, ENGINE_ERROR_INVALID_BITMAP_FONT_ATLAS, ENGINE_ERROR_WEBGL_CONTEXT_LOST, Ellipse, Game, GameObjectFactory, Graphics, Group, Image$1 as Image, Line, math_exports as MathUtils, Matrix, Point, Polygon, Rectangle, RoundedRectangle, ScaleManager, Scene, SceneManager, Signal, Sound, SoundManager, SoundSprite, Text, Texture, Time, Timer, TimerEvent, Tween, TweenData, TweenManager };
|
|
20698
|
+
export { Animation, AnimationManager, BaseTexture, BitmapText, Button, Cache, Circle, const_exports as Const, DisplayObject, ENGINE_ERROR_CANNOT_SET_FRAME, ENGINE_ERROR_CANNOT_SET_FRAME_NAME, ENGINE_ERROR_CREATING_AUDIO_CONTEXT, ENGINE_ERROR_CREATING_CANVAS_2D_CONTEXT, ENGINE_ERROR_CREATING_WEBGL_CONTEXT, ENGINE_ERROR_GETTING_DOCUMENT, ENGINE_ERROR_INVALID_BITMAP_FONT_ATLAS, ENGINE_ERROR_WEBGL_CONTEXT_LOST, Ellipse, Game, GameObjectFactory, Graphics, Group, Image$1 as Image, Input, Line, Loader, math_exports as MathUtils, Matrix, Point, Pointer, Polygon, Rectangle, RoundedRectangle, ScaleManager, Scene, SceneManager, Signal, Sound, SoundManager, SoundSprite, Text, Texture, Time, Timer, TimerEvent, Tween, TweenData, TweenManager };
|
|
20705
20699
|
|
|
20706
20700
|
//# sourceMappingURL=index.js.map
|