1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Allow mouse wheel for astart options setup (town/hero/bonus)

This commit is contained in:
Ivan Savenko
2023-05-27 17:30:12 +03:00
parent 261308b942
commit 2a30eccb2d
2 changed files with 21 additions and 1 deletions

View File

@@ -410,7 +410,7 @@ void OptionsTab::CPlayerOptionTooltipBox::genBonusWindow()
} }
OptionsTab::SelectedBox::SelectedBox(Point position, PlayerSettings & settings, SelType type) OptionsTab::SelectedBox::SelectedBox(Point position, PlayerSettings & settings, SelType type)
: CIntObject(RCLICK, position), CPlayerSettingsHelper(settings, type) : CIntObject(RCLICK | WHEEL, position), CPlayerSettingsHelper(settings, type)
{ {
OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE; OBJ_CONSTRUCTION_CAPTURING_ALL_NO_DISPOSE;
@@ -440,6 +440,25 @@ void OptionsTab::SelectedBox::clickRight(tribool down, bool previousState)
} }
} }
void OptionsTab::SelectedBox::wheelScrolled(int distance, bool isInside)
{
if (!isInside)
return;
switch(CPlayerSettingsHelper::type)
{
case TOWN:
CSH->setPlayerOption(LobbyChangePlayerOption::TOWN, distance, settings.color);
break;
case HERO:
CSH->setPlayerOption(LobbyChangePlayerOption::HERO, distance, settings.color);
break;
case BONUS:
CSH->setPlayerOption(LobbyChangePlayerOption::BONUS, distance, settings.color);
break;
}
}
OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry(const PlayerSettings & S, const OptionsTab & parent) OptionsTab::PlayerOptionsEntry::PlayerOptionsEntry(const PlayerSettings & S, const OptionsTab & parent)
: pi(std::make_unique<PlayerInfo>(SEL->getPlayerInfo(S.color.getNum()))) : pi(std::make_unique<PlayerInfo>(SEL->getPlayerInfo(S.color.getNum())))
, s(std::make_unique<PlayerSettings>(S)) , s(std::make_unique<PlayerSettings>(S))

View File

@@ -100,6 +100,7 @@ public:
SelectedBox(Point position, PlayerSettings & settings, SelType type); SelectedBox(Point position, PlayerSettings & settings, SelType type);
void clickRight(tribool down, bool previousState) override; void clickRight(tribool down, bool previousState) override;
void wheelScrolled(int distance, bool isInside) override;
void update(); void update();
}; };