diff --git a/src/applet/Init.ts b/src/applet/Init.ts index 1c9bfe1..fc9395e 100644 --- a/src/applet/Init.ts +++ b/src/applet/Init.ts @@ -17,7 +17,7 @@ class Selection { /** * Run a callback for selected canvases, with a 2d context & KeyControl established for use. */ - public forEachCanvas(callback: (canvas: HTMLCanvasElement, cx: CanvasRenderingContext2D, keys: KeyControl) => {}, tabIndex = -1) { + public forEachCanvas(callback: (canvas: HTMLCanvasElement, cx: CanvasRenderingContext2D, keys: KeyControl) => void, tabIndex = -1) { this.elements.forEach(e => { if(e instanceof HTMLCanvasElement) { const cx = e.getContext("2d") as CanvasRenderingContext2D; diff --git a/src/game/Main.ts b/src/game/Main.ts index 33c9dde..c94790c 100644 --- a/src/game/Main.ts +++ b/src/game/Main.ts @@ -6,8 +6,7 @@ import { DrawSet } from "../applet/Render"; import { Location, PolygonComponent, RenderBounds } from "../ecs/Components"; import { Create } from "../ecs/Data"; import { RunRenderBounds } from "../ecs/Renderers"; -import { LockstepClient } from "../net/LockstepClient"; -import { LoopbackServer } from "../net/LoopbackServer"; +import { LockstepClient, Server } from "../net/LockstepClient"; import { Data, Engine, PlayerControl } from "./GameComponents"; import { Buttons } from "./Input"; @@ -15,11 +14,11 @@ export class Main extends LockstepClient { buttons = new Buttons(); - constructor(canvas: HTMLCanvasElement, cx: CanvasRenderingContext2D, keys: KeyControl, server: LoopbackServer) { + constructor(canvas: HTMLCanvasElement, cx: CanvasRenderingContext2D, keys: KeyControl, server: Server) { super(new Engine()); keys.setHandler(this.buttons); - this.connect(server.socket); + this.connect(server); pipe( this.renderFrames, diff --git a/src/index.ts b/src/index.ts index b9f2f5b..484caab 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,6 +18,6 @@ import { LoopbackServer } from "./net/LoopbackServer"; const server = new LoopbackServer(); -Select(".GameCanvas").forEachCanvas((c, cx, keys) => new Main(c, cx, keys, server)); +Select(".GameCanvas").forEachCanvas((c, cx, keys) => new Main(c, cx, keys, server.socket)); BindTests();