diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/client/vgui_loadingdiscpanel.cpp | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/client/vgui_loadingdiscpanel.cpp')
| -rw-r--r-- | mp/src/game/client/vgui_loadingdiscpanel.cpp | 352 |
1 files changed, 176 insertions, 176 deletions
diff --git a/mp/src/game/client/vgui_loadingdiscpanel.cpp b/mp/src/game/client/vgui_loadingdiscpanel.cpp index 187cb8c5..94b2a9fb 100644 --- a/mp/src/game/client/vgui_loadingdiscpanel.cpp +++ b/mp/src/game/client/vgui_loadingdiscpanel.cpp @@ -1,176 +1,176 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $Workfile: $
-// $Date: $
-// $NoKeywords: $
-//=============================================================================//
-#include "cbase.h"
-#include "iloadingdisc.h"
-#include "vgui_controls/Frame.h"
-#include "vgui_controls/Label.h"
-#include "hud_numericdisplay.h"
-#include "vgui/ISurface.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-//-----------------------------------------------------------------------------
-// Purpose: Displays the loading plaque
-//-----------------------------------------------------------------------------
-class CLoadingDiscPanel : public vgui::EditablePanel
-{
- typedef vgui::EditablePanel BaseClass;
-public:
- CLoadingDiscPanel( vgui::VPANEL parent );
- ~CLoadingDiscPanel();
-
- virtual void ApplySchemeSettings( vgui::IScheme *pScheme )
- {
- BaseClass::ApplySchemeSettings( pScheme );
-
- int w, h;
- w = ScreenWidth();
- h = ScreenHeight();
-
- if ( w != m_ScreenSize[ 0 ] ||
- h != m_ScreenSize[ 1 ] )
- {
- m_ScreenSize[ 0 ] = w;
- m_ScreenSize[ 1 ] = h;
-
- // Re-perform the layout if the screen size changed
- LoadControlSettings( "resource/LoadingDiscPanel.res" );
- }
-
- // center the dialog
- int wide, tall;
- GetSize( wide, tall );
- SetPos( ( w - wide ) / 2, ( h - tall ) / 2 );
- }
-
- virtual void PaintBackground()
- {
- SetBgColor( Color(0, 0, 0, 128) );
- SetPaintBackgroundType( 2 );
- BaseClass::PaintBackground();
- }
-
- virtual void SetText( const char *text )
- {
- m_pLoadingLabel->SetText( text );
- }
-
-private:
- vgui::Label *m_pLoadingLabel;
- int m_ScreenSize[ 2 ];
-};
-
-//-----------------------------------------------------------------------------
-// Purpose: Constructor
-//-----------------------------------------------------------------------------
-CLoadingDiscPanel::CLoadingDiscPanel( vgui::VPANEL parent ) : BaseClass( NULL, "CLoadingDiscPanel" )
-{
- int w, h;
- w = ScreenWidth();
- h = ScreenHeight();
-
- SetParent( parent );
- SetProportional( true );
- SetScheme( "ClientScheme" );
- SetVisible( false );
- SetCursor( NULL );
-
- m_pLoadingLabel = vgui::SETUP_PANEL(new vgui::Label( this, "LoadingLabel", "" ));
- m_pLoadingLabel->SetPaintBackgroundEnabled( false );
-
- LoadControlSettings( "resource/LoadingDiscPanel.res" );
-
- // center the dialog
- int wide, tall;
- GetSize( wide, tall );
- SetPos( ( w - wide ) / 2, ( h - tall ) / 2 );
-
- m_ScreenSize[ 0 ] = w;
- m_ScreenSize[ 1 ] = h;
-}
-
-//-----------------------------------------------------------------------------
-// Purpose: Destructor
-//-----------------------------------------------------------------------------
-CLoadingDiscPanel::~CLoadingDiscPanel()
-{
-}
-
-class CLoadingDisc : public ILoadingDisc
-{
-private:
- CLoadingDiscPanel *loadingDiscPanel;
- CLoadingDiscPanel *m_pPauseDiscPanel;
- vgui::VPANEL m_hParent;
-
-public:
- CLoadingDisc( void )
- {
- loadingDiscPanel = NULL;
- m_pPauseDiscPanel = NULL;
- }
-
- void Create( vgui::VPANEL parent )
- {
- // don't create now, only when it's needed
- m_hParent = parent;
- }
-
- void Destroy( void )
- {
- if ( loadingDiscPanel )
- {
- loadingDiscPanel->SetParent( (vgui::Panel *)NULL );
- delete loadingDiscPanel;
- loadingDiscPanel = NULL;
- }
-
- if ( m_pPauseDiscPanel )
- {
- m_pPauseDiscPanel->SetParent( (vgui::Panel *)NULL );
- delete m_pPauseDiscPanel;
- m_pPauseDiscPanel = NULL;
- }
-
- m_hParent = NULL;
- }
-
- void SetLoadingVisible( bool bVisible )
- {
- // demand-create the dialog
- if ( bVisible && !loadingDiscPanel )
- {
- loadingDiscPanel = vgui::SETUP_PANEL(new CLoadingDiscPanel( m_hParent ) );
- }
-
- if ( loadingDiscPanel )
- {
- loadingDiscPanel->SetVisible( bVisible );
- }
- }
-
-
- void SetPausedVisible( bool bVisible )
- {
- if ( bVisible && !m_pPauseDiscPanel )
- {
- m_pPauseDiscPanel = vgui::SETUP_PANEL(new CLoadingDiscPanel( m_hParent ) );
- m_pPauseDiscPanel->SetText( "#gameui_paused" );
- }
-
- if ( m_pPauseDiscPanel )
- {
- m_pPauseDiscPanel->SetVisible( bVisible );
- }
- }
-};
-
-static CLoadingDisc g_LoadingDisc;
-ILoadingDisc *loadingdisc = ( ILoadingDisc * )&g_LoadingDisc;
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $Workfile: $ +// $Date: $ +// $NoKeywords: $ +//=============================================================================// +#include "cbase.h" +#include "iloadingdisc.h" +#include "vgui_controls/Frame.h" +#include "vgui_controls/Label.h" +#include "hud_numericdisplay.h" +#include "vgui/ISurface.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +//----------------------------------------------------------------------------- +// Purpose: Displays the loading plaque +//----------------------------------------------------------------------------- +class CLoadingDiscPanel : public vgui::EditablePanel +{ + typedef vgui::EditablePanel BaseClass; +public: + CLoadingDiscPanel( vgui::VPANEL parent ); + ~CLoadingDiscPanel(); + + virtual void ApplySchemeSettings( vgui::IScheme *pScheme ) + { + BaseClass::ApplySchemeSettings( pScheme ); + + int w, h; + w = ScreenWidth(); + h = ScreenHeight(); + + if ( w != m_ScreenSize[ 0 ] || + h != m_ScreenSize[ 1 ] ) + { + m_ScreenSize[ 0 ] = w; + m_ScreenSize[ 1 ] = h; + + // Re-perform the layout if the screen size changed + LoadControlSettings( "resource/LoadingDiscPanel.res" ); + } + + // center the dialog + int wide, tall; + GetSize( wide, tall ); + SetPos( ( w - wide ) / 2, ( h - tall ) / 2 ); + } + + virtual void PaintBackground() + { + SetBgColor( Color(0, 0, 0, 128) ); + SetPaintBackgroundType( 2 ); + BaseClass::PaintBackground(); + } + + virtual void SetText( const char *text ) + { + m_pLoadingLabel->SetText( text ); + } + +private: + vgui::Label *m_pLoadingLabel; + int m_ScreenSize[ 2 ]; +}; + +//----------------------------------------------------------------------------- +// Purpose: Constructor +//----------------------------------------------------------------------------- +CLoadingDiscPanel::CLoadingDiscPanel( vgui::VPANEL parent ) : BaseClass( NULL, "CLoadingDiscPanel" ) +{ + int w, h; + w = ScreenWidth(); + h = ScreenHeight(); + + SetParent( parent ); + SetProportional( true ); + SetScheme( "ClientScheme" ); + SetVisible( false ); + SetCursor( NULL ); + + m_pLoadingLabel = vgui::SETUP_PANEL(new vgui::Label( this, "LoadingLabel", "" )); + m_pLoadingLabel->SetPaintBackgroundEnabled( false ); + + LoadControlSettings( "resource/LoadingDiscPanel.res" ); + + // center the dialog + int wide, tall; + GetSize( wide, tall ); + SetPos( ( w - wide ) / 2, ( h - tall ) / 2 ); + + m_ScreenSize[ 0 ] = w; + m_ScreenSize[ 1 ] = h; +} + +//----------------------------------------------------------------------------- +// Purpose: Destructor +//----------------------------------------------------------------------------- +CLoadingDiscPanel::~CLoadingDiscPanel() +{ +} + +class CLoadingDisc : public ILoadingDisc +{ +private: + CLoadingDiscPanel *loadingDiscPanel; + CLoadingDiscPanel *m_pPauseDiscPanel; + vgui::VPANEL m_hParent; + +public: + CLoadingDisc( void ) + { + loadingDiscPanel = NULL; + m_pPauseDiscPanel = NULL; + } + + void Create( vgui::VPANEL parent ) + { + // don't create now, only when it's needed + m_hParent = parent; + } + + void Destroy( void ) + { + if ( loadingDiscPanel ) + { + loadingDiscPanel->SetParent( (vgui::Panel *)NULL ); + delete loadingDiscPanel; + loadingDiscPanel = NULL; + } + + if ( m_pPauseDiscPanel ) + { + m_pPauseDiscPanel->SetParent( (vgui::Panel *)NULL ); + delete m_pPauseDiscPanel; + m_pPauseDiscPanel = NULL; + } + + m_hParent = NULL; + } + + void SetLoadingVisible( bool bVisible ) + { + // demand-create the dialog + if ( bVisible && !loadingDiscPanel ) + { + loadingDiscPanel = vgui::SETUP_PANEL(new CLoadingDiscPanel( m_hParent ) ); + } + + if ( loadingDiscPanel ) + { + loadingDiscPanel->SetVisible( bVisible ); + } + } + + + void SetPausedVisible( bool bVisible ) + { + if ( bVisible && !m_pPauseDiscPanel ) + { + m_pPauseDiscPanel = vgui::SETUP_PANEL(new CLoadingDiscPanel( m_hParent ) ); + m_pPauseDiscPanel->SetText( "#gameui_paused" ); + } + + if ( m_pPauseDiscPanel ) + { + m_pPauseDiscPanel->SetVisible( bVisible ); + } + } +}; + +static CLoadingDisc g_LoadingDisc; +ILoadingDisc *loadingdisc = ( ILoadingDisc * )&g_LoadingDisc; |