Struct pax_runtime::engine::PaxEngine
source · pub struct PaxEngine {
pub runtime_context: RuntimeContext,
pub root_node: Rc<ExpandedNode>,
}Expand description
Singleton struct storing everything related to properties computation & rendering
Fields§
§runtime_context: RuntimeContext§root_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>, expression_table: ExpressionTable, viewport_size: (f64, f64) ) -> Self
pub fn replace_by_id(&mut self, id: &str, new_instance: Rc<dyn InstanceNode>)
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: u32) -> 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: ArgsKeyDown)
pub fn global_dispatch_key_up(&self, args: ArgsKeyUp)
pub fn global_dispatch_key_press(&self, args: ArgsKeyPress)
Auto Trait Implementations§
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.