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.

90 lines
2.5 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef HUD_MENU_H
  8. #define HUD_MENU_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "utlvector.h"
  13. #include "hudelement.h"
  14. #include <vgui_controls/Panel.h>
  15. #define MENU_SELECTION_TIMEOUT 5.0f
  16. //-----------------------------------------------------------------------------
  17. // Purpose:
  18. //-----------------------------------------------------------------------------
  19. class CHudMenu : public CHudElement, public vgui::Panel
  20. {
  21. DECLARE_CLASS_SIMPLE( CHudMenu, vgui::Panel );
  22. public:
  23. explicit CHudMenu( const char *pElementName );
  24. void Init( void );
  25. void VidInit( void );
  26. void Reset( void );
  27. virtual bool ShouldDraw( void );
  28. bool MsgFunc_ShowMenu( const CCSUsrMsg_ShowMenu &msg );
  29. void HideMenu( void );
  30. void ShowMenu( const char * menuName, int keySlot );
  31. void ShowMenu_KeyValueItems( KeyValues *pKV );
  32. bool IsMenuOpen( void );
  33. void SelectMenuItem( int menu_item );
  34. CUserMessageBinder m_UMCMsgShowMenu;
  35. private:
  36. virtual void OnThink();
  37. virtual void Paint();
  38. virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
  39. private:
  40. void ProcessText( void );
  41. void PaintString( const wchar_t *text, int textlen, vgui::HFont& font, int x, int y );
  42. struct ProcessedLine
  43. {
  44. int menuitem; // -1 for just text
  45. int startchar;
  46. int length;
  47. int pixels;
  48. int height;
  49. };
  50. CUtlVector< ProcessedLine > m_Processed;
  51. int m_nMaxPixels;
  52. int m_nHeight;
  53. bool m_bMenuDisplayed;
  54. int m_bitsValidSlots;
  55. float m_flShutoffTime;
  56. int m_nSelectedItem;
  57. bool m_bMenuTakesInput;
  58. float m_flSelectionTime;
  59. CPanelAnimationVar( float, m_flOpenCloseTime, "OpenCloseTime", "1" );
  60. CPanelAnimationVar( float, m_flBlur, "Blur", "0" );
  61. CPanelAnimationVar( float, m_flTextScan, "TextScane", "1" );
  62. CPanelAnimationVar( float, m_flAlphaOverride, "Alpha", "255.0" );
  63. CPanelAnimationVar( float, m_flSelectionAlphaOverride, "SelectionAlpha", "255.0" );
  64. CPanelAnimationVar( vgui::HFont, m_hTextFont, "TextFont", "MenuTextFont" );
  65. CPanelAnimationVar( vgui::HFont, m_hItemFont, "ItemFont", "MenuItemFont" );
  66. CPanelAnimationVar( vgui::HFont, m_hItemFontPulsing, "ItemFontPulsing", "MenuItemFontPulsing" );
  67. CPanelAnimationVar( Color, m_MenuColor, "MenuColor", "MenuColor" );
  68. CPanelAnimationVar( Color, m_ItemColor, "MenuItemColor", "ItemColor" );
  69. CPanelAnimationVar( Color, m_BoxColor, "MenuBoxColor", "MenuBoxBg" );
  70. };
  71. #endif // HUD_MENU_H