Counter Strike : Global Offensive Source Code
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.

76 lines
2.1 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //
  7. //=============================================================================//
  8. #if !defined TEXTCONSOLE_H
  9. #define TEXTCONSOLE_H
  10. #pragma once
  11. #ifdef _WIN32
  12. #include <windows.h>
  13. #endif // _WIN32
  14. #define MAX_CONSOLE_TEXTLEN 256
  15. #define MAX_BUFFER_LINES 30
  16. //class IBaseSystem;
  17. class CTextConsole
  18. {
  19. public:
  20. virtual ~CTextConsole()
  21. {
  22. };
  23. virtual bool Init ( /*IBaseSystem * system*/ );
  24. virtual void ShutDown( void );
  25. virtual void Print( char * pszMsg );
  26. virtual void SetTitle( char * pszTitle ) { };
  27. virtual void SetStatusLine( char * pszStatus ) { };
  28. virtual void UpdateStatus() { };
  29. // Must be provided by children
  30. virtual void PrintRaw( char * pszMsg, int nChars = 0 ) = 0;
  31. virtual void Echo( char * pszMsg, int nChars = 0 ) = 0;
  32. virtual char * GetLine( void ) = 0;
  33. virtual int GetWidth( void ) = 0;
  34. virtual void SetVisible( bool visible );
  35. virtual bool IsVisible();
  36. protected:
  37. char m_szConsoleText[ MAX_CONSOLE_TEXTLEN ]; // console text buffer
  38. int m_nConsoleTextLen; // console textbuffer length
  39. int m_nCursorPosition; // position in the current input line
  40. // Saved input data when scrolling back through command history
  41. char m_szSavedConsoleText[ MAX_CONSOLE_TEXTLEN ]; // console text buffer
  42. int m_nSavedConsoleTextLen; // console textbuffer length
  43. char m_aszLineBuffer[ MAX_BUFFER_LINES ][ MAX_CONSOLE_TEXTLEN ]; // command buffer last MAX_BUFFER_LINES commands
  44. int m_nInputLine; // Current line being entered
  45. int m_nBrowseLine; // current buffer line for up/down arrow
  46. int m_nTotalLines; // # of nonempty lines in the buffer
  47. bool m_ConsoleVisible;
  48. // IBaseSystem * m_System;
  49. int ReceiveNewline( void );
  50. void ReceiveBackspace( void );
  51. void ReceiveTab( void );
  52. void ReceiveStandardChar( const char ch );
  53. void ReceiveUpArrow( void );
  54. void ReceiveDownArrow( void );
  55. void ReceiveLeftArrow( void );
  56. void ReceiveRightArrow( void );
  57. };
  58. #endif // !defined