View on GitHub

DSFML

dsfml.graphics.vertexarray



class VertexArray: dsfml.graphics.drawable.Drawable;
Define a set of one or more 2D primitives.

VertexArray is a very simple wrapper around a dynamic array of vertices and a primitives type.

It inherits Drawable, but unlike other drawables it is not transformable.

Authors:
Laurent Gomila, Jeremy DeHaan

See Also:


http:
//www.sfml-dev.org/documentation/2.0/classsf_1_1VertexArray.php#details

PrimitiveType primitiveType;
The type of primitive to draw.

Can be any of the following: - Points - Lines - Triangles - Quads

The default primitive type is Points.

FloatRect getBounds();
Compute the bounding rectangle of the vertex array.

This function returns the axis-aligned rectangle that contains all the vertices of the array.

Returns:
Bounding rectangle of the vertex array.

uint getVertexCount();
Return the vertex count.

Returns:
Number of vertices in the array

void append(Vertex newVertex);
Add a vertex to the array.

Params:
vertex Vertex to add.

void clear();
Clear the vertex array.

This function removes all the vertices from the array. It doesn't deallocate the corresponding memory, so that adding new vertices after clearing doesn't involve reallocating all the memory.

void draw(RenderTarget renderTarget, RenderStates renderStates);
Draw the object to a render target.

Params:
RenderTarget renderTarget Render target to draw to
RenderStates renderStates Current render states

void resize(uint length);
Resize the vertex array.

If vertexCount is greater than the current size, the previous vertices are kept and new (default-constructed) vertices are added. If vertexCount is less than the current size, existing vertices are removed from the array.

Params:
vertexCount New size of the array (number of vertices).