Mercurial > fife-parpg
comparison engine/core/util/resource/resource.i @ 644:b84dbc4665b0
loaders extension can now handle multiple loaders for different filetypes. A difference between map and object files is now being made!
Fixed a small redundancy in the guimanager.
Added clearResourceLoaders() to the Pool class. This can be used if different resourceloaders have to be added at a later point in time (running editor for example, a plugin might want to have it's own loader added)
author | nihathrael@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 11 Oct 2010 22:20:00 +0000 |
parents | 376b8afc9a18 |
children | bb26a76458c6 |
comparison
equal
deleted
inserted
replaced
643:edf6dcfe8cd4 | 644:b84dbc4665b0 |
---|---|
74 public: | 74 public: |
75 virtual ~ResourceSaver() { }; | 75 virtual ~ResourceSaver() { }; |
76 virtual void save(const ResourceLocation& location, IResource* resource) = 0; | 76 virtual void save(const ResourceLocation& location, IResource* resource) = 0; |
77 virtual void save(const std::string& filename, IResource* resource) { save(ResourceLocation(filename), resource); } | 77 virtual void save(const std::string& filename, IResource* resource) { save(ResourceLocation(filename), resource); } |
78 }; | 78 }; |
79 | 79 |
80 | 80 |
81 enum { RES_LOADED = 0x01, RES_NON_LOADED = 0x02}; | 81 enum { RES_LOADED = 0x01, RES_NON_LOADED = 0x02}; |
82 | 82 |
83 class Pool { | 83 class Pool { |
84 public: | 84 public: |
87 virtual int addResourceFromFile(const std::string& filename); | 87 virtual int addResourceFromFile(const std::string& filename); |
88 virtual int addResourceFromLocation(ResourceLocation* loc); | 88 virtual int addResourceFromLocation(ResourceLocation* loc); |
89 virtual int getResourceCount(int status); | 89 virtual int getResourceCount(int status); |
90 virtual int purgeLoadedResources(); | 90 virtual int purgeLoadedResources(); |
91 virtual void addResourceLoader(ResourceLoader* loader); | 91 virtual void addResourceLoader(ResourceLoader* loader); |
92 virtual void clearResourceLoaders(); | |
92 virtual void release(unsigned int index, bool dec = false); | 93 virtual void release(unsigned int index, bool dec = false); |
93 virtual IResource& get(unsigned int index, bool inc = false); | 94 virtual IResource& get(unsigned int index, bool inc = false); |
94 virtual void printStatistics(); | 95 virtual void printStatistics(); |
95 | 96 |
96 private: | 97 private: |
97 Pool(); | 98 Pool(); |
98 }; | 99 }; |
99 | 100 |
100 class ResourcePtr { | 101 class ResourcePtr { |
101 public: | 102 public: |
102 ResourcePtr(IResource* ptr = 0); | 103 ResourcePtr(IResource* ptr = 0); |
103 ResourcePtr(Pool* pool,int index); | 104 ResourcePtr(Pool* pool,int index); |