Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

89 lines
2.0 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "cbase.h"
  7. #include "hudelement.h"
  8. #include <vgui_controls/Panel.h>
  9. #include <vgui/ISurface.h>
  10. #include "c_dod_player.h"
  11. #include "iclientmode.h"
  12. class CHudAreaCapIcon : public CHudElement, public vgui::Panel
  13. {
  14. public:
  15. DECLARE_CLASS_SIMPLE( CHudAreaCapIcon, vgui::Panel );
  16. CHudAreaCapIcon( const char *name );
  17. virtual void Paint();
  18. virtual void Init();
  19. virtual bool ShouldDraw();
  20. private:
  21. int m_iAreaTexture;
  22. int m_iPrevMaterialIndex;
  23. Color m_clrIcon;
  24. };
  25. // DECLARE_HUDELEMENT( CHudAreaCapIcon );
  26. CHudAreaCapIcon::CHudAreaCapIcon( const char *pName ) :
  27. vgui::Panel( NULL, "HudAreaCapIcon" ), CHudElement( pName )
  28. {
  29. SetParent( g_pClientMode->GetViewport() );
  30. m_clrIcon = Color(255,255,255,255);
  31. m_iPrevMaterialIndex = 0;
  32. SetHiddenBits( HIDEHUD_PLAYERDEAD );
  33. }
  34. void CHudAreaCapIcon::Init()
  35. {
  36. m_iAreaTexture = vgui::surface()->CreateNewTextureID();
  37. }
  38. bool CHudAreaCapIcon::ShouldDraw()
  39. {
  40. return false;
  41. }
  42. void CHudAreaCapIcon::Paint()
  43. {
  44. /*
  45. C_DODPlayer *pPlayer = C_DODPlayer::GetLocalDODPlayer();
  46. if( !pPlayer )
  47. return;
  48. int x,y,w,h;
  49. GetBounds( x,y,w,h );
  50. // The player knows what material to show as our area icon
  51. int iMaterialIndex = pPlayer->m_Shared.GetAreaIconMaterial();
  52. if( iMaterialIndex <= 0 )
  53. return;
  54. // if the icon is changed from last draw, force the texture to reload
  55. bool bForceReload = ( m_iPrevMaterialIndex != iMaterialIndex );
  56. // get the material name from the material string table
  57. const char *szMatName = GetMaterialNameFromIndex( iMaterialIndex );
  58. // draw the icon
  59. vgui::surface()->DrawSetTextureFile( m_iAreaTexture, szMatName , true, bForceReload);
  60. vgui::surface()->DrawSetColor( m_clrIcon );
  61. vgui::surface()->DrawTexturedRect( 0, 0, w, h );
  62. // store the previous material index to compare next frame
  63. m_iPrevMaterialIndex = iMaterialIndex;*/
  64. }