Struct ggez::graphics::spritebatch::SpriteBatch [−][src]
pub struct SpriteBatch { /* fields omitted */ }
Expand description
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
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.
Adds a new sprite to the sprite batch.
Returns a handle with which to modify the sprite using
set()
Alters a sprite in the batch to use the given draw params
Returns a reference to the sprites.
Returns a mutable reference to the sprites.
Unlike with MeshBatch
, manually calling flush
after altering sprites
in this slice is currently unnecessary, as SpriteBatch
flushes automatically
on every draw call. This might change in the future though.
Unwraps and returns the contained Image
Replaces the contained Image
, returning the old one.
Get the filter mode for the SpriteBatch.
Set the filter mode for the SpriteBatch.
Trait Implementations
Draws the drawable onto the rendering target.
Returns a bounding box in the form of a Rect
. Read more
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
Gets the blend mode to be used when drawing this drawable.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl !RefUnwindSafe for SpriteBatch
impl Send for SpriteBatch
impl Sync for SpriteBatch
impl Unpin for SpriteBatch
impl !UnwindSafe for SpriteBatch
Blanket Implementations
Mutably borrows from an owned value. Read more