Shape

Shape defines a drawable geometric shape.

Constructors

this
this(Geometry geo)

CTor

this
this(Geometry geo, Vertex[] vertices)

CTor

this
this(size_t radius, const Vector2f center, size_t vecNum = 30)

CTor for circles

Members

Enums

Fill
enum Fill

Defines how the Shape should be filled.

Functions

append
void append(ref const Vertex vertex)

Stores a Vertex

append
void append(const Vector2f vec)

Stores a Vertex

append
void append(Vertex[] vertices)

Stores multiple Vertices

clear
void clear()

Clear all Vertices but preserve the storage and capacity

getClipRect
Rect getClipRect()

Returns the clip Rect

getTexture
inout(Texture*) getTexture()

Returns the current texture or null

getVertexRect
Rect getVertexRect()

Returns the Rect which contains all vertices

getVertices
inout(Vertex[]) getVertices()

Returns all Vertices

setColor
void setColor(const Color4b col)

Set the color of <b>all</b> Vertices

setTexture
void setTexture(Texture* texture)

Set or reset a Texture

setTexture
void setTexture(Texture* texture, const Rect rect)

Set (or reset) a Texture and set the corresponding Rect

setTextureRect
void setTextureRect(const Rect rect)

Set the corresponding Texture Rect

Variables

antiAliasing
bool antiAliasing;

Optional anti-alias for lines thicker than 1. Default is false.

fill
Fill fill;

Fill option. Default is Fill.Full

geometry
Geometry geometry;

The geometric type of the shape

lineWidth
ubyte lineWidth;

Option for the line width. Default is 1

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)