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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. /*!
  12. * \brief Console 'overlay'
  13. */
  14. class Console {
  15. public:
  16. /*!
  17. * \brief Constructs an object of Console
  18. */
  19. Console();
  20. /*!
  21. * \brief Deconstructs an object of Console
  22. */
  23. ~Console();
  24. void setVisible(bool visible);
  25. bool isVisible();
  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. private:
  32. void moveInHistory(bool up);
  33. bool mVisible;
  34. char *mInputBuffer;
  35. size_t mInputBufferPointer;
  36. char *mPartialInput;
  37. std::vector<char *> mHistory;
  38. size_t mHistoryPointer;
  39. std::vector<char *> mCommandHistory;
  40. char *mUnfinishedInput;
  41. unsigned int mLineOffset;
  42. };
  43. Console &getConsole();
  44. #endif