summaryrefslogtreecommitdiff
path: root/vgui2/dme_controls/dmecontrols.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 /vgui2/dme_controls/dmecontrols.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'vgui2/dme_controls/dmecontrols.cpp')
-rw-r--r--vgui2/dme_controls/dmecontrols.cpp102
1 files changed, 102 insertions, 0 deletions
diff --git a/vgui2/dme_controls/dmecontrols.cpp b/vgui2/dme_controls/dmecontrols.cpp
new file mode 100644
index 0000000..1e4ee78
--- /dev/null
+++ b/vgui2/dme_controls/dmecontrols.cpp
@@ -0,0 +1,102 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//===========================================================================//
+
+#include "dme_controls/dmecontrols.h"
+#include "soundemittersystem/isoundemittersystembase.h"
+#include "matsys_controls/matsyscontrols.h"
+#include "toolframework/ienginetool.h"
+#include "vphysics_interface.h"
+#include "dme_controls/inotifyui.h"
+
+// memdbgon must be the last include file in a .cpp file!!!
+#include "tier0/memdbgon.h"
+
+namespace vgui
+{
+
+ISoundEmitterSystemBase *g_pSoundEmitterSystem = NULL;
+ISoundEmitterSystemBase *SoundEmitterSystem()
+{
+ return g_pSoundEmitterSystem;
+}
+
+IEngineTool *enginetools = NULL;
+IEngineTool *EngineTool()
+{
+ return enginetools;
+}
+
+IPhysicsCollision *g_pPhysicsCollision = NULL;
+IPhysicsCollision *PhysicsCollision()
+{
+ return g_pPhysicsCollision;
+}
+
+class CDefaultElementPropertiesChoices : public CBaseElementPropertiesChoices
+{
+public:
+};
+
+static CDefaultElementPropertiesChoices s_DefaultChoices;
+IElementPropertiesChoices *g_pElementPropertiesChoices = &s_DefaultChoices;
+IElementPropertiesChoices *ElementPropertiesChoices()
+{
+ return g_pElementPropertiesChoices;
+}
+
+void SetElementPropertiesChoices( IElementPropertiesChoices *pElementPropertiesChoices )
+{
+ g_pElementPropertiesChoices = pElementPropertiesChoices ? pElementPropertiesChoices : &s_DefaultChoices;
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose: finds a particular interface in the factory set
+//-----------------------------------------------------------------------------
+static void *InitializeInterface( char const *interfaceName, CreateInterfaceFn *factoryList, int numFactories )
+{
+ void *retval;
+
+ for ( int i = 0; i < numFactories; i++ )
+ {
+ CreateInterfaceFn factory = factoryList[ i ];
+ if ( !factory )
+ continue;
+
+ retval = factory( interfaceName, NULL );
+ if ( retval )
+ return retval;
+ }
+
+ // No provider for requested interface!!!
+ // Assert( !"No provider for requested interface!!!" );
+
+ return NULL;
+}
+
+
+//-----------------------------------------------------------------------------
+// Purpose: Initializes the controls
+//-----------------------------------------------------------------------------
+bool VGui_InitDmeInterfacesList( const char *moduleName, CreateInterfaceFn *factoryList, int numFactories )
+{
+ if ( !vgui::VGui_InitMatSysInterfacesList( moduleName, factoryList, numFactories ) )
+ return false;
+
+ g_pSoundEmitterSystem = (ISoundEmitterSystemBase*)InitializeInterface( SOUNDEMITTERSYSTEM_INTERFACE_VERSION, factoryList, numFactories );
+ enginetools = (IEngineTool*)InitializeInterface( VENGINETOOL_INTERFACE_VERSION, factoryList, numFactories );
+ g_pPhysicsCollision = (IPhysicsCollision*)InitializeInterface( VPHYSICS_COLLISION_INTERFACE_VERSION, factoryList, numFactories );
+
+ // Can function without either of these
+ return true;
+}
+
+
+} // namespace vgui
+
+
+