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

This commit is contained in:
chrisf
2007-07-10 05:04:12 +00:00
parent 83448294bd
commit 6b758aaa0d

View File

@@ -150,11 +150,6 @@ namespace OpenRa.Game
effect = new Effect(device, File.OpenRead("../../../" + shaderName));
texture = effect.GetHandle("DiffuseTexture");
scroll = effect.GetHandle("Scroll");
spriteHelper = new SpriteHelper(device);
fontHelper = new FontHelper(device, "Tahoma", 10, false);
Clock.Reset();
}
internal void Run()
@@ -203,11 +198,8 @@ namespace OpenRa.Game
return ok ? enumerator.Current : default(T);
}
int n = 1;
void Frame()
{
Clock.StartFrame();
device.Begin();
device.Clear( 0, Surfaces.Color );
@@ -219,9 +211,8 @@ namespace OpenRa.Game
effect.SetValue(scroll, scrollPos);
KeyValuePair<Sheet, IndexBuffer> batch = Nth(drawBatches, n);
if (batch.Key != null)
//foreach (KeyValuePair<Sheet, IndexBuffer> batch in drawBatches)
int batchCount = 0;
foreach (KeyValuePair<Sheet, IndexBuffer> batch in drawBatches)
{
effect.SetTexture(texture, batch.Key.texture);
effect.Commit();
@@ -230,34 +221,17 @@ namespace OpenRa.Game
device.DrawIndexedPrimitives(PrimitiveType.TriangleList,
vertexBuffer.Size, batch.Value.Size / 3);
++batchCount;
}
effect.EndPass();
effect.End();
spriteHelper.Begin();
fontHelper.Draw(spriteHelper, "fps: " + Clock.FrameRate, 0, 0, Color.White.ToArgb());
spriteHelper.End();
device.End();
device.Present();
}
protected override void OnKeyDown(KeyEventArgs e)
{
base.OnKeyDown(e);
if (e.KeyCode == Keys.C)
Clock.Reset();
if (e.KeyCode == Keys.A)
n++;
if (e.KeyCode == Keys.Z)
if (--n < 1)
n = 1;
}
TileSet LoadTileSet(Map currentMap)
{
string theaterName = currentMap.Theater;