Changeset View
Changeset View
Standalone View
Standalone View
source/ps/CConsole.h
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | public: | ||||
/** | /** | ||||
* @param deltaRealTime Elapsed real time since the last frame. | * @param deltaRealTime Elapsed real time since the last frame. | ||||
*/ | */ | ||||
void Update(const float deltaRealTime); | void Update(const float deltaRealTime); | ||||
void Render(); | void Render(); | ||||
void InsertChar(const int szChar, const wchar_t cooked); | void InsertChar(const int szChar, const char cooked); | ||||
void InsertMessage(const std::string& message); | void InsertMessage(const std::string& message); | ||||
void SetBuffer(const wchar_t* szMessage); | void SetBuffer(const char* szMessage); | ||||
void UseHistoryFile(const VfsPath& filename, int historysize); | void UseHistoryFile(const VfsPath& filename, int historysize); | ||||
// Only returns a pointer to the buffer; copy out of here if you want to keep it. | // Only returns a pointer to the buffer; copy out of here if you want to keep it. | ||||
const wchar_t* GetBuffer(); | const char* GetBuffer(); | ||||
void FlushBuffer(); | void FlushBuffer(); | ||||
bool IsActive() { return m_bVisible; } | bool IsActive() { return m_bVisible; } | ||||
int m_iFontHeight; | int m_iFontHeight; | ||||
int m_iFontWidth; | int m_iFontWidth; | ||||
int m_iFontOffset; // distance to move up before drawing | int m_iFontOffset; // distance to move up before drawing | ||||
size_t m_charsPerPage; | size_t m_charsPerPage; | ||||
private: | private: | ||||
// Lock for all state modified by InsertMessage | // Lock for all state modified by InsertMessage | ||||
std::mutex m_Mutex; | std::mutex m_Mutex; | ||||
float m_fX; | float m_fX; | ||||
float m_fY; | float m_fY; | ||||
float m_fHeight; | float m_fHeight; | ||||
float m_fWidth; | float m_fWidth; | ||||
// "position" in show/hide animation, how visible the console is (0..1). | // "position" in show/hide animation, how visible the console is (0..1). | ||||
// allows implementing other animations than sliding, e.g. fading in/out. | // allows implementing other animations than sliding, e.g. fading in/out. | ||||
float m_fVisibleFrac; | float m_fVisibleFrac; | ||||
std::deque<std::wstring> m_deqMsgHistory; // protected by m_Mutex | std::deque<std::string> m_deqMsgHistory; // protected by m_Mutex | ||||
std::deque<std::wstring> m_deqBufHistory; | std::deque<std::string> m_deqBufHistory; | ||||
int m_iMsgHistPos; | int m_iMsgHistPos; | ||||
wchar_t* m_szBuffer; | char* m_szBuffer; | ||||
int m_iBufferPos; | int m_iBufferPos; | ||||
int m_iBufferLength; | int m_iBufferLength; | ||||
VfsPath m_sHistoryFile; | VfsPath m_sHistoryFile; | ||||
int m_MaxHistoryLines; | int m_MaxHistoryLines; | ||||
bool m_bVisible; // console is to be drawn | bool m_bVisible; // console is to be drawn | ||||
bool m_bToggle; // show/hide animation is currently active | bool m_bToggle; // show/hide animation is currently active | ||||
double m_prevTime; // the previous time the cursor draw state changed (used for blinking cursor) | double m_prevTime; // the previous time the cursor draw state changed (used for blinking cursor) | ||||
bool m_bCursorVisState; // if the cursor should be drawn or not | bool m_bCursorVisState; // if the cursor should be drawn or not | ||||
double m_cursorBlinkRate; // cursor blink rate in seconds, if greater than 0.0 | double m_cursorBlinkRate; // cursor blink rate in seconds, if greater than 0.0 | ||||
void DrawWindow(CShaderProgramPtr& shader); | void DrawWindow(CShaderProgramPtr& shader); | ||||
void DrawHistory(CTextRenderer& textRenderer); | void DrawHistory(CTextRenderer& textRenderer); | ||||
void DrawBuffer(CTextRenderer& textRenderer); | void DrawBuffer(CTextRenderer& textRenderer); | ||||
void DrawCursor(CTextRenderer& textRenderer); | void DrawCursor(CTextRenderer& textRenderer); | ||||
bool IsEOB() { return (m_iBufferPos == m_iBufferLength); } // Is end of Buffer? | bool IsEOB() { return (m_iBufferPos == m_iBufferLength); } // Is end of Buffer? | ||||
bool IsBOB() { return (m_iBufferPos == 0); } // Is beginning of Buffer? | bool IsBOB() { return (m_iBufferPos == 0); } // Is beginning of Buffer? | ||||
bool IsFull() { return (m_iBufferLength == CONSOLE_BUFFER_SIZE); } | bool IsFull() { return (m_iBufferLength == CONSOLE_BUFFER_SIZE); } | ||||
bool IsEmpty() { return (m_iBufferLength == 0); } | bool IsEmpty() { return (m_iBufferLength == 0); } | ||||
void ProcessBuffer(const wchar_t* szLine); | void ProcessBuffer(const char* szLine); | ||||
void LoadHistory(); | void LoadHistory(); | ||||
void SaveHistory(); | void SaveHistory(); | ||||
}; | }; | ||||
extern CConsole* g_Console; | extern CConsole* g_Console; | ||||
extern InReaction conInputHandler(const SDL_Event_* ev); | extern InReaction conInputHandler(const SDL_Event_* ev); | ||||
#endif | #endif |
Wildfire Games · Phabricator