recrownedathenaeum/RecrownedAthenaeum.Pipeline/TextureAtlas/TextureAtlasImporter.cs

22 lines
731 B
C#

using Microsoft.Xna.Framework.Content.Pipeline;
using Newtonsoft.Json;
using System.IO;
namespace RecrownedAthenaeum.Pipeline.TextureAtlas
{
[ContentImporter(".tatlas", DisplayName = "Texture Atlas Importer")]
internal class TextureAtlasImporter : ContentImporter<TextureAtlasData>
{
public override TextureAtlasData Import(string filename, ContentImporterContext context)
{
TextureAtlasData atlas;
using (StreamReader stream = new StreamReader(filename))
{
atlas = JsonConvert.DeserializeObject<TextureAtlasData>(stream.ReadToEnd());
}
context.AddDependency(atlas.textureName);
return atlas;
}
}
}