Counter Strike : Global Offensive Source Code
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.

99 lines
3.2 KiB

  1. //========= Copyright � 1996-2006, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef HUD_BASEDEATHNOTICE_H
  8. #define HUD_BASEDEATHNOTICE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. // Player entries in a death notice
  13. struct DeathNoticePlayer
  14. {
  15. DeathNoticePlayer()
  16. {
  17. szName[0] = 0;
  18. iTeam = TEAM_UNASSIGNED;
  19. }
  20. char szName[MAX_PLAYER_NAME_LENGTH*2]; // big enough for player name and additional information
  21. int iTeam; // team #
  22. };
  23. // Contents of each entry in our list of death notices
  24. struct DeathNoticeItem
  25. {
  26. DeathNoticeItem()
  27. {
  28. szIcon[0]=0;
  29. wzInfoText[0]=0;
  30. iconDeath = NULL;
  31. bSelfInflicted = false;
  32. flCreationTime = 0;
  33. bLocalPlayerInvolved = false;
  34. }
  35. float GetExpiryTime();
  36. DeathNoticePlayer Killer;
  37. DeathNoticePlayer Victim;
  38. char szIcon[32]; // name of icon to display
  39. wchar_t wzInfoText[32]; // any additional text to display next to icon
  40. CHudTexture *iconDeath;
  41. bool bSelfInflicted;
  42. float flCreationTime;
  43. bool bLocalPlayerInvolved;
  44. };
  45. #define NUM_CORNER_COORD 10
  46. #define NUM_BACKGROUND_COORD NUM_CORNER_COORD*4
  47. //-----------------------------------------------------------------------------
  48. // Purpose:
  49. //-----------------------------------------------------------------------------
  50. class CHudBaseDeathNotice : public CHudElement, public vgui::Panel
  51. {
  52. DECLARE_CLASS_SIMPLE( CHudBaseDeathNotice, vgui::Panel );
  53. public:
  54. explicit CHudBaseDeathNotice( const char *pElementName );
  55. void VidInit( void );
  56. virtual void Init( void );
  57. virtual bool ShouldDraw( void );
  58. virtual void Paint( void );
  59. virtual void ApplySchemeSettings( vgui::IScheme *scheme );
  60. void RetireExpiredDeathNotices( void );
  61. void FireGameEvent( IGameEvent *event );
  62. protected:
  63. virtual Color GetTeamColor( int iTeamNumber );
  64. virtual void OnGameEvent( IGameEvent *event, DeathNoticeItem &deathNoticeItem ) {};
  65. void DrawText( int x, int y, vgui::HFont hFont, Color clr, const wchar_t *szText );
  66. int AddDeathNoticeItem();
  67. void GetBackgroundPolygonVerts( int x0, int y0, int x1, int y1, int iVerts, vgui::Vertex_t vert[] );
  68. void CalcRoundedCorners();
  69. CHudTexture *GetIcon( const char *szIcon, bool bInvert );
  70. void GetLocalizedControlPointName( IGameEvent *event, char *namebuf, int namelen );
  71. CPanelAnimationVarAliasType( float, m_flLineHeight, "LineHeight", "16", "proportional_float" );
  72. CPanelAnimationVarAliasType( float, m_flLineSpacing, "LineSpacing", "4", "proportional_float" );
  73. CPanelAnimationVarAliasType( float, m_flCornerRadius, "CornerRadius", "3", "proportional_float" );
  74. CPanelAnimationVar( float, m_flMaxDeathNotices, "MaxDeathNotices", "4" );
  75. CPanelAnimationVar( bool, m_bRightJustify, "RightJustify", "1" );
  76. CPanelAnimationVar( vgui::HFont, m_hTextFont, "TextFont", "Default" );
  77. CPanelAnimationVar( Color, m_clrIcon, "IconColor", "255 80 0 255" );
  78. CPanelAnimationVar( Color, m_clrBaseBGColor, "BaseBackgroundColor", "46 43 42 220" );
  79. CPanelAnimationVar( Color, m_clrLocalBGColor, "LocalBackgroundColor", "245 229 196 200" );
  80. CUtlVector<DeathNoticeItem> m_DeathNotices;
  81. Vector2D m_CornerCoord[NUM_CORNER_COORD];
  82. };
  83. #endif // HUD_BASEDEATHNOTICE_H