al_use_transform(3alleg5)

πŸ“¦
version 5.2.11.3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– al_use_transform β€” from the al_use_transform(3alleg5) girlies, Allegro 5 API ✨

okay bestie, pull up a chair, we're talking transforms πŸŽ€


✨ NAME ✨

al_use_transform β€” the Allegro 5 API function that sets which transformation your drawings are gonna get, no cap πŸ’…


🌸 SYNOPSIS 🌸

#include <allegro5/allegro.h>

void al_use_transform(const ALLEGRO_TRANSFORM *trans)

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically, al_use_transform sets the transformation that's gonna be used for the drawing operations on the target bitmap β€” and here's the tea, every single bitmap keeps its own transformation, they don't share, they're all independent main characters πŸ‘‘

Every drawing operation you do after this call is gonna get transformed using this transformation. fr fr. And if you wanna go back to the default behaviour, just call this function with an identity transformation and you're back to normal, periodt πŸ’–

heads up: this function does absolutely nothing if there is no target bitmap. like, zero. it just vibes. πŸ™ˆ

Also, the parameter is passed by reference as an optimization β€” it's there to dodge the overhead of stack copying. And ngl the important part: the reference will not be stored in the Allegro library, so it is totally safe to pass references to local variables. slay πŸ’…

like, look at this iconic little setup:

void setup_my_transformation(void)
{
   ALLEGRO_TRANSFORM transform;
   al_translate_transform(&transform, 5, 10);
   al_use_transform(&transform);
}

see how transform is a local and we just hand over &transform? that's the vibe check passing with flying colors ✨

Parameters:

  • trans β€” Transformation to use πŸŽ€

πŸ’œ SEE ALSO πŸ’œ

go read those too, bestie, they're giving supporting cast energy 🫢


kisses, this was the Allegro reference manual πŸ’–βœ¨ this page is al_use_transform(3alleg5), you're welcome, mwah πŸŽ€πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from