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.

100 lines
2.1 KiB

  1. //========= Copyright � 1996-2009, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=====================================================================================//
  6. #ifndef __UIAVATARIMAGE_H__
  7. #define __UIAVATARIMAGE_H__
  8. #include "vgui/IImage.h"
  9. #ifdef _GAMECONSOLE
  10. typedef vgui::IImage CGameUiAvatarImage;
  11. #else
  12. #include "steam/steam_api.h"
  13. //-----------------------------------------------------------------------------
  14. // Purpose:
  15. //-----------------------------------------------------------------------------
  16. class CGameUiAvatarImage : public vgui::IImage
  17. {
  18. public:
  19. CGameUiAvatarImage( void );
  20. // Call this to set the steam ID associated with the avatar
  21. bool SetAvatarSteamID( CSteamID steamIDUser );
  22. void ClearAvatarSteamID( void );
  23. // Call to Paint the image
  24. // Image will draw within the current panel context at the specified position
  25. virtual void Paint( void );
  26. // Set the position of the image
  27. virtual void SetPos(int x, int y)
  28. {
  29. m_nX = x;
  30. m_nY = y;
  31. }
  32. // Gets the size of the content
  33. virtual void GetContentSize(int &wide, int &tall)
  34. {
  35. wide = m_nWide;
  36. tall = m_nTall;
  37. }
  38. // Get the size the image will actually draw in (usually defaults to the content size)
  39. virtual void GetSize(int &wide, int &tall)
  40. {
  41. GetContentSize( wide, tall );
  42. }
  43. // Sets the size of the image
  44. virtual void SetSize(int wide, int tall)
  45. {
  46. m_nWide = wide;
  47. m_nTall = tall;
  48. }
  49. // Set the draw color
  50. virtual void SetColor(Color col)
  51. {
  52. m_Color = col;
  53. }
  54. virtual void SetRotation( int )
  55. {
  56. ( void ) 0; // Not implemented
  57. }
  58. virtual bool Evict() { return false; }
  59. virtual int GetNumFrames() { return 0; }
  60. virtual void SetFrame( int nFrame ) {}
  61. virtual vgui::HTexture GetID() { return m_iTextureID; }
  62. bool IsValid( void ) { return m_bValid; }
  63. float GetFetchedTime() const { return m_flFetchedTime; }
  64. protected:
  65. void InitFromRGBA( const byte *rgba, int width, int height );
  66. private:
  67. Color m_Color;
  68. int m_iTextureID;
  69. int m_nX, m_nY, m_nWide, m_nTall;
  70. bool m_bValid;
  71. float m_flFetchedTime;
  72. };
  73. #endif // !_GAMECONSOLE
  74. #endif // __UIAVATARIMAGE_H__