Browse Source

Slight bugfix in new preset mode

master
Starbeamrainbowlabs 10 months ago
parent
commit
f92154b228
Signed by: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com> GPG Key ID: 1BE5172E637709C2
2 changed files with 6 additions and 3 deletions
  1. 5
    2
      SpritePacker-CLI/Program.cs
  2. 1
    1
      SpritePacker/SpritePacker.cs

+ 5
- 2
SpritePacker-CLI/Program.cs View File

@@ -61,8 +61,10 @@ namespace SpritePacker
61 61
 						string presetFilename = args[++i];
62 62
 						if (File.Exists(presetFilename))
63 63
 							rawSourceLocations = File.ReadAllText(presetFilename);
64
-						else
64
+						else {
65 65
 							Console.Error.WriteLine("Warning: Couldn't find the preset csv file at {0}", presetFilename);
66
+							return 1;
67
+						}
66 68
 						break;
67 69
 					case "--csv":
68 70
 						outputFormat = OutputFormat.CSV;
@@ -120,7 +122,7 @@ namespace SpritePacker
120 122
 			// Preset some locations if they were specified
121 123
 			if (rawSourceLocations != null) {
122 124
 				foreach (string[] line in parseCSV(rawSourceLocations).Skip(1)) { // Skip the header
123
-				  // index,filename,x,y,width,height
125
+					// index,filename,x,y,width,height
124 126
 					Sprite currentSprite = sprites.Find((Sprite item) => item.Filename == line[1]);
125 127
 					currentSprite.Area = new Rectangle(
126 128
 						int.Parse(line[2]),
@@ -129,6 +131,7 @@ namespace SpritePacker
129 131
 						int.Parse(line[5])
130 132
 					);
131 133
 					currentSprite.Placed = true;
134
+					if(Verbose) Console.WriteLine("Pre-placing {0}", currentSprite);
132 135
 				}
133 136
 			}
134 137
 			spritePacker.Add(sprites);

+ 1
- 1
SpritePacker/SpritePacker.cs View File

@@ -155,7 +155,7 @@ namespace SpritePacker
155 155
 								if (probSpr.Bottom > downProblem.Bottom)
156 156
 									downProblem = probSpr;
157 157
 								// If the current problem's right edge is further in than the current next scan line,
158
-								// move the enxt scan line up to meet it.
158
+								// move the next scan line up to meet it.
159 159
 								// Also make sure that the next scan line and the current scan line don't touch or cross.
160 160
 								if (probSpr.Right < nextScanLines.X && probSpr.Right > scanLines.X)
161 161
 									nextScanLines.X = probSpr.Right; // NOTE: Add one here?

Loading…
Cancel
Save