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/sdk/vgui | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'game/client/sdk/vgui')
| -rw-r--r-- | game/client/sdk/vgui/sdkviewport.cpp | 85 | ||||
| -rw-r--r-- | game/client/sdk/vgui/sdkviewport.h | 40 | ||||
| -rw-r--r-- | game/client/sdk/vgui/vgui_rootpanel_sdk.cpp | 106 | ||||
| -rw-r--r-- | game/client/sdk/vgui/vgui_rootpanel_sdk.h | 56 |
4 files changed, 287 insertions, 0 deletions
diff --git a/game/client/sdk/vgui/sdkviewport.cpp b/game/client/sdk/vgui/sdkviewport.cpp new file mode 100644 index 0000000..5fd3627 --- /dev/null +++ b/game/client/sdk/vgui/sdkviewport.cpp @@ -0,0 +1,85 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: Client DLL VGUI2 Viewport +// +// $Workfile: $ +// $Date: $ +// +//----------------------------------------------------------------------------- +// $Log: $ +// +// $NoKeywords: $ +//=============================================================================// + +#include "cbase.h" + +#pragma warning( disable : 4800 ) // disable forcing int to bool performance warning + +// VGUI panel includes +#include <vgui_controls/Panel.h> +#include <vgui/ISurface.h> +#include <KeyValues.h> +#include <vgui/Cursor.h> +#include <vgui/IScheme.h> +#include <vgui/IVGui.h> +#include <vgui/ILocalize.h> +#include <vgui/VGUI.h> + +// client dll/engine defines +#include "hud.h" +#include <voice_status.h> + +// viewport definitions +#include <baseviewport.h> +#include "SDKViewport.h" + +#include "vguicenterprint.h" +#include "text_message.h" + + +void SDKViewport::ApplySchemeSettings( vgui::IScheme *pScheme ) +{ + BaseClass::ApplySchemeSettings( pScheme ); + + gHUD.InitColors( pScheme ); + + SetPaintBackgroundEnabled( false ); +} + + +IViewPortPanel* SDKViewport::CreatePanelByName(const char *szPanelName) +{ + IViewPortPanel* newpanel = NULL; + +// Up here, strcmp against each type of panel we know how to create. +// else if ( Q_strcmp(PANEL_OVERVIEW, szPanelName) == 0 ) +// { +// newpanel = new CCSMapOverview( this ); +// } + + // create a generic base panel, don't add twice + newpanel = BaseClass::CreatePanelByName( szPanelName ); + + return newpanel; +} + +void SDKViewport::CreateDefaultPanels( void ) +{ + BaseClass::CreateDefaultPanels(); +} + +int SDKViewport::GetDeathMessageStartHeight( void ) +{ + int x = YRES(2); + + IViewPortPanel *spectator = gViewPortInterface->FindPanelByName( PANEL_SPECGUI ); + + //TODO: Link to actual height of spectator bar + if ( spectator && spectator->IsVisible() ) + { + x += YRES(52); + } + + return x; +} + diff --git a/game/client/sdk/vgui/sdkviewport.h b/game/client/sdk/vgui/sdkviewport.h new file mode 100644 index 0000000..159da39 --- /dev/null +++ b/game/client/sdk/vgui/sdkviewport.h @@ -0,0 +1,40 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#ifndef SDKVIEWPORT_H +#define SDKVIEWPORT_H + + +#include "sdk_shareddefs.h" +#include "baseviewport.h" + + +using namespace vgui; + +namespace vgui +{ + class Panel; +} + +class SDKViewport : public CBaseViewport +{ + +private: + DECLARE_CLASS_SIMPLE( SDKViewport, CBaseViewport ); + +public: + + IViewPortPanel* CreatePanelByName(const char *szPanelName); + void CreateDefaultPanels( void ); + + virtual void ApplySchemeSettings( vgui::IScheme *pScheme ); + + int GetDeathMessageStartHeight( void ); +}; + + +#endif // SDKViewport_H diff --git a/game/client/sdk/vgui/vgui_rootpanel_sdk.cpp b/game/client/sdk/vgui/vgui_rootpanel_sdk.cpp new file mode 100644 index 0000000..e756829 --- /dev/null +++ b/game/client/sdk/vgui/vgui_rootpanel_sdk.cpp @@ -0,0 +1,106 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// +#include "cbase.h" +#include "vgui_int.h" +#include "ienginevgui.h" +#include "vgui_rootpanel_sdk.h" +#include "vgui/IVGui.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +C_SDKRootPanel *g_pRootPanel = NULL; + + +//----------------------------------------------------------------------------- +// Global functions. +//----------------------------------------------------------------------------- +void VGUI_CreateClientDLLRootPanel( void ) +{ + g_pRootPanel = new C_SDKRootPanel( enginevgui->GetPanel( PANEL_CLIENTDLL ) ); +} + +void VGUI_DestroyClientDLLRootPanel( void ) +{ + delete g_pRootPanel; + g_pRootPanel = NULL; +} + +vgui::VPANEL VGui_GetClientDLLRootPanel( void ) +{ + return g_pRootPanel->GetVPanel(); +} + + +//----------------------------------------------------------------------------- +// C_SDKRootPanel implementation. +//----------------------------------------------------------------------------- +C_SDKRootPanel::C_SDKRootPanel( vgui::VPANEL parent ) + : BaseClass( NULL, "SDK Root Panel" ) +{ + SetParent( parent ); + SetPaintEnabled( false ); + SetPaintBorderEnabled( false ); + SetPaintBackgroundEnabled( false ); + + // This panel does post child painting + SetPostChildPaintEnabled( true ); + + // Make it screen sized + SetBounds( 0, 0, ScreenWidth(), ScreenHeight() ); + + // Ask for OnTick messages + vgui::ivgui()->AddTickSignal( GetVPanel() ); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +C_SDKRootPanel::~C_SDKRootPanel( void ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void C_SDKRootPanel::PostChildPaint() +{ + BaseClass::PostChildPaint(); + + // Draw all panel effects + RenderPanelEffects(); +} + +//----------------------------------------------------------------------------- +// Purpose: For each panel effect, check if it wants to draw and draw it on +// this panel/surface if so +//----------------------------------------------------------------------------- +void C_SDKRootPanel::RenderPanelEffects( void ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void C_SDKRootPanel::OnTick( void ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: Reset effects on level load/shutdown +//----------------------------------------------------------------------------- +void C_SDKRootPanel::LevelInit( void ) +{ +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void C_SDKRootPanel::LevelShutdown( void ) +{ +} + diff --git a/game/client/sdk/vgui/vgui_rootpanel_sdk.h b/game/client/sdk/vgui/vgui_rootpanel_sdk.h new file mode 100644 index 0000000..448abbc --- /dev/null +++ b/game/client/sdk/vgui/vgui_rootpanel_sdk.h @@ -0,0 +1,56 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +//=============================================================================// + +#ifndef VGUI_ROOTPANEL_SDK_H +#define VGUI_ROOTPANEL_SDK_H +#ifdef _WIN32 +#pragma once +#endif + + +#include <vgui_controls/Panel.h> +#include <vgui_controls/EditablePanel.h> +#include "utlvector.h" + + +class CPanelEffect; + + +// Serial under of effect, for safe lookup +typedef unsigned int EFFECT_HANDLE; + +//----------------------------------------------------------------------------- +// Purpose: Sits between engine and client .dll panels +// Responsible for drawing screen overlays +//----------------------------------------------------------------------------- +class C_SDKRootPanel : public vgui::Panel +{ + typedef vgui::Panel BaseClass; +public: + C_SDKRootPanel( vgui::VPANEL parent ); + virtual ~C_SDKRootPanel( void ); + + // Draw Panel effects here + virtual void PostChildPaint(); + + // Clear list of Panel Effects + virtual void LevelInit( void ); + virtual void LevelShutdown( void ); + + // Run effects and let them decide whether to remove themselves + void OnTick( void ); + +private: + + // Render all panel effects + void RenderPanelEffects( void ); + + // List of current panel effects + CUtlVector< CPanelEffect *> m_Effects; +}; + + +#endif // VGUI_ROOTPANEL_SDK_H |