import type { ActionCodesMap } from "./actionBindings.js"; /** A serializable gamepad state sampled from the platform input API. */ export interface GamepadSnapshot { id: string; axes: number[]; buttons: { pressed: boolean; value: number; }[]; connected: boolean; } /** Names of the built-in controller glyph sets. */ export type GamepadGlyphName = "xbox" | "playstation" | "nintendo" | "generic"; /** Button labels used by one controller family. */ export interface GamepadGlyphSet { buttons: readonly string[]; } /** Built-in short labels for the common controller families. */ export declare const GAMEPAD_GLYPH_SETS: Record; /** Lowercase alias for consumers that prefer data-oriented naming. */ export declare const gamepadGlyphSets: Record; /** Action bindings whose codes identify gamepad buttons or axes. */ export type GamepadBindings = ActionCodesMap; /** A gamepad button or signed axis binding code. */ export type GamepadCode = `pad:${number}` | `padaxis:${number}${"+" | "-"}`; /** Deadzone policy applied to gamepad axes. */ export interface GamepadDeadzone { kind: "radial" | "axial"; inner: number; outer: number; } /** * Read-only view of one sampled gamepad. The browser `Gamepad` satisfies it structurally, so a poll * loop can resolve `navigator.getGamepads()` entries without copying them. */ export interface GamepadSample { readonly axes: ArrayLike; readonly buttons: ArrayLike<{ readonly pressed: boolean; readonly value: number; }>; readonly connected: boolean; } /** Options for resolving one gamepad snapshot into action state. */ export interface ResolveGamepadFrameOptions { deadzone: GamepadDeadzone; /** Response exponent for sticks and analog buttons: `1` linear, `>1` finer near rest (default `1`). */ curve?: number; /** Inner deadzone `0..1` for analog button values (triggers); below it the button reads 0 and is not held (default `0`). */ triggerDeadzone?: number; } /** * Game-level pad feel read by the shell's gamepad poll. A number `deadzone` is the axial inner * deadzone with a `0.95` outer edge. */ export interface GamepadFeelConfig { /** Stick deadzone (default axial `0.12` inner, `0.95` outer). */ deadzone?: number | GamepadDeadzone; /** Response exponent shared by sticks and triggers (default `1`). */ curve?: number; /** Trigger inner deadzone `0..1` (default `0`). */ triggerDeadzone?: number; } /** Shell default stick deadzone. */ export declare const DEFAULT_GAMEPAD_DEADZONE: GamepadDeadzone; /** Resolve a {@link GamepadFeelConfig} into the options {@link resolveGamepadFrame} takes. */ export declare function gamepadFeelOptions(config: GamepadFeelConfig | undefined): ResolveGamepadFrameOptions; /** The digital and analog action state produced by a gamepad frame. */ export interface GamepadFrame { held: string[]; analog: Record; } /** * Resolve one sampled gamepad into held actions and shaped analog action values. Sticks go through * the deadzone and curve; analog buttons (triggers) through `triggerDeadzone` and the same curve. * Pass `out` to reuse a frame across polls; it is cleared and returned. * @capability gamepad-input Resolve sampled gamepad input into actions with deadzones and response curves. */ export declare function resolveGamepadFrame(snapshot: GamepadSample, bindings: GamepadBindings, options: ResolveGamepadFrameOptions, out?: GamepadFrame): GamepadFrame;