summaryrefslogtreecommitdiff
path: root/asset.hpp
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-12-29 13:54:35 +1100
committerquou <quou@disroot.org>2024-12-29 13:55:35 +1100
commitf107689be915d96363ea75889631939c62f07980 (patch)
treea4b54d5145f12ee946dd24c18e6f6d5225a4d997 /asset.hpp
parent928eba3845d6017d133048cf04c1f816d87941b0 (diff)
cache assets to avoid loading them more than once
Diffstat (limited to 'asset.hpp')
-rw-r--r--asset.hpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/asset.hpp b/asset.hpp
index db53414..c149e0a 100644
--- a/asset.hpp
+++ b/asset.hpp
@@ -7,7 +7,6 @@ struct Pack_File;
struct Pack;
struct Asset {
- Asset* next;
Asset_Loader* loader;
};
@@ -19,13 +18,19 @@ struct Asset_Loader {
struct Asset_Arena {
Pack* p;
Arena* a, * s;
- Asset* assets;
-
- void init(Arena* arena, const char* pack_name);
+ struct Bucket {
+ char* name;
+ Asset* asset;
+ };
+ Bucket* assets;
+ int max_assets;
+
+ void init(Arena* arena, const char* pack_name, int max);
void destroy();
Asset* load(const char* name);
- void claim(Asset* a);
+
+ int bucket(const char* name);
};
void register_asset_loader(