Struct pax_runtime::engine::PaxEngine
source · pub struct PaxEngine {
pub runtime_context: Rc<RuntimeContext>,
pub root_expanded_node: Rc<ExpandedNode>,
/* private fields */
}Expand description
Singleton struct storing everything related to properties computation & rendering
Fields§
§runtime_context: Rc<RuntimeContext>§root_expanded_node: Rc<ExpandedNode>Implementations§
source§impl PaxEngine
impl PaxEngine
Central instance of the PaxEngine and runtime, intended to be created by a particular chassis. Contains all rendering and runtime logic.
pub fn new( main_component_instance: Rc<ComponentInstance>, viewport_size: (f64, f64), platform: Platform, os: OS, ) -> Self
sourcepub fn tick(&mut self) -> Vec<NativeMessage>
pub fn tick(&mut self) -> Vec<NativeMessage>
Workhorse methods of every tick. Will be executed up to 240 Hz. Three phases:
- Expand nodes & compute properties; recurse entire instance tree and evaluate ExpandedNodes, stitching together parent/child relationships between ExpandedNodes along the way.
- Compute layout (z-index & TransformAndBounds) by visiting ExpandedNode tree in rendering order, writing computed rendering-specific values to ExpandedNodes
- Render: a. find lowest node (last child of last node) b. start rendering, from lowest node on-up, throughout tree
pub fn render(&mut self, rcs: &mut dyn RenderContext)
pub fn get_expanded_node( &self, id: ExpandedNodeIdentifier, ) -> Option<Rc<ExpandedNode>>
sourcepub fn set_viewport_size(&mut self, new_viewport_size: (f64, f64))
pub fn set_viewport_size(&mut self, new_viewport_size: (f64, f64))
Called by chassis when viewport size changes, e.g. with native window resizes
pub fn global_dispatch_key_down(&self, args: KeyDown) -> bool
pub fn global_dispatch_key_up(&self, args: KeyUp) -> bool
pub fn global_dispatch_key_press(&self, args: KeyPress) -> bool
Auto Trait Implementations§
impl Freeze for PaxEngine
impl !RefUnwindSafe for PaxEngine
impl !Send for PaxEngine
impl !Sync for PaxEngine
impl Unpin for PaxEngine
impl !UnwindSafe for PaxEngine
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
impl<T, U> RoundInto<U> for Twhere
U: RoundFrom<T>,
source§fn round_into(self) -> U
fn round_into(self) -> U
Performs the conversion.