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.

79 lines
2.2 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: This is a panel which is rendered image on top of an entity
  4. //
  5. // $Revision: $
  6. // $NoKeywords: $
  7. //=============================================================================//
  8. #ifndef TEAMBITMAPIMAGE_H
  9. #define TEAMBITMAPIMAGE_H
  10. #ifdef _WIN32
  11. #pragma once
  12. #endif
  13. //#include "tf_shareddefs.h"
  14. #include <vgui/vgui.h>
  15. namespace vgui
  16. {
  17. class Panel;
  18. }
  19. class BitmapImage;
  20. class C_BaseEntity;
  21. class KeyValues;
  22. //-----------------------------------------------------------------------------
  23. // A multiplexer bitmap that chooses a bitmap based on team
  24. //-----------------------------------------------------------------------------
  25. class CTeamBitmapImage
  26. {
  27. public:
  28. // construction, destruction
  29. CTeamBitmapImage();
  30. ~CTeamBitmapImage();
  31. // initialization
  32. bool Init( vgui::Panel *pParent, KeyValues* pInitData, C_BaseEntity* pEntity );
  33. // Alpha override...
  34. void SetAlpha( float alpha );
  35. // Paint the sucka. Paint it the size of the parent panel
  36. void Paint( float yaw = 0.0f );
  37. protected:
  38. // Wrapper so we can implement this with EHANDLES some day
  39. C_BaseEntity *GetEntity() { return m_pEntity; }
  40. private:
  41. enum
  42. {
  43. // NOTE: Was MAX_TF_TEAMS not 4, but I don't like the dependency here.
  44. BITMAP_COUNT = 4 + 1
  45. };
  46. BitmapImage *m_ppImage[ BITMAP_COUNT ];
  47. C_BaseEntity *m_pEntity;
  48. float m_Alpha;
  49. bool m_bRelativeTeams;
  50. };
  51. //-----------------------------------------------------------------------------
  52. // Helper method to initialize a team image from KeyValues data..
  53. // KeyValues contains the bitmap data. pSectionName, if it exists,
  54. // indicates which subsection of pInitData should be looked at to get at the
  55. // image data. The final argument is the bitmap image to initialize.
  56. // The function returns true if it succeeded.
  57. //
  58. // NOTE: This function looks for the key values 'material' and 'color'
  59. // and uses them to set up the material + modulation color of the image
  60. //-----------------------------------------------------------------------------
  61. bool InitializeTeamImage( KeyValues *pInitData, const char* pSectionName,
  62. vgui::Panel *pParent, C_BaseEntity *pEntity, CTeamBitmapImage* pBitmapImage );
  63. #endif // TEAMBITMAPIMAGE_H