working on texture manager

This commit is contained in:
Vladislav Khorev committed 2026-05-01 21:00:51 +03:00
1 parent e04fcbb9bd
commit be6a8cca9e
9 files changed
+92 -39

No files matched your search

+7 -14
View File
@@ -490,8 +490,7 @@ namespace ZL {
std::string path = t[key].get<std::string>();
try {
std::cout << "UiManager: loading texture for button '" << btn->name << "' : " << path << " Zip file: " << zipFile << std::endl;
auto data = CreateTextureDataFromPng(path.c_str(), zipFile.c_str());
return std::make_shared<Texture>(data);
return renderer.textureManager.LoadFromPng(path, zipFile);
}
catch (const std::exception& e) {
std::cerr << "UiManager: failed load texture " << path << " : " << e.what() << std::endl;
@@ -523,8 +522,7 @@ namespace ZL {
std::string path = t[key].get<std::string>();
try {
std::cout << "UiManager: --loading texture for slider '" << s->name << "' : " << path << " Zip file: " << zipFile << std::endl;
auto data = CreateTextureDataFromPng(path.c_str(), zipFile.c_str());
return std::make_shared<Texture>(data);
return renderer.textureManager.LoadFromPng(path, zipFile);
}
catch (const std::exception& e) {
std::cerr << "UiManager: failed load texture " << path << " : " << e.what() << std::endl;
@@ -674,8 +672,7 @@ namespace ZL {
if (!texPath.empty()) {
try {
auto data = CreateTextureDataFromPng(texPath.c_str(), zipFile.c_str());
img->texture = std::make_shared<Texture>(data);
img->texture = renderer.textureManager.LoadFromPng(texPath, zipFile);
}
catch (const std::exception& e) {
std::cerr << "UiManager: failed load texture for StaticImage '" << img->name << "' : " << e.what() << std::endl;
@@ -1058,14 +1055,10 @@ namespace ZL {
s->vertical = vertical;
try {
if (!trackPath.empty()) {
auto data = CreateTextureDataFromPng(trackPath.c_str(), zipFile.c_str());
s->texTrack = std::make_shared<Texture>(data);
}
if (!knobPath.empty()) {
auto data = CreateTextureDataFromPng(knobPath.c_str(), zipFile.c_str());
s->texKnob = std::make_shared<Texture>(data);
}
if (!trackPath.empty())
s->texTrack = renderer.textureManager.LoadFromPng(trackPath, zipFile);
if (!knobPath.empty())
s->texKnob = renderer.textureManager.LoadFromPng(knobPath, zipFile);
}
catch (const std::exception& e) {
std::cerr << "UiManager: addSlider failed to load textures: " << e.what() << std::endl;