PCMStream, msvc build fix, sound is an asset now
This commit is contained in:
+20
-5
@@ -1,5 +1,6 @@
|
||||
#include "Assets.h"
|
||||
|
||||
#include "../audio/audio.h"
|
||||
#include "../graphics/Texture.h"
|
||||
#include "../graphics/Shader.h"
|
||||
#include "../graphics/Atlas.h"
|
||||
@@ -18,7 +19,7 @@ Texture* Assets::getTexture(std::string name) const {
|
||||
}
|
||||
|
||||
void Assets::store(Texture* texture, std::string name){
|
||||
textures[name].reset(texture);
|
||||
textures.emplace(name, texture);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +31,7 @@ Shader* Assets::getShader(std::string name) const{
|
||||
}
|
||||
|
||||
void Assets::store(Shader* shader, std::string name){
|
||||
shaders[name].reset(shader);
|
||||
shaders.emplace(name, shader);
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +43,7 @@ Font* Assets::getFont(std::string name) const {
|
||||
}
|
||||
|
||||
void Assets::store(Font* font, std::string name){
|
||||
fonts[name].reset(font);
|
||||
fonts.emplace(name, font);
|
||||
}
|
||||
|
||||
Atlas* Assets::getAtlas(std::string name) const {
|
||||
@@ -53,7 +54,18 @@ Atlas* Assets::getAtlas(std::string name) const {
|
||||
}
|
||||
|
||||
void Assets::store(Atlas* atlas, std::string name){
|
||||
atlases[name].reset(atlas);
|
||||
atlases.emplace(name, atlas);
|
||||
}
|
||||
|
||||
audio::Sound* Assets::getSound(std::string name) const {
|
||||
auto found = sounds.find(name);
|
||||
if (found == sounds.end())
|
||||
return nullptr;
|
||||
return found->second.get();
|
||||
}
|
||||
|
||||
void Assets::store(audio::Sound* sound, std::string name) {
|
||||
sounds.emplace(name, sound);
|
||||
}
|
||||
|
||||
const std::vector<TextureAnimation>& Assets::getAnimations() {
|
||||
@@ -72,7 +84,7 @@ UiDocument* Assets::getLayout(std::string name) const {
|
||||
}
|
||||
|
||||
void Assets::store(UiDocument* layout, std::string name) {
|
||||
layouts[name].reset(layout);
|
||||
layouts.emplace(name, layout);
|
||||
}
|
||||
|
||||
void Assets::extend(const Assets& assets) {
|
||||
@@ -91,6 +103,9 @@ void Assets::extend(const Assets& assets) {
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user