Sprite

Renders a **Texture** with its own properties.

Constructors

this
this()

Default ctor.

this
this(Sprite sprite)

Copy another sprite.

this
this(Drawable drawable_, Flip flip_)

Default sprite that takes the whole Texture.

this
this(Drawable drawable_, Vec4i clip_, Flip flip_)

Sprite that takes a clipped region of a Texture.

Members

Functions

contain
void contain(Vec2f size_)

Set the sprite's size to contain the specified size.

draw
void draw(Vec2f position)
void draw(Vec2f pivot, float pivotDistance, float pivotAngle)
void draw(Vec2f pivot, Vec2f pivotOffset, float pivotAngle)
drawRotated
void drawRotated(Vec2f position)
drawUnchecked
void drawUnchecked(Vec2f position)

Render the sprite there.

fit
void fit(Vec2f size_)

Set the sprite's size to fit inside the specified size.

isInside
bool isInside(Vec2f position)

Is this inside the sprite region ? \ Note: Does not take angle into account. may not work properly.

opAssign
Sprite opAssign(Drawable drawable_)

Reset the sprite to take the whole specified Texture.

Properties

center
Vec2f center [@property getter]

Get the anchored and scaled center of the sprite.

isValid
bool isValid [@property getter]

Is the drawable loaded ?

Variables

alpha
float alpha;

Alpha

anchor
Vec2f anchor;

Relative center of the sprite.

angle
float angle;

Angle in which the sprite will be rendered.

blend
Blend blend;

Blending algorithm.

clip
Vec4i clip;

Texture region being rendered (the source size).

color
Color color;

Color added to the sprite.

drawable
Drawable drawable;

Texture being used.

flip
Flip flip;

Mirroring property.

scale
Vec2f scale;

Scale of the sprite.

size
Vec2f size;

Size of the sprite.

Meta