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

@@ -133,6 +133,7 @@ namespace RecrownedAthenaeum.Tools.TextureAtlas
ImageHandler ih = imageHandlers[i];
regions[i].SetBounds(ih.x, ih.y, ih.Width, ih.Height);
regions[i].ninePatchData = ih.ninePatchData;
regions[i].ninePatchData.textureName = null;
regions[i].name = Path.GetFileNameWithoutExtension(ih.Name);
using (Image<Rgba32> image = Image.Load<Rgba32>(ih.path))
{
@@ -140,12 +141,12 @@ namespace RecrownedAthenaeum.Tools.TextureAtlas
}
}
Directory.CreateDirectory(output);
using (FileStream stream = new FileStream(output + "/" + atlasName + ".png", FileMode.Create))
using (FileStream stream = new FileStream(output + "/" + atlasName + "-texture" + ".png", FileMode.Create))
{
atlasTexture.SaveAsPng(stream);
}
}
string serialized = JsonConvert.SerializeObject(new TextureAtlasData(atlasName + ".png", regions), Formatting.Indented);
string serialized = JsonConvert.SerializeObject(new TextureAtlasData(atlasName + "-texture" + ".png", regions), Formatting.Indented);
File.WriteAllText(output + "/" + atlasName + ".tatlas", serialized);
}