Struct pix_engine::engine::PixEngine
source · [−]pub struct PixEngine { /* private fields */ }
Expand description
The core engine that maintains the render loop, state, drawing functions, event handling, etc.
Implementations
sourceimpl PixEngine
impl PixEngine
sourcepub fn run<A>(&mut self, app: &mut A) -> PixResult<()> where
A: AppState,
pub fn run<A>(&mut self, app: &mut A) -> PixResult<()> where
A: AppState,
Starts the PixEngine
application and begins executing the frame loop on a given
application which must implement AppState
. The only required method of which is
AppState::on_update
.
Errors
Any error in the entire library can propagate here and terminate the program. See the
error module for details. Also see AppState::on_stop
.
Example
fn main() -> PixResult<()> {
let mut engine = PixEngine::builder().build()?;
let mut app = MyApp::new(); // MyApp implements `AppState`
engine.run(&mut app)
}
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for PixEngine
impl !Send for PixEngine
impl !Sync for PixEngine
impl Unpin for PixEngine
impl UnwindSafe for PixEngine
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more