Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Animated GIF  (Read 21053 times)

0 Members and 1 Guest are viewing this topic.

stewart

  • Newbie
  • *
  • Posts: 9
    • View Profile
Animated GIF
« 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.

Spidyy

  • Sr. Member
  • ****
  • Posts: 493
    • View Profile
Animated GIF
« Reply #1 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.

gsaurus

  • Sr. Member
  • ****
  • Posts: 262
    • View Profile
    • Evolution Engine
Animated GIF
« Reply #2 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).
Pluma - Plug-in Management Framework

Ashenwraith

  • Sr. Member
  • ****
  • Posts: 270
    • View Profile
Animated GIF
« Reply #3 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.