]> git.tdb.fi Git - libs/gl.git/blobdiff - source/resourcemanager.h
Implement manual loading policy and async flag
[libs/gl.git] / source / resourcemanager.h
index fb4353350f4c2138a1b4a4d1d541b08bf1016f61..1e3cb54f3b439c72fe26811ccd546d6993743327 100644 (file)
@@ -28,8 +28,12 @@ private:
                std::string name;
                IO::Seekable *io;
                Resource::AsyncLoader *loader;
+               bool loaded;
 
                ManagedResource(Resource &);
+
+               void start_loading();
+               void finish_loading();
        };
 
        class LoadingThread: public Thread
@@ -65,12 +69,13 @@ private:
                void terminate();
        };
 
+       typedef std::map<const Resource *, ManagedResource> ResourceMap;
        typedef std::list<ManagedResource *> LoadQueue;
 
        LoadingPolicy policy;
        bool async_loads;
-       std::map<const Resource *, ManagedResource> resources;
-       std::list<ManagedResource *> queue;
+       ResourceMap resources;
+       LoadQueue queue;
        LoadingThread thread;
 
 public:
@@ -81,8 +86,10 @@ public:
        void set_async_loads(bool);
 
        void add_resource(Resource &);
+       void *get_data_for_resource(const Resource &);
        void set_resource_location(Resource &, DataFile::Collection &, const std::string &);
-       void load_resource(const Resource &);
+       void load_resource(Resource &);
+       void resource_used(const Resource &);
        void remove_resource(Resource &);
 
        void tick();