al_register_bitmap_loader( ".ext", ?*(*al_loader_fnxn)? )
The title refers to the unknown second argument desired by the al_register_bitmap_loader() function. In fact, the documentation and the MSVS snippet auto-completer disagree on exactly what it wants, the former designating an "ALLEGRO_BITMAP *(*loader)(const char *filename)"; the latter demanding an "ALLEGRO_IIO_LOADER_FUNCTION loader". I assume that these types are identical, though how this is so is beyond my ken, and all attempts to satisfy the wanton desires of this function have proven fruitless.
So I am asking for someone to explain in clear terms the reason why this function was implemented and how to provide it an argument which allows me to make use of it. ( I am aware that the NULL pointer allows you to compile without error, but it still precludes actual use of it to load bitmaps, which is the whole idea. )
I'd assume you just need to pass it any pointer to a function that returns and ALLEGRO_BITMAP* while taking a const char*. This would make most sense, if you think about it.
As an example:
3 /* Code for loading a PSD file here */
8 /* Allegro initialization code here */
bitmap = al_load_bitmap("GameDataFolder/MyTestBitmap.psd");
14 /* Draw bitmap to screen here */
16 /* Free resources here */
18 return 0;
Thank you for the help! It has kicked the ball further down the field. I do have a resulting problem I would like to know the answer to, however: namely, Doesn't allegro supply the code for loading images? If this is so, I must be using the wrong method of loading them.
Thread #615593. Printed from Allegro.cc
Yes, it has code for a few image formats included already, such as png. You have to init the image addon to use them.