Text

Text defines a graphical 2D text, that can be drawn on screen.

Constructors

this
this(ref Font fnt, string str = null)

CTor

Members

Functions

format
void format(string text, Args args)

Format a given string by using std.string.format. Therefore the formating pattern is identical.

getFont
inout(Font*) getFont()

Returns a pointer to the current Font

getText
string getText()

Returns the current text

getTexture
inout(Texture*) getTexture()

Returns the used Texture which contains the last rendered Text

opBinary
Text opBinary(string text)

Concatenate the current string with another.

setData
void setData(T data)

Set or reset the current text by using std.conv.to!(string) if the data is not a string

setFont
void setFont(ref Font fnt)

Set or reset the current Font

update
void update()

Update the Texture and redraw the text, if necessary. This method is called automatically if the Text is drawn onto the Window. But if you need specific informations (e.g. width/height) before the draw call, you can call the method by yourself.

Properties

height
uint height [@property getter]

Returns the height

width
uint width [@property getter]

Returns the width

Variables

background
Color4b background;

The background color. Default is Color4b.White.

foreground
Color4b foreground;

The foreground color. Default is Color4b.Black.

mode
Font.Mode mode;

The Font mode which is default Font.Mode.Solid.

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)