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.

Console.h 958B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 <vector>
  11. /*!
  12. * \brief Console 'overlay'
  13. */
  14. class Console {
  15. public:
  16. /*!
  17. * \brief Constructs an object of Console
  18. */
  19. Console();
  20. void setVisible(bool visible);
  21. bool isVisible();
  22. void print(const char *s, ...) __attribute__((format(printf, 2, 3)));
  23. void display();
  24. void handleKeyboard(KeyboardButton key, bool pressed);
  25. void handleText(char *text, bool notFinished);
  26. void handleMouseScroll(int xrel, int yrel);
  27. private:
  28. void moveInHistory(bool up);
  29. bool mVisible;
  30. std::string mInputBuffer;
  31. std::string mPartialInput;
  32. std::vector<std::string> mHistory;
  33. size_t mHistoryPointer;
  34. std::vector<std::string> mCommandHistory;
  35. std::string mUnfinishedInput;
  36. unsigned int mLineOffset;
  37. };
  38. Console &getConsole();
  39. #endif