From 6b758aaa0daadb3f879e414c488af2b185b95f5b Mon Sep 17 00:00:00 2001 From: chrisf Date: Tue, 10 Jul 2007 05:04:12 +0000 Subject: [PATCH] git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1152 993157c7-ee19-0410-b2c4-bb4e9862e678 --- OpenRa.Game/MainWindow.cs | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/OpenRa.Game/MainWindow.cs b/OpenRa.Game/MainWindow.cs index 889c021c49..5f9b04751f 100644 --- a/OpenRa.Game/MainWindow.cs +++ b/OpenRa.Game/MainWindow.cs @@ -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 batch = Nth(drawBatches, n); - if (batch.Key != null) - //foreach (KeyValuePair batch in drawBatches) + int batchCount = 0; + foreach (KeyValuePair 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;