Module camera

Module camera 

Source
Expand description

This contains a simple 2D camera that can be used to transform the world.

    fn render<'pass, 'others>(
        &'others mut self,
        mut render_handle: RenderInformation<'pass, 'others>,
    ) where
    'others: 'pass,
    {
        self.material.add_rectangle(Vec2 { x: 0.0, y: 0.0 }, Vec2{x: 300.0, y: 300.0}, Colour::WHITE, &render_handle);
        // Draws objects with a cameras transform
        self.camera.set_active(&mut render_handle);
        self.material.draw(&mut render_handle);
        // Resets back to the default camera great for static elements like a HUD or UI
        render_handle.reset_camera();
        self.text.add_instance(vec2!(0.0), Colour::WHITE, &render_handle);
        self.text.draw(&mut render_handle);
}

Structsยง

Camera
A simple 2D camera that can translate, rotate, and scale everything on the screen.