2018-09-22 14:23:26 +00:00
|
|
|
package allg5
|
2017-10-03 18:38:09 +00:00
|
|
|
|
|
|
|
// #include <allegro5/allegro.h>
|
|
|
|
// #include <allegro5/allegro_primitives.h>
|
|
|
|
import "C"
|
2018-08-07 04:59:52 +00:00
|
|
|
import "unsafe"
|
2017-10-03 18:38:09 +00:00
|
|
|
|
2018-06-04 19:16:17 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2017-10-03 18:38:09 +00:00
|
|
|
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))
|
|
|
|
}
|
2017-10-23 09:18:24 +00:00
|
|
|
|
2018-08-07 04:59:52 +00:00
|
|
|
func DrawPolyline(vertices []float32, c Color, thickness float32) {
|
|
|
|
C.al_draw_polyline((*C.float)(unsafe.Pointer(&vertices[0])), 8, C.int(len(vertices)>>1), C.ALLEGRO_LINE_JOIN_ROUND, C.ALLEGRO_LINE_CAP_ROUND, c.color, C.float(thickness), 1)
|
|
|
|
}
|
|
|
|
|
2017-10-23 09:18:24 +00:00
|
|
|
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))
|
|
|
|
}
|
|
|
|
|
2018-06-04 19:16:17 +00:00
|
|
|
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))
|
2017-10-23 09:18:24 +00:00
|
|
|
}
|