mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 12:31:51 +00:00
audio::reset_channel + minor refactor
This commit is contained in:
parent
9fbf46169f
commit
0ab39fa06f
9 changed files with 62 additions and 40 deletions
|
|
@ -52,6 +52,12 @@ class AssetsLoader {
|
|||
public:
|
||||
AssetsLoader(Assets* assets, const ResPaths* paths);
|
||||
void addLoader(int tag, aloader_func func);
|
||||
|
||||
/// @brief Enqueue asset load
|
||||
/// @param tag asset type
|
||||
/// @param filename asset file path
|
||||
/// @param alias internal asset name
|
||||
/// @param settings asset loading settings (based on asset type)
|
||||
void add(
|
||||
int tag,
|
||||
const std::string filename,
|
||||
|
|
@ -59,10 +65,12 @@ public:
|
|||
std::shared_ptr<AssetCfg> settings=nullptr
|
||||
);
|
||||
|
||||
|
||||
bool hasNext() const;
|
||||
bool loadNext();
|
||||
|
||||
/// @brief Enqueue core and content assets
|
||||
/// @param loader target loader
|
||||
/// @param content engine content
|
||||
static void addDefaults(AssetsLoader& loader, const Content* content);
|
||||
|
||||
const ResPaths* getPaths() const;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,14 @@
|
|||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
static bool animation(
|
||||
Assets* assets,
|
||||
const ResPaths* paths,
|
||||
const std::string directory,
|
||||
const std::string name,
|
||||
Atlas* dstAtlas
|
||||
);
|
||||
|
||||
bool assetload::texture(
|
||||
AssetsLoader&,
|
||||
Assets* assets,
|
||||
|
|
@ -102,7 +110,7 @@ bool assetload::atlas(
|
|||
Atlas* atlas = builder.build(2);
|
||||
assets->store(atlas, name);
|
||||
for (const auto& file : builder.getNames()) {
|
||||
assetload::animation(assets, paths, "textures", file, atlas);
|
||||
animation(assets, paths, "textures", file, atlas);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -172,7 +180,7 @@ bool assetload::sound(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool assetload::animation(
|
||||
static bool animation(
|
||||
Assets* assets,
|
||||
const ResPaths* paths,
|
||||
const std::string directory,
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ class AssetsLoader;
|
|||
class Atlas;
|
||||
struct AssetCfg;
|
||||
|
||||
/// @brief see AssetsLoader.h: aloader_func
|
||||
namespace assetload {
|
||||
bool texture(
|
||||
AssetsLoader&,
|
||||
|
|
@ -60,14 +61,6 @@ namespace assetload {
|
|||
const std::string name,
|
||||
std::shared_ptr<AssetCfg> settings
|
||||
);
|
||||
|
||||
bool animation(
|
||||
Assets*,
|
||||
const ResPaths* paths,
|
||||
const std::string directory,
|
||||
const std::string name,
|
||||
Atlas* dstAtlas
|
||||
);
|
||||
}
|
||||
|
||||
#endif // ASSETS_ASSET_LOADERS_H_
|
||||
#endif // ASSETS_ASSET_LOADERS_H_
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue