diff --git a/OpenRA.Game/Widgets/CheckboxWidget.cs b/OpenRA.Game/Widgets/CheckboxWidget.cs index 66dfc68594..76179f3391 100644 --- a/OpenRA.Game/Widgets/CheckboxWidget.cs +++ b/OpenRA.Game/Widgets/CheckboxWidget.cs @@ -10,6 +10,7 @@ using System; using System.Drawing; +using OpenRA.Graphics; namespace OpenRA.Widgets { @@ -18,11 +19,11 @@ namespace OpenRA.Widgets public string Text = ""; public int baseLine = 1; public bool Bold = false; - public Func Checked = () => {return false;}; + public Func Checked = () => false; public override void DrawInner(World world) { - var font = (Bold) ? Game.Renderer.BoldFont : Game.Renderer.RegularFont; + var font = Bold ? Game.Renderer.BoldFont : Game.Renderer.RegularFont; var pos = RenderOrigin; var rect = RenderBounds; var check = new Rectangle(rect.Location, @@ -31,14 +32,13 @@ namespace OpenRA.Widgets 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); + new float2(rect.Left + rect.Height * 1.5f, + pos.Y - baseLine + (Bounds.Height - textSize.Y)/2), Color.White); if (Checked()) - { - Game.Renderer.RgbaSpriteRenderer.Flush(); - WidgetUtils.FillRectWithColor(check.InflateBy(-4,-5,-4,-5),Color.White); - Game.Renderer.LineRenderer.Flush(); - } + WidgetUtils.DrawRGBA( + ChromeProvider.GetImage("checkbox", "checked"), + new float2(rect.Left + 2, rect.Top + 2)); } public override bool HandleInputInner(MouseInput mi) { return true; } diff --git a/OpenRA.Game/Widgets/ImageWidget.cs b/OpenRA.Game/Widgets/ImageWidget.cs index e31a77494c..a33d171bab 100644 --- a/OpenRA.Game/Widgets/ImageWidget.cs +++ b/OpenRA.Game/Widgets/ImageWidget.cs @@ -23,8 +23,8 @@ namespace OpenRA.Widgets public ImageWidget() : base() { - GetImageName = () => { return ImageName; }; - GetImageCollection = () => { return ImageCollection; }; + GetImageName = () => ImageName; + GetImageCollection = () => ImageCollection; } protected ImageWidget(ImageWidget other) diff --git a/OpenRA.Game/Widgets/LabelWidget.cs b/OpenRA.Game/Widgets/LabelWidget.cs index 77973747d8..bfd172728b 100644 --- a/OpenRA.Game/Widgets/LabelWidget.cs +++ b/OpenRA.Game/Widgets/LabelWidget.cs @@ -27,8 +27,8 @@ namespace OpenRA.Widgets public LabelWidget() : base() { - GetText = () => { return Text; }; - GetBackground = () => { return Background; }; + GetText = () => Text; + GetBackground = () => Background; } protected LabelWidget(LabelWidget other) diff --git a/OpenRA.Game/Widgets/ListBoxWidget.cs b/OpenRA.Game/Widgets/ListBoxWidget.cs index d9cb1ab923..c21c1b801a 100644 --- a/OpenRA.Game/Widgets/ListBoxWidget.cs +++ b/OpenRA.Game/Widgets/ListBoxWidget.cs @@ -8,7 +8,8 @@ */ #endregion -using System.Drawing; +using System.Drawing; +using OpenRA.Graphics; namespace OpenRA.Widgets { @@ -63,6 +64,15 @@ namespace OpenRA.Widgets WidgetUtils.DrawPanel(downButtonBg, downButtonRect); WidgetUtils.DrawPanel(scrollbarBg, scrollbarRect); + var upOffset = UpPressed ? 4 : 3; + var downOffset = DownPressed ? 4 : 3; + WidgetUtils.DrawRGBA(ChromeProvider.GetImage("scrollbar", "up_arrow"), + new float2(upButtonRect.Left + upOffset, upButtonRect.Top + upOffset)); + WidgetUtils.DrawRGBA(ChromeProvider.GetImage("scrollbar", "down_arrow"), + new float2(downButtonRect.Left + downOffset, downButtonRect.Top + downOffset)); + + Game.Renderer.RgbaSpriteRenderer.Flush(); + Game.Renderer.Device.EnableScissor(backgroundRect.X, backgroundRect.Y + HeaderHeight, backgroundRect.Width, backgroundRect.Height - HeaderHeight); foreach (var child in Children) diff --git a/OpenRA.Game/Widgets/ViewportScrollControllerWidget.cs b/OpenRA.Game/Widgets/ViewportScrollControllerWidget.cs index 62bf79ea5e..ed649ce121 100644 --- a/OpenRA.Game/Widgets/ViewportScrollControllerWidget.cs +++ b/OpenRA.Game/Widgets/ViewportScrollControllerWidget.cs @@ -8,14 +8,8 @@ */ #endregion -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using OpenRA.Orders; -using OpenRA.Traits; -using OpenRA.FileFormats; - +using System; + namespace OpenRA.Widgets { [Flags] @@ -33,9 +27,9 @@ namespace OpenRA.Widgets public int EdgeScrollThreshold = 15; ScrollDirection Keyboard; - ScrollDirection Edge; - - public ViewportScrollControllerWidget() : base() {} + ScrollDirection Edge; + + public ViewportScrollControllerWidget() : base() { } protected ViewportScrollControllerWidget(ViewportScrollControllerWidget widget) : base(widget) {} public override void DrawInner( World world ) {} diff --git a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs index aebaebfed8..8ac2f3e93e 100644 --- a/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs +++ b/OpenRA.Game/Widgets/WorldInteractionControllerWidget.cs @@ -6,15 +6,14 @@ * as published by the Free Software Foundation. For more information, * see LICENSE. */ -#endregion - -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using OpenRA.Orders; +#endregion + +using System; +using System.Drawing; +using System.Linq; +using OpenRA.FileFormats; +using OpenRA.Orders; using OpenRA.Traits; -using OpenRA.FileFormats; namespace OpenRA.Widgets { diff --git a/mods/cnc/buttons.png b/mods/cnc/buttons.png index 09c7d95ac0..9efcfbc8a1 100644 Binary files a/mods/cnc/buttons.png and b/mods/cnc/buttons.png differ diff --git a/mods/cnc/chrome.xml b/mods/cnc/chrome.xml index ae2ecbd3e7..c1c45660c0 100644 --- a/mods/cnc/chrome.xml +++ b/mods/cnc/chrome.xml @@ -13,11 +13,8 @@ - - - @@ -59,11 +56,8 @@ - - - @@ -155,7 +149,7 @@ - + @@ -201,11 +195,18 @@ - - - - - - - + + + + + + + + + + + + + + diff --git a/mods/cnc/chrome/gamelobby.yaml b/mods/cnc/chrome/gamelobby.yaml index 79b8808cdf..ef9bb4cfa6 100644 --- a/mods/cnc/chrome/gamelobby.yaml +++ b/mods/cnc/chrome/gamelobby.yaml @@ -96,8 +96,9 @@ Container@ROOT: Checkbox@STATUS: Id:STATUS X:455 - Width:25 - Height:25 + Y:2 + Width:20 + Height:20 Container@TEMPLATE_REMOTE: Id:TEMPLATE_REMOTE X:0 @@ -151,8 +152,9 @@ Container@ROOT: Checkbox@STATUS: Id:STATUS X:455 - Width:25 - Height:25 + Y:2 + Width:20 + Height:20 Container@LABEL_CONTAINER: X:30 Y:45 diff --git a/mods/ra/buttons.png b/mods/ra/buttons.png index b06ceb5e21..dc205ab3fe 100644 Binary files a/mods/ra/buttons.png and b/mods/ra/buttons.png differ diff --git a/mods/ra/chrome.xml b/mods/ra/chrome.xml index 5d5f0cbda1..1b74499780 100644 --- a/mods/ra/chrome.xml +++ b/mods/ra/chrome.xml @@ -12,9 +12,9 @@ - - - + + + @@ -55,7 +55,7 @@ - + @@ -189,16 +189,23 @@ - + - - - - - - - + + + + + + + + + + + + + + diff --git a/mods/ra/chrome/gamelobby.yaml b/mods/ra/chrome/gamelobby.yaml index a7cdccc064..cb94d9b5bf 100644 --- a/mods/ra/chrome/gamelobby.yaml +++ b/mods/ra/chrome/gamelobby.yaml @@ -96,8 +96,9 @@ Container@ROOT: Checkbox@STATUS: Id:STATUS X:455 - Width:25 - Height:25 + Y:2 + Width:20 + Height:20 Container@TEMPLATE_REMOTE: Id:TEMPLATE_REMOTE X:0 @@ -151,8 +152,9 @@ Container@ROOT: Checkbox@STATUS: Id:STATUS X:455 - Width:25 - Height:25 + Y:2 + Width:20 + Height:20 Container@LABEL_CONTAINER: X:30 Y:45