[−][src]Struct ggez::graphics::spritebatch::SpriteBatch
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]
P: Into<DrawParam>,
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]
P: Into<DrawParam>,
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]
pub fn clone(&self) -> SpriteBatch
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for SpriteBatch
[src]
impl Drawable for SpriteBatch
[src]
pub fn draw(&self, ctx: &mut Context, param: DrawParam) -> GameResult
[src]
pub fn dimensions(&self, _ctx: &mut Context) -> Option<Rect>
[src]
pub fn set_blend_mode(&mut self, mode: Option<BlendMode>)
[src]
pub fn blend_mode(&self) -> Option<BlendMode>
[src]
impl PartialEq<SpriteBatch> for SpriteBatch
[src]
pub fn eq(&self, other: &SpriteBatch) -> bool
[src]
pub fn ne(&self, other: &SpriteBatch) -> bool
[src]
impl StructuralPartialEq for SpriteBatch
[src]
Auto Trait Implementations
impl !RefUnwindSafe for SpriteBatch
[src]
impl Send for SpriteBatch
[src]
impl Sync for SpriteBatch
[src]
impl Unpin for SpriteBatch
[src]
impl !UnwindSafe for SpriteBatch
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,