Struct tinybit::Viewport[][src]

pub struct Viewport {
    pub position: ScreenPos,
    pub size: ScreenSize,
    // some fields omitted
}

Represents a drawable area on screen.

Fields

position: ScreenPos

The viewport’s position on screen. Where 0,0 is the top left corner

size: ScreenSize

The size of the viewport. Should probably match the size of the camera that is used with this viewport.

Implementations

impl Viewport[src]

pub fn new(position: ScreenPos, size: ScreenSize) -> Self[src]

Create a new viewport with a given screen position.

pub fn resize(&mut self, width: u16, height: u16)[src]

Resize the viewport. Remember to clear the renderer or residual characters might remain.

pub fn draw_pixels(&mut self, pixels: Vec<Pixel>)[src]

Draw the pixels onto the renderable surface layers. This is offset by the camera and the viewport.

pub fn draw_pixel(&mut self, pixel: Pixel)[src]

Draw a single pixel onto the rendereable surface layers. This is called from draw_pixels for each pixel.

This is useful if it’s desired to draw just one pixel.

pub fn draw_widget(&mut self, widget: &impl Widget, offset: ScreenPos)[src]

Draw a widget with an offset in the viewport.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.