• Advertisement
Sign in to follow this  

C/C++/Allegro and PNG-images? howto?

This topic is 4576 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm kinda new to C/C++/Allegro (library of choice), but I really need to know how to load and display PNG-images (as one would a .bmp-image)... What do I need and how do I use it? Would really love some sample-code! Basically just howto display a .png-image and make use of the transparent channel baked in PNG-images... like for instance this one: http://images.linux.com/babytux.png (first one on google image-search :P) Help me! please! :D

Share this post


Link to post
Share on other sites
Advertisement
Mmm... found that too earlier, but I didn't and still don't understand the howto/usage-file... and what exactly do I do with the files? guessing they're library-files i need to link to in order to use?

Share this post


Link to post
Share on other sites
Yes. You need to link your program with three libraries for it to work -- Allegro (alleg), LibPNG (png), and loadpng. You then need to include the loadpng header along with the allegro header.

Share this post


Link to post
Share on other sites
ok, but I assume you are experienced enough with C to understand the howto/usage-file...

What would for instance be the line to load and display an image called test.png with the transparency as it is?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement