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.

155 lines
2.6 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Simple texture object used for sprites. Handed to the renderer
  4. // for binding. May become a general purpose texture object.
  5. //
  6. //=============================================================================//
  7. #ifndef TEXTURE_H
  8. #define TEXTURE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "IEditorTexture.h"
  13. enum
  14. {
  15. TEXTURE_HAS_ALPHA = 0x01
  16. };
  17. class CTexture : public IEditorTexture
  18. {
  19. public:
  20. CTexture( void );
  21. virtual ~CTexture( void );
  22. bool Allocate( int nWidth, int nHeight, int nFlags );
  23. void Draw(CDC *pDC, RECT &rect, int iFontHeight, int iIconHeight, DrawTexData_t &DrawTexData);
  24. inline void *GetImageDataPtr( void )
  25. {
  26. return( m_pImageData );
  27. }
  28. const char *GetFileName(void) const;
  29. inline const char *GetName(void) const
  30. {
  31. return(m_szName);
  32. }
  33. int GetShortName(char *pszName) const;
  34. int GetKeywords(char *pszKeywords) const;
  35. int GetImageDataRGB( void *pData = NULL );
  36. int GetImageDataRGBA( void *pData = NULL );
  37. inline int GetPreviewImageWidth( void ) const
  38. {
  39. return( m_nWidth );
  40. }
  41. inline int GetPreviewImageHeight( void ) const
  42. {
  43. return( m_nHeight );
  44. }
  45. inline int GetWidth( void ) const
  46. {
  47. return( m_nWidth );
  48. }
  49. inline int GetHeight( void ) const
  50. {
  51. return( m_nHeight );
  52. }
  53. inline float GetDecalScale( void ) const
  54. {
  55. return( 1.0f );
  56. }
  57. inline CPalette *GetPalette( void ) const
  58. {
  59. return( NULL );
  60. }
  61. inline int GetSurfaceAttributes( void ) const
  62. {
  63. return(0);
  64. }
  65. inline int GetSurfaceContents(void ) const
  66. {
  67. return(0);
  68. }
  69. inline int GetSurfaceValue( void ) const
  70. {
  71. return(0);
  72. }
  73. inline TEXTUREFORMAT GetTextureFormat( void ) const
  74. {
  75. return(tfSprite);
  76. }
  77. inline int GetTextureID( void ) const
  78. {
  79. return( m_nTextureID );
  80. }
  81. inline bool HasAlpha( void ) const
  82. {
  83. return( m_bHasAlpha );
  84. }
  85. inline bool HasData( void ) const
  86. {
  87. return( m_pImageData != NULL );
  88. }
  89. inline bool HasPalette( void ) const
  90. {
  91. return( false );
  92. }
  93. inline bool IsDummy( void ) const
  94. {
  95. return(( m_nWidth == 0) || ( m_nHeight == 0) || ( m_pImageData == NULL ));
  96. }
  97. bool Load( void );
  98. inline bool IsLoaded() const
  99. {
  100. return true;
  101. }
  102. inline void SetTextureID( int nTextureID )
  103. {
  104. m_nTextureID = nTextureID;
  105. }
  106. protected:
  107. int m_nTextureID; // Uniquely identifies this texture in all 3D renderers.
  108. int m_nWidth;
  109. int m_nHeight;
  110. bool m_bHasAlpha;
  111. char m_szName[MAX_PATH];
  112. void *m_pImageData;
  113. };
  114. #endif // TEXTURE_H