From 5f031fdd204310b1aed5f75ab2e2ed6a0f64016a Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Mon, 4 Jun 2018 21:16:17 +0200 Subject: [PATCH] Added primitives drawing functions. --- allegro5/primitives.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/allegro5/primitives.go b/allegro5/primitives.go index 51fe59a..507c742 100644 --- a/allegro5/primitives.go +++ b/allegro5/primitives.go @@ -4,6 +4,14 @@ package allegro5 // #include import "C" +func DrawFilledRectangle(x1, y1, x2, y2 float32, c Color) { + C.al_draw_filled_rectangle(C.float(x1), C.float(y1), C.float(x2), C.float(y2), c.color) +} + +func DrawFilledTriangle(x1, y1, x2, y2, x3, y3 float32, c Color) { + C.al_draw_filled_triangle(C.float(x1), C.float(y1), C.float(x2), C.float(y2), C.float(x3), C.float(y3), c.color) +} + func DrawLine(x1, y1, x2, y2 float32, c Color, thickness float32) { C.al_draw_line(C.float(x1), C.float(y1), C.float(x2), C.float(y2), c.color, C.float(thickness)) } @@ -12,6 +20,6 @@ func DrawRectangle(x1, y1, x2, y2 float32, c Color, thickness float32) { C.al_draw_rectangle(C.float(x1), C.float(y1), C.float(x2), C.float(y2), c.color, C.float(thickness)) } -func DrawFilledRectangle(x1, y1, x2, y2 float32, c Color) { - C.al_draw_filled_rectangle(C.float(x1), C.float(y1), C.float(x2), C.float(y2), c.color) +func DrawTriangle(x1, y1, x2, y2, x3, y3 float32, c Color, thickness float32) { + C.al_draw_triangle(C.float(x1), C.float(y1), C.float(x2), C.float(y2), C.float(x3), C.float(y3), c.color, C.float(thickness)) }