Record the SheetType in each Sheet.

This commit is contained in:
Paul Chote
2015-09-28 18:23:25 +01:00
parent 426e187a4c
commit e819ff832b
13 changed files with 23 additions and 18 deletions

View File

@@ -24,6 +24,8 @@ namespace OpenRA.Graphics
byte[] data;
public readonly Size Size;
public readonly SheetType Type;
public byte[] GetData()
{
CreateBuffer();
@@ -32,18 +34,20 @@ namespace OpenRA.Graphics
public bool Buffered { get { return data != null || texture == null; } }
public Sheet(Size size)
public Sheet(SheetType type, Size size)
{
Type = type;
Size = size;
}
public Sheet(ITexture texture)
public Sheet(SheetType type, ITexture texture)
{
Type = type;
this.texture = texture;
Size = texture.Size;
}
public Sheet(string filename)
public Sheet(SheetType type, string filename)
{
using (var stream = GlobalFileSystem.Open(filename))
using (var bitmap = (Bitmap)Image.FromStream(stream))
@@ -54,6 +58,7 @@ namespace OpenRA.Graphics
Util.FastCopyIntoSprite(new Sprite(this, bitmap.Bounds(), TextureChannel.Red), bitmap);
}
Type = type;
ReleaseBuffer();
}