summaryrefslogtreecommitdiff
path: root/game/client/dod/VGUI/dodmenubackground.cpp
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/client/dod/VGUI/dodmenubackground.cpp
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'game/client/dod/VGUI/dodmenubackground.cpp')
-rw-r--r--game/client/dod/VGUI/dodmenubackground.cpp89
1 files changed, 89 insertions, 0 deletions
diff --git a/game/client/dod/VGUI/dodmenubackground.cpp b/game/client/dod/VGUI/dodmenubackground.cpp
new file mode 100644
index 0000000..4851f2e
--- /dev/null
+++ b/game/client/dod/VGUI/dodmenubackground.cpp
@@ -0,0 +1,89 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#include "cbase.h"
+#include <vgui/ISurface.h>
+#include "dodmenubackground.h"
+
+using namespace vgui;
+
+//-----------------------------------------------------------------------------
+// Purpose: Constructor
+//-----------------------------------------------------------------------------
+CDODMenuBackground::CDODMenuBackground(Panel *parent) : EditablePanel(parent, "MenuBackground")
+{
+ SetProportional(true);
+ SetVisible(true);
+
+ SetZPos( -1 );
+
+ LoadControlSettings("Resource/UI/MenuBackground.res");
+}
+
+void CDODMenuBackground::Init( void )
+{
+ m_iBackgroundTexture = vgui::surface()->CreateNewTextureID();
+ vgui::surface()->DrawSetTextureFile( m_iBackgroundTexture, "vgui/white", true, false);
+}
+
+void CDODMenuBackground::ApplySchemeSettings( IScheme *pScheme )
+{
+ int top[8];
+ int main[8];
+ int box[8];
+ int i;
+ for( i=0;i<8;i++ )
+ {
+ top[i] = vgui::scheme()->GetProportionalScaledValueEx( GetScheme(),iTopDims[i]);
+ main[i] = vgui::scheme()->GetProportionalScaledValueEx( GetScheme(),iMainDims[i]);
+ box[i] = vgui::scheme()->GetProportionalScaledValueEx( GetScheme(),iBoxDims[i]);
+
+ if ( i < 6 )
+ m_LineDims[i] = vgui::scheme()->GetProportionalScaledValueEx( GetScheme(),iLineDims[i]);
+ }
+
+ m_BackgroundTopVerts[0].Init( Vector2D( top[0], top[1] ) );
+ m_BackgroundTopVerts[1].Init( Vector2D( top[2], top[3] ) );
+ m_BackgroundTopVerts[2].Init( Vector2D( top[4], top[5] ) );
+ m_BackgroundTopVerts[3].Init( Vector2D( top[6], top[7] ) );
+
+ m_BackgroundMainVerts[0].Init( Vector2D( main[0], main[1] ) );
+ m_BackgroundMainVerts[1].Init( Vector2D( main[2], main[3] ) );
+ m_BackgroundMainVerts[2].Init( Vector2D( main[4], main[5] ) );
+ m_BackgroundMainVerts[3].Init( Vector2D( main[6], main[7] ) );
+
+ m_BoxVerts[0].Init( Vector2D( box[0], box[1] ) );
+ m_BoxVerts[1].Init( Vector2D( box[2], box[3] ) );
+ m_BoxVerts[2].Init( Vector2D( box[4], box[5] ) );
+ m_BoxVerts[3].Init( Vector2D( box[6], box[7] ) );
+
+ BaseClass::ApplySchemeSettings(pScheme);
+}
+
+//-----------------------------------------------------------------------------
+// Purpose: paint the dod style background
+//-----------------------------------------------------------------------------
+void CDODMenuBackground::Paint(void)
+{
+ vgui::surface()->DrawSetColor(128,110,53,235);
+ vgui::surface()->DrawSetTexture( m_iBackgroundTexture );
+
+ //top background
+ vgui::surface()->DrawTexturedPolygon( 4, m_BackgroundTopVerts );
+
+ //main background
+ vgui::surface()->DrawTexturedPolygon( 4, m_BackgroundMainVerts );
+
+ // top white line
+ vgui::surface()->DrawSetColor(255,255,255,196);
+ vgui::surface()->DrawLine( m_LineDims[0], m_LineDims[1], m_LineDims[2], m_LineDims[3] );
+ vgui::surface()->DrawLine( m_LineDims[2], m_LineDims[3], m_LineDims[4], m_LineDims[5] );
+
+ // top white box
+ vgui::surface()->DrawTexturedPolygon( 4, m_BoxVerts );
+}
+