[][src]Struct blaze_rs::dynamic::SpriteBatch

pub struct SpriteBatch<'a> { /* fields omitted */ }

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]

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]

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]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.