exalpha(3alleg4)

✨ exalpha ✨

okay bestie, welcome to exalpha, straight out of the Allegro manual (that's the Allegro game programming library, section 3, page exalpha, in case you were wondering which manual we're living in today πŸ’–).


🌸 NAME 🌸

exalpha β€” creating and using 32 bit RGBA sprites πŸ’… from the Allegro game programming library. yes babe, alpha channels, we're doing translucency today, no cap.


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro.h>

Example exalpha

like that's it, that's the whole vibe. one include, one example. iconic.


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea, bestie πŸ“. This program is a whole demo of how to use the 32 bit RGBA translucency functions to store an alpha channel right alongside a bitmap graphic. like, the alpha channel is part of the bitmap now, they're a package deal, they're endgame πŸ’œ.

Two images get loaded from disk:

  1. one is used for the background
  2. the other is used as a sprite

and then β€” this is the part where she really ate β€” the example generates an alpha channel for the sprite image, composing that 32 bit RGBA bitmap during runtime, and draws it right at the position of the mouse cursor. so the sprite literally follows your mouse around like a little bestie 🫢. cursor-following sprite behaviour? we love to see it.


🌈 SEE ALSO 🌈

the whole friend group, go say hi:


and that's the whole page, babe πŸ’– tysm for reading, mwah. this was Allegro, version 4.4.3, and the page itself is exalpha(3alleg4), dated with the Allegro release. go forth and composite your RGBA sprites, you absolute main character πŸ‘‘βœ¨