1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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 );
}
|