"Create Server" submenu

This commit is contained in:
Paul Chote
2010-03-14 23:26:34 +13:00
parent ddf331cfed
commit ef306cbcd5
8 changed files with 217 additions and 116 deletions

View File

@@ -7,13 +7,25 @@ namespace OpenRA.Widgets
class LabelWidget : Widget
{
public readonly string Text = null;
public readonly string Align = "Left";
public override void Draw(SpriteRenderer rgbaRenderer, Renderer renderer)
{
Rectangle r = Bounds;
renderer.Device.EnableScissor(r.Left, r.Top, r.Width, r.Height);
renderer.BoldFont.DrawText(rgbaRenderer, Text, new int2(X+Width/2, Y+Height/2) - new int2(renderer.BoldFont.Measure(Text).X / 2, renderer.BoldFont.Measure(Text).Y/2), Color.White);
renderer.Device.DisableScissor();
if (Visible)
{
Rectangle r = Bounds;
renderer.Device.EnableScissor(r.Left, r.Top, r.Width, r.Height);
int2 bounds = renderer.BoldFont.Measure(Text);
int2 position = new int2(X,Y);
if (Align == "Center")
position = new int2(X+Width/2, Y+Height/2) - new int2(bounds.X / 2, bounds.Y/2);
renderer.BoldFont.DrawText(rgbaRenderer, Text, position, Color.White);
renderer.Device.DisableScissor();
}
base.Draw(rgbaRenderer,renderer);
}
}