Very rudimentary track editor... and headache spaghetti

This commit is contained in:
2025-02-08 05:30:16 -07:00
parent 791ba42ceb
commit 8dc0af650f
6 changed files with 542 additions and 173 deletions

View File

@@ -1,3 +1,6 @@
import { Vector, ZoomableDoodler } from "@bearmetal/doodler";
import { getContextItem } from "./context.ts";
export class InputManager {
private keyStates: Map<string | number, boolean> = new Map();
private mouseStates: Map<string | number, boolean> = new Map();
@@ -39,8 +42,25 @@ export class InputManager {
return this.mouseStates.get(key);
}
getMouseLocation() {
if (getContextItem("doodler") instanceof ZoomableDoodler) {
return getContextItem<ZoomableDoodler>("doodler").screenToWorld(
this.mouseLocation.x,
this.mouseLocation.y,
);
}
return this.mouseLocation;
}
getMouseLocationV() {
if (getContextItem("doodler") instanceof ZoomableDoodler) {
return new Vector(
getContextItem<ZoomableDoodler>("doodler").screenToWorld(
this.mouseLocation.x,
this.mouseLocation.y,
),
);
}
return new Vector(this.mouseLocation);
}
getMouseDelta() {
return this.mouseDelta;
}