Shape

Base class for textured shapes with outline.

Shape is a drawable class that allows to define and display a custom convex shape on a render target.

It's only an abstract base, it needs to be specialized for concrete types of shapes (circle, rectangle, convex polygon, star, ...).

In addition to the attributes provided by the specialized shape classes, a shape always has the following attributes: - a texture - a texture rectangle - a fill color - an outline color - an outline thickness

Each feature is optional, and can be disabled easily: - the texture can be null - the fill/outline colors can be sf::Color::Transparent - the outline thickness can be zero

You can write your own derived shape class, there are only two virtual functions to override: - getPointCount must return the number of points of the shape - getPoint must return the points of the shape

Constructors

this
this()
Undocumented in source.

Members

Functions

draw
void draw(RenderTarget renderTarget, RenderStates renderStates)

Draw the shape to a render target.

getGlobalBounds
FloatRect getGlobalBounds()

Get the global bounding rectangle of the entity.

getLocalBounds
FloatRect getLocalBounds()

Get the local bounding rectangle of the entity.

getPoint
Vector2f getPoint(uint index)

Get a point of the shape.

getTexture
const(Texture) getTexture()

Get the source texture of the shape.

setTexture
void setTexture(const(Texture) texture, bool resetRect)

Change the source texture of the shape.

update
void update()

Recompute the internal geometry of the shape.

Mixins

__anonymous
mixin NormalTransformable
Undocumented in source.

Properties

fillColor
Color fillColor [@property setter]

The fill color of the shape.

fillColor
Color fillColor [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
outlineColor
Color outlineColor [@property setter]

The outline color of the shape.

outlineColor
Color outlineColor [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
outlineThickness
float outlineThickness [@property setter]

The thickness of the shape's outline.

outlineThickness
float outlineThickness [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
pointCount
uint pointCount [@property getter]

Get the total number of points in the shape.

textureRect
IntRect textureRect [@property setter]

The sub-rectangle of the texture that the shape will display.

textureRect
IntRect textureRect [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Mixed In Members

From mixin NormalTransformable

origin
Vector2f origin [@property setter]

The local origin of the object.

origin
Vector2f origin [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
position
Vector2f position [@property setter]

The position of the object. The default is (0, 0).

position
Vector2f position [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
rotation
float rotation [@property setter]

The orientation of the object, in degrees. The default is 0 degrees.

rotation
float rotation [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
scale
Vector2f scale [@property setter]

The scale factors of the object. The default is (1, 1).

scale
Vector2f scale [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
getInverseTransform
const(Transform) getInverseTransform()

Get the inverse of the combined transform of the object.

getTransform
const(Transform) getTransform()

Get the combined transform of the object.

move
void move(Vector2f offset)

Move the object by a given offset.

Inherited Members

From Drawable

draw
void draw(RenderTarget renderTarget, RenderStates renderStates)

Draw the object to a render target.

From Transformable

origin
Vector2f origin [@property setter]

The local origin of the object.

origin
Vector2f origin [@property getter]
Undocumented in source.
position
Vector2f position [@property setter]

The position of the object. The default is (0, 0).

position
Vector2f position [@property getter]
Undocumented in source.
rotation
float rotation [@property setter]

The orientation of the object, in degrees. The default is 0 degrees.

rotation
float rotation [@property getter]
Undocumented in source.
scale
Vector2f scale [@property setter]

The scale factors of the object. The default is (1, 1).

scale
Vector2f scale [@property getter]
Undocumented in source.
getTransform
const(Transform) getTransform()

Get the inverse of the combined transform of the object.

getInverseTransform
const(Transform) getInverseTransform()

Get the combined transform of the object.

move
void move(Vector2f offset)

Move the object by a given offset.

See Also

Meta

Authors

Laurent Gomila, Jeremy DeHaan