dsfml.graphics.sprite



class Sprite: dsfml.graphics.drawableimpl.Drawableimpl!(sfSprite).Drawableimpl;
Sprite defines a sprite : texture, transformations, color, and draw on screen

See Also:
IDrawable

this();
Default constructor

this(Image img, float left = 0F, float top = 0F, float scaleX = 1F, float scaleY = 1F, float rotation = 0F, Color col = (Color).WHITE);
Construct the sprite from a source image

Params:
Image img Image of the sprite
float left Left coordinate of the sprite (0 by default)
float top Top coordinate of the sprite (0 by default)
float scaleX Horizontal scale (1 by default)
float scaleY Vertical scale (1 by default)
float rotation Orientation, in degrees (0 by default)
Color col Color of the sprite (white by default)

void setImage(Image img);
Change the image of the sprite

Params:
Image img New image

void setSubRect(Rect rect);
Set the sub-rectangle of a sprite inside the source image.

Params:
Rect rect New sub-rectangle

void resize(float width, float height);
Resize the sprite (by changing its scale factors). The default size is defined by the subrect

Params:
float width New width (must be strictly positive)
float height New height (must be strictly positive)

void resize(Vector2!(float) size);
Resize the sprite (by changing its scale factors). The default size is defined by the subrect

Params:
Vector2!(float) size New size (both coordinates must be strictly positive)

void flipX(bool flipped);
Flip the sprite horizontally

Params:
bool flipped True to flip the sprite

void flipY(bool flipped);
Flip the sprite vertically

Params:
bool flipped True to flip the sprite

Image getImage();
Get the source image of the sprite

Returns:
Pointer to the image (can be NULL)

Rect getSubRect();
Get the sub-rectangle of the sprite inside the source image

Returns:
Sub-rectangle

Vector2!(float) getSize();
Get the sprite size

Returns:
Size of the sprite

Color getPixel(uint x, uint y);
Get the color of a given pixel in the sprite

Params:
uint x X coordinate
uint y Y coordinate

Returns:
Color of pixel


Page generated by Ddoc.