RectangleShape

A resizable rectangle containing a texture.

Constructors

this
this()

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Functions

create
void create()

Creates a new mesh after disposing the old mesh.

draw
void draw(IRenderTarget target, ShaderProgram shader = null)

Sets the current transformation matrix and draws this onto the target.

Properties

size
vec2 size [@property getter]

Property for the size of the rectangle.

texCoords
vec4 texCoords [@property getter]

Property for begin xy and end xy using a vec4 for texture coordinates.

valid
bool valid [@property getter]

Returns if the mesh is valid.

Static functions

create
RectangleShape create(vec2 position, vec2 size)
create
RectangleShape create(Texture texture, vec2 position, vec2 size)
create
RectangleShape create(Texture texture, vec2 position, vec2 size, vec4 texCoords)

Examples

1 auto rect = new RectangleShape();
2 rect.size = vec2(100, 50); // 100x50 px
3 rect.create();
4 window.draw(rect);
5 
6 // OR
7 
8 auto rect = RectangleShape.create(vec2(0, 0), vec2(100, 50)); // At 0,0 with size 100x50 px
9 window.draw(rect);

Meta