Define a grid size to snap onto. A grid of 1x1 gives us a pixel by pixel grid. But we usually want to have 5, 10, 50, 100 or something like that.
This commit is contained in:
@ -26,6 +26,7 @@ namespace SpriteLibrary
|
||||
List<ImageStruct> TheImages = new List<ImageStruct>();
|
||||
ResourceManager myResourceManager = null;
|
||||
string Filename = "";
|
||||
Size SnapGridSize = new Size(5, 5);
|
||||
|
||||
public SpriteDatabase(ResourceManager theResourceManager, string filename)
|
||||
{
|
||||
@ -39,6 +40,14 @@ namespace SpriteLibrary
|
||||
LoadSpriteInfo();
|
||||
}
|
||||
|
||||
public void SetSnapGridSize(Size GridSize)
|
||||
{
|
||||
if (GridSize.Width <= 0) return;
|
||||
if (GridSize.Height <= 0) return;
|
||||
if (GridSize.Width > 500) return;
|
||||
if (GridSize.Height > 500) return;
|
||||
SnapGridSize = GridSize;
|
||||
}
|
||||
|
||||
//*******************************
|
||||
//**** Sprite Info Functions ***
|
||||
@ -83,7 +92,7 @@ namespace SpriteLibrary
|
||||
|
||||
public void OpenEditWindow(int FirstItemIndex=-1)
|
||||
{
|
||||
SpriteEntryForm SEF = new SpriteEntryForm(myResourceManager, SpriteInfoList);
|
||||
SpriteEntryForm SEF = new SpriteEntryForm(myResourceManager, SpriteInfoList, SnapGridSize);
|
||||
SEF.ShowDialog();
|
||||
//Use the updated list returned from the form.
|
||||
SpriteInfoList.Clear();
|
||||
|
Reference in New Issue
Block a user