Skip to content

Commit

Permalink
create scenes after pixi renderer is initialized
Browse files Browse the repository at this point in the history
  • Loading branch information
RoryDuncan committed Oct 30, 2024
1 parent 6a57249 commit 3e9a550
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/lib/core/scene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ const { promise, resolve } = Promise.withResolvers<void>();

export const Scenes: SceneManager = {
init: async () => {
console.log("Initializing Scenes");
initialized_scenes.clear();
resolve();
},
Expand All @@ -102,6 +103,7 @@ export const Scenes: SceneManager = {
create: async (scene_init) => {
await promise;
const scene: Scene = await scene_init();
console.log("Created scene:", scene.name);
return scene;
},

Expand Down
3 changes: 2 additions & 1 deletion src/lib/ui/Game.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
import { createEventDispatcher } from "svelte";
import { initialize } from "$lib/core/index.js";
import type { Scene } from "@ancient-cat/foolish";
import { Scenes, type Scene } from "$lib/core/scene.js";
let scene: Scene;
const dispatch = createEventDispatcher();
async function start(e: CustomEvent<HTMLElement>) {
await initialize(e.detail);
Scenes.init();
dispatch("start");
}
</script>
Expand Down
3 changes: 2 additions & 1 deletion src/routes/+layout.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const prerender = true;
export const prerender = false;
export const ssr = false;

0 comments on commit 3e9a550

Please sign in to comment.