use-control
Version:
A powerful set of hooks for elegantly handling keyboard, mouse and gamepad input (soon)
20 lines (19 loc) • 858 B
TypeScript
import { Subject } from 'rxjs';
export declare const gamepadButtonPress$: Subject<GamepadAction>;
export declare const gamepadButtonHeld$: Subject<GamepadAction>;
export declare const gamepadButtonReleased$: Subject<GamepadAction>;
export declare const gamepadAxes$: Subject<GamepadAxisReading>;
declare type GamepadAction = {
controllerIndex: number;
buttonIndex: number;
};
declare type GamepadAxisReading = {
controllerIndex: number;
axisIndex: number;
value: number;
};
export declare function initGamepad(pollIntervalMs?: number): void;
export declare function teardownGamepad(): void;
export declare function useGamepadButtonPressed(controllerIndex: number, buttonIndex: number, sink: () => void): void;
export declare function useGamepadAxis(controllerIndex: number, axisIndex: number, sink: (v: number) => void): void;
export {};