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.

69 lines
1.8 KiB

  1. //=========== Copyright Valve Corporation, All rights reserved. ===============//
  2. //
  3. // Purpose:
  4. //=============================================================================//
  5. #ifndef ANIMATED_IMAGE_STRIP_H
  6. #define ANIMATED_IMAGE_STRIP_H
  7. #ifdef _WIN32
  8. #pragma once
  9. #endif
  10. #include "image.h"
  11. namespace panorama
  12. {
  13. //-----------------------------------------------------------------------------
  14. // Purpose: Animated Image Strip
  15. //
  16. // Takes an image that has multiple sub-frames and animates displaying them.
  17. // Accepts strips in either horizontal or vertical orientation.
  18. //-----------------------------------------------------------------------------
  19. class CAnimatedImageStrip : public CImagePanel
  20. {
  21. DECLARE_PANEL2D( CAnimatedImageStrip, CImagePanel );
  22. public:
  23. CAnimatedImageStrip( CPanel2D *parent, const char * pchPanelID );
  24. virtual ~CAnimatedImageStrip();
  25. virtual bool BSetProperty( CPanoramaSymbol symName, const char *pchValue ) OVERRIDE;
  26. virtual void Paint() OVERRIDE;
  27. void StartAnimating();
  28. void StopAnimating();
  29. void StopAnimatingAtFrame( int nFrame );
  30. int GetDefaultFrame() const { return m_nDefaultFrame; }
  31. void SetDefaultFrame( int nFrame ) { m_nDefaultFrame = nFrame; }
  32. float GetFrameTime() const { return m_flFrameTime; }
  33. void SetFrameTime( float flFrameTime ) { m_flFrameTime = flFrameTime; }
  34. void SetCurrentFrame( int nFrame );
  35. int GetCurrentFrame() const { return m_nCurrentFrameIndex; }
  36. int GetFrameCount();
  37. private:
  38. void AdvanceFrame();
  39. int GetFrameIndex( int nFrame );
  40. bool EventPanelLoaded( const CPanelPtr< IUIPanel > &panelPtr );
  41. bool EventAdvanceFrame();
  42. int m_nDefaultFrame;
  43. float m_flFrameTime;
  44. int m_nCurrentFrameIndex;
  45. int m_nStopAtFrameIndex;
  46. bool m_bAnimating;
  47. bool m_bCurrentFramePainted;
  48. };
  49. } // namespace panorama
  50. #endif // PANORAMA_BUTTON_H