Remove some duplication

This commit is contained in:
Paul Chote
2010-07-16 19:02:09 +12:00
parent 4c8f85b36b
commit 84ac8d9d16
5 changed files with 50 additions and 77 deletions

View File

@@ -35,24 +35,18 @@ namespace OpenRA.Widgets
var font = (Bold) ? Game.chrome.renderer.BoldFont : Game.chrome.renderer.RegularFont;
var pos = RenderOrigin;
var rect = RenderBounds;
WidgetUtils.DrawPanel("dialog3", new Rectangle(rect.Location,
new Size(Bounds.Height, Bounds.Height)));
var check = new Rectangle(rect.Location,
new Size(Bounds.Height, Bounds.Height));
WidgetUtils.DrawPanel("dialog3", check);
var textSize = font.Measure(Text);
font.DrawText(Text,
new float2(rect.Left + rect.Height * 1.5f, pos.Y - baseLine + (Bounds.Height - textSize.Y)/2), Color.White);
if (Checked())
{
{
Game.chrome.renderer.RgbaSpriteRenderer.Flush();
Game.chrome.lineRenderer.FillRect(
new RectangleF(
Game.viewport.Location.X + rect.Left + 4,
Game.viewport.Location.Y + rect.Top + 5,
rect.Height - 9,
rect.Height - 9),
Color.White);
WidgetUtils.FillRectWithColor(check.InflateBy(-4,-5,-4,-5),Color.White);
Game.chrome.lineRenderer.Flush();
}
}