BattleOnlyMode.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. VCMI_LIB_NAMESPACE_BEGIN
  14. class CGHeroInstance;
  15. class CCreatureSet;
  16. class CMap;
  17. class EditorCallback;
  18. class BattleOnlyModeStartInfo;
  19. VCMI_LIB_NAMESPACE_END
  20. class FilledTexturePlayerColored;
  21. class CButton;
  22. class CPicture;
  23. class CLabel;
  24. class BattleOnlyModeWindow;
  25. class CAnimImage;
  26. class GraphicalPrimitiveCanvas;
  27. class CTextInput;
  28. class TransparentFilledRectangle;
  29. class BattleOnlyMode
  30. {
  31. public:
  32. static void openBattleWindow();
  33. };
  34. class BattleOnlyModeHeroSelector : public CIntObject
  35. {
  36. private:
  37. BattleOnlyModeWindow& parent;
  38. std::shared_ptr<CPicture> backgroundImage;
  39. std::shared_ptr<CPicture> heroImage;
  40. std::shared_ptr<CLabel> heroLabel;
  41. std::vector<std::shared_ptr<CPicture>> creatureImage;
  42. int id;
  43. public:
  44. std::vector<std::shared_ptr<CAnimImage>> primSkills;
  45. std::vector<std::shared_ptr<GraphicalPrimitiveCanvas>> primSkillsBorder;
  46. std::vector<std::shared_ptr<CTextInput>> primSkillsInput;
  47. std::vector<std::shared_ptr<CTextInput>> selectedArmyInput;
  48. void setHeroIcon();
  49. void setCreatureIcons();
  50. BattleOnlyModeHeroSelector(int id, BattleOnlyModeWindow& parent, Point position);
  51. };
  52. class BattleOnlyModeWindow : public CWindowObject
  53. {
  54. friend class BattleOnlyModeHeroSelector;
  55. private:
  56. std::shared_ptr<BattleOnlyModeStartInfo> startInfo;
  57. std::unique_ptr<CMap> map;
  58. std::shared_ptr<EditorCallback> cb;
  59. std::shared_ptr<FilledTexturePlayerColored> backgroundTexture;
  60. std::shared_ptr<CButton> buttonOk;
  61. std::shared_ptr<CButton> buttonAbort;
  62. std::shared_ptr<CLabel> title;
  63. std::shared_ptr<CButton> battlefieldSelector;
  64. std::shared_ptr<CButton> buttonReset;
  65. std::shared_ptr<BattleOnlyModeHeroSelector> heroSelector1;
  66. std::shared_ptr<BattleOnlyModeHeroSelector> heroSelector2;
  67. ColorRGBA disabledColor;
  68. void init();
  69. void onChange();
  70. void update();
  71. void setTerrainButtonText();
  72. void setOkButtonEnabled();
  73. void startBattle();
  74. public:
  75. BattleOnlyModeWindow();
  76. void applyStartInfo(std::shared_ptr<BattleOnlyModeStartInfo> si);
  77. };