rotate_sprite_lit(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

πŸ’– rotate_sprite_lit β€” the manual page, but make it make sense πŸ’–

okay so bestie, we're in the Allegro manual (game programming library, iconic, no notes) and today's main character is rotate_sprite_lit. it spins your sprite. around its centre. with lighting. slay. ✨


🌸 SYNOPSIS 🌸

first things first, you gotta bring in the header, obviously:

#include <allegro.h>

and here's the signature, copy it exactly bestie, no typos:

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

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does it actually do. it draws the sprite image onto the bitmap. simple. but here's the twist: it gets placed with its top left corner at the specified position, and then it's rotated by the specified angle around its centre. yes, around the centre. not the corner. the centre. the way that it pivots from the middle is honestly so main character of it. πŸ’…

now the angle. this is a fixed point 16.16 number, and it's in the exact same format the fixed point trig routines use. so:

  • 256 = a full circle 🌈
  • 64 = a right angle
  • etc., you get the vibe, iykyk

also!!! every single rotation function can draw between any two bitmaps β€” even screen bitmaps, even bitmaps of different color depth. that's so flexible of them honestly, we love a function with range. πŸ‘‘

and the direction: positive increments of the angle make the sprite rotate clockwise on the screen. that's literally demonstrated by the Allegro example, so if you wanna see it in action, go peek. clockwise, bestie, don't come for me. πŸ”₯


πŸ’œ SEE ALSO πŸ’œ

go read these next, they're all part of the rotation/pivot cinematic universe:


and that's the whole page, babe. no cap. go rotate something. 🫢

this lil love letter to rotate_sprite_lit comes straight from Allegro, version 4.4.3, dated with all the rotate_sprite_lit(3) energy a girl could ask for. mwah. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from