SFML community forums

Help => Graphics => Topic started by: stewart on April 16, 2010, 03:34:55 pm

Title: Animated GIF
Post by: stewart on April 16, 2010, 03:34:55 pm
Can someone suggest a methods for loading animated gifs in to SFML? I tried loading the gifs in the way I ahve with other images but they could not be loaded.
Title: Animated GIF
Post by: Spidyy on April 16, 2010, 04:48:30 pm
You can't directly load animated gif. You need to create a class animating a sprite from a tilesheet instead.

You got animation class in the wiki like here (http://www.sfml-dev.org/wiki/en/sources/frame_anim_animated).
Title: Animated GIF
Post by: gsaurus on April 16, 2010, 05:00:16 pm
It's not possible with SFML only.

If you really want/need to use animated gifs, there must be code/libraries out there to load gifs into memory (I don't remember of any atm, just search ;)). You can get their frames data separately and load them into images with loadFromPixels. Finally build your own animation class with those images and the timing for each frame (which you should get from the gif somehow too).
Title: Animated GIF
Post by: Ashenwraith on April 16, 2010, 05:17:27 pm
gifs are for supporting legacy web browsers.

You should use png and make sheets to do animation if you are not experienced.

Either that or change your game to only need one play or cycle animations, ie a limited shmup.

Maybe then you could convert your gifs to motion pngs.