diff --git a/Mods/vcmi/Data/QuickRecruitmentWindow/CreaturePurchaseCard.png b/Mods/vcmi/Data/QuickRecruitmentWindow/CreaturePurchaseCard.png deleted file mode 100644 index 9920a1ea2..000000000 Binary files a/Mods/vcmi/Data/QuickRecruitmentWindow/CreaturePurchaseCard.png and /dev/null differ diff --git a/Mods/vcmi/Sprites/QuickRecruitmentWindow/CreaturePurchaseCard.png b/Mods/vcmi/Sprites/QuickRecruitmentWindow/CreaturePurchaseCard.png new file mode 100644 index 000000000..5d7bfbfef Binary files /dev/null and b/Mods/vcmi/Sprites/QuickRecruitmentWindow/CreaturePurchaseCard.png differ diff --git a/Mods/vcmi/Sprites/QuickRecruitmentWindow/QuickRecruitmentAllButton.def b/Mods/vcmi/Sprites/QuickRecruitmentWindow/QuickRecruitmentAllButton.def new file mode 100644 index 000000000..884e909cc Binary files /dev/null and b/Mods/vcmi/Sprites/QuickRecruitmentWindow/QuickRecruitmentAllButton.def differ diff --git a/Mods/vcmi/Sprites/QuickRecruitmentWindow/QuickRecruitmentNoneButton.def b/Mods/vcmi/Sprites/QuickRecruitmentWindow/QuickRecruitmentNoneButton.def new file mode 100644 index 000000000..2efa0d4d9 Binary files /dev/null and b/Mods/vcmi/Sprites/QuickRecruitmentWindow/QuickRecruitmentNoneButton.def differ diff --git a/Mods/vcmi/Sprites/QuickRecruitmentWindow/costBackground.png b/Mods/vcmi/Sprites/QuickRecruitmentWindow/costBackground.png new file mode 100644 index 000000000..458faf28b Binary files /dev/null and b/Mods/vcmi/Sprites/QuickRecruitmentWindow/costBackground.png differ diff --git a/client/widgets/Buttons.cpp b/client/widgets/Buttons.cpp index b838254d2..ed93a75ee 100644 --- a/client/widgets/Buttons.cpp +++ b/client/widgets/Buttons.cpp @@ -34,6 +34,13 @@ void CButton::update() } int newPos = stateToIndex[int(state)]; + if(animateLonelyFrame) + { + if(state == PRESSED) + image->moveBy(Point(1,1)); + else + image->moveBy(Point(-1,-1)); + } if (newPos < 0) newPos = 0; @@ -85,6 +92,10 @@ void CButton::setImageOrder(int state1, int state2, int state3, int state4) update(); } +void CButton::setAnimateLonelyFrame(bool agreement) +{ + animateLonelyFrame = agreement; +} void CButton::setState(ButtonState newState) { if (state == newState) diff --git a/client/widgets/Buttons.h b/client/widgets/Buttons.h index c4d745711..7334a3c48 100644 --- a/client/widgets/Buttons.h +++ b/client/widgets/Buttons.h @@ -51,7 +51,7 @@ private: CAnimImage * image; //image for this button CIntObject * overlay;//object-overlay, can be null - + bool animateLonelyFrame = false; protected: void onButtonClicked(); // calls callback void update();//to refresh button after image or text change @@ -79,6 +79,7 @@ public: void addHoverText(ButtonState state, std::string text); void setImageOrder(int state1, int state2, int state3, int state4); + void setAnimateLonelyFrame(bool agreement); void block(bool on); /// State modifiers diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index ac5ff4434..35cc1aa6c 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -887,6 +887,7 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, const CGTownInst CWindowObject(PLAYER_COLORED | BORDERED), hall(nullptr), fort(nullptr), + fastArmyPurhase(nullptr), town(Town) { OBJ_CONSTRUCTION_CAPTURING_ALL; @@ -988,6 +989,7 @@ void CCastleInterface::recreateIcons() OBJ_CONSTRUCTION_CAPTURING_ALL; delete fort; delete hall; + delete fastArmyPurhase; size_t iconIndex = town->town->clientInfo.icons[town->hasFort()][town->builded >= CGI->modh->settings.MAX_BUILDING_PER_TURN]; icon->setFrame(iconIndex); @@ -996,8 +998,10 @@ void CCastleInterface::recreateIcons() hall = new CTownInfo( 80, 413, town, true); fort = new CTownInfo(122, 413, town, false); + fastArmyPurhase = new CButton(Point(122, 413), "itmcl.def", CButton::tooltip(), [&](){builds->enterToTheQuickRecruitmentWindow();}); fastArmyPurhase->setImageOrder(town->fortLevel()-1,town->fortLevel()-1,town->fortLevel()-1,town->fortLevel()-1); + fastArmyPurhase->setAnimateLonelyFrame(true); for (auto & elem : creainfo) delete elem; creainfo.clear(); diff --git a/client/windows/CreaturePurchaseCard.cpp b/client/windows/CreaturePurchaseCard.cpp index a66a39714..91c4e580a 100644 --- a/client/windows/CreaturePurchaseCard.cpp +++ b/client/windows/CreaturePurchaseCard.cpp @@ -26,12 +26,12 @@ void CreaturePurchaseCard::initButtons() void CreaturePurchaseCard::initMaxButton() { - maxButton = std::make_shared(Point(pos.x + 52, pos.y + 178), "iam014.def", CButton::tooltip(), std::bind(&CSlider::moveToMax,slider), SDLK_LSHIFT); + maxButton = std::make_shared(Point(pos.x + 52, pos.y + 180), "QuickRecruitmentWindow/QuickRecruitmentAllButton.def", CButton::tooltip(), std::bind(&CSlider::moveToMax,slider), SDLK_LSHIFT); } void CreaturePurchaseCard::initMinButton() { - minButton = std::make_shared(Point(pos.x, pos.y + 178), "iam015.def", CButton::tooltip(), std::bind(&CSlider::moveToMin,slider), SDLK_LCTRL); + minButton = std::make_shared(Point(pos.x, pos.y + 180), "QuickRecruitmentWindow/QuickRecruitmentNoneButton.def", CButton::tooltip(), std::bind(&CSlider::moveToMin,slider), SDLK_LCTRL); } void CreaturePurchaseCard::initCreatureSwitcherButton() @@ -52,8 +52,8 @@ void CreaturePurchaseCard::switchCreatureLevel() void CreaturePurchaseCard::initAmountInfo() { - availableAmount = std::make_shared(pos.x + 24, pos.y + 144, FONT_SMALL, CENTER, Colors::YELLOW); - purhaseAmount = std::make_shared(pos.x + 77, pos.y + 144, FONT_SMALL, CENTER, Colors::WHITE); + availableAmount = std::make_shared(pos.x + 25, pos.y + 146, FONT_SMALL, CENTER, Colors::YELLOW); + purhaseAmount = std::make_shared(pos.x + 76, pos.y + 146, FONT_SMALL, CENTER, Colors::WHITE); updateAmountInfo(0); } diff --git a/client/windows/QuickRecruitmentWindow.cpp b/client/windows/QuickRecruitmentWindow.cpp index 14ef57b9b..ccedf437d 100644 --- a/client/windows/QuickRecruitmentWindow.cpp +++ b/client/windows/QuickRecruitmentWindow.cpp @@ -28,20 +28,20 @@ void QuickRecruitmentWindow::setButtons() void QuickRecruitmentWindow::setCancelButton() { - cancelButton = std::make_shared(Point((pos.w / 2) + 47, 417), "ICN6432.DEF", CButton::tooltip(), [&](){ close(); }, SDLK_RETURN); + cancelButton = std::make_shared(Point((pos.w / 2) + 48, 418), "ICN6432.DEF", CButton::tooltip(), [&](){ close(); }, SDLK_RETURN); cancelButton->setImageOrder(0, 1, 2, 3); } void QuickRecruitmentWindow::setBuyButton() { - buyButton = std::make_shared(Point((pos.w/2)-33, 417), "IBY6432.DEF", CButton::tooltip(), [&](){ purhaseUnits(); }); + buyButton = std::make_shared(Point((pos.w/2)-32, 418), "IBY6432.DEF", CButton::tooltip(), [&](){ purhaseUnits(); }); cancelButton->assignedKeys.insert(SDLK_ESCAPE); buyButton->setImageOrder(0, 1, 2, 3); } void QuickRecruitmentWindow::setMaxButton() { - maxButton = std::make_shared(Point((pos.w/2)-113, 417), "IRCBTNS.DEF", CButton::tooltip(), [&](){ maxAllCards(cards); }); + maxButton = std::make_shared(Point((pos.w/2)-112, 418), "IRCBTNS.DEF", CButton::tooltip(), [&](){ maxAllCards(cards); }); maxButton->setImageOrder(0, 1, 2, 3); } @@ -73,6 +73,7 @@ void QuickRecruitmentWindow::initWindow(Rect startupPosition) pos.x -= 55 * (creaturesAmount - 3); } backgroundTexture = std::make_shared("DIBOXBCK.pcx", Rect(0, 0, pos.w, pos.h)); + costBackground = std::make_shared("QuickRecruitmentWindow/costBackground.png", pos.w/2-113, pos.y+290); } void QuickRecruitmentWindow::maxAllCards(std::vector > cards) diff --git a/client/windows/QuickRecruitmentWindow.h b/client/windows/QuickRecruitmentWindow.h index 62898c797..6e610e2ef 100644 --- a/client/windows/QuickRecruitmentWindow.h +++ b/client/windows/QuickRecruitmentWindow.h @@ -42,4 +42,5 @@ private: std::shared_ptr totalCost; std::vector> cards; std::shared_ptr backgroundTexture; + std::shared_ptr costBackground; };