improved batching behavior of text rendering

This commit is contained in:
Chris Forbes
2010-04-09 18:21:15 +12:00
parent 7fa6ba6ddd
commit 93702c183a
5 changed files with 11 additions and 3 deletions

View File

@@ -268,6 +268,7 @@ namespace OpenRA
var rect = new Rectangle(pos.X - 160 / 2, pos.Y - 4, 160, 24);
DrawDialogBackground( rect, "dialog2");
DrawCentered(text, new int2(pos.X, pos.Y), Color.White);
rgbaRenderer.Flush();
AddButton(rect, a);
}
@@ -278,6 +279,7 @@ namespace OpenRA
var r = new Rectangle( (Game.viewport.Width - w) / 2, (Game.viewport.Height - h) / 2, w, h );
DrawDialogBackground(r, "dialog");
DrawCentered("Choose Map", new int2(r.Left + w / 2, r.Top + 20), Color.White);
rgbaRenderer.Flush();
DrawDialogBackground(new Rectangle(r.Right - 200 - 160 / 2,
r.Bottom - 50 + 6, 160, 24), "dialog2");
@@ -401,7 +403,7 @@ namespace OpenRA
}
public void DrawWidgets(World world) { rootWidget.Draw(); }
public void DrawWidgets(World world) { rootWidget.Draw(); shpRenderer.Flush(); rgbaRenderer.Flush(); }
public void DrawLobby( World world )
{
@@ -419,6 +421,7 @@ namespace OpenRA
var r = new Rectangle( (Game.viewport.Width - w) / 2, (Game.viewport.Height - h) / 2, w, h );
DrawDialogBackground(r, "dialog");
DrawCentered("OpenRA Multiplayer Lobby", new int2(r.Left + w / 2, r.Top + 20), Color.White);
rgbaRenderer.Flush();
DrawDialogBackground(new Rectangle(r.Right - 264, r.Top + 43, 244, 244),"dialog2");
@@ -447,6 +450,8 @@ namespace OpenRA
f.DrawText(rgbaRenderer, "Status", new int2(r.Left + 290, r.Top + 50), Color.White);
f.DrawText(rgbaRenderer, "Spawn", new int2(r.Left + 390, r.Top + 50), Color.White);
rgbaRenderer.Flush();
var y = r.Top + 80;
foreach (var client in Game.LobbyInfo.Clients)
{

View File

@@ -52,7 +52,7 @@ namespace OpenRA.Graphics
p.X += g.Advance;
}
r.Flush();
// r.Flush();
}
public int2 Measure(string text)

View File

@@ -56,6 +56,8 @@ namespace OpenRA.Widgets
Game.chrome.lineRenderer.Flush();
}
Game.chrome.rgbaRenderer.Flush();
base.Draw();
}
}

View File

@@ -46,6 +46,7 @@ namespace OpenRA.Widgets
- new int2(textSize.X / 2, textSize.Y/2);
Game.chrome.renderer.BoldFont.DrawText(Game.chrome.rgbaRenderer, Text, position, Color.White);
Game.chrome.rgbaRenderer.Flush();
Game.chrome.renderer.Device.DisableScissor();
base.Draw();
}

View File

@@ -59,10 +59,10 @@ namespace OpenRA.Widgets
sr.DrawSprite(ss[5], new float2(Bounds.Right - ss[5].size.X, Bounds.Top), "chrome");
sr.DrawSprite(ss[6], new float2(Bounds.Left, Bounds.Bottom - ss[6].size.Y), "chrome");
sr.DrawSprite(ss[7], new float2(Bounds.Right - ss[7].size.X, Bounds.Bottom - ss[7].size.Y), "chrome");
sr.Flush();
if (a != null) a();
sr.Flush(); // because the scissor is changing
r.Device.DisableScissor();
}
}