[Allegro 5] Loading resources from memory
I have a question for you guys. In the game I am creating, I am using PAK files like those in Quake to store all of my game data into one single file for convinience and security. When the program is furst run it parses the PAK file. It's structure is similar to that of a UNIX file system. But that is not important. The files are stored as is, without compression. I read the files in buffers in memory.
How would I for example load a png image into allegro from a memory buffer (the buffer contains the entire png file, not just the pixel data, ex header and etc...)?
PS: Okay I was searching through the allegro documentation and stumbled upon this function:
From what I understand this should create an ALLEGRO_FILE handle to a virtual file in memory. I can then use al_load_bitmap_f with the returned handle to load the bitmap from memory. Is that correct?
You can open a chunk of memory using the al_open_memfile function from the memfile addon. then you can use the al_load_bitmap_f function to load the image from an open file handle.
Oh thank you
Thread #614549. Printed from Allegro.cc
Someone mentioned a solution similar to what you said here.