summaryrefslogtreecommitdiff
path: root/client/src/components/GameCanvas.svelte
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-07-19 20:38:24 -0700
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2023-07-19 20:38:24 -0700
commit0fd9fb097552686f2257c1aa689d797e80057bd1 (patch)
treeb8d0367bf7b62c049af60ace301ce1cffc08d821 /client/src/components/GameCanvas.svelte
downloadjumpstorm-0fd9fb097552686f2257c1aa689d797e80057bd1.tar.gz
jumpstorm-0fd9fb097552686f2257c1aa689d797e80057bd1.zip
initial commit
Diffstat (limited to 'client/src/components/GameCanvas.svelte')
-rw-r--r--client/src/components/GameCanvas.svelte28
1 files changed, 28 insertions, 0 deletions
diff --git a/client/src/components/GameCanvas.svelte b/client/src/components/GameCanvas.svelte
new file mode 100644
index 0000000..766a08a
--- /dev/null
+++ b/client/src/components/GameCanvas.svelte
@@ -0,0 +1,28 @@
+<script lang="ts">
+ import { onMount } from "svelte";
+ import { Game } from "../../lib/Game";
+ import { Render } from "../../lib/systems";
+ import { Floor } from "../../lib/entities";
+ import { loadAssets } from "../../lib/config";
+ import { JumpStorm } from "../../lib/JumpStorm";
+
+ let canvas: HTMLCanvasElement;
+ let ctx: CanvasRenderingContext2D;
+
+ export let width: number;
+ export let height: number;
+
+ let jumpStorm: JumpStorm;
+
+ onMount(() => {
+ ctx = canvas.getContext("2d");
+ ctx.imageSmoothingEnabled = false;
+
+ loadAssets().then(() => {
+ jumpStorm = new JumpStorm(ctx);
+ jumpStorm.play();
+ });
+ });
+</script>
+
+<canvas bind:this={canvas} {width} {height} />