From 8d40550ac78223da79ac431cc7135d78cc362e18 Mon Sep 17 00:00:00 2001 From: Christopher Whitley Date: Tue, 26 Mar 2024 15:12:53 -0400 Subject: [PATCH] Code documentation cleanup --- source/MonoGame.Aseprite/AnimatedSprite.cs | 142 +++--- .../MonoGame.Aseprite/AnimatedTIlemapFrame.cs | 199 ++++----- source/MonoGame.Aseprite/AnimatedTilemap.cs | 282 +++++------- source/MonoGame.Aseprite/AnimationFrame.cs | 12 +- source/MonoGame.Aseprite/AnimationTag.cs | 46 +- .../MonoGame.Aseprite/AnimationTagBuilder.cs | 68 ++- .../Readers/AsepriteFileContentTypeReader.cs | 1 - source/MonoGame.Aseprite/NinePatchSlice.cs | 6 +- source/MonoGame.Aseprite/Slice.cs | 16 +- source/MonoGame.Aseprite/Sprite.cs | 162 ++----- .../SpriteBatchExtensions.cs | 339 +++++---------- source/MonoGame.Aseprite/SpriteSheet.cs | 180 ++++---- source/MonoGame.Aseprite/TextureAtlas.cs | 349 ++++++--------- source/MonoGame.Aseprite/TextureRegion.cs | 270 +++++------- source/MonoGame.Aseprite/Tile.cs | 38 +- source/MonoGame.Aseprite/Tilemap.cs | 236 ++++------ source/MonoGame.Aseprite/TilemapLayer.cs | 407 +++++++----------- source/MonoGame.Aseprite/Tileset.cs | 228 ++++------ 18 files changed, 1157 insertions(+), 1824 deletions(-) diff --git a/source/MonoGame.Aseprite/AnimatedSprite.cs b/source/MonoGame.Aseprite/AnimatedSprite.cs index 68bf9dd..298ba55 100644 --- a/source/MonoGame.Aseprite/AnimatedSprite.cs +++ b/source/MonoGame.Aseprite/AnimatedSprite.cs @@ -7,7 +7,7 @@ namespace MonoGame.Aseprite; /// -/// Defines an animated sprite with methods to control the playing of the sprite animation. +/// Defines an animated sprite with methods to control the playing of the sprite animation. /// public sealed class AnimatedSprite : Sprite { @@ -20,17 +20,17 @@ public sealed class AnimatedSprite : Sprite private AnimationTag _animationTag; /// - /// Gets a value that indicates if this is currently paused. + /// Gets a value that indicates if this is currently paused. /// public bool IsPaused { get; private set; } /// - /// Gets a value that indicates if this has completed its animation. + /// Gets a value that indicates if this has completed its animation. /// public bool IsAnimating { get; private set; } /// - /// Gets or Sets a value that indicates if this plays it's frames in reverse order. + /// Gets or Sets a value that indicates if this plays it's frames in reverse order. /// public bool IsReversed { @@ -39,14 +39,14 @@ public bool IsReversed } /// - /// Gets or Sets a value that indicates if this should ping-pong once reaching the - /// last frame of animation. + /// Gets or Sets a value that indicates if this should ping-pong once reaching the + /// last frame of animation. /// public bool IsPingPong { get; set; } /// - /// Gets a value that indicates the total number of loops/cycles of the animation that should play for - /// this . + /// Gets a value that indicates the total number of loops/cycles of the animation that should play for + /// this . /// /// /// @@ -60,13 +60,11 @@ public bool IsReversed public int LoopCount => _loopCount; /// - /// Sets the rate at which the animation is played. + /// Sets the rate at which the animation is played. /// /// - /// This value is clamped between 0.0d and - /// - /// - /// Default (normal) speed is 1.0d + /// This value is clamped between 0.0d and + /// Default (normal) speed is 1.0d /// public double Speed { @@ -78,54 +76,54 @@ public double Speed } /// - /// Gets the total number of frames in this + /// Gets the total number of frames in this /// public int FrameCount => _animationTag.FrameCount; /// - /// Gets the source of the current frame of animation for this - /// . + /// Gets the source of the current frame of animation for this + /// . /// public AnimationFrame CurrentFrame => _animationTag.Frames[_currentIndex]; /// - /// Gets or Sets an method to invoke at the start of each frame of animation. + /// Gets or Sets an method to invoke at the start of each frame of animation. /// public Action? OnFrameBegin { get; set; } = default; /// - /// Gets or Sets an method to invoke at the end of each frame of animation. + /// Gets or Sets an method to invoke at the end of each frame of animation. /// public Action? OnFrameEnd { get; set; } = default; /// - /// Gets or Sets an method to invoke at the start of the animation. + /// Gets or Sets an method to invoke at the start of the animation. /// /// - /// This will trigger only once when the animation starts before the the first frame's - /// triggers. + /// This will trigger only once when the animation starts before the the first frame's + /// triggers. /// public Action? OnAnimationBegin { get; set; } = default; /// - /// Gets or Sets an to invoke each time the animation loops. + /// Gets or Sets an to invoke each time the animation loops. /// /// - /// This will trigger each time the animation loops after the last frame's triggers. + /// This will trigger each time the animation loops after the last frame's triggers. /// public Action? OnAnimationLoop { get; set; } = default; /// - /// Gets or Sets an method to invoke when the animation ends. + /// Gets or Sets an method to invoke when the animation ends. /// /// - /// This will only trigger when the animation ends in a non-looping animation, or if a looping animation is - /// stopped by calling manually. + /// This will only trigger when the animation ends in a non-looping animation, or if a looping animation is + /// stopped by calling manually. /// public Action? OnAnimationEnd { get; set; } = default; /// - /// Gets the amount of time remaining for the before moving to the next frame. + /// Gets the amount of time remaining for the before moving to the next frame. /// public TimeSpan CurrentFrameTimeRemaining { get; private set; } @@ -137,13 +135,13 @@ internal AnimatedSprite(AnimationTag tag) } /// - /// Updates this . + /// Updates this . /// /// - /// This should only be called once per update cycle. + /// This should only be called once per update cycle. /// /// - /// The amount of time, in seconds, that have elapsed since the last update cycle in the game. + /// The amount of time, in seconds, that have elapsed since the last update cycle in the game. /// public void Update(double deltaTimeInSeconds) { @@ -151,28 +149,24 @@ public void Update(double deltaTimeInSeconds) } /// - /// Updates this . + /// Updates this . /// /// - /// This should only be called once per update cycle. + /// This should only be called once per update cycle. /// - /// - /// A snapshot of the game timing values for the current update cycle. - /// + /// A snapshot of the game timing values for the current update cycle. public void Update(GameTime gameTime) { Update(gameTime.ElapsedGameTime); } /// - /// Updates this . + /// Updates this . /// /// - /// This should only be called once per update cycle. + /// This should only be called once per update cycle. /// - /// - /// The amount of time, that have elapsed since the last update cycle in the game. - /// + /// The amount of time, that have elapsed since the last update cycle in the game. public void Update(in TimeSpan elapsedTime) { if (!IsAnimating || IsPaused) @@ -200,15 +194,15 @@ public void Update(in TimeSpan elapsedTime) } /// - /// Sets the current frame of animation for this . + /// Sets the current frame of animation for this . /// /// - /// The index of the frame to set. Value must be greater than zero and less than the total count of frames. You - /// can use to determine the total number of frames. + /// The index of the frame to set. Value must be greater than zero and less than the total count of frames. You + /// can use to determine the total number of frames. /// /// - /// Thrown if the value provided is less than zero or is greater than or equal to - /// the total number of frames in this . + /// Thrown if the value provided is less than zero or is greater than or equal to + /// the total number of frames in this . /// public void SetFrame(int frameIndex) { @@ -268,7 +262,7 @@ private void ReduceLoopsRemaining() } /// - /// Starts the animation for this + /// Starts the animation for this /// /// /// @@ -296,13 +290,13 @@ private void ReduceLoopsRemaining() /// /// /// - /// if animation play was successfully started for this ; - /// otherwise, . This method returns if the animation is already - /// playing (when equals ). + /// if animation play was successfully started for this ; + /// otherwise, . This method returns if the animation is already + /// playing (when equals ). /// /// - /// Thrown if the value provided is less than zero or is greater than or equal to - /// the total number of frames in this . + /// Thrown if the value provided is less than zero or is greater than or equal to + /// the total number of frames in this . /// public bool Play(int? loopCount = default, int? startingFrame = 0) { @@ -344,17 +338,17 @@ public bool Play(int? loopCount = default, int? startingFrame = 0) /// - /// Paused this and prevents it from being updated until it is unpaused. + /// Paused this and prevents it from being updated until it is unpaused. /// /// - /// A value that indicates whether the should be reset. When this - /// method returns , this indicates the was not - /// reset even if this was specified as . + /// A value that indicates whether the should be reset. When this method + /// returns , this indicates the was not reset even + /// if this was specified as . /// /// - /// if this was successfully paused; otherwise, - /// . This method returns if this - /// is not currently animating or if it is already paused. + /// if this was successfully paused; otherwise, + /// . This method returns if this + /// is not currently animating or if it is already paused. /// public bool Pause(bool resetFrameDuration = false) { @@ -376,17 +370,17 @@ public bool Pause(bool resetFrameDuration = false) } /// - /// Unpaused this . + /// Unpaused this . /// /// - /// A value that indicates whether this should immediately advance to the next - /// frame after unpausing. When this method returns , this - /// will -not- be advanced to the next frame, even if this was specified as . + /// A value that indicates whether this should immediately advance to the next frame + /// after unpausing. When this method returns , this will + /// -not- be advanced to the next frame, even if this was specified as . /// /// - /// if this was successfully unpaused; otherwise, - /// . This method returns if this - /// is not currently animating or if it is not paused. + /// if this was successfully unpaused; otherwise, + /// . This method returns if this + /// is not currently animating or if it is not paused. /// public bool Unpause(bool advanceToNextFrame = false) { @@ -408,16 +402,16 @@ public bool Unpause(bool advanceToNextFrame = false) } /// - /// Stops this on the current frame. + /// Stops this on the current frame. /// /// - /// This will trigger the action if one was set. + /// This will trigger the action if one was set. /// /// - /// if this was successfully stopped; otherwise, - /// . This method returns if this - /// is not currently animating. If this method returns , this also indicates that the - /// was not triggered. + /// if this was successfully stopped; otherwise, + /// . This method returns if this + /// is not currently animating. If this method returns , this also indicates that the + /// was not triggered. /// public bool Stop() { @@ -435,9 +429,9 @@ public bool Stop() } /// - /// Resets this back to its initial state as defined by the - /// used to create it. You will need to call - /// after resetting to start the playback of the animation. + /// Resets this back to its initial state as defined by the + /// used to create it. You will need to call + /// after resetting to start the playback of the animation. /// /// /// diff --git a/source/MonoGame.Aseprite/AnimatedTIlemapFrame.cs b/source/MonoGame.Aseprite/AnimatedTIlemapFrame.cs index 1250552..7aa08e2 100644 --- a/source/MonoGame.Aseprite/AnimatedTIlemapFrame.cs +++ b/source/MonoGame.Aseprite/AnimatedTIlemapFrame.cs @@ -9,8 +9,8 @@ namespace MonoGame.Aseprite; /// -/// Defines a frame of animation in an , containing zero or more -/// elements. +/// Defines a frame of animation in an , containing zero or more +/// elements. /// public sealed class AnimatedTilemapFrame : IEnumerable { @@ -18,80 +18,67 @@ public sealed class AnimatedTilemapFrame : IEnumerable private Dictionary _layerLookup = new(); /// - /// Gets the duration of this . + /// Gets the duration of this . /// public TimeSpan Duration { get; } /// - /// Gets the total number of elements in this . + /// Gets the total number of elements in this . /// public int LayerCount => _layers.Count; /// - /// Gets the element at the specified index in this - /// . + /// Gets the element at the specified index in this . /// - /// - /// The index of the element to locate. - /// - /// - /// The element located. - /// + /// The index of the element to locate. + /// The element located. /// - /// Thrown if the specified index is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the specified index is less than zero or is greater than or equal to the total number of + /// elements in this . /// public TilemapLayer this[int layerIndex] => GetLayer(layerIndex); /// - /// Gets the element with the specified name in this - /// . + /// Gets the element with the specified name in this . /// - /// - /// The name of the element to locate. - /// - /// - /// The element located. - /// + /// The name of the element to locate. + /// The element located. /// - /// Thrown if this does not contain a element with - /// the specified name. + /// Thrown if this does not contain a element with + /// the specified name. /// public TilemapLayer this[string layerName] => GetLayer(layerName); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The duration to assign the . - /// + /// The duration to assign the . public AnimatedTilemapFrame(TimeSpan duration) => Duration = duration; /// - /// Creates a new element and adds it to this . + /// Creates a new element and adds it to this . /// /// - /// The name to assign the element created by this method. The name must be unique - /// across all elements in this . + /// The name to assign the element created by this method. The name must be unique + /// across all elements in this . /// /// - /// The source to assign the element created by this method. + /// The source to assign the element created by this method. /// /// - /// The total number of columns to assign the element created by this method. + /// The total number of columns to assign the element created by this method. /// /// - /// The total of rows in the element created by this method. + /// The total of rows in the element created by this method. /// /// - /// The x- and y-position offset, relative to the location the is rendered, to - /// assign the element created by this method. + /// The x- and y-position offset, relative to the location the is rendered, to + /// assign the element created by this method. /// - /// - /// The created by this method. + /// The created by this method. /// - /// Thrown if this already contains a element with - /// the specified name. + /// Thrown if this already contains a element with + /// the specified name. /// public TilemapLayer CreateLayer(string layerName, Tileset tileset, int columns, int rows, Vector2 offset) { @@ -101,12 +88,12 @@ public TilemapLayer CreateLayer(string layerName, Tileset tileset, int columns, } /// - /// Adds the given element to this . + /// Adds the given element to this . /// /// The element to add. /// - /// Thrown if this already contains a element with - /// the same name as the element given. + /// Thrown if this already contains a element with + /// the same name as the element given. /// public void AddLayer(TilemapLayer layer) { @@ -120,18 +107,14 @@ public void AddLayer(TilemapLayer layer) } /// - /// Gets the element at the specified index in this - /// . + /// Gets the element at the specified index in this + /// . /// - /// - /// The index of the element to locate. - /// - /// - /// The element located. - /// + /// The index of the element to locate. + /// The element located. /// - /// Thrown if the specified index is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the specified index is less than zero or is greater than or equal to the total number of + /// elements in this . /// public TilemapLayer GetLayer(int index) { @@ -144,18 +127,14 @@ public TilemapLayer GetLayer(int index) } /// - /// Gets the element with the specified name in this - /// . + /// Gets the element with the specified name in this + /// . /// - /// - /// The name of the element to locate. - /// - /// - /// The element located. - /// + /// The name of the element to locate. + /// The element located. /// - /// Thrown if this does not contain a element with - /// the specified name. + /// Thrown if this does not contain a element with + /// the specified name. /// public TilemapLayer GetLayer(string name) { @@ -168,21 +147,18 @@ public TilemapLayer GetLayer(string name) } /// - /// Get the element at the specified index in this - /// . + /// Get the element at the specified index in this . /// - /// - /// The index of the element to locate. - /// + /// The index of the element to locate. /// - /// When this method returns , contains the element located; - /// otherwise, . + /// When this method returns , contains the element located; + /// otherwise, . /// /// - /// if a element was located at the specified index in this - /// ; otherwise, . This method return - /// when the specified index is less than zero or is greater than or equal to the total - /// number of elements in this . + /// if a element was located at the specified index in this + /// ; otherwise, . This method return + /// when the specified index is less than zero or is greater than or equal to the total + /// number of elements in this . /// public bool TryGetLayer(int index, [NotNullWhen(true)] out TilemapLayer? layer) { @@ -198,37 +174,34 @@ public bool TryGetLayer(int index, [NotNullWhen(true)] out TilemapLayer? layer) } /// - /// Gets the element with the specified name in this - /// . + /// Gets the element with the specified name in this . /// - /// - /// The name of the element to locate. - /// + /// The name of the element to locate. /// - /// When this method returns , contains the element located; - /// otherwise, . + /// When this method returns , contains the element located; + /// otherwise, . /// /// - /// if a element was located in this - /// with the specified name; otherwise . This method - /// returns if this does not contain a - /// element with the specified name. + /// if a element was located in this + /// with the specified name; otherwise . This method + /// returns if this does not contain a + /// element with the specified name. /// public bool TryGetLayer(string name, [NotNullWhen(true)] out TilemapLayer? layer) => _layerLookup.TryGetValue(name, out layer); /// - /// Removes the element at the specified index in this - /// . + /// Removes the element at the specified index in this + /// . /// /// - /// The index of the element to remove from this . + /// The index of the element to remove from this . /// /// - /// if the element was successfully removed; otherwise, - /// . This method returns if the specified index is less than - /// zero or is greater than or equal to the total number of elements in this tilemap - /// frame. + /// if the element was successfully removed; otherwise, + /// . This method returns if the specified index is less than + /// zero or is greater than or equal to the total number of elements in this tilemap + /// frame. /// public bool RemoveLayer(int index) { @@ -242,16 +215,16 @@ public bool RemoveLayer(int index) } /// - /// Removes the element with the specified name from this - /// . + /// Removes the element with the specified name from this + /// . /// /// - /// The name of the element to remove from this + /// The name of the element to remove from this /// /// - /// if the element was successfully removed; otherwise, - /// . This method returns if this tilemap frame does not - /// contain a element with the specified name. + /// if the element was successfully removed; otherwise, + /// . This method returns if this tilemap frame does not + /// contain a element with the specified name. /// public bool RemoveLayer(string name) { @@ -264,21 +237,21 @@ public bool RemoveLayer(string name) } /// - /// Removes the given element from this . + /// Removes the given element from this . /// /// /// The element to remove from this . /// /// - /// if the element was removed successfully; otherwise, - /// . This method returns if this tilemap frame does not contain - /// the element given. + /// if the element was removed successfully; otherwise, + /// . This method returns if this tilemap frame does not contain + /// the element given. /// public bool RemoveLayer(TilemapLayer layer) => _layers.Remove(layer) && _layerLookup.Remove(layer.Name); /// - /// Removes all elements from this . + /// Removes all elements from this . /// public void Clear() { @@ -287,24 +260,24 @@ public void Clear() } /// - /// Returns an enumerator used to iterate through all of the elements in this - /// . The order of elements in the enumeration is from bottom layer to top - /// layer. + /// Returns an enumerator used to iterate through all of the elements in this + /// . The order of elements in the enumeration is from bottom layer to top + /// layer. /// /// - /// An enumerator used to iterate through all of the elements in this - /// . + /// An enumerator used to iterate through all of the elements in this + /// . /// public IEnumerator GetEnumerator() => _layers.GetEnumerator(); /// - /// Returns an enumerator used to iterate through all of the elements in this - /// . The order of elements in the enumeration is from bottom layer to top - /// layer. + /// Returns an enumerator used to iterate through all of the elements in this + /// . The order of elements in the enumeration is from bottom layer to top + /// layer. /// /// - /// An enumerator used to iterate through all of the elements in this - /// . + /// An enumerator used to iterate through all of the elements in this + /// . /// IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } diff --git a/source/MonoGame.Aseprite/AnimatedTilemap.cs b/source/MonoGame.Aseprite/AnimatedTilemap.cs index 8762367..f284109 100644 --- a/source/MonoGame.Aseprite/AnimatedTilemap.cs +++ b/source/MonoGame.Aseprite/AnimatedTilemap.cs @@ -6,7 +6,6 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; - namespace MonoGame.Aseprite; /// @@ -20,7 +19,7 @@ public sealed class AnimatedTilemap : IEnumerable private List _frames = new(); /// - /// Gets the name assigned to this . + /// Gets the name assigned to this . /// public string Name { get; } @@ -30,55 +29,55 @@ public sealed class AnimatedTilemap : IEnumerable public int frameCount => _frames.Count; /// - /// Gets the element at the specified index in this - /// . + /// Gets the element at the specified index in this + /// . /// /// - /// The index of the element to locate. + /// The index of the element to locate. /// /// - /// The element that was located at the specified index in this - /// . + /// The element that was located at the specified index in this + /// . /// /// - /// Thrown if the specified index is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the specified index is less than zero or is greater than or equal to the total number of + /// elements in this . /// public AnimatedTilemapFrame this[int frameIndex] => GetFrame(frameIndex); /// - /// Gets a value that indicates if this is currently paused. + /// Gets a value that indicates if this is currently paused. /// public bool IsPaused { get; private set; } /// - /// Gets a value that indicates if this is currently animating. + /// Gets a value that indicates if this is currently animating. /// public bool IsAnimating { get; private set; } /// - /// Gets a value that indicates whether the animation this should loop. + /// Gets a value that indicates whether the animation this should loop. /// public bool IsLooping { get; } /// - /// Gets a value that indicates whether the animation this should play frames - /// in reverse order. + /// Gets a value that indicates whether the animation this should play frames in + /// reverse order. /// public bool IsReversed { get; } /// - /// Gets a value that indicates whether the animation for this should ping-pong - /// once reaching the last frame of animation. + /// Gets a value that indicates whether the animation for this should ping-pong once + /// reaching the last frame of animation. /// public bool IsPingPong { get; } /// - /// Gets the source element for the current animation frame. + /// Gets the source element for the current animation frame. /// /// - /// Thrown if no elements have been added to this - /// prior to accessing this property. + /// Thrown if no elements have been added to this + /// prior to accessing this property. /// public AnimatedTilemapFrame CurrentFrame { @@ -94,55 +93,55 @@ public AnimatedTilemapFrame CurrentFrame } /// - /// Gets or Sets an method to invoke at the start of each animation frame. + /// Gets or Sets an method to invoke at the start of each animation frame. /// public Action? OnFrameBegin { get; set; } = default; /// - /// Gets or Sets an method to invoke at the end of each animation frame. + /// Gets or Sets an method to invoke at the end of each animation frame. /// public Action? OnFrameEnd { get; set; } = default; /// - /// Gets or Sets an method to invoke at the start of the animation. This will trigger only - /// once when the animation starts before the first frame's triggers. + /// Gets or Sets an method to invoke at the start of the animation. This will trigger only + /// once when the animation starts before the first frame's triggers. /// public Action? OnAnimationBegin { get; set; } = default; /// - /// Gets or Sets an method to invoke each time the animation loops. This will trigger each - /// time the animation loops after the last frame's triggers. + /// Gets or Sets an method to invoke each time the animation loops. This will trigger each + /// time the animation loops after the last frame's triggers. /// public Action? OnAnimationLoop { get; set; } = default; /// - /// Gets or Sets an method to invoke when the animation ends. This will only trigger when - /// the animation ends in a non-looping animation, or if a looping animation is stopped by calling the - /// method manually. + /// Gets or Sets an method to invoke when the animation ends. This will only trigger when + /// the animation ends in a non-looping animation, or if a looping animation is stopped by calling the + /// method manually. /// public Action? OnAnimationEnd { get; set; } = default; /// - /// Gets the amount of time remaining for the before moving to the next frame. + /// Gets the amount of time remaining for the before moving to the next frame. /// public TimeSpan CurrentFrameTimeRemaining { get; private set; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// The name to assign the . + /// The name to assign the . /// /// - /// Indicates whether the animation for the should loop + /// Indicates whether the animation for the should loop /// /// - /// Indicates whether the frames for the should play in reverse order. + /// Indicates whether the frames for the should play in reverse order. /// /// - /// Indicates whether the animation for this should ping-pong once reaching the - /// last frame of animation + /// Indicates whether the animation for this should ping-pong once reaching the + /// last frame of animation /// public AnimatedTilemap(string name, bool isLooping = true, bool isReversed = false, bool isPingPong = false) { @@ -154,13 +153,13 @@ public AnimatedTilemap(string name, bool isLooping = true, bool isReversed = fal } /// - /// Updates this . + /// Updates this . /// /// - /// This should only be called once per game update cycle. + /// This should only be called once per game update cycle. /// /// - /// The amount of time, in seconds, that have elapsed since the last update cycle in the game. + /// The amount of time, in seconds, that have elapsed since the last update cycle in the game. /// public void Update(double deltaTimeInSeconds) { @@ -168,28 +167,24 @@ public void Update(double deltaTimeInSeconds) } /// - /// Updates this . + /// Updates this . /// /// - /// This should only be called once per game update cycle. + /// This should only be called once per game update cycle. /// - /// - /// A snapshot of the game timing values for the current update cycle. - /// + /// A snapshot of the game timing values for the current update cycle. public void Update(GameTime gameTime) { Update(gameTime.ElapsedGameTime); } /// - /// Updates this . + /// Updates this . /// /// - /// This should only be called once per game update cycle. + /// This should only be called once per game update cycle. /// - /// - /// The amount of time, that have elapsed since the last update cycle in the game. - /// + /// The amount of time, that have elapsed since the last update cycle in the game. public void Update(in TimeSpan elapsedTime) { if (!IsAnimating || IsPaused) @@ -328,17 +323,17 @@ private void ReversePingPongLoopCheck() } /// - /// Pauses this and prevents it from being updated until it is unpaused. + /// Pauses this and prevents it from being updated until it is unpaused. /// /// - /// A value that indicates whether the the duration of the should be reset. When - /// this method returns , the duration will not be reset even if this is specified as - /// . + /// A value that indicates whether the the duration of the should be reset. When + /// this method returns , the duration will not be reset even if this is specified as + /// . /// /// - /// this was successfully paused; otherwise, - /// . This method returns this - /// is not currently animating or if it is already paused. + /// this was successfully paused; otherwise, + /// . This method returns this + /// is not currently animating or if it is already paused. /// public bool Pause(bool resetFrameDuration = false) { @@ -360,17 +355,17 @@ public bool Pause(bool resetFrameDuration = false) } /// - /// Unpauses this . + /// Unpauses this . /// /// - /// A value that indicates whether this should immediately be advanced to the next - /// frame after unpausing. When this method returns , this - /// will -not- be advanced to the next frame, even if this was specified as . + /// A value that indicates whether this should immediately be advanced to the next + /// frame after unpausing. When this method returns , this + /// will -not- be advanced to the next frame, even if this was specified as . /// /// - /// if this was successfully unpaused; otherwise, - /// . This method return this is - /// not currently animating or if it has not already been paused. + /// if this was successfully unpaused; otherwise, + /// . This method return this is + /// not currently animating or if it has not already been paused. /// public bool Unpause(bool advanceToNextFrame = false) { @@ -392,14 +387,14 @@ public bool Unpause(bool advanceToNextFrame = false) } /// - /// Stops this on the . This will trigger the - /// if one was set. + /// Stops this on the . This will trigger the + /// if one was set. /// /// - /// this was successfully stopped; otherwise, - /// . This method returns this is - /// not currently animating. If this method returns , this indicates that the - /// action method was not invoked. + /// this was successfully stopped; otherwise, + /// . This method returns this is + /// not currently animating. If this method returns , this indicates that the + /// action method was not invoked. /// public bool Stop() { @@ -416,10 +411,10 @@ public bool Stop() } /// - /// Resets this back to its first frame of animation. + /// Resets this back to its first frame of animation. /// /// - /// A value that indicates whether his should be paused after it is reset. + /// A value that indicates whether his should be paused after it is reset. /// public void Reset(bool paused = false) { @@ -441,14 +436,12 @@ public void Reset(bool paused = false) } /// - /// Creates and adds a new element as the next frame of animation in this - /// . + /// Creates and adds a new element as the next frame of animation in this + /// . /// - /// - /// The duration to assign the created. - /// + /// The duration to assign the created. /// - /// The created. + /// The created. /// public AnimatedTilemapFrame CreateFrame(TimeSpan duration) { @@ -458,27 +451,23 @@ public AnimatedTilemapFrame CreateFrame(TimeSpan duration) } /// - /// Adds the given as the next frame of animation in this - /// . + /// Adds the given as the next frame of animation in this + /// . /// - /// - /// The to add - /// + /// The to add public void AddFrame(AnimatedTilemapFrame frame) => _frames.Add(frame); /// - /// Gets the element at the specified index in this - /// . + /// Gets the element at the specified index in this + /// . /// - /// - /// The index of the element to locate. - /// + /// The index of the element to locate. /// - /// The element that was located. + /// The element that was located. /// /// - /// Thrown if the specified index is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the specified index is less than zero or is greater than or equal to the total number of + /// elements in this . /// public AnimatedTilemapFrame GetFrame(int frameIndex) { @@ -491,21 +480,19 @@ public AnimatedTilemapFrame GetFrame(int frameIndex) } /// - /// Gets the element at the specified index in this - /// . + /// Gets the element at the specified index in this + /// . /// - /// - /// The index of the element to locate. - /// + /// The index of the element to locate. /// - /// When this method returns , contains the located; - /// otherwise, . + /// When this method returns , contains the located; + /// otherwise, . /// /// - /// if the element was located; otherwise, - /// . This method returns when the specified index is less than - /// zero or is greater than or equal to the total number of elements in this - /// . + /// if the element was located; otherwise, + /// . This method returns when the specified index is less than + /// zero or is greater than or equal to the total number of elements in this + /// . /// public bool TryGetFrame(int index, out AnimatedTilemapFrame? frame) { @@ -520,17 +507,15 @@ public bool TryGetFrame(int index, out AnimatedTilemapFrame? frame) } /// - /// Removes the element at the specified index from this - /// . + /// Removes the element at the specified index from this + /// . /// - /// - /// The index of the element to remove. - /// + /// The index of the element to remove. /// - /// if the was removed successfully; otherwise, - /// . This method returns when the specified index is less than - /// zero or is greater that or equal to the total number of elements in this - /// . + /// if the was removed successfully; otherwise, + /// . This method returns when the specified index is less than + /// zero or is greater that or equal to the total number of elements in this + /// . /// public bool RemoveFrame(int index) { @@ -550,85 +535,48 @@ public bool RemoveFrame(int index) /// - /// Draws this using the - /// . + /// Draws this using the . /// /// - /// The to use for rendering this - /// . - /// - /// - /// The x- and y-coordinate location to render this at. - /// - /// - /// The color mask to apply when rendering this . + /// The to use for rendering this + /// . /// + /// The x- and y-coordinate location to render this at. + /// The color mask to apply when rendering this . public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color) => Draw(spriteBatch, position, color, Vector2.One, 0.0f); /// - /// Draws this using the - /// . + /// Draws this using the . /// /// - /// The to use for rendering this - /// . - /// - /// - /// The x- and y-coordinate location to render this at. - /// - /// - /// The color mask to apply when rendering this . - /// - /// - /// The amount of scaling to apply when rendering this . - /// - /// - /// The layer depth to apply when rendering this . + /// The to use for rendering this + /// . /// + /// The x- and y-coordinate location to render this at. + /// The color mask to apply when rendering this . + /// The amount of scaling to apply when rendering this . + /// The layer depth to apply when rendering this . public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color, float scale, float layerDepth) => Draw(spriteBatch, position, color, new Vector2(scale, scale), layerDepth); /// - /// Draws this using the - /// . + /// Draws this using the . /// /// - /// The to use for rendering the - /// . - /// - /// - /// The x- and y-coordinate location to render the at. - /// - /// - /// The color mask to apply when rendering the . - /// - /// - /// The amount of scaling to apply when rendering the . - /// - /// - /// The layer depth to apply when rendering the . + /// The to use for rendering the + /// . /// + /// The x- and y-coordinate location to render this at. + /// The color mask to apply when rendering this . + /// The amount of scaling to apply when rendering this . + /// The layer depth to apply when rendering this . public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color, Vector2 scale, float layerDepth) => spriteBatch.Draw(this, position, color, scale, layerDepth); - /// - /// Returns an enumerator used to iterate through all of the elements in this - /// . The order of elements in the enumeration is from first frame to last frame. - /// - /// - /// An enumerator used to iterate through all of the elements in this - /// . - /// + /// public IEnumerator GetEnumerator() => _frames.GetEnumerator(); - /// - /// Returns an enumerator used to iterate through all of the elements in this - /// . The order of elements in the enumeration is from first frame to last frame. - /// - /// - /// An enumerator used to iterate through all of the elements in this - /// . - /// + /// IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } diff --git a/source/MonoGame.Aseprite/AnimationFrame.cs b/source/MonoGame.Aseprite/AnimationFrame.cs index 65f93ab..68ef222 100644 --- a/source/MonoGame.Aseprite/AnimationFrame.cs +++ b/source/MonoGame.Aseprite/AnimationFrame.cs @@ -5,24 +5,24 @@ namespace MonoGame.Aseprite; /// -/// Defines the source and duration of a single frame of animation in an -/// . +/// Defines the source and duration of a single frame of animation in an +/// . /// public sealed class AnimationFrame { /// - /// Gets the index of the source in the of the - /// . + /// Gets the index of the source in the of the + /// . /// public int FrameIndex { get; } /// - /// Gets the source for this . + /// Gets the source for this . /// public TextureRegion TextureRegion { get; } /// - /// Gets the duration of this . + /// Gets the duration of this . /// public TimeSpan Duration { get; } diff --git a/source/MonoGame.Aseprite/AnimationTag.cs b/source/MonoGame.Aseprite/AnimationTag.cs index 8fc4956..cf2b3af 100644 --- a/source/MonoGame.Aseprite/AnimationTag.cs +++ b/source/MonoGame.Aseprite/AnimationTag.cs @@ -12,54 +12,50 @@ public sealed class AnimationTag private AnimationFrame[] _frames; /// - /// Gets the name of the animation + /// Gets the name of the animation /// public string Name { get; } /// - /// Gets a read-only span of the 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 elements that make up the animation. The order of + /// elements is from first frame to last frame in non-reverse order. /// public ReadOnlySpan Frames => _frames; /// - /// Gets the total number of , elements. + /// Gets the total number of , elements. /// public int FrameCount => _frames.Length; /// - /// Gets the element at the specified index from this . + /// Gets the element at the specified index from this . /// - /// - /// The index of the to locate. - /// - /// - /// The located. - /// + /// The index of the to locate. + /// The located. /// - /// Thrown if the specified is less than zero or is greater than or equal to the total - /// number of elements in this . + /// Thrown if the specified is less than zero or is greater than or equal to the total + /// number of elements in this . /// public AnimationFrame this[int index] => GetFrame(index); /// - /// Gets a value that indicates whether the animation should loop. + /// Gets a value that indicates whether the animation should loop. /// public bool IsLooping => LoopCount == 0; /// - /// 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. /// public bool IsReversed { get; set; } /// - /// 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. /// public bool IsPingPong { get; set; } /// - /// 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. /// /// /// @@ -76,17 +72,13 @@ internal AnimationTag(string name, AnimationFrame[] frames, int loopCount, bool (Name, _frames, LoopCount, IsReversed, IsPingPong) = (name, frames, loopCount, isReversed, isPingPong); /// - /// Gets the element at the specified index from this . + /// Gets the element at the specified index from this . /// - /// - /// The index of the to locate. - /// - /// - /// The located. - /// + /// The index of the to locate. + /// The located. /// - /// Thrown if the specified is less than zero or is greater than or equal to the total - /// number of elements in this . + /// Thrown if the specified is less than zero or is greater than or equal to the total + /// number of elements in this . /// public AnimationFrame GetFrame(int index) { diff --git a/source/MonoGame.Aseprite/AnimationTagBuilder.cs b/source/MonoGame.Aseprite/AnimationTagBuilder.cs index 24ed8fe..48c49ad 100644 --- a/source/MonoGame.Aseprite/AnimationTagBuilder.cs +++ b/source/MonoGame.Aseprite/AnimationTagBuilder.cs @@ -5,7 +5,7 @@ namespace MonoGame.Aseprite; /// -/// Defines a builder building an for a . +/// Defines a builder building an for a . /// public sealed class AnimationTagBuilder { @@ -20,23 +20,19 @@ internal AnimationTagBuilder(string name, SpriteSheet spriteSheet) => (_name, _spriteSheet) = (name, spriteSheet); /// - /// Adds a new frame of animation to the using the - /// located at the specified index in the of the and with - /// the specified duration. + /// Adds a new frame of animation to the using the + /// located at the specified index in the of the and with + /// the specified duration. /// /// - /// The index of the source in the of the - /// . + /// The index of the source in the of the + /// . /// - /// - /// The duration of the frame of animation. - /// - /// - /// This instance of the class. - /// + /// The duration of the frame of animation. + /// This instance of the class. /// - /// Throw if the specified index is less than zero or is greater than or equal to the total number of regions in - /// the . + /// Throw if the specified index is less than zero or is greater than or equal to the total number of regions in + /// the . /// public AnimationTagBuilder AddFrame(int regionIndex, TimeSpan duration) { @@ -47,23 +43,19 @@ public AnimationTagBuilder AddFrame(int regionIndex, TimeSpan duration) } /// - /// Adds a new frame of animation to the using the with - /// the specified name in the of the and with the specified - /// duration. + /// Adds a new frame of animation to the using the with + /// the specified name in the of the and with the specified + /// duration. /// /// - /// The name of the source in the of the - /// . + /// The name of the source in the of the + /// . /// - /// - /// The duration of the frame of animation. - /// - /// - /// This instance of the class. - /// + /// The duration of the frame of animation. + /// This instance of the class. /// - /// Thrown if the of the does not contain a - /// with the specified name. + /// Thrown if the of the does not contain a + /// with the specified name. /// public AnimationTagBuilder AddFrame(string regionName, TimeSpan duration) { @@ -75,7 +67,7 @@ public AnimationTagBuilder AddFrame(string regionName, TimeSpan duration) } /// - /// 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. /// /// /// @@ -99,14 +91,10 @@ public AnimationTagBuilder LoopCount(int count) } /// - /// Sets whether the animation should play in reverse. + /// Sets whether the animation should play in reverse. /// - /// - /// A value that indicates whether the animation should play in reverse - /// - /// - /// This instance of the class. - /// + /// A value that indicates whether the animation should play in reverse + /// This instance of the class. public AnimationTagBuilder IsReversed(bool isReversed) { _isReversed = isReversed; @@ -114,14 +102,10 @@ public AnimationTagBuilder IsReversed(bool isReversed) } /// - /// 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. /// - /// - /// A value that indicates whether the animation should ping-pong. - /// - /// - /// This instance of the class. - /// + /// A value that indicates whether the animation should ping-pong. + /// This instance of the class. public AnimationTagBuilder IsPingPong(bool isPingPong) { _isPingPong = isPingPong; diff --git a/source/MonoGame.Aseprite/Content/Pipeline/Readers/AsepriteFileContentTypeReader.cs b/source/MonoGame.Aseprite/Content/Pipeline/Readers/AsepriteFileContentTypeReader.cs index 2648f87..36ec4d9 100644 --- a/source/MonoGame.Aseprite/Content/Pipeline/Readers/AsepriteFileContentTypeReader.cs +++ b/source/MonoGame.Aseprite/Content/Pipeline/Readers/AsepriteFileContentTypeReader.cs @@ -12,7 +12,6 @@ internal sealed class AsepriteFileContentTypeReader : ContentTypeReader -/// Defines a with center bounds. +/// Defines a with center bounds. /// public sealed class NinePatchSlice : Slice { /// - /// Gets the rectangular bounds of the center rectangle for this , - /// relative to it's bounds. + /// Gets the rectangular bounds of the center rectangle for this , + /// relative to it's bounds. /// public Rectangle CenterBounds { get; } diff --git a/source/MonoGame.Aseprite/Slice.cs b/source/MonoGame.Aseprite/Slice.cs index 67690b8..fe6cda3 100644 --- a/source/MonoGame.Aseprite/Slice.cs +++ b/source/MonoGame.Aseprite/Slice.cs @@ -7,30 +7,30 @@ namespace MonoGame.Aseprite; /// -/// Defines a named slice for a with a bounds, origin, and color. +/// Defines a named slice for a with a bounds, origin, and color. /// public class Slice { /// - /// Gets the name assigned to this . + /// Gets the name assigned to this . /// public string Name { get; } /// - /// Gets the rectangular bounds of this relative to the bounds of the - /// it is in. + /// Gets the rectangular bounds of this relative to the bounds of the + /// it is in. /// public Rectangle Bounds { get; } /// - /// Gets the x- and y-coordinate origin point for this relative to the - /// upper-left corner of the bonds of the it is in. + /// Gets the x- and y-coordinate origin point for this relative to the + /// upper-left corner of the bonds of the it is in. /// public Vector2 Origin { get; } /// - /// Gets the value assigned to this - /// . + /// Gets the value assigned to this + /// . /// public Color Color { get; } diff --git a/source/MonoGame.Aseprite/Sprite.cs b/source/MonoGame.Aseprite/Sprite.cs index 0106d87..58659e4 100644 --- a/source/MonoGame.Aseprite/Sprite.cs +++ b/source/MonoGame.Aseprite/Sprite.cs @@ -8,90 +8,8 @@ namespace MonoGame.Aseprite; /// -/// -/// Defines a named sprite -/// -/// -/// The class is a general purpose wrapper around a -/// with properties to control how it is rendered. When creating -/// a from an , it represents the image of the frame used to -/// create it. -/// -/// -/// The most common methods for creating a will be either by using the -/// to create an instance from a frame in -/// your Aseprite File, or by using a to create a from one of -/// the regions in the atlas. An instance can also be created manually using the constructor for a more general -/// purpose use. -/// +/// Defines a named sprite /// -/// -/// -/// The , , , -/// , and are passed automatically to the -/// when rendering this sprite. For one-off rendering -/// where you can override the parameter values passed to the -/// , you can render the -/// instead. -/// -/// -/// ### Performance Considerations -/// -/// -/// If you plan to create multiple instances from various frames in your Aseprite file, -/// consider first creating a , then creating each instance -/// using the . By doing this, you will be generating a single source -/// for the . Each -/// that is then created from the will be references the single -/// source instead of separate instances per -/// . -/// -/// -/// This is beneficial because it reduces the amount of texture swapping done on the -/// when rendering the -/// instances. -/// -/// -/// -/// -/// The following examples demonstrate various ways to create a : -/// -/// -/// // Load an Aseprite file -/// AsepriteFile aseFile = AsepriteFile.Load("path-to-file"); -/// -/// // Use the SpriteProcessor to create a Sprite -/// Sprite sprite = SpriteProcessor.Process(GraphicsDevice, aseFile, frameIndex: 0); -/// -/// -/// -/// // Load an Aseprite File -/// AsepriteFile aseFile = AsepriteFile.Load("path-to-file") -/// -/// // Create a TextureAtlas from the AsepriteFile using the TextureAtlasProcessor -/// TextureAtlas atlas = TextureAtlasProcessor.Process(GraphicsDevice, aseFile); -/// -/// // Create a Sprite from region 0 in the TextureAtlas -/// Sprite sprite = atlas.CreateSprite(regionIndex: 0); -/// -/// -/// -/// // Load an Aseprite File -/// AsepriteFile aseFile = AsepriteFile.Load("path-to-file") -/// -/// // Create a SpriteSheet from the AsepriteFile using the SpriteSheetProcessor -/// SpriteSheet spriteSheet = SpriteSheetProcessor.Process(GraphicsDevice, aseFile); -/// -/// // Create a Sprite from region 0 in the SpriteSheet -/// Sprite sprite = spriteSheet.CreateSprite(regionIndex: 0); -/// -/// -/// -/// -/// -/// -/// -/// public class Sprite { private TextureRegion _textureRegion; @@ -101,12 +19,12 @@ public class Sprite private float _transparency; /// - /// Gets the name assigned to this . + /// Gets the name assigned to this . /// public string Name { get; } /// - /// Gets the source of this . + /// Gets the source of this . /// public TextureRegion TextureRegion { @@ -115,32 +33,23 @@ public TextureRegion TextureRegion } /// - /// Gets the width, in pixels, of this + /// Gets the width, in pixels, of this /// - /// - /// The width, in pixels, of this . - /// public int Width => _textureRegion.Bounds.Width; /// - /// Gets the height, in pixels, of this + /// Gets the height, in pixels, of this /// - /// - /// The height, in pixels, of this . - /// public int Height => _textureRegion.Bounds.Height; /// - /// Gets or Sets the color mask to apply when rendering this . + /// Gets or Sets the color mask to apply when rendering this . /// - /// - /// The color mask to apply when rendering this . - /// public Color Color { get; set; } /// - /// Gets or Sets the level of transparency, between 0.0f, and 1.0f, to apply when rendering this - /// . + /// Gets or Sets the level of transparency, between 0.0f, and 1.0f, to apply when rendering this + /// . /// public float Transparency { @@ -149,12 +58,12 @@ public float Transparency } /// - /// Gets or Sets the rotation, in radians, to apply when rendering this . + /// Gets or Sets the rotation, in radians, to apply when rendering this . /// public float Rotation { get; set; } /// - /// Gets or Sets the x- and y-coordinate point of origin to apply when rendering this . + /// Gets or Sets the x- and y-coordinate point of origin to apply when rendering this . /// public Vector2 Origin { @@ -163,7 +72,7 @@ public Vector2 Origin } /// - /// Gets or Sets the x-coordinate point of origin to apply when rendering this . + /// Gets or Sets the x-coordinate point of origin to apply when rendering this . /// public float OriginX { @@ -172,7 +81,7 @@ public float OriginX } /// - /// Gets or Sets the y-coordinate point of origin to apply when rendering this . + /// Gets or Sets the y-coordinate point of origin to apply when rendering this . /// public float OriginY { @@ -181,7 +90,7 @@ public float OriginY } /// - /// Gets or Sets the x- and y-axis scale factor to use when rendering this . + /// Gets or Sets the x- and y-axis scale factor to use when rendering this . /// public Vector2 Scale { @@ -190,7 +99,7 @@ public Vector2 Scale } /// - /// Gets or Sets the x-axis scale factor to use when rendering this . + /// Gets or Sets the x-axis scale factor to use when rendering this . /// public float ScaleX { @@ -199,7 +108,7 @@ public float ScaleX } /// - /// Gets or Sets the y-axis scale factor to use when rendering this . + /// Gets or Sets the y-axis scale factor to use when rendering this . /// public float ScaleY { @@ -208,13 +117,13 @@ public float ScaleY } /// - /// Gets or Sets the to apply for vertical and - /// horizontal flipping when rendering this . + /// Gets or Sets the to apply for vertical and + /// horizontal flipping when rendering this . /// public SpriteEffects SpriteEffects { get; set; } /// - /// Gets or Sets a value that indicates whether to flip this horizontally when rendering. + /// Gets or Sets a value that indicates whether to flip this horizontally when rendering. /// public bool FlipHorizontally { @@ -223,7 +132,7 @@ public bool FlipHorizontally } /// - /// Gets or Sets a value that indicates whether to flip this vertically when rendering. + /// Gets or Sets a value that indicates whether to flip this vertically when rendering. /// public bool FlipVertically { @@ -232,23 +141,21 @@ public bool FlipVertically } /// - /// Gets or Sets the layer depth to render this at. + /// Gets or Sets the layer depth to render this at. /// public float LayerDepth { get; set; } /// - /// Gets or Sets a value that indicates if this is visible and can be rendered. + /// Gets or Sets a value that indicates if this is visible and can be rendered. /// public bool IsVisible { get; set; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The name to assign the . - /// + /// The name to assign the . /// - /// The source to assign the . + /// The source to assign the . /// public Sprite(string name, TextureRegion textureRegion) { @@ -265,26 +172,17 @@ public Sprite(string name, TextureRegion textureRegion) } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The name to assign the . - /// - /// - /// The source image for the . - /// + /// The name to assign the . + /// The source image for the . public Sprite(string name, Texture2D texture) : this(name, new TextureRegion(name, texture, texture.Bounds)) { } /// - /// Renders this . + /// Renders this . /// - /// - /// The to use for rendering this - /// . - /// - /// - /// The x- and y-coordinate location to render this at. - /// + /// The to use for rendering this. + /// The x- and y-coordinate location to render this at. public void Draw(SpriteBatch spriteBatch, Vector2 position) => spriteBatch.Draw(this, position); } diff --git a/source/MonoGame.Aseprite/SpriteBatchExtensions.cs b/source/MonoGame.Aseprite/SpriteBatchExtensions.cs index ab84c0a..2440af5 100644 --- a/source/MonoGame.Aseprite/SpriteBatchExtensions.cs +++ b/source/MonoGame.Aseprite/SpriteBatchExtensions.cs @@ -15,155 +15,116 @@ public static class SpriteBatchExtensions #region Texture Region /// - /// Draws a using the . + /// Draws a using the . /// /// - /// The to use for rendering. - /// - /// - /// The to render. + /// The to use for rendering. /// + /// The to render. /// - /// A rectangular bound that defines the destination to render the into. - /// - /// - /// The color mask to apply when rendering the . + /// A rectangular bound that defines the destination to render the into. /// + /// The color mask to apply when rendering the . public static void Draw(this SpriteBatch spriteBatch, TextureRegion region, Rectangle destinationRectangle, Color color) => spriteBatch.Draw(region.Texture, destinationRectangle, region.Bounds, color); /// - /// Draws a using the . + /// Draws a using the . /// /// - /// The to use for rendering. - /// - /// - /// The to render. - /// - /// - /// The x- and y-coordinate location to render the at. - /// - /// - /// The color mask to apply when rendering the . + /// The to use for rendering. /// + /// The to render. + /// The x- and y-coordinate location to render the at. + /// The color mask to apply when rendering the . public static void Draw(this SpriteBatch spriteBatch, TextureRegion region, Vector2 position, Color color) => spriteBatch.Draw(region.Texture, position, region.Bounds, color); /// - /// Draws a using the . + /// Draws a using the . /// /// - /// The to use for rendering. - /// - /// - /// The to render. - /// - /// - /// The x- and y-coordinate location to render the at. - /// - /// - /// The color mask to apply when rendering the . + /// The to use for rendering. /// + /// The to render. + /// The x- and y-coordinate location to render the at. + /// The color mask to apply when rendering the . /// - /// The amount of rotation, in radians, to apply when rendering the . + /// The amount of rotation, in radians, to apply when rendering the . /// /// - /// The x- and y-coordinate point of origin to apply when rendering the . - /// - /// - /// The amount of scaling to apply when rendering the . + /// The x- and y-coordinate point of origin to apply when rendering the . /// + /// The amount of scaling to apply when rendering the . /// - /// The to apply for horizontal and vertical axis - /// flipping when rendering the . - /// - /// - /// The layer depth to apply when rendering the . + /// The to apply for horizontal and vertical axis + /// flipping when rendering the . /// + /// The layer depth to apply when rendering the . public static void Draw(this SpriteBatch spriteBatch, TextureRegion region, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth) => spriteBatch.Draw(region.Texture, position, region.Bounds, color, rotation, origin, scale, effects, layerDepth); + /// - /// Draws a using the . + /// Draws a using the . /// /// - /// The to use for rendering. - /// - /// - /// The to render. - /// - /// - /// The x- and y-coordinate location to render the at. - /// - /// - /// The color mask to apply when rendering the . + /// The to use for rendering. /// + /// The to render. + /// The x- and y-coordinate location to render the at. + /// The color mask to apply when rendering the . /// - /// The amount of rotation, in radians, to apply when rendering the . + /// The amount of rotation, in radians, to apply when rendering the . /// /// - /// The x- and y-coordinate point of origin to apply when rendering the . - /// - /// - /// The amount of scaling to apply when rendering the . + /// The x- and y-coordinate point of origin to apply when rendering the . /// + /// The amount of scaling to apply when rendering the . /// - /// The to apply for horizontal and vertical axis - /// flipping when rendering the . - /// - /// - /// The layer depth to apply when rendering the . + /// The to apply for horizontal and vertical axis + /// flipping when rendering the . /// + /// The layer depth to apply when rendering the . public static void Draw(this SpriteBatch spriteBatch, TextureRegion region, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth) => spriteBatch.Draw(region.Texture, position, region.Bounds, color, rotation, origin, scale, effects, layerDepth); /// - /// Draws a using the . + /// Draws a using the . /// /// - /// The to use for rendering. - /// - /// - /// The to render. + /// The to use for rendering. /// + /// The to render. /// - /// A rectangular bound that defines the destination to render the into. - /// - /// - /// The color mask to apply when rendering the . + /// A rectangular bound that defines the destination to render the into. /// + /// The color mask to apply when rendering the . /// - /// The amount of rotation, in radians, to apply when rendering the . + /// The amount of rotation, in radians, to apply when rendering the . /// /// - /// The x- and y-coordinate point of origin to apply when rendering the . + /// The x- and y-coordinate point of origin to apply when rendering the . /// /// - /// The to apply for horizontal and vertical axis - /// flipping when rendering the . - /// - /// - /// The layer depth to apply when rendering the . + /// The to apply for horizontal and vertical axis + /// flipping when rendering the . /// + /// The layer depth to apply when rendering the . public static void Draw(this SpriteBatch spriteBatch, TextureRegion region, Rectangle destinationRectangle, Color color, float rotation, Vector2 origin, SpriteEffects effects, float layerDepth) => spriteBatch.Draw(region.Texture, destinationRectangle, region.Bounds, color, rotation, origin, effects, layerDepth); #endregion Texture Region /// - /// Draws a using the . + /// Draws a using the . /// /// - /// The to use for rendering the - /// . + /// The to use for rendering the . /// - /// - /// The to render. - /// - /// - /// The x- and y-coordinate location to render the at. + /// The to render. /// + /// The x- and y-coordinate location to render the at. public static void Draw(this SpriteBatch spriteBatch, Sprite sprite, Vector2 position) => spriteBatch.Draw(sprite.TextureRegion, position, sprite.Color * sprite.Transparency, sprite.Rotation, sprite.Origin, sprite.Scale, sprite.SpriteEffects, sprite.LayerDepth); @@ -171,71 +132,45 @@ public static void Draw(this SpriteBatch spriteBatch, Sprite sprite, Vector2 pos #region Animated Tilemap /// - /// Draws an using the . + /// Draws an using the . /// /// - /// The to use for rendering the - /// . - /// - /// - /// The to draw. - /// - /// - /// The x- and y-coordinate location to render the at. - /// - /// - /// The color mask to apply when rendering the . + /// The to use for rendering the + /// . /// + /// The to draw. + /// The x- and y-coordinate location to render the at. + /// The color mask to apply when rendering the . public static void Draw(this SpriteBatch spriteBatch, AnimatedTilemap animatedTilemap, Vector2 position, Color color) => Draw(spriteBatch, animatedTilemap, position, color, Vector2.One, 0.0f); /// - /// Draws an using the . + /// Draws an using the . /// /// - /// The to use for rendering the - /// . - /// - /// - /// The to draw. - /// - /// - /// The x- and y-coordinate location to render the at. - /// - /// - /// The color mask to apply when rendering the . - /// - /// - /// The amount of scaling to apply when rendering the . - /// - /// - /// The layer depth to apply when rendering the . - /// + /// The to use for rendering the + /// . + /// + /// The to draw. + /// The x- and y-coordinate location to render the at. + /// The color mask to apply when rendering the . + /// The amount of scaling to apply when rendering the . + /// The layer depth to apply when rendering the . public static void Draw(this SpriteBatch spriteBatch, AnimatedTilemap animatedTilemap, Vector2 position, Color color, float scale, float layerDepth) => Draw(spriteBatch, animatedTilemap, position, color, new Vector2(scale, scale), layerDepth); /// - /// Draws an using the . + /// Draws an using the . /// /// - /// The to use for rendering the - /// . - /// - /// - /// The to draw. - /// - /// - /// The x- and y-coordinate location to render the at. - /// - /// - /// The color mask to apply when rendering the . - /// - /// - /// The amount of scaling to apply when rendering the . - /// - /// - /// The layer depth to apply when rendering the . - /// + /// The to use for rendering the + /// . + /// + /// The to draw. + /// The x- and y-coordinate location to render the at. + /// The color mask to apply when rendering the . + /// The amount of scaling to apply when rendering the . + /// The layer depth to apply when rendering the . public static void Draw(this SpriteBatch spriteBatch, AnimatedTilemap animatedTilemap, Vector2 position, Color color, Vector2 scale, float layerDepth) { AnimatedTilemapFrame frame = animatedTilemap.CurrentFrame; @@ -255,68 +190,42 @@ public static void Draw(this SpriteBatch spriteBatch, AnimatedTilemap animatedTi #region Tilemap /// - /// Draws a using the . + /// Draws a using the . /// /// /// The to use for rendering the . /// - /// - /// The to draw. - /// - /// - /// The x- and y-coordinate location to render the at. - /// - /// - /// The color mask to apply when rendering the . - /// + /// The to draw. + /// The x- and y-coordinate location to render the at. + /// The color mask to apply when rendering the . public static void Draw(this SpriteBatch spriteBatch, Tilemap tilemap, Vector2 position, Color color) => Draw(spriteBatch, tilemap, position, color, Vector2.One, 0.0f); /// - /// Draws a using the . + /// Draws a using the . /// /// /// The to use for rendering the . /// - /// - /// The to draw. - /// - /// - /// The x- and y-coordinate location to render the at. - /// - /// - /// The color mask to apply when rendering the . - /// - /// - /// The amount of scaling to apply when rendering the . - /// - /// - /// The layer depth to apply when rendering the . - /// + /// The to draw. + /// The x- and y-coordinate location to render the at. + /// The color mask to apply when rendering the . + /// The amount of scaling to apply when rendering the . + /// The layer depth to apply when rendering the . public static void Draw(this SpriteBatch spriteBatch, Tilemap tilemap, Vector2 position, Color color, float scale, float layerDepth) => Draw(spriteBatch, tilemap, position, color, new Vector2(scale, scale), layerDepth); /// - /// Draws a using the . + /// Draws a using the . /// /// /// The to use for rendering the . /// - /// - /// The to draw. - /// - /// - /// The x- and y-coordinate location to render the at. - /// - /// - /// The color mask to apply when rendering the . - /// - /// - /// The amount of scaling to apply when rendering the . - /// - /// - /// The layer depth to apply when rendering the . - /// + /// The to draw. + /// The x- and y-coordinate location to render the at. + /// The color mask to apply when rendering the . + /// The amount of scaling to apply when rendering the . + /// The layer depth to apply when rendering the . public static void Draw(this SpriteBatch spriteBatch, Tilemap tilemap, Vector2 position, Color color, Vector2 scale, float layerDepth) { foreach (TilemapLayer layer in tilemap) @@ -334,77 +243,55 @@ public static void Draw(this SpriteBatch spriteBatch, Tilemap tilemap, Vector2 p #region Tilemap Layer /// - /// Draws a layer using the - /// . + /// Draws a layer using the . /// /// - /// The to use for rendering the - /// . - /// - /// - /// The to draw. + /// The to use for rendering the + /// . /// + /// The to draw. /// - /// The x- and y-coordinate location to draw the at. Drawing the - /// using this method ignores the . - /// - /// - /// The color mask to apply when rendering the . + /// The x- and y-coordinate location to draw the at. Drawing the + /// using this method ignores the . /// + /// The color mask to apply when rendering the . public static void Draw(this SpriteBatch spriteBatch, TilemapLayer layer, Vector2 position, Color color) => Draw(spriteBatch, layer, position, color, Vector2.One, 0.0f); /// - /// Draws a layer using the - /// . + /// Draws a layer using the . /// /// - /// The to use for rendering the - /// . - /// - /// - /// The to draw. + /// The to use for rendering the + /// . /// + /// The to draw. /// - /// The x- and y-coordinate location to draw the at. Drawing the - /// using this method ignores the . - /// - /// - /// The color mask to apply when rendering the . - /// - /// - /// The amount of scaling to apply when rendering the . - /// - /// - /// The layer depth to apply when rendering the . + /// The x- and y-coordinate location to draw the at. Drawing the + /// using this method ignores the . /// + /// The color mask to apply when rendering the . + /// The amount of scaling to apply when rendering the . + /// The layer depth to apply when rendering the . public static void Draw(this SpriteBatch spriteBatch, TilemapLayer layer, Vector2 position, Color color, float scale, float layerDepth) => Draw(spriteBatch, layer, position, color, new Vector2(scale, scale), layerDepth); + /// - /// Draws a layer using the - /// . + /// Draws a layer using the . /// /// - /// The to use for rendering the - /// . - /// - /// - /// The to draw. + /// The to use for rendering the + /// . /// + /// The to draw. /// - /// The x- and y-coordinate location to draw the at. Drawing the - /// using this method ignores the . - /// - /// - /// The color mask to apply when rendering the . - /// - /// - /// The amount of scaling to apply when rendering the . - /// - /// - /// The layer depth to apply when rendering the . + /// The x- and y-coordinate location to draw the at. Drawing the + /// using this method ignores the . /// + /// The color mask to apply when rendering the . + /// The amount of scaling to apply when rendering the . + /// The layer depth to apply when rendering the . public static void Draw(this SpriteBatch spriteBatch, TilemapLayer layer, Vector2 position, Color color, Vector2 scale, float layerDepth) { Vector2 tPosition = position; diff --git a/source/MonoGame.Aseprite/SpriteSheet.cs b/source/MonoGame.Aseprite/SpriteSheet.cs index e702e06..b3df85b 100644 --- a/source/MonoGame.Aseprite/SpriteSheet.cs +++ b/source/MonoGame.Aseprite/SpriteSheet.cs @@ -7,8 +7,8 @@ namespace MonoGame.Aseprite; /// -/// Defines a spritesheet with a source and methods for creating -/// and elements. +/// Defines a spritesheet with a source and methods for creating +/// and elements. /// public sealed class SpriteSheet { @@ -17,49 +17,41 @@ public sealed class SpriteSheet private Dictionary _animationTagLookup = new(); /// - /// Gets the total number of elements that have been defined for this - /// . + /// Gets the total number of elements that have been defined for this + /// . /// public int AnimationTagCount => _animationTagLookup.Count; /// - /// Gets the name assigned to this . + /// Gets the name assigned to this . /// public string Name { get; } /// - /// Gets the source of this . + /// Gets the source of this . /// public TextureAtlas TextureAtlas { get; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The name assign the . - /// - /// - /// The source to give the . - /// + /// The name assign the . + /// The source to give the . public SpriteSheet(string name, TextureAtlas atlas) => (Name, TextureAtlas) = (name, atlas); /// - /// Creates a new from the at the specified index in the - /// of this . + /// Creates a new from the at the specified index in the + /// of this . /// - /// - /// The name to assign the that is created. - /// + /// The name to assign the that is created. /// - /// The index of the element in the assign the - /// that is created. + /// The index of the element in the assign the + /// that is created. /// - /// - /// The that is created by this method. - /// + /// The that is created by this method. /// - /// Thrown if the specified index is less than zero or is greater than or equal to the total number of - /// elements in the . + /// Thrown if the specified index is less than zero or is greater than or equal to the total number of + /// elements in the . /// public Sprite CreateSprite(string spriteName, int regionIndex) { @@ -69,16 +61,16 @@ public Sprite CreateSprite(string spriteName, int regionIndex) } /// - /// Creates a new from the at the specified index in the - /// of this . + /// Creates a new from the at the specified index in the + /// of this . /// /// - /// The index of the element to assign the that is created. + /// The index of the element to assign the that is created. /// /// The that is created by this method. /// - /// Thrown if the specified index is less than zero or is greater than or equal to the total number of - /// elements in the . + /// Thrown if the specified index is less than zero or is greater than or equal to the total number of + /// elements in the . /// public Sprite CreateSprite(int regionIndex) { @@ -88,22 +80,18 @@ public Sprite CreateSprite(int regionIndex) } /// - /// Creates a new from the at the specified index in the - /// of this . + /// Creates a new from the at the specified index in the + /// of this . /// - /// - /// The name to assign the that is created. - /// + /// The name to assign the that is created. /// - /// The name of the element in the assign the - /// that is created. + /// The name of the element in the assign the + /// that is created. /// - /// - /// The that is created by this method. - /// + /// The that is created by this method. /// - /// Thrown if the does not contain a with the name - /// specified. + /// Thrown if the does not contain a with the name + /// specified. /// public Sprite CreateSprite(string spriteName, string regionName) { @@ -113,17 +101,17 @@ public Sprite CreateSprite(string spriteName, string regionName) } /// - /// Creates a new from the at the specified index in the - /// of this . + /// Creates a new from the at the specified index in the + /// of this . /// /// - /// The name of the element in the assign the - /// that is created. + /// The name of the element in the assign the + /// that is created. /// /// The that is created by this method. /// - /// Thrown if the does not contain a with the name - /// specified. + /// Thrown if the does not contain a with the name + /// specified. /// public Sprite CreateSprite(string regionName) { @@ -145,22 +133,20 @@ internal void AddAnimationTag(AnimationTag tag) } /// - /// Creates a new and adds it to this . + /// Creates a new and adds it to this . /// /// - /// The name to assign the that is created by this method. This name must be unique - /// across all elements defined in this . + /// The name to assign the that is created by this method. This name must be unique + /// across all elements defined in this . /// /// - /// An method used to build the with an - /// . + /// An method used to build the with an + /// . /// - /// - /// The that is created by this method. - /// + /// The that is created by this method. /// - /// Thrown if this already contains an element with the - /// name specified. + /// Thrown if this already contains an element with the + /// name specified. /// public AnimationTag CreateAnimationTag(string name, Action builder) { @@ -174,17 +160,13 @@ public AnimationTag CreateAnimationTag(string name, Action } /// - /// Gets the element with the specified name in this . + /// Gets the element with the specified name in this . /// - /// - /// The name of the to locate. - /// - /// - /// The that was located. - /// + /// The name of the to locate. + /// The that was located. /// - /// Thrown if this does not contain an element with the - /// specified name. + /// Thrown if this does not contain an element with the + /// specified name. /// public AnimationTag GetAnimationTag(string name) { @@ -197,74 +179,68 @@ public AnimationTag GetAnimationTag(string name) } /// - /// Gets the element with the specified name in this . + /// Gets the element with the specified name in this . /// - /// - /// The name of the to locate. - /// + /// The name of the to locate. /// - /// When this method returns , contains the located; otherwise, - /// + /// When this method returns , contains the located; otherwise, + /// /// /// - /// if the was located; otherwise, . - /// This method returns if this does not contain an - /// element with the specified name. + /// if the was located; otherwise, . + /// This method returns if this does not contain an + /// element with the specified name. /// public bool TryGetAnimationTag(string name, [NotNullWhen(true)] out AnimationTag? tag) => _animationTagLookup.TryGetValue(name, out tag); /// - /// Returns a new containing the name of all elements that - /// have been defined in this . + /// Returns a new containing the name of all elements that + /// have been defined in this . /// /// - /// A new containing the name of all elements that have been - /// defined in this . + /// A new containing the name of all elements that have been + /// defined in this . /// public List GetAnimationTagNames() => _animationTagLookup.Keys.ToList(); /// - /// Returns a value that indicates whether this contains an - /// with the specified name. + /// Returns a value that indicates whether this contains an + /// with the specified name. /// - /// - /// The name fo the element to locate. - /// + /// The name of the element to locate. /// - /// if this contains an with the - /// specified name; otherwise, . + /// if this contains an with the + /// specified name; otherwise, . /// public bool ContainsAnimationTag(string name) => _animationTagLookup.ContainsKey(name); /// - /// Removes the element with the specified name from this . + /// Removes the element with the specified name from this . /// /// - /// The name of the element to remove from this . + /// The name of the element to remove from this . /// /// - /// if the element was successfully removed from this - /// ; otherwise, . This method returns - /// if this does not contain an element with the specified - /// name. + /// if the element was successfully removed from this + /// ; otherwise, . This method returns + /// if this does not contain an element with the specified + /// name. /// public bool RemoveAnimationTag(string name) => _animationTagLookup.Remove(name); /// - /// Creates a new using the element with the specified - /// name in this . + /// Creates a new using the element with the specified + /// name in this . /// /// - /// The name of the element in this to create the - /// with. + /// The name of the element in this to create the + /// with. /// - /// - /// The that is created by this method. - /// + /// The that is created by this method. /// - /// Thrown if this does not contain an element with the - /// specified name. + /// Thrown if this does not contain an element with the + /// specified name. /// public AnimatedSprite CreateAnimatedSprite(string tagName) { diff --git a/source/MonoGame.Aseprite/TextureAtlas.cs b/source/MonoGame.Aseprite/TextureAtlas.cs index 78127a9..7e2ac7b 100644 --- a/source/MonoGame.Aseprite/TextureAtlas.cs +++ b/source/MonoGame.Aseprite/TextureAtlas.cs @@ -7,11 +7,10 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; - namespace MonoGame.Aseprite; /// -/// Defines a with a source image and zero or more elements. +/// Defines a with a source image and zero or more elements. /// public class TextureAtlas : IEnumerable { @@ -19,33 +18,33 @@ public class TextureAtlas : IEnumerable private Dictionary _regionLookup = new(); /// - /// G ets the name assigned to this . + /// Gets the name assigned to this . /// public string Name { get; } /// - /// Gets the source image of this . + /// Gets the source image of this . /// public Texture2D Texture { get; } /// - /// Gets the total number of elements in this . + /// Gets the total number of elements in this . /// public int RegionCount => _regions.Count; /// - /// Gets the element at the specified index in this . + /// Gets the element at the specified index in this . /// /// - /// The index of the element in this to locate. + /// The index of the element in this to locate. /// /// - /// The element that was located at the specified index in this - /// . + /// The element that was located at the specified index in this + /// . /// /// - /// Thrown if the specified index is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the specified index is less than zero or is greater than or equal to the total number of + /// elements in this . /// public TextureRegion this[int index] => GetRegion(index); @@ -53,27 +52,23 @@ public class TextureAtlas : IEnumerable /// Gets the element with the specified name in this . /// /// - /// The name of the element in this to locate. + /// The name of the element in this to locate. /// /// - /// The element that was located with the specified name in this - /// . + /// The element that was located with the specified name in this + /// . /// /// - /// Thrown if this does not contain a with the specified - /// name. + /// Thrown if this does not contain a with the specified + /// name. /// public TextureRegion this[string name] => GetRegion(name); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The name to assign the . - /// - /// T - /// he source image to give the . - /// + /// The name to assign the . + /// The source image to give the . public TextureAtlas(string name, Texture2D texture) => (Name, Texture) = (name, texture); private void AddRegion(TextureRegion region) @@ -91,76 +86,66 @@ private bool RemoveRegion(TextureRegion region) => _regions.Remove(region) && _regionLookup.Remove(region.Name); /// - /// Creates a new and adds it to this . + /// Creates a new and adds it to this . /// /// - /// The name to assign the that is created. The name must be unique across all - /// in this . + /// The name to assign the that is created. The name must be unique across all + /// in this . /// /// - /// The x-coordinate location of the upper-left corner of the within the source - /// image of this . + /// The x-coordinate location of the upper-left corner of the within the source + /// image of this . /// /// - /// The y-coordinate location of the upper-left corner of the within the source - /// image of this . - /// - /// - /// The width, in pixels, of the . - /// - /// - /// The height, in pixels, of the . + /// The y-coordinate location of the upper-left corner of the within the source + /// image of this . /// + /// The width, in pixels, of the . + /// The height, in pixels, of the . /// - /// Thrown if this already contains a element with the - /// specified name. + /// Thrown if this already contains a element with the + /// specified name. /// - /// - /// The created by this method. - /// + /// The created by this method. public TextureRegion CreateRegion(string name, int x, int y, int width, int height) => CreateRegion(name, new Rectangle(x, y, width, height)); /// - /// Creates a new and adds it to this . + /// Creates a new and adds it to this . /// /// - /// The name to assign the that is created. The name must be unique across all - /// in this . + /// The name to assign the that is created. The name must be unique across all + /// in this . /// /// - /// The x- and y-coordinate location of the upper-left corner of the within the - /// source image of this . + /// The x- and y-coordinate location of the upper-left corner of the within the + /// source image of this . /// /// The width and height extents, in pixels, of the . /// - /// Thrown if this already contains a element with the - /// specified name. + /// Thrown if this already contains a element with the + /// specified name. /// - /// - /// The created by this method. - /// + /// The created by this method. public TextureRegion CreateRegion(string name, Point location, Point size) => CreateRegion(name, new Rectangle(location, size)); /// - /// Creates a new and adds it to this . + /// Creates a new and adds it to this . /// /// - /// The name to assign the that is created. The name must be unique across all - /// in this . + /// The name to assign the that is created. The name must be unique across all + /// in this . /// /// - /// The rectangular bounds of the within the source image of this - /// . + /// The rectangular bounds of the within the source image of this + /// . /// /// - /// Thrown if this already contains a element with the - /// specified name. + /// Thrown if this already contains a element with the + /// specified name. /// - /// - /// The created by this method. - /// + /// The created by this method. public TextureRegion CreateRegion(string name, Rectangle bounds) { TextureRegion region = new(name, Texture, bounds); @@ -169,31 +154,25 @@ public TextureRegion CreateRegion(string name, Rectangle bounds) } /// - /// Returns a value that indicates whether this contains a - /// element with the specified name. + /// Returns a value that indicates whether this contains a + /// element with the specified name. /// - /// - /// The name of the to locate. - /// + /// The name of the to locate. /// - /// if this contains a element - /// with the specified name; otherwise, . + /// if this contains a element + /// with the specified name; otherwise, . /// public bool ContainsRegion(string name) => _regionLookup.ContainsKey(name); /// - /// Returns the index of the element with the specified name in this - /// . + /// Returns the index of the element with the specified name in this + /// . /// - /// - /// The name of the to locate. - /// - /// - /// The index of the located. - /// + /// The name of the to locate. + /// The index of the located. /// - /// if this contains a element - /// with the specified name; otherwise, . + /// if this contains a element + /// with the specified name; otherwise, . /// public int GetIndexOfRegion(string name) { @@ -211,17 +190,13 @@ public int GetIndexOfRegion(string name) } /// - /// Gets the element at the specified index in this . + /// Gets the element at the specified index in this . /// - /// - /// The index of the element to locate. - /// - /// - /// The element that was located. - /// + /// The index of the element to locate. + /// The element that was located. /// - /// Thrown if the specified index is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the specified index is less than zero or is greater than or equal to the total number of + /// elements in this . /// public TextureRegion GetRegion(int index) { @@ -234,17 +209,13 @@ public TextureRegion GetRegion(int index) } /// - /// Gets the element with the specified name in this . + /// Gets the element with the specified name in this . /// - /// - /// The name of the element to locate. - /// - /// - /// The element that was located. - /// + /// The name of the element to locate. + /// The element that was located. /// - /// Thrown if this does not contain a element with the - /// specified name. + /// Thrown if this does not contain a element with the + /// specified name. /// public TextureRegion GetRegion(string name) { @@ -259,19 +230,15 @@ public TextureRegion GetRegion(string name) } /// - /// Gets a new of all elements at the specified indexes in - /// this . Order of the elements in the collection returned is the same as the order - /// of the indexes specified. + /// Gets a new of all elements at the specified indexes in + /// this . Order of the elements in the collection returned is the same as the order + /// of the indexes specified. /// - /// - /// The indexes of the elements to locate. - /// - /// - /// A new containing the elements located. - /// + /// The indexes of the elements to locate. + /// A new containing the elements located. /// - /// Thrown if any of the specified indexes are less than zero or if any are greater than or equal to the total - /// number of elements in this . + /// Thrown if any of the specified indexes are less than zero or if any are greater than or equal to the total + /// number of elements in this . /// public List GetRegions(params int[] indexes) { @@ -285,19 +252,15 @@ public List GetRegions(params int[] indexes) } /// - /// Gets a new of all elements with the specified names in - /// this . Order of the elements in the collection returned is the same as the order - /// of names specified. + /// Gets a new of all elements with the specified names in + /// this . Order of the elements in the collection returned is the same as the order + /// of names specified. /// - /// - /// The names of the elements to locate. - /// - /// - /// A new containing the elements located. - /// + /// The names of the elements to locate. + /// A new containing the elements located. /// - /// Thrown if any of the specified names do not match a element in this - /// . + /// Thrown if any of the specified names do not match a element in this + /// . /// public List GetRegions(params string[] names) { @@ -312,20 +275,18 @@ public List GetRegions(params string[] names) } /// - /// Gets the element at the specified index in this . + /// Gets the element at the specified index in this . /// - /// - /// The index of the element to locate. - /// + /// The index of the element to locate. /// - /// When this method returns , contains the located; - /// otherwise, . + /// When this method returns , contains the located; + /// otherwise, . /// /// - /// if a element was located; otherwise, - /// . This method returns if the index specified is less than - /// zero or is greater than or equal to the total number of elements in this - /// . + /// if a element was located; otherwise, + /// . This method returns if the index specified is less than + /// zero or is greater than or equal to the total number of elements in this + /// . /// public bool TryGetRegion(int index, [NotNullWhen(true)] out TextureRegion? region) { @@ -341,34 +302,30 @@ public bool TryGetRegion(int index, [NotNullWhen(true)] out TextureRegion? regio } /// - /// Gets the element with the specified name in this . + /// Gets the element with the specified name in this . /// - /// - /// The name of the element to locate. - /// + /// The name of the element to locate. /// - /// When this method returns , contains the located; - /// otherwise, . + /// When this method returns , contains the located; + /// otherwise, . /// /// - /// if a element was located; otherwise, - /// . This method returns if this - /// does not contain a element with the specified name. + /// if a element was located; otherwise, + /// . This method returns if this + /// does not contain a element with the specified name. /// public bool TryGetRegion(string name, [NotNullWhen(true)] out TextureRegion? region) => _regionLookup.TryGetValue(name, out region); /// - /// Removes the element at the specified index from this . + /// Removes the element at the specified index from this . /// - /// - /// The index of the element to remove. - /// + /// The index of the element to remove. /// - /// if the element was successfully removed; otherwise, - /// . This method returns if the specified index is less than - /// zero or is greater than or equal to the total number of element in this - /// . + /// if the element was successfully removed; otherwise, + /// . This method returns if the specified index is less than + /// zero or is greater than or equal to the total number of element in this + /// . /// public bool RemoveRegion(int index) { @@ -381,16 +338,14 @@ public bool RemoveRegion(int index) } /// - /// Removes the element with the specified name from this - /// . + /// Removes the element with the specified name from this + /// . /// - /// - /// The name of the element to remove. - /// + /// The name of the element to remove. /// - /// if the element was successfully removed; otherwise, - /// . This method returns if this - /// does not contain a element with the specified name. + /// if the element was successfully removed; otherwise, + /// . This method returns if this + /// does not contain a element with the specified name. /// public bool RemoveRegion(string name) { @@ -403,22 +358,18 @@ public bool RemoveRegion(string name) } /// - /// Creates a new from the at the specified index in this - /// . + /// Creates a new from the at the specified index in this + /// . /// - /// - /// The name to assign the that is created. - /// + /// The name to assign the that is created. /// - /// The index of the element in this assign the - /// that is created. + /// The index of the element in this assign the + /// that is created. /// - /// - /// The that is created by this method. - /// + /// The that is created by this method. /// - /// Thrown if the specified index is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the specified index is less than zero or is greater than or equal to the total number of + /// elements in this . /// public Sprite CreateSprite(string spriteName, int regionIndex) { @@ -428,18 +379,16 @@ public Sprite CreateSprite(string spriteName, int regionIndex) } /// - /// Creates a new from the at the specified index in this - /// . + /// Creates a new from the at the specified index in this + /// . /// /// - /// The index of the element to assign the that is created. + /// The index of the element to assign the that is created. /// - /// - /// The that is created by this method. - /// + /// The that is created by this method. /// - /// Thrown if the specified index is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the specified index is less than zero or is greater than or equal to the total number of + /// elements in this . /// public Sprite CreateSprite(int regionIndex) { @@ -449,22 +398,18 @@ public Sprite CreateSprite(int regionIndex) } /// - /// Creates a new from the with the specified name in this - /// . + /// Creates a new from the with the specified name in this + /// . /// - /// - /// The name to assign the that is created. - /// + /// The name to assign the that is created. /// - /// The name of the element in this assign the - /// that is created. + /// The name of the element in this assign the + /// that is created. /// - /// - /// The that is created by this method. - /// + /// The that is created by this method. /// - /// Thrown if this does not contain a with the name - /// specified. + /// Thrown if this does not contain a with the name + /// specified. /// public Sprite CreateSprite(string spriteName, string regionName) { @@ -474,19 +419,17 @@ public Sprite CreateSprite(string spriteName, string regionName) } /// - /// Creates a new from the with the specified name in this - /// . + /// Creates a new from the with the specified name in this + /// . /// /// - /// The name of the element in this assign the - /// that is created. + /// The name of the element in this assign the + /// that is created. /// - /// - /// The that is created by this method. - /// + /// The that is created by this method. /// - /// Thrown if this does not contain a with the name - /// specified. + /// Thrown if this does not contain a with the name + /// specified. /// public Sprite CreateSprite(string regionName) { @@ -496,7 +439,7 @@ public Sprite CreateSprite(string regionName) } /// - /// Removes all elements from this . + /// Removes all elements from this . /// public void Clear() { @@ -507,21 +450,9 @@ public void Clear() } } - /// - /// Returns an enumerator that iterates each element in this - /// . - /// - /// - /// An enumerator that iterates each elements in this . - /// + /// public IEnumerator GetEnumerator() => _regions.GetEnumerator(); - /// - /// Returns an enumerator that iterates each element in this - /// . - /// - /// - /// An enumerator that iterates each elements in this . - /// + /// IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } diff --git a/source/MonoGame.Aseprite/TextureRegion.cs b/source/MonoGame.Aseprite/TextureRegion.cs index f309f9e..3a90506 100644 --- a/source/MonoGame.Aseprite/TextureRegion.cs +++ b/source/MonoGame.Aseprite/TextureRegion.cs @@ -15,62 +15,54 @@ public class TextureRegion private Dictionary _objects = new(); /// - /// Gets the name assigned to this . + /// Gets the name assigned to this . /// public string Name { get; } /// - /// Gets the source texture used by this . + /// Gets the source texture used by this . /// public Texture2D Texture { get; } /// - /// Gets the rectangular bounds that define the location and width and height extents, in pixels, of the region - /// within the source texture that is represented by this . + /// Gets the rectangular bounds that define the location and width and height extents, in pixels, of the region + /// within the source texture that is represented by this . /// public Rectangle Bounds { get; } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The name to assign the . - /// - /// - /// The source texture image this region is from. - /// - /// - /// The rectangular bounds of this region within the source texture. - /// + /// The name to assign the . + /// The source texture image this region is from. + /// The rectangular bounds of this region within the source texture. public TextureRegion(string name, Texture2D texture, Rectangle bounds) => (Name, Texture, Bounds) = (name, texture, bounds); /// - /// Creates and adds a new element to this . + /// Creates and adds a new element to this . /// /// - /// The name to assign the that is created by this method. The name must be - /// unique across all elements in this . + /// The name to assign the that is created by this method. The name must be + /// unique across all elements in this . /// /// - /// The bounds to assign the created by this method. This should be relative to the bounds - /// of this . + /// The bounds to assign the created by this method. This should be relative to the bounds + /// of this . /// /// - /// The x- and y-coordinate origin point to assign the created by this method. - /// This should be relative to the upper-left corner of the bounds of this . + /// The x- and y-coordinate origin point to assign the created by this method. + /// This should be relative to the upper-left corner of the bounds of this . /// /// - /// A value to assign the created - /// by this method. + /// A value to assign the created + /// by this method. /// - /// - /// The created by this method. - /// + /// The created by this method. /// - /// Thrown if this already contains a with the - /// specified name. + /// Thrown if this already contains a with the + /// specified name. /// public Slice CreateSlice(string name, Rectangle bounds, Vector2 origin, Color color) { @@ -80,34 +72,32 @@ public Slice CreateSlice(string name, Rectangle bounds, Vector2 origin, Color co } /// - /// Creates and adds a new element to this . + /// Creates and adds a new element to this . /// /// - /// The name to assign the that is created by this method. The name must be - /// unique across all elements in this . + /// The name to assign the that is created by this method. The name must be + /// unique across all elements in this . /// /// - /// The bounds to assign the created by this method. This should be relative to - /// the bounds of this . + /// The bounds to assign the created by this method. This should be relative to + /// the bounds of this . /// /// - /// The center bounds to assign the created by this method. This should be - /// relative to the . + /// The center bounds to assign the created by this method. This should be + /// relative to the . /// /// - /// The x- and y-coordinate origin point to assign the created by this method. - /// This should be relative to the upper-left corner of the bounds of this . + /// The x- and y-coordinate origin point to assign the created by this method. + /// This should be relative to the upper-left corner of the bounds of this . /// /// - /// A value to assign the created - /// by this method. + /// A value to assign the created + /// by this method. /// - /// - /// The created by this method. - /// + /// The created by this method. /// - /// Thrown if this already contains a with the - /// specified name. + /// Thrown if this already contains a with the + /// specified name. /// public NinePatchSlice CreateNinePatchSlice(string name, Rectangle bounds, Rectangle centerBounds, Vector2 origin, Color color) { @@ -127,17 +117,13 @@ private void AddSlice(Slice slice) } /// - /// Returns the element with the specified name from this . + /// Returns the element with the specified name from this . /// - /// - /// The name of the element to locate. - /// - /// - /// The element located. - /// + /// The name of the element to locate. + /// The element located. /// - /// Thrown if this does not contain a element with the specified - /// name. + /// Thrown if this does not contain a element with the specified + /// name. /// public Slice GetSlice(string name) { @@ -150,36 +136,30 @@ public Slice GetSlice(string name) } /// - /// Returns the element with the specified name from this . + /// Returns the element with the specified name from this . /// - /// - /// The name of the element to locate. - /// + /// The name of the element to locate. /// - /// When this method returns , contains the located; otherwise, - /// + /// When this method returns , contains the located; otherwise, + /// /// /// - /// if the was located; otherwise, . - /// This method returns if this does not contain - /// a element with the specified name. + /// if the was located; otherwise, . + /// This method returns if this does not contain + /// a element with the specified name. /// public bool TryGetSlice(string name, out Slice? slice) => _objects.TryGetValue(name, out slice); /// - /// Returns the element with the specified name from this as the - /// type specified. + /// Returns the element with the specified name from this as the + /// type specified. /// /// - /// The type to return the located element as. Must derived from the base type - /// . + /// The type to return the located element as. Must derived from the base type + /// . /// - /// - /// The name of the element to locate. - /// - /// - /// The element located as the type specified. - /// + /// The name of the element to locate. + /// The element located as the type specified. public T GetSlice(string name) where T : Slice { if (_objects.TryGetValue(name, out Slice? slice)) @@ -191,24 +171,22 @@ public T GetSlice(string name) where T : Slice } /// - /// Returns the element with the specified name from this as the - /// type specified. + /// Returns the element with the specified name from this as the + /// type specified. /// /// - /// The type to return the located element as. Must derived from the base type - /// . + /// The type to return the located element as. Must derived from the base type + /// . /// - /// - /// The name of the element to locate. - /// + /// The name of the element to locate. /// - /// When this method returns , contains the located; otherwise, - /// + /// When this method returns , contains the located; otherwise, + /// /// /// - /// if the was located; otherwise, . - /// This method returns if this does not contain - /// a element with the specified name. + /// if the was located; otherwise, . + /// This method returns if this does not contain + /// a element with the specified name. /// public bool TryGetSlice(string name, out T? slice) where T : Slice { @@ -225,145 +203,117 @@ public bool TryGetSlice(string name, out T? slice) where T : Slice } /// - /// Removes the element with the specified name from this . + /// Removes the element with the specified name from this . /// - /// - /// The name of the element to remove. - /// + /// The name of the element to remove. /// - /// if the element was successfully removed; otherwise, - /// . This method returns when this - /// does not have a element with the specified name. + /// if the element was successfully removed; otherwise, + /// . This method returns when this + /// does not have a element with the specified name. /// public bool RemoveSlice(string name) => _objects.Remove(name); /// - /// Removes all elements from this . + /// Removes all elements from this . /// public void RemoveAllSlices() => _objects.Clear(); /// - /// Draws this instance using the - /// provided. + /// Draws this instance using the + /// provided. /// /// - /// The to use for rendering. + /// The to use for rendering. /// /// - /// A rectangular bound that defines the destination to render this into. - /// - /// - /// The color mask to apply when rendering this . + /// A rectangular bound that defines the destination to render this into. /// + /// The color mask to apply when rendering this . public void Draw(SpriteBatch spriteBatch, Rectangle destinationRectangle, Color color) => spriteBatch.Draw(this, destinationRectangle, color); /// - /// Draws this instance using the - /// provided. + /// Draws this instance using the + /// provided. /// /// - /// The to use for rendering. - /// - /// - /// The x- and y-coordinate location to render this at. - /// - /// - /// The color mask to apply when rendering this . + /// The to use for rendering. /// + /// The x- and y-coordinate location to render this at. + /// The color mask to apply when rendering this . public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color) => spriteBatch.Draw(this, position, color); /// - /// Draws this using the - /// provided. + /// Draws this instance using the + /// provided. /// /// - /// The to use for rendering. - /// - /// - /// The x- and y-coordinate location to render this at. - /// - /// - /// The color mask to apply when rendering this . + /// The to use for rendering. /// + /// The x- and y-coordinate location to render this at. + /// The color mask to apply when rendering this . /// - /// The amount of rotation, in radians, to apply when rendering this . + /// The amount of rotation, in radians, to apply when rendering this . /// /// - /// The x- and y-coordinate point of origin to apply when rendering this . - /// - /// - /// The amount of scaling to apply when rendering this . + /// The x- and y-coordinate point of origin to apply when rendering this . /// + /// The amount of scaling to apply when rendering this . /// - /// The to apply for horizontal and vertical axis - /// flipping when rendering this . - /// - /// - /// The layer depth to apply when rendering this . + /// The to apply for horizontal and vertical axis + /// flipping when rendering this . /// + /// The layer depth to apply when rendering this . public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth) => spriteBatch.Draw(this, position, color, rotation, origin, scale, effects, layerDepth); /// - /// Draws this using the - /// provided. + /// Draws this instance using the + /// provided. /// /// - /// The to use for rendering. - /// - /// - /// The x- and y-coordinate location to render this at. - /// - /// - /// The color mask to apply when rendering this . + /// The to use for rendering. /// + /// The x- and y-coordinate location to render this at. + /// The color mask to apply when rendering this . /// - /// The amount of rotation, in radians, to apply when rendering this . + /// The amount of rotation, in radians, to apply when rendering this . /// /// - /// The x- and y-coordinate point of origin to apply when rendering this . - /// - /// - /// The amount of scaling to apply when rendering this . + /// The x- and y-coordinate point of origin to apply when rendering this . /// + /// The amount of scaling to apply when rendering this . /// - /// The to apply for horizontal and vertical axis - /// flipping when rendering this . - /// - /// - /// The layer depth to apply when rendering this . + /// The to apply for horizontal and vertical axis + /// flipping when rendering this . /// + /// The layer depth to apply when rendering this . public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects effects, float layerDepth) => spriteBatch.Draw(this, position, color, rotation, origin, scale, effects, layerDepth); /// - /// Draws this using the - /// provided. + /// Draws this instance using the + /// provided. /// /// - /// The to use for rendering. + /// The to use for rendering. /// /// - /// A rectangular bound that defines the destination to render this into. - /// - /// - /// The color mask to apply when rendering this . + /// A rectangular bound that defines the destination to render this into. /// + /// The color mask to apply when rendering this . /// - /// The amount of rotation, in radians, to apply when rendering this . + /// The amount of rotation, in radians, to apply when rendering this . /// /// - /// The x- and y-coordinate point of origin to apply when rendering this . + /// The x- and y-coordinate point of origin to apply when rendering this . /// /// - /// The to apply for horizontal and vertical axis - /// flipping when rendering this . - /// - /// - /// The layer depth to apply when rendering this . + /// The to apply for horizontal and vertical axis + /// flipping when rendering this . /// + /// The layer depth to apply when rendering this . public void Draw(SpriteBatch spriteBatch, Rectangle destinationRectangle, Color color, float rotation, Vector2 origin, SpriteEffects effects, float layerDepth) => spriteBatch.Draw(this, destinationRectangle, color, rotation, origin, effects, layerDepth); diff --git a/source/MonoGame.Aseprite/Tile.cs b/source/MonoGame.Aseprite/Tile.cs index 464e381..f6b03c6 100644 --- a/source/MonoGame.Aseprite/Tile.cs +++ b/source/MonoGame.Aseprite/Tile.cs @@ -5,73 +5,73 @@ namespace MonoGame.Aseprite; /// -/// Defines a tile value in a . +/// Defines a tile value in a . /// public struct Tile { /// - /// Represents a with its properties left uninitialized. + /// Represents a with its properties left uninitialized. /// public static readonly Tile Empty; /// - /// The ID (or index) of the source tile in the that represents the - /// to render for this . + /// The ID (or index) of the source tile in the that represents the + /// to render for this . /// public int TilesetTileID = 0; /// - /// Indicates whether this should be flipped horizontally rendered. + /// Indicates whether this should be flipped horizontally rendered. /// public bool FlipHorizontally = false; /// - /// Indicates whether this should be flipped vertically rendered. + /// Indicates whether this should be flipped vertically rendered. /// public bool FlipVertically = false; /// - /// Indicates whether this should be flipped diagonally when rendered. + /// Indicates whether this should be flipped diagonally when rendered. /// public bool FlipDiagonally = false; /// - /// Gets a value that indicates if this is an empty . + /// Gets a value that indicates if this is an empty . /// /// - /// Empty tiles have a equal to zero. + /// Empty tiles have a equal to zero. /// public bool IsEmpty => TilesetTileID == 0; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// public Tile() { } /// - /// Initializes a new value. + /// Initializes a new value. /// /// - /// The ID (or index) of the source tile in the that represents the - /// to assign for this . + /// The ID (or index) of the source tile in the that represents the + /// to assign for this . /// public Tile(int tilesetTileID) => TilesetTileID = tilesetTileID; /// - /// Initializes a new value. + /// Initializes a new value. /// /// - /// The ID (or index) of the source tile in the that represents the - /// to assign for this . + /// The ID (or index) of the source tile in the that represents the + /// to assign for this . /// /// - /// Indicates whether the should be flipped horizontally when rendered. + /// Indicates whether the should be flipped horizontally when rendered. /// /// - /// Indicates whether the should be flipped vertically when rendered. + /// Indicates whether the should be flipped vertically when rendered. /// /// - /// Indicates whether the should be flipped diagonally when rendered. + /// Indicates whether the should be flipped diagonally when rendered. /// public Tile(int tilesetTileID, bool flipHorizontally, bool flipVertically, bool flipDiagonally) => (TilesetTileID, FlipHorizontally, FlipVertically, FlipDiagonally) = (tilesetTileID, flipHorizontally, flipVertically, flipDiagonally); diff --git a/source/MonoGame.Aseprite/Tilemap.cs b/source/MonoGame.Aseprite/Tilemap.cs index 672cbd8..c6d4743 100644 --- a/source/MonoGame.Aseprite/Tilemap.cs +++ b/source/MonoGame.Aseprite/Tilemap.cs @@ -11,7 +11,7 @@ namespace MonoGame.Aseprite; /// -/// Defines a with zero or more elements. +/// Defines a with zero or more elements. /// public sealed class Tilemap : IEnumerable { @@ -19,79 +19,67 @@ public sealed class Tilemap : IEnumerable private Dictionary _layerLookup = new(); /// - /// Gets the name assigned to this . + /// Gets the name assigned to this . /// public string Name { get; } /// - /// Gets the total number of elements in this . + /// Gets the total number of elements in this . /// public int LayerCount => _layers.Count; /// - /// Gets the element at the specified index in this . + /// Gets the element at the specified index in this . /// - /// - /// The index of the element to locate. - /// - /// - /// The element located. - /// + /// The index of the element to locate. + /// The element located. /// - /// Thrown if the specified index is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the specified index is less than zero or is greater than or equal to the total number of + /// elements in this . /// public TilemapLayer this[int layerIndex] => GetLayer(layerIndex); /// - /// Gets the element with the specified name in this . + /// Gets the element with the specified name in this . /// - /// - /// The name of the element to locate. - /// - /// - /// The element located. - /// + /// The name of the element to locate. + /// The element located. /// - /// Thrown if this does not contain a element with the - /// specified name. + /// Thrown if this does not contain a element with the + /// specified name. /// public TilemapLayer this[string layerName] => GetLayer(layerName); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The name to assign . - /// + /// The name to assign . public Tilemap(string name) => Name = name; /// - /// Creates a new element and adds it to this . + /// Creates a new element and adds it to this . /// /// - /// The name to give the element created by this method. The name must be unique - /// across all elements in this . + /// The name to give the element created by this method. The name must be unique + /// across all elements in this . /// /// - /// The source tileset to assign the element created by this method. + /// The source tileset to assign the element created by this method. /// /// - /// The total number of columns to assign the element created by this method. + /// The total number of columns to assign the element created by this method. /// /// - /// The total of rows to assign the element created by this method. + /// The total of rows to assign the element created by this method. /// /// - /// The x- and y-position offset, relative to the location the is rendered, to - /// assign the element created by this method. + /// The x- and y-position offset, relative to the location the is rendered, to + /// assign the element created by this method. /// - /// - /// The created by this method. - /// + /// The created by this method. /// - /// Thrown if this already contains a element with the - /// specified name. + /// Thrown if this already contains a element with the + /// specified name. /// public TilemapLayer CreateLayer(string layerName, Tileset tileset, int columns, int rows, Vector2 offset) { @@ -101,14 +89,12 @@ public TilemapLayer CreateLayer(string layerName, Tileset tileset, int columns, } /// - /// Adds the given element to this . + /// Adds the given element to this . /// - /// - /// The element to add. - /// + /// The element to add. /// - /// Thrown if this already contains a element with the same - /// name as the element given. + /// Thrown if this already contains a element with the same + /// name as the element given. /// public void AddLayer(TilemapLayer layer) { @@ -122,17 +108,13 @@ public void AddLayer(TilemapLayer layer) } /// - /// Get the element at the specified index in this . + /// Get the element at the specified index in this . /// - /// - /// The index of the element to locate. - /// - /// - /// The element located. - /// + /// The index of the element to locate. + /// The element located. /// - /// Thrown if the specified index is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the specified index is less than zero or is greater than or equal to the total number of + /// elements in this . /// public TilemapLayer GetLayer(int index) { @@ -145,17 +127,13 @@ public TilemapLayer GetLayer(int index) } /// - /// Gets the element with the specified name in this . + /// Gets the element with the specified name in this . /// - /// - /// The name of the element to locate. - /// - /// - /// The located. - /// + /// The name of the element to locate. + /// The located. /// - /// Thrown if this does not contain a element with the - /// specified name. + /// Thrown if this does not contain a element with the + /// specified name. /// public TilemapLayer GetLayer(string name) { @@ -168,20 +146,18 @@ public TilemapLayer GetLayer(string name) } /// - /// Get the element at the specified index in this . + /// Get the element at the specified index in this . /// - /// - /// The index of the element to locate. - /// + /// The index of the element to locate. /// - /// When this method returns , contains the element located; - /// otherwise, . + /// When this method returns , contains the element located; + /// otherwise, . /// /// - /// if a element was located at the specified index in this - /// ; otherwise, . This method return when - /// the specified index is less than zero or is greater than or equal to the total number of - /// elements in this . + /// if a element was located at the specified index in this + /// ; otherwise, . This method return when + /// the specified index is less than zero or is greater than or equal to the total number of + /// elements in this . /// public bool TryGetLayer(int index, [NotNullWhen(true)] out TilemapLayer? layer) { @@ -197,34 +173,32 @@ public bool TryGetLayer(int index, [NotNullWhen(true)] out TilemapLayer? layer) } /// - /// Gets the element with the specified name in this . + /// Gets the element with the specified name in this . /// - /// - /// The name of the element to locate. - /// + /// The name of the element to locate. /// - /// When this method returns , contains the element located; - /// otherwise, . + /// When this method returns , contains the element located; + /// otherwise, . /// /// - /// if a element was located in this - /// with the specified name; otherwise . This method returns if - /// this does not contain a element with the specified name. + /// if a element was located in this + /// with the specified name; otherwise . This method returns if + /// this does not contain a element with the specified name. /// public bool TryGetLayer(string name, [NotNullWhen(true)] out TilemapLayer? layer) => _layerLookup.TryGetValue(name, out layer); /// - /// Removes the element at the specified index in this . + /// Removes the element at the specified index in this . /// /// - /// The index of the element to remove from this . + /// The index of the element to remove from this . /// /// - /// if the element was successfully removed; otherwise, - /// . This method returns if the specified index is less than - /// zero or is greater than or equal to the total number of elements in this - /// . + /// if the element was successfully removed; otherwise, + /// . This method returns if the specified index is less than + /// zero or is greater than or equal to the total number of elements in this + /// . /// public bool RemoveLayer(int index) { @@ -238,15 +212,15 @@ public bool RemoveLayer(int index) } /// - /// Removes the element with the specified name from this . + /// Removes the element with the specified name from this . /// /// - /// The name of the element to remove from this + /// The name of the element to remove from this /// /// - /// if the element was successfully removed; otherwise, - /// . This method returns if this does not - /// contain a element with the specified name. + /// if the element was successfully removed; otherwise, + /// . This method returns if this does not + /// contain a element with the specified name. /// public bool RemoveLayer(string name) { @@ -259,21 +233,19 @@ public bool RemoveLayer(string name) } /// - /// Removes the given element from this . + /// Removes the given element from this . /// - /// - /// The element to remove from this . - /// + /// The element to remove from this . /// - /// if the element was removed successfully; otherwise, - /// . This method returns false if this does not contain the - /// element given. + /// if the element was removed successfully; otherwise, + /// . This method returns false if this does not contain the + /// element given. /// public bool RemoveLayer(TilemapLayer layer) => _layers.Remove(layer) && _layerLookup.Remove(layer.Name); /// - /// Removes all elements from this . + /// Removes all elements from this . /// public void Clear() { @@ -282,79 +254,45 @@ public void Clear() } /// - /// Draws this using the . + /// Draws this using the . /// /// /// The to use for rendering this . /// - /// - /// The x- and y-coordinate location to render this at. - /// - /// - /// The color mask to apply when rendering this . - /// + /// The x- and y-coordinate location to render this at. + /// The color mask to apply when rendering this . public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color) => Draw(spriteBatch, position, color, Vector2.One, 0.0f); /// - /// Draws this using the . + /// Draws this using the . /// /// /// The to use for rendering this . /// - /// - /// The x- and y-coordinate location to render this at. - /// - /// - /// The color mask to apply when rendering this . - /// - /// - /// The amount of scaling to apply when rendering this . - /// - /// - /// The layer depth to apply when rendering this . - /// + /// The x- and y-coordinate location to render this at. + /// The color mask to apply when rendering this . + /// The amount of scaling to apply when rendering this . + /// The layer depth to apply when rendering this . public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color, float scale, float layerDepth) => Draw(spriteBatch, position, color, new Vector2(scale, scale), layerDepth); /// - /// Draws a using this . + /// Draws this using the . /// /// /// The to use for rendering this . /// - /// - /// The x- and y-coordinate location to render this at. - /// - /// - /// The color mask to apply when rendering this . - /// - /// - /// The amount of scaling to apply when rendering this . - /// - /// - /// The layer depth to apply when rendering this . - /// + /// The x- and y-coordinate location to render this at. + /// The color mask to apply when rendering this . + /// The amount of scaling to apply when rendering this . + /// The layer depth to apply when rendering this . public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color, Vector2 scale, float layerDepth) => spriteBatch.Draw(this, position, color, scale, layerDepth); - /// - /// Returns an enumerator used to iterate through all of the elements in this - /// . The order of elements in the enumeration is from bottom layer to top layer. - /// - /// - /// An enumerator used to iterate through all of the elements in this - /// . - /// + /// public IEnumerator GetEnumerator() => _layers.GetEnumerator(); - /// - /// Returns an enumerator used to iterate through all of the elements in this - /// . The order of elements in the enumeration is from bottom layer to top layer. - /// - /// - /// An enumerator used to iterate through all of the elements in this - /// . - /// + /// IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); } diff --git a/source/MonoGame.Aseprite/TilemapLayer.cs b/source/MonoGame.Aseprite/TilemapLayer.cs index 4efde02..7c68693 100644 --- a/source/MonoGame.Aseprite/TilemapLayer.cs +++ b/source/MonoGame.Aseprite/TilemapLayer.cs @@ -9,7 +9,7 @@ namespace MonoGame.Aseprite; /// -/// Defines a grid-like layer in a tilemap that contains a collection of tiles. +/// Defines a grid-like layer in a tilemap that contains a collection of tiles. /// public sealed class TilemapLayer : IEnumerable { @@ -17,57 +17,57 @@ public sealed class TilemapLayer : IEnumerable private Vector2 _offset = Vector2.Zero; /// - /// Gets a read-only span of the elements in this . + /// Gets a read-only span of the elements in this . /// public ReadOnlySpan Tiles => _tiles; /// - /// Gets the name assigned to this . + /// Gets the name assigned to this . /// public string Name { get; } /// - /// Gets or Sets the source referenced by the elements in this - /// . + /// Gets or Sets the source referenced by the elements in this + /// . /// public Tileset Tileset { get; set; } /// - /// Gets the total number of columns in this . + /// Gets the total number of columns in this . /// public int Columns { get; } /// - /// Gets the total number of rows in this . + /// Gets the total number of rows in this . /// public int Rows { get; } /// - /// Gets the width, in pixels, of this . - /// Width = Tileset.TileWidth * Columns + /// Gets the width, in pixels, of this . + /// Width = Tileset.TileWidth * Columns /// public int Width => Tileset.TileWidth * Columns; /// - /// Gets the height, in pixels, of this . - /// Height = Tileset.TileHeight * Rows + /// Gets the height, in pixels, of this . + /// Height = Tileset.TileHeight * Rows /// public int Height => Tileset.TileHeight * Rows; /// - /// Gets or Sets the transparency of this . + /// Gets or Sets the transparency of this . /// public float Transparency { get; set; } = 1.0f; /// - /// Gets or Sets a value that indicates whether this is visible and should be - /// rendered. + /// Gets or Sets a value that indicates whether this is visible and should be + /// rendered. /// public bool IsVisible { get; set; } = true; /// - /// Gets or Sets the x- and y-coordinate position offset, relative to the position of the , - /// to render this at + /// Gets or Sets the x- and y-coordinate position offset, relative to the position of the , + /// to render this at /// public Vector2 Offset { @@ -76,8 +76,8 @@ public Vector2 Offset } /// - /// Gets or Sets the x-position offset, relative to the position of the , to render this - /// at + /// Gets or Sets the x-position offset, relative to the position of the , to render this + /// at /// public float OffsetX { @@ -86,8 +86,8 @@ public float OffsetX } /// - /// Gets or Sets the y-position offset, relative to the position of the , to render this - /// at + /// Gets or Sets the y-position offset, relative to the position of the , to render this + /// at /// public float OffsetY { @@ -96,78 +96,56 @@ public float OffsetY } /// - /// Gets the total number of elements in this . + /// Gets the total number of elements in this . /// public int TileCount => _tiles.Length; /// - /// Gets the element at the specified index in this + /// Gets the element at the specified index in this /// - /// - /// The index of the element to locate. - /// - /// - /// The element located. - /// + /// The index of the element to locate. + /// The element located. /// - /// Thrown if the index specified is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the index specified is less than zero or is greater than or equal to the total number of + /// elements in this . /// public Tile this[int tileIndex] => GetTile(tileIndex); /// - /// Gets the element located at the specified column and row in this - /// . + /// Gets the element located at the specified column and row in this + /// . /// - /// - /// The column of the element to locate. - /// - /// - /// The row of the element to locate. - /// - /// - /// The element located. - /// + /// The column of the element to locate. + /// The row of the element to locate. + /// The element located. /// - /// Thrown if either the column or rows specified is less than zero or if either is greater than or equal to the - /// total number of columns or rows in this . + /// Thrown if either the column or rows specified is less than zero or if either is greater than or equal to the + /// total number of columns or rows in this . /// public Tile this[int column, int row] => GetTile(column, row); /// - /// Gets the element located at the specified column and row location in this - /// . + /// Gets the element located at the specified column and row location in this + /// . /// - /// - /// The column and row location of the element to locate. - /// - /// - /// The element located. - /// + /// The column and row location of the element to locate. + /// The element located. /// - /// Thrown if either the column or rows specified in the location is less than zero or if either is greater - /// than or equal to the total number of columns or rows in this . + /// Thrown if either the column or rows specified in the location is less than zero or if either is greater + /// than or equal to the total number of columns or rows in this . /// public Tile this[Point location] => GetTile(location); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// The name assign the . - /// - /// - /// The source tileset used by the tiles in this . - /// - /// - /// The total number of columns to assign the . - /// - /// - /// The total number of rows to assign the . - /// + /// The name assign the . + /// The source tileset used by the tiles in this . + /// The total number of columns to assign the . + /// The total number of rows to assign the . /// - /// The x- and y-coordinate position offset, relative to the position of the to assign the - /// . + /// The x- and y-coordinate position offset, relative to the position of the to assign the + /// . /// public TilemapLayer(string name, Tileset tileset, int columns, int rows, Vector2 offset) { @@ -180,82 +158,72 @@ public TilemapLayer(string name, Tileset tileset, int columns, int rows, Vector2 } /// - /// Returns a value that indicates whether the element at the specified index in this - /// is empty. + /// Returns a value that indicates whether the element at the specified index in this + /// is empty. /// - /// - /// The index of the element to check. - /// + /// The index of the element to check. /// - /// if the element at the specified index is empty; otherwise, - /// . + /// if the element at the specified index is empty; otherwise, + /// . /// /// - /// Thrown if the index specified is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the index specified is less than zero or is greater than or equal to the total number of + /// elements in this . /// public bool IsEmpty(int index) => GetTile(index).IsEmpty; /// - /// Returns a value that indicates whether the element at the specified column and row in - /// this is empty. + /// Returns a value that indicates whether the element at the specified column and row in + /// this is empty. /// - /// - /// The column of the element to check. - /// - /// - /// The row of the element to check. - /// + /// The column of the element to check. + /// The row of the element to check. /// - /// if the element at the specified column and row in this - /// is empty; otherwise, . + /// if the element at the specified column and row in this + /// is empty; otherwise, . /// /// - /// Thrown if either the column or row specified is less than zero or if either is greater than or equal to the - /// total number of columns or rows in this . + /// Thrown if either the column or row specified is less than zero or if either is greater than or equal to the + /// total number of columns or rows in this . /// public bool IsEmpty(int column, int row) => GetTile(column, row).IsEmpty; /// - /// Returns a value that indicates whether the element at the specified column and row - /// location in this is empty. + /// Returns a value that indicates whether the element at the specified column and row + /// location in this is empty. /// - /// - /// The column and row location of the element to check. - /// + /// The column and row location of the element to check. /// - /// if the element at the specified column and row location in this - /// is empty; otherwise, . + /// if the element at the specified column and row location in this + /// is empty; otherwise, . /// /// - /// Thrown if either the column or row in the specified location is less than zero or if either is greater - /// than or equal to the total number of columns or rows in this . + /// Thrown if either the column or row in the specified location is less than zero or if either is greater + /// than or equal to the total number of columns or rows in this . /// public bool IsEmpty(Point location) => GetTile(location).IsEmpty; /// - /// Sets the element at the specified index in this using the - /// values provided. + /// Sets the element at the specified index in this using the + /// values provided. /// - /// - /// The index of the element in this to set. - /// + /// The index of the element in this to set. /// - /// The ID of the source tile in the that represents the to - /// render for the element being set. + /// The ID of the source tile in the that represents the to + /// render for the element being set. /// /// - /// Indicates whether the element being set should be flipped horizontally when rendered. + /// Indicates whether the element being set should be flipped horizontally when rendered. /// /// - /// Indicates if the element being set should be flipped vertically when rendered. + /// Indicates if the element being set should be flipped vertically when rendered. /// /// - /// Indicates if the element being set should be flipped diagonally when rendered. + /// Indicates if the element being set should be flipped diagonally when rendered. /// /// - /// Thrown if the index specified is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the index specified is less than zero or is greater than or equal to the total number of + /// elements in this . /// public void SetTile(int index, int tilesetTileID, bool flipHorizontally = false, bool flipVertically = false, bool flipDiagonally = false) { @@ -268,31 +236,31 @@ public void SetTile(int index, int tilesetTileID, bool flipHorizontally = false, } /// - /// Sets the element at the specified column and row in this - /// using the values provided. + /// Sets the element at the specified column and row in this + /// using the values provided. /// /// - /// The column in this to set the element at. + /// The column in this to set the element at. /// /// - /// The row in this to set the element at. + /// The row in this to set the element at. /// /// - /// The ID of the source tile in the that represents the to - /// render for the element being set. + /// The ID of the source tile in the that represents the to + /// render for the element being set. /// /// - /// Indicates whether the element being set should be flipped horizontally when rendered. + /// Indicates whether the element being set should be flipped horizontally when rendered. /// /// - /// Indicates if the element being set should be flipped vertically when rendered. + /// Indicates if the element being set should be flipped vertically when rendered. /// /// - /// Indicates if the element being set should be flipped diagonally when rendered. + /// Indicates if the element being set should be flipped diagonally when rendered. /// /// - /// Thrown if either the column or row specified is less than zero or are greater than or equal to the total - /// number of columns or rows in this . + /// Thrown if either the column or row specified is less than zero or are greater than or equal to the total + /// number of columns or rows in this . /// public void SetTile(int column, int row, int tilesetTileID, bool flipHorizontally = false, bool flipVertically = false, bool flipDiagonally = false) { @@ -305,28 +273,28 @@ public void SetTile(int column, int row, int tilesetTileID, bool flipHorizontall } /// - /// Sets the element at the specified column and row location in this - /// using the values provided. + /// Sets the element at the specified column and row location in this + /// using the values provided. /// /// - /// The column and row location in this to set the element at. + /// The column and row location in this to set the element at. /// /// - /// The ID of the source tile in the that represents the to - /// render for the element being set. + /// The ID of the source tile in the that represents the to + /// render for the element being set. /// /// - /// Indicates whether the element being set should be flipped horizontally when rendered. + /// Indicates whether the element being set should be flipped horizontally when rendered. /// /// - /// Indicates if the element being set should be flipped vertically when rendered. + /// Indicates if the element being set should be flipped vertically when rendered. /// /// - /// Indicates if the element being set should be flipped diagonally when rendered. + /// Indicates if the element being set should be flipped diagonally when rendered. /// /// - /// Thrown if either the column or row in the specified location is less than zero or are greater than or equal - /// to the total number of columns or rows in this . + /// Thrown if either the column or row in the specified location is less than zero or are greater than or equal + /// to the total number of columns or rows in this . /// public void SetTile(Point location, int tilesetTileID, bool flipHorizontally = false, bool flipVertically = false, bool flipDiagonally = false) { @@ -339,17 +307,13 @@ public void SetTile(Point location, int tilesetTileID, bool flipHorizontally = f } /// - /// Sets the specified index in this to the element given. + /// Sets the specified index in this to the element given. /// - /// - /// The index in this to set. - /// - /// - /// The element to set at the index. - /// + /// The index in this to set. + /// The element to set at the index. /// - /// Thrown if the index specified is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the index specified is less than zero or is greater than or equal to the total number of + /// elements in this . /// public void SetTile(int index, Tile tile) { @@ -358,21 +322,15 @@ public void SetTile(int index, Tile tile) } /// - /// Sets the specified column and row in this to the element - /// given. + /// Sets the specified column and row in this to the element + /// given. /// - /// - /// The column in this to set. - /// - /// - /// The row in this to set. - /// - /// - /// The element to set at the column and row. - /// + /// The column in this to set. + /// The row in this to set. + /// The element to set at the column and row. /// - /// Thrown if either the column or row specified are less than zero or are greater than or equal to the total - /// number of columns or rows in this . + /// Thrown if either the column or row specified are less than zero or are greater than or equal to the total + /// number of columns or rows in this . /// public void SetTile(int column, int row, Tile tile) { @@ -383,18 +341,14 @@ public void SetTile(int column, int row, Tile tile) } /// - /// Sets the specified column and row location in this to the - /// element given. + /// Sets the specified column and row location in this to the + /// element given. /// - /// - /// The column and row location in this to set. - /// - /// - /// The element to set at the column and row location. - /// + /// The column and row location in this to set. + /// The element to set at the column and row location. /// - /// Thrown if either the column or row in the specified location are less than zero or are greater than or equal - /// to the total number of columns or rows in this . + /// Thrown if either the column or row in the specified location are less than zero or are greater than or equal + /// to the total number of columns or rows in this . /// public void SetTile(Point location, Tile tile) { @@ -404,17 +358,13 @@ public void SetTile(Point location, Tile tile) } /// - /// Gets the element located at the specified index in this . + /// Gets the element located at the specified index in this . /// - /// - /// The index of the element in this to locate. - /// - /// - /// The element located - /// + /// The index of the element in this to locate. + /// The element located /// - /// Thrown if the index specified is less than zero or is greater than or equal to the total number of - /// elements in this . + /// Thrown if the index specified is less than zero or is greater than or equal to the total number of + /// elements in this . /// public Tile GetTile(int index) { @@ -423,21 +373,15 @@ public Tile GetTile(int index) } /// - /// Gets the element located at the specified column and row in this - /// . + /// Gets the element located at the specified column and row in this + /// . /// - /// - /// The column of the element to locate. - /// - /// - /// The row of the element to locate. - /// - /// - /// The element located. - /// + /// The column of the element to locate. + /// The row of the element to locate. + /// The element located. /// - /// Thrown if either the column or rows specified are less than zero or are greater than or equal to the total - /// number of columns or rows in this . + /// Thrown if either the column or rows specified are less than zero or are greater than or equal to the total + /// number of columns or rows in this . /// public Tile GetTile(int column, int row) { @@ -448,18 +392,14 @@ public Tile GetTile(int column, int row) } /// - /// Gets the element located at the specified column and row location in this - /// . + /// Gets the element located at the specified column and row location in this + /// . /// - /// - /// The column and row location of the element to locate. - /// - /// - /// The element located. - /// + /// The column and row location of the element to locate. + /// The element located. /// - /// Thrown if either the column or rows in the specified location are less than zero or are greater than or - /// equal to the total number of columns or rows in this . + /// Thrown if either the column or rows in the specified location are less than zero or are greater than or + /// equal to the total number of columns or rows in this . /// public Tile GetTile(Point location) { @@ -470,8 +410,7 @@ public Tile GetTile(Point location) /// - /// Clears all elements in this by resetting them to an empty - /// value. + /// Clears all elements in this by resetting them to an empty value. /// public void Clear() { @@ -479,79 +418,53 @@ public void Clear() } /// - /// Draws this layer using the - /// . + /// Draws this layer using the . /// /// - /// The to use for rendering this - /// . + /// The to use for rendering this . /// /// - /// The x- and y-coordinate location to draw this at. Drawing this - /// using this method ignores the . - /// - /// - /// The color mask to apply when rendering this . + /// The x- and y-coordinate location to draw this at. Drawing this + /// using this method ignores the . /// + /// The color mask to apply when rendering this . public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color) => Draw(spriteBatch, position, color, Vector2.One, 0.0f); /// - /// Draws this layer using the - /// . + /// Draws this layer using the . /// /// - /// The to use for rendering this - /// . + /// The to use for rendering this . /// /// - /// The x- and y-coordinate location to draw this at. Drawing this - /// using this method ignores the . - /// - /// - /// The color mask to apply when rendering this . - /// - /// - /// The amount of scaling to apply when rendering this . - /// - /// - /// The layer depth to apply when rendering this . + /// The x- and y-coordinate location to draw this at. Drawing this + /// using this method ignores the . /// + /// The color mask to apply when rendering this . + /// The amount of scaling to apply when rendering this . + /// The layer depth to apply when rendering this . public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color, float scale, float layerDepth) => Draw(spriteBatch, position, color, new Vector2(scale, scale), layerDepth); /// - /// Draws this layer using the - /// . + /// Draws this layer using the . /// /// - /// The to use for rendering this - /// . + /// The to use for rendering this . /// /// - /// The x- and y-coordinate location to draw this at. Drawing this - /// using this method ignores the . - /// - /// - /// The color mask to apply when rendering this . - /// - /// - /// The amount of scaling to apply when rendering this . - /// - /// - /// The layer depth to apply when rendering this . + /// The x- and y-coordinate location to draw this at. Drawing this + /// using this method ignores the . /// + /// The color mask to apply when rendering this . + /// The amount of scaling to apply when rendering this . + /// The layer depth to apply when rendering this . public void Draw(SpriteBatch spriteBatch, Vector2 position, Color color, Vector2 scale, float layerDepth) => spriteBatch.Draw(this, position, color, scale, layerDepth); - /// - /// Returns an enumerator that iterates through all elements in this - /// . The order tiles in the enumeration is from top-to-bottom, read left-to-right. - /// - /// - /// An enumerator that iterates through all elements in this . - /// + /// public IEnumerator GetEnumerator() { for (int i = 0; i < _tiles.Length; i++) @@ -560,13 +473,7 @@ public IEnumerator GetEnumerator() } } - /// - /// Returns an enumerator that iterates through all elements in this - /// . The order tiles in the enumeration is from top-to-bottom, read left-to-right. - /// - /// - /// An enumerator that iterates through all elements in this . - /// + /// IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); private int ToIndex(int column, int row) => row * Columns + column; diff --git a/source/MonoGame.Aseprite/Tileset.cs b/source/MonoGame.Aseprite/Tileset.cs index 6d6916e..1f8872b 100644 --- a/source/MonoGame.Aseprite/Tileset.cs +++ b/source/MonoGame.Aseprite/Tileset.cs @@ -10,139 +10,117 @@ namespace MonoGame.Aseprite; /// -/// Defines a with a source image and named elements that -/// represent the tiles. +/// Defines a with a source image and named elements that +/// represent the tiles. /// /// -/// A is similar in function to a in that it uses a single -/// source image and has named for sections within that image. The difference is that -/// a auto generates the elements into a grid like structure and -/// the accessor for each is by location id or column and row only. +/// A is similar in function to a in that it uses a single +/// source image and has named for sections within that image. The difference is that +/// a auto generates the elements into a grid like structure and +/// the accessor for each is by location id or column and row only. /// public sealed class Tileset { private TextureRegion[] _regions; /// - /// Gets the name assigned to this . + /// Gets the name assigned to this . /// public string Name { get; } /// - /// Gets the source texture image used by this . + /// Gets the source texture image used by this . /// public Texture2D Texture { get; } /// - /// Gets the width, in pixels, of each tile in this . + /// Gets the width, in pixels, of each tile in this . /// public int TileWidth { get; } /// - /// Gets the height, in pixels of each tile in this . + /// Gets the height, in pixels of each tile in this . /// public int TileHeight { get; } /// - /// Gets the total number of rows in this . + /// Gets the total number of rows in this . /// public int RowCount { get; } /// - /// Gets the total number of columns in this . + /// Gets the total number of columns in this . /// public int ColumnCount { get; } /// - /// G ets the total number of tiles in this . + /// Gets the total number of tiles in this . /// public int TileCount { get; } /// - /// Gets a read-only span of the elements that represent the tiles in this - /// . + /// Gets a read-only span of the elements that represent the tiles in this + /// . /// public ReadOnlySpan Tiles => _regions; /// - /// Gets the of the tile at the specified index in this . + /// Gets the of the tile at the specified index in this . /// - /// - /// The index of the tile to locate. - /// - /// - /// The for the tile located. - /// + /// The index of the tile to locate. + /// The for the tile located. /// - /// Thrown if the specified index is less than zero or is greater than or equal to the total number of tiles in - /// this . + /// Thrown if the specified index is less than zero or is greater than or equal to the total number of tiles in + /// this . /// public TextureRegion this[int index] => GetTile(index); /// - /// Gets the for the tile at the specified column and row in this - /// . + /// Gets the for the tile at the specified column and row in this + /// . /// - /// - /// The column of the tile to locate in this . - /// - /// - /// The row of the tile to locate in this . - /// - /// - /// The for the tile located. - /// + /// The column of the tile to locate in this . + /// The row of the tile to locate in this . + /// The for the tile located. /// - /// Thrown if either the column or row specified are less than zero or if either are greater than or equal to - /// the total number of columns or rows in this . + /// Thrown if either the column or row specified are less than zero or if either are greater than or equal to + /// the total number of columns or rows in this . /// public TextureRegion this[int column, int row] => GetTile(column, row); /// - /// Gets the for the tile at the specified column and row location in this - /// . + /// Gets the for the tile at the specified column and row location in this + /// . /// - /// - /// The column and row location of the tile to locate in this . - /// - /// - /// The for the tile located. - /// + /// The column and row location of the tile to locate in this . + /// The for the tile located. /// - /// Thrown if either the column or row in the location specified are less than zero or if either are greater - /// than or equal to the total number of columns or rows in this . + /// Thrown if either the column or row in the location specified are less than zero or if either are greater + /// than or equal to the total number of columns or rows in this . /// public TextureRegion this[Point location] => GetTile(location); /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// The elements for each tile in this are auto-generated - /// based on the and specified. Both of these values - /// must be greater than zero and the width of the must divide evenly by - /// the and the height of the must divide evenly by the - /// + /// The elements for each tile in this are auto-generated + /// based on the and specified. Both of these values + /// must be greater than zero and the width of the must divide evenly by + /// the and the height of the must divide evenly by the + /// /// - /// - /// The name to assign the . - /// - /// - /// The source texture used by this . - /// - /// - /// The width, in pixels, of each tile in this . - /// - /// - /// The height, in pixels, of each tile in this . - /// + /// The name to assign the . + /// The source texture used by this . + /// The width, in pixels, of each tile in this . + /// The height, in pixels, of each tile in this . /// - /// Thrown if the or values are less than one. + /// Thrown if the or values are less than one. /// /// - /// Thrown if the width of the does not divide evenly by the - /// specified or if the height of the does not divide - /// evenly by the specified. + /// Thrown if the width of the does not divide evenly by the + /// specified or if the height of the does not divide + /// evenly by the specified. /// public Tileset(string name, Texture2D texture, int tileWidth, int tileHeight) { @@ -192,17 +170,13 @@ private void CreateTextureRegions() } /// - /// Gets the of the tile at the specified index in this . + /// Gets the of the tile at the specified index in this . /// - /// - /// The index of the tile to locate. - /// - /// - /// The for the tile located. - /// + /// The index of the tile to locate. + /// The for the tile located. /// - /// Thrown if the specified index is less than zero or is greater than or equal to the total number of tiles in - /// this . + /// Thrown if the specified index is less than zero or is greater than or equal to the total number of tiles in + /// this . /// public TextureRegion GetTile(int index) { @@ -215,37 +189,27 @@ public TextureRegion GetTile(int index) } /// - /// Gets the for the tile at the specified column and row in this - /// . + /// Gets the for the tile at the specified column and row in this + /// . /// - /// - /// The column and row location of the tile to locate in this . - /// - /// - /// The for the tile located. - /// + /// The column and row location of the tile to locate in this . + /// The for the tile located. /// - /// Thrown if either the column or row in the specified location are less than zero or if either are greater - /// than or equal to the total number of columns or rows respectively. + /// Thrown if either the column or row in the specified location are less than zero or if either are greater + /// than or equal to the total number of columns or rows respectively. /// public TextureRegion GetTile(Point location) => GetTile(location.X, location.Y); /// - /// Gets the for the tile at the specified column and row in this - /// . + /// Gets the for the tile at the specified column and row in this + /// . /// - /// - /// The column of the tile to locate in this . - /// - /// - /// The row of the tile to locate in this . - /// - /// - /// The for the tile located. - /// + /// The column of the tile to locate in this . + /// The row of the tile to locate in this . + /// The for the tile located. /// - /// Thrown if either the column or row specified are less than zero or if either are greater than or equal to - /// the total number of columns or rows in this . + /// Thrown if either the column or row specified are less than zero or if either are greater than or equal to + /// the total number of columns or rows in this . /// public TextureRegion GetTile(int column, int row) { @@ -254,20 +218,18 @@ public TextureRegion GetTile(int column, int row) } /// - /// Gets the of the tile at the specified index in this - /// . + /// Gets the of the tile at the specified index in this + /// . /// - /// - /// The index of the tile to locate. - /// + /// The index of the tile to locate. /// - /// When this method returns , contains the of the tile - /// located; otherwise, . + /// When this method returns , contains the of the tile + /// located; otherwise, . /// /// - /// if a tile was located at the specified index; otherwise, . - /// This method returns if the specified index is less than zero or is greater than or - /// equal to the total number of tiles in this . + /// if a tile was located at the specified index; otherwise, . + /// This method returns if the specified index is less than zero or is greater than or + /// equal to the total number of tiles in this . /// public bool TryGetTile(int index, [NotNullWhen(true)] out TextureRegion? tile) { @@ -283,44 +245,38 @@ public bool TryGetTile(int index, [NotNullWhen(true)] out TextureRegion? tile) } /// - /// Gets the for the tile at the specified column and row in this - /// . + /// Gets the for the tile at the specified column and row in this + /// . /// - /// - /// The column and row location of the tile to locate in this . - /// + /// The column and row location of the tile to locate in this . /// - /// When this method returns , contains the of the tile - /// located; otherwise, . + /// When this method returns , contains the of the tile + /// located; otherwise, . /// /// - /// if a tile was located at the specified column and row location; otherwise - /// . This method return if the column or row in the location - /// specified is less than zero or if either are greater than or equal to the total number of columns or rows - /// in this . + /// if a tile was located at the specified column and row location; otherwise + /// . This method return if the column or row in the location + /// specified is less than zero or if either are greater than or equal to the total number of columns or rows + /// in this . /// public bool TryGetTile(Point location, [NotNullWhen(true)] out TextureRegion? tile) => TryGetTile(location.X, location.Y, out tile); /// - /// Gets the for the tile at the specified column and row in this - /// . + /// Gets the for the tile at the specified column and row in this + /// . /// - /// - /// The column of the tile to locate in this . - /// - /// - /// The row of the tile to locate in this . - /// + /// The column of the tile to locate in this . + /// The row of the tile to locate in this . /// - /// When this method returns , contains the of the tile - /// located; otherwise, . + /// When this method returns , contains the of the tile + /// located; otherwise, . /// /// - /// if a tile was located at the specified column and row; otherwise - /// . This method return if the column or row in the location - /// specified is less than zero or if either are greater than or equal to the total number of columns or rows - /// in this . + /// if a tile was located at the specified column and row; otherwise + /// . This method return if the column or row in the location + /// specified is less than zero or if either are greater than or equal to the total number of columns or rows + /// in this . /// public bool TryGetTile(int column, int row, [NotNullWhen(true)] out TextureRegion? tile) {