CAdvmapInterface.h 4.1 KB

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