Skip to main content

PaxEngine

Struct PaxEngine 

Source
pub struct PaxEngine {
    pub runtime_context: Rc<RuntimeContext>,
    pub root_expanded_node: Option<Rc<ExpandedNode>>,
    pub scroller_tiling_policy: ScrollerTilingPolicy,
}
Expand description

Singleton struct storing everything related to properties computation & rendering

Fields§

§runtime_context: Rc<RuntimeContext>§root_expanded_node: Option<Rc<ExpandedNode>>§scroller_tiling_policy: ScrollerTilingPolicy

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_empty( viewport_size: (f64, f64), platform: Platform, os: OS, get_elapsed_millis: Box<dyn Fn() -> u128>, scroller_tiling_policy: ScrollerTilingPolicy, ) -> Self

Source

pub fn mount_root_component( &mut self, main_component_instance: Rc<ComponentInstance>, ) -> Rc<ExpandedNode>

Mount a root component tree into an existing runtime kernel.

Source

pub fn unmount(&mut self)

Detach the mounted root component tree, leaving the runtime kernel empty.

Source

pub fn new( main_component_instance: Rc<ComponentInstance>, viewport_size: (f64, f64), platform: Platform, os: OS, get_elapsed_millis: Box<dyn Fn() -> u128>, scroller_tiling_policy: ScrollerTilingPolicy, ) -> 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 update_layer_count(&self, rcs: &mut dyn RenderContext)

Source

pub fn global_dispatch_focus(&self, args: Focus) -> bool

Source

pub fn global_dispatch_select_start(&self, args: SelectStart) -> bool

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

Source

pub fn global_dispatch_gyro(&self, args: Gyro) -> bool

Source

pub fn global_dispatch_accel(&self, args: Accel) -> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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>,

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>