CAdvmapInterface.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. #ifndef CADVENTUREMAPINTERFACE_H
  2. #define CADVENTUREMAPINTERFACE_H
  3. #include "SDL.h"
  4. #include "CDefHandler.h"
  5. #include "SDL_Extensions.h"
  6. #include "CGameInterface.h"
  7. #include "CGameInfo.h"
  8. #include "SDL_Extensions.h"
  9. #include <boost/logic/tribool.hpp>
  10. #include "global.h"
  11. class AdventureMapButton
  12. : public ClickableL, public ClickableR, public Hoverable, public KeyInterested, public CButtonBase
  13. {
  14. public:
  15. std::string name; //for status bar
  16. std::string helpBox; //for right-click help
  17. char key; //key shortcut
  18. void (CAdvMapInt::*function)(); //function in CAdvMapInt called when this button is pressed, different for each button
  19. void clickRight (tribool down);
  20. void clickLeft (tribool down);
  21. void hover (bool on);
  22. void keyPressed (SDL_KeyboardEvent & key);
  23. void activate(); // makes button active
  24. void deactivate(); // makes button inactive (but don't deletes)
  25. AdventureMapButton(); //c-tor
  26. AdventureMapButton( std::string Name, std::string HelpBox, void(CAdvMapInt::*Function)(), int x, int y, std::string defName, bool activ=false, std::vector<std::string> * add = NULL );//c-tor
  27. };
  28. /*****************************/
  29. class CList
  30. : public ClickableL, public ClickableR, public Hoverable, public KeyInterested, public virtual CIntObject
  31. {
  32. SDL_Surface * bg;
  33. //arrow up, arrow down
  34. int posw, posh; //position width/height
  35. void clickLeft(tribool down);
  36. void activate();
  37. void deactivate();
  38. virtual void select(int which)=0;
  39. };
  40. class CHeroList
  41. : public CList
  42. {
  43. void select(int which);
  44. void clickRight(tribool down);
  45. };
  46. class CTownList
  47. : public CList
  48. {
  49. void select(int which);
  50. void clickRight(tribool down);
  51. };
  52. class CResourceBar
  53. :public ClickableR, public CIntObject
  54. {
  55. SDL_Surface * bg;
  56. void clickRight(tribool down);
  57. void refresh();
  58. };
  59. class CDataBar
  60. :public ClickableR, public CIntObject
  61. {
  62. SDL_Surface * bg;
  63. void clickRight(tribool down);
  64. void refresh();
  65. };
  66. class CStatusBar
  67. : public CIntObject
  68. {
  69. public:
  70. SDL_Surface * bg; //background
  71. int middlex, middley; //middle of statusbar
  72. std::string current; //text currently printed
  73. CStatusBar(int x, int y); //c-tor
  74. ~CStatusBar(); //d-tor
  75. void print(std::string text); //prints text and refreshes statusbar
  76. void clear();//clears statusbar and refreshes
  77. void show(); //shows statusbar (with current text)
  78. };
  79. class CMinimap
  80. : public ClickableL, public ClickableR, public Hoverable, public CIntObject
  81. {
  82. public:
  83. SDL_Surface * radar; //radar.def
  84. SDL_Surface * terrainMap;
  85. SDL_Surface * undTerrainMap; //underground
  86. //TODO flagged buildings
  87. bool underground;
  88. };
  89. class CTerrainRect
  90. : public ClickableL, public ClickableR, public Hoverable, public CIntObject, public KeyInterested
  91. {
  92. public:
  93. void activate();
  94. void deactivate();
  95. void clickLeft(tribool down);
  96. void clickRight(tribool down);
  97. void hover(bool on);
  98. void keyPressed (SDL_KeyboardEvent & key);
  99. void show();
  100. };
  101. /*****************************/
  102. class CAdvMapInt //adventure map interface
  103. {
  104. public:
  105. CAdvMapInt(int Player);
  106. ~CAdvMapInt();
  107. int3 position; //top left corner of visible map part
  108. int player;
  109. std::vector<CDefHandler *> gems;
  110. bool scrollingLeft ;
  111. bool scrollingRight ;
  112. bool scrollingUp ;
  113. bool scrollingDown ;
  114. bool updateScreen ;
  115. unsigned char anim, animValHitCount; //animation frame
  116. SDL_Surface * bg;
  117. AdventureMapButton kingOverview,//- kingdom overview
  118. underground,//- underground switch
  119. questlog,//- questlog
  120. sleepWake, //- sleep/wake hero
  121. moveHero, //- move hero
  122. spellbook,//- spellbook
  123. advOptions, //- adventure options
  124. sysOptions,//- system options
  125. nextHero, //- next hero
  126. endTurn;//- end turn
  127. //CHeroList herolist;
  128. CTerrainRect terrain; //visible terrain
  129. CStatusBar statusbar;
  130. //fuctions binded to buttons
  131. void fshowOverview();
  132. void fswitchLevel();
  133. void fshowQuestlog();
  134. void fsleepWake();
  135. void fmoveHero();
  136. void fshowSpellbok();
  137. void fadventureOPtions();
  138. void fsystemOptions();
  139. void fnextHero();
  140. void fendTurn();
  141. void show(); //shows and activates adv. map interface
  142. void update(); //redraws terrain
  143. };
  144. #endif //CADVENTUREMAPINTERFACE_H