git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1219 993157c7-ee19-0410-b2c4-bb4e9862e678

This commit is contained in:
chrisf
2007-07-14 06:01:12 +00:00
parent 805c245c7b
commit 9ea296c34d

View File

@@ -7,13 +7,11 @@ using OpenRa.FileFormats;
namespace OpenRa.Game namespace OpenRa.Game
{ {
delegate T Provider<T>();
static class SheetBuilder static class SheetBuilder
{ {
public static void Initialize(GraphicsDevice device) public static void Initialize(GraphicsDevice d)
{ {
pageProvider = delegate { return new Sheet(new Size(512,512), device); }; device = d;
} }
public static Sprite Add(byte[] src, Size size) public static Sprite Add(byte[] src, Size size)
@@ -32,7 +30,12 @@ namespace OpenRa.Game
return Add(data, size); return Add(data, size);
} }
static Provider<Sheet> pageProvider; static Sheet NewSheet()
{
return new Sheet(new Size(512, 512), device);
}
static GraphicsDevice device;
static Sheet current = null; static Sheet current = null;
static int rowHeight = 0; static int rowHeight = 0;
static Point p; static Point p;
@@ -58,7 +61,7 @@ namespace OpenRa.Game
{ {
if (current == null) if (current == null)
{ {
current = pageProvider(); current = NewSheet();
channel = NextChannel(null); channel = NextChannel(null);
} }
@@ -76,7 +79,7 @@ namespace OpenRa.Game
if (null == (channel = NextChannel(channel))) if (null == (channel = NextChannel(channel)))
{ {
current = pageProvider(); current = NewSheet();
channel = NextChannel(channel); channel = NextChannel(channel);
} }