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

Central instance of the PaxEngine and runtime, intended to be created by a particular chassis. Contains all rendering and runtime logic.

source

pub fn new( main_component_instance: Rc<ComponentInstance>, viewport_size: (f64, f64), platform: Platform, os: OS, ) -> Self

source

pub fn tick(&mut self) -> Vec<NativeMessage>

Workhorse methods of every tick. Will be executed up to 240 Hz. Three phases:

  1. Expand nodes & compute properties; recurse entire instance tree and evaluate ExpandedNodes, stitching together parent/child relationships between ExpandedNodes along the way.
  2. Compute layout (z-index & TransformAndBounds) by visiting ExpandedNode tree in rendering order, writing computed rendering-specific values to ExpandedNodes
  3. Render: a. find lowest node (last child of last node) b. start rendering, from lowest node on-up, throughout tree
source

pub fn render(&mut self, rcs: &mut dyn RenderContext)

source

pub fn get_expanded_node( &self, id: ExpandedNodeIdentifier, ) -> Option<Rc<ExpandedNode>>

source

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

source

pub fn global_dispatch_key_down(&self, args: KeyDown) -> bool

source

pub fn global_dispatch_key_up(&self, args: KeyUp) -> bool

source

pub fn global_dispatch_key_press(&self, args: KeyPress) -> bool

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> RoundFrom<T> for T

source§

fn round_from(x: T) -> T

Performs the conversion.
source§

impl<T, U> RoundInto<U> for T
where U: RoundFrom<T>,

source§

fn round_into(self) -> U

Performs the conversion.
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.