summaryrefslogtreecommitdiff
path: root/src/asset-manager.hpp
blob: 73d19a1cb38abd9b6f92d82b0cfd5b7bd9803d1d (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 AM_Init();
AssetHandle AM_Register(const void *data, int64_t size, const char *key);
AssetHandle AM_Register(const char *path);
void AM_Destroy(AssetHandle assetHandle);
const Asset *AM_Get(AssetHandle assetHandle);

#endif /* PKE_ASSET_MANAGER_HPP */