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 1.0KB

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