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 /game/client/game_controls/intromenu.cpp | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/game_controls/intromenu.cpp')
| -rw-r--r-- | game/client/game_controls/intromenu.cpp | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/game/client/game_controls/intromenu.cpp b/game/client/game_controls/intromenu.cpp new file mode 100644 index 0000000..bf31a83 --- /dev/null +++ b/game/client/game_controls/intromenu.cpp @@ -0,0 +1,122 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//============================================================================= + +#include "cbase.h" +#include "intromenu.h" +#include <networkstringtabledefs.h> +#include <cdll_client_int.h> +#include <vgui/IScheme.h> +#include <vgui/ILocalize.h> +#include <vgui/ISurface.h> +#include <filesystem.h> +#include <KeyValues.h> +#include <convar.h> +#include <game/client/iviewport.h> +#include "spectatorgui.h" +#include "gamerules.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +using namespace vgui; + +//----------------------------------------------------------------------------- +// Purpose: Constructor +//----------------------------------------------------------------------------- +CIntroMenu::CIntroMenu( IViewPort *pViewPort ) : Frame( NULL, PANEL_INTRO ) +{ + // initialize dialog + m_pViewPort = pViewPort; + + m_pTitleLabel = NULL; + + // load the new scheme early!! + SetScheme( "ClientScheme" ); + SetMoveable( false ); + SetSizeable( false ); + SetProportional( true ); + + // hide the system buttons + SetTitleBarVisible( false ); + + Reset(); +} + +//----------------------------------------------------------------------------- +// Purpose: Destructor +//----------------------------------------------------------------------------- +CIntroMenu::~CIntroMenu() +{ +} + +//----------------------------------------------------------------------------- +// Purpose: Sets the color of the top and bottom bars +//----------------------------------------------------------------------------- +void CIntroMenu::ApplySchemeSettings( IScheme *pScheme ) +{ + BaseClass::ApplySchemeSettings( pScheme ); + + LoadControlSettings("Resource/UI/IntroMenu.res"); + + m_pTitleLabel = dynamic_cast<Label *>( FindChildByName( "titlelabel" ) ); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CIntroMenu::Reset( void ) +{ + Update(); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CIntroMenu::Update( void ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CIntroMenu::OnCommand( const char *command ) +{ + if ( !Q_strcmp( command, "skip" ) ) + { + engine->ClientCmd( "intro_skip" ); + m_pViewPort->ShowPanel( this, false ); + } + + BaseClass::OnCommand( command ); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CIntroMenu::ShowPanel( bool bShow ) +{ + if ( BaseClass::IsVisible() == bShow ) + return; + + m_pViewPort->ShowBackGround( bShow ); + + if ( bShow ) + { + Activate(); + + if ( GameRules() ) + { + SetDialogVariable( "gamemode", g_pVGuiLocalize->Find( GameRules()->GetGameTypeName() ) ); + } + + SetMouseInputEnabled( true ); + } + else + { + SetVisible( false ); + SetMouseInputEnabled( false ); + } +} |