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

Go to the source code of this file.

## Functions
sfVertexArray * | sfVertexArray_create (void)
| Create a new vertex array.
sfVertexArray * | sfVertexArray_copy (const sfVertexArray *vertexArray)
| Copy an existing vertex array.
void | sfVertexArray_destroy (const sfVertexArray *vertexArray)
| Destroy an existing vertex array.
size_t | sfVertexArray_getVertexCount (const sfVertexArray *vertexArray)
| Return the vertex count of a vertex array.
sfVertex * | sfVertexArray_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 (const sfVertexArray *vertexArray)
| Get the type of primitives drawn by a vertex array.
sfFloatRect | sfVertexArray_getBounds (const 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

  vertexArray | Vertex array object
  vertex | Vertex 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

  vertexArray | Vertex array object

## ◆ sfVertexArray_copy()

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

Copy an existing vertex array.

Parameters

  vertexArray | Vertex 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 | ( | const sfVertexArray * | vertexArray | ) |

Destroy an existing vertex array.

Parameters

  vertexArray | Vertex array to delete

## ◆ sfVertexArray_getBounds()

sfFloatRect sfVertexArray_getBounds | ( | const 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 object

Returns
  Bounding rectangle of the vertex array

## ◆ sfVertexArray_getPrimitiveType()

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

Get the type of primitives drawn by a vertex array.

Parameters

  vertexArray | Vertex array object

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

  vertexArray | Vertex array object
  index | Index 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

  vertexArray | Vertex 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

  vertexArray | Vertex array object
  vertexCount | New 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

  vertexArray | Vertex array object
  type | Type of primitive