Struct lux::graphics::UniformSpriteSheet [] [src]

pub struct UniformSpriteSheet {
    pub sprite: Sprite,
    // some fields omitted
}

A uniform sprite sheet is a sprite sheet that is broken up into a grid of equally sized sub-sprites.

A UniformSpriteSheet can be obtained by calling as_uniform_sprite_sheet on a Sprite object.

Fields

sprite

The sprite that this sprite sheet indexes into

Methods

impl UniformSpriteSheet

A sprite sheet that that is laid out in a grid where every grid is the same height and width.

fn num_divs(&self) -> (u32, u32)

Returns the number of divisions made in the x and y direction.

fn get(&self, x: u32, y: u32) -> Sprite

Gets the sprite that is in the (x, y) position in the grid defined by this sprite sheet.

Failure

Fails if out of bounds.

fn get_opt(&self, x: u32, y: u32) -> Option<Sprite>

Same as get but returns None instead of failing if the sprite is out of bounds.

Trait Implementations

Derived Implementations

impl Debug for UniformSpriteSheet

fn fmt(&self, __arg_0: &mut Formatter) -> Result

impl Clone for UniformSpriteSheet

fn clone(&self) -> UniformSpriteSheet

fn clone_from(&mut self, source: &Self)