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

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