import { Context, ContextManager } from '../context'; import { Event } from '../event'; /** * Represents the axes of a gamepad. */ export declare enum GamepadAxis { LeftStickHorizontal = "LeftStickHorizontal", LeftStickVertical = "LeftStickVertical", RightStickHorizontal = "RightStickHorizontal", RightStickVertical = "RightStickVertical" } /** * Represents the buttons on a gamepad. */ export declare enum GamepadButton { South = "South", East = "East", West = "West", North = "North", ShoulderLeft = "ShoulderLeft", ShoulderRight = "ShoulderRight", TriggerLeft = "TriggerLeft", TriggerRight = "TriggerRight", Select = "Select", Start = "Start", StickLeft = "StickLeft", StickRight = "StickRight", DUp = "DUp", DDown = "DDown", DLeft = "DLeft", DRight = "DRight", Center = "Center" } /** * Manages and tracks gamepad connections and states. * @zcontext */ export declare class GamepadContext extends Context { readonly onGamepadsChange: Event<[]>; readonly activeGamepads: Set; private _registeredGamepads; /** * Creates an instance of GamepadContext. * @param contextManager - The current ContextManager */ constructor(contextManager: ContextManager); private _update; /** * Retrieves a gamepad instance by its index. * @param indx The index of the gamepad. * @returns The gamepad instance or null if not found. */ getGamepad(indx: number): Gamepad | null; /** * Executes a function on each active gamepad, optionally filtered by index. * @param requestedIndex The index to filter gamepads by, if specified. * @param fn The function to execute on each matching gamepad. */ forGamepadsMatchingIndex(requestedIndex: number | undefined, fn: (gamepad: Gamepad) => void): void; /** * Registers a gamepad with a specific index. * @param indx The index of the gamepad. * @param gamepad The gamepad to register. */ registerGamepad(indx: number, gamepad: Gamepad): void; /** * Unregisters a gamepad by its index. * @param indx The index of the gamepad to unregister. */ unregsiterGamepad(indx: number): void; dispose(): never; } /** * Converts a gamepad axis enum value to its corresponding numeric representation. * @param axis The gamepad axis to translate. * @returns The numeric representation of the gamepad axis. */ export declare function translateGamepadAxis(axis: GamepadAxis): number;