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
1.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef ANIMATINGIMAGEPANEL_H
  8. #define ANIMATINGIMAGEPANEL_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include <utlvector.h>
  13. #include <vgui_controls/Panel.h>
  14. namespace vgui
  15. {
  16. //-----------------------------------------------------------------------------
  17. // Purpose: Animating image
  18. //-----------------------------------------------------------------------------
  19. class AnimatingImagePanel : public Panel
  20. {
  21. DECLARE_CLASS_SIMPLE( AnimatingImagePanel, Panel );
  22. public:
  23. AnimatingImagePanel(Panel *parent, const char *name);
  24. // Add an image to the end of the list of animations
  25. // image - pointer to the image to add to the end of the list
  26. virtual void AddImage(IImage *image);
  27. // Load a set of animations by name.
  28. // baseName - The name of the animations without their frame number or file extension, (e.g. c1.tga becomes just c.)
  29. // framecount: number of frames in the animation
  30. virtual void LoadAnimation(const char *baseName, int frameCount);
  31. virtual void StartAnimation();
  32. virtual void StopAnimation();
  33. virtual void ResetAnimation(int frame = 0);
  34. protected:
  35. virtual void OnTick();
  36. virtual void PerformLayout();
  37. virtual void PaintBackground();
  38. virtual void GetSettings(KeyValues *outResourceData);
  39. virtual void ApplySettings(KeyValues *inResourceData);
  40. virtual const char *GetDescription();
  41. private:
  42. int m_iCurrentImage;
  43. int m_iNextFrameTime;
  44. int m_iFrameTimeMillis;
  45. CUtlVector<IImage *> m_Frames;
  46. char *m_pImageName;
  47. bool m_bAnimating;
  48. bool m_bFiltered;
  49. bool m_bScaleImage;
  50. };
  51. }; // namespace vgui
  52. #endif // ANIMATINGIMAGEPANEL_H