Struct sprite::Sprite [] [src]

pub struct Sprite<I: ImageSize> { /* fields omitted */ }

A sprite is a texture with some properties.

Methods

impl<I: ImageSize> Sprite<I>
[src]

[src]

Crate sprite from a texture

[src]

Create sprite from a rectangle selection of a texture

[src]

Get the sprite's id

[src]

Whether or not the sprite is visible

[src]

Set the sprite's visibility

[src]

Get the sprite's anchor point

The value is normalized. Default value is 0.5, 0.5

[src]

Set the sprite's anchor point

[src]

Get the sprite's position

[src]

Set the sprite's position

[src]

Set the sprite's draw color (tint)

[src]

get the sprite's color.s

[src]

Get the sprite's rotation (in degree)

[src]

Set the sprite's rotation (in degree)

[src]

Get the sprite's scale

[src]

Set the sprite's scale

[src]

Whether or not the sprite is flipped horizontally.

It only flips the texture of the sprite, and not the texture of the sprite’s children.

Also, flipping the texture doesn’t alter the anchor.

If you want to flip the anchor too, and/or to flip the children too use: sprite.scale.x *= -1;

[src]

Flip the sprite

[src]

Whether or not the sprite is flipped vertically.

It only flips the texture of the sprite, and not the texture of the sprite’s children.

Also, flipping the texture doesn’t alter the anchor.

If you want to flip the anchor too, and/or to flip the children too use: sprite.scale.y *= -1;

[src]

Flip the sprite

[src]

Get the sprite's opacity

[src]

Set the sprite's opacity

[src]

Get the sprite's source rectangle

[src]

Set the sprite's source rectangle

[src]

Get the sprite's texture

[src]

Set the sprite's texture

[src]

Add a sprite as the child of this sprite, return the added sprite's id.

[src]

Remove the child by id from this sprite's children or grandchild

[src]

Find the child by id from this sprite's children or grandchild

[src]

Find the child by id from this sprite's children or grandchild, mutability

[src]

Get the sprite's children

[src]

Draw this sprite and its children

[src]

Draw this sprite and its children with color

[src]

Get the sprite's bounding box