Struct macroquad_canvas_2d::Canvas2D[][src]

pub struct Canvas2D {
    pub width: f32,
    pub height: f32,
    // some fields omitted
}

Fields

width: f32height: f32

Implementations

impl Canvas2D[src]

pub fn new(width: f32, height: f32) -> Self[src]

Create a new canvas

pub fn draw_inside_canvas(&self, f: &dyn Fn())[src]

Draw inside of the canvas

pub fn calculate_size_and_padding(
    &self,
    target_width: f32,
    target_height: f32
) -> (f32, f32, Vec2)
[src]

Calculate size and padding of the canvas so it can fit inside of the target and its position is in the center

pub fn calculate_size(&self, target_width: f32, target_height: f32) -> Vec2[src]

Calculate size of the canvas so it can fit inside of the target

pub fn get_texture(&self) -> &Texture2D[src]

Get a reference of the canvas texture

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.