Skip to main content

Module runner_common

Module runner_common 

Source
Expand description

Shared runner helpers extracted from duplicated desktop/web/android App impls.

Structs§

BackendLifecycle
Retry policy for GPU backend construction, shared by every runner so the attempt cap and backoff curve stay identical across platforms. Callers keep their own clock and absolute retry deadline, since Instant differs on wasm.
TouchResult
Raw touch result without dispatch - caller handles dispatch_action to avoid double-borrow.

Enums§

BackendRetry
BackendState

Constants§

MAX_BACKEND_INIT_ATTEMPTS
Adapter creation is retried a few times because a platform may still be bringing up its GPU process. A capability problem (no supported backend, blocklisted driver) never resolves, so stop after this many tries.

Functions§

handle_touch_raw
map_mouse_button
Map winit MouseButton -> PointerButton.
map_physical_key
Typed physical position for a winit key (None wraps to repose_core::input::PhysicalKey::Unidentified, never None: every physical press has a position). Backs both the KeyEvent field and the Scheduler::held_keys snapshot.
on_cursor_moved
CursorMoved helper - returns cursor + whether inspector hover updated.
on_ime
Ime dispatch helper.
on_key_parts
Same dispatch as on_keyboard_input, for runners that cannot hand over a winit::event::KeyEvent (it has no public constructor): synthetic keys and keys forwarded from a DOM element.
on_keyboard_input
Shared inspector toggle + runtime dispatch. Reports the raw physical transition to the polled held_keys set first (games read held keys GML-style without depending on focus), then dispatches the focus-routed key event as before. Returns true if event consumed / needs redraw.
on_modifiers_changed
Update Modifiers from winit state - shared.
on_mouse_wheel
MouseWheel helper - converts delta to px and dispatches.
on_touch
HACK: Legacy wrapper that dispatches gestures inline (use handle_touch_raw when caller needs to avoid double-borrow of self containing rt).
on_touch_with_ime
Touch handler that also syncs IME for focused textfields on native runners. The web backend has no editor bridge, so its touch path only dispatches input.
physical_key_name
Stable debug name for a physical key (KeyW, Digit1, Space, …), matching KeyCode’s variant names. Layout-independent: AZERTY/QWERTZ report the same physical names, so games bind by position the way GML’s ord("W") binds the US position.
sync_touch_points
Publish the live contact table into sched.touch_points (single sync point: every runner funnels raw touch through handle_touch_raw). Games snapshot it each frame, so held fingers stay visible across frames (unlike the press edge, which fires once and is gone). GML device_mouse_* parity: stable per-finger ids, physical-px positions sampled every tick while held.