mirror of
https://github.com/vcmi/vcmi.git
synced 2025-03-25 21:38:59 +02:00
QuickBackpack window position on shift+click slot fixed
This commit is contained in:
parent
f60813d86f
commit
fa9201831b
@ -95,12 +95,12 @@ CExchangeWindow::CExchangeWindow(ObjectInstanceID hero1, ObjectInstanceID hero2,
|
||||
}
|
||||
|
||||
artifs[0] = std::make_shared<CArtifactsOfHeroMain>(Point(-334, 151));
|
||||
artifs[0]->clickPressedCallback = [this, hero = heroInst[0]](const CArtPlace & artPlace, const Point & cursorPosition){clickPressedOnArtPlace(hero, artPlace.slot, true, false, false);};
|
||||
artifs[0]->clickPressedCallback = [this, hero = heroInst[0]](const CArtPlace & artPlace, const Point & cursorPosition){clickPressedOnArtPlace(hero, artPlace.slot, true, false, false, cursorPosition);};
|
||||
artifs[0]->showPopupCallback = [this, heroArts = artifs[0]](CArtPlace & artPlace, const Point & cursorPosition){showArtifactAssembling(*heroArts, artPlace, cursorPosition);};
|
||||
artifs[0]->gestureCallback = [this, hero = heroInst[0]](const CArtPlace & artPlace, const Point & cursorPosition){showQuickBackpackWindow(hero, artPlace.slot, cursorPosition);};
|
||||
artifs[0]->setHero(heroInst[0]);
|
||||
artifs[1] = std::make_shared<CArtifactsOfHeroMain>(Point(98, 151));
|
||||
artifs[1]->clickPressedCallback = [this, hero = heroInst[1]](const CArtPlace & artPlace, const Point & cursorPosition){clickPressedOnArtPlace(hero, artPlace.slot, true, false, false);};
|
||||
artifs[1]->clickPressedCallback = [this, hero = heroInst[1]](const CArtPlace & artPlace, const Point & cursorPosition){clickPressedOnArtPlace(hero, artPlace.slot, true, false, false, cursorPosition);};
|
||||
artifs[1]->showPopupCallback = [this, heroArts = artifs[1]](CArtPlace & artPlace, const Point & cursorPosition){showArtifactAssembling(*heroArts, artPlace, cursorPosition);};
|
||||
artifs[1]->gestureCallback = [this, hero = heroInst[1]](const CArtPlace & artPlace, const Point & cursorPosition){showQuickBackpackWindow(hero, artPlace.slot, cursorPosition);};
|
||||
artifs[1]->setHero(heroInst[1]);
|
||||
|
@ -35,7 +35,7 @@ CHeroBackpackWindow::CHeroBackpackWindow(const CGHeroInstance * hero, const std:
|
||||
arts->moveBy(Point(windowMargin, windowMargin));
|
||||
arts->clickPressedCallback = [this](const CArtPlace & artPlace, const Point & cursorPosition)
|
||||
{
|
||||
clickPressedOnArtPlace(arts->getHero(), artPlace.slot, true, false, true);
|
||||
clickPressedOnArtPlace(arts->getHero(), artPlace.slot, true, false, true, cursorPosition);
|
||||
};
|
||||
arts->showPopupCallback = [this](CArtPlace & artPlace, const Point & cursorPosition)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "../render/Colors.h"
|
||||
#include "../render/IImage.h"
|
||||
#include "../renderSDL/RenderHandler.h"
|
||||
#include"../widgets/CComponentHolder.h"
|
||||
#include "../widgets/CComponentHolder.h"
|
||||
#include "../widgets/Images.h"
|
||||
#include "../widgets/TextControls.h"
|
||||
#include "../widgets/GraphicalPrimitiveCanvas.h"
|
||||
@ -206,7 +206,7 @@ void CHeroOverview::genControls()
|
||||
i = 0;
|
||||
for(auto & skill : (*CGI->heroh)[heroIdx]->secSkillsInit)
|
||||
{
|
||||
imageSecSkills.push_back(std::make_shared<CSecSkillPlace>(Point(302, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset)),
|
||||
secSkills.push_back(std::make_shared<CSecSkillPlace>(Point(302, 7 * borderOffset + yOffset + 186 + i * (32 + borderOffset)),
|
||||
CSecSkillPlace::ImageSize::SMALL, skill.first, skill.second));
|
||||
labelSecSkillsNames.push_back(std::make_shared<CLabel>(334 + 2 * borderOffset, 8 * borderOffset + yOffset + 186 + i * (32 + borderOffset) - 5, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, CGI->generaltexth->levels[skill.second - 1]));
|
||||
labelSecSkillsNames.push_back(std::make_shared<CLabel>(334 + 2 * borderOffset, 8 * borderOffset + yOffset + 186 + i * (32 + borderOffset) + 10, FONT_SMALL, ETextAlignment::TOPLEFT, Colors::WHITE, (*CGI->skillh)[skill.first]->getNameTranslated()));
|
||||
|
@ -61,7 +61,7 @@ class CHeroOverview : public CWindowObject
|
||||
std::vector<std::shared_ptr<CLabel>> labelSpellsNames;
|
||||
|
||||
std::shared_ptr<CLabel> labelSecSkillTitle;
|
||||
std::vector<std::shared_ptr<CSecSkillPlace>> imageSecSkills;
|
||||
std::vector<std::shared_ptr<CSecSkillPlace>> secSkills;
|
||||
std::vector<std::shared_ptr<CLabel>> labelSecSkillsNames;
|
||||
|
||||
void genBackground();
|
||||
|
@ -209,7 +209,7 @@ void CHeroWindow::update()
|
||||
if(!arts)
|
||||
{
|
||||
arts = std::make_shared<CArtifactsOfHeroMain>(Point(-65, -8));
|
||||
arts->clickPressedCallback = [this](const CArtPlace & artPlace, const Point & cursorPosition){clickPressedOnArtPlace(curHero, artPlace.slot, true, false, false);};
|
||||
arts->clickPressedCallback = [this](const CArtPlace & artPlace, const Point & cursorPosition){clickPressedOnArtPlace(curHero, artPlace.slot, true, false, false, cursorPosition);};
|
||||
arts->showPopupCallback = [this](CArtPlace & artPlace, const Point & cursorPosition){showArtifactAssembling(*arts, artPlace, cursorPosition);};
|
||||
arts->gestureCallback = [this](const CArtPlace & artPlace, const Point & cursorPosition){showQuickBackpackWindow(curHero, artPlace.slot, cursorPosition);};
|
||||
arts->setHero(curHero);
|
||||
|
@ -552,7 +552,7 @@ std::shared_ptr<CIntObject> CKingdomInterface::createMainTab(size_t index)
|
||||
{
|
||||
newHeroSet->clickPressedCallback = [this, newHeroSet](const CArtPlace & artPlace, const Point & cursorPosition)
|
||||
{
|
||||
clickPressedOnArtPlace(newHeroSet->getHero(), artPlace.slot, false, false, false);
|
||||
clickPressedOnArtPlace(newHeroSet->getHero(), artPlace.slot, false, false, false, cursorPosition);
|
||||
};
|
||||
newHeroSet->showPopupCallback = [this, newHeroSet](CArtPlace & artPlace, const Point & cursorPosition)
|
||||
{
|
||||
|
@ -262,7 +262,7 @@ void CMarketWindow::createAltarArtifacts(const IMarket * market, const CGHeroIns
|
||||
const auto heroArts = altarArtifactsStorage->getAOHset();
|
||||
heroArts->clickPressedCallback = [this, heroArts](const CArtPlace & artPlace, const Point & cursorPosition)
|
||||
{
|
||||
clickPressedOnArtPlace(heroArts->getHero(), artPlace.slot, true, true, false);
|
||||
clickPressedOnArtPlace(heroArts->getHero(), artPlace.slot, true, true, false, cursorPosition);
|
||||
};
|
||||
heroArts->showPopupCallback = [this, heroArts](CArtPlace & artPlace, const Point & cursorPosition)
|
||||
{
|
||||
|
@ -71,7 +71,7 @@ const CArtifactInstance * CWindowWithArtifacts::getPickedArtifact() const
|
||||
}
|
||||
|
||||
void CWindowWithArtifacts::clickPressedOnArtPlace(const CGHeroInstance * hero, const ArtifactPosition & slot,
|
||||
bool allowExchange, bool altarTrading, bool closeWindow)
|
||||
bool allowExchange, bool altarTrading, bool closeWindow, const Point & cursorPosition)
|
||||
{
|
||||
if(!LOCPLINT->makingTurn)
|
||||
return;
|
||||
@ -85,8 +85,7 @@ void CWindowWithArtifacts::clickPressedOnArtPlace(const CGHeroInstance * hero, c
|
||||
}
|
||||
else if(GH.isKeyboardShiftDown())
|
||||
{
|
||||
if(ArtifactUtils::isSlotEquipment(slot))
|
||||
GH.windows().createAndPushWindow<CHeroQuickBackpackWindow>(hero, slot);
|
||||
showQuickBackpackWindow(hero, slot, cursorPosition);
|
||||
}
|
||||
else if(auto art = hero->getArt(slot))
|
||||
{
|
||||
@ -134,6 +133,9 @@ void CWindowWithArtifacts::showQuickBackpackWindow(const CGHeroInstance * hero,
|
||||
if(!settings["general"]["enableUiEnhancements"].Bool())
|
||||
return;
|
||||
|
||||
if(!ArtifactUtils::isSlotEquipment(slot))
|
||||
return;
|
||||
|
||||
GH.windows().createAndPushWindow<CHeroQuickBackpackWindow>(hero, slot);
|
||||
auto backpackWindow = GH.windows().topWindow<CHeroQuickBackpackWindow>();
|
||||
backpackWindow->moveTo(cursorPosition - Point(1, 1));
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
const CGHeroInstance * getHeroPickedArtifact() const;
|
||||
const CArtifactInstance * getPickedArtifact() const;
|
||||
void clickPressedOnArtPlace(const CGHeroInstance * hero, const ArtifactPosition & slot,
|
||||
bool allowExchange, bool altarTrading, bool closeWindow);
|
||||
bool allowExchange, bool altarTrading, bool closeWindow, const Point & cursorPosition);
|
||||
void swapArtifactAndClose(const CArtifactsOfHeroBase & artsInst, const ArtifactPosition & slot, const ArtifactLocation & dstLoc);
|
||||
void showArtifactAssembling(const CArtifactsOfHeroBase & artsInst, CArtPlace & artPlace, const Point & cursorPosition) const;
|
||||
void showQuickBackpackWindow(const CGHeroInstance * hero, const ArtifactPosition & slot, const Point & cursorPosition) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user