main_game_loop 0.1.0

A game loop with event handling
Documentation

main_game_loop

dependency status

Example usage with some random Engine

fn main() {
	let engine = Engine::new();
	engine.build_game_loop().run::<App>();
}

struct App {
	vbo: VertexBuffer,
	shader: Shader,
}

impl Runnable<Engine> for App {
    fn init(_: &mut GameLoop<Engine>) -> Self {
        Self {
            vbo: VertexBuffer::new(),
			shader: Shader::new(),
        }
    }

    fn draw(&mut self, gl: &mut GameLoop<Engine>, frame: &mut Frame, delta: f32) {
        frame
            .main_render_pass()
            .bind_vbo(&self.vbo)
            .bind_shader(&self.shader)
            .draw(0..6, 0..1);
    }
}