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

This commit is contained in:
chrisf
2007-07-14 05:58:44 +00:00
parent c2e5e4557b
commit 805c245c7b

View File

@@ -34,7 +34,8 @@ namespace OpenRa.Game
static Provider<Sheet> pageProvider;
static Sheet current = null;
static int x = 0, y = 0, rowHeight = 0;
static int rowHeight = 0;
static Point p;
static TextureChannel? channel = null;
static TextureChannel? NextChannel(TextureChannel? t)
@@ -61,17 +62,16 @@ namespace OpenRa.Game
channel = NextChannel(null);
}
if (rowHeight == 0 || imageSize.Width + x > current.Size.Width)
if (imageSize.Width + p.X > current.Size.Width)
{
y += rowHeight;
p = new Point(0, p.Y + rowHeight);
rowHeight = imageSize.Height;
x = 0;
}
if (imageSize.Height > rowHeight)
rowHeight = imageSize.Height;
if (y + imageSize.Height > current.Size.Height)
if (p.Y + imageSize.Height > current.Size.Height)
{
if (null == (channel = NextChannel(channel)))
@@ -80,11 +80,12 @@ namespace OpenRa.Game
channel = NextChannel(channel);
}
x = y = rowHeight = 0;
rowHeight = 0;
p = new Point(0,0);
}
Sprite rect = new Sprite(current, new Point(x, y), imageSize, channel.Value);
x += imageSize.Width;
Sprite rect = new Sprite(current, p, imageSize, channel.Value);
p.X += imageSize.Width;
return rect;
}