fix: ditched sdl and moved to xinput for windows for less ram usage

This commit is contained in:
Simeon Radivoev 2026-03-30 02:02:12 +03:00
parent 90d6711935
commit dc0f2d150a
Signed by: simeonradivoev
GPG key ID: 7611A451D2A5D37A
18 changed files with 663 additions and 100 deletions

View file

@ -0,0 +1,32 @@
// ./gamepad/index.ts
import { platform } from "os";
import { GamepadWindows } from "./windows";
import { GamepadLinux } from "./linux";
import type { IGamepadBackend, GamepadState } from "./types";
export class Gamepad
{
private backend: IGamepadBackend;
constructor(index = 0)
{
if (platform() === "win32")
{
this.backend = new GamepadWindows(index);
} else
{
this.backend = new GamepadLinux(index);
}
}
update (): GamepadState | null
{
return this.backend.update();
}
close ()
{
this.backend.close?.();
}
}