Changed 9p and tatlas' to use a separately loaded texture.

This commit is contained in:
2019-03-20 19:28:16 -05:00
parent 4add103f94
commit e3535f5662
30 changed files with 184 additions and 169 deletions

View File

@@ -8,10 +8,6 @@ namespace RecrownedAthenaeum.Tools.NinePatchTools
{
public class NinePatchCommand : EngineCommand
{
private enum SupportedExtensions
{
jpeg, jpg, png
}
public NinePatchCommand() : base("9p", "ninepatch", "9patch")
{
@@ -34,6 +30,7 @@ namespace RecrownedAthenaeum.Tools.NinePatchTools
string imagePath, outPath;
if (IndexOfArgument("-i", arguments) + 1 >= arguments.Length) throw new ArgumentException("Missing -i path after argument.");
imagePath = arguments[IndexOfArgument("-i", arguments) + 1];
if (!File.Exists(imagePath)) throw new ArgumentException("Input file does not exist at " + imagePath + ".");
if (HasArgument(commandArguments[1], arguments))
{
@@ -51,10 +48,7 @@ namespace RecrownedAthenaeum.Tools.NinePatchTools
NinePatchData npData = new NinePatchData(Path.GetFileName(imagePath), leftBound, rightBound, bottomBound, topBound);
string serialized = JsonConvert.SerializeObject(npData, Formatting.Indented);
if (!File.Exists(imagePath)) throw new ArgumentException("Input file does not exist at " + imagePath + ".");
SupportedExtensions extension;
if (!Enum.TryParse<SupportedExtensions>(Path.GetExtension(imagePath).ToLower().Substring(1), out extension)) throw new ArgumentException("Input file extension \"" + Path.GetExtension(imagePath).ToLower().Substring(1) + "\" not supported.");
File.Move(imagePath, Path.GetFileNameWithoutExtension(imagePath) + "-texture" + Path.GetExtension(imagePath));
File.WriteAllText(outPath + ".9p", serialized);
ConsoleUtilities.WriteWrappedLine("Done. Written to \"" + outPath + "\" with values: left = " + leftBound + " right = " + rightBound + " top = " + topBound + " bottom = " + bottomBound);