ICO Loader

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

// we created it with new, so we must drop it.

// now we can add an .ICO archive to the filesystem

// and load an icon from it
video::ITexture* tex = driver->getTexture("bitplane.ico.2.tga");

As this is a silly toy and is of no use to most people, it has been relegated to IrrExt rather than becoming a part of Irrlicht. You can get the source code from IrrExt SVN, and read the docs here