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]
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]
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]
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