1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-05-23 17:13:38 +02:00
MLEM/MLEM/Content/Texture2DReader.cs

24 lines
725 B
C#
Raw Normal View History

2020-04-22 00:30:55 +02:00
using System.IO;
using Microsoft.Xna.Framework.Graphics;
namespace MLEM.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"};
}
}
}