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
impl Engine
Sourcepub fn builder() -> EngineBuilder
pub fn builder() -> EngineBuilder
Constructs a default EngineBuilder which can build a Engine
instance.
See EngineBuilder for examples.
Sourcepub fn run<A>(&mut self, app: &mut A) -> PixResult<()>where
A: PixEngine,
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§
Auto Trait Implementations§
impl Freeze for Engine
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> 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