diff --git a/AnimationLibrary/AnimatedSprite.cs b/AnimationLibrary/AnimatedSprite.cs index 7d4afa7..a4d4793 100644 --- a/AnimationLibrary/AnimatedSprite.cs +++ b/AnimationLibrary/AnimatedSprite.cs @@ -1,12 +1,11 @@ using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; -using MonoGame.Extended.TextureAtlases; namespace QURO.AnimationLibrary { public class AnimatedSprite { - public TextureAtlas CurrentTextureAtlas { get; set; } + public Texture2D SpriteSheet { get; set; } private Animation currentAnimation; public Animation CurrentAnimation { @@ -18,15 +17,15 @@ namespace QURO.AnimationLibrary } } public int CurrentFrameIndex { get; set; } - public TextureRegion2D CurrentFrame => CurrentAnimation.Frames[CurrentFrameIndex]; + public Rectangle CurrentFrame => CurrentAnimation.Frames[CurrentFrameIndex]; private float timer; public AnimatedSprite() { } - public AnimatedSprite(TextureAtlas textureAtlas, Animation startingAnimation) + public AnimatedSprite(Texture2D spriteSheet, Animation startingAnimation) { - CurrentTextureAtlas = textureAtlas; + SpriteSheet = spriteSheet; CurrentAnimation = startingAnimation; timer = CurrentAnimation.Delay; } @@ -65,15 +64,15 @@ namespace QURO.AnimationLibrary public void Draw(SpriteBatch spriteBatch, Vector2 position, Color tint) { - spriteBatch.Draw(CurrentTextureAtlas.Texture, position, CurrentFrame.Bounds, tint); + spriteBatch.Draw(SpriteSheet, position, CurrentFrame, tint); } public void Draw(SpriteBatch spriteBatch, Vector2 position, Vector2 spriteOffset, Color tint) { - Rectangle sourceRect = CurrentFrame.Bounds; + Rectangle sourceRect = CurrentFrame; sourceRect.Offset(spriteOffset); - spriteBatch.Draw(CurrentTextureAtlas.Texture, position, sourceRect, tint); + spriteBatch.Draw(SpriteSheet, position, sourceRect, tint); } } } diff --git a/AnimationLibrary/Animation.cs b/AnimationLibrary/Animation.cs index 2014dca..2bb0fae 100644 --- a/AnimationLibrary/Animation.cs +++ b/AnimationLibrary/Animation.cs @@ -1,4 +1,4 @@ -using MonoGame.Extended.TextureAtlases; +using Microsoft.Xna.Framework; namespace QURO.AnimationLibrary { @@ -8,24 +8,10 @@ namespace QURO.AnimationLibrary public bool IsLooping { get; set; } public float Delay { get; set; } - public TextureRegion2D[] Frames { get; set; } + public Rectangle[] Frames { get; set; } public bool IsStillImage => Frames.Length <= 1; public Animation() { } - - public Animation(string name, TextureAtlas textureAtlas, string[] frameNames, float delaySetting = 0.2f, bool willLoop = false) - { - Name = name; - - Frames = new TextureRegion2D[frameNames.Length]; - - for (int index = 0; index < frameNames.Length; index++) - { - Frames[index] = textureAtlas.GetRegion(frameNames[index]); - } - IsLooping = willLoop; - Delay = delaySetting; - } } } diff --git a/AnimationLibrary/AnimationSet.cs b/AnimationLibrary/AnimationSet.cs new file mode 100644 index 0000000..31e40a3 --- /dev/null +++ b/AnimationLibrary/AnimationSet.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace QURO.AnimationLibrary +{ + public class AnimationSet + { + public Dictionary Anims; + } +} diff --git a/AnimationLibrary/AnimationLibrary.csproj b/AnimationLibrary/QURO.AnimationLibrary.csproj similarity index 81% rename from AnimationLibrary/AnimationLibrary.csproj rename to AnimationLibrary/QURO.AnimationLibrary.csproj index a1420f1..3982b3c 100644 --- a/AnimationLibrary/AnimationLibrary.csproj +++ b/AnimationLibrary/QURO.AnimationLibrary.csproj @@ -31,16 +31,10 @@ 4 - - ..\packages\MonoGame.Extended.1.1.0\lib\portable-net45+win8+wpa81\MonoGame.Extended.dll - False C:\Program Files (x86)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll - - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - @@ -53,10 +47,8 @@ + - - - \ No newline at end of file diff --git a/AnimationLibrary/packages.config b/AnimationLibrary/packages.config deleted file mode 100644 index 5207eb6..0000000 --- a/AnimationLibrary/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/PuzzSwap.sln b/PuzzSwap.sln index 5abe745..ba068e5 100644 --- a/PuzzSwap.sln +++ b/PuzzSwap.sln @@ -5,7 +5,7 @@ VisualStudioVersion = 15.0.27703.2047 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PuzzSwap", "PuzzSwap\PuzzSwap.csproj", "{CD753795-0CB4-4F05-A0E7-2D2EFC968D82}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnimationLibrary", "AnimationLibrary\AnimationLibrary.csproj", "{69DADC27-FBEB-4625-9212-6EB5BED5102A}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QURO.AnimationLibrary", "AnimationLibrary\QURO.AnimationLibrary.csproj", "{69DADC27-FBEB-4625-9212-6EB5BED5102A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution