Scaffold vpinball-wasm: Emscripten port of Visual Pinball
Build scripts, CMake/source patches, npm packaging, and a Gitea CI workflow to compile the real Visual Pinball engine (SDL3 + WebGL2 + libwinevbs for real VBScript) to WebAssembly. The patches are validated end-to-end: the patched engine boots in a real browser, loads a real .vpx table, compiles its real GLSL shaders, computes environment map radiance, initializes physics, and starts the VBScript engine, before hanging on the one deliberately-deferred piece of work (game loop rewrite around emscripten_set_main_loop), documented in the README's roadmap.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
Reference in New Issue
Block a user