BattleOnlyMode.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /*
  2. * BattleOnlyMode.h, 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. #pragma once
  11. #include "../windows/CWindowObject.h"
  12. #include "../../lib/constants/EntityIdentifiers.h"
  13. class FilledTexturePlayerColored;
  14. class CButton;
  15. class CPicture;
  16. class CLabel;
  17. class CGHeroInstance;
  18. class CCreatureSet;
  19. class EditorCallback;
  20. class CMap;
  21. class BattleOnlyModeWindow;
  22. class CAnimImage;
  23. class GraphicalPrimitiveCanvas;
  24. class CTextInput;
  25. class TransparentFilledRectangle;
  26. class BattleOnlyMode
  27. {
  28. public:
  29. static void openBattleWindow();
  30. };
  31. class NumberInputWindow : public CWindowObject
  32. {
  33. std::shared_ptr<FilledTexturePlayerColored> backgroundTexture;
  34. std::shared_ptr<TransparentFilledRectangle> backgroundOverlay;
  35. std::shared_ptr<CButton> buttonOk;
  36. std::shared_ptr<CTextInput> input;
  37. public:
  38. NumberInputWindow(int initialValue, std::function<void(int)> onValueSelected);
  39. };
  40. class BattleOnlyModeHeroSelector : public CIntObject
  41. {
  42. private:
  43. BattleOnlyModeWindow& parent;
  44. std::shared_ptr<CPicture> backgroundImage;
  45. std::shared_ptr<CPicture> heroImage;
  46. std::shared_ptr<CLabel> heroLabel;
  47. std::vector<std::shared_ptr<CPicture>> creatureImage;
  48. std::vector<std::shared_ptr<CLabel>> creatureImageLabel;
  49. void setHeroIcon();
  50. void setCreatureIcons();
  51. public:
  52. std::vector<std::shared_ptr<CAnimImage>> primSkills;
  53. std::vector<std::shared_ptr<GraphicalPrimitiveCanvas>> primSkillsBorder;
  54. std::vector<std::shared_ptr<CTextInput>> primSkillsInput;
  55. std::shared_ptr<CGHeroInstance> selectedHero;
  56. std::shared_ptr<CCreatureSet> selectedArmy;
  57. BattleOnlyModeHeroSelector(BattleOnlyModeWindow& parent, Point position);
  58. };
  59. class BattleOnlyModeWindow : public CWindowObject
  60. {
  61. friend class BattleOnlyModeHeroSelector;
  62. private:
  63. std::unique_ptr<CMap> map;
  64. std::shared_ptr<EditorCallback> cb;
  65. std::shared_ptr<FilledTexturePlayerColored> backgroundTexture;
  66. std::shared_ptr<CButton> buttonOk;
  67. std::shared_ptr<CButton> buttonAbort;
  68. std::shared_ptr<CLabel> title;
  69. std::shared_ptr<CButton> battlegroundSelector;
  70. std::shared_ptr<BattleOnlyModeHeroSelector> heroSelector1;
  71. std::shared_ptr<BattleOnlyModeHeroSelector> heroSelector2;
  72. TerrainId selectedTerrain;
  73. FactionID selectedTown;
  74. void init();
  75. void setTerrainButtonText();
  76. void setOkButtonEnabled();
  77. void startBattle();
  78. public:
  79. BattleOnlyModeWindow();
  80. };