Struct simple_game_engine::Engine[][src]

pub struct Engine<'a> { /* fields omitted */ }

The main game engine, which manages the display and input.

Implementations

impl<'a> Engine<'a>[src]

pub fn new(
    app: &'a mut dyn Application,
    title: &'a str,
    width: u32,
    height: u32
) -> Result<Engine<'a>, String>
[src]

Create a new engine.

Parameters

  • app: Defines the application’s logic.
  • title: Title of the window.
  • width: Width (in pixels) of the window.
  • height: Height (in pixels) of the window.

Example

use simple_game_engine::Engine;
let mut app = App {}; // Some `Application` implementation
let engine = Engine::new(&mut app, "Window Title", 640, 480)?;

pub fn start(&mut self, present_vsync: bool) -> Result<(), Box<dyn Error>>[src]

Create and show the window and start the main event loop.

Parameters

  • present_vsync: Whether to limit the frame rate of the application to the frame rate of the display.

Example

use simple_game_engine::Engine;
let mut app = App {}; // Some `Application` implementation
let mut engine = Engine::new(&mut app, "Window Title", 640, 480)?;
engine.start(true)?; // Starts with vsync enabled

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Engine<'a>

impl<'a> !Send for Engine<'a>

impl<'a> !Sync for Engine<'a>

impl<'a> Unpin for Engine<'a>

impl<'a> !UnwindSafe for Engine<'a>

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.