Files
vpinball-wasm/package/src/types.ts
T

31 lines
1002 B
TypeScript
Raw Normal View History

/**
* Public TypeScript surface for @valknar/vpinball-wasm.
*
* This wraps the raw Emscripten-generated module (dist/vpinball.js) so
* consumers don't need to know about ccall/cwrap/FS internals directly.
*/
export interface LoadPinballOptions {
/** Canvas the engine renders into via SDL3's WebGL2 backend. */
canvas: HTMLCanvasElement;
/**
* Raw bytes of a .vpx table file to load on startup. If omitted, the
* bundled default table (package/assets/test000-default-table.vpx) is
* used instead.
*/
tableData?: ArrayBuffer;
/** Base URL to fetch dist/vpinball.wasm (and .data, if present) from. */
baseUrl?: string;
}
export interface PinballInstance {
/** Load a different .vpx table at runtime, replacing the current one. */
loadTable(vpxBytes: ArrayBuffer): void;
/** Start (or resume) the simulation's main loop. */
start(): void;
/** Pause the simulation's main loop. */
stop(): void;
/** Tear down the instance and free its WebAssembly memory. */
dispose(): void;
}