From f107689be915d96363ea75889631939c62f07980 Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 29 Dec 2024 13:54:35 +1100 Subject: cache assets to avoid loading them more than once --- asset.hpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'asset.hpp') 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( -- cgit v1.2.3-54-g00ecf