//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

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

#include "hudelement.h"
#include <vgui_controls/Panel.h>
#include <vgui/ISurface.h>
#include <vgui/IVGui.h>

enum mouse_cursors
{
	CURSOR_NORMAL = 0,
	CURSOR_ATTACK,
	CURSOR_ABILITY,
	CURSOR_CAPTURE,
	CURSOR_COUNT,
};

enum visual_helpers_t
{
	VISUAL_NONE = 0,
	VISUAL_BUILD,		// shows a model of what we will build/spawn around the mouse cursor
};

namespace vgui
{
	class IScheme;
};

class C_LocalTempEntity;
class C_HL2Wars_Player;
class FileAbilityInfo_t;

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
class CHudMouseCursor : public CHudElement, public vgui::Panel
{
	DECLARE_CLASS_SIMPLE( CHudMouseCursor, vgui::Panel );
public:
	CHudMouseCursor( const char *pElementName );

	virtual void	LevelInit( void );
	virtual void	LevelShutdown( void );
	void			DrawSelectionBox( C_HL2Wars_Player* pPlayer ); 
	void			DrawRightClick();
	//void			DrawDirectionLine( C_HL2Wars_Player* pPlayer );
	void			DrawAbility( );
	QAngle			CalculateDirection( void );

	C_BaseEntity	*GetMouseOverEntity();

	void			UpdateMouseCursor( void );
protected:
	virtual void	ApplySchemeSettings( vgui::IScheme *scheme );
	virtual void	Paint();
	virtual void	OnThink();

private:
	void SelectBox( void );
	void UpdateHover( void );
	Vector retrieveGroundPos( void );

	void SelectAllInScreenOfType( C_BaseEntity *pType );
	C_BaseEntity *GetEntityMouse( void );

	void CreatePreviewEnt( FileAbilityInfo_t *pFAI );
	void UpdatePreviewEnt( byte r, byte g, byte b, byte a );
	void UpdatePreviewEnt( Vector origin );
	void UpdatePreviewEnt( QAngle angle );
	void DestroyPreviewEnt();

private:
	int m_nRTSButtonsPressed;

	Color			m_clrMouseCursor;
	int				m_iCursor;

	vgui::HCursor m_iMouseCursor[CURSOR_COUNT];

	Vector m_normal;
	Vector m_vMouseLeftPressed;
	Vector m_vMouseRightPressed;

	EHANDLE m_pMouseOverEnt;

	// position mouse
	int m_iX;
	int m_iY;

	// model we are drawing
	C_LocalTempEntity	*m_pMainPreviewEnt;
	CUtlVector<C_LocalTempEntity *> m_SubPreviewEnts;
	int					m_iCurrentAbility;
	bool				m_bAllowBuildEnt;
	bool				m_bDrawDirectionArrow;		// some abilities don't want the arrow

	// testing
	CMaterialReference m_ProjectTextureArrow;
	C_LocalTempEntity	*pCursorEnt;
};

inline C_BaseEntity	*CHudMouseCursor::GetMouseOverEntity() 
{ 
	return m_pMouseOverEnt; 
}

#endif // HUD_CROSSHAIR_H
