CInGameConsole.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * CInGameConsole.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "../gui/CIntObject.h"
  12. class CInGameConsole : public CIntObject
  13. {
  14. private:
  15. std::list< std::pair< std::string, uint32_t > > texts; //list<text to show, time of add>
  16. boost::mutex texts_mx; // protects texts
  17. std::vector< std::string > previouslyEntered; //previously entered texts, for up/down arrows to work
  18. int prevEntDisp; //displayed entry from previouslyEntered - if none it's -1
  19. int defaultTimeout; //timeout for new texts (in ms)
  20. int maxDisplayedTexts; //hiw many texts can be displayed simultaneously
  21. std::weak_ptr<IStatusBar> currentStatusBar;
  22. public:
  23. std::string enteredText;
  24. void show(SDL_Surface * to) override;
  25. void print(const std::string &txt);
  26. void keyPressed(const SDL_Keycode & key) override;
  27. void textInputed(const std::string & enteredText) override;
  28. void textEdited(const std::string & enteredText) override;
  29. void startEnteringText();
  30. void endEnteringText(bool processEnteredText);
  31. void refreshEnteredText();
  32. CInGameConsole();
  33. };