Skip to main content

render_gui

Function render_gui 

Source
pub fn render_gui(
    source: &str,
    width: u32,
    height: u32,
    theme_json: &str,
    data_json: &str,
    lang: u32,
) -> Vec<u8> 
Expand description

Generic, game-agnostic layout preview for editors.

Compiles raw .gui source, renders at an arbitrary width×height, lets the editor inject the screen theme (so high-resolution / proportional / themed layouts preview exactly as in-game) and supplies the data bindings itself as JSON. Game-specific custom:* elements are NOT registered here (the engine cannot know them); games that have any ship their own preview WASM built on dotzuki-renderer’s layout engine.

  • source — raw .gui DSL text.
  • width/height — framebuffer size in pixels (e.g. 426×240 for wuxia).
  • theme_json — a Theme object ({bg_color, text_mode, ink, …}); empty string keeps the layout’s own theme (default GB white/tile).
  • data_json — an object of template bindings; values may be nested arrays (→ DataValue::List) to feed list/flex_list rows.
  • lang — 0=en, 1=zh for @t(...) text.

Returns a width*height*4 RGBA buffer, or empty on compile/parse error.