Sprite

Sprite represents a drawable object and maintains a Texture

Constructors

this
this(ref Texture tex)

CTor

this
this(ref Texture tex, const Vector2f pos)

CTor

Members

Functions

getClipRect
Rect getClipRect()

Returns the Clip Rect. The Sprite will notice if a Texture Rect is used or not and will therefore adapt the size of the view automatically

getTexture
inout(Texture*) getTexture()

Returns a pointer to the current Texture

getTextureRect
const(Rect) getTextureRect()

Returns the current Texture Rect

setColor
void setColor(const Color4b col)

Set a Color for the Sprite which is painted over the displayed Texture.

setTexture
void setTexture(ref Texture tex)

Reset the Texture

setTextureRect
void setTextureRect(const Rect texRect)

Set the Texture Rect. With this you can define a specific view of the Texture, so that only this specific view will be drawn.

Inherited Members

From Transformable

getMatrix
const(Matrix4x4) getMatrix()

Returns the current matrix. If any transformations was made, the matrix is updated before

setPosition
void setPosition(float x, float y)

Sets the position

setPosition
void setPosition(const Vector2f pos)

Sets the position

move
void move(float x, float y)

Move the position by offset (x, y)

move
void move(const Vector2f offset)

Move the position by offset (x, y)

getPosition
const(Vector2f) getPosition()

Returns the current position

x
float x [@property getter]

Returns the x coordinate <b>by value</b>

x
float x [@property setter]

Sets a new x coordinate

y
float y [@property getter]

Returns the y coordinate <b>by value</b>

y
float y [@property setter]

Sets a new y coordinate

setRotationCenter
void setRotationCenter(float x, float y)

Sets the center position

setRotationCenter
void setRotationCenter(const Vector2f center)

Sets the center of the rotation

getRotationCenter
const(Vector2f) getRotationCenter()

Returns the current rotation center

setOrigin
void setOrigin(float x, float y)

Sets the origin. The origin is a offset which is added to the position and serves as center position for scaling and rotation.

setOrigin
void setOrigin(const Vector2f origin)

Sets the origin. The origin is a offset which is added to the position and serves as center position for scaling and rotation.

getOrigin
const(Vector2f) getOrigin()

Returns the current origin

setScale
void setScale(float x, float y)

Sets the scaling (for both, x and y)

setScale
void setScale(const Vector2f offset)

Sets the scaling (for both, x and y)

scale
void scale(const Vector2f offset)

Inc-/Decrease the scaling

scale
void scale(float offset)

Inc-/Decrease the scaling

getScale
const(Vector2f) getScale()

Returns the current scaling

setRotation
void setRotation(float rotation)

Set the rotation angle. If not in range of 0 .. 360 it will be set to 0.

rotate
void rotate(float rotation)

Inc-/Decrease the rotation. If the rotation is <b>after</b> that not in range of 0 .. 360 it will be set to 0.

getRotation
float getRotation()

Returns the current rotation

From Drawable

draw
void draw(ref const Window)

Draw method which is called from the Window's draw method

Meta

Authors

Randy Schuett (rswhite4@googlemail.com)