Dgame.Graphic.Transformable

« Go back

Bottom


class Transformable;
Transformable is an abstract class which enables his child classes to be transformable which means that they have a position, can be scaled and can be rotated. For that purpose an additional Matrix is used (besides the Vector2f and float components) which maps the transformations.

See:
Matrix4

See:
Vector2f

Author:
Randy Schuett (rswhite4@googlemail.com)

final pure nothrow @nogc ref const(Matrix4x4) getMatrix();
Returns the current matrix. If any transformations was made, the matrix is updated before

final pure nothrow @nogc void setPosition(float x, float y);
Sets the position

final pure nothrow @nogc void setPosition(const Vector2f pos);
Sets the position

final pure nothrow @nogc void move(float x, float y);
Move the position by offset (x, y)

final pure nothrow @nogc void move(const Vector2f offset);
Move the position by offset (x, y)

final const pure nothrow @nogc ref const(Vector2f) getPosition();
Returns the current position

final const pure nothrow @nogc @property float x();
Returns the x coordinate by value

Note:
if you want to change the coordinate, use either move or setPosition

final pure nothrow @nogc @property void x(float cx);
Sets a new x coordinate

final const pure nothrow @nogc @property float y();
Returns the y coordinate by value

Note:
if you want to change the coordinate, use either move or setPosition

final pure nothrow @nogc @property void y(float cy);
Sets a new y coordinate

final pure nothrow @nogc void setRotationCenter(float x, float y);
Sets the center position

Note:
if you use this function with setOrigin, the origin takes the place of the rotation center.

final pure nothrow @nogc void setRotationCenter(const Vector2f center);
Sets the center of the rotation

Note:
if you use this function with setOrigin, the origin takes the place of the rotation center.

final const pure nothrow @nogc ref const(Vector2f) getRotationCenter();
Returns the current rotation center

final pure nothrow @nogc 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.

Note:
If you use this with setRotationCenter the origin will suppress the rotation center and takes it's place.

final pure nothrow @nogc 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.

Note:
If you use this with setRotationCenter the origin will suppress the rotation center and takes it's place.

final const pure nothrow @nogc ref const(Vector2f) getOrigin();
Returns the current origin

final pure nothrow @nogc void setScale(float x, float y);
Sets the scaling (for both, x and y)

final pure nothrow @nogc void setScale(const Vector2f offset);
Sets the scaling (for both, x and y)

final pure nothrow @nogc void scale(const Vector2f offset);
Inc-/Decrease the scaling

final pure nothrow @nogc void scale(float offset);
Inc-/Decrease the scaling

final const pure nothrow @nogc ref const(Vector2f) getScale();
Returns the current scaling

final pure nothrow @nogc void setRotation(float rotation);
Set the rotation angle. If not in range of 0 .. 360 it will be set to 0.

final pure nothrow @nogc void rotate(float rotation);
Inc-/Decrease the rotation. If the rotation is after that not in range of 0 .. 360 it will be set to 0.

final const pure nothrow @nogc float getRotation();
Returns the current rotation


Page generated by Ddoc.

» Dgame.Graphic.Transformable on Github

Top

« Go back