22 #ifndef ILLUSIONS_RESOURCESYSTEM_H 23 #define ILLUSIONS_RESOURCESYSTEM_H 25 #include "common/array.h" 26 #include "common/file.h" 27 #include "common/hashmap.h" 28 #include "common/memstream.h" 29 #include "common/str.h" 30 #include "common/substream.h" 31 #include "common/system.h" 35 #define ResourceTypeId(x) ((x) & 0xFFFF0000) 37 class BaseResourceLoader;
38 class BaseResourceReader;
39 class IllusionsEngine;
44 virtual void load(
Resource *resource);
45 virtual void unload();
47 virtual void unpause();
61 Resource() : _loaded(
false), _resId(0), _sceneId(0), _threadId(0), _data(0), _dataSize(0), _instance(0) {
81 virtual void load(
Resource *resource) = 0;
82 virtual bool isFlag(
int flag) = 0;
92 void loadResource(uint32 resId, uint32 sceneId, uint32 threadId);
93 void unloadResourceById(uint32 resId);
94 void unloadResourcesBySceneId(uint32 sceneId);
95 void unloadSceneResources(uint32 sceneId1, uint32 sceneId2);
96 void unloadAllResources();
101 typedef ResourceLoadersMap::iterator ResourceLoadersMapIterator;
103 ResourceLoadersMap _resourceLoaders;
108 ResourcesArray _resources;
113 bool operator()(
const Resource *resource)
const {
114 return resource->_resId == _resId;
121 bool operator()(
const Resource *resource)
const {
122 return resource == _resource;
129 bool operator()(
const Resource *resource)
const {
130 return resource->_sceneId == _sceneId;
135 uint32 _sceneId1, _sceneId2;
137 bool operator()(
const Resource *resource)
const {
138 return resource->_sceneId != _sceneId1 && resource->_sceneId != _sceneId2;
142 void unloadResource(
Resource *resource);
148 #endif // ILLUSIONS_RESOURCESYSTEM_H Definition: resourcesystem.h:134
Definition: resourcesystem.h:85
T * iterator
Definition: array.h:54
Definition: resourcesystem.h:51
Definition: resourcesystem.h:110
Definition: resourcereader.h:29
Definition: resourcesystem.h:42
Definition: resourcesystem.h:126
Definition: resourcesystem.h:78
Definition: illusions.h:92
Definition: resourcesystem.h:118