summaryrefslogtreecommitdiff
path: root/game/server/sprite_perfmonitor.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/server/sprite_perfmonitor.cpp
downloadarchived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz
archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip
Diffstat (limited to 'game/server/sprite_perfmonitor.cpp')
-rw-r--r--game/server/sprite_perfmonitor.cpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/game/server/sprite_perfmonitor.cpp b/game/server/sprite_perfmonitor.cpp
new file mode 100644
index 0000000..0e42b04
--- /dev/null
+++ b/game/server/sprite_perfmonitor.cpp
@@ -0,0 +1,95 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose: an entity which turns on and off counting and display of the particle
+// performance metric
+//
+//=============================================================================
+
+#include "cbase.h"
+#include "baseentity.h"
+#include "entityoutput.h"
+#include "convar.h"
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+//-----------------------------------------------------------------------------
+// Purpose: Entity that particle performance measuring
+//-----------------------------------------------------------------------------
+class CParticlePerformanceMonitor : public CPointEntity
+{
+ DECLARE_CLASS( CParticlePerformanceMonitor, CPointEntity );
+public:
+ DECLARE_DATADESC();
+ DECLARE_SERVERCLASS();
+
+ void Spawn( void );
+ int UpdateTransmitState( void );
+
+ // Inputs
+ void InputTurnOnDisplay( inputdata_t &inputdata );
+ void InputTurnOffDisplay( inputdata_t &inputdata );
+ void InputStartMeasuring( inputdata_t &inputdata );
+ void InputStopMeasuring( inputdata_t &inputdata );
+
+private:
+ CNetworkVar( bool, m_bDisplayPerf );
+ CNetworkVar( bool, m_bMeasurePerf );
+};
+
+LINK_ENTITY_TO_CLASS( env_particle_performance_monitor, CParticlePerformanceMonitor );
+
+BEGIN_DATADESC( CParticlePerformanceMonitor )
+ DEFINE_FIELD( m_bDisplayPerf, FIELD_BOOLEAN ),
+ DEFINE_FIELD( m_bMeasurePerf, FIELD_BOOLEAN ),
+
+ // Inputs
+ DEFINE_INPUTFUNC( FIELD_VOID, "TurnOnDisplay", InputTurnOnDisplay ),
+ DEFINE_INPUTFUNC( FIELD_VOID, "TurnOffDisplay", InputTurnOffDisplay ),
+ DEFINE_INPUTFUNC( FIELD_VOID, "StartMeasuring", InputStartMeasuring ),
+ DEFINE_INPUTFUNC( FIELD_VOID, "StopMeasuring", InputStopMeasuring ),
+END_DATADESC()
+
+IMPLEMENT_SERVERCLASS_ST( CParticlePerformanceMonitor, DT_ParticlePerformanceMonitor )
+ SendPropInt( SENDINFO(m_bDisplayPerf), 1, SPROP_UNSIGNED ),
+ SendPropInt( SENDINFO(m_bMeasurePerf), 1, SPROP_UNSIGNED ),
+END_SEND_TABLE()
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+void CParticlePerformanceMonitor::Spawn( void )
+{
+ SetSolid( SOLID_NONE );
+ SetMoveType( MOVETYPE_NONE );
+ m_bDisplayPerf = false;
+ m_bMeasurePerf = false;
+}
+
+//-----------------------------------------------------------------------------
+// Purpose:
+//-----------------------------------------------------------------------------
+int CParticlePerformanceMonitor::UpdateTransmitState()
+{
+ return SetTransmitState( FL_EDICT_ALWAYS );
+}
+
+void CParticlePerformanceMonitor::InputTurnOnDisplay( inputdata_t &inputdata )
+{
+ m_bDisplayPerf = true;
+}
+
+void CParticlePerformanceMonitor::InputTurnOffDisplay( inputdata_t &inputdata )
+{
+ m_bDisplayPerf = false;
+}
+
+void CParticlePerformanceMonitor::InputStartMeasuring( inputdata_t &inputdata )
+{
+ m_bMeasurePerf = true;
+}
+
+void CParticlePerformanceMonitor::InputStopMeasuring( inputdata_t &inputdata )
+{
+ m_bMeasurePerf = false;
+}
+