[][src]Struct olc_pixel_game_engine::Sprite

pub struct Sprite { /* fields omitted */ }

Mirror of olc::Sprite. An image represented by a 2D array of olc::Pixel.

Implementations

impl Sprite[src]

pub fn empty() -> Self[src]

Returns a new empty sprite, alias for Sprite::new. This can be used to initialise a sprite instead of using Option.

pub fn new() -> Self[src]

Creates a new empty sprite.

pub fn with_dims(width: i32, height: i32) -> Self[src]

Creates an empty sprite with dimensions width x height.

pub fn from_image(path: &str) -> Result<Self, Error>[src]

Loads a sprite from the image. Returns error if the image could be loaded.

pub fn width(&self) -> i32[src]

Returns width of the sprite.

pub fn height(&self) -> i32[src]

Returns height of the sprite.

pub fn has_data(&self) -> bool[src]

Returns true if sprite has data.

pub fn sample_mode(&self) -> SpriteMode[src]

Returns sample mode for the sprite.

pub fn set_sample_mode(&mut self, mode: SpriteMode)[src]

Sets sample mode.

pub fn get_pixel(&self, x: i32, y: i32) -> Pixel[src]

Returns pixel at (x, y).

pub fn set_pixel(&mut self, x: i32, y: i32, p: Pixel) -> bool[src]

Sets pixel at (x, y).

pub fn sample(&self, x: f32, y: f32) -> Pixel[src]

Samples sprite for x and y, x and y should be between 0.0 and 1.0.

pub fn sample_bl(&self, u: f32, v: f32) -> Pixel[src]

Sample BL for u and v.

Trait Implementations

impl Debug for Sprite[src]

impl Display for Sprite[src]

impl Drop for Sprite[src]

Auto Trait Implementations

impl RefUnwindSafe for Sprite

impl !Send for Sprite

impl !Sync for Sprite

impl Unpin for Sprite

impl UnwindSafe for Sprite

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> ToString for T where
    T: Display + ?Sized
[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.