You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
import { Orientation } from "./enums/Orientation";
|
|
import { initApp, game, sceneManager, assetManager } from "./init";
|
|
import { appRuntime } from "./kernel/AppRuntime";
|
|
import { DebugOverlay } from "./devtools/overlay/DebugOverlay";
|
|
|
|
type DevtoolsWindow = Window & {
|
|
__PIXIDEMO_DEBUG_OVERLAY__?: DebugOverlay;
|
|
};
|
|
|
|
void (async () => {
|
|
try {
|
|
await initApp();
|
|
game.setOrientation(Orientation.Portrait);
|
|
} catch (e) {
|
|
console.error("initApp failed", e);
|
|
}
|
|
})();
|
|
|
|
if (import.meta.env.DEV) {
|
|
const devWindow = window as DevtoolsWindow;
|
|
devWindow.__PIXIDEMO_DEBUG_OVERLAY__?.dispose();
|
|
|
|
(window as unknown as { game: typeof game; sceneManager: typeof sceneManager }).game = game;
|
|
(window as unknown as { game: typeof game; sceneManager: typeof sceneManager }).sceneManager =
|
|
sceneManager;
|
|
devWindow.__PIXIDEMO_DEBUG_OVERLAY__ = new DebugOverlay({
|
|
sceneManager: appRuntime.sceneManager,
|
|
assetManager,
|
|
events: appRuntime.events,
|
|
});
|
|
|
|
import.meta.hot?.dispose(() => {
|
|
devWindow.__PIXIDEMO_DEBUG_OVERLAY__?.dispose();
|
|
delete devWindow.__PIXIDEMO_DEBUG_OVERLAY__;
|
|
});
|
|
}
|
|
|