Open Source Tomb Raider Engine
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*!
  2. * \file include/Console.h
  3. * \brief Console 'overlay'
  4. *
  5. * \author xythobuz
  6. */
  7. #ifndef _CONSOLE_H_
  8. #define _CONSOLE_H_
  9. #include <string>
  10. #include <sstream>
  11. #include <vector>
  12. /*!
  13. * \brief Console 'overlay'
  14. */
  15. class Console {
  16. public:
  17. /*!
  18. * \brief Constructs an object of Console
  19. */
  20. Console();
  21. void setVisible(bool visible);
  22. bool isVisible();
  23. template<typename T>
  24. Console &operator<<(T t);
  25. // Deprecated!
  26. void print(const char *s, ...) __attribute__((format(printf, 2, 3)));
  27. void display();
  28. void handleKeyboard(KeyboardButton key, bool pressed);
  29. void handleText(char *text, bool notFinished);
  30. void handleMouseScroll(int xrel, int yrel);
  31. const static char endl = '\n';
  32. private:
  33. void moveInHistory(bool up);
  34. bool mVisible;
  35. std::string mInputBuffer;
  36. std::string mPartialInput;
  37. std::vector<std::string> mHistory;
  38. size_t mHistoryPointer;
  39. std::vector<std::string> mCommandHistory;
  40. std::string mUnfinishedInput;
  41. unsigned int mLineOffset;
  42. std::ostringstream printBuffer;
  43. };
  44. Console &getConsole();
  45. #endif