Struct ggez::graphics::spritebatch::SpriteBatch
[−]
[src]
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; you need to build with optimizations enabled to really get the
speed boost.
Methods
impl SpriteBatch
[src]
fn new(image: Image) -> Self
[src]
Creates a new SpriteBatch
, drawing with the given image.
fn add(&mut self, param: DrawParam) -> SpriteIdx
[src]
Adds a new sprite to the sprite batch.
Returns a handle with which to modify the sprite using set()
fn set(&mut self, handle: SpriteIdx, param: DrawParam) -> GameResult<()>
[src]
Alters a sprite in the batch to use the given draw params
fn clear(&mut self)
[src]
Removes all data from the sprite batch.
fn into_inner(self) -> Image
[src]
Unwraps the contained Image
fn set_image(&mut self, image: Image) -> Image
[src]
Replaces the contained Image
, returning the old one.
Trait Implementations
impl Debug for SpriteBatch
[src]
impl Drawable for SpriteBatch
[src]
fn draw_ex(&self, ctx: &mut Context, param: DrawParam) -> GameResult<()>
[src]
Actually draws the object to the screen. Read more
fn set_blend_mode(&mut self, mode: Option<BlendMode>)
[src]
Sets the blend mode to be used when drawing this drawable. This overrides the general graphics::set_blend_mode()
. If None
is set, defers to the blend mode set by graphics::set_blend_mode()
. Read more
fn get_blend_mode(&self) -> Option<BlendMode>
[src]
Gets the blend mode to be used when drawing this drawable.
fn draw(&self, ctx: &mut Context, dest: Point2, rotation: f32) -> GameResult<()>
[src]
Draws the drawable onto the rendering target. Read more