Console.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #ifndef CONSOLE_H
  2. #define CONSOLE_H
  3. #include <OgreColourValue.h>
  4. #include <OgreLog.h>
  5. #include <OgreSingleton.h>
  6. #include <OgreStringVector.h>
  7. #include <OIS.h>
  8. #include <list>
  9. #include <vector>
  10. #include "Event.h"
  11. class Console : public Ogre::Singleton< Console >, public Ogre::LogListener
  12. {
  13. public:
  14. Console();
  15. ~Console();
  16. void Input( const Event& event );
  17. void Update();
  18. void UpdateDraw();
  19. void UpdateNotification();
  20. void OnResize();
  21. void SetToVisible();
  22. void SetToHide();
  23. bool IsVisible() const;
  24. void AddTextToOutput( const Ogre::String& text, const Ogre::ColourValue& colour = Ogre::ColourValue::White );
  25. void ExecuteCommand( const Ogre::String& command );
  26. void ExecuteScript();
  27. void CompleteInput();
  28. void ResetAutoCompletion();
  29. void AddInputToHistory();
  30. void SetInputLineFromHistory();
  31. virtual void messageLogged( const Ogre::String& message, Ogre::LogMessageLevel lml, bool maskDebug, const Ogre::String &logName, bool& skipThisMessage );
  32. private:
  33. int m_ConsoleWidth;
  34. int m_ConsoleHeight;
  35. unsigned int m_LineWidth;
  36. int m_LetterWidth;
  37. bool m_ToVisible;
  38. bool m_Visible;
  39. float m_Height;
  40. struct OutputLine
  41. {
  42. Ogre::String text;
  43. Ogre::ColourValue colour;
  44. float time;
  45. };
  46. std::list< OutputLine > m_OutputLine;
  47. unsigned int m_MaxOutputLine; // max number of lines in output list
  48. unsigned int m_DisplayLine; // bottom of console displays this line
  49. Ogre::String m_InputLine;
  50. unsigned int m_CursorPosition;
  51. float m_CursorBlinkTime;
  52. std::list< Ogre::String > m_History;
  53. int m_HistoryLine;
  54. unsigned int m_HistorySize;
  55. Ogre::StringVector m_AutoCompletition;
  56. unsigned int m_AutoCompletitionLine;
  57. };
  58. #endif // CONSOLE_H