Blocks atlas is auto-assembling now

This commit is contained in:
MihailRis
2023-11-22 01:53:48 +03:00
parent ea5c117652
commit fb8d220cca
41 changed files with 622 additions and 75 deletions
+16
View File
@@ -2,6 +2,7 @@
#include "../graphics/Texture.h"
#include "../graphics/Shader.h"
#include "../graphics/Atlas.h"
#include "../graphics/Font.h"
Assets::~Assets() {
@@ -16,6 +17,10 @@ Assets::~Assets() {
for (auto& iter : fonts){
delete iter.second;
}
for (auto& iter : atlases) {
delete iter.second;
}
}
Texture* Assets::getTexture(std::string name) const {
@@ -52,3 +57,14 @@ Font* Assets::getFont(std::string name) const {
void Assets::store(Font* font, std::string name){
fonts[name] = font;
}
Atlas* Assets::getAtlas(std::string name) const {
auto found = atlases.find(name);
if (found == atlases.end())
return nullptr;
return found->second;
}
void Assets::store(Atlas* atlas, std::string name){
atlases[name] = atlas;
}