diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /vgui2/src/vgui_internal.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'vgui2/src/vgui_internal.cpp')
| -rw-r--r-- | vgui2/src/vgui_internal.cpp | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/vgui2/src/vgui_internal.cpp b/vgui2/src/vgui_internal.cpp new file mode 100644 index 0000000..ffcc63a --- /dev/null +++ b/vgui2/src/vgui_internal.cpp @@ -0,0 +1,68 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Core implementation of vgui +// +// $NoKeywords: $ +//=============================================================================// + +#include "vgui_internal.h" + +#include <vgui/ISurface.h> +#include <vgui/ILocalize.h> +#include <vgui/IPanel.h> +#include "filesystem.h" +#include <vstdlib/IKeyValuesSystem.h> + +#include <stdio.h> + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +namespace vgui +{ + +ISurface *g_pSurface = NULL; +IPanel *g_pIPanel = NULL; + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +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: +// Output : Returns true on success, false on failure. +//----------------------------------------------------------------------------- +bool VGui_InternalLoadInterfaces( CreateInterfaceFn *factoryList, int numFactories ) +{ + // loads all the interfaces + g_pSurface = (ISurface *)InitializeInterface(VGUI_SURFACE_INTERFACE_VERSION, factoryList, numFactories ); +// g_pKeyValues = (IKeyValues *)InitializeInterface(KEYVALUES_INTERFACE_VERSION, factoryList, numFactories ); + g_pIPanel = (IPanel *)InitializeInterface(VGUI_PANEL_INTERFACE_VERSION, factoryList, numFactories ); + + if (g_pSurface && /*g_pKeyValues &&*/ g_pIPanel) + return true; + + return false; +} + +} // namespace vgui |