Restruct: QURO << QURO.Animation; SpriteMapRegion -> Sprite: Now can draw itself

This commit is contained in:
quinnvoker
2018-12-19 09:16:17 -08:00
parent 06486e72fc
commit b8173d688d
19 changed files with 63 additions and 275 deletions
@@ -11,14 +11,14 @@ namespace SpriteMapEditor.SpriteMapModifications
{
class AddSprite : ISpriteMapModification
{
private readonly BindingList<SpriteMapRegion> allSprites;
private readonly BindingList<Sprite> allSprites;
private readonly SpriteMapRegion selectedSprite;
private readonly Sprite selectedSprite;
private List<int> preChangeSelection;
private List<int> postChangeSelection;
public AddSprite(BindingList<SpriteMapRegion> spriteList, SpriteMapRegion selected = null)
public AddSprite(BindingList<Sprite> spriteList, Sprite selected = null)
{
allSprites = spriteList;
@@ -28,9 +28,9 @@ namespace SpriteMapEditor.SpriteMapModifications
public void Do()
{
if (selectedSprite != null)
allSprites.Add(new SpriteMapRegion(selectedSprite.Name, selectedSprite.Bounds, selectedSprite.Origin));
allSprites.Add(new Sprite(selectedSprite.Name, selectedSprite.Bounds, selectedSprite.Origin));
else
allSprites.Add(new SpriteMapRegion());
allSprites.Add(new Sprite());
}
public void Undo()
@@ -10,7 +10,7 @@ namespace SpriteMapEditor.SpriteMapModifications
{
class ApplyOriginPreset : ISpriteMapModification
{
private readonly List<SpriteMapRegion> sprites;
private readonly List<Sprite> sprites;
private readonly OriginPreset preset;
@@ -19,7 +19,7 @@ namespace SpriteMapEditor.SpriteMapModifications
private List<int> preChangeSelection;
private List<int> postChangeSelection;
public ApplyOriginPreset(List<SpriteMapRegion> spritesToEditOrigin, OriginPreset presetToApply)
public ApplyOriginPreset(List<Sprite> spritesToEditOrigin, OriginPreset presetToApply)
{
sprites = spritesToEditOrigin.ToList();
preset = presetToApply;
@@ -33,7 +33,7 @@ namespace SpriteMapEditor.SpriteMapModifications
public void Do()
{
foreach(SpriteMapRegion sprite in sprites)
foreach(Sprite sprite in sprites)
{
Vector2 newOrigin = sprite.Origin;
@@ -46,7 +46,7 @@ namespace SpriteMapEditor.SpriteMapModifications
public static void SelectFromList(ListBox listBox, List<int> newSelection)
{
listBox.SelectedIndices.Clear();
var source = (BindingList<SpriteMapRegion>)listBox.DataSource;
var source = (BindingList<Sprite>)listBox.DataSource;
foreach (int currentIndex in newSelection)
{
if(currentIndex < source.Count)
@@ -11,7 +11,7 @@ namespace SpriteMapEditor.SpriteMapModifications
{
class ModifyBounds : ISpriteMapModification
{
private readonly List<SpriteMapRegion> sprites;
private readonly List<Sprite> sprites;
private readonly int newXPosition;
private readonly int newYPosition;
@@ -23,7 +23,7 @@ namespace SpriteMapEditor.SpriteMapModifications
private List<int> preChangeSelection;
private List<int> postChangeSelection;
public ModifyBounds(List<SpriteMapRegion> spritesToModify, int x = -1, int y = -1, int width = -1, int height = -1)
public ModifyBounds(List<Sprite> spritesToModify, int x = -1, int y = -1, int width = -1, int height = -1)
{
sprites = spritesToModify.ToList();
newXPosition = x;
@@ -10,7 +10,7 @@ namespace SpriteMapEditor.SpriteMapModifications
{
class ModifyOrigin : ISpriteMapModification
{
private readonly List<SpriteMapRegion> sprites;
private readonly List<Sprite> sprites;
private readonly int newOriginX;
private readonly int newOriginY;
@@ -20,7 +20,7 @@ namespace SpriteMapEditor.SpriteMapModifications
private List<int> preChangeSelection;
private List<int> postChangeSelection;
public ModifyOrigin(List<SpriteMapRegion> spritesToEditOrigin, int x = -1, int y = -1)
public ModifyOrigin(List<Sprite> spritesToEditOrigin, int x = -1, int y = -1)
{
sprites = spritesToEditOrigin.ToList();
newOriginX = x;
@@ -10,7 +10,7 @@ namespace SpriteMapEditor.SpriteMapModifications
{
class MoveBounds : ISpriteMapModification
{
private readonly List<SpriteMapRegion> sprites;
private readonly List<Sprite> sprites;
private readonly int xDiff;
private readonly int yDiff;
@@ -19,7 +19,7 @@ namespace SpriteMapEditor.SpriteMapModifications
private List<int> preChangeSelection;
private List<int> postChangeSelection;
public MoveBounds(List<SpriteMapRegion> spritesToMove, int xDifference, int yDifference, List<Rectangle> preDragBounds = null)
public MoveBounds(List<Sprite> spritesToMove, int xDifference, int yDifference, List<Rectangle> preDragBounds = null)
{
sprites = spritesToMove.ToList();
xDiff = xDifference;
@@ -29,7 +29,7 @@ namespace SpriteMapEditor.SpriteMapModifications
public void Do()
{
foreach (SpriteMapRegion sprite in sprites)
foreach (Sprite sprite in sprites)
{
var newBounds = sprite.Bounds;
newBounds.X += xDiff;
@@ -48,7 +48,7 @@ namespace SpriteMapEditor.SpriteMapModifications
}
else
{
foreach (SpriteMapRegion sprite in sprites)
foreach (Sprite sprite in sprites)
{
var newBounds = sprite.Bounds;
newBounds.X -= xDiff;
@@ -10,7 +10,7 @@ namespace SpriteMapEditor.SpriteMapModifications
{
class MoveSpriteListEntry : ISpriteMapModification
{
private readonly BindingList<SpriteMapRegion> allSprites;
private readonly BindingList<Sprite> allSprites;
private readonly int selectedIndex;
private readonly int dir;
@@ -18,7 +18,7 @@ namespace SpriteMapEditor.SpriteMapModifications
private List<int> preChangeSelection;
private List<int> postChangeSelection;
public MoveSpriteListEntry(BindingList<SpriteMapRegion> spriteList, int selection, int direction)
public MoveSpriteListEntry(BindingList<Sprite> spriteList, int selection, int direction)
{
allSprites = spriteList;
selectedIndex = selection;
@@ -10,16 +10,16 @@ namespace SpriteMapEditor.SpriteMapModifications
{
class RemoveSprite : ISpriteMapModification
{
private readonly BindingList<SpriteMapRegion> allSprites;
private readonly BindingList<Sprite> allSprites;
private readonly int index;
private readonly SpriteMapRegion removedSprite;
private readonly Sprite removedSprite;
private List<int> preChangeSelection;
private List<int> postChangeSelection;
public RemoveSprite(BindingList<SpriteMapRegion> spriteList, int indexToRemove)
public RemoveSprite(BindingList<Sprite> spriteList, int indexToRemove)
{
allSprites = spriteList;
index = indexToRemove;
@@ -9,7 +9,7 @@ namespace SpriteMapEditor.SpriteMapModifications
{
class RenameSprite : ISpriteMapModification
{
private readonly SpriteMapRegion sprite;
private readonly Sprite sprite;
private readonly string newName;
private readonly string oldName;
@@ -17,7 +17,7 @@ namespace SpriteMapEditor.SpriteMapModifications
private List<int> preChangeSelection;
private List<int> postChangeSelection;
public RenameSprite(SpriteMapRegion spriteToRename, string name)
public RenameSprite(Sprite spriteToRename, string name)
{
sprite = spriteToRename;
newName = name;