@duyquangnvx/pixi-game-engine 0.1.1 → 0.1.2
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.cjs +28 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -695,6 +695,14 @@ declare class Engine {
|
|
|
695
695
|
}>;
|
|
696
696
|
/** Signal emitted when engine is updated */
|
|
697
697
|
static readonly onUpdate: Signal<number>;
|
|
698
|
+
/** Signal emitted at the end of init() after all managers are constructed */
|
|
699
|
+
static readonly onReady: Signal<void>;
|
|
700
|
+
/** Signal emitted at the start of destroy() before any teardown */
|
|
701
|
+
static readonly onDestroy: Signal<void>;
|
|
702
|
+
/** Signal emitted when browser tab visibility changes (true = visible, false = hidden) */
|
|
703
|
+
static readonly onVisibilityChange: Signal<boolean>;
|
|
704
|
+
/** Signal emitted when browser window gains/loses focus (true = focused, false = blurred) */
|
|
705
|
+
static readonly onFocusChange: Signal<boolean>;
|
|
698
706
|
/** Design resolution width (original config width) */
|
|
699
707
|
private static _designWidth;
|
|
700
708
|
/** Design resolution height (original config height) */
|
|
@@ -705,6 +713,9 @@ declare class Engine {
|
|
|
705
713
|
private static _scale;
|
|
706
714
|
private static _isRunning;
|
|
707
715
|
private static _resizeHandler;
|
|
716
|
+
private static _visibilityHandler;
|
|
717
|
+
private static _focusHandler;
|
|
718
|
+
private static _blurHandler;
|
|
708
719
|
private static _initialized;
|
|
709
720
|
/** Logger instance for consistent logging across the engine */
|
|
710
721
|
static readonly logger: LoggerClass;
|
package/dist/index.d.ts
CHANGED
|
@@ -695,6 +695,14 @@ declare class Engine {
|
|
|
695
695
|
}>;
|
|
696
696
|
/** Signal emitted when engine is updated */
|
|
697
697
|
static readonly onUpdate: Signal<number>;
|
|
698
|
+
/** Signal emitted at the end of init() after all managers are constructed */
|
|
699
|
+
static readonly onReady: Signal<void>;
|
|
700
|
+
/** Signal emitted at the start of destroy() before any teardown */
|
|
701
|
+
static readonly onDestroy: Signal<void>;
|
|
702
|
+
/** Signal emitted when browser tab visibility changes (true = visible, false = hidden) */
|
|
703
|
+
static readonly onVisibilityChange: Signal<boolean>;
|
|
704
|
+
/** Signal emitted when browser window gains/loses focus (true = focused, false = blurred) */
|
|
705
|
+
static readonly onFocusChange: Signal<boolean>;
|
|
698
706
|
/** Design resolution width (original config width) */
|
|
699
707
|
private static _designWidth;
|
|
700
708
|
/** Design resolution height (original config height) */
|
|
@@ -705,6 +713,9 @@ declare class Engine {
|
|
|
705
713
|
private static _scale;
|
|
706
714
|
private static _isRunning;
|
|
707
715
|
private static _resizeHandler;
|
|
716
|
+
private static _visibilityHandler;
|
|
717
|
+
private static _focusHandler;
|
|
718
|
+
private static _blurHandler;
|
|
708
719
|
private static _initialized;
|
|
709
720
|
/** Logger instance for consistent logging across the engine */
|
|
710
721
|
static readonly logger: LoggerClass;
|
package/dist/index.js
CHANGED
|
@@ -2309,6 +2309,14 @@ var Engine = class _Engine {
|
|
|
2309
2309
|
static onResize = new Signal();
|
|
2310
2310
|
/** Signal emitted when engine is updated */
|
|
2311
2311
|
static onUpdate = new Signal();
|
|
2312
|
+
/** Signal emitted at the end of init() after all managers are constructed */
|
|
2313
|
+
static onReady = new Signal();
|
|
2314
|
+
/** Signal emitted at the start of destroy() before any teardown */
|
|
2315
|
+
static onDestroy = new Signal();
|
|
2316
|
+
/** Signal emitted when browser tab visibility changes (true = visible, false = hidden) */
|
|
2317
|
+
static onVisibilityChange = new Signal();
|
|
2318
|
+
/** Signal emitted when browser window gains/loses focus (true = focused, false = blurred) */
|
|
2319
|
+
static onFocusChange = new Signal();
|
|
2312
2320
|
/** Design resolution width (original config width) */
|
|
2313
2321
|
static _designWidth;
|
|
2314
2322
|
/** Design resolution height (original config height) */
|
|
@@ -2319,6 +2327,9 @@ var Engine = class _Engine {
|
|
|
2319
2327
|
static _scale = 1;
|
|
2320
2328
|
static _isRunning = false;
|
|
2321
2329
|
static _resizeHandler;
|
|
2330
|
+
static _visibilityHandler;
|
|
2331
|
+
static _focusHandler;
|
|
2332
|
+
static _blurHandler;
|
|
2322
2333
|
static _initialized = false;
|
|
2323
2334
|
/** Logger instance for consistent logging across the engine */
|
|
2324
2335
|
static logger = Logger;
|
|
@@ -2429,6 +2440,15 @@ var Engine = class _Engine {
|
|
|
2429
2440
|
}
|
|
2430
2441
|
_Engine._app.ticker.add(_Engine.update);
|
|
2431
2442
|
_Engine._isRunning = true;
|
|
2443
|
+
_Engine._visibilityHandler = () => {
|
|
2444
|
+
_Engine.onVisibilityChange.emit(!document.hidden);
|
|
2445
|
+
};
|
|
2446
|
+
_Engine._focusHandler = () => _Engine.onFocusChange.emit(true);
|
|
2447
|
+
_Engine._blurHandler = () => _Engine.onFocusChange.emit(false);
|
|
2448
|
+
document.addEventListener("visibilitychange", _Engine._visibilityHandler);
|
|
2449
|
+
window.addEventListener("focus", _Engine._focusHandler);
|
|
2450
|
+
window.addEventListener("blur", _Engine._blurHandler);
|
|
2451
|
+
_Engine.onReady.emit();
|
|
2432
2452
|
}
|
|
2433
2453
|
static update(delta) {
|
|
2434
2454
|
_Engine.onUpdate.emit(delta);
|
|
@@ -2504,6 +2524,10 @@ var Engine = class _Engine {
|
|
|
2504
2524
|
}
|
|
2505
2525
|
static destroy() {
|
|
2506
2526
|
if (!_Engine._initialized) return;
|
|
2527
|
+
_Engine.onDestroy.emit();
|
|
2528
|
+
document.removeEventListener("visibilitychange", _Engine._visibilityHandler);
|
|
2529
|
+
window.removeEventListener("focus", _Engine._focusHandler);
|
|
2530
|
+
window.removeEventListener("blur", _Engine._blurHandler);
|
|
2507
2531
|
window.removeEventListener("resize", _Engine._resizeHandler);
|
|
2508
2532
|
_Engine._app.ticker.remove(_Engine.update);
|
|
2509
2533
|
_Engine._input.destroy();
|
|
@@ -2517,6 +2541,10 @@ var Engine = class _Engine {
|
|
|
2517
2541
|
_Engine.onPause.clear();
|
|
2518
2542
|
_Engine.onResume.clear();
|
|
2519
2543
|
_Engine.onResize.clear();
|
|
2544
|
+
_Engine.onReady.clear();
|
|
2545
|
+
_Engine.onDestroy.clear();
|
|
2546
|
+
_Engine.onVisibilityChange.clear();
|
|
2547
|
+
_Engine.onFocusChange.clear();
|
|
2520
2548
|
_Engine._app.destroy(true, { children: true, texture: true });
|
|
2521
2549
|
_Engine._isRunning = false;
|
|
2522
2550
|
_Engine._initialized = false;
|