UNPKG

@hiddentao/clockwork-engine

Version:

A TypeScript/PIXI.js game engine for deterministic, replayable games with built-in rendering

64 lines 2.06 kB
import type { GameEventSource } from "./EventSource"; import type { GameEngine } from "./GameEngine"; import type { GameRecorder } from "./GameRecorder"; import type { IGameLoop } from "./IGameLoop"; import type { AnyGameEvent, ObjectUpdateEvent, UserInputEvent } from "./types"; export declare class GameEventManager implements IGameLoop { protected source: GameEventSource; protected engine: GameEngine; protected recorder?: GameRecorder; protected currentTick: number; constructor(source: GameEventSource, engine: GameEngine); /** * Set the game recorder for this event manager */ setRecorder(recorder: GameRecorder | undefined): void; /** * Process events for the current tick */ update(_deltaTicks: number, totalTicks: number): void; /** * Set a new event source * @param source The new event source to use */ setSource(source: GameEventSource): void; /** * Get the current event source */ getSource(): GameEventSource; /** * Reset the event manager */ reset(): void; /** * Process a single game event */ protected processEvent(event: AnyGameEvent): void; /** * Process a user input event * This is where you would typically dispatch input events to game systems */ protected processUserInput(event: UserInputEvent): void; /** * Process an object update event * Finds the target object and calls the specified method with parameters */ protected processObjectUpdate(event: ObjectUpdateEvent): void; /** * Optional callback for handling user input events * Can be set by the game implementation to handle input */ onUserInput?: (event: UserInputEvent) => void; /** * Check if there are more events to process */ hasMoreEvents(): boolean; /** * Get information about the current event source */ getSourceInfo(): { type: string; hasMore: boolean; }; } //# sourceMappingURL=GameEventManager.d.ts.map