primitives.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. // acodec
  2. package al
  3. /*
  4. #cgo pkg-config: allegro_primitives-5
  5. #cgo CFLAGS: -I/usr/local/include
  6. #cgo linux LDFLAGS: -lc_nonshared
  7. #include <stdlib.h>
  8. #include <allegro5/allegro.h>
  9. #include <allegro5/allegro_primitives.h>
  10. #include "helpers.h"
  11. */
  12. import "C"
  13. import "runtime"
  14. import "unsafe"
  15. type PrimType C.ALLEGRO_PRIM_TYPE
  16. const (
  17. PRIM_LINE_LIST = PrimType(C.ALLEGRO_PRIM_LINE_LIST)
  18. PRIM_LINE_STRIP = PrimType(C.ALLEGRO_PRIM_LINE_STRIP)
  19. PRIM_LINE_LOOP = PrimType(C.ALLEGRO_PRIM_LINE_LOOP)
  20. PRIM_TRIANGLE_LIST = PrimType(C.ALLEGRO_PRIM_TRIANGLE_LIST)
  21. PRIM_TRIANGLE_STRIP = PrimType(C.ALLEGRO_PRIM_TRIANGLE_STRIP)
  22. PRIM_TRIANGLE_FAN = PrimType(C.ALLEGRO_PRIM_TRIANGLE_FAN)
  23. PRIM_POINT_LIST = PrimType(C.ALLEGRO_PRIM_POINT_LIST)
  24. PRIM_NUM_TYPES = PrimType(C.ALLEGRO_PRIM_NUM_TYPES)
  25. )
  26. const PRIM_MAX_USER_ATTR = C.ALLEGRO_PRIM_MAX_USER_ATTR
  27. type PrimAttr C.ALLEGRO_PRIM_ATTR
  28. const (
  29. PRIM_POSITION = PrimAttr(C.ALLEGRO_PRIM_POSITION)
  30. PRIM_COLOR_ATTR = PrimAttr(C.ALLEGRO_PRIM_COLOR_ATTR)
  31. PRIM_TEX_COORD = PrimAttr(C.ALLEGRO_PRIM_TEX_COORD)
  32. PRIM_TEX_COORD_PIXEL = PrimAttr(C.ALLEGRO_PRIM_TEX_COORD_PIXEL)
  33. PRIM_USER_ATTR = PrimAttr(C.ALLEGRO_PRIM_USER_ATTR)
  34. PRIM_ATTR_NUM = PrimAttr(C.ALLEGRO_PRIM_ATTR_NUM)
  35. )
  36. type PrimStorage C.ALLEGRO_PRIM_STORAGE
  37. const (
  38. PRIM_FLOAT_2 = PrimStorage(C.ALLEGRO_PRIM_FLOAT_2)
  39. PRIM_FLOAT_3 = PrimStorage(C.ALLEGRO_PRIM_FLOAT_3)
  40. PRIM_SHORT_2 = PrimStorage(C.ALLEGRO_PRIM_SHORT_2)
  41. PRIM_FLOAT_1 = PrimStorage(C.ALLEGRO_PRIM_FLOAT_1)
  42. PRIM_FLOAT_4 = PrimStorage(C.ALLEGRO_PRIM_FLOAT_4)
  43. PRIM_UBYTE_4 = PrimStorage(C.ALLEGRO_PRIM_UBYTE_4)
  44. PRIM_SHORT_4 = PrimStorage(C.ALLEGRO_PRIM_SHORT_4)
  45. PRIM_NORMALIZED_UBYTE_4 = PrimStorage(C.ALLEGRO_PRIM_NORMALIZED_UBYTE_4)
  46. PRIM_NORMALIZED_SHORT_2 = PrimStorage(C.ALLEGRO_PRIM_NORMALIZED_SHORT_2)
  47. PRIM_NORMALIZED_SHORT_4 = PrimStorage(C.ALLEGRO_PRIM_NORMALIZED_SHORT_4)
  48. PRIM_NORMALIZED_USHORT_2 = PrimStorage(C.ALLEGRO_PRIM_NORMALIZED_USHORT_2)
  49. PRIM_NORMALIZED_USHORT_4 = PrimStorage(C.ALLEGRO_PRIM_NORMALIZED_USHORT_4)
  50. PRIM_HALF_FLOAT_2 = PrimStorage(C.ALLEGRO_PRIM_HALF_FLOAT_2)
  51. PRIM_HALF_FLOAT_4 = PrimStorage(C.ALLEGRO_PRIM_HALF_FLOAT_4)
  52. )
  53. type LineJoin C.ALLEGRO_LINE_JOIN
  54. const(
  55. LINE_JOIN_NONE = LineJoin(C.ALLEGRO_LINE_JOIN_NONE)
  56. LINE_JOIN_BEVEL = LineJoin(C.ALLEGRO_LINE_JOIN_BEVEL)
  57. LINE_JOIN_ROUND = LineJoin(C.ALLEGRO_LINE_JOIN_ROUND)
  58. LINE_JOIN_MITER = LineJoin(C.ALLEGRO_LINE_JOIN_MITER)
  59. LINE_JOIN_MITRE = LineJoin(C.ALLEGRO_LINE_JOIN_MITRE)
  60. )
  61. type LineCap C.ALLEGRO_LINE_CAP
  62. const(
  63. LINE_CAP_NONE = LineCap(C.ALLEGRO_LINE_CAP_NONE)
  64. LINE_CAP_SQUARE = LineCap(C.ALLEGRO_LINE_CAP_SQUARE)
  65. LINE_CAP_ROUND = LineCap(C.ALLEGRO_LINE_CAP_ROUND)
  66. LINE_CAP_TRIANGLE = LineCap(C.ALLEGRO_LINE_CAP_TRIANGLE)
  67. LINE_CAP_CLOSED = LineCap(C.ALLEGRO_LINE_CAP_CLOSED)
  68. )
  69. type PrimBufferFlags C.ALLEGRO_PRIM_BUFFER_FLAGS
  70. const (
  71. PRIM_BUFFER_STREAM = PrimBufferFlags(C.ALLEGRO_PRIM_BUFFER_STREAM)
  72. PRIM_BUFFER_STATIC = PrimBufferFlags(C.ALLEGRO_PRIM_BUFFER_STATIC)
  73. PRIM_BUFFER_DYNAMIC = PrimBufferFlags(C.ALLEGRO_PRIM_BUFFER_DYNAMIC)
  74. PRIM_BUFFER_READWRITE = PrimBufferFlags(C.ALLEGRO_PRIM_BUFFER_READWRITE)
  75. )
  76. const VERTEX_CACHE_SIZE = C.ALLEGRO_VERTEX_CACHE_SIZE
  77. const PRIM_QUALITY = C.ALLEGRO_PRIM_QUALITY
  78. type VertexElement = C.ALLEGRO_VERTEX_ELEMENT
  79. // Convert from C
  80. func wrapVertexElement(elem C.ALLEGRO_VERTEX_ELEMENT) VertexElement {
  81. return VertexElement(elem)
  82. }
  83. // Convert to C
  84. func (elem VertexElement) toC() C.ALLEGRO_VERTEX_ELEMENT {
  85. return C.ALLEGRO_VERTEX_ELEMENT(elem)
  86. }
  87. // Convert to C
  88. func (elem * VertexElement) toCPointer() * C.ALLEGRO_VERTEX_ELEMENT {
  89. return (* C.ALLEGRO_VERTEX_ELEMENT)(elem)
  90. }
  91. func (elem * VertexElement) Attribute() PrimAttr {
  92. return PrimAttr(elem.toC().attribute)
  93. }
  94. func (elem * VertexElement) Storage() PrimStorage {
  95. return PrimStorage(elem.toC().storage)
  96. }
  97. func (elem * VertexElement) Offset() int {
  98. return int(elem.toC().offset)
  99. }
  100. func (elem * VertexElement) SetAttribute(attribute PrimAttr) {
  101. // celem := elem.toC()
  102. elem.attribute = C.int(attribute)
  103. }
  104. func (elem * VertexElement) SetStorage(storage PrimStorage) {
  105. elem.storage = C.int(storage)
  106. }
  107. func (elem * VertexElement) SetOffset(offset int) {
  108. elem.offset = C.int(offset)
  109. }
  110. func NewVertexElement(attr PrimAttr, store PrimStorage, offset int) *VertexElement {
  111. res := new(VertexElement)
  112. res.SetAttribute(attr)
  113. res.SetStorage(store)
  114. res.SetOffset(offset)
  115. return res
  116. }
  117. type VertexDecl struct {
  118. handle * C.ALLEGRO_VERTEX_DECL
  119. }
  120. // returns low level handle for the vertex declaration
  121. func (vd *VertexDecl) toC() * C.ALLEGRO_VERTEX_DECL {
  122. return vd.handle
  123. }
  124. // Wraps a C Allegro vertex declaration into a VertexDecl Sets no finalizer.
  125. func wrapVertexDeclRaw(handle *C.ALLEGRO_VERTEX_DECL) *VertexDecl {
  126. if handle == nil {
  127. return nil
  128. }
  129. return &VertexDecl{handle}
  130. }
  131. // Wraps a C Allegro vertex declaration. Sets a finalizer that calls Destroy.
  132. func wrapVertexDecl(handle *C.ALLEGRO_VERTEX_DECL) *VertexDecl {
  133. vd := wrapVertexDeclRaw(handle)
  134. if vd != nil {
  135. runtime.SetFinalizer(vd, func(me * VertexDecl) { me.Destroy() })
  136. }
  137. return vd
  138. }
  139. func CreateVertexDecl(gelements []VertexElement, stride int) * VertexDecl {
  140. raw := C.al_create_vertex_decl(&gelements[0], C.int(stride))
  141. return wrapVertexDecl(raw)
  142. }
  143. func (vd * VertexDecl) Destroy() {
  144. if vd.handle != nil {
  145. C.al_destroy_vertex_decl(vd.handle)
  146. }
  147. vd.handle = nil
  148. }
  149. type Vertex = C.ALLEGRO_VERTEX
  150. type VertexBuffer struct {
  151. handle * C.ALLEGRO_VERTEX_BUFFER
  152. }
  153. type IndexBuffer struct {
  154. handle * C.ALLEGRO_INDEX_BUFFER
  155. }
  156. func PrimitivesVersion() uint32 {
  157. return uint32(C.al_get_allegro_primitives_version())
  158. }
  159. func InitPrimitivesAddon() bool {
  160. return bool(C.al_init_primitives_addon())
  161. }
  162. func ShutdownPrimitivesAddon() {
  163. C.al_shutdown_primitives_addon()
  164. }
  165. /*
  166. The generic case is risky due to the GC kicking in, and hard to square with the go type system .For now only support drawing ALLEGRO_VERTICES.
  167. func DrawPrimGeneric(vertices []interface{}, decl * VertexDecl, texture * Bitmap,
  168. start, end int, ptype PrimType) int {
  169. va := make([]unsafe.Pointer, len(vertices))
  170. for i:= 0 ; i < len(vertices); index ++
  171. }
  172. */
  173. func DrawPrim(v []Vertex, texture * Bitmap, start, end int, ptype PrimType) int {
  174. return int(C.al_draw_prim(unsafe.Pointer(&v[0]), nil,
  175. texture.toC(), C.int(start), C.int(end), C.int(ptype)))
  176. }
  177. func DrawIndexedPrim(v []Vertex, indices []int, texture * Bitmap, start, end int, ptype PrimType) int {
  178. return int(C.al_draw_indexed_prim(unsafe.Pointer(&v[0]), nil,
  179. texture.toC(), (* C.int)(unsafe.Pointer(&indices[0])),
  180. C.int(len(indices)), C.int(ptype)))
  181. }
  182. func DrawVertexBuffer(vb * VertexBuffer, texture * Bitmap, start, end int, ptype PrimType) int {
  183. return int(C.al_draw_vertex_buffer(vb.toC(),
  184. texture.toC(), C.int(start), C.int(end), C.int(ptype)))
  185. }
  186. func DrawIndexedBuffer(vb * VertexBuffer, texture * Bitmap, ib * IndexBuffer, start, end int, ptype PrimType) int {
  187. return int(C.al_draw_indexed_buffer(vb.toC(),
  188. texture.toC(), ib.toC(), C.int(start), C.int(end), C.int(ptype)))
  189. }
  190. // returns low level handle for the vertex buffer
  191. func (vb *VertexBuffer) toC() * C.ALLEGRO_VERTEX_BUFFER {
  192. return vb.handle
  193. }
  194. // Wraps a C Allegro vertex buffer. Sets no finalizer.
  195. func wrapVertexBufferRaw(handle *C.ALLEGRO_VERTEX_BUFFER) *VertexBuffer {
  196. if handle == nil {
  197. return nil
  198. }
  199. return &VertexBuffer{handle}
  200. }
  201. // Wraps a C Allegro vertex buffer. Sets a finalizer that calls Destroy.
  202. func wrapVertexBuffer(handle *C.ALLEGRO_VERTEX_BUFFER) *VertexBuffer {
  203. vd := wrapVertexBufferRaw(handle)
  204. if vd != nil {
  205. runtime.SetFinalizer(vd, func(me * VertexBuffer) { me.Destroy() })
  206. }
  207. return vd
  208. }
  209. func CreateVertexBuffer(initial []Vertex, flags PrimBufferFlags) * VertexBuffer {
  210. size := len(initial)
  211. raw := C.al_create_vertex_buffer(nil, unsafe.Pointer(&initial[0]), C.int(size), C.int(flags))
  212. return wrapVertexBuffer(raw)
  213. }
  214. func (vb * VertexBuffer) Destroy() {
  215. if vb.handle != nil {
  216. C.al_destroy_vertex_buffer(vb.handle)
  217. }
  218. vb.handle = nil
  219. }
  220. func (vb * VertexBuffer) Get(offset, length int) []Vertex {
  221. res := make([]Vertex, length)
  222. ptr := C.al_lock_vertex_buffer(vb.toC(), C.int(offset), C.int(length), C.ALLEGRO_LOCK_READONLY)
  223. if (ptr == nil) {
  224. res = nil
  225. } else {
  226. for i := 0; i < length; i ++ {
  227. res[i] = *((*C.ALLEGRO_VERTEX)(unsafe.Pointer(uintptr(ptr) + uintptr(i * C.sizeof_ALLEGRO_VERTEX))))
  228. }
  229. C.al_unlock_vertex_buffer(vb.toC())
  230. }
  231. return res
  232. }
  233. func (vb * VertexBuffer) Set(offset int, v []Vertex) int {
  234. length := len(v)
  235. res := length
  236. ptr := C.al_lock_vertex_buffer(vb.toC(), C.int(offset), C.int(length), C.ALLEGRO_LOCK_READWRITE)
  237. if (ptr == nil) {
  238. res = 0
  239. } else {
  240. for i := 0; i < length; i ++ {
  241. *((*C.ALLEGRO_VERTEX)(unsafe.Pointer(uintptr(ptr) + uintptr(i * C.sizeof_ALLEGRO_VERTEX)))) = v[i]
  242. }
  243. C.al_unlock_vertex_buffer(vb.toC())
  244. }
  245. return res
  246. }
  247. // returns low level handle for the vertex buffer
  248. func (ib *IndexBuffer) toC() * C.ALLEGRO_INDEX_BUFFER {
  249. return ib.handle
  250. }
  251. // Wraps a C Allegro vertex buffer. Sets no finalizer.
  252. func wrapIndexBufferRaw(handle *C.ALLEGRO_INDEX_BUFFER) *IndexBuffer {
  253. if handle == nil {
  254. return nil
  255. }
  256. return &IndexBuffer{handle}
  257. }
  258. // Wraps a C Allegro vertex buffer. Sets a finalizer that calls Destroy.
  259. func wrapIndexBuffer(handle *C.ALLEGRO_INDEX_BUFFER) *IndexBuffer {
  260. ib := wrapIndexBufferRaw(handle)
  261. if ib != nil {
  262. runtime.SetFinalizer(ib, func(me * IndexBuffer) { me.Destroy() })
  263. }
  264. return ib
  265. }
  266. func CreateIndexBuffer(initial []int32, flags PrimBufferFlags) * IndexBuffer {
  267. size := len(initial)
  268. raw := C.al_create_index_buffer(4, unsafe.Pointer(&initial[0]), C.int(size), C.int(flags))
  269. return wrapIndexBuffer(raw)
  270. }
  271. func (ib * IndexBuffer) Destroy() {
  272. if ib.handle != nil {
  273. C.al_destroy_index_buffer(ib.handle)
  274. }
  275. ib.handle = nil
  276. }
  277. func (ib * IndexBuffer) Get(offset, length int) []int32 {
  278. res := make([]int32, length)
  279. ptr := C.al_lock_index_buffer(ib.toC(), C.int(offset), C.int(length), C.ALLEGRO_LOCK_READONLY)
  280. if (ptr == nil) {
  281. res = nil
  282. } else {
  283. for i := 0; i < length; i ++ {
  284. res[i] = int32(*((*C.int)(unsafe.Pointer(uintptr(ptr) + uintptr(i * C.sizeof_int)))))
  285. }
  286. C.al_unlock_index_buffer(ib.toC())
  287. }
  288. return res
  289. }
  290. func (ib * IndexBuffer) Set(offset int, v []int32) int {
  291. length := len(v)
  292. res := length
  293. ptr := C.al_lock_index_buffer(ib.toC(), C.int(offset), C.int(length), C.ALLEGRO_LOCK_READWRITE)
  294. if (ptr == nil) {
  295. res = 0
  296. } else {
  297. for i := 0; i < length; i ++ {
  298. *((*C.int)(unsafe.Pointer(uintptr(ptr) + uintptr(i * C.sizeof_int)))) = C.int(v[i])
  299. }
  300. C.al_unlock_index_buffer(ib.toC())
  301. }
  302. return res
  303. }
  304. /* Callback primitives not implemented due to being a PITA. */
  305. func DrawLine(x1, y1, x2, y2 float32, color Color, thickness float32) {
  306. C.al_draw_line(C.float(x1), C.float(y1),
  307. C.float(x2), C.float(y2),
  308. color.toC(), C.float(thickness))
  309. }
  310. func DrawTriangle(x1, y1, x2, y2, x3, y3 float32, color Color, thickness float32) {
  311. C.al_draw_triangle(C.float(x1), C.float(y1),
  312. C.float(x2), C.float(y2),
  313. C.float(x3), C.float(y3),
  314. color.toC(), C.float(thickness))
  315. }
  316. func DrawRectangle(x1, y1, x2, y2 float32, color Color, thickness float32) {
  317. C.al_draw_rectangle(C.float(x1), C.float(y1),
  318. C.float(x2), C.float(y2),
  319. color.toC(), C.float(thickness))
  320. }
  321. func DrawRoundedRectangle(x1, y1, x2, y2, rx, ry float32, color Color, thickness float32) {
  322. C.al_draw_rounded_rectangle(C.float(x1), C.float(y1),
  323. C.float(x2), C.float(y2),
  324. C.float(rx), C.float(ry),
  325. color.toC(), C.float(thickness))
  326. }
  327. func DrawCircle(cx, cy, r float32, color Color, thickness float32) {
  328. C.al_draw_circle(C.float(cx), C.float(cy),
  329. C.float(r),
  330. color.toC(), C.float(thickness))
  331. }
  332. func DrawEllipse(cx, cy, rx, ry float32, color Color, thickness float32) {
  333. C.al_draw_ellipse(C.float(cx), C.float(cy),
  334. C.float(rx), C.float(ry),
  335. color.toC(), C.float(thickness))
  336. }
  337. func DrawPieSlice(cx, cy, r, start, delta float32, color Color, thickness float32) {
  338. C.al_draw_pieslice(C.float(cx), C.float(cy),
  339. C.float(r),
  340. C.float(start), C.float(delta),
  341. color.toC(), C.float(thickness))
  342. }
  343. func DrawPolygon(vertices []float32, join LineJoin, color Color, thickness float32, miter_limit float32) {
  344. C.al_draw_polygon((*C.float)(&vertices[0]), C.int(len(vertices)/2), C.int(join),
  345. color.toC(), C.float(thickness),
  346. C.float(miter_limit))
  347. }
  348. func DrawArc(cx, cy, r, start, delta float32, color Color, thickness float32) {
  349. C.al_draw_arc(C.float(cx), C.float(cy),
  350. C.float(r),
  351. C.float(start), C.float(delta),
  352. color.toC(), C.float(thickness))
  353. }
  354. func DrawEllipticalArc(cx, cy, rx, ry, start, delta float32, color Color, thickness float32) {
  355. C.al_draw_elliptical_arc(C.float(cx), C.float(cy),
  356. C.float(rx), C.float(ry),
  357. C.float(start), C.float(delta),
  358. color.toC(), C.float(thickness))
  359. }
  360. func DrawSpline(points [8]float32, color Color, thickness float32) {
  361. C.al_draw_spline((*C.float)(&points[0]),
  362. color.toC(), C.float(thickness))
  363. }
  364. func DrawRibbon(points []float32, stride int, color Color, thickness float32) {
  365. C.al_draw_ribbon((*C.float)(&points[0]), C.int(stride),
  366. color.toC(), C.float(thickness), C.int(len(points)/2))
  367. }
  368. func DrawFilledTriangle(x1, y1, x2, y2, x3, y3 float32, color Color) {
  369. C.al_draw_filled_triangle(C.float(x1), C.float(y1),
  370. C.float(x2), C.float(y2),
  371. C.float(x3), C.float(y3),
  372. color.toC())
  373. }
  374. func DrawFilledRectangle(x1, y1, x2, y2 float32, color Color) {
  375. C.al_draw_filled_rectangle(C.float(x1), C.float(y1),
  376. C.float(x2), C.float(y2),
  377. color.toC())
  378. }
  379. func DrawFilledRectangleInt(x1, y1, x2, y2 int, color Color) {
  380. C.al_draw_filled_rectangle(C.float(x1), C.float(y1),
  381. C.float(x2), C.float(y2),
  382. color.toC())
  383. }
  384. func DrawFilledRoundedRectangle(x1, y1, x2, y2, rx, ry float32, color Color) {
  385. C.al_draw_filled_rounded_rectangle(C.float(x1), C.float(y1),
  386. C.float(x2), C.float(y2),
  387. C.float(rx), C.float(ry),
  388. color.toC())
  389. }
  390. func DrawFilledCircle(cx, cy, r float32, color Color) {
  391. C.al_draw_filled_circle(C.float(cx), C.float(cy),
  392. C.float(r),
  393. color.toC())
  394. }
  395. func DrawFilledEllipse(cx, cy, rx, ry float32, color Color) {
  396. C.al_draw_filled_ellipse(C.float(cx), C.float(cy),
  397. C.float(rx), C.float(ry),
  398. color.toC())
  399. }
  400. func DrawFilledPieSlice(cx, cy, r, start, delta float32, color Color) {
  401. C.al_draw_filled_pieslice(C.float(cx), C.float(cy),
  402. C.float(r),
  403. C.float(start), C.float(delta),
  404. color.toC())
  405. }
  406. func DrawFilledPolygon(vertices []float32, join LineJoin, color Color) {
  407. C.al_draw_filled_polygon((*C.float)(&vertices[0]), C.int(len(vertices)/2), color.toC())
  408. }
  409. func (vert * Vertex) Init(x, y, z, u, v float32, color Color) {
  410. vert.x = C.float(x)
  411. vert.y = C.float(y)
  412. vert.z = C.float(z)
  413. vert.u = C.float(u)
  414. vert.v = C.float(v)
  415. vert.color = color.toC()
  416. }
  417. var later = `
  418. /*
  419. *High level primitives
  420. */
  421. ALLEGRO_PRIM_FUNC(void, al_draw_filled_triangle, (float x1, float y1, float x2, float y2, float x3, float y3, ALLEGRO_COLOR color));
  422. ALLEGRO_PRIM_FUNC(void, al_draw_filled_rectangle, (float x1, float y1, float x2, float y2, ALLEGRO_COLOR color));
  423. ALLEGRO_PRIM_FUNC(void, al_draw_filled_ellipse, (float cx, float cy, float rx, float ry, ALLEGRO_COLOR color));
  424. ALLEGRO_PRIM_FUNC(void, al_draw_filled_circle, (float cx, float cy, float r, ALLEGRO_COLOR color));
  425. ALLEGRO_PRIM_FUNC(void, al_draw_filled_pieslice, (float cx, float cy, float r, float start_theta, float delta_theta, ALLEGRO_COLOR color));
  426. ALLEGRO_PRIM_FUNC(void, al_draw_filled_rounded_rectangle, (float x1, float y1, float x2, float y2, float rx, float ry, ALLEGRO_COLOR color));
  427. ALLEGRO_PRIM_FUNC(void, al_draw_polyline, (const float* vertices, int vertex_stride, int vertex_count, int join_style, int cap_style, ALLEGRO_COLOR color, float thickness, float miter_limit));
  428. ALLEGRO_PRIM_FUNC(void, al_draw_polygon, (const float* vertices, int vertex_count, int join_style, ALLEGRO_COLOR color, float thickness, float miter_limit));
  429. ALLEGRO_PRIM_FUNC(void, al_draw_filled_polygon, (const float* vertices, int vertex_count, ALLEGRO_COLOR color));
  430. ALLEGRO_PRIM_FUNC(void, al_draw_filled_polygon_with_holes, (const float* vertices, const int* vertex_counts, ALLEGRO_COLOR color));
  431. #ifdef __cplusplus
  432. }
  433. #endif
  434. #endif
  435. `