SpriteMapEditor Rework
-Renamed Sprite to SpriteMapRegion -Updated Frame code in QURO.AnimationLibrary to use SpriteMapRegions instead of Rectangles -Replaced Drag and drop sprite rearrangement behaviour in Editor with simpler, less buggy up/down button system -Changed Editor's save/load format to be a MonoGame compatible Dictionary<string, SpriteMapRegion> rather than a List
This commit is contained in:
@@ -74,12 +74,12 @@ namespace QURO.AnimationLibrary
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, Vector2 position, Color tint)
|
||||
{
|
||||
spriteBatch.Draw(SpriteSheet, position, CurrentFrame.SourceRect, tint);
|
||||
spriteBatch.Draw(SpriteSheet, position, CurrentFrame.Bounds, tint);
|
||||
}
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, Vector2 position, Vector2 spriteOffset, Color tint)
|
||||
{
|
||||
Rectangle sourceRect = CurrentFrame.SourceRect;
|
||||
Rectangle sourceRect = CurrentFrame.Bounds;
|
||||
sourceRect.Offset(spriteOffset);
|
||||
|
||||
spriteBatch.Draw(SpriteSheet, position, sourceRect, tint);
|
||||
|
||||
@@ -1,17 +1,49 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using QURO;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace QURO.AnimationLibrary
|
||||
{
|
||||
public class Frame
|
||||
public class Frame : SpriteMapRegion
|
||||
{
|
||||
public Rectangle SourceRect { get; set; }
|
||||
public float Delay { get; set; }
|
||||
|
||||
public Frame() { }
|
||||
|
||||
public Frame(Rectangle sourceRectangle, float delay)
|
||||
public Frame()
|
||||
{
|
||||
SourceRect = sourceRectangle;
|
||||
Name = "unnamed";
|
||||
Bounds = new Rectangle(0, 0, 8, 8);
|
||||
Origin = Vector2.Zero;
|
||||
Delay = 0;
|
||||
}
|
||||
|
||||
public Frame(SpriteMapRegion sprite, float delay)
|
||||
{
|
||||
Name = sprite.Name;
|
||||
Bounds = sprite.Bounds;
|
||||
Origin = sprite.Origin;
|
||||
Delay = delay;
|
||||
}
|
||||
|
||||
public Frame(string name, Rectangle bounds, float delay, Vector2 origin)
|
||||
{
|
||||
Name = name;
|
||||
Bounds = bounds;
|
||||
Origin = origin;
|
||||
Delay = delay;
|
||||
}
|
||||
|
||||
public Frame(Rectangle bounds, float delay, Vector2 origin)
|
||||
{
|
||||
Name = "unnamed";
|
||||
Bounds = bounds;
|
||||
Origin = origin;
|
||||
Delay = delay;
|
||||
}
|
||||
|
||||
public Frame(Rectangle bounds, float delay)
|
||||
{
|
||||
Name = "unnamed";
|
||||
Bounds = bounds;
|
||||
Origin = Vector2.Zero;
|
||||
Delay = delay;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user