next_fli_frame(3)

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

πŸ’– next_fli_frame(3) β€” the Allegro manual, but make it make sense πŸ’–

okay bestie, gather round, because this one is literally from the Allegro game programming library and it's giving "flipbook but make it C" ✨


🌸 NAME 🌸

next_fli_frame β€” reads the next frame of the current animation file. πŸŽ€

(and yes, it lives in the Allegro game programming library, that's the whole vibe πŸ¦‹)


✨ SYNOPSIS ✨

#include <allegro.h>

int next_fli_frame(int loop);

πŸ’… DESCRIPTION πŸ’…

So here's the tea: this function reads the next frame of the current animation file. That's it. That's the job. 🫢

Now, the loop argument? She's the main character here:

  • if loop is not zero, the player will cycle when it reaches the end of the file β€” like a playlist on repeat, no cap πŸ”
  • if loop is zero, it'll just return FLI_EOF instead. bye. πŸšͺ

And where does the frame go, you ask? It gets read into the global variables fli_bitmap and fli_palette. iconic behaviour honestly πŸ‘‘

Example time, because i know you love one:

while (next_fli_frame(0) == FLI_OK) {
   /* Do stuff, like play audio stream
      or check keys to skip animation. */
   /* Rest some time until next frame... */
}

see how clean that is? the loop just keeps going until the frames run out. periodt πŸ’…


πŸ”₯ RETURN VALUE πŸ”₯

  • FLI_OK β€” slay, it worked, success ✨
  • FLI_ERROR β€” oops, something went wrong 😭
  • FLI_NOT_OPEN β€” also an error, but specifically the "girl you never opened the file" kind πŸ™ˆ
  • FLI_EOF β€” you've hit the end of the file, that's all she wrote πŸ’€

πŸ‘€ SEE ALSO πŸ‘€

go read those too, iykyk πŸ’œ


k that's the whole page bestie!! this was brought to you by Allegro version 4.4.3 🌈 β€” mwah, drink water, and don't forget to check your return values πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from