Open Source Tomb Raider Engine
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

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