Support reading from generic stream objects.

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

simpleton
Just popping in
Just popping in
Posts: 1
Joined: Thu Apr 01, 2010 05:14

Support reading from generic stream objects.

Postby simpleton » Thu Apr 01, 2010 05:31

I haven't been keeping up much with the CEGUI development so I don't know if this is already present in 0.7x. I've kept up with the Secret Maryo project and even submitted a few patches to it myself. One of the topics discussed was the ability to compress level files. The project writes XML files directly so can easily add a compression layer, but uses CEGUI to read the XML. I had and idea for a feature for CEGUI, if it could read not only from files, but from any generic stream object that had a read method, not only for XML files, but images and anything else needed. Perhaps load methods could take a object such as CEGUI::InputStream derived object with a member Read(void* buf, size_t bytes). Or maybe even some type of all-out virtual file system (for instance so all CEGUI items, image sets, layouts, etc could be stored in a zip file, and if an XML file references an image set relatively, it would access it with the appropriate file system decoder or application defined file system decoder.

I'm not sure how such would be implemented. Perhaps a unique string could be used, such as file:///path/to/zip#zip:///path/to/entry, this would use a file decoder for reading /path/to/zip, and create a zip decoder wrapping that file decoder and set to read /path/to/entry from the file. Well, I don't know how it could really be implemented, but it would be a nice feature to be able to load resources from any application-defined stream and not just directly from disk.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Support reading from generic stream objects.

Postby CrazyEddie » Thu Apr 01, 2010 09:19

Hi,

CEGUI reads all files via a ResourceProvider system. This loads data having been given a filename and a resource group identifier. The default implementation is just based on the underlying file system, but custom implementations are able to load from anywhere - including doing such things as decompression on the fly.

In fact, we've just added a MinizipResourceProvider to the v0-7 codebase, which was contributed by Jamarr. This can have a .zip file set as a data source, can have relative data paths set for resource groups within the .zip file, and so - for example - it's possible to zip up the datafiles directory for CEGUI and have all resources loaded from that zip. The zip could just as easily have a location that contains the level XML data and be loaded from a resource group identifier that points to that subdir within the zip.

If MinizipResourceProvider should be unsuitable, it would almost certainly be possible to create a customised ResourceProvider that would work in an acceptable way.

CE.


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 7 guests