summaryrefslogtreecommitdiff
path: root/client/src/components
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-23 19:44:59 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-08-23 19:44:59 -0600
commitdec7b614d895a1b507137e4a96a8999ff63aa179 (patch)
tree827437755bf9674db51818ee59d919c74a4ea2fc /client/src/components
parentd64ffb5016119e54f0e20d05ae8ac9c96955d9d5 (diff)
downloadjumpstorm-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.svelte17
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>