@hiddentao/clockwork-engine
Version:
A TypeScript/PIXI.js game engine for deterministic, replayable games with built-in rendering
48 lines • 1.44 kB
TypeScript
import type { GameEventSource } from "./EventSource";
import type { AnyGameEvent } from "./types";
export declare class UserInputEventSource implements GameEventSource {
protected dataQueue: Array<{
inputType: string;
data: any;
timestamp: number;
}>;
/**
* Queue input data to be processed
* @param inputType The type of input (e.g., "direction", "button")
* @param data The input data to queue
*/
queueInput(inputType: string, data: any): void;
/**
* Get all events for the current tick
* Transforms queued data into game events with the current tick
* Clears the queue after returning events
*/
getNextEvents(totalTicks: number): AnyGameEvent[];
/**
* Check if there are more events available
*/
hasMoreEvents(): boolean;
/**
* Reset the event source by clearing the queue
*/
reset(): void;
/**
* Get the number of queued data items
*/
getQueueLength(): number;
/**
* Get all queued data (read-only)
*/
getQueuedData(): readonly any[];
/**
* Remove all data matching a predicate
* @param predicate Function to test each data item
* @returns Number of items removed
*/
removeData(predicate: (data: any) => boolean): number;
/**
* Clear all data from the queue
*/
clear(): void;
}
//# sourceMappingURL=UserInputEventSource.d.ts.map