"Create Server" submenu
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user