rotate_sprite(3)
π rotate_sprite β ok bestie, let's SPIN π
so this is rotate_sprite, and it lives in the Allegro game programming library, which is iconic of it. it's a <hotpink>man(3)</hotpink> page, iykyk π
β¨ SYNOPSIS β¨
#include <allegro.h>
void rotate_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y, fixed
angle);
like yes, she takes four args plus a bitmap, we'll get there π«Ά
π¦ DESCRIPTION π¦
okay so here's the tea: rotate_sprite draws the sprite image onto the bmp bitmap. the sprite gets placed with its top left corner at the position you specify, and then it gets rotated by the angle you specify around its centre. centre. of the sprite. yes girl, that's the pivot. π
now the angle β and this is the part where people get confused, so listen up β it's a fixed point 16.16 number, in the exact same format used by the fixed point trig routines. so:
256= a full circle π64= a right angle- etc. (you get the pattern, bestie, it's just dividing the circle into 256 slices)
and the way that all the rotation functions work? they can draw between any two bitmaps β even screen bitmaps, even bitmaps with totally different color depths. no cap. she does not care about your vibes mismatch. π
last thing: if you keep adding positive increments to the angle, the sprite rotates clockwise on the screen. the Allegro example demonstrates this, so go look at it if you want to see it in action. β
ngl the fixed point angle thing trips everyone up the first time. 256 = full circle. tattoo it on your brain. π§ β¨
πΈ SEE ALSO πΈ
go read these next, they're all part of the same rotation-and-pivot cinematic universe π
draw_sprite(3)rotate_scaled_sprite(3)rotate_sprite_v_flip(3)rotate_scaled_sprite_v_flip(3)pivot_sprite(3)pivot_sprite_v_flip(3)pivot_scaled_sprite(3)pivot_scaled_sprite_v_flip(3)itofix(3)exsprite(3)
ok that's the whole page, we ate and left no crumbs π this was Allegro, version 4.4.3, and the page itself is rotate_sprite(3) β love her, follow her, she's the moment ππ
mwah, study hard bestie ππ
π¦ 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