VertexArray#
Functions
-
sfVertexArray *sfVertexArray_create(void)#
Create a new vertex array.
- Returns:
A new sfVertexArray object
-
sfVertexArray *sfVertexArray_copy(const sfVertexArray *vertexArray)#
Copy an existing vertex array.
- Parameters:
vertexArray – Vertex array to copy
- Returns:
Copied object
-
void sfVertexArray_destroy(sfVertexArray *vertexArray)#
Destroy an existing vertex array.
- Parameters:
vertexArray – Vertex array to delete
-
size_t sfVertexArray_getVertexCount(const sfVertexArray *vertexArray)#
Return the vertex count of a vertex array.
- Parameters:
vertexArray – Vertex array object
- Returns:
Number of vertices in the array
-
sfVertex *sfVertexArray_getVertex(sfVertexArray *vertexArray, size_t index)#
Get access to a vertex by its index.
This function doesn’t check index, it must be in range [0, vertex count - 1]. The behaviour is undefined otherwise.
- Parameters:
vertexArray – Vertex array object
index – Index of the vertex to get
- Returns:
Pointer to the index-th vertex
-
void sfVertexArray_clear(sfVertexArray *vertexArray)#
Clear a 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.
- Parameters:
vertexArray – Vertex array object
-
void sfVertexArray_resize(sfVertexArray *vertexArray, size_t vertexCount)#
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.
- Parameters:
vertexArray – Vertex array objet
vertexCount – New size of the array (number of vertices)
-
void sfVertexArray_append(sfVertexArray *vertexArray, sfVertex vertex)#
Add a vertex to a vertex array array.
- Parameters:
vertexArray – Vertex array objet
vertex – Vertex to add
-
void sfVertexArray_setPrimitiveType(sfVertexArray *vertexArray, sfPrimitiveType type)#
Set the type of primitives of a vertex array.
This function defines how the vertices must be interpreted when it’s time to draw them:
As points
As lines
As triangles
As quads The default primitive type is sfPoints.
- Parameters:
vertexArray – Vertex array objet
type – Type of primitive
-
sfPrimitiveType sfVertexArray_getPrimitiveType(sfVertexArray *vertexArray)#
Get the type of primitives drawn by a vertex array.
- Parameters:
vertexArray – Vertex array objet
- Returns:
Primitive type
-
sfFloatRect sfVertexArray_getBounds(sfVertexArray *vertexArray)#
Compute the bounding rectangle of a vertex array.
This function returns the axis-aligned rectangle that contains all the vertices of the array.
- Parameters:
vertexArray – Vertex array objet
- Returns:
Bounding rectangle of the vertex array