From 290197f0aba2cadc0ae8f2cf9522765b960493c0 Mon Sep 17 00:00:00 2001
From: Christopher Whitley <103014489+AristurtleDev@users.noreply.github.com>
Date: Fri, 27 Sep 2024 00:50:50 -0400
Subject: [PATCH 1/3] Update for AsepriteDotNet 1.9.0
---
.../MonoGame.Aseprite.Content.Pipeline.csproj | 2 +-
.../AsepriteFileExtensions.cs | 363 +++++++++++++++++-
.../MonoGame.Aseprite.csproj | 2 +-
3 files changed, 357 insertions(+), 10 deletions(-)
diff --git a/source/MonoGame.Aseprite.Content.Pipeline/MonoGame.Aseprite.Content.Pipeline.csproj b/source/MonoGame.Aseprite.Content.Pipeline/MonoGame.Aseprite.Content.Pipeline.csproj
index 290be10..efa458c 100644
--- a/source/MonoGame.Aseprite.Content.Pipeline/MonoGame.Aseprite.Content.Pipeline.csproj
+++ b/source/MonoGame.Aseprite.Content.Pipeline/MonoGame.Aseprite.Content.Pipeline.csproj
@@ -23,8 +23,8 @@
+
-
\ No newline at end of file
diff --git a/source/MonoGame.Aseprite/AsepriteFileExtensions.cs b/source/MonoGame.Aseprite/AsepriteFileExtensions.cs
index 068a99e..e6727ce 100644
--- a/source/MonoGame.Aseprite/AsepriteFileExtensions.cs
+++ b/source/MonoGame.Aseprite/AsepriteFileExtensions.cs
@@ -3,6 +3,7 @@
// See LICENSE file in the project root for full license information.
using AsepriteDotNet.Aseprite;
+using AsepriteDotNet.Aseprite.Types;
using AsepriteDotNet.Processors;
using Microsoft.Xna.Framework.Graphics;
using MonoGame.Aseprite.Utils;
@@ -48,13 +49,86 @@ public static class AsepriteFileExtensions
/// Thrown if is less than zero or greater than or equal to the total number of
/// frames in the aseprite file.
///
+#pragma warning disable CS0618
+ [Obsolete("This method will be removed in a future release. Users should switch to the other CreateSprite methods instead", false)]
public static Sprite CreateSprite(this AsepriteFile aseFile, GraphicsDevice device, int frameIndex, ProcessorOptions? options = null)
{
ArgumentNullException.ThrowIfNull(aseFile);
ArgumentNullException.ThrowIfNull(device);
options ??= ProcessorOptions.Default;
- AseSprite aseSprite = SpriteProcessor.Process(aseFile, frameIndex, options);
+ return CreateSprite(aseFile, device, frameIndex, options.OnlyVisibleLayers, options.IncludeBackgroundLayer, options.IncludeTilemapLayers);
+ }
+#pragma warning restore CS0618
+
+ ///
+ /// Creates a new from the specified frame index of the provided aseprite file instance.
+ ///
+ /// The aseprite file instance.
+ /// The graphics device used to create graphical resources.
+ /// The index of the frame in the aseprite file to create the sprite from.
+ /// Indicates whether only visible layers should be processed.
+ /// Indicates whether the layer assigned as the background layer should be processed.
+ /// Indicates whether tilemap layers should be processed.
+ /// The created by this method.
+ ///
+ /// Thrown if the parameter is .
+ ///
+ /// -or-
+ ///
+ /// Thrown if the parameter is .
+ ///
+ ///
+ /// Thrown if is less than zero or greater than or equal to the total number of
+ /// frames in the aseprite file.
+ ///
+ public static Sprite CreateSprite(this AsepriteFile aseFile, GraphicsDevice device, int frameIndex, bool onlyVisibleLayers = true, bool includeBackgroundLayer = false, bool includeTilemapLayers = false)
+ {
+ ArgumentNullException.ThrowIfNull(aseFile);
+ ArgumentNullException.ThrowIfNull(device);
+
+
+ List layers = new List();
+ for (int i = 0; i < aseFile.Layers.Length; i++)
+ {
+ AsepriteLayer layer = aseFile.Layers[i];
+ if (onlyVisibleLayers && !layer.IsVisible) { continue; }
+ if (!includeBackgroundLayer && layer.IsBackgroundLayer) { continue; }
+ if (!includeTilemapLayers && layer is AsepriteTilemapLayer) { continue; }
+ layers.Add(layer.Name);
+ }
+
+ return CreateSprite(aseFile, device, frameIndex, layers);
+ }
+
+ ///
+ /// Creates a new from the specified frame index of the provided aseprite file instance.
+ ///
+ /// The aseprite file instance.
+ /// The graphics device used to create graphical resources.
+ /// The index of the frame in the aseprite file to create the sprite from.
+ ///
+ /// A collection containing the name of the layers to process. Only cels on a layer who's name matches a name in
+ /// this collection will be processed.
+ ///
+ /// The created by this method.
+ ///
+ /// Thrown if the parameter is .
+ ///
+ /// -or-
+ ///
+ /// Thrown if the parameter is .
+ ///
+ ///
+ /// Thrown if is less than zero or greater than or equal to the total number of
+ /// frames in the aseprite file.
+ ///
+ public static Sprite CreateSprite(this AsepriteFile aseFile, GraphicsDevice device, int frameIndex, ICollection layers)
+ {
+ ArgumentNullException.ThrowIfNull(aseFile);
+ ArgumentNullException.ThrowIfNull(device);
+
+ AseSprite aseSprite = SpriteProcessor.Process(aseFile, frameIndex, layers);
Texture2D texture = aseSprite.Texture.ToTexture2D(device);
TextureRegion region = new TextureRegion(texture.Name, texture, texture.Bounds);
@@ -80,13 +154,91 @@ public static Sprite CreateSprite(this AsepriteFile aseFile, GraphicsDevice devi
///
/// Thrown if the parameter is .
///
+#pragma warning disable CS0618
+ [Obsolete("This method will be removed in a future release. Users should switch to the other CreateTextureAtlas methods instead", false)]
public static TextureAtlas CreateTextureAtlas(this AsepriteFile aseFile, GraphicsDevice device, ProcessorOptions? options = null)
{
ArgumentNullException.ThrowIfNull(aseFile);
ArgumentNullException.ThrowIfNull(device);
options ??= ProcessorOptions.Default;
- AseTextureAtlas aseAtlas = TextureAtlasProcessor.Process(aseFile, options);
+ return CreateTextureAtlas(aseFile, device, options.OnlyVisibleLayers, options.IncludeBackgroundLayer, options.IncludeTilemapLayers, options.MergeDuplicateFrames, options.BorderPadding, options.Spacing, options.InnerPadding);
+ }
+#pragma warning restore CS0618
+
+ ///
+ /// Creates a new from the provided aseprite file.
+ ///
+ /// The aseprite file instance.
+ /// The graphics device used to create graphical resources.
+ /// Indicates whether only visible layers should be processed.
+ /// Indicates whether the layer assigned as the background layer should be processed.
+ /// Indicates whether tilemap layers should be processed.
+ /// Indicates whether duplicates frames should be merged.
+ /// The amount of transparent pixels to add to the edge of the generated texture.
+ /// The amount of transparent pixels to add between each texture region in the generated texture.
+ /// The amount of transparent pixels to add around the edge of each texture region in the generated texture.
+ /// The created by this method.
+ ///
+ /// Thrown if the parameter is .
+ ///
+ /// -or-
+ ///
+ /// Thrown if the parameter is .
+ ///
+ public static TextureAtlas CreateTextureAtlas(this AsepriteFile aseFile,
+ GraphicsDevice device,
+ bool onlyVisibleLayers = true,
+ bool includeBackgroundLayer = false,
+ bool includeTilemapLayers = false,
+ bool mergeDuplicateFrames = true,
+ int borderPadding = 0,
+ int spacing = 0,
+ int innerPadding = 0)
+ {
+ ArgumentNullException.ThrowIfNull(aseFile);
+ ArgumentNullException.ThrowIfNull(device);
+
+ List layers = new List();
+ for (int i = 0; i < aseFile.Layers.Length; i++)
+ {
+ AsepriteLayer layer = aseFile.Layers[i];
+ if (onlyVisibleLayers && !layer.IsVisible) { continue; }
+ if (!includeBackgroundLayer && layer.IsBackgroundLayer) { continue; }
+ if (!includeTilemapLayers && layer is AsepriteTilemapLayer) { continue; }
+ layers.Add(layer.Name);
+ }
+
+ return CreateTextureAtlas(aseFile, device, layers, mergeDuplicateFrames, borderPadding, spacing, innerPadding);
+ }
+
+ ///
+ /// Creates a new from the provided aseprite file.
+ ///
+ /// The aseprite file instance.
+ /// The graphics device used to create graphical resources.
+ ///
+ /// A collection containing the name of the layers to process. Only cels on a layer who's name matches a name in
+ /// this collection will be processed.
+ ///
+ /// Indicates whether duplicates frames should be merged.
+ /// The amount of transparent pixels to add to the edge of the generated texture.
+ /// The amount of transparent pixels to add between each texture region in the generated texture.
+ /// The amount of transparent pixels to add around the edge of each texture region in the generated texture.
+ /// The created by this method.
+ ///
+ /// Thrown if the parameter is .
+ ///
+ /// -or-
+ ///
+ /// Thrown if the parameter is .
+ ///
+ public static TextureAtlas CreateTextureAtlas(this AsepriteFile aseFile, GraphicsDevice device, ICollection layers, bool mergeDuplicateFrames = true, int borderPadding = 0, int spacing = 0, int innerPadding = 0)
+ {
+ ArgumentNullException.ThrowIfNull(aseFile);
+ ArgumentNullException.ThrowIfNull(device);
+
+ AseTextureAtlas aseAtlas = TextureAtlasProcessor.Process(aseFile, layers, mergeDuplicateFrames, borderPadding, spacing, innerPadding);
Texture2D texture = aseAtlas.Texture.ToTexture2D(device);
TextureAtlas atlas = new TextureAtlas(texture.Name, texture);
GenerateRegions(atlas, aseAtlas);
@@ -107,13 +259,91 @@ public static TextureAtlas CreateTextureAtlas(this AsepriteFile aseFile, Graphic
///
/// Thrown if the parameter is .
///
+#pragma warning disable CS0618
+ [Obsolete("This method will be removed in a future release. Users should switch to the other CreateSpriteSheet methods instead", false)]
public static SpriteSheet CreateSpriteSheet(this AsepriteFile aseFile, GraphicsDevice device, ProcessorOptions? options = null)
{
ArgumentNullException.ThrowIfNull(aseFile);
ArgumentNullException.ThrowIfNull(device);
options ??= ProcessorOptions.Default;
- AseSpriteSheet aseSheet = SpriteSheetProcessor.Process(aseFile, options);
+ return CreateSpriteSheet(aseFile, device, options.OnlyVisibleLayers, options.IncludeBackgroundLayer, options.IncludeTilemapLayers, options.MergeDuplicateFrames, options.BorderPadding, options.Spacing, options.InnerPadding);
+ }
+#pragma warning restore CS0618
+
+ ///
+ /// Creates a new from the provided aseprite file.
+ ///
+ /// The aseprite file instance.
+ /// The graphics device used to create graphical resources.
+ /// Indicates whether only visible layers should be processed.
+ /// Indicates whether the layer assigned as the background layer should be processed.
+ /// Indicates whether tilemap layers should be processed.
+ /// Indicates whether duplicates frames should be merged.
+ /// The amount of transparent pixels to add to the edge of the generated texture.
+ /// The amount of transparent pixels to add between each texture region in the generated texture.
+ /// The amount of transparent pixels to add around the edge of each texture region in the generated texture.
+ /// The created by this method.
+ ///
+ /// Thrown if the parameter is .
+ ///
+ /// -or-
+ ///
+ /// Thrown if the parameter is .
+ ///
+ public static SpriteSheet CreateSpriteSheet(this AsepriteFile aseFile,
+ GraphicsDevice device,
+ bool onlyVisibleLayers = true,
+ bool includeBackgroundLayer = false,
+ bool includeTilemapLayers = false,
+ bool mergeDuplicateFrames = true,
+ int borderPadding = 0,
+ int spacing = 0,
+ int innerPadding = 0)
+ {
+ ArgumentNullException.ThrowIfNull(aseFile);
+ ArgumentNullException.ThrowIfNull(device);
+
+ List layers = new List();
+ for (int i = 0; i < aseFile.Layers.Length; i++)
+ {
+ AsepriteLayer layer = aseFile.Layers[i];
+ if (onlyVisibleLayers && !layer.IsVisible) { continue; }
+ if (!includeBackgroundLayer && layer.IsBackgroundLayer) { continue; }
+ if (!includeTilemapLayers && layer is AsepriteTilemapLayer) { continue; }
+ layers.Add(layer.Name);
+ }
+
+ return CreateSpriteSheet(aseFile, device, layers, mergeDuplicateFrames, borderPadding, spacing, innerPadding);
+ }
+
+ ///
+ /// Creates a new from the provided aseprite file.
+ ///
+ /// The aseprite file instance.
+ /// The graphics device used to create graphical resources.
+ ///
+ /// A collection containing the name of the layers to process. Only cels on a layer who's name matches a name in
+ /// this collection will be processed.
+ ///
+ /// Indicates whether duplicates frames should be merged.
+ /// The amount of transparent pixels to add to the edge of the generated texture.
+ /// The amount of transparent pixels to add between each texture region in the generated texture.
+ /// The amount of transparent pixels to add around the edge of each texture region in the generated texture.
+ /// The created by this method.
+ ///
+ /// Thrown if the parameter is .
+ ///
+ /// -or-
+ ///
+ /// Thrown if the parameter is .
+ ///
+ public static SpriteSheet CreateSpriteSheet(this AsepriteFile aseFile, GraphicsDevice device, ICollection layers, bool mergeDuplicateFrames = true, int borderPadding = 0, int spacing = 0, int innerPadding = 0)
+ {
+ ArgumentNullException.ThrowIfNull(aseFile);
+ ArgumentNullException.ThrowIfNull(device);
+
+ AseSpriteSheet aseSheet = SpriteSheetProcessor.Process(aseFile, layers, mergeDuplicateFrames, borderPadding, spacing, innerPadding);
Texture2D texture = aseSheet.TextureAtlas.Texture.ToTexture2D(device);
TextureAtlas atlas = new TextureAtlas(texture.Name, texture);
GenerateRegions(atlas, aseSheet.TextureAtlas);
@@ -135,8 +365,6 @@ public static SpriteSheet CreateSpriteSheet(this AsepriteFile aseFile, GraphicsD
}
});
}
-
-
return sheet;
}
@@ -234,13 +462,74 @@ public static Tileset CreateTileset(this AseTileset aseTileset, GraphicsDevice d
///
/// throw if is .
///
+#pragma warning disable CS0618
+ [Obsolete("This method will be removed in a future release. Users should switch to the other CreateTilemap methods instead", false)]
public static Tilemap CreateTilemap(this AsepriteFile aseFile, GraphicsDevice device, int frameIndex, ProcessorOptions? options = null)
{
ArgumentNullException.ThrowIfNull(aseFile);
ArgumentNullException.ThrowIfNull(device);
options ??= ProcessorOptions.Default;
- AseTilemap aseTilemap = TilemapProcessor.Process(aseFile, frameIndex, options);
+ return CreateTilemap(aseFile, device, frameIndex, options.OnlyVisibleLayers);
+ }
+#pragma warning restore CS0618
+
+ ///
+ /// Creates a new from a specified frame in the provided aseprite file.
+ ///
+ /// The aseprite file instance.
+ /// The graphics device used to create graphical resources.
+ /// The index of the frame with the tilemap.
+ /// Indicates whether only visible layers should be processed.
+ /// The created by this method.
+ ///
+ /// Thrown if is .
+ ///
+ /// -or-
+ ///
+ /// throw if is .
+ ///
+ public static Tilemap CreateTilemap(this AsepriteFile aseFile, GraphicsDevice device, int frameIndex, bool onlyVisibleLayers = true)
+ {
+ ArgumentNullException.ThrowIfNull(aseFile);
+ ArgumentNullException.ThrowIfNull(device);
+
+ List layers = new List();
+ for (int i = 0; i < aseFile.Layers.Length; i++)
+ {
+ AsepriteLayer layer = aseFile.Layers[i];
+ if (layer is not AsepriteTilemapLayer) { continue; }
+ if (onlyVisibleLayers && !layer.IsVisible) { continue; }
+ layers.Add(layer.Name);
+ }
+
+ return CreateTilemap(aseFile, device, frameIndex, layers);
+ }
+
+ ///
+ /// Creates a new from a specified frame in the provided aseprite file.
+ ///
+ /// The aseprite file instance.
+ /// The graphics device used to create graphical resources.
+ /// The index of the frame with the tilemap.
+ ///
+ /// A collection containing the name of the layers to process. Only cels on a layer who's name matches a name in
+ /// this collection will be processed.
+ ///
+ /// The created by this method.
+ ///
+ /// Thrown if is .
+ ///
+ /// -or-
+ ///
+ /// throw if is .
+ ///
+ public static Tilemap CreateTilemap(this AsepriteFile aseFile, GraphicsDevice device, int frameIndex, ICollection layers)
+ {
+ ArgumentNullException.ThrowIfNull(aseFile);
+ ArgumentNullException.ThrowIfNull(device);
+
+ AseTilemap aseTilemap = TilemapProcessor.Process(aseFile, frameIndex, layers);
Tilemap tilemap = new Tilemap(aseTilemap.Name);
Dictionary tilesets = GenereateTilesets(device, aseTilemap);
@@ -282,13 +571,72 @@ public static Tilemap CreateTilemap(this AsepriteFile aseFile, GraphicsDevice de
///
/// throw if is .
///
+#pragma warning disable CS0618
+ [Obsolete("This method will be removed in a future release. Users should switch to the other AnimatedTilemap methods instead", false)]
public static AnimatedTilemap CreateAnimatedTilemap(this AsepriteFile aseFile, GraphicsDevice device, ProcessorOptions? options = null)
{
ArgumentNullException.ThrowIfNull(aseFile);
ArgumentNullException.ThrowIfNull(device);
options ??= ProcessorOptions.Default;
- AseAnimatedTilemap aseAnimatedTilemap = AnimatedTilemapProcessor.Process(aseFile, options);
+ return CreateAnimatedTilemap(aseFile, device, options.OnlyVisibleLayers);
+ }
+#pragma warning restore CS0618
+
+ ///
+ /// Creates a new from the all frames in the provided aseprite file.
+ ///
+ /// The aseprite file instance.
+ /// The graphics device used to create graphical resources.
+ /// Indicates whether only visible layers should be processed.
+ /// the created by this method.
+ ///
+ /// Thrown if is .
+ ///
+ /// -or-
+ ///
+ /// throw if is .
+ ///
+ public static AnimatedTilemap CreateAnimatedTilemap(this AsepriteFile aseFile, GraphicsDevice device, bool onlyVisibleLayers = true)
+ {
+ ArgumentNullException.ThrowIfNull(aseFile);
+ ArgumentNullException.ThrowIfNull(device);
+
+ List layers = new List();
+ for (int i = 0; i < aseFile.Layers.Length; i++)
+ {
+ AsepriteLayer layer = aseFile.Layers[i];
+ if (layer is not AsepriteTilemapLayer) { continue; }
+ if (onlyVisibleLayers && !layer.IsVisible) { continue; }
+ layers.Add(layer.Name);
+ }
+
+ return CreateAnimatedTilemap(aseFile, device, layers);
+ }
+
+ ///
+ /// Creates a new from the all frames in the provided aseprite file.
+ ///
+ /// The aseprite file instance.
+ /// The graphics device used to create graphical resources.
+ ///
+ /// A collection containing the name of the layers to process. Only cels on a layer who's name matches a name in
+ /// this collection will be processed.
+ ///
+ /// the created by this method.
+ ///
+ /// Thrown if is .
+ ///
+ /// -or-
+ ///
+ /// throw if is .
+ ///
+ public static AnimatedTilemap CreateAnimatedTilemap(this AsepriteFile aseFile, GraphicsDevice device, ICollection layers)
+ {
+ ArgumentNullException.ThrowIfNull(aseFile);
+ ArgumentNullException.ThrowIfNull(device);
+
+ AseAnimatedTilemap aseAnimatedTilemap = AnimatedTilemapProcessor.Process(aseFile, layers);
AnimatedTilemap animatedTilemap = new AnimatedTilemap(aseAnimatedTilemap.Name);
Dictionary tilesets = new Dictionary();
@@ -334,7 +682,6 @@ public static AnimatedTilemap CreateAnimatedTilemap(this AsepriteFile aseFile, G
return animatedTilemap;
}
-
private static void GenerateRegions(TextureAtlas atlas, AseTextureAtlas aseAtlas)
{
for (int i = 0; i < aseAtlas.Regions.Length; i++)
diff --git a/source/MonoGame.Aseprite/MonoGame.Aseprite.csproj b/source/MonoGame.Aseprite/MonoGame.Aseprite.csproj
index 0f3b237..47b7ea4 100644
--- a/source/MonoGame.Aseprite/MonoGame.Aseprite.csproj
+++ b/source/MonoGame.Aseprite/MonoGame.Aseprite.csproj
@@ -25,7 +25,7 @@
-
+
From a5a750be76f6ba5523f4c42fa504184efa5ae8dd Mon Sep 17 00:00:00 2001
From: Christopher Whitley <103014489+AristurtleDev@users.noreply.github.com>
Date: Fri, 27 Sep 2024 00:57:38 -0400
Subject: [PATCH 2/3] Update samples for AsepriteDotNet 1.9.0
---
examples/AnimatedTilemapExample/Game1.cs | 2 +-
examples/ContentPipelineExample/Game1.cs | 13 ++++++++++++-
examples/SpriteExample/Game1.cs | 9 ++++++++-
examples/SpritesheetExample/Game1.cs | 12 +++++++++++-
examples/TextureAtlasExample/Game1.cs | 12 +++++++++++-
examples/TilemapExample/Game1.cs | 4 +++-
6 files changed, 46 insertions(+), 6 deletions(-)
diff --git a/examples/AnimatedTilemapExample/Game1.cs b/examples/AnimatedTilemapExample/Game1.cs
index 3982a28..11d46d5 100644
--- a/examples/AnimatedTilemapExample/Game1.cs
+++ b/examples/AnimatedTilemapExample/Game1.cs
@@ -47,7 +47,7 @@ protected override void LoadContent()
/// Create an animated tilemap from the file based on all frames.
///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
- _animatedTilemap = aseFile.CreateAnimatedTilemap(GraphicsDevice);
+ _animatedTilemap = aseFile.CreateAnimatedTilemap(GraphicsDevice, onlyVisibleLayers: true);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
diff --git a/examples/ContentPipelineExample/Game1.cs b/examples/ContentPipelineExample/Game1.cs
index 9a143a8..e2b4065 100644
--- a/examples/ContentPipelineExample/Game1.cs
+++ b/examples/ContentPipelineExample/Game1.cs
@@ -37,8 +37,19 @@ protected override void LoadContent()
///
/// Do something with i (see the other examples for more information
///
+ /// The onlyVisibleLayers, includeBackgroundLayer, includeTilemapLayers, mergeDuplicateLayers, borderPadding,
+ /// spacing, and innerPadding parameters used below are optional. Their default values are shown.
+ ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
- SpriteSheet sheet = aseFile.CreateSpriteSheet(GraphicsDevice);
+ SpriteSheet sheet = aseFile.CreateSpriteSheet(GraphicsDevice,
+ onlyVisibleLayers: true,
+ includeBackgroundLayer: false,
+ includeTilemapLayers: false,
+ mergeDuplicateFrames: true,
+ borderPadding: 0,
+ spacing: 0,
+ innerPadding: 0);
+
_animatedSprite = sheet.CreateAnimatedSprite("walk");
_animatedSprite.Play();
}
diff --git a/examples/SpriteExample/Game1.cs b/examples/SpriteExample/Game1.cs
index 4469b03..6351a4a 100644
--- a/examples/SpriteExample/Game1.cs
+++ b/examples/SpriteExample/Game1.cs
@@ -48,8 +48,15 @@ protected override void LoadContent()
///
/// Create a sprite from any frame in the aseprite file
///
+ /// The onlyVisibleLayers, includeBackgroundLayer, includeTilemapLayers, parameters used below are optional.
+ /// Their default values are shown.
+ ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
- _sprite = aseFile.CreateSprite(GraphicsDevice, 0);
+ _sprite = aseFile.CreateSprite(GraphicsDevice,
+ 0,
+ onlyVisibleLayers: true,
+ includeBackgroundLayer: false,
+ includeTilemapLayers: false);
}
protected override void Draw(GameTime gameTime)
diff --git a/examples/SpritesheetExample/Game1.cs b/examples/SpritesheetExample/Game1.cs
index b1cc76b..5489acb 100644
--- a/examples/SpritesheetExample/Game1.cs
+++ b/examples/SpritesheetExample/Game1.cs
@@ -51,8 +51,18 @@ protected override void LoadContent()
///
/// Create a sprite sheet from any frame in the aseprite file
///
+ /// The onlyVisibleLayers, includeBackgroundLayer, includeTilemapLayers, mergeDuplicateLayers, borderPadding,
+ /// spacing, and innerPadding parameters used below are optional. Their default values are shown.
+ ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
- _spriteSheet = aseFile.CreateSpriteSheet(GraphicsDevice);
+ _spriteSheet = aseFile.CreateSpriteSheet(GraphicsDevice,
+ onlyVisibleLayers: true,
+ includeBackgroundLayer: false,
+ includeTilemapLayers: false,
+ mergeDuplicateFrames: true,
+ borderPadding: 0,
+ spacing: 0,
+ innerPadding: 0);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
diff --git a/examples/TextureAtlasExample/Game1.cs b/examples/TextureAtlasExample/Game1.cs
index 40d66f6..8266193 100644
--- a/examples/TextureAtlasExample/Game1.cs
+++ b/examples/TextureAtlasExample/Game1.cs
@@ -51,8 +51,18 @@ protected override void LoadContent()
///
/// Create a texture atlas from the aseprite file
///
+ /// The onlyVisibleLayers, includeBackgroundLayer, includeTilemapLayers, mergeDuplicateLayers, borderPadding,
+ /// spacing, and innerPadding parameters used below are optional. Their default values are shown.
+ ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
- _atlas = aseFile.CreateTextureAtlas(GraphicsDevice);
+ _atlas = aseFile.CreateTextureAtlas(GraphicsDevice,
+ onlyVisibleLayers: true,
+ includeBackgroundLayer: false,
+ includeTilemapLayers: false,
+ mergeDuplicateFrames: true,
+ borderPadding: 0,
+ spacing: 0,
+ innerPadding: 0);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
diff --git a/examples/TilemapExample/Game1.cs b/examples/TilemapExample/Game1.cs
index e737b89..91a1fc1 100644
--- a/examples/TilemapExample/Game1.cs
+++ b/examples/TilemapExample/Game1.cs
@@ -45,8 +45,10 @@ protected override void LoadContent()
///
/// Create a tilemap from the file based on the frame the tilemap is on.
///
+ /// The onlyVisibleLayers parameter is optional. It's default value is shown
+ ///
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
- _tilemap = aseFile.CreateTilemap(GraphicsDevice, frameIndex: 0);
+ _tilemap = aseFile.CreateTilemap(GraphicsDevice, frameIndex: 0, onlyVisibleLayers: true);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
///
From 27929855d34f258c6c46f072b98d73099e9a4b39 Mon Sep 17 00:00:00 2001
From: Christopher Whitley <103014489+AristurtleDev@users.noreply.github.com>
Date: Fri, 27 Sep 2024 00:59:34 -0400
Subject: [PATCH 3/3] Update version number to 6.1.0
---
Directory.Build.props | 2 +-
README.md | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/Directory.Build.props b/Directory.Build.props
index 49d9575..d9420a3 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -20,7 +20,7 @@
en
enable
enable
- 6.0.7
+ 6.1.0
diff --git a/README.md b/README.md
index 18c353e..36abac0 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
A Cross Platform C# Library That Adds Support For Aseprite Files in MonoGame Projects.
[![build-and-test](https://github.com/AristurtleDev/monogame-aseprite/actions/workflows/main.yml/badge.svg)](https://github.com/AristurtleDev/monogame-aseprite/actions/workflows/main.yml)
-[![NuGet 6.0.7](https://img.shields.io/nuget/v/MonoGame.Aseprite?color=blue&style=flat-square)](https://www.nuget.org/packages/MonoGame.Aseprite/6.0.7)
+[![NuGet 6.1.0](https://img.shields.io/nuget/v/MonoGame.Aseprite?color=blue&style=flat-square)](https://www.nuget.org/packages/MonoGame.Aseprite/6.1.0)
[![License: MIT](https://img.shields.io/badge/📃%20license-MIT-blue?style=flat)](LICENSE)
[![Twitter](https://img.shields.io/badge/%20-Share%20On%20Twitter-555?style=flat&logo=twitter)](https://twitter.com/intent/tweet?text=MonoGame.Aseprite%20by%20%40aristurtledev%0A%0AA%20cross-platform%20C%23%20library%20that%20adds%20support%20for%20Aseprite%20files%20in%20MonoGame%20projects.%20https%3A%2F%2Fgithub.com%2FAristurtleDev%2Fmonogame-aseprite%0A%0A%23monogame%20%23aseprite%20%23dotnet%20%23csharp%20%23oss%0A)
@@ -29,7 +29,7 @@ A Cross Platform C# Library That Adds Support For Aseprite Files in MonoGame Pro
# Installation
Install via NuGet
```
-dotnet add package MonoGame.Aseprite --version 6.0.7
+dotnet add package MonoGame.Aseprite --version 6.1.0
```
# Usage