rotate_sprite_trans(3alleg4)

✨ rotate_sprite_trans ✨

okay bestie, welcome to the Allegro manual β€” this one's a sprite-spinning banger from the Allegro game programming library, and yes it's as cute as it sounds πŸŒ€πŸ’–


🌸 SYNOPSIS 🌸

#include <allegro.h>

void rotate_sprite_trans(BITMAP *bmp, BITMAP *sprite,
int x, int y, fixed angle);

πŸ¦‹ DESCRIPTION πŸ¦‹

so what this does is draw the sprite image onto the bitmap. simple. iconic. but here's the twist β€” it drops that sprite in with its top left corner at the position you specified, and then rotates it by the angle you gave, spinning it around its centre. like, it's giving pirouette πŸ’…

the angle is a fixed point 16.16 number, same format the fixed point trig routines use. the math is giving:

  • 256 = a full circle 🎑
  • 64 = a right angle πŸ“
  • etc. iykyk

and here's the lowkey amazing part: all rotation functions can draw between any two bitmaps β€” even screen bitmaps, even bitmaps of different color depth. no cap. it does not care, it will simply slay across depths 🌈✨

positive increments of the angle will make the sprite rotate clockwise on the screen β€” as demonstrated by the Allegro example, go look at it, it's adorable fr fr πŸŽ€


πŸ’œ SEE ALSO πŸ’œ


go read exsprite(3alleg4) if you want the full rotating-sprite cinematic universe, bestie 🫢

okay that's the whole page, you ate it πŸ’– this was Allegro version 4.4.3, brought to you with love from the rotate_sprite_trans(3alleg4) girlies β€” stay spinnin' πŸ¦‹β­πŸŽ€