[][src]Struct ggez::graphics::spritebatch::SpriteBatch

pub struct SpriteBatch { /* fields omitted */ }

A SpriteBatch draws a number of copies of the same image, using a single draw call.

This is generally faster than drawing the same sprite with many invocations of draw(), though it has a bit of overhead to set up the batch. This makes it run very slowly in debug mode because it spends a lot of time on array bounds checking and un-optimized math; you need to build with optimizations enabled to really get the speed boost.

Methods

impl SpriteBatch[src]

pub fn new(image: Image) -> Self[src]

Creates a new SpriteBatch, drawing with the given image.

Takes ownership of the Image, but cloning an Image is cheap since they have an internal Arc containing the actual image data.

pub fn add<P>(&mut self, param: P) -> SpriteIdx where
    P: Into<DrawParam>, 
[src]

Adds a new sprite to the sprite batch.

Returns a handle with which type to modify the sprite using set()

pub fn set<P>(&mut self, handle: SpriteIdx, param: P) -> GameResult where
    P: Into<DrawParam>, 
[src]

Alters a sprite in the batch to use the given draw params

pub fn clear(&mut self)[src]

Removes all data from the sprite batch.

pub fn into_inner(self) -> Image[src]

Unwraps and returns the contained Image

pub fn set_image(&mut self, image: Image) -> Image[src]

Replaces the contained Image, returning the old one.

pub fn filter(&self) -> FilterMode[src]

Get the filter mode for the SpriteBatch.

pub fn set_filter(&mut self, mode: FilterMode)[src]

Set the filter mode for the SpriteBatch.

Trait Implementations

impl Drawable for SpriteBatch[src]

impl PartialEq<SpriteBatch> for SpriteBatch[src]

impl Clone for SpriteBatch[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for SpriteBatch[src]

Auto Trait Implementations

impl Send for SpriteBatch

impl Sync for SpriteBatch

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.

impl<T> Same for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf for SP where
    SS: SubsetOf<SP>, 

impl<T> Erased for T

impl<T> SetParameter for T

default fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.