0

So, I was trying to make game in allegro but I'm currently stuck with this damn blank background which is making me very mad, as I know PNG images have transparency in the background already, but I can't load pngs, i have already download devpaks, installed libraries and stilll nothing good happened, if the best option for me is to use PNG so please tell me how to load then and use then correctly.

If the best option is still to use BMP and there is a algorithm, function or a little code which will make the blank background go away please tell me.

For those who didn't understand what I want there is a better explanation: http://3.bp.blogspot.com/-r9BaUuMLirc/ThjzRHOMBKI/AAAAAAAAAJI/kUilPnIPJLg/s400/bola_azul.png

its currently in .png, but I transformed to .bmp in paint, so it makes me a blank background and in allegro it shows the whole picture, i want to have only the ball.

1 Answers1

1

As you've commented, with Allegro 4, the color 0xFF00FF is treated as transparent when used with masked_blit() or draw_sprite().

To load PNGs in Allegro 4, you'll want to use loadpng with libpng. You can use the 8-bit alpha channel by enabling the alpha blender with set_alpha_blender().

If you're just starting out, you should be using Allegro 5, which has a modern API and native support for PNG files.

Matthew
  • 47,584
  • 11
  • 86
  • 98