Struct pix_engine::engine::Engine

source ·
pub struct Engine { /* private fields */ }
Expand description

The core engine that maintains the render loop, state, drawing functions, event handling, etc.

Implementations§

source§

impl Engine

source

pub fn builder() -> EngineBuilder

Constructs a default EngineBuilder which can build a Engine instance.

See EngineBuilder for examples.

source

pub fn run<A>(&mut self, app: &mut A) -> PixResult<()>
where A: PixEngine,

Starts the Engine application and begins executing the frame loop on a given application which must implement Engine. The only required method of which is [Engine::on_update].

Errors

Any error in the entire library can propagate here and terminate the program. See the error module for details. Also see [Engine::on_stop].

Example
fn main() -> PixResult<()> {
    let mut engine = Engine::builder().build()?;
    let mut app = MyApp::new(); // MyApp implements `Engine`
    engine.run(&mut app)
}

Trait Implementations§

source§

impl Debug for Engine

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Engine

§

impl !Send for Engine

§

impl !Sync for Engine

§

impl Unpin for Engine

§

impl UnwindSafe for Engine

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V