CKingdomInterface.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #ifndef __CKINGDOMINTERFACE_H__
  2. #define __CKINGDOMINTERFACE_H__
  3. #include "../global.h"
  4. #include <SDL.h>
  5. #include "GUIBase.h"
  6. #include "../hch/CMusicBase.h"
  7. class AdventureMapButton;
  8. class CHighlightableButtonsGroup;
  9. class CResDataBar;
  10. class CStatusBar;
  11. class CSlider;
  12. class CMinorResDataBar;
  13. class HoverableArea;
  14. /*
  15. * CKingdomInterface.h, part of VCMI engine
  16. *
  17. * Authors: listed in file AUTHORS in main folder
  18. *
  19. * License: GNU General Public License v2.0 or later
  20. * Full text of license available in license.txt file, in main folder
  21. *
  22. */
  23. class CKingdomInterface : public CIntObject
  24. {
  25. class CResIncomePic : public CIntObject
  26. {
  27. public:
  28. int resID,value;//resource ID
  29. std::string hoverText;
  30. CResIncomePic(int RID, CDefEssential * Mines);//c-tor
  31. ~CResIncomePic();//d-tor
  32. void hover(bool on);
  33. void show(SDL_Surface * to);
  34. CDefEssential * mines;//pointer to mines pictures;
  35. };
  36. class CTownItem : public CIntObject
  37. {
  38. public:
  39. int numb;//position on screen (1..size)
  40. const CGTownInstance * town;
  41. void show(SDL_Surface * to);
  42. void activate();
  43. void deactivate();
  44. CTownItem (int num);//c-tor
  45. ~CTownItem();//d-tor
  46. };
  47. class CHeroItem : public CIntObject
  48. {
  49. public:
  50. const CGHeroInstance * hero;
  51. int artGroup,numb;//current art group (0 = equiped, 1 = misc, 2 = backpack)
  52. void onArtChange(int newstate);//changes artgroup
  53. void show(SDL_Surface * to);
  54. void activate();
  55. void deactivate();
  56. CHeroItem (int num);//c-tor
  57. ~CHeroItem();//d-tor
  58. };
  59. public:
  60. //common data
  61. int state;//1 = towns showed, 2 = heroes;
  62. SDL_Surface * bg;//background
  63. CStatusBar * statusbar;//statusbar
  64. CResDataBar *resdatabar;//resources
  65. //buttons
  66. AdventureMapButton *exit;//exit button
  67. AdventureMapButton *toTowns;//town button
  68. AdventureMapButton *toHeroes;//hero button
  69. CDefEssential * title; //title bar
  70. //hero/town lists
  71. CSlider * slider;//slider
  72. bool showHarrisoned;//show harrisoned hero in heroes list or not, disabled by default
  73. int heroPos,townPos;//position of lists
  74. std::vector<CHeroItem *> heroes;//heroes list
  75. std::vector<CTownItem *> towns;//towns list
  76. static CDefEssential * slots, *fort, *hall;
  77. //objects list
  78. int objSize, objPos;
  79. CDefEssential *objPics;
  80. std::map<int,std::pair<int, std::string*> > objList; //dwelling ID, count, hover text
  81. std::vector <HoverableArea* > ObjList;//list of dwellings
  82. AdventureMapButton* ObjUp, *ObjDown, *ObjTop, *ObjBottom;//buttons for dwellings list
  83. //income pics
  84. std::vector<CResIncomePic *> incomes;//mines + incomes
  85. CDefEssential * mines;//picture of mines
  86. CKingdomInterface(); //c-tor
  87. ~CKingdomInterface(); //d-tor
  88. void moveObjectList(int newPos);
  89. void recreateHeroList(int pos);//recreating heroes list (on slider move)
  90. void recreateTownList(int pos);//same for town list
  91. void keyPressed(const SDL_KeyboardEvent & key);
  92. void listToTowns();//changing list to town view
  93. void listToHeroes();//changing list to heroes view
  94. void sliderMoved(int newpos);//when we move a slider...
  95. void show(SDL_Surface * to);
  96. void showAll(SDL_Surface * to);
  97. void close();
  98. void activate();
  99. void deactivate();
  100. };
  101. #endif // __CCASTLEINTERFACE_H__