Trait 2dgl::game::Game [-]  [+] [src]

pub trait Game<E, R>: Update<()> + Render<R> + EventHandler<E> {
    fn should_exit(&self) -> bool;
    fn target_time_per_frame(&self) -> Duration;
    fn init_render(&self) -> R;
}

An abstract game that is handled by GameHandler

Required Methods

fn should_exit(&self) -> bool

Whether the execution of the game should terminate. This should be handled by the game handler.

fn target_time_per_frame(&self) -> Duration

The amount of time that should be spent on each frame This is the inverse of FPS: 1/FPS (frames per second)

fn init_render(&self) -> R

Initializes rendering

Implementors