From 39ed87570bdb2f86969d4be821c94b722dc71179 Mon Sep 17 00:00:00 2001 From: Joe Ludwig Date: Wed, 26 Jun 2013 15:22:04 -0700 Subject: First version of the SOurce SDK 2013 --- mp/src/vgui2/vgui_controls/controls.cpp | 72 +++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 mp/src/vgui2/vgui_controls/controls.cpp (limited to 'mp/src/vgui2/vgui_controls/controls.cpp') diff --git a/mp/src/vgui2/vgui_controls/controls.cpp b/mp/src/vgui2/vgui_controls/controls.cpp new file mode 100644 index 00000000..2da48c2b --- /dev/null +++ b/mp/src/vgui2/vgui_controls/controls.cpp @@ -0,0 +1,72 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//===========================================================================// + +#include +#include + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +extern int g_nYou_Must_Add_Public_Vgui_Controls_Vgui_ControlsCpp_To_Your_Project; + +namespace vgui +{ + +static char g_szControlsModuleName[256]; + +//----------------------------------------------------------------------------- +// Purpose: Initializes the controls +//----------------------------------------------------------------------------- +extern "C" { extern int _heapmin(); } + +bool VGui_InitInterfacesList( const char *moduleName, CreateInterfaceFn *factoryList, int numFactories ) +{ + g_nYou_Must_Add_Public_Vgui_Controls_Vgui_ControlsCpp_To_Your_Project = 1; + + // If you hit this error, then you need to include memoverride.cpp in the project somewhere or else + // you'll get crashes later when vgui_controls allocates KeyValues and vgui tries to delete them. +#if !defined(NO_MALLOC_OVERRIDE) && defined( WIN32 ) + if ( _heapmin() != 1 ) + { + Assert( false ); + Error( "Must include memoverride.cpp in your project." ); + } +#endif + // keep a record of this module name + strncpy(g_szControlsModuleName, moduleName, sizeof(g_szControlsModuleName)); + g_szControlsModuleName[sizeof(g_szControlsModuleName) - 1] = 0; + + // initialize our locale (must be done for every vgui dll/exe) + // "" makes it use the default locale, required to make iswprint() work correctly in different languages + setlocale(LC_CTYPE, ""); + setlocale(LC_TIME, ""); + setlocale(LC_COLLATE, ""); + setlocale(LC_MONETARY, ""); + + // NOTE: Vgui expects to use these interfaces which are defined in tier3.lib + if ( !g_pVGui || !g_pVGuiInput || !g_pVGuiPanel || + !g_pVGuiSurface || !g_pVGuiSchemeManager || !g_pVGuiSystem ) + { + Warning( "vgui_controls is missing a required interface!\n" ); + return false; + } + + return true; +} + +//----------------------------------------------------------------------------- +// Purpose: returns the name of the module this has been compiled into +//----------------------------------------------------------------------------- +const char *GetControlsModuleName() +{ + return g_szControlsModuleName; +} + +} // namespace vgui + + + -- cgit v1.2.3