source-engine/game/client/c_sprite_perfmonitor.cpp
FluorescentCIAAfricanAmerican 3bf9df6b27 1
2020-04-22 12:56:21 -04:00

69 lines
2.2 KiB
C++

//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================
#include "cbase.h"
extern bool g_bMeasureParticlePerformance;
extern bool g_bDisplayParticlePerformance;
void ResetParticlePerformanceCounters( void );
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class C_ParticlePerformanceMonitor : public C_BaseEntity
{
DECLARE_CLASS( C_ParticlePerformanceMonitor, C_BaseEntity );
public:
DECLARE_CLIENTCLASS();
C_ParticlePerformanceMonitor();
~C_ParticlePerformanceMonitor();
virtual void OnDataChanged( DataUpdateType_t updateType );
private:
bool m_bDisplayPerf;
bool m_bMeasurePerf;
private:
C_ParticlePerformanceMonitor( const C_ParticlePerformanceMonitor & );
};
IMPLEMENT_CLIENTCLASS_DT( C_ParticlePerformanceMonitor, DT_ParticlePerformanceMonitor, CParticlePerformanceMonitor )
RecvPropInt( RECVINFO(m_bMeasurePerf) ),
RecvPropInt( RECVINFO(m_bDisplayPerf) ),
END_RECV_TABLE()
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
C_ParticlePerformanceMonitor::C_ParticlePerformanceMonitor( void )
{
m_bDisplayPerf = false;
m_bMeasurePerf = false;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
C_ParticlePerformanceMonitor::~C_ParticlePerformanceMonitor( void )
{
g_bMeasureParticlePerformance = false;
g_bDisplayParticlePerformance = false;
}
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void C_ParticlePerformanceMonitor::OnDataChanged( DataUpdateType_t updateType )
{
BaseClass::OnDataChanged(updateType);
if ( m_bMeasurePerf && ( ! g_bMeasureParticlePerformance ) )
ResetParticlePerformanceCounters();
g_bMeasureParticlePerformance = m_bMeasurePerf;
g_bDisplayParticlePerformance = m_bDisplayPerf;
}