polygon(3)
β¨ polygon(3) β¨
okay bestie, pop off, we're in the Allegro manual and this page is all about polygon β the lil function that draws a filled polygon π
it lives in the Allegro game programming library, and honestly? iconic.
πΈ NAME πΈ
polygon β draws a filled polygon π Allegro game programming library, periodt.
π¦ SYNOPSIS π¦
#include <allegro.h>
void polygon(BITMAP *bmp, int vertices, const int *points, int color);
π DESCRIPTION π
so the way that this works is: polygon draws a filled polygon with an arbitrary number of corners. no cap, arbitrary β you can have as many corners as your heart desires π«Ά
you pass it the number of vertices, plus an array containing a series of x, y points. and bestie, listen β that array holds a total of vertices*2 values, because every single corner is two lil numbers living their best life side by side π₯°
example, since i know you're a visual learner:
int points[12] = { 50, 50, 100, 100, 100, 150,
50, 200, 0, 150, 0, 100 };
...
clear_to_color(screen, makecol(255, 255, 255));
polygon(screen, 6, points, makecol(0, 0, 0));
see how it's giving six vertices and twelve whole numbers? that's the vertices*2 math doing its thing β¨ clear the screen to white, then draw a black filled hexagon on top. slay.
π SEE ALSO π
triangle(3)β for when three corners is enough πpolygon3d(3)β the 3D main character version πdrawing_mode(3)β how you're drawing itmakecol(3)β where those colors come fromexcamera(3)β camera things, iykyk
aaaand that's the whole page, babe π this was Allegro, version 4.4.3, and polygon(3) said what it said β go draw something cute, mwah πβ¨π¦
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms