1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Added labels that indicate current option values

This commit is contained in:
Ivan Savenko
2023-03-04 13:37:27 +02:00
parent 2f556ccf60
commit b2e5e55c1e
9 changed files with 64 additions and 16 deletions

View File

@@ -22,6 +22,7 @@
BattleOptionsTab::BattleOptionsTab(BattleInterface * owner)
{
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
type |= REDRAW_PARENT;
const JsonNode config(ResourceID("config/widgets/settings/battleOptionsTab.json"));
addCallback("viewGridChanged", [this, owner](bool value)
@@ -139,6 +140,11 @@ void BattleOptionsTab::animationSpeedChangedCallback(int value)
{
Settings speed = settings.write["battle"]["speedFactor"];
speed->Float() = static_cast<float>(value);
auto targetLabel = widget<CLabel>("animationSpeedValueLabel");
int valuePercentage = value * 100 / 3; // H3 max value is "3", displaying it to be 100%
if (targetLabel)
targetLabel->setText(std::to_string(valuePercentage) + "%");
}
void BattleOptionsTab::showQueueChangedCallback(bool value, BattleInterface * parentBattleInterface)