Skip to content

Commit

Permalink
Adding drag-and-drop support to chunk, block and tile lists.
Browse files Browse the repository at this point in the history
  • Loading branch information
MainMemory committed Feb 1, 2015
1 parent bc1ec8e commit 1657a6d
Show file tree
Hide file tree
Showing 4 changed files with 660 additions and 187 deletions.
17 changes: 16 additions & 1 deletion SonLVL/Extensions.cs
@@ -1,4 +1,5 @@
using System.Drawing;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;

Expand Down Expand Up @@ -72,5 +73,19 @@ public static Rectangle Scale(this Rectangle r, int factor)
{
return new Rectangle(r.X * factor, r.Y * factor, r.Width * factor, r.Height * factor);
}

public static void Swap<T>(this IList<T> list, int a, int b)
{
T tmp = list[a];
list[a] = list[b];
list[b] = tmp;
}

public static void Move<T>(this IList<T> list, int src, int dst)
{
T tmp = list[src];
list.Insert(dst, tmp);
list.RemoveAt(src);
}
}
}

0 comments on commit 1657a6d

Please sign in to comment.