al_register_bitmap_loader_f(3alleg5)

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

✨ al_register_bitmap_loader_f β€” Allegro 5 API ✨

okay bestie, pull up a chair, we're doing the allegro5 manual today and honestly? this one is a lil hidden gem πŸ’Ž


πŸŽ€ NAME πŸŽ€

al_register_bitmap_loader_f β€” that's the whole thing, that's the name, it's giving Allegro 5 API and we love her for it 🫢


🌸 SYNOPSIS 🌸

#include <allegro5/allegro.h>

bool al_register_bitmap_loader_f(const char *extension,
   ALLEGRO_BITMAP *(*fs_loader)(ALLEGRO_FILE *fp, int flags))

look at that signature. she's got a function pointer and everything. very main character energy, no cap πŸ’…


πŸ’– DESCRIPTION πŸ’–

so basically, this function registers a handler for al_load_bitmap_f(3alleg5). like, you're telling Allegro "hey, when someone loads a bitmap file with this extension, use this function of mine to do it." iconic delegation behavior, honestly πŸ‘‘

here's the tea on the arguments:

  • extension β€” the file extension you're claiming. it should include the leading dot (.), so like .png, not png. and ngl, it gets matched case-insensitively, so .PNG and .png are the same vibe ✨
  • fs_loader β€” your loader function. it takes an ALLEGRO_FILE *fp and an int flags, and hands you back an ALLEGRO_BITMAP *. πŸ¦‹ and hmm, important: this argument may be NULL β€” that's how you unregister an entry. yes bestie, NULL is the "actually nvm, forget this one" button πŸ™ˆ

and what does she return?

  • true on success πŸŽ‰
  • false on error 😭
  • and specifically? she returns false if you try to unregister an entry that doesn't exist. so don't come for entries that were never there, she will simply say no πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘


that's the whole page, bestie. now go register some loaders, you absolute legend 🧚

this came to you straight from the <b>Allegro reference manual</b> β€” that's the source/version, and the page signs off as <b>al_register_bitmap_loader_f(3alleg5)</b>. mwah, bye πŸ’œ
πŸ“¦ where this page comes from