Hello,
Continuing from http://www.allegro.cc/forums/thread/609005,
I've added
al_set_physfs_file_interface(); ALLEGRO_FILE *file; if (!(file = al_fopen("02.gif", "r"))) { al_draw_textf(font, al_map_rgb(255, 255, 255), 250, 350, 0, "fopen: Error loading gif"); al_flip_display(); al_rest(4.0); }
before the start of my last post on the old thread. This new code works, but again, I can't load the gif. Any suggestions, please?
TIA,
xtheunknown0
Show your full code again.
And what does that code print out?
I made a simplified test case :
And here's a 7-zip of the source, exe, dlls, and data/test.zip file.
The gif in the zip file doesn't display properly, but if I do the exact same thing with a png instead, then it displays perfectly.
I think your gif is bad. Try loading it regularly (not using Physfs) and see if it is still NULL.
Well I've tried to load a png file instead. I got this from http://images2.wikia.nocookie.net/__cb20090331234637/uncyclopedia/images/8/80/Smiley.png
Here, I get a blank screen.
A screenshot of the output from the previous post is attached.
You get a blank screen because you never flipped the display. Load the png, make sure it gave you a valid ALLGRO_BITMAP*, then add it to a zip file and try again.
Like I said, your gif is probably corrupt or invalid. Try loading it with al_load_bitmap instead, and see if it works.
IIRC Matt explained in another thread that Allegro still doesn't support GIF, even though the patent expired years ago.
I got a valid pointer from al_load_bitmap_f when loading a gif... It just didn't display like I thought it would...
In A5, Only BMP, PCX, and TGA are guaranteed to be supported. Support for JPEG and PNG will probably have been enabled.
OS X and Windows will support GIF (the first frame) if the OS-native image loading libraries are being used.
IIRC Matt explained in another thread that Allegro still doesn't support GIF, even though the patent expired years ago.
We never cared about the patent, see my gif addon for A4 which was published when the patent was still active. It was up to the user of the addon to deal with the patent.
We never cared about the patent
Why can't Allegro read GIF files?
Unisys has a patent on the LZW compression algorithm that is used by
the GIF format. I want everything in Allegro to be freely usable
without any restrictions whatsoever, which means I can't include any
code that is subject to licensing or the payment of royalties.
Allegro 3.12 faq.txt said:
Well, 3.12 was before my time (as developer)
Solved. Thanks to everyone.