Abstraction of VK2DBuffer for shapes.
More...
Go to the source code of this file.
Abstraction of VK2DBuffer for shapes.
- Author
- Paolo Mazzon
◆ vk2dPolygonCreate()
VK2DPolygon vk2dPolygonCreate |
( |
vec2 * |
vertices, |
|
|
uint32_t |
vertexCount |
|
) |
| |
Creates a polygon with specified vertices for drawing (use vk2dRendererSetColourMod to change colours)
- Parameters
-
vertices | List of x/y positions for the polygon's vertices |
vertexCount | Amount of vertices |
- Returns
- Returns either the new polygon or NULL if it failed
- Warning
- Convex polygons only, the triangulation method will likely fail for concave polygons
-
Must have at least 3 vertices
-
While you may use polygons created from this function with vk2dDrawPolygonOutline, it may not look like you expect and for that reason you may want vk2dPolygonCreateOutline for polygons you want to draw outlined
◆ vk2dPolygonCreateOutline()
VK2DPolygon vk2dPolygonCreateOutline |
( |
vec2 * |
vertices, |
|
|
uint32_t |
vertexCount |
|
) |
| |
Creates a polygon made to be rendered as an outline (does not triangulate input)
- Parameters
-
vertices | List of x/y positions for the polygons vertices |
vertexCount | Number of vertices in the list |
- Returns
- Returns either the new polygon or NULL if it failed
- Warning
- It is not possible to draw a polygon made with this function with vk2dRendererDrawPolygon unless its a triangle
-
This function will crash on < 1 vertex
◆ vk2dPolygonFree()
void vk2dPolygonFree |
( |
VK2DPolygon |
polygon | ) |
|
Frees a polygon from memory.
- Parameters
-
◆ vk2dPolygonShapeCreateRaw()
VK2DPolygon vk2dPolygonShapeCreateRaw |
( |
VK2DVertexColour * |
vertexData, |
|
|
uint32_t |
vertexCount |
|
) |
| |
Creates a polygon for the shapes pipeline (should be triangulated)
- Parameters
-
vertexData | Vertex data of the polygon (must be triangulated) |
vertexCount | Number of vertices |
- Returns
- Returns a new polygon
- Warning
- This function is for creating fancier effects with the inner vertex data. Use vk2dPolygonCreate for creating simple shapes
-
Polygon must be triangulated unless it will be drawn as an outline, vk2dPolygonCreate automatically triangulates but this does not.