r5sdk/r5dev/gameui/IConsole.h
Amos d182652211 Check and clear console vector even if console is not drawn
The vector could still overflow if user plays the game for a long time while not opening the console at least once.
2022-01-16 01:32:51 +01:00

46 lines
1.6 KiB
C++

#pragma once
#ifndef DEDICATED
class CConsole
{
private:
///////////////////////////////////////////////////////////////////////////
char m_szInputBuf[512] = { 0 };
ImVector<const char*> m_ivCommands;
ImVector<char*> m_ivHistory;
int m_nHistoryPos = -1;
ImGuiTextFilter m_itFilter;
bool m_bAutoScroll = true;
bool m_bScrollToBottom = false;
bool m_bCopyToClipBoard = false;
bool m_bReclaimFocus = false;
bool m_bInitialized = false;
public:
bool m_bActivate = false;
ImVector<char*> m_ivConLog;
///////////////////////////////////////////////////////////////////////////
CConsole();
~CConsole();
void Draw(const char* title, bool* bDraw);
void Options();
void Think();
void ProcessCommand(const char* command_line);
int TextEditCallback(ImGuiInputTextCallbackData* data);
static int TextEditCallbackStub(ImGuiInputTextCallbackData* data);
///////////////////////////////////////////////////////////////////////////
void AddLog(const char* fmt, ...) IM_FMTARGS(2);
void ClearLog();
void ColorLog();
///////////////////////////////////////////////////////////////////////////
void SetStyleVar();
};
///////////////////////////////////////////////////////////////////////////////
extern CConsole* g_pIConsole;
#endif // !DEDICATED