#ifndef PKE_ASSET_MANAGER_HPP #define PKE_ASSET_MANAGER_HPP #include "macros.hpp" #include "memory.hpp" #include #include struct AssetHandle : public PkeHandle { }; constexpr AssetHandle AssetHandle_MAX = AssetHandle{}; TypeSafeInt_Const_Expr(AssetLoadingState, uint8_t, 0xFF); const int64_t AssetKeyLength = 16; using AssetKey = char[AssetKeyLength]; const AssetLoadingState PKE_ASSET_LOADING_STATE_UNLOADED = AssetLoadingState {0}; const AssetLoadingState PKE_ASSET_LOADING_STATE_LOADING = AssetLoadingState {1}; const AssetLoadingState PKE_ASSET_LOADING_STATE_LOADED = AssetLoadingState {2}; const AssetLoadingState PKE_ASSET_LOADING_STATE_FAILED = AssetLoadingState {3}; struct Asset{ AssetHandle handle{}; AssetKey key = {'\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0','\0'}; const char *basePath = nullptr; int64_t size = 0; void *ptr = nullptr; std::future future; int8_t referenceCount = 0; AssetLoadingState state = PKE_ASSET_LOADING_STATE_UNLOADED; }; void AM_Init(); AssetHandle AM_Register(const void *data, int64_t size, std::size_t alignment, const char *key); AssetHandle AM_Register(const char *path); AssetHandle AM_Register(AssetKey key, const char *path); void AM_Release(AssetHandle assetHandle); const Asset *AM_Get(AssetHandle assetHandle); const AssetHandle AM_GetHandle(AssetKey key); uint64_t AM_GetBucketCount(); Asset *AM_GetAssets(uint64_t bucketIndex, uint64_t &itemCount); void AM_Teardown(); void AM_DebugPrint(); #endif /* PKE_ASSET_MANAGER_HPP */