Sprite

Sprite represents a drawable object and maintains a Texture

Constructors

this
this(Texture tex)

CTor

this
this(Texture tex, Vector2f pos)

CTor

Members

Functions

_adjustTextureRect
void _adjustTextureRect()
Undocumented in source. Be warned that the author may not have intended to support it.
_updateVertices
void _updateVertices()
Undocumented in source. Be warned that the author may not have intended to support it.
draw
void draw(Window wnd)
Undocumented in source. Be warned that the author may not have intended to support it.
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(Color4b col)

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

setTexture
void setTexture(Texture tex)

Reset the Texture

setTextureRect
void setTextureRect(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.

Variables

_texRect
Rect _texRect;
Undocumented in source.
_texture
Texture* _texture;
Undocumented in source.
_vertices
Vertex[4] _vertices;
Undocumented in source.

Inherited Members

From Transformable

_notifyTransform
void _notifyTransform()
Undocumented in source. Be warned that the author may not have intended to support it.
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(Vector2f pos)

Sets the position

move
void move(float x, float y)

Move the position by offset (x, y)

move
void move(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(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(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(Vector2f offset)

Sets the scaling (for both, x and y)

scale
void scale(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(Window )

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

Meta

Authors

Randy Schuett (rswhite4@googlemail.com)