play_fli(3alleg4)

πŸ’– play_fli β€” bestie, it's literally Allegro manual time ✨

okay so this page lives in play_fli(3alleg4), straight out of the Allegro manual, and it's about playing FLI/FLC animations from disk. iconic. let's get into it πŸ¦‹


🌸 NAME 🌸

play_fli β€” plays a FLI or FLC animation from disk. it's the Allegro game programming library, no cap πŸ’…


✨ SYNOPSIS ✨

#include <allegro.h>

int play_fli(const char *filename, BITMAP *bmp, int loop, int
(*callback)());

πŸŽ€ DESCRIPTION πŸŽ€

so basically? it plays an Autodesk Animator FLI or FLC animation file onto the BITMAP you pass in, and it reads the data off the disk as it needs it (yes, streaming, we love a low-memory queen πŸ‘‘).

about loop: if it's not zero, the player just keeps cycling when it hits the end of the file β€” infinite main character energy. if it is zero, it plays the whole animation through once and then comes back. one and done, periodt.

and for the whole callback parameter situation, go read the beginning of the chapter "FLIC routines" β€” that's where the lore lives πŸ“–.

Example, because we love a demo:

/* Let users skip looped animations. */
int check_escape_key(void)
{
   if (key[KEY_ESC])
      return 1;
   else
      return 0;
}
...
   int ret = play_fli("animlogo.fli", screen, 1,
                       check_escape_key);
   if (ret == FLI_ERROR)
      abort_on_error("Error playing intro!");

🌈 RETURN VALUE 🌈

the FLI player hands you back:

  • FLI_OK β€” yay, it reached the end of the file πŸ₯³
  • FLI_ERROR β€” nope, something went wrong 😭
  • or literally whatever the callback function returned, if that was the thing that stopped it 🫢

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, bestie πŸ’– this was Allegro version 4.4.3, play_fli(3alleg4), signing off β€” go play some animations, you ate πŸ“βœ¨