Working on loading
This commit is contained in:
1 parent
d38a75ea72
commit
9b71ee447a
11 files changed
+268
-55
No files matched your search
@@ -4,6 +4,7 @@
|
||||
#include "utils/Utils.h"
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
#if defined EMSCRIPTEN || defined __ANDROID__
|
||||
#define PNG_ENABLED
|
||||
@@ -79,8 +80,16 @@ namespace FRG
|
||||
void UnloadByPrefix(const std::string& prefix);
|
||||
void UnloadAll();
|
||||
|
||||
// Marks every texture cached so far as resident, so UnloadNonResident() keeps it.
|
||||
void MarkAllResident();
|
||||
// Drops cached textures that aren't resident and whose key doesn't start with
|
||||
// residentPrefix (e.g. UI images, which are reloaded under the same prefix). A
|
||||
// texture is freed once nothing else holds it.
|
||||
void UnloadNonResident(const std::string& residentPrefix = "");
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, std::shared_ptr<Texture>> textureMap;
|
||||
std::unordered_set<std::string> residentKeys;
|
||||
static std::string MakeKey(const std::string& fileName, const std::string& zipFile);
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user