Skip to main content

Scheduler

Struct Scheduler 

Source
pub struct Scheduler {
Show 14 fields pub focused: Option<u64>, pub size: (u32, u32), pub pointer_pos_px: Option<(f32, f32)>, pub held_keys: HashSet<PhysicalKey>, pub window_focused: bool, pub touch_points: Vec<(u64, f32, f32)>, pub mouse_primary: bool, pub mouse_secondary: bool, pub mouse_middle: bool, pub gamepads: Vec<GamepadPad>, pub scale: f32, pub cursor_override: Option<CursorIcon>, pub cursor_grab: CursorGrabMode, pub fullscreen_request: Option<bool>, /* private fields */
}

Fields§

§focused: Option<u64>§size: (u32, u32)§pointer_pos_px: Option<(f32, f32)>

Last known mouse pointer position in physical px, updated on mouse move/press/release without passing through focus dispatch.

§held_keys: HashSet<PhysicalKey>

Polled physical keys currently down, layout-independent positions (see PhysicalKey). 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: bool

Window focus as of the last platform event. false drops every held key on the game side.

§touch_points: Vec<(u64, f32, f32)>

Live touch contacts in physical px: (touch id, x, y) per finger currently down. Written by the platform runners from raw WindowEvent::Touch (Started/Moved/Ended-Cancelled), read by games through feed_polled-style staging snapshots (GML device_mouse_x_to_gui(i) parity: stable per-finger slot ids, positions sampled every tick while held).

§mouse_primary: bool

Polled 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§gamepads: Vec<GamepadPad>

The connected gamepads, polled like the keys and the mouse levels: the buttons that are down and the live axis values, one entry per pad.

§scale: f32

The window’s DPI scale factor: physical px per logical px. 1.0 on a display that reports no scaling. The pointer’s positions are physical px, so a game that maps them into its own space divides by this.

§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().

§cursor_grab: CursorGrabMode

App-requested pointer confinement, declared per frame like cursor_override: a game steering with the mouse sets CursorGrabMode::Confined while the pointer is its input, so the mouse stops at the window edge instead of escaping and freezing the control. The field is reset to None after every frame(), so a game that stops asking - a paused match, a closed editor - releases the pointer the same frame.

§fullscreen_request: Option<bool>

App-requested borderless fullscreen, taken by the runner when it next looks rather than declared per frame like cursor_grab.

A switch rather than a state, and the difference matters: the game asks on the frame the player flips the setting, so a window the player resized themselves is left alone by the next frame re-asserting it. The runner consumes the request, so it is None again once it has been applied. Games ask through Scheduler::request_fullscreen; shells read it back with repose_app::Runtime::take_fullscreen_request.

Implementations§

Source§

impl Scheduler

Source

pub fn new() -> Self

Source

pub fn request_fullscreen(&mut self, fullscreen: bool)

Ask the runner for borderless fullscreen on or off.

The app’s side of the request: the runner consumes it when it next looks, so this is asked once, on the frame the player changes their mind, rather than asserted every frame. A game has no other way to reach the window — the closure the shell calls is handed a scheduler and a render context, and neither is the window.

Source

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.

Source

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).

Source

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).

Source

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.

Source

pub fn id(&mut self) -> u64

Source

pub fn id_count(&self) -> u64

Source

pub fn is_held(&self, key: PhysicalKey) -> bool

True while the named physical key is in the polled snapshot.

Source

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.

Source

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.

Source

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).

Source

pub fn gc_scope_state(&mut self, live_keys: &FxHashSet<String>)

Source§

impl Scheduler

Source

pub fn repose<F>( &mut self, build_root: F, layout_paint: impl Fn(&View, (u32, u32)) -> (Scene, Vec<HitRegion>, Vec<SemNode>), ) -> Frame
where F: FnMut(&mut Scheduler) -> View,

Trait Implementations§

Source§

impl Default for Scheduler

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.