26 lines
777 B
C++
26 lines
777 B
C++
#include <amethyst/assets.hpp>
|
|
#include <amethyst/c3d.hpp>
|
|
#include <amethyst/iron.hpp>
|
|
#include <amethyst/texture.hpp>
|
|
|
|
namespace Amy {
|
|
void AssetMgr::AutoLoad(const ID& id, ksr path) {
|
|
if (path.ends_with(".png") || path.ends_with(".jpg") ||
|
|
path.ends_with(".bmp")) {
|
|
auto tex = Texture::New();
|
|
tex->Load(path);
|
|
Add(id, tex);
|
|
} else if (path.ends_with(".shbin")) {
|
|
auto shader = C3D::Shader::New();
|
|
shader->Load(path);
|
|
Add(id, shader);
|
|
} else if (path.ends_with(".ttf")) {
|
|
auto font = Iron::Font::New();
|
|
font->LoadTTF(path);
|
|
Add(id, font);
|
|
} else {
|
|
throw std::runtime_error("[amy]: assets: " + id.GetName() + " (" + path +
|
|
") is unsupported for AssetMgr::AutoLoad!");
|
|
}
|
|
}
|
|
} // namespace Amy
|