This commit is contained in:
kolaflash
2025-11-25 19:32:27 +01:00
commit 104f0998e1
36 changed files with 1274 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
import { currentScene, loadScene } from "#/engine/Scene.ts";
import {
initViewport,
resetCtx,
resizeCanvas,
viewport,
} from "#/engine/Viewport.ts";
let then = self.performance.now();
let delta = 0;
function animate(timestamp: number): void {
delta = timestamp - then;
then = timestamp;
resetCtx();
currentScene.process(viewport.ctx, delta);
requestAnimationFrame(animate);
}
(async () => {
if (import.meta.env.DEV) {
import("#/tools/main.tsx").then((m) => m.use(viewport.gameContainer));
}
initViewport();
await loadScene("testScene");
resizeCanvas(currentScene.data.width, currentScene.data.height);
self.addEventListener("resize", () => {
resizeCanvas(currentScene.data.width, currentScene.data.height);
});
animate(delta);
})();