import { GameEventBus } from "../eventBus.d.ts"; import { Action } from "../../interfaces/action.d.ts"; import { Binding, TriggerBindingDefinition } from "../../interfaces/binding.d.ts"; import { DeviceType, DeviceValueReader, InputState } from "../../interfaces/input.d.ts"; /** * All supported edge modes for validation */ export declare const edgeModes: readonly ["rising", "falling", "both"]; /** * Defines when a trigger binding will fire based on input state changes */ export type EdgeMode = typeof edgeModes[number]; /** * Options for configuring a trigger binding */ export interface TriggerBindingOptions { /** * Which edge(s) should cause the trigger to fire * - 'rising': Only trigger on false -> true transitions * - 'falling': Only trigger on true -> false transitions * - 'both': Trigger on any state change */ edgeMode?: EdgeMode; /** * Threshold for analog inputs (0.0 to 1.0) * When input value is >= threshold, it's considered "active" (true) * When input value is < threshold, it's considered "inactive" (false) * Defaults to 0.5 for analog inputs */ threshold?: number; /** * Optional context name this binding belongs to */ context?: string; } /** * Implementation of a trigger binding, which emits an action when a button/key is pressed or released. * Can handle both digital and analog inputs with configurable threshold. * Can output either digital or analog values based on the action type. */ export declare class TriggerBinding implements Binding { readonly type: "trigger"; readonly action: Action; readonly context?: string; readonly deviceID: string; readonly deviceType: DeviceType; readonly reader: DeviceValueReader; private readonly _edgeMode; private readonly _threshold; private _lastDigitalState; /** * Get the current options for this trigger binding. */ get options(): TriggerBindingOptions; /** * Create a new trigger binding * * @param action * @param deviceID * @param deviceType * @param reader * @param options */ constructor(action: Action, deviceID: string, deviceType: DeviceType, reader: DeviceValueReader, options?: TriggerBindingOptions); /** * Process input state and emit an action event on the configured edge transition(s). * * @param state * @param eventBus */ process(state: InputState, eventBus: GameEventBus): void; /** * Reset edge-detection state for a context activation. When a state is provided, primes from the current physical * input so that already-held inputs don't produce phantom rising edges in the newly activated context. */ resetEdgeState(state?: InputState): void; /** * Returns a JSON-serializable representation of this trigger binding. */ toJSON(): TriggerBindingDefinition; }