summaryrefslogtreecommitdiff
path: root/game/client/tf/tf_hud_annotationspanel.h
blob: 63a80cb07c43e1457ec959ec2761bca30ef2257f (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
//=============================================================================

#ifndef TF_HUD_ANNOTATIONSPANEL_H
#define TF_HUD_ANNOTATIONSPANEL_H
#ifdef _WIN32
#pragma once
#endif

#include <vgui_controls/EditablePanel.h>
#include <game/client/iviewport.h>
#include <vgui/IScheme.h>
#include "hud.h"
#include "hudelement.h"
#include "tf_imagepanel.h"
#include "tf_hud_playerstatus.h"
#include "vgui_avatarimage.h"
#include "item_model_panel.h"
using namespace vgui;

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
class CTFAnnotationsPanelCallout : public EditablePanel
{
	DECLARE_CLASS_SIMPLE( CTFAnnotationsPanelCallout, EditablePanel );
public:
	CTFAnnotationsPanelCallout( Panel *parent, const char *name, int id, Vector &location, const char *text );
	~CTFAnnotationsPanelCallout();

	virtual void ApplySettings( KeyValues *pInResourceData );
	virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
	virtual void PerformLayout( void );

	bool	UpdateCallout();
	inline int GetAnnotationID(){ return m_ID; }
	inline void Touch();
	inline void	SetLocation( const Vector &location ) { m_Location = location; }
	inline void SetFollowEntity( CBaseEntity *pFollowEntity ) { m_FollowEntity = pFollowEntity; }
	inline void	SetVisibilityBitfield( int iVisibilityBitfield ) { m_iVisibilityBitfield = iVisibilityBitfield; }
	void	SetShowDistance( bool bShowDistance );
	void    SetLifetime( float flLifetime );
	void	SetText( const char *text );	
	void	FadeAndRemove();

private:
	int m_ID;
	Vector m_Location;
	CHandle< CBaseEntity > m_FollowEntity;
	Label *m_pAnnotationLabel;
	Label *m_pDistanceLabel;
	ImagePanel *m_pArrow;
	const char *m_Text;
	float m_DeathTime;
	float m_flLerpPercentage;
	int m_iVisibilityBitfield;
	bool m_bWasOffscreen;
	bool m_bShowDistance;
	Panel *m_pBackground;
	KeyValues *m_pArrowImages;
	float m_flAlpha[2];
};

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
class CTFAnnotationsPanel : public EditablePanel, public CHudElement
{
private:
	DECLARE_CLASS_SIMPLE( CTFAnnotationsPanel, EditablePanel );

public:
	CTFAnnotationsPanel( const char *pElementName );
	virtual ~CTFAnnotationsPanel();

	virtual void Reset();
	virtual void Init();
	virtual void ApplySchemeSettings( vgui::IScheme *pScheme );
	virtual void FireGameEvent( IGameEvent * event );

	void UpdateAnnotations( void );
	void AddAnnotation( IGameEvent * event );
	void HideAnnotation( int id );
	void RemoveAll();
	virtual bool ShouldDraw( void );
	void OnThink( void );


protected:
	CTFAnnotationsPanelCallout *TestAndAddCallout( int id, Vector &origin, const char *text );
		
private:
	bool					m_bShouldBeVisible;
	CUtlVector<CTFAnnotationsPanelCallout*>	m_pCalloutPanels;
	vgui::Panel				*m_pFreezePanelBG;

};

#endif // TF_HUD_ANNOTATIONSPANEL_H