r5sdk/r5dev/vgui/vgui_debugpanel.h
Kawe Mazidjatari 9019e5cb70 Move LogType_t to dbg.h
Renamed to EGlobalContext_t and used globally for all context types combined into one (required for rcon messages for example, as we do native and script messages, while also retaining colors).
2022-08-17 12:28:52 +02:00

51 lines
1.2 KiB
C++

#pragma once
#include "core/stdafx.h"
#include "mathlib/color.h"
struct LogMsg_t
{
LogMsg_t(const string svMessage, const int nTicks, const EGlobalContext_t type)
{
this->m_svMessage = svMessage;
this->m_nTicks = nTicks;
this->m_type = type;
}
string m_svMessage = "";
int m_nTicks = 1024;
EGlobalContext_t m_type = EGlobalContext_t::NONE;
};
class CLogSystem
{
public:
CLogSystem()
{
m_nFontHeight = 16;
memset(m_pszCon_NPrintf_Buf, '\0', sizeof(m_pszCon_NPrintf_Buf));
}
void Update(void);
void AddLog(const EGlobalContext_t context, const string& svText);
void DrawLog(void);
void DrawHostStats(void) const;
void DrawSimStats(void) const;
void DrawGPUStats(void) const;
void DrawCrosshairMaterial(void) const;
void DrawStreamOverlay(void) const;
private:
Color GetLogColorForType(const EGlobalContext_t type) const;
vector<LogMsg_t> m_vLogs;
int m_nFontHeight;
public:
char m_pszCon_NPrintf_Buf[4096]{};
};
///////////////////////////////////////////////////////////////////////////////
void CEngineVGui_Attach();
void CEngineVGui_Detach();
///////////////////////////////////////////////////////////////////////////////
extern CLogSystem g_pLogSystem;