mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
This change was planned for a long time. This moves all REGISTER calls to a single translation unit, this is required as we currently added a very dirty workaround for not registering duplicates by checking if VFTable pointer was already present in the vector... Registering from single translation unit prevents duplicate instances that gets created if header is included by more cpp files. Reworking this reduced 100kb+ of compiled code. This commit also reworked the way functions/variables/constant gets logged with their addresses; the new code formats them on the fly, and allows for resize at any time. Formatting is no longer required by programmer. TODO: currently there are some compile errors for dedicated and client dll's. These will be resolved very soon as they need to be properly worked out still (server & client only stuff needs to be properly split). Use the 'main' (stable) branch for the time being if you need to compile these dll's.
51 lines
1.3 KiB
C++
51 lines
1.3 KiB
C++
#pragma once
|
|
#include "core/stdafx.h"
|
|
#include "mathlib/color.h"
|
|
|
|
struct CTextNotify
|
|
{
|
|
CTextNotify(const EGlobalContext_t type, const float nTime, const string& svMessage)
|
|
{
|
|
this->m_svMessage = svMessage;
|
|
this->m_flLifeRemaining = nTime;
|
|
this->m_type = type;
|
|
}
|
|
EGlobalContext_t m_type = EGlobalContext_t::NONE;
|
|
float m_flLifeRemaining = 0.0f;
|
|
string m_svMessage = "";
|
|
};
|
|
|
|
class CTextOverlay
|
|
{
|
|
public:
|
|
CTextOverlay()
|
|
{
|
|
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 DrawNotify(void);
|
|
void DrawFormat(const int x, const int y, const Color c, const char* pszFormat, ...) const;
|
|
void ShouldDraw(const float flFrameTime);
|
|
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<CTextNotify> m_vNotifyText;
|
|
int m_nFontHeight; // Hardcoded to 16 in this engine.
|
|
|
|
mutable std::mutex m_Mutex;
|
|
|
|
public:
|
|
char m_pszCon_NPrintf_Buf[4096]{};
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
extern CTextOverlay* g_pOverlay;
|