mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 22:41:49 +00:00
content-pack resources support
This commit is contained in:
parent
c6d2266026
commit
396ee31bcc
43 changed files with 170 additions and 90 deletions
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <filesystem>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
|
||||
|
|
@ -12,13 +11,14 @@ const short ASSET_SHADER = 2;
|
|||
const short ASSET_FONT = 3;
|
||||
const short ASSET_ATLAS = 4;
|
||||
|
||||
class ResPaths;
|
||||
class Assets;
|
||||
|
||||
typedef std::function<bool(Assets*, const std::filesystem::path&, const std::string&)> aloader_func;
|
||||
typedef std::function<bool(Assets*, const ResPaths*, const std::string&, const std::string&)> aloader_func;
|
||||
|
||||
struct aloader_entry {
|
||||
int tag;
|
||||
const std::filesystem::path filename;
|
||||
const std::string filename;
|
||||
const std::string alias;
|
||||
};
|
||||
|
||||
|
|
@ -26,11 +26,11 @@ class AssetsLoader {
|
|||
Assets* assets;
|
||||
std::map<int, aloader_func> loaders;
|
||||
std::queue<aloader_entry> entries;
|
||||
std::filesystem::path resdir;
|
||||
const ResPaths* paths;
|
||||
public:
|
||||
AssetsLoader(Assets* assets, std::filesystem::path resdir);
|
||||
AssetsLoader(Assets* assets, const ResPaths* paths);
|
||||
void addLoader(int tag, aloader_func func);
|
||||
void add(int tag, const std::filesystem::path filename, const std::string alias);
|
||||
void add(int tag, const std::string filename, const std::string alias);
|
||||
|
||||
bool hasNext() const;
|
||||
bool loadNext();
|
||||
|
|
@ -38,7 +38,7 @@ public:
|
|||
static void createDefaults(AssetsLoader& loader);
|
||||
static void addDefaults(AssetsLoader& loader);
|
||||
|
||||
std::filesystem::path getDirectory() const;
|
||||
const ResPaths* getPaths() const;
|
||||
};
|
||||
|
||||
#endif // ASSETS_ASSETS_LOADER_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue