Shape

Shape defines a drawable convex shape. It also defines helper functions to draw simple shapes like lines, rectangles, circles, etc.

Constructors

this
this(Type type, Texture tex)

CTor

Members

Enums

Type
enum Type

Supported shape types.

Functions

_render
void _render()
Undocumented in source. Be warned that the author may not have intended to support it.
_updateTexCoords
void _updateTexCoords()
Undocumented in source. Be warned that the author may not have intended to support it.
append
void append(Vertex vx)

Stores a Vertex for this Shape.

append
void append(Vertex vec)

Rvalue version.

append
void append(Vertex[] vertices)

Stores multiple Vertices for this Shape.

bindTexture
void bindTexture(Texture tex)

Bind (or unbind) a Texture.

calculateCenter
const(Vector2s) calculateCenter()

Calculate, store and return the center point.

fetchTextureRect
inout(ShortRect*) fetchTextureRect()

Returns a pointer to the Texture Rect. With this you can change the existing Rect without setting a new one. You can e.g. collapse the Rect with this method.

fetchVertexAt
inout(Vertex)* fetchVertexAt(uint idx)

Returns a pointer of the Vertex at the given index or null if the index is out of rpoint.

fill
void fill(bool fill)

Activate fill mode. This means the whole shape is drawn and not only the outlines.

forceUpdate
void forceUpdate()

The current shape will be updated.

getBlend
inout(Blend) getBlend()

Returns the current Blend instance, or null.

getLineWidth
ubyte getLineWidth()

Returns the line width.

getSmooth
const(Smooth) getSmooth()

Return the current smooth

getType
Type getType()

Returns the Shape Type.

getVertexAt
const(Vertex) getVertexAt(uint idx)

Returns the Vertex at the given index or throws an exception, if the index is out of rpoint.

getVertices
const(Vertex[]) getVertices()

Returns all Vertex of this Shape.

isFilled
bool isFilled()

Returns if the fill mode is active or not.

remove
void remove(uint index, Vertex* vp)

Remove the Vertex on the specific index. If vp is not null, the droped Vertex is stored there.

setBlend
void setBlend(Blend blend)

Set (or reset) the current Blend instance.

setColor
void setColor(Color col)

Set for <b>all</b> vertices a (new) color.

setColor
void setColor(Color col)

Rvalue version

setLineWidth
void setLineWidth(ubyte width)

Set the line width.

setSmooth
void setSmooth(Smooth.Target sTarget, Smooth.Mode sMode)

Set target and mode of smoothing.

setSmooth
void setSmooth(Smooth smooth)

Set target and mode of smoothing.

setTextureRect
void setTextureRect(ShortRect texRect)

Set a Texture Rect

setTextureRect
void setTextureRect(ShortRect texRect)

Rvalue version

setType
void setType(Type type)

Set or replace the current Shape type.

Static functions

make
Shape make(Type type, float[] mat)

Add an array of floats Note that 3 dimensional coordinate components are expected.

make
Shape make(Type type, Vertex[] vertices)

Make a new Shape object with the given type and vertices.

makeCircle
Shape makeCircle(ubyte radius, Vector2f center, ubyte vecNum)

Make a new Shape object as Circle.

Variables

_blend
Blend _blend;
Undocumented in source.
_isFilled
bool _isFilled;
Undocumented in source.
_lineWidth
ubyte _lineWidth;
Undocumented in source.
_needUpdate
bool _needUpdate;
Undocumented in source.
_smooth
Smooth _smooth;
Undocumented in source.
_tex
Texture _tex;
Undocumented in source.
_texRect
ShortRect _texRect;
Undocumented in source.
_type
Type _type;
Undocumented in source.
_vertices
Vertex[] _vertices;
Undocumented in source.

Inherited Members

From Transformable

_applyTranslation
void _applyTranslation()

Apply translation to the object.

calculateCenter
const(Vector2s) calculateCenter()

Calculate, store and return the center point.

resetTranslation
void resetTranslation()

Reset the translation.

setCenter
void setCenter(Vector2s center)

Set the rotation center.

setCenter
void setCenter(short x, short y)

Set the rotation center.

getCenter
const(Vector2s) getCenter()

Returns the rotation center.

setRotation
void setRotation(short rotAngle)

Set a (new) rotation.

rotate
void rotate(short rotAngle)

Increase/Decrease the rotation.

getRotation
short getRotation()

Returns the current rotation.

setScale
void setScale(float zoom)

Set a new scale.

scale
void scale(float zoom)

Increase/Decrease the scale/zoom.

getScale
float getScale()

Returns the current scale/zoom.

From Drawable

_render
void _render()
Undocumented in source.
render
void render()

Render method

From Blendable

setBlend
void setBlend(Blend blend)

Set (or reset) the current Blend instance.

getBlend
inout(Blend) getBlend()

Returns the current Blend instance, or null.

Meta

Authors

rschuett