1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-12-02 00:48:34 +01:00
MLEM/MLEM.Data/Content/Texture2DReader.cs

24 lines
730 B
C#
Raw Normal View History

2020-04-22 00:30:55 +02:00
using System.IO;
using Microsoft.Xna.Framework.Graphics;
namespace MLEM.Data.Content {
/// <inheritdoc />
2020-04-22 00:30:55 +02:00
public class Texture2DReader : RawContentReader<Texture2D> {
/// <inheritdoc />
2020-04-22 00:30:55 +02:00
protected override Texture2D Read(RawContentManager manager, string assetPath, Stream stream, Texture2D existing) {
if (existing != null) {
existing.Reload(stream);
return existing;
} else {
return Texture2D.FromStream(manager.GraphicsDevice, stream);
}
}
/// <inheritdoc />
2020-04-22 00:30:55 +02:00
public override string[] GetFileExtensions() {
return new[] {"png", "bmp", "gif", "jpg", "tif", "dds"};
}
}
}