@combos-fun/engine 0.1.22 → 0.1.23
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/engine.cjs.js +49 -7
- package/dist/engine.cjs.js.map +1 -1
- package/dist/engine.cjs.prod.js +1 -1
- package/dist/engine.d.ts +34 -5
- package/dist/engine.esm.js +48 -8
- package/dist/engine.esm.js.map +1 -1
- package/package.json +3 -3
package/dist/engine.cjs.js
CHANGED
|
@@ -891,7 +891,7 @@ class Scene extends GameObject {
|
|
|
891
891
|
}
|
|
892
892
|
|
|
893
893
|
/** Generated at build from package.json */
|
|
894
|
-
const version = "0.1.
|
|
894
|
+
const version = "0.1.23";
|
|
895
895
|
|
|
896
896
|
/**
|
|
897
897
|
* Sent after each `System.init` completes during `Game.addSystem`.
|
|
@@ -2458,25 +2458,25 @@ const ADAPTIVE_SLOW_FRAME_COUNT = 30;
|
|
|
2458
2458
|
const ADAPTIVE_FAST_FRAME_COUNT = 120;
|
|
2459
2459
|
const ADAPTIVE_STEP = 0.5;
|
|
2460
2460
|
const MIN_PIXEL_RATIO = 1;
|
|
2461
|
-
function isPositive(value) {
|
|
2461
|
+
function isPositive$1(value) {
|
|
2462
2462
|
return typeof value === 'number' && Number.isFinite(value) && value > 0;
|
|
2463
2463
|
}
|
|
2464
2464
|
function roundToHalf(value) {
|
|
2465
2465
|
return Math.round(value * 2) / 2;
|
|
2466
2466
|
}
|
|
2467
2467
|
function readDevicePixelRatio(devicePixelRatio) {
|
|
2468
|
-
if (isPositive(devicePixelRatio))
|
|
2468
|
+
if (isPositive$1(devicePixelRatio))
|
|
2469
2469
|
return devicePixelRatio;
|
|
2470
|
-
if (typeof window !== 'undefined' && isPositive(window.devicePixelRatio)) {
|
|
2470
|
+
if (typeof window !== 'undefined' && isPositive$1(window.devicePixelRatio)) {
|
|
2471
2471
|
return window.devicePixelRatio;
|
|
2472
2472
|
}
|
|
2473
2473
|
return 1;
|
|
2474
2474
|
}
|
|
2475
2475
|
function resolveRenderQuality(input = {}, defaults = {}) {
|
|
2476
|
-
const maxPixelRatio = isPositive(input.maxPixelRatio) ? input.maxPixelRatio : DEFAULT_MAX_PIXEL_RATIO;
|
|
2477
|
-
const explicit = isPositive(input.resolution)
|
|
2476
|
+
const maxPixelRatio = isPositive$1(input.maxPixelRatio) ? input.maxPixelRatio : DEFAULT_MAX_PIXEL_RATIO;
|
|
2477
|
+
const explicit = isPositive$1(input.resolution)
|
|
2478
2478
|
? input.resolution
|
|
2479
|
-
: isPositive(input.pixelRatio)
|
|
2479
|
+
: isPositive$1(input.pixelRatio)
|
|
2480
2480
|
? input.pixelRatio
|
|
2481
2481
|
: undefined;
|
|
2482
2482
|
const devicePixelRatio = readDevicePixelRatio(input.devicePixelRatio ?? defaults.devicePixelRatio);
|
|
@@ -2551,6 +2551,46 @@ class AdaptivePixelRatio {
|
|
|
2551
2551
|
}
|
|
2552
2552
|
}
|
|
2553
2553
|
|
|
2554
|
+
function isPositive(value) {
|
|
2555
|
+
return typeof value === 'number' && Number.isFinite(value) && value > 0;
|
|
2556
|
+
}
|
|
2557
|
+
/** Backing store for the canvas box, using the caller-supplied pixel ratio. */
|
|
2558
|
+
function displayBufferSize(box, resolution) {
|
|
2559
|
+
if (!isPositive(box.width) || !isPositive(box.height) || !isPositive(resolution))
|
|
2560
|
+
return null;
|
|
2561
|
+
if (box.width < 1 || box.height < 1)
|
|
2562
|
+
return null;
|
|
2563
|
+
const bufferWidth = Math.round(box.width * resolution);
|
|
2564
|
+
const bufferHeight = Math.round(box.height * resolution);
|
|
2565
|
+
if (bufferWidth < 1 || bufferHeight < 1)
|
|
2566
|
+
return null;
|
|
2567
|
+
return { bufferWidth, bufferHeight };
|
|
2568
|
+
}
|
|
2569
|
+
/**
|
|
2570
|
+
* Unity orthographic camera: vertical extent stays `height`, the view stays
|
|
2571
|
+
* centered on `(width / 2, height / 2)`, and the horizontal extent follows the
|
|
2572
|
+
* backing-store aspect.
|
|
2573
|
+
*/
|
|
2574
|
+
function fitOrthographicDisplay(input) {
|
|
2575
|
+
if (!isPositive(input.width) || !isPositive(input.height))
|
|
2576
|
+
return null;
|
|
2577
|
+
const buffer = displayBufferSize(input.box, input.resolution);
|
|
2578
|
+
if (!buffer)
|
|
2579
|
+
return null;
|
|
2580
|
+
const visibleHeight = input.height;
|
|
2581
|
+
const pixelRatio = buffer.bufferHeight / visibleHeight;
|
|
2582
|
+
const visibleWidth = buffer.bufferWidth / pixelRatio;
|
|
2583
|
+
return {
|
|
2584
|
+
bufferWidth: buffer.bufferWidth,
|
|
2585
|
+
bufferHeight: buffer.bufferHeight,
|
|
2586
|
+
visibleWidth,
|
|
2587
|
+
visibleHeight,
|
|
2588
|
+
pixelRatio,
|
|
2589
|
+
originX: input.width / 2 - visibleWidth / 2,
|
|
2590
|
+
originY: 0,
|
|
2591
|
+
};
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2554
2594
|
/** Decorators util */
|
|
2555
2595
|
const decorators = {
|
|
2556
2596
|
IDEProp,
|
|
@@ -2577,6 +2617,8 @@ exports.applyCompressedImagePreference = applyCompressedImagePreference;
|
|
|
2577
2617
|
exports.componentObserver = componentObserver;
|
|
2578
2618
|
exports.compressedTextureUrl = compressedTextureUrl;
|
|
2579
2619
|
exports.decorators = decorators;
|
|
2620
|
+
exports.displayBufferSize = displayBufferSize;
|
|
2621
|
+
exports.fitOrthographicDisplay = fitOrthographicDisplay;
|
|
2580
2622
|
exports.gpuSupportsCompressedTexture = gpuSupportsCompressedTexture;
|
|
2581
2623
|
exports.imageFallbackUrl = imageFallbackUrl;
|
|
2582
2624
|
exports.isAllowedMessageOrigin = isAllowedMessageOrigin;
|