[][src]Struct screen_13::Engine

pub struct Engine { /* fields omitted */ }

Pumps an operating system event loop in order to refresh a Gpu-created image at the refresh rate of the monitor. Requires a DynScreen instance to render.

Implementations

impl Engine[src]

pub fn new<'a, 'b, P: AsRef<Program<'a, 'b>>>(program: P) -> Self[src]

Constructs a new Engine from the given Program description.

NOTE: This function loads any existing user configuration file and may override program description options in order to preserve the user experience.

Examples

use screen_13::prelude_all::*;

fn main() {
    let foo = Program::new("UltraMega III", "Nintari, Inc.")
                .with_title("UltraMega III: Breath of Fire")
                .with_window();
    let engine = Engine::new(foo); //    We ask for windowed mode, but we ...
    engine.run(...)                // <- ... get fullscreen because of some previous run. 😂
}

pub fn gpu(&self) -> &Gpu[src]

Borrows the Gpu instance.

pub fn run(self, screen: DynScreen) -> ![src]

Runs a program starting with the given DynScreen.

Immediately after this call, draw will be called on the screen, followed by update, ad infinium. This call does not return to the calling code.

Examples

use screen_13::prelude_all::*;

fn main() {
    let engine = Engine::default();
    engine.run(Box::new(FooScreen)) // <- Note the return value which is the no-return bang
                                    //    "value", inception. 🤯
}

struct FooScreen;

impl Screen for FooScreen {
    ...
}

Trait Implementations

impl Default for Engine[src]

impl From<&'_ Program<'_, '_>> for Engine[src]

impl From<Program<'_, '_>> for Engine[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.