protected override TextureAtlas Read(ContentReader reader, TextureAtlas existingInstance) { var texturePackerFile = Load(reader); var assetName = reader.GetRelativeAssetName(texturePackerFile.Metadata.Image); var texture = reader.ContentManager.Load <Texture2D>(assetName); var atlas = new TextureAtlas(assetName, texture); var regionCount = texturePackerFile.Regions.Count; for (var i = 0; i < regionCount; i++) { atlas.CreateRegion( ContentReaderExtensions.RemoveExtension(texturePackerFile.Regions[i].Filename), texturePackerFile.Regions[i].Frame.X, texturePackerFile.Regions[i].Frame.Y, texturePackerFile.Regions[i].Frame.Width, texturePackerFile.Regions[i].Frame.Height); } return(atlas); }
public void ContentReaderExtensions_ShortenRelativePath(string input, string expectedoutput) { Assert.True(ContentReaderExtensions.ShortenRelativePath(input) == expectedoutput); }