summaryrefslogtreecommitdiff
path: root/client/src/components/GameCanvas.svelte
diff options
context:
space:
mode:
authorElizabeth (Lizzy) Hunt <elizabeth.hunt@simponic.xyz>2023-08-26 17:57:05 -0600
committerGitHub <noreply@github.com>2023-08-26 17:57:05 -0600
commit8a4ab8d79b5ce1dabb431168398b5d5111fe326c (patch)
treee60767dc5295edf379cf421e20171dc418e548b7 /client/src/components/GameCanvas.svelte
parentc6e9baa0009f7cce0f6ff156a3957ef04a8cb684 (diff)
parent6ce6946a4401d2ee6fa5cb747fab7d4c658a63c8 (diff)
downloadjumpstorm-8a4ab8d79b5ce1dabb431168398b5d5111fe326c.tar.gz
jumpstorm-8a4ab8d79b5ce1dabb431168398b5d5111fe326c.zip
Merge pull request #1 from Simponic/network
Network
Diffstat (limited to 'client/src/components/GameCanvas.svelte')
-rw-r--r--client/src/components/GameCanvas.svelte18
1 files changed, 10 insertions, 8 deletions
diff --git a/client/src/components/GameCanvas.svelte b/client/src/components/GameCanvas.svelte
index ae8c1b0..ea7dd15 100644
--- a/client/src/components/GameCanvas.svelte
+++ b/client/src/components/GameCanvas.svelte
@@ -1,24 +1,26 @@
<script lang="ts">
import { onMount } from "svelte";
import { loadAssets } from "@engine/config";
+ import { Game } from "@engine/Game";
import { JumpStorm } from "../JumpStorm";
-
+
let canvas: HTMLCanvasElement;
let ctx: CanvasRenderingContext2D;
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);
+
+ await jumpStorm.init(ctx, "http", "ws", document.location.host + "/api");
+ jumpStorm.play();
});
</script>