aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/client/vgui_entityimagepanel.h
blob: bb5452568d51feba0a73e65b15bc6e09faa384f0 (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
73
74
75
76
77
78
79
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: This is a panel which is rendered image on top of an entity
//
// $Revision: $
// $NoKeywords: $
//=============================================================================//

#ifndef VGUI_ENTITYIMAGEPANEL_H
#define VGUI_ENTITYIMAGEPANEL_H

#include "vgui_EntityPanel.h"
#include "shareddefs.h"

//-----------------------------------------------------------------------------
// forward declarations
//-----------------------------------------------------------------------------

class C_BaseEntity;
class KeyValues;
class BitmapImage;

//-----------------------------------------------------------------------------
// This is a base class for a panel which always is rendered on top of an entity
//-----------------------------------------------------------------------------

class CEntityImagePanel : public CEntityPanel
{
	DECLARE_CLASS( CEntityImagePanel, CEntityPanel );

public:
	// constructor
	CEntityImagePanel( vgui::Panel* pParent, const char *panelName );
	~CEntityImagePanel();

	// initialization
	virtual bool Init( KeyValues* pInitData, C_BaseEntity* pEntity );

	bool ShouldDraw();

	virtual void Paint( void );
	virtual void PaintBackground( void ) {}

private:
	// The bitmap to render
	BitmapImage *m_pImage;

protected:
	int m_r, m_g, m_b, m_a;
};


//-----------------------------------------------------------------------------
// Purpose: Same as above, but understands how to parse color/material out of
//  Team1/Team2 sections
//-----------------------------------------------------------------------------
class CEntityTeamImagePanel : public CEntityImagePanel
{
	DECLARE_CLASS( CEntityTeamImagePanel, CEntityImagePanel );

public:
	CEntityTeamImagePanel( vgui::Panel* pParent, const char *panelName );
	~CEntityTeamImagePanel( void );
	// initialization
	virtual bool Init( KeyValues* pInitData, C_BaseEntity* pEntity );

	virtual void Paint( void );

private:
	struct TEAMIMAGE
	{
		BitmapImage *m_pImage;
		int m_r, m_g, m_b, m_a;
	};

	TEAMIMAGE m_Images[ MAX_TEAMS ];
};

#endif //  VGUI_ENTITYIMAGEPANEL_H