contro-max
Version:
Game controls done in the best possible way!
6 lines (5 loc) • 795 B
TypeScript
export declare const buttonMap: readonly [readonly ["A"], readonly ["B"], readonly ["X"], readonly ["Y"], readonly ["Left Bumper", "LB"], readonly ["Right Bumper", "RB"], readonly ["Left Trigger", "LT"], readonly ["Right Trigger", "RT"], readonly ["Back", "View"], readonly ["Start"], readonly ["Left Stick"], readonly ["Right Stick"], readonly ["Up", "DpadUp"], readonly ["Down", "DpadDown"], readonly ["Left", "DpadLeft"], readonly ["Right", "DpadRight"], readonly ["Home", "Guide", "Xbox"]];
export type GamepadButtonName = typeof buttonMap[number][0];
/** Find button number by button name (or number itself) */
export declare const findButtonNumber: (button: GamepadButtonName | number) => number;
export declare function getButtonLabel(buttonIndex: number): GamepadButtonName | undefined;