2
0

CQuestLog.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #include "gui/CIntObject.h"
  2. #include "AdventureMapClasses.h"
  3. #include "CAdvmapInterface.h"
  4. #include "GUIClasses.h"
  5. #include "../lib/CGameState.h"
  6. /*
  7. * CQuestLog.h, part of VCMI engine
  8. *
  9. * Authors: listed in file AUTHORS in main folder
  10. *
  11. * License: GNU General Public License v2.0 or later
  12. * Full text of license available in license.txt file, in main folder
  13. *
  14. */
  15. class CCreature;
  16. class CStackInstance;
  17. class CAdventureMapButton;
  18. class CGHeroInstance;
  19. class CComponent;
  20. class LRClickableAreaWText;
  21. class CAdventureMapButton;
  22. class CPicture;
  23. class CCreaturePic;
  24. class LRClickableAreaWTextComp;
  25. class CSlider;
  26. class CLabel;
  27. struct QuestInfo;
  28. extern CAdvMapInt *adventureInt;
  29. const int QUEST_COUNT = 9;
  30. class CQuestLabel : public LRClickableAreaWText, public CBoundedLabel
  31. {
  32. public:
  33. std::function<void()> callback;
  34. CQuestLabel (int x=0, int y=0, EFonts Font = FONT_SMALL, EAlignment Align = TOPLEFT, const SDL_Color &Color = Colors::WHITE, const std::string &Text = "")
  35. : CBoundedLabel (x, y, FONT_SMALL, TOPLEFT, Colors::WHITE, Text){};
  36. void clickLeft(tribool down, bool previousState);
  37. void showAll(SDL_Surface * to);
  38. };
  39. class CQuestIcon : public CAnimImage
  40. {
  41. public:
  42. std::function<void()> callback; //TODO: merge with other similiar classes?
  43. CQuestIcon (const std::string &defname, int index, int x=0, int y=0);
  44. void clickLeft(tribool down, bool previousState);
  45. void showAll(SDL_Surface * to);
  46. };
  47. class CQuestMinimap : public CMinimap
  48. {
  49. std::vector <CQuestIcon *> icons;
  50. void clickLeft(tribool down, bool previousState){}; //minimap ignores clicking on its surface
  51. void iconClicked();
  52. void mouseMoved (const SDL_MouseMotionEvent & sEvent){};
  53. public:
  54. const QuestInfo * currentQuest;
  55. CQuestMinimap (const Rect & position);
  56. //should be called to invalidate whole map - different player or level
  57. void update();
  58. void setLevel(int level);
  59. void addQuestMarks (const QuestInfo * q);
  60. void showAll(SDL_Surface * to);
  61. };
  62. class CQuestLog : public CWindowObject
  63. {
  64. int questIndex;
  65. const QuestInfo * currentQuest;
  66. const std::vector<QuestInfo> quests;
  67. std::vector<CQuestLabel *> labels;
  68. CTextBox * description;
  69. CQuestMinimap * minimap;
  70. CSlider * slider; //scrolls quests
  71. CAdventureMapButton *ok;
  72. void init ();
  73. public:
  74. CQuestLog (const std::vector<QuestInfo> & Quests);
  75. ~CQuestLog(){};
  76. void selectQuest (int which);
  77. void updateMinimap (int which){};
  78. void printDescription (int which){};
  79. void sliderMoved (int newpos);
  80. void recreateQuestList (int pos);
  81. void showAll (SDL_Surface * to);
  82. };