Struct tinybit::Viewport [−][src]
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
impl RefUnwindSafe for Viewport
impl Send for Viewport
impl Sync for Viewport
impl Unpin for Viewport
impl UnwindSafe for Viewport
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,