CInGameConsole.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 "ObjectLists.h"
  12. #include "../../lib/FunctionList.h"
  13. VCMI_LIB_NAMESPACE_BEGIN
  14. class CArmedInstance;
  15. class CGGarrison;
  16. class CGObjectInstance;
  17. class CGHeroInstance;
  18. class CGTownInstance;
  19. struct Component;
  20. struct InfoAboutArmy;
  21. struct InfoAboutHero;
  22. struct InfoAboutTown;
  23. VCMI_LIB_NAMESPACE_END
  24. class CAnimation;
  25. class CAnimImage;
  26. class CShowableAnim;
  27. class CFilledTexture;
  28. class CButton;
  29. class CComponent;
  30. class CHeroTooltip;
  31. class CTownTooltip;
  32. class CTextBox;
  33. class IImage;
  34. class CInGameConsole : public CIntObject
  35. {
  36. private:
  37. std::list< std::pair< std::string, uint32_t > > texts; //list<text to show, time of add>
  38. boost::mutex texts_mx; // protects texts
  39. std::vector< std::string > previouslyEntered; //previously entered texts, for up/down arrows to work
  40. int prevEntDisp; //displayed entry from previouslyEntered - if none it's -1
  41. int defaultTimeout; //timeout for new texts (in ms)
  42. int maxDisplayedTexts; //hiw many texts can be displayed simultaneously
  43. std::weak_ptr<IStatusBar> currentStatusBar;
  44. public:
  45. std::string enteredText;
  46. void show(SDL_Surface * to) override;
  47. void print(const std::string &txt);
  48. void keyPressed (const SDL_KeyboardEvent & key) override; //call-in
  49. void textInputed(const SDL_TextInputEvent & event) override;
  50. void textEdited(const SDL_TextEditingEvent & event) override;
  51. void startEnteringText();
  52. void endEnteringText(bool processEnteredText);
  53. void refreshEnteredText();
  54. CInGameConsole();
  55. };