small ui changes
This commit is contained in:
@@ -85,28 +85,3 @@ UiDocument* Assets::getLayout(std::string name) const {
|
||||
void Assets::store(UiDocument* layout, std::string name) {
|
||||
layouts[name] = std::shared_ptr<UiDocument>(layout);
|
||||
}
|
||||
|
||||
void Assets::extend(const Assets& assets) {
|
||||
for (auto entry : assets.textures) {
|
||||
textures[entry.first] = entry.second;
|
||||
}
|
||||
for (auto entry : assets.shaders) {
|
||||
shaders[entry.first] = entry.second;
|
||||
}
|
||||
for (auto entry : assets.fonts) {
|
||||
fonts[entry.first] = entry.second;
|
||||
}
|
||||
for (auto entry : assets.atlases) {
|
||||
atlases[entry.first] = entry.second;
|
||||
}
|
||||
for (auto entry : assets.layouts) {
|
||||
layouts[entry.first] = entry.second;
|
||||
}
|
||||
for (auto entry : assets.sounds) {
|
||||
sounds[entry.first] = entry.second;
|
||||
}
|
||||
animations.clear();
|
||||
for (auto entry : assets.animations) {
|
||||
animations.emplace_back(entry);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -34,7 +34,10 @@ class Assets {
|
||||
std::unordered_map<std::string, std::shared_ptr<audio::Sound>> sounds;
|
||||
std::vector<TextureAnimation> animations;
|
||||
public:
|
||||
Assets() {}
|
||||
Assets(const Assets&) = delete;
|
||||
~Assets();
|
||||
|
||||
Texture* getTexture(std::string name) const;
|
||||
void store(Texture* texture, std::string name);
|
||||
|
||||
@@ -55,8 +58,6 @@ public:
|
||||
|
||||
UiDocument* getLayout(std::string name) const;
|
||||
void store(UiDocument* layout, std::string name);
|
||||
|
||||
void extend(const Assets& assets);
|
||||
};
|
||||
|
||||
#endif /* ASSETS_ASSETS_H_ */
|
||||
|
||||
@@ -182,6 +182,9 @@ assetload::postfunc assetload::sound(
|
||||
baseSound->variants.emplace_back(audio::load_sound(variantFile, keepPCM));
|
||||
}
|
||||
|
||||
if (baseSound == nullptr) {
|
||||
throw std::runtime_error("could not to find sound: " + file);
|
||||
}
|
||||
auto sound = baseSound.release();
|
||||
return [=](auto assets) {
|
||||
assets->store(sound, name);
|
||||
|
||||
Reference in New Issue
Block a user