CSFML

- Main Page
- Data Structures
- Files

- File List
- Globals

Functions
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>`

Go to the source code of this file.

## Functions

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

## Function Documentation

CSFML_GRAPHICS_API void sfVertexArray_append | ( | sfVertexArray * | vertexArray,
|  | sfVertex | vertex
| ) |  |

Add a vertex to a vertex array array.

Parameters

  vertexArray | Vertex array objet
  vertex | Vertex to add

CSFML_GRAPHICS_API 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

CSFML_GRAPHICS_API sfVertexArray* sfVertexArray_copy | ( | const sfVertexArray * | vertexArray | ) |

Copy an existing vertex array.

Parameters

  vertexArray | Vertex array to copy

Returns
  Copied object

CSFML_GRAPHICS_API sfVertexArray* sfVertexArray_create | ( | void |  | ) |

Create a new vertex array.

Returns
  A new sfVertexArray object

CSFML_GRAPHICS_API void sfVertexArray_destroy | ( | sfVertexArray * | vertexArray | ) |

Destroy an existing vertex array.

Parameters

  vertexArray | Vertex array to delete

CSFML_GRAPHICS_API 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

CSFML_GRAPHICS_API sfPrimitiveType sfVertexArray_getPrimitiveType | ( | sfVertexArray * | vertexArray | ) |

Get the type of primitives drawn by a vertex array.

Parameters

  vertexArray | Vertex array objet

Returns
  Primitive type

CSFML_GRAPHICS_API sfVertex* sfVertexArray_getVertex | ( | sfVertexArray * | vertexArray,
|  | unsigned int | 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

CSFML_GRAPHICS_API unsigned int 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

CSFML_GRAPHICS_API void sfVertexArray_resize | ( | sfVertexArray * | vertexArray,
|  | unsigned int | 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)

CSFML_GRAPHICS_API 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