RectangleShape

A resizable rectangle containing a texture.

Constructors

this
this()

Destructor

~this
~this()
Undocumented in source.

Members

Functions

create
void create()

Creates a new mesh after disposing the old mesh.

dispose
void dispose()
Undocumented in source. Be warned that the author may not have intended to support it.
draw
void draw(IRenderTarget target, ShaderProgram shader)

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)

Variables

_mesh
Mesh _mesh;
Undocumented in source.
_size
vec2 _size;
Undocumented in source.
_texCoords
vec4 _texCoords;
Undocumented in source.

Examples

auto rect = new RectangleShape();
rect.size = vec2(100, 50); // 100x50 px
rect.create();
window.draw(rect);

// OR

auto rect = RectangleShape.create(vec2(0, 0), vec2(100, 50)); // At 0,0 with size 100x50 px
window.draw(rect);

Meta