CHeroBackpackWindow.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * CHeroBackpackWindow.cpp, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #include "StdInc.h"
  11. #include "CHeroBackpackWindow.h"
  12. #include "../gui/CGuiHandler.h"
  13. #include "../gui/Shortcut.h"
  14. #include "../widgets/Buttons.h"
  15. #include "../widgets/Images.h"
  16. #include "CMessage.h"
  17. #include "render/Canvas.h"
  18. #include "CPlayerInterface.h"
  19. CHeroBackpackWindow::CHeroBackpackWindow(const CGHeroInstance * hero)
  20. : CWindowObject((EOptions)0)
  21. {
  22. OBJECT_CONSTRUCTION_CAPTURING(255-DISPOSE);
  23. stretchedBackground = std::make_shared<CFilledTexture>("DIBOXBCK", Rect(0, 0, 410, 425));
  24. pos.w = stretchedBackground->pos.w;
  25. pos.h = stretchedBackground->pos.h;
  26. center();
  27. arts = std::make_shared<CArtifactsOfHeroBackpack>(/*Point(-100, -170)*/Point(10, 10));
  28. arts->setHero(hero);
  29. addSet(arts);
  30. addCloseCallback(std::bind(&CHeroBackpackWindow::close, this));
  31. quitButton = std::make_shared<CButton>(Point(173, 385), "IOKAY32.def", CButton::tooltip(""), [this]() { close(); }, EShortcut::GLOBAL_RETURN);
  32. }
  33. void CHeroBackpackWindow::showAll(Canvas &to)
  34. {
  35. CIntObject::showAll(to);
  36. CMessage::drawBorder(PlayerColor(LOCPLINT->playerID), to.getInternalSurface(), pos.w+28, pos.h+29, pos.x-14, pos.y-15);
  37. }