summaryrefslogtreecommitdiff
path: root/src/asset-manager.hpp
blob: 8064697ac3e8fa775648ca772abff3aeacde67f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef PKE_ASSET_MANAGER_HPP
#define PKE_ASSET_MANAGER_HPP

#include "macros.hpp"
#include "memory.hpp"

#include <fstream>
#include <cstdint>
#include <cstring>
#include <cassert>

TypeSafeInt_H(AssetHandle, uint64_t, UINT64_MAX);

struct Asset{
	char key[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
	int64_t size = 0;
	void *ptr = nullptr;
};

void AssetManagerInit();
AssetHandle RegisterAsset(const void *data, int64_t size, const char *key);
AssetHandle RegisterAsset(const char *path);
void DestroyAsset(AssetHandle assetHandle);
const Asset *GetAsset(AssetHandle assetHandle);

#endif /* PKE_ASSET_MANAGER_HPP */