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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -188,7 +188,7 @@
|
||||
"vertical_gravity": "top",
|
||||
"width": 274,
|
||||
"height": 274,
|
||||
"x": -200,
|
||||
"x": 200,
|
||||
"y": 650,
|
||||
"textures": {
|
||||
"normal": "resources/w/ui/img/inv/ItemBook002.png",
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
"vertical_align": "bottom",
|
||||
"name": "objective1nameLayout",
|
||||
"paddingY": 0,
|
||||
"width": 540.0,
|
||||
"width": 510.0,
|
||||
"height": 60.0,
|
||||
"x": 56,
|
||||
"y": 370,
|
||||
@@ -103,7 +103,7 @@
|
||||
"horizontal_gravity": "center",
|
||||
"vertical_gravity": "top",
|
||||
"paddingY": -20,
|
||||
"width": 540.0,
|
||||
"width": 510.0,
|
||||
"height": 60.0,
|
||||
"text": "Цель 1 Цель 1 Цель 1 Цель 1",
|
||||
"fontSize": 32,
|
||||
@@ -139,7 +139,7 @@
|
||||
"horizontal_gravity": "center",
|
||||
"vertical_gravity": "top",
|
||||
"vertical_align": "bottom",
|
||||
"width": 540.0,
|
||||
"width": 510.0,
|
||||
"height": 80.0,
|
||||
"x": 56,
|
||||
"y": 450,
|
||||
@@ -150,7 +150,7 @@
|
||||
"horizontal_gravity": "center",
|
||||
"vertical_gravity": "top",
|
||||
"paddingY": 0,
|
||||
"width": 540.0,
|
||||
"width": 510.0,
|
||||
"height": 60.0,
|
||||
"text": "Цель 2",
|
||||
"fontSize": 32,
|
||||
@@ -187,7 +187,7 @@
|
||||
"vertical_align": "bottom",
|
||||
"name": "objective3nameLayout",
|
||||
"paddingY": 0,
|
||||
"width": 540.0,
|
||||
"width": 510.0,
|
||||
"height": 60.0,
|
||||
"x": 56,
|
||||
"y": 530,
|
||||
@@ -197,7 +197,7 @@
|
||||
"name": "objective3name",
|
||||
"horizontal_gravity": "center",
|
||||
"vertical_gravity": "top",
|
||||
"width": 540.0,
|
||||
"width": 510.0,
|
||||
"height": 60.0,
|
||||
"text": "Цель 3",
|
||||
"fontSize": 32,
|
||||
@@ -218,7 +218,7 @@
|
||||
"type": "TextView",
|
||||
"name": "quest_description",
|
||||
"x": 4.0,
|
||||
"y": 480.0,
|
||||
"y": 510.0,
|
||||
"width": 580.0,
|
||||
"height": 400.0,
|
||||
"horizontal_gravity": "center",
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
"y": 10,
|
||||
"width": 160,
|
||||
"height": 36,
|
||||
"text": "v. 1.0.2",
|
||||
"text": "v. 1.0.3",
|
||||
"fontSize": 24,
|
||||
"textCentered": false,
|
||||
"topAligned": true,
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
"y": 10,
|
||||
"width": 160,
|
||||
"height": 36,
|
||||
"text": "v. 1.0.2",
|
||||
"text": "v. 1.0.3",
|
||||
"fontSize": 24,
|
||||
"textCentered": false,
|
||||
"topAligned": true,
|
||||
|
||||
Binary file not shown.
@@ -188,7 +188,7 @@
|
||||
"vertical_gravity": "top",
|
||||
"width": 274,
|
||||
"height": 274,
|
||||
"x": -200,
|
||||
"x": 200,
|
||||
"y": 650,
|
||||
"textures": {
|
||||
"normal": "resources/w/ui/img/inv/ItemBook002.png",
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
"vertical_align": "bottom",
|
||||
"name": "objective1nameLayout",
|
||||
"paddingY": 0,
|
||||
"width": 540.0,
|
||||
"width": 510.0,
|
||||
"height": 60.0,
|
||||
"x": 56,
|
||||
"y": 370,
|
||||
@@ -103,7 +103,7 @@
|
||||
"horizontal_gravity": "center",
|
||||
"vertical_gravity": "top",
|
||||
"paddingY": -20,
|
||||
"width": 540.0,
|
||||
"width": 510.0,
|
||||
"height": 60.0,
|
||||
"text": "",
|
||||
"fontSize": 32,
|
||||
@@ -139,7 +139,7 @@
|
||||
"horizontal_gravity": "center",
|
||||
"vertical_gravity": "top",
|
||||
"vertical_align": "bottom",
|
||||
"width": 540.0,
|
||||
"width": 510.0,
|
||||
"height": 80.0,
|
||||
"x": 56,
|
||||
"y": 450,
|
||||
@@ -150,7 +150,7 @@
|
||||
"horizontal_gravity": "center",
|
||||
"vertical_gravity": "top",
|
||||
"paddingY": 0,
|
||||
"width": 540.0,
|
||||
"width": 510.0,
|
||||
"height": 60.0,
|
||||
"text": "",
|
||||
"fontSize": 32,
|
||||
@@ -187,7 +187,7 @@
|
||||
"vertical_align": "bottom",
|
||||
"name": "objective3nameLayout",
|
||||
"paddingY": 0,
|
||||
"width": 540.0,
|
||||
"width": 510.0,
|
||||
"height": 60.0,
|
||||
"x": 56,
|
||||
"y": 530,
|
||||
@@ -197,7 +197,7 @@
|
||||
"name": "objective3name",
|
||||
"horizontal_gravity": "center",
|
||||
"vertical_gravity": "top",
|
||||
"width": 540.0,
|
||||
"width": 510.0,
|
||||
"height": 60.0,
|
||||
"text": "",
|
||||
"fontSize": 32,
|
||||
@@ -218,7 +218,7 @@
|
||||
"type": "TextView",
|
||||
"name": "quest_description",
|
||||
"x": 4.0,
|
||||
"y": 480.0,
|
||||
"y": 510.0,
|
||||
"width": 580.0,
|
||||
"height": 400.0,
|
||||
"horizontal_gravity": "center",
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
"y": 10,
|
||||
"width": 160,
|
||||
"height": 36,
|
||||
"text": "v. 1.0.2",
|
||||
"text": "v. 1.0.3",
|
||||
"fontSize": 24,
|
||||
"textCentered": false,
|
||||
"topAligned": true,
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
"y": 10,
|
||||
"width": 160,
|
||||
"height": 36,
|
||||
"text": "v. 1.0.2",
|
||||
"text": "v. 1.0.3",
|
||||
"fontSize": 24,
|
||||
"textCentered": false,
|
||||
"topAligned": true,
|
||||
|
||||
+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 {
|
||||
|
||||
+3
-1
@@ -1253,7 +1253,7 @@ namespace FRG {
|
||||
bool UiManager::setButtonCallback(const std::string& name, std::function<void(const std::string&)> cb) {
|
||||
auto b = findButton(name);
|
||||
if (!b) {
|
||||
std::cerr << "UiManager: setButtonCallback failed, button not found: " << name << std::endl;
|
||||
logger() << "UiManager: setButtonCallback failed, button not found: " << name << std::endl;
|
||||
return false;
|
||||
}
|
||||
b->onClick = std::move(cb);
|
||||
@@ -1850,11 +1850,13 @@ namespace FRG {
|
||||
for (auto it = allInteractives.rbegin(); it != allInteractives.rend(); ++it) {
|
||||
if (std::holds_alternative<std::shared_ptr<UiButton>>(*it)) {
|
||||
auto& b = std::get<std::shared_ptr<UiButton>>(*it);
|
||||
//logger() << "onTouchDown found the button: " << b->name << std::endl;
|
||||
if (b->state != ButtonState::Disabled &&
|
||||
b->getClickZoneRect().containsConsideringBorder((float)x, (float)y, b->border)) {
|
||||
b->state = ButtonState::Pressed;
|
||||
pressedButtons[fingerId] = b;
|
||||
if (b->onPress) b->onPress(b->name);
|
||||
//logger() << "onTouchDown pressed the button: " << b->name << std::endl;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user