Team Fortress 2 Source Code as on 22/4/2020
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.

65 lines
2.1 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //===========================================================================//
  7. #ifndef ENGINESPRITE_H
  8. #define ENGINESPRITE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "mathlib/vector.h"
  13. #include "video/ivideoservices.h"
  14. #include "const.h"
  15. //-----------------------------------------------------------------------------
  16. // Forward declarations
  17. //-----------------------------------------------------------------------------
  18. class IMaterial;
  19. class IMaterialVar;
  20. typedef struct wrect_s wrect_t;
  21. //-----------------------------------------------------------------------------
  22. // Purpose: Sprite Models
  23. //-----------------------------------------------------------------------------
  24. class CEngineSprite
  25. {
  26. // NOTE: don't define a constructor or destructor so that this can be allocated
  27. // as before.
  28. public:
  29. int GetWidth() { return m_width; }
  30. int GetHeight() { return m_height; }
  31. int GetNumFrames() { return m_numFrames; }
  32. IMaterial *GetMaterial( RenderMode_t nRenderMode ) { return m_material[nRenderMode]; }
  33. IMaterial *GetMaterial( RenderMode_t nRenderMode, int nFrame );
  34. void SetFrame( RenderMode_t nRenderMode, int nFrame );
  35. bool Init( const char *name );
  36. void Shutdown( void );
  37. void UnloadMaterial();
  38. void SetColor( float r, float g, float b );
  39. int GetOrientation( void );
  40. void GetHUDSpriteColor( float* color );
  41. float GetUp() { return up; }
  42. float GetDown() { return down; }
  43. float GetLeft() { return left; }
  44. float GetRight() { return right; }
  45. void DrawFrame( RenderMode_t nRenderMode, int frame, int x, int y, const wrect_t *prcSubRect );
  46. void DrawFrameOfSize( RenderMode_t nRenderMode, int frame, int x, int y, int iWidth, int iHeight, const wrect_t *prcSubRect);
  47. bool IsVideo();
  48. void GetTexCoordRange( float *pMinU, float *pMinV, float *pMaxU, float *pMaxV );
  49. private:
  50. IVideoMaterial *m_VideoMaterial;
  51. int m_width;
  52. int m_height;
  53. int m_numFrames;
  54. IMaterial *m_material[kRenderModeCount];
  55. int m_orientation;
  56. float m_hudSpriteColor[3];
  57. float up, down, left, right;
  58. };
  59. #endif // ENGINESPRITE_H