This interface allows users to define their own file input sources from which
DSFML can load resources.
DSFML resource classes like $(TEXTURE_LINK) and $(SOUNDBUFFER_LINK) provide
loadFromFile and loadFromMemory functions, which read data from
conventional sources. However, if you have data coming from a different source
(over a network, embedded, encrypted, compressed, etc) you can derive your own
class from $(U InputStream) and load DSFML resources with their
loadFromStream function.
Usage example:
// custom stream class that reads from inside a zip fileclassZipStream : InputStream
{
public:
ZipStream(stringarchive);
boolopen(stringfilename);
longread(void[] data);
longseek(longposition);
longtell();
longgetSize();
private:
...
};
// now you can load textures...autotexture = newTexture();
autostream = newZipStream("resources.zip");
stream.open("images/img.png");
texture.loadFromStream(stream);
// musics...automusic = newMusic();
autostream = newZipStream("resources.zip");
stream.open("musics/msc.ogg");
music.openFromStream(stream);
// etc.
This interface allows users to define their own file input sources from which DSFML can load resources.
DSFML resource classes like $(TEXTURE_LINK) and $(SOUNDBUFFER_LINK) provide loadFromFile and loadFromMemory functions, which read data from conventional sources. However, if you have data coming from a different source (over a network, embedded, encrypted, compressed, etc) you can derive your own class from $(U InputStream) and load DSFML resources with their loadFromStream function.
Usage example: