-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use AsepriteDotNet as core processing library
- Loading branch information
1 parent
3139277
commit ab5b0d0
Showing
127 changed files
with
1,618 additions
and
6,640 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"dotnet-mgcb": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb" | ||
] | ||
}, | ||
"dotnet-mgcb-editor": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor" | ||
] | ||
}, | ||
"dotnet-mgcb-editor-linux": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor-linux" | ||
] | ||
}, | ||
"dotnet-mgcb-editor-windows": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor-windows" | ||
] | ||
}, | ||
"dotnet-mgcb-editor-mac": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor-mac" | ||
] | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
examples/AnimatedTilemapExample/AnimatedTilemapExample.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<RollForward>Major</RollForward> | ||
<PublishReadyToRun>false</PublishReadyToRun> | ||
<TieredCompilation>false</TieredCompilation> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<ApplicationManifest>app.manifest</ApplicationManifest> | ||
<ApplicationIcon>Icon.ico</ApplicationIcon> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<None Remove="Icon.ico" /> | ||
<None Remove="Icon.bmp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="Icon.ico" /> | ||
<EmbeddedResource Include="Icon.bmp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" /> | ||
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.1.303" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Update="townmap.aseprite"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
<Target Name="RestoreDotnetTools" BeforeTargets="Restore"> | ||
<Message Text="Restoring dotnet tools" Importance="High" /> | ||
<Exec Command="dotnet tool restore" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
#----------------------------- Global Properties ----------------------------# | ||
|
||
/outputDir:bin/$(Platform) | ||
/intermediateDir:obj/$(Platform) | ||
/platform:DesktopGL | ||
/config: | ||
/profile:Reach | ||
/compress:False | ||
|
||
#-------------------------------- References --------------------------------# | ||
|
||
|
||
#---------------------------------- Content ---------------------------------# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
using AsepriteDotNet.Aseprite; | ||
using AsepriteDotNet.IO; | ||
using Microsoft.Xna.Framework; | ||
using Microsoft.Xna.Framework.Graphics; | ||
using MonoGame.Aseprite; | ||
|
||
namespace AnimatedTilemapExample; | ||
|
||
public class Game1 : Game | ||
{ | ||
private GraphicsDeviceManager _graphics; | ||
private SpriteBatch _spriteBatch; | ||
private AnimatedTilemap _animatedTilemap; | ||
private Vector2 _scale; | ||
|
||
public Game1() | ||
{ | ||
_graphics = new GraphicsDeviceManager(this); | ||
Content.RootDirectory = "Content"; | ||
IsMouseVisible = true; | ||
} | ||
|
||
|
||
protected override void LoadContent() | ||
{ | ||
_spriteBatch = new SpriteBatch(GraphicsDevice); | ||
|
||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
/// | ||
/// Load the file. In this example, we're not using the MGCB/Content Pipeline and have the Aseprite file set as | ||
/// a file in our project that is copied the output directory. Because of this, we can use the | ||
/// TitleContainer.OpenStream to get a stream to the file and use that to load it. | ||
/// | ||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
AsepriteFile aseFile; | ||
using (Stream stream = TitleContainer.OpenStream("townmap.aseprite")) | ||
{ | ||
aseFile = AsepriteFileLoader.FromStream("townmap", stream); | ||
} | ||
|
||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
/// | ||
/// Create an animated tilemap from the file based on all frames. | ||
/// | ||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
_animatedTilemap = aseFile.CreateAnimatedTilemap(GraphicsDevice); | ||
|
||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
/// | ||
/// Size the tilemap is created 1:1 with the size it is in Aseprite, we're going to create a scale factor here | ||
/// in this example to be the size of the game window. | ||
/// | ||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
_scale.X = _graphics.PreferredBackBufferWidth / (float)_animatedTilemap.GetFrame(0).GetLayer(0).Width; | ||
_scale.Y = _graphics.PreferredBackBufferHeight / (float)_animatedTilemap.GetFrame(0).GetLayer(0).Height; | ||
|
||
} | ||
|
||
protected override void Update(GameTime gameTime) | ||
{ | ||
|
||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
/// | ||
/// The animated tilemap must be updated each frame to update the animations. | ||
/// | ||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
_animatedTilemap.Update(gameTime); | ||
|
||
} | ||
|
||
protected override void Draw(GameTime gameTime) | ||
{ | ||
GraphicsDevice.Clear(Color.CornflowerBlue); | ||
|
||
|
||
_spriteBatch.Begin(samplerState: SamplerState.PointClamp); | ||
|
||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
/// | ||
/// Spritebatch extension are provided to draw the tilemap | ||
/// | ||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
_spriteBatch.Draw(_animatedTilemap, Vector2.Zero, Color.White, _scale, 0.0f); | ||
|
||
_spriteBatch.End(); | ||
} | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
| ||
using var game = new AnimatedTilemapExample.Game1(); | ||
game.Run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1"> | ||
<assemblyIdentity version="1.0.0.0" name="AnimatedTilemapExample"/> | ||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2"> | ||
<security> | ||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3"> | ||
<requestedExecutionLevel level="asInvoker" uiAccess="false" /> | ||
</requestedPrivileges> | ||
</security> | ||
</trustInfo> | ||
|
||
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> | ||
<application> | ||
<!-- A list of the Windows versions that this application has been tested on and is | ||
is designed to work with. Uncomment the appropriate elements and Windows will | ||
automatically selected the most compatible environment. --> | ||
|
||
<!-- Windows Vista --> | ||
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" /> | ||
|
||
<!-- Windows 7 --> | ||
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" /> | ||
|
||
<!-- Windows 8 --> | ||
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" /> | ||
|
||
<!-- Windows 8.1 --> | ||
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" /> | ||
|
||
<!-- Windows 10 --> | ||
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> | ||
|
||
</application> | ||
</compatibility> | ||
|
||
<application xmlns="urn:schemas-microsoft-com:asm.v3"> | ||
<windowsSettings> | ||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> | ||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness> | ||
</windowsSettings> | ||
</application> | ||
|
||
</assembly> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"version": 1, | ||
"isRoot": true, | ||
"tools": { | ||
"dotnet-mgcb": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb" | ||
] | ||
}, | ||
"dotnet-mgcb-editor": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor" | ||
] | ||
}, | ||
"dotnet-mgcb-editor-linux": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor-linux" | ||
] | ||
}, | ||
"dotnet-mgcb-editor-windows": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor-windows" | ||
] | ||
}, | ||
"dotnet-mgcb-editor-mac": { | ||
"version": "3.8.1.303", | ||
"commands": [ | ||
"mgcb-editor-mac" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
#----------------------------- Global Properties ----------------------------# | ||
|
||
/outputDir:bin/$(Platform) | ||
/intermediateDir:obj/$(Platform) | ||
/platform:DesktopGL | ||
/config: | ||
/profile:Reach | ||
/compress:False | ||
|
||
#-------------------------------- References --------------------------------# | ||
|
||
/reference:..\..\..\.artifacts\bin\source\MonoGame.Aseprite.Content.Pipeline\Debug\net6.0\MonoGame.Aseprite.Content.Pipeline.dll | ||
|
||
#---------------------------------- Content ---------------------------------# | ||
|
||
#begin character_robot.aseprite | ||
/importer:AsepriteFileContentImporter | ||
/processor:AsepriteFileContentProcessor | ||
/processorParam:PremultiplyAlpha=True | ||
/build:character_robot.aseprite | ||
|
Binary file not shown.
34 changes: 34 additions & 0 deletions
34
examples/ContentPipelineExample/ContentPipelineExample.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<RollForward>Major</RollForward> | ||
<PublishReadyToRun>false</PublishReadyToRun> | ||
<TieredCompilation>false</TieredCompilation> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<ApplicationManifest>app.manifest</ApplicationManifest> | ||
<ApplicationIcon>Icon.ico</ApplicationIcon> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<None Remove="Icon.ico" /> | ||
<None Remove="Icon.bmp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="Icon.ico" /> | ||
<EmbeddedResource Include="Icon.bmp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<PackageReference Include="MonoGame.Framework.DesktopGL" Version="3.8.1.303" /> | ||
<PackageReference Include="MonoGame.Content.Builder.Task" Version="3.8.1.303" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Update="Content\character_robot.aseprite"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
</ItemGroup> | ||
<Target Name="RestoreDotnetTools" BeforeTargets="Restore"> | ||
<Message Text="Restoring dotnet tools" Importance="High" /> | ||
<Exec Command="dotnet tool restore" /> | ||
</Target> | ||
</Project> |
Oops, something went wrong.