r5sdk/r5dev/vgui/vgui_debugpanel.h
Kawe Mazidjatari fcf3a09418 Make singletons use static memory
Avoid heap memory allocation and a level of indirection. This allows the compiler to optimize the program even more. No logic has been changed in this patch.
2024-04-05 17:52:57 +02:00

54 lines
1.2 KiB
C++

#pragma once
#include "core/stdafx.h"
#include "mathlib/color.h"
struct CTextNotify
{
CTextNotify(const eDLL_T type, const float flTime, const char* pszText)
{
this->m_Text = pszText;
this->m_flLifeRemaining = flTime;
this->m_Type = type;
}
eDLL_T m_Type;
float m_flLifeRemaining;
CUtlString m_Text;
};
class CTextOverlay
{
public:
CTextOverlay()
{
m_nFontHeight = 16;
m_nCon_NPrintf_Idx = 0;
memset(m_szCon_NPrintf_Buf, '\0', sizeof(m_szCon_NPrintf_Buf));
}
void Update(void);
void AddLog(const eDLL_T context, const char* pszText);
void DrawNotify(void);
void DrawFormat(const int x, const int y, const Color c, const char* pszFormat, ...) const;
void ShouldDraw(const float flFrameTime);
void DrawSimStats(void) const;
void DrawGPUStats(void) const;
void DrawCrosshairMaterial(void) const;
void DrawStreamOverlay(void) const;
void Con_NPrintf(void);
private:
Color GetLogColorForType(const eDLL_T type) const;
CUtlVector<CTextNotify> m_NotifyLines;
int m_nFontHeight; // Hardcoded to 16 in this engine.
mutable CThreadFastMutex m_Mutex;
public:
int m_nCon_NPrintf_Idx;
char m_szCon_NPrintf_Buf[4096];
};
///////////////////////////////////////////////////////////////////////////////
extern CTextOverlay g_TextOverlay;