From 1b2825bc0c0203d77a68101714a84797e49c7512 Mon Sep 17 00:00:00 2001 From: xzebra Date: Sat, 6 Feb 2021 01:12:40 +0100 Subject: [PATCH] triangle functions --- raylib/shapes.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/raylib/shapes.go b/raylib/shapes.go index 2bdf435..cf3dc12 100644 --- a/raylib/shapes.go +++ b/raylib/shapes.go @@ -281,6 +281,22 @@ func DrawTriangleLines(v1, v2, v3 Vector2, color Color) { C.DrawTriangleLines(*cv1, *cv2, *cv3, *ccolor) } +// DrawTriangleFan - Draw a triangle fan defined by points +func DrawTriangleFan(points []Vector2, color Color) { + cpoints := (*C.Vector2)(unsafe.Pointer(&points[0])) + cpointsCount := (C.int)(int32(len(points))) + ccolor := color.cptr() + C.DrawTriangleLines(*cpoints, cpointsCount, *ccolor) +} + +// DrawTriangleStrip - Draw a triangle strip defined by points +func DrawTriangleStrip(points []Vector2, color Color) { + cpoints := (*C.Vector2)(unsafe.Pointer(&points[0])) + cpointsCount := (C.int)(int32(len(points))) + ccolor := color.cptr() + C.DrawTriangleStrip(*cpoints, cpointsCount, *ccolor) +} + // DrawPoly - Draw a regular polygon (Vector version) func DrawPoly(center Vector2, sides int32, radius, rotation float32, color Color) { ccenter := center.cptr()