Loading...
Searching...
No Matches
VertexArray.h File Reference
#include <SFML/Graphics/Export.h>
#include <SFML/Graphics/PrimitiveType.h>
#include <SFML/Graphics/Rect.h>
#include <SFML/Graphics/Types.h>
#include <SFML/Graphics/Vertex.h>
#include <stddef.h>

Go to the source code of this file.

Functions

sfVertexArraysfVertexArray_create (void)
 Create a new vertex array.
 
sfVertexArraysfVertexArray_copy (const sfVertexArray *vertexArray)
 Copy an existing vertex array.
 
void sfVertexArray_destroy (sfVertexArray *vertexArray)
 Destroy an existing vertex array.
 
size_t sfVertexArray_getVertexCount (const sfVertexArray *vertexArray)
 Return the vertex count of a vertex array.
 
sfVertexsfVertexArray_getVertex (sfVertexArray *vertexArray, size_t index)
 Get access to a vertex by its index.
 
void sfVertexArray_clear (sfVertexArray *vertexArray)
 Clear a vertex array.
 
void sfVertexArray_resize (sfVertexArray *vertexArray, size_t vertexCount)
 Resize the vertex array.
 
void sfVertexArray_append (sfVertexArray *vertexArray, sfVertex vertex)
 Add a vertex to a vertex array array.
 
void sfVertexArray_setPrimitiveType (sfVertexArray *vertexArray, sfPrimitiveType type)
 Set the type of primitives of a vertex array.
 
sfPrimitiveType sfVertexArray_getPrimitiveType (sfVertexArray *vertexArray)
 Get the type of primitives drawn by a vertex array.
 
sfFloatRect sfVertexArray_getBounds (sfVertexArray *vertexArray)
 Compute the bounding rectangle of a vertex array.
 

Function Documentation

◆ sfVertexArray_append()

void sfVertexArray_append ( sfVertexArray vertexArray,
sfVertex  vertex 
)

Add a vertex to a vertex array array.

Parameters
vertexArrayVertex array objet
vertexVertex to add

◆ sfVertexArray_clear()

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
vertexArrayVertex array object

◆ sfVertexArray_copy()

sfVertexArray * sfVertexArray_copy ( const sfVertexArray vertexArray)

Copy an existing vertex array.

Parameters
vertexArrayVertex array to copy
Returns
Copied object

◆ sfVertexArray_create()

sfVertexArray * sfVertexArray_create ( void  )

Create a new vertex array.

Returns
A new sfVertexArray object

◆ sfVertexArray_destroy()

void sfVertexArray_destroy ( sfVertexArray vertexArray)

Destroy an existing vertex array.

Parameters
vertexArrayVertex array to delete

◆ sfVertexArray_getBounds()

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
vertexArrayVertex array objet
Returns
Bounding rectangle of the vertex array

◆ sfVertexArray_getPrimitiveType()

sfPrimitiveType sfVertexArray_getPrimitiveType ( sfVertexArray vertexArray)

Get the type of primitives drawn by a vertex array.

Parameters
vertexArrayVertex array objet
Returns
Primitive type

◆ sfVertexArray_getVertex()

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
vertexArrayVertex array object
indexIndex of the vertex to get
Returns
Pointer to the index-th vertex

◆ sfVertexArray_getVertexCount()

size_t sfVertexArray_getVertexCount ( const sfVertexArray vertexArray)

Return the vertex count of a vertex array.

Parameters
vertexArrayVertex array object
Returns
Number of vertices in the array

◆ sfVertexArray_resize()

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
vertexArrayVertex array objet
vertexCountNew size of the array (number of vertices)

◆ sfVertexArray_setPrimitiveType()

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
vertexArrayVertex array objet
typeType of primitive