[][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 overhead 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.

Implementations

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 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 Clone for SpriteBatch[src]

impl Debug for SpriteBatch[src]

impl Drawable for SpriteBatch[src]

impl PartialEq<SpriteBatch> for SpriteBatch[src]

impl StructuralPartialEq for SpriteBatch[src]

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> Pointable for T

type Init = T

The type for initializers.

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

type Owned = T

The resulting type after obtaining ownership.

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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,