After Tommi and I gave Irrlicht’s VFS the capability of adding pluggable archive types in the form of archive factories (IArchiveLoader), I got all excited and wanted to explore this in depth. Along with adding TAR and gzip support to Irrlicht 1.6, allowing native .tar.gz support, I also decided to play with some other formats which weren’t really archives but could be used as such.
So, I decided to add support for Windows icons as if they were a filesystem themselves. The dual bitmap types are combined into a 32-bit TGA file on demand using Irrlicht’s TGA writer and memory files, while PNG icons are loaded directly from the file.
Using it looks like this:
// create an instance of the loader io::CArchiveLoaderICO* icoLoader = new io::CArchiveLoaderICO(fs, driver); // add it to the filesystem fs->addArchiveLoader(icoLoader); // we created it with new, so we must drop it. icoLoader->drop(); // now we can add an .ICO archive to the filesystem fs->addFileArchive("bitplane.ico"); // and load an icon from it video::ITexture* tex = driver->getTexture("bitplane.ico.2.tga");