CBattleConsole.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #pragma once
  2. #include "../UIFramework/CIntObject.h"
  3. struct SDL_Surface;
  4. /*
  5. * CBattleConsole.h, part of VCMI engine
  6. *
  7. * Authors: listed in file AUTHORS in main folder
  8. *
  9. * License: GNU General Public License v2.0 or later
  10. * Full text of license available in license.txt file, in main folder
  11. *
  12. */
  13. /// Class which shows the console at the bottom of the battle screen and manages the text of the console
  14. class CBattleConsole : public CIntObject
  15. {
  16. private:
  17. std::vector< std::string > texts; //a place where texts are stored
  18. int lastShown; //last shown line of text
  19. public:
  20. std::string alterTxt; //if it's not empty, this text is displayed
  21. std::string ingcAlter; //alternative text set by in-game console - very important!
  22. int whoSetAlter; //who set alter text; 0 - battle interface or none, 1 - button
  23. CBattleConsole(); //c-tor
  24. ~CBattleConsole(); //d-tor
  25. void show(SDL_Surface *to = 0);
  26. bool addText(const std::string &text); //adds text at the last position; returns false if failed (e.g. text longer than 70 characters)
  27. void eraseText(ui32 pos); //erases added text at position pos
  28. void changeTextAt(const std::string &text, ui32 pos); //if we have more than pos texts, pos-th is changed to given one
  29. void scrollUp(ui32 by = 1); //scrolls console up by 'by' positions
  30. void scrollDown(ui32 by = 1); //scrolls console up by 'by' positions
  31. };