pub struct Scheduler {
pub focused: Option<u64>,
pub size: (u32, u32),
pub held_keys: Vec<String>,
pub window_focused: bool,
pub mouse_primary: bool,
pub mouse_secondary: bool,
pub mouse_middle: bool,
pub cursor_override: Option<CursorIcon>,
/* private fields */
}Fields§
§focused: Option<u64>§size: (u32, u32)§held_keys: Vec<String>Polled physical-key names currently down (KeyW, Digit1,
Space, … — winit KeyCode debug names, layout-independent
positions, not glyphs). The platform runner maintains this from
raw KeyboardInput events without passing through focus
dispatch; games reconcile their event-staged held sets against
it every frame (GML keyboard_check parity). Cleared on window
focus loss (no key-ups arrive across an alt-tab).
window_focused: boolWindow focus as of the last platform event. false drops every
held key on the game side.
mouse_primary: boolPolled mouse-button levels, same source as held_keys
(GML mouse_check_button parity; repairs a missed button-up
when the release lands outside the window).
mouse_secondary: bool§mouse_middle: bool§cursor_override: Option<CursorIcon>App-requested cursor override. When Some, the platform
applies it instead of the hover-derived icon: games hide the
OS pointer here (CursorIcon::Hidden) while drawing their own
crosshair, GML window_set_cursor(cr_none) parity. None
restores hover behavior. Set during composition (any view can
write it; last write per frame wins), consumed by the runner
after frame().
Implementations§
Source§impl Scheduler
impl Scheduler
pub fn new() -> Self
Sourcepub fn enter_scope(&mut self, key: &str)
pub fn enter_scope(&mut self, key: &str)
Enter a named scope. Subsequent id() calls within this scope
will allocate from the scope’s local counter, producing packed
(scope_id << 32) | local_id values that are stable across sibling
recompositions. Nested scopes push; exit_scope pops.
Sourcepub fn exit_scope(&mut self)
pub fn exit_scope(&mut self)
Exit the innermost scope. No-op if the stack is empty or the top does not match (defensive: never corrupt an outer scope).
Sourcepub fn scope_guard<'a>(&'a mut self, key: &str) -> SchedulerScopeGuard<'a>
pub fn scope_guard<'a>(&'a mut self, key: &str) -> SchedulerScopeGuard<'a>
RAII scope entry: pops on drop, so a panicking scope body cannot leave the scheduler stuck in the wrong scope (which previously leaked outer IDs into the global sequence).
Sourcepub fn scope_guard_raw(&mut self, key: &str) -> SchedulerScopeGuardRaw
pub fn scope_guard_raw(&mut self, key: &str) -> SchedulerScopeGuardRaw
Panic-safe scope entry that does NOT hold a borrow: the guarded body
(including nested scope!) can keep using the Scheduler. Used by
the scope! macro.
pub fn id(&mut self) -> u64
pub fn id_count(&self) -> u64
Sourcepub fn snapshot_id(&self) -> u64
pub fn snapshot_id(&self) -> u64
Snapshot the current ID counter (before executing a scope body) so the delta can be computed after the body returns.
Sourcepub fn advance_id(&mut self, count: u32)
pub fn advance_id(&mut self, count: u32)
Advance the ID counter by count without assigning IDs.
Used by the scope! macro to reserve IDs for a cached scope subtree.
Sourcepub fn ids_used_since(&self, prev_id: u64) -> u32
pub fn ids_used_since(&self, prev_id: u64) -> u32
Number of IDs assigned since prev_id (the value returned by
snapshot_id() before executing a scope body).