[−][src]Struct blaze_rs::dynamic::SpriteBatch
Defines a dynamic sprite batching object.
Designed for moving sprites. The sprites are batched into several configurable buckets which use VAOs (vertex array objects) and are drawn sorted by their texture to minimize texture state changes and increase performance. The VAOs are double-buffered by default, so they can be pushed faster without waiting for GPU to synchronize.
Methods
impl<'s> SpriteBatch<'s>
[src]
pub fn new(options: SpriteBatchOpts) -> Result<SpriteBatch<'s>, String>
[src]
Creates a new SpriteBatch object using specified parameters.
pub fn draw<'t: 's>(
&self,
texture: &'t Texture,
position: Vector2,
srcRectangle: Option<Rectangle>,
rotationInRadians: f32,
origin: Option<Vector2>,
scale: Option<Vector2>,
color: Color,
flip: SpriteFlip
) -> CallResult
[src]
&self,
texture: &'t Texture,
position: Vector2,
srcRectangle: Option<Rectangle>,
rotationInRadians: f32,
origin: Option<Vector2>,
scale: Option<Vector2>,
color: Color,
flip: SpriteFlip
) -> CallResult
Pushes a sprite into the batch using the specified parameters. Returns error if the batch limits are reached.
Parameters
texture
- Sprite texture
position
- Position of the sprite (top-left corner if origin is NULL)
srcRectangle
- Part of the source texture to draw defined in pixels, or NULL if the whole texture should be drawn
rotation
- Rotation of the sprite in clockwise direction in radians
origin
- The point around which the sprite should be positioned and rotated, if NULL, top-left corner (0, 0) will be used
scale
- Scale in X and Y directions, if NULL, defaults to (1,1)
color
- Color to apply to the sprite (color gets multiplied if default shader is used)
effects
- Defines if the sprite should be flipped in any direction
pub fn lower_draw<'t: 's>(
&self,
texture: &'t Texture,
quad: &SpriteQuad
) -> CallResult
[src]
&self,
texture: &'t Texture,
quad: &SpriteQuad
) -> CallResult
Lower-level drawing function, which allows specifying a custom quad to be drawn. Used internally by the library.
pub fn present(&self) -> CallResult
[src]
Flushes the batch onto the screen, drawing everything.
pub fn get_options(&self) -> &SpriteBatchOpts
[src]
Returns options which were used when this object was created.
Trait Implementations
impl<'a> Drop for SpriteBatch<'a>
[src]
Auto Trait Implementations
impl<'a> !Send for SpriteBatch<'a>
impl<'a> !Sync for SpriteBatch<'a>
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,