al_draw_rotated_bitmap(3alleg5)
β¨ NAME β¨
al_draw_rotated_bitmap β like, the Allegro 5 API function that spins your bitmap around π« (this one lives in the Allegro 5 API, bestie, section 3 of the manual, iykyk)
π SYNOPSIS π
#include <allegro5/allegro.h>
void al_draw_rotated_bitmap(ALLEGRO_BITMAP *bitmap,
float cx, float cy, float dx, float dy, float angle, int flags)
π¦ DESCRIPTION π¦
okay so this one draws a rotated version of the bitmap you hand it, onto the target bitmap. The rotation is by angle radians, and it goes clockwise, no cap π
Here's the tea: the point at cx/cy β measured relative to the upper left corner of the bitmap β is the point that gets drawn at dx/dy, and the whole bitmap rotates around it. So if cx,cy is 0,0, your bitmap spins around its upper left corner. That's it, that's the mechanic π
cxβ center x, and it's relative to the bitmap, not the screencyβ center y, same deal, relative to the bitmapdxβ destination x, where the party actually landsdyβ destination y, fr frangleβ the angle you're rotating by, in radiansflagsβ literally the same as foral_draw_bitmap(3alleg5), nothing new here
πΈ Example πΈ
float w = al_get_bitmap_width(bitmap);
float h = al_get_bitmap_height(bitmap);
al_draw_rotated_bitmap(bitmap, w / 2, h / 2, x, y, ALLEGRO_PI / 2, 0);
So what that little cutie above is doing: it draws the bitmap centered on x/y and rotates it 90Β° clockwise. Iconic behaviour, honestly β¨
Heads up bestie β go read al_draw_bitmap(3alleg5) for a note on restrictions on which bitmaps can be drawn where. Don't skip it, it's giving important π
π SEE ALSO π
al_draw_bitmap(3alleg5)al_draw_bitmap_region(3alleg5)al_draw_scaled_bitmap(3alleg5)al_draw_scaled_rotated_bitmap(3alleg5)
and that's the whole page, bestie π this was the Allegro reference manual dropping al_draw_rotated_bitmap(3alleg5) for you β go rotate something slay, ily, bye π«Ά
π¦ where this page comes from
- debian trixie: allegro5-doc 2:5.2.10.1+dfsg-1 Β· Zlib
- ubuntu questing: allegro5-doc 2:5.2.10.1+dfsg-1build1
- ubuntu resolute: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- ubuntu stonking: allegro5-doc 2:5.2.11.3+dfsg-1 Β· Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms