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.

66 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. //=======================================================================================//
  4. #ifndef CL_SCREENSHOTMANAGER_H
  5. #define CL_SCREENSHOTMANAGER_H
  6. #ifdef _WIN32
  7. #pragma once
  8. #endif
  9. //----------------------------------------------------------------------------------------
  10. #include "basethinker.h"
  11. #include "replay/ireplayscreenshotmanager.h"
  12. #include "replay/screenshot.h"
  13. //----------------------------------------------------------------------------------------
  14. class CReplay;
  15. //----------------------------------------------------------------------------------------
  16. class CScreenshotManager : public CBaseThinker,
  17. public IReplayScreenshotManager
  18. {
  19. public:
  20. CScreenshotManager();
  21. ~CScreenshotManager();
  22. bool Init();
  23. bool ShouldCaptureScreenshot();
  24. void DoCaptureScreenshot();
  25. void SetScreenshotReplay( ReplayHandle_t hReplay );
  26. ReplayHandle_t GetScreenshotReplay() const { return m_hScreenshotReplay; }
  27. //
  28. // IReplayScreenshotManager
  29. //
  30. virtual void CaptureScreenshot( CaptureScreenshotParams_t& params );
  31. virtual void GetUnpaddedScreenshotSize( int &nOutWidth, int &nOutHeight );
  32. virtual void DeleteScreenshotsForReplay( CReplay *pReplay );
  33. private:
  34. //
  35. // CBaseThinker
  36. //
  37. void Think();
  38. float GetNextThinkTime() const;
  39. float m_flScreenshotCaptureTime;
  40. CaptureScreenshotParams_t m_screenshotParams; // Params for next scheduled screenshot
  41. int m_aScreenshotWidths[3][2]; // [ 16:9, 16:10, 4:3 ][ lo res, hi res ]
  42. ReplayHandle_t m_hScreenshotReplay; // Destination replay for any screenshots taken - we always write to the "pending"
  43. // replay for the most part, but if we want to take a screenshot after the local
  44. // player is dead, we need to use a handle rather than using m_pPendingReplay directly,
  45. // since it becomes NULL when the player dies.
  46. float m_flLastScreenshotTime;
  47. int m_nPrevScreenDims[2]; // Screenshot dimensions, used to determine if we should update the screenshot cache on the client
  48. };
  49. //----------------------------------------------------------------------------------------
  50. #endif // CL_SCREENSHOTMANAGER_H