diff options
author | quou <quou@disroot.org> | 2024-12-29 13:54:35 +1100 |
---|---|---|
committer | quou <quou@disroot.org> | 2024-12-29 13:55:35 +1100 |
commit | f107689be915d96363ea75889631939c62f07980 (patch) | |
tree | a4b54d5145f12ee946dd24c18e6f6d5225a4d997 /asset.hpp | |
parent | 928eba3845d6017d133048cf04c1f816d87941b0 (diff) |
cache assets to avoid loading them more than once
Diffstat (limited to 'asset.hpp')
-rw-r--r-- | asset.hpp | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -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( |