diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-08-23 19:44:59 -0600 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-08-23 19:44:59 -0600 |
commit | dec7b614d895a1b507137e4a96a8999ff63aa179 (patch) | |
tree | 827437755bf9674db51818ee59d919c74a4ea2fc /client/src/components | |
parent | d64ffb5016119e54f0e20d05ae8ac9c96955d9d5 (diff) | |
download | jumpstorm-dec7b614d895a1b507137e4a96a8999ff63aa179.tar.gz jumpstorm-dec7b614d895a1b507137e4a96a8999ff63aa179.zip |
holy fuck we actually got somewhere
Diffstat (limited to 'client/src/components')
-rw-r--r-- | client/src/components/GameCanvas.svelte | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/client/src/components/GameCanvas.svelte b/client/src/components/GameCanvas.svelte index ae8c1b0..ed16f33 100644 --- a/client/src/components/GameCanvas.svelte +++ b/client/src/components/GameCanvas.svelte @@ -1,6 +1,7 @@ <script lang="ts"> import { onMount } from "svelte"; import { loadAssets } from "@engine/config"; + import { Game } from "@engine/Game"; import { JumpStorm } from "../JumpStorm"; let canvas: HTMLCanvasElement; @@ -9,16 +10,18 @@ export let width: number; export let height: number; - let jumpStorm: JumpStorm; - - onMount(() => { + onMount(async () => { ctx = canvas.getContext("2d"); ctx.imageSmoothingEnabled = false; - loadAssets().then(() => { - jumpStorm = new JumpStorm(ctx); - jumpStorm.play(); - }); + await loadAssets(); + + const game = new Game(); + const jumpStorm = new JumpStorm(game); + + const url = new URL(document.location); + await jumpStorm.init(ctx, "http", "ws", url.host + "/api"); + jumpStorm.play(); }); </script> |