Skip to content

Commit

Permalink
Code documentation cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AristurtleDev committed Mar 26, 2024
1 parent eab0091 commit 8d40550
Show file tree
Hide file tree
Showing 18 changed files with 1,157 additions and 1,824 deletions.
142 changes: 68 additions & 74 deletions source/MonoGame.Aseprite/AnimatedSprite.cs

Large diffs are not rendered by default.

199 changes: 86 additions & 113 deletions source/MonoGame.Aseprite/AnimatedTIlemapFrame.cs

Large diffs are not rendered by default.

282 changes: 115 additions & 167 deletions source/MonoGame.Aseprite/AnimatedTilemap.cs

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions source/MonoGame.Aseprite/AnimationFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@
namespace MonoGame.Aseprite;

/// <summary>
/// Defines the source <see cref="TextureRegion"/> and duration of a single frame of animation in an
/// <see cref="AnimationTag"/>.
/// Defines the source <see cref="TextureRegion"/> and duration of a single frame of animation in an
/// <see cref="AnimationTag"/>.
/// </summary>
public sealed class AnimationFrame
{
/// <summary>
/// Gets the index of the source <see cref="TextureRegion"/> in the <see cref="TextureAtlas"/> of the
/// <see cref="SpriteSheet"/>.
/// Gets the index of the source <see cref="TextureRegion"/> in the <see cref="TextureAtlas"/> of the
/// <see cref="SpriteSheet"/>.
/// </summary>
public int FrameIndex { get; }

/// <summary>
/// Gets the source <see cref="TextureRegion"/> for this <see cref="AnimationFrame"/>.
/// Gets the source <see cref="TextureRegion"/> for this <see cref="AnimationFrame"/>.
/// </summary>
public TextureRegion TextureRegion { get; }

/// <summary>
/// Gets the duration of this <see cref="AnimationFrame"/>.
/// Gets the duration of this <see cref="AnimationFrame"/>.
/// </summary>
public TimeSpan Duration { get; }

Expand Down
46 changes: 19 additions & 27 deletions source/MonoGame.Aseprite/AnimationTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,54 +12,50 @@ public sealed class AnimationTag
private AnimationFrame[] _frames;

/// <summary>
/// Gets the name of the animation
/// Gets the name of the animation
/// </summary>
public string Name { get; }

/// <summary>
/// Gets a read-only span of the <see cref="AnimationFrame"/> elements that make up the animation. The order of
/// elements is from first frame to last frame in non-reverse order.
/// Gets a read-only span of the <see cref="AnimationFrame"/> elements that make up the animation. The order of
/// elements is from first frame to last frame in non-reverse order.
/// </summary>
public ReadOnlySpan<AnimationFrame> Frames => _frames;

/// <summary>
/// Gets the total number of ,<see cref="AnimationFrame"/> elements.
/// Gets the total number of ,<see cref="AnimationFrame"/> elements.
/// </summary>
public int FrameCount => _frames.Length;

/// <summary>
/// Gets the <see cref="AnimationFrame"/> element at the specified index from this <see cref="AnimationTag"/>.
/// Gets the <see cref="AnimationFrame"/> element at the specified index from this <see cref="AnimationTag"/>.
/// </summary>
/// <param name="index">
/// The index of the <see cref="AnimationFrame"/> to locate.
/// </param>
/// <returns>
/// The <see cref="AnimationFrame"/> located.
/// </returns>
/// <param name="index">The index of the <see cref="AnimationFrame"/> to locate.</param>
/// <returns>The <see cref="AnimationFrame"/> located.</returns>
/// <exception cref="ArgumentOutOfRangeException">
/// Thrown if the specified <paramref name="index"/> is less than zero or is greater than or equal to the total
/// number of <see cref="AnimationFrame"/> elements in this <see cref="AnimationTag"/>.
/// Thrown if the specified <paramref name="index"/> is less than zero or is greater than or equal to the total
/// number of <see cref="AnimationFrame"/> elements in this <see cref="AnimationTag"/>.
/// </exception>
public AnimationFrame this[int index] => GetFrame(index);

/// <summary>
/// Gets a value that indicates whether the animation should loop.
/// Gets a value that indicates whether the animation should loop.
/// </summary>
public bool IsLooping => LoopCount == 0;

/// <summary>
/// Gets or Sets a value that indicates whether the animation should play in reverse.
/// Gets or Sets a value that indicates whether the animation should play in reverse.
/// </summary>
public bool IsReversed { get; set; }

/// <summary>
/// Gets or Sets a value that indicates whether the animation should ping-pong once reaching the last frame of
/// animation.
/// Gets or Sets a value that indicates whether the animation should ping-pong once reaching the last frame of
/// animation.
/// </summary>
public bool IsPingPong { get; set; }

/// <summary>
/// Gets or Sets a value that indicates the total number of loops/cycles of this animation that should play.
/// Gets or Sets a value that indicates the total number of loops/cycles of this animation that should play.
/// </summary>
/// <remarks>
/// <para>
Expand All @@ -76,17 +72,13 @@ internal AnimationTag(string name, AnimationFrame[] frames, int loopCount, bool
(Name, _frames, LoopCount, IsReversed, IsPingPong) = (name, frames, loopCount, isReversed, isPingPong);

/// <summary>
/// Gets the <see cref="AnimationFrame"/> element at the specified index from this <see cref="AnimationTag"/>.
/// Gets the <see cref="AnimationFrame"/> element at the specified index from this <see cref="AnimationTag"/>.
/// </summary>
/// <param name="index">
/// The index of the <see cref="AnimationFrame"/> to locate.
/// </param>
/// <returns>
/// The <see cref="AnimationFrame"/> located.
/// </returns>
/// <param name="index">The index of the <see cref="AnimationFrame"/> to locate.</param>
/// <returns>The <see cref="AnimationFrame"/> located.</returns>
/// <exception cref="ArgumentOutOfRangeException">
/// Thrown if the specified <paramref name="index"/> is less than zero or is greater than or equal to the total
/// number of <see cref="AnimationFrame"/> elements in this <see cref="AnimationTag"/>.
/// Thrown if the specified <paramref name="index"/> is less than zero or is greater than or equal to the total
/// number of <see cref="AnimationFrame"/> elements in this <see cref="AnimationTag"/>.
/// </exception>
public AnimationFrame GetFrame(int index)
{
Expand Down
68 changes: 26 additions & 42 deletions source/MonoGame.Aseprite/AnimationTagBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace MonoGame.Aseprite;

/// <summary>
/// Defines a builder building an <see cref="AnimationTag"/> for a <see cref="SpriteSheet"/>.
/// Defines a builder building an <see cref="AnimationTag"/> for a <see cref="SpriteSheet"/>.
/// </summary>
public sealed class AnimationTagBuilder
{
Expand All @@ -20,23 +20,19 @@ internal AnimationTagBuilder(string name, SpriteSheet spriteSheet) =>
(_name, _spriteSheet) = (name, spriteSheet);

/// <summary>
/// Adds a new frame of animation to the <see cref="AnimationTag"/> using the <see cref="TextureRegion"/>
/// located at the specified index in the <see cref="TextureAtlas"/> of the <see cref="SpriteSheet"/> and with
/// the specified duration.
/// Adds a new frame of animation to the <see cref="AnimationTag"/> using the <see cref="TextureRegion"/>
/// located at the specified index in the <see cref="TextureAtlas"/> of the <see cref="SpriteSheet"/> and with
/// the specified duration.
/// </summary>
/// <param name="regionIndex">
/// The index of the source <see cref="TextureRegion"/> in the <see cref="TextureAtlas"/> of the
/// <see cref="SpriteSheet"/>.
/// The index of the source <see cref="TextureRegion"/> in the <see cref="TextureAtlas"/> of the
/// <see cref="SpriteSheet"/>.
/// </param>
/// <param name="duration">
/// The duration of the frame of animation.
/// </param>
/// <returns>
/// This instance of the <see cref="AnimationTagBuilder"/> class.
/// </returns>
/// <param name="duration">The duration of the frame of animation.</param>
/// <returns>This instance of the <see cref="AnimationTagBuilder"/> class.</returns>
/// <exception cref="ArgumentOutOfRangeException">
/// Throw if the specified index is less than zero or is greater than or equal to the total number of regions in
/// the <see cref="TextureAtlas"/>.
/// Throw if the specified index is less than zero or is greater than or equal to the total number of regions in
/// the <see cref="TextureAtlas"/>.
/// </exception>
public AnimationTagBuilder AddFrame(int regionIndex, TimeSpan duration)
{
Expand All @@ -47,23 +43,19 @@ public AnimationTagBuilder AddFrame(int regionIndex, TimeSpan duration)
}

/// <summary>
/// Adds a new frame of animation to the <see cref="AnimationTag"/> using the <see cref="TextureRegion"/> with
/// the specified name in the <see cref="TextureAtlas"/> of the <see cref="SpriteSheet"/> and with the specified
/// duration.
/// Adds a new frame of animation to the <see cref="AnimationTag"/> using the <see cref="TextureRegion"/> with
/// the specified name in the <see cref="TextureAtlas"/> of the <see cref="SpriteSheet"/> and with the specified
/// duration.
/// </summary>
/// <param name="regionName">
/// The name of the source <see cref="TextureRegion"/> in the <see cref="TextureAtlas"/> of the
/// <see cref="SpriteSheet"/>.
/// The name of the source <see cref="TextureRegion"/> in the <see cref="TextureAtlas"/> of the
/// <see cref="SpriteSheet"/>.
/// </param>
/// <param name="duration">
/// The duration of the frame of animation.
/// </param>
/// <returns>
/// This instance of the <see cref="AnimationTagBuilder"/> class.
/// </returns>
/// <param name="duration">The duration of the frame of animation.</param>
/// <returns>This instance of the <see cref="AnimationTagBuilder"/> class.</returns>
/// <exception cref="KeyNotFoundException">
/// Thrown if the <see cref="TextureAtlas"/> of the <see cref="SpriteSheet"/> does not contain a
/// <see cref="TextureRegion"/> with the specified name.
/// Thrown if the <see cref="TextureAtlas"/> of the <see cref="SpriteSheet"/> does not contain a
/// <see cref="TextureRegion"/> with the specified name.
/// </exception>
public AnimationTagBuilder AddFrame(string regionName, TimeSpan duration)
{
Expand All @@ -75,7 +67,7 @@ public AnimationTagBuilder AddFrame(string regionName, TimeSpan duration)
}

/// <summary>
/// Sets the total number of loops/cycles of the animation that should play.
/// Sets the total number of loops/cycles of the animation that should play.
/// </summary>
/// <remarks>
/// <para>
Expand All @@ -99,29 +91,21 @@ public AnimationTagBuilder LoopCount(int count)
}

/// <summary>
/// Sets whether the animation should play in reverse.
/// Sets whether the animation should play in reverse.
/// </summary>
/// <param name="isReversed">
/// A value that indicates whether the animation should play in reverse
/// </param>
/// <returns>
/// This instance of the <see cref="AnimationTagBuilder"/> class.
/// </returns>
/// <param name="isReversed">A value that indicates whether the animation should play in reverse</param>
/// <returns>This instance of the <see cref="AnimationTagBuilder"/> class.</returns>
public AnimationTagBuilder IsReversed(bool isReversed)
{
_isReversed = isReversed;
return this;
}

/// <summary>
/// Sets whether the animation should ping-pong once reaching the last frame of animation.
/// Sets whether the animation should ping-pong once reaching the last frame of animation.
/// </summary>
/// <param name="isPingPong">
/// A value that indicates whether the animation should ping-pong.
/// </param>
/// <returns>
/// This instance of the <see cref="AnimationTagBuilder"/> class.
/// </returns>
/// <param name="isPingPong">A value that indicates whether the animation should ping-pong.</param>
/// <returns>This instance of the <see cref="AnimationTagBuilder"/> class.</returns>
public AnimationTagBuilder IsPingPong(bool isPingPong)
{
_isPingPong = isPingPong;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ internal sealed class AsepriteFileContentTypeReader : ContentTypeReader<Aseprite
{
protected override AsepriteFile Read(ContentReader reader, AsepriteFile? existingInstance)
{

if (existingInstance is not null)
{
return existingInstance;
Expand Down
6 changes: 3 additions & 3 deletions source/MonoGame.Aseprite/NinePatchSlice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
namespace MonoGame.Aseprite;

/// <summary>
/// Defines a <see cref="Slice"/> with center bounds.
/// Defines a <see cref="Slice"/> with center bounds.
/// </summary>
public sealed class NinePatchSlice : Slice
{
/// <summary>
/// Gets the rectangular bounds of the center rectangle for this <see cref="NinePatchSlice"/>,
/// relative to it's bounds.
/// Gets the rectangular bounds of the center rectangle for this <see cref="NinePatchSlice"/>,
/// relative to it's bounds.
/// </summary>
public Rectangle CenterBounds { get; }

Expand Down
16 changes: 8 additions & 8 deletions source/MonoGame.Aseprite/Slice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,30 @@
namespace MonoGame.Aseprite;

/// <summary>
/// Defines a named slice for a <see cref="TextureRegion"/> with a bounds, origin, and color.
/// Defines a named slice for a <see cref="TextureRegion"/> with a bounds, origin, and color.
/// </summary>
public class Slice
{
/// <summary>
/// Gets the name assigned to this <see cref="Slice"/>.
/// Gets the name assigned to this <see cref="Slice"/>.
/// </summary>
public string Name { get; }

/// <summary>
/// Gets the rectangular bounds of this <see cref="Slice"/> relative to the bounds of the
/// <see cref="TextureRegion"/> it is in.
/// Gets the rectangular bounds of this <see cref="Slice"/> relative to the bounds of the
/// <see cref="TextureRegion"/> it is in.
/// </summary>
public Rectangle Bounds { get; }

/// <summary>
/// Gets the x- and y-coordinate origin point for this <see cref="Slice"/> relative to the
/// upper-left corner of the bonds of the <see cref="TextureRegion"/> it is in.
/// Gets the x- and y-coordinate origin point for this <see cref="Slice"/> relative to the
/// upper-left corner of the bonds of the <see cref="TextureRegion"/> it is in.
/// </summary>
public Vector2 Origin { get; }

/// <summary>
/// Gets the <see cref="Microsoft.Xna.Framework.Color"/> value assigned to this
/// <see cref="Slice"/>.
/// Gets the <see cref="Microsoft.Xna.Framework.Color"/> value assigned to this
/// <see cref="Slice"/>.
/// </summary>
public Color Color { get; }

Expand Down
Loading

0 comments on commit 8d40550

Please sign in to comment.