gamepad-helper
Version:
Wrapper class for the HTML5 Gamepad API.
24 lines • 956 B
TypeScript
export declare type GamepadHub = {
[key: number]: Gamepad;
};
export interface IGamepadButtonEventDetail {
gamepad: number;
button: number;
}
export declare class GamepadHelper {
static gamepads: GamepadHub;
static gamepadsLastUpdate: GamepadHub;
static logOutput: boolean;
/** Return the state of the specified button */
static getButtonValue(gamepad: number, button: number): number | undefined;
/** Return the state of the specified axis */
static getAxisValue(gamepad: number, axis: number): number | undefined;
/** Main method intended to be called from within a game loop.
* Queries the state of each button on each connected gamepad and dispatches an event to the document if there is change in state.
*/
static update(): void;
private static checkForNewGamepads;
private static dispatchButtonDownEvent;
private static dispatchButtonUpEvent;
}
//# sourceMappingURL=index.d.ts.map