simvx.graphics.web_app¶
Client-side web app runtime — runs inside Pyodide (browser WASM Python).
Replaces App for fully client-side web export. Drives the SceneTree, Draw2D,
and DrawSerializer in the browser without any server or Vulkan dependency.
The JavaScript web_runtime.js bridge calls tick(dt) each frame via
requestAnimationFrame and renders the returned binary data with WebGPU.
Module Contents¶
Classes¶
Browser-side app runtime for Pyodide. |
Data¶
API¶
- simvx.graphics.web_app.__all__¶
[‘WebApp’]
- class simvx.graphics.web_app.WebApp(width: int, height: int, physics_fps: int = 60)[source]¶
Browser-side app runtime for Pyodide.
Usage from JavaScript::
const app = pyodide.runPython(` from simvx.graphics.web_app import WebApp app = WebApp(800, 600) app `) app.set_root(pyodide.runPython('from game import GameScene; GameScene()')) # In rAF loop: app.process_input(events_json) frame_bytes = app.tick(dt)Initialization
- property title: str¶
- load_atlas(atlas_rgba: bytes, atlas_size: int, regions_json: str, font_size: int, ascender: float, descender: float, line_height: float, sdf_range: float, glyph_padding: int) None[source]¶
Reconstruct the MSDF atlas from pre-baked data (no freetype needed).
Args: atlas_rgba: Raw RGBA pixel bytes (atlas_size * atlas_size * 4). atlas_size: Width/height of the square atlas texture. regions_json: JSON-serialized glyph regions. font_size: Original font pixel size used to generate the atlas. ascender, descender, line_height: Font metrics. sdf_range: SDF range used during generation. glyph_padding: Glyph padding used during generation.
- process_input(events_json: str) None[source]¶
Process batched input events from JavaScript.
Args: events_json: JSON array of input event objects.