From 619a039942c3c02552f72275634a9f6c0788c570 Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Thu, 20 Jul 2023 22:22:26 -0700 Subject: very basic websocket setup --- client/src/JumpStorm.ts | 7 +++++++ client/src/routes/Home.svelte | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'client/src') diff --git a/client/src/JumpStorm.ts b/client/src/JumpStorm.ts index 45ea163..d1d1013 100644 --- a/client/src/JumpStorm.ts +++ b/client/src/JumpStorm.ts @@ -11,9 +11,16 @@ import { export class JumpStorm { private game: Game; + private socket: WebSocket; constructor(ctx: CanvasRenderingContext2D) { this.game = new Game(); + this.socket = new WebSocket("ws://localhost:8080"); + + this.socket.onopen = () => { + this.socket.send("gaming"); + console.log("OPENED SOCKET"); + }; [ this.createInputSystem(), diff --git a/client/src/routes/Home.svelte b/client/src/routes/Home.svelte index 935ed69..9ada10e 100644 --- a/client/src/routes/Home.svelte +++ b/client/src/routes/Home.svelte @@ -2,8 +2,11 @@ import GameCanvas from "../components/GameCanvas.svelte"; import LeaderBoard from "../components/LeaderBoard.svelte"; - let width: number = 600; - let height: number = 800; + import { Miscellaneous } from "@engine/config"; + + let width: number = Miscellaneous.WIDTH; + let height: number = Miscellaneous.HEIGHT; +
-- cgit v1.2.3-70-g09d2