LING71671/moon-egui/examples/canvas does not have a README file

    BenchmarkState

    pub struct BenchmarkState {
    grid_dim : Int
    wave_pulse : Bool
    magnetic_repel : Bool
    ripple_active : Bool
    ripple_cx : Double
    ripple_cy : Double
    ripple_progress : Double
    frame_tick : Double
    click_count : Int
    cam_x : Double
    cam_y : Double
    zoom : Double
    selected_id : Int
    selected_col : Int
    selected_row : Int
    drag_mode : Int
    item_drag_dx : Double
    item_drag_dy : Double
    is_dragging_item : Bool
    visible_cells : Int
    show_studio : Bool
    panel_tab : Int
    jump_text : String
    jump_after : Int
    show_grid : Bool
    }

    FrameOutput

    pub struct FrameOutput {
    draw_list :
    DrawList

    cam_x : Double
    cam_y : Double
    zoom : Double
    grid_dim : Int
    visible_cells : Int
    selected_id : Int
    show_studio : Bool
    is_vector : Bool
    cursor : String
    navigate_url : String
    }

    GalleryState

    pub struct GalleryState {
    button_clicks : Int
    checkbox_gpu : Bool
    checkbox_grid : Bool
    checkbox_dark_contrast : Bool
    checkbox_antialiasing : Bool
    toggle_minimal : Bool
    toggle_autosave : Bool
    toggle_retina : Bool
    toggle_haptics : Bool
    radio_quality : Int
    slider_zoom : Double
    slider_opacity : Double
    drag_x : Double
    drag_y : Double
    drag_scale : Double
    stepper_count : Double
    stepper_gain : Double
    rating_val : Double
    steps_current : Int
    pagination_page : Int
    knob_cutoff : Double
    knob_res : Double
    knob_pan : Double
    knob_drive : Double
    fader_vol : Double
    fader_gain : Double
    fader_l : Double
    fader_r : Double
    combo_format : Int
    combo_color : Int
    color_idx : Int
    progress_val : Double
    tree_selected : String?
    tree_expanded : Array[String]
    tab_selected : Int
    text_name : String
    text_email : String
    code_buffer : String
    toasts : Array[
    Toast
    ]
    cmd_open : Bool
    cmd_query : String
    cmd_idx : Int
    ctx_menu_open : Bool
    ctx_menu_pos :
    Vec2

    status_text : String
    active_comp_id : String
    splitter_ratio : Double
    table_sort_col : String
    table_sort_dir :
    TableSortDirection

    table_columns : Array[
    TableColumn
    ]
    table_selected_row : Int
    dialog_open : Bool
    dialog_last_result : String
    segmented_sel : Int
    tag1_open : Bool
    tag2_open : Bool
    tag3_open : Bool
    sparkline_data : Array[Double]
    color_picker_val :
    Color

    breadcrumb_last_clicked : String
    rich_text_last_url : String
    dock_tree :
    DockTree

    node_items : Array[
    NodeItem
    ]
    node_conns : Array[
    NodeConnection
    ]
    spring_puck_x : Double
    spring_puck_y : Double
    spring_model :
    Spring2D

    spring_stiffness : Double
    spring_damping : Double
    spring_dragging : Bool
    svg_export_done : Bool
    }

    MineChunk

    type MineChunk

    One 64x64 tile of the world holding the revealed / flagged bitmaps. Only touched tiles ever allocate - the board is effectively infinite.

    MineWorld

    type MineWorld

    Deterministic, effectively infinite minesweeper world.

    Mine positions are derived from mine_cell_hash(x, y, seed), so nothing about the mines is stored: given the same seed and density every client computes the exact same board, which is what makes the shared / replayable variant nearly free to synchronise.

    MinesFrame

    pub struct MinesFrame {
    draw_list :
    DrawList

    revealed : Int
    flagged : Int
    hits : Int
    pending : Bool
    flag_mode : Bool
    pan_mode : Bool
    cursor : String
    tile_x : Int
    tile_y : Int
    cell : Double
    domain_size : Int
    view_x : Int
    view_y : Int
    view_cols : Int
    view_rows : Int
    navigate_url : String
    }

    Frame payload for the standalone minesweeper page (minesweeper.html).

    MinesState

    type MinesState

    StudioFile

    type StudioFile

    StudioState

    pub struct StudioState {
    files : Array[StudioFile]
    open_tabs : Array[Int]
    active_tab : Int
    split_h_ratio : Double
    split_v_ratio : Double
    terminal_lines : Array[TerminalLine]
    term_tab : Int
    cmd_palette_open : Bool
    cmd_query : String
    cmd_index : Int
    tree_expanded : Array[String]
    initialized : Bool
    }

    TerminalLine

    type TerminalLine

    DOMAIN_SIZE

    let DOMAIN_SIZE : Int

    The world is a bounded domain of DOMAIN_SIZE x DOMAIN_SIZE tiles holding TARGET_MINES mines in total (the quantified identity of the shared field). Outside the domain there are no mines at all.

    MINES_THRESHOLD

    let MINES_THRESHOLD : UInt64

    Calibrated threshold: the domain contains EXACTLY TARGET_MINES mines at this value. Counting all 655,360,000 tiles through the hash above gives 100,000,000 exactly (scratch/verify_mine_count.py; the same number comes out of cmd/mines_calibrate). Never change it casually - it is part of the quantified identity of the shared world.

    Verifying this is easy to get wrong: an earlier version of the checker hashed mix64(x ^ seed) instead of mix64(x * GOLD ^ seed) and reported 100,014,855 for this same constant. Cross-check any counter against the exact big-integer reference in scratch/probe_window.py on a small window before trusting a full-domain number.

    TARGET_MINES

    let TARGET_MINES : Int

    fn gallery_step(comp_id : String, mouse_x : Double, mouse_y : Double, mouse_down : Bool, scroll_dy : Double, vp_w : Double, vp_h : Double, text_input : String, keys_pressed : Array[String], keys_released : Array[String], mod_flags : Int, mouse_secondary_down? : Bool) ->
    DrawList

    Native MoonBit Component Showcase Frame Entry Point. Evaluates native widgets and returns pure @draw.DrawList to JavaScript.

    get_cam_x

    fn get_cam_x() -> Double

    get_cam_y

    fn get_cam_y() -> Double

    fn get_gallery_cursor() -> String

    fn get_gallery_status() -> String

    get_grid_dim

    fn get_grid_dim() -> Int

    get_logo_color

    fn get_logo_color(dim : Int, col : Int, row : Int) ->
    Color
    ?

    get_selected_id

    fn get_selected_id() -> Int

    get_state

    fn get_state() -> BenchmarkState

    get_studio_cursor

    fn get_studio_cursor() -> String

    get_visible_cells

    fn get_visible_cells() -> Int

    get_zoom

    fn get_zoom() -> Double

    is_magnetic_repel

    fn is_magnetic_repel() -> Bool

    is_show_studio

    fn is_show_studio() -> Bool

    is_wave_pulse

    fn is_wave_pulse() -> Bool

    mines_calibrate_threshold

    fn mines_calibrate_threshold(target : Int) -> UInt64

    Binary-search the smallest threshold whose domain holds at least target mines. Runs once at development time (cmd/mines_calibrate).

    mines_count_for_threshold

    fn mines_count_for_threshold(threshold : UInt64) -> Int

    Count mines over the whole domain for a given threshold (calibration).

    mines_density_percent

    fn mines_density_percent() -> Double

    The density the board is built with, as a percentage: a tile is a mine exactly when the top 32 bits of its hash fall below the calibrated threshold, so the threshold IS the per-tile mine probability. Multiplying it by the domain gives 100,003,690, against an exhaustively counted 100,000,000 - a 0.40 sigma draw.

    mines_domain_tiles

    fn mines_domain_tiles() -> Int

    Total tiles in the shared domain: 25,600 x 25,600 = 655,360,000.

    The number is the point of the demo and also its least believable claim, because it cannot be seen. The viewport holds a few thousand tiles at any zoom the board stays legible at, so "100 million mines" and "1 million mines" render identically. Anything that makes the scale visible - the overview map and the coverage figure - reads from here.

    mines_is_mine_raw

    fn mines_is_mine_raw(x : Int, y : Int) -> Bool

    Raw hash classification without world state - the calibration tool and the sampling test both count through this.

    mines_step

    fn mines_step(mouse_x : Double, mouse_y : Double, mouse_down : Bool, mouse_secondary_down : Bool, pan_dx : Double, pan_dy : Double, zoom_delta : Double, action_switch : Int, vp_w : Double, vp_h : Double) -> MinesFrame

    Per-frame entry point of the standalone minesweeper page. The host only feeds pointer / wheel / button state - everything else (procedural board, cascade, rendering) lives in this deterministic core.

    step

    fn step(mouse_x : Double, mouse_y : Double, mouse_down : Bool, pan_dx : Double, pan_dy : Double, zoom_delta : Double, switch_mode : Int, vp_w : Double, vp_h : Double, text_input : String, keys_pressed : Array[String], keys_released : Array[String], mod_flags : Int) -> FrameOutput

    Core benchmark frame update function supporting 128x128, 256x256, 512x512, 1024x1024.

    Input crosses the JS boundary as primitives - pointer, the text typed this frame, the named keys pressed and released this frame, and a modifier bitmask - and host_input.mbt turns them into the library's events.

    studio_step

    fn studio_step(cur_w : Double, cur_h : Double, mouse_x : Double, mouse_y : Double, mouse_down : Bool, scroll_dy : Double, text_input : String, keys_pressed : Array[String], keys_released : Array[String], mod_flags : Int, mouse_secondary_down? : Bool) ->
    DrawList