Fixing UI bugs, some clean up
This commit is contained in:
1 parent
1d8e103690
commit
1c20333f30
18 files changed
+37
-26
No files matched your search
+10
-1
@@ -903,9 +903,14 @@ namespace FRG {
|
||||
uiManager.setButtonCallback("inventoryMain", [this](const std::string&) {});
|
||||
|
||||
const auto& items = inventory->getItems();
|
||||
/*logger() << "Item count: " << items.size() << std::endl;
|
||||
for (int x = 0; x < items.size(); x++)
|
||||
{
|
||||
std::cout << "item " << x << ": " << items[x].id << std::endl;
|
||||
}*/
|
||||
const int maxSlots = 9;
|
||||
for (int i = 0; i < maxSlots; ++i) {
|
||||
const std::string btnName = "item" + std::to_string(i + 1) + "Button";
|
||||
std::string btnName = "item" + std::to_string(i + 1) + "Button";
|
||||
if (i < static_cast<int>(items.size())) {
|
||||
uiManager.setNodeVisible(btnName, true);
|
||||
auto btn = uiManager.findButton(btnName);
|
||||
@@ -913,8 +918,12 @@ namespace FRG {
|
||||
auto tex = renderer.textureManager.LoadFromPng(items[i].icon, CONST_ZIP_FILE, true);
|
||||
btn->texNormal = btn->texHover = btn->texPressed = tex;
|
||||
}
|
||||
//logger() << "Set button ballback to button: " << btnName << std::endl;
|
||||
uiManager.setButtonCallback(btnName, [this, i](const std::string&) {
|
||||
//logger() << "Callback called for button number " << i << std::endl;
|
||||
selectInventoryItem(i);
|
||||
//logger() << "Callback called for button number " << i << " END" << std::endl;
|
||||
|
||||
audioPlayer_.playSoundAsync("audio/sound_bag001.ogg");
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user