Struct pax_runtime::engine::PaxEngine
source · pub struct PaxEngine {
pub runtime_context: Rc<RefCell<RuntimeContext>>,
pub root_node: Rc<ExpandedNode>,
/* private fields */
}Expand description
Singleton struct storing everything related to properties computation & rendering
Fields§
§runtime_context: Rc<RefCell<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
sourcepub fn replace_main_template_instance_node(
&mut self,
new_instance: Rc<dyn InstanceNode>
)
pub fn replace_main_template_instance_node( &mut self, new_instance: Rc<dyn InstanceNode> )
Replace an instance node in the main component’s template
pub fn remount_main_template_expanded_node( &mut self, new_instance: Rc<dyn InstanceNode> )
sourcepub fn recurse_remount_main_template_expanded_node(
parent: &Rc<ExpandedNode>,
id: &UniqueTemplateNodeIdentifier,
ctx: &Rc<RefCell<RuntimeContext>>
)
pub fn recurse_remount_main_template_expanded_node( parent: &Rc<ExpandedNode>, id: &UniqueTemplateNodeIdentifier, ctx: &Rc<RefCell<RuntimeContext>> )
Remounts an expanded node (&siblings) in the main component’s template
pub fn partial_update_expanded_node( &mut self, 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: KeyDown)
pub fn global_dispatch_key_up(&self, args: KeyUp)
pub fn global_dispatch_key_press(&self, args: KeyPress)
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.