BlockGame/blocks/TextureLoader.cpp

23 lines
482 B
C++
Raw Permalink Normal View History

2022-02-06 21:53:29 +00:00
//
// Created by lukas on 06.02.22.
//
#include <iostream>
#include "TextureLoader.h"
std::unordered_map<std::string, Texture> TextureLoader::texts;
Texture *TextureLoader::loadTexture(std::string path) {
if (texts.find(path) != texts.end()) {
return &texts[path];
} else {
std::cout << "Loading texture: " << path << std::endl;
auto *t = new Texture;
t->load(path);
t->Bind();
texts[path] = *t;
return t;
}
}