play_memory_fli(3)

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

✨ play_memory_fli ✨

okay bestie, welcome to the Allegro manual πŸ’– this one's play_memory_fli(3) and it's lowkey iconic.


πŸŽ€ NAME πŸŽ€

play_memory_fli β€” plays a FLI or FLC animation from memory. part of the Allegro game programming library, no big deal 🫢


🌸 SYNOPSIS 🌸

#include <allegro.h>

int play_memory_fli(const void *fli_data, BITMAP *bmp, int loop, int
(*callback)());

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically? this plays an Autodesk Animator FLI or FLC animation onto the BITMAP you hand it, and the way it does that is by reading the data from a copy of the file that's already chilling in memory. not me pulling the whole animation out of RAM like a main character πŸ’…

how do you even get that fli_data pointer, you ask? two ways, bestie:

  • allocate a block of memory and read an FLI file into it
  • import an FLI into a grabber datafile

then, the loop situation: if loop is not zero, the player will cycle when it reaches the end of the file. if it is zero, it plays through the animation once and then returns. periodt.

and for the callback parameter β€” go read the beginning of the chapter "FLIC routines", it's all explained there. iykyk ✨


playing animations from memory is obviously faster than cueing them directly from disk, and it's genuinely so useful with short, looped FLI's. but like… animations can get very large very easily, so in most cases you'll probably be better off just using play_fli(). no shade, just facts.

you can think of this function as a little wrapper sitting on top of open_memory_fli(), next_fli_frame() and close_fli(). it's giving "delegation, but make it cute" πŸ‘‘

example time:

int ret = play_memory_fli(anim_data, screen, 0, NULL);
if (ret == FLI_ERROR)
   abort_on_error("Corrupted animation data?");

πŸ’« RETURN VALUE πŸ’«

the FLI player returns:

  • FLI_OK β€” if it reached the end of the file βœ…
  • FLI_ERROR β€” if something went wrong 😭
  • the value returned by the callback function β€” if that was what stopped it

🌈 SEE ALSO 🌈

play_fli(3), install_timer(3), fli_frame(3)


heads up bestie: those return values matter. don't just ignore FLI_ERROR and then act surprised when your animation is a mess πŸ’€

Allegro Β· version 4.4.3 Β· play_memory_fli(3)

and that's the whole page, bestie πŸŽ€ go play some FLIs, slay, and remember β€” memory animations hit different πŸ’–βœ¨

πŸ“¦ where this page comes from