SpriteSheetAnimationFrame.cs 971 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright (c) Craftwork Games. All rights reserved.
  2. // Licensed under the MIT license.
  3. // See LICENSE file in the project root for full license information.
  4. using System;
  5. using System.Diagnostics;
  6. using MonoGame.Extended.Animations;
  7. namespace MonoGame.Extended.Graphics;
  8. /// <summary>
  9. /// Represents a single frame within a sprite sheet animation, including its index, display duration, and texture
  10. /// region.
  11. /// </summary>
  12. [DebuggerDisplay("{Index} {Duration}")]
  13. internal class SpriteSheetAnimationFrame : IAnimationFrame
  14. {
  15. /// <summary>
  16. /// Gets the index of the frame in the overall sprite sheet.
  17. /// </summary>
  18. public int FrameIndex { get; }
  19. /// <summary>
  20. /// Gets the total duration this frame should be displayed during an animation.
  21. /// </summary>
  22. public TimeSpan Duration { get; }
  23. internal SpriteSheetAnimationFrame(int index, TimeSpan duration)
  24. {
  25. FrameIndex = index;
  26. Duration = duration;
  27. }
  28. }