summaryrefslogtreecommitdiff
path: root/game/client/tf2/playeroverlayclass.h
blob: ab4483d1d0f38863e9c3777254467c73162a3d59 (plain) (blame)
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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $Workfile:     $
// $Date:         $
// $NoKeywords: $
//=============================================================================//

#if !defined( PLAYEROVERLAYCLASS_H )
#define PLAYEROVERLAYCLASS_H
#ifdef _WIN32
#pragma once
#endif

#include "vgui_basepanel.h"

class BitmapImage;
class KeyValues;
class CHudPlayerOverlay;

class CHudPlayerOverlayClass : public CBasePanel
{
public:
	DECLARE_CLASS( CHudPlayerOverlayClass, CBasePanel );

	CHudPlayerOverlayClass( CHudPlayerOverlay *baseOverlay );
	virtual ~CHudPlayerOverlayClass( void );

	bool Init( KeyValues* pKeyValues );

	void SetColor( int r, int g, int b, int a );
	void SetImage( BitmapImage *pImage );
	void SetTeamAndClass( int team, int playerclass );

	// Keeps the image size correct
	virtual void SetSize( int w, int h );

	virtual void Paint( void );

	virtual void OnCursorEntered();
	virtual void OnCursorExited();

private:
	class CMapClassColors
	{
	public:
		CMapClassColors() : m_pClassImage(0) {}

		BitmapImage	*m_pClassImage;
		Color		m_clrClass;
	};

	// Initialize class info only once
	static bool InitClassInfo( KeyValues* pKeyValues );
	static bool ParseTeamClassInfo( KeyValues *pClassIcons, const char *classname, CMapClassColors *pClassColors );
	static bool ParseTeamClassIcons( CMapClassColors *pT, KeyValues *pTeam );

	static CMapClassColors** s_ppClassInfo;

	int		m_r, m_g, m_b, m_a;
	BitmapImage *m_pImage;

	Color m_fgColor;
	Color m_bgColor;

	CHudPlayerOverlay *m_pBaseOverlay;

	friend class CCleanupPlayerOverlayClass;
};

#endif // PLAYEROVERLAYCLASS_H