Render

Trait Render 

Source
pub trait Render {
    // Required method
    fn render(&self, loc: Vec2, buffer: &mut Buffer) -> Vec2;

    // Provided methods
    fn size(&self) -> Vec2 { ... }
    fn render_clipped(
        &self,
        loc: Vec2,
        clip_size: Vec2,
        buffer: &mut Buffer,
    ) -> Vec2 { ... }
}
Expand description

The main trait that allows for rendering an element at a location to the buffer. Render’s return type is the location the render ended at.

Required Methods§

Source

fn render(&self, loc: Vec2, buffer: &mut Buffer) -> Vec2

Render the object to the buffer at the given location.

Provided Methods§

Source

fn size(&self) -> Vec2

Returns the resulting size of the element

Source

fn render_clipped( &self, loc: Vec2, clip_size: Vec2, buffer: &mut Buffer, ) -> Vec2

Render’s the element into a clipped view, allowing for clipping easily

Trait Implementations§

Source§

impl<R: Render + 'static> From<R> for Box<dyn Render>

Source§

fn from(value: R) -> Self

Converts to this type from the input type.

Implementations on Foreign Types§

Source§

impl Render for &str

Source§

fn render(&self, loc: Vec2, buffer: &mut Buffer) -> Vec2

Source§

fn size(&self) -> Vec2

Source§

fn render_clipped( &self, loc: Vec2, clip_size: Vec2, buffer: &mut Buffer, ) -> Vec2

Source§

impl Render for char

Source§

fn render(&self, loc: Vec2, buffer: &mut Buffer) -> Vec2

Source§

fn size(&self) -> Vec2

Source§

fn render_clipped( &self, loc: Vec2, clip_size: Vec2, buffer: &mut Buffer, ) -> Vec2

Source§

impl Render for String

Source§

fn render(&self, loc: Vec2, buffer: &mut Buffer) -> Vec2

Source§

fn render_clipped( &self, loc: Vec2, clip_size: Vec2, buffer: &mut Buffer, ) -> Vec2

Source§

impl<R: Into<Box<dyn Render>> + Clone> Render for Vec<R>

Source§

fn render(&self, loc: Vec2, buffer: &mut Buffer) -> Vec2

Source§

fn render_clipped( &self, loc: Vec2, clip_size: Vec2, buffer: &mut Buffer, ) -> Vec2

Implementors§