Files
OpenRA/OpenRa.Game/Sheet.cs
(no author) 9d13923a03 removing some dead crap
git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1301 993157c7-ee19-0410-b2c4-bb4e9862e678
2007-07-18 12:48:15 +00:00

50 lines
884 B
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using BluntDirectX.Direct3D;
using System.IO;
using System.Drawing.Imaging;
namespace OpenRa.Game
{
class Sheet
{
public readonly Bitmap bitmap;
readonly GraphicsDevice device;
Texture texture;
string filename = string.Format("../../../block-cache-{0}.png", suffix++);
public Size Size { get { return bitmap.Size; } }
public Sheet(Size size, GraphicsDevice d)
{
bitmap = new Bitmap(size.Width, size.Height);
device = d;
}
public Texture Texture
{
get
{
if (texture == null)
LoadTexture();
return texture;
}
}
void LoadTexture()
{
bitmap.Save(filename);
using( Stream s = File.OpenRead(filename) )
texture = Texture.Create(s, device);
}
static int suffix = 0;
}
}