Compare commits
No commits in common. "524df8cbd7fda2ece4b81ecda4cbb7ad0f72a8c6" and "7467dd88a4fd8ad7fcc62b642b26a40072936eb6" have entirely different histories.
524df8cbd7
...
7467dd88a4
6 changed files with 15 additions and 72 deletions
|
@ -3,11 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpritePacker", "SpritePacker\SpritePacker.csproj", "{6EF47B64-1920-4827-BEEF-B262D5A2D214}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5C9D36DD-3962-45BF-938E-BE1E258053EC}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
|
@ -19,6 +14,4 @@ Global
|
|||
{6EF47B64-1920-4827-BEEF-B262D5A2D214}.Release|x86.ActiveCfg = Release|x86
|
||||
{6EF47B64-1920-4827-BEEF-B262D5A2D214}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
SpritePacker, by Starbeamrainbowlabs
|
||||
|
||||
Usage:
|
||||
mono ./SpritePacker.exe [flags] [filenames]
|
||||
|
||||
--help Shows this help message.
|
||||
--version Shows the version information.
|
||||
|
||||
More information can be found at https://git.starbeamrainbowlabs.com/sbrl/SpritePacker
|
|
@ -39,11 +39,11 @@ namespace SpritePacker
|
|||
break;
|
||||
|
||||
// Scan along the X axis
|
||||
cspr.X = 0;
|
||||
cspr.Y = scanLines.Y;
|
||||
cspr.Area.X = 0;
|
||||
cspr.Area.Y = scanLines.Y;
|
||||
|
||||
bool foundPosition = false;
|
||||
while(cspr.X < scanLines.X)
|
||||
while(cspr.Area.X < scanLines.X)
|
||||
{
|
||||
if (!cspr.IntersectsWith(arrangedSprites))
|
||||
{
|
||||
|
@ -56,24 +56,24 @@ namespace SpritePacker
|
|||
Sprite rightProblem = problems[0];
|
||||
foreach (Sprite probSpr in problems)
|
||||
{
|
||||
if (probSpr.Right > rightProblem.Right)
|
||||
if (probSpr.Area.Right > rightProblem.Area.Right)
|
||||
rightProblem = probSpr;
|
||||
if (probSpr.Top < nextScanLines.Y)
|
||||
nextScanLines.Y = probSpr.Top + 1;
|
||||
if (probSpr.Area.Top < nextScanLines.Y)
|
||||
nextScanLines.Y = probSpr.Area.Top + 1;
|
||||
}
|
||||
|
||||
// Move up to the position furthest to the right
|
||||
// NOTE: We may need to add one here.
|
||||
cspr.X = rightProblem.Right + 1;
|
||||
cspr.Area.X = rightProblem.Area.Right + 1;
|
||||
|
||||
}
|
||||
|
||||
if (!foundPosition)
|
||||
{
|
||||
// We didn't find anything along the x axis - let's scan the y axis next
|
||||
cspr.X = scanLines.X;
|
||||
cspr.Y = 0;
|
||||
while (cspr.Y < scanLines.Y)
|
||||
cspr.Area.X = scanLines.X;
|
||||
cspr.Area.Y = 0;
|
||||
while (cspr.Area.Y < scanLines.Y)
|
||||
{
|
||||
if (!cspr.IntersectsWith(arrangedSprites))
|
||||
{
|
||||
|
@ -86,13 +86,13 @@ namespace SpritePacker
|
|||
Sprite downProblem = problems[0];
|
||||
foreach (Sprite probSpr in problems)
|
||||
{
|
||||
if (probSpr.Bottom > downProblem.Bottom)
|
||||
if (probSpr.Area.Bottom > downProblem.Area.Bottom)
|
||||
downProblem = probSpr;
|
||||
if (probSpr.Left < nextScanLines.X)
|
||||
nextScanLines.X = probSpr.Left + 1;
|
||||
if (probSpr.Area.Left < nextScanLines.X)
|
||||
nextScanLines.X = probSpr.Area.Left + 1;
|
||||
}
|
||||
// Move up to the position furthest downwards
|
||||
cspr.Y = downProblem.Bottom + 1;
|
||||
cspr.Area.Y = downProblem.Area.Bottom + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Windows.Markup;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace SpritePacker
|
||||
{
|
||||
|
@ -16,18 +15,7 @@ namespace SpritePacker
|
|||
switch(args[i])
|
||||
{
|
||||
case "--help":
|
||||
/*
|
||||
string[] resFiles = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceNames();
|
||||
foreach (string str in resFiles)
|
||||
Console.WriteLine("[{0}]", str);
|
||||
*/
|
||||
|
||||
Assembly asm = Assembly.GetExecutingAssembly();
|
||||
Stream stream = asm.GetManifestResourceStream("SpritePacker.Help.txt");
|
||||
StreamReader source = new StreamReader(stream);
|
||||
Console.Write(source.ReadToEnd());
|
||||
source.Dispose();
|
||||
stream.Dispose();
|
||||
Console.WriteLine("Help text coming soon!");
|
||||
return;
|
||||
case "--version":
|
||||
Console.WriteLine("Version text coming soon!");
|
||||
|
|
|
@ -20,31 +20,6 @@ namespace SpritePacker
|
|||
set { filename = value; }
|
||||
}
|
||||
|
||||
public int X
|
||||
{
|
||||
get { return area.X; }
|
||||
set { area.X = value; }
|
||||
}
|
||||
public int Y
|
||||
{
|
||||
get { return area.Y; }
|
||||
set { area.Y = value; }
|
||||
}
|
||||
public int Width
|
||||
{
|
||||
get { return area.Width; }
|
||||
set { area.Width = value; }
|
||||
}
|
||||
public int Height
|
||||
{
|
||||
get { return area.Height; }
|
||||
set { area.Height = value; }
|
||||
}
|
||||
public int Top { get { return area.Top; } }
|
||||
public int Bottom { get { return area.Bottom; } }
|
||||
public int Left { get { return area.Left; } }
|
||||
public int Right { get { return area.Right; } }
|
||||
|
||||
public Sprite(string inFilename)
|
||||
{
|
||||
Filename = inFilename;
|
||||
|
@ -60,7 +35,6 @@ namespace SpritePacker
|
|||
if (spr.Area.Width > largestSoFar)
|
||||
largestSoFar = spr.Area.Width;
|
||||
}
|
||||
return largestSoFar;
|
||||
}
|
||||
|
||||
public List<Sprite> GetIntersectors(List<Sprite> spriteList)
|
||||
|
|
|
@ -40,7 +40,4 @@
|
|||
<Compile Include="Sprite.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Help.txt" />
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in a new issue