Console.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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/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 QGears::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. void LoadHistory();
  34. void SaveHistory();
  35. void AddToHistory(const Ogre::String& history);
  36. char TranslateNumpad(const QGears::Event& event);
  37. int m_ConsoleWidth;
  38. int m_ConsoleHeight;
  39. unsigned int m_LineWidth;
  40. int m_LetterWidth;
  41. bool m_ToVisible;
  42. bool m_Visible;
  43. float m_Height;
  44. struct OutputLine
  45. {
  46. Ogre::String text;
  47. Ogre::ColourValue colour;
  48. float time;
  49. };
  50. std::list< OutputLine > m_OutputLine;
  51. unsigned int m_MaxOutputLine; // max number of lines in output list
  52. unsigned int m_DisplayLine; // bottom of console displays this line
  53. Ogre::String m_InputLine;
  54. unsigned int m_CursorPosition;
  55. float m_CursorBlinkTime;
  56. std::list< Ogre::String > m_History;
  57. int m_HistoryLineCycleIndex;
  58. unsigned int m_MaxHistorySize;
  59. Ogre::StringVector m_AutoCompletition;
  60. unsigned int m_AutoCompletitionLine;
  61. };
  62. #endif // CONSOLE_H