summaryrefslogtreecommitdiff
path: root/client/src/components/GameCanvas.svelte
blob: d7abecfa0dc850ee0eb551fc17eb87c350a368ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<script lang="ts">
  import { onMount } from "svelte";
  import { loadAssets } from "@engine/config";
  import { JumpStorm} from "../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} />