integrate scrollbar and checkbox art. fixes #215.
This commit is contained in:
@@ -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<bool> Checked = () => {return false;};
|
||||
public Func<bool> 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; }
|
||||
|
||||
Reference in New Issue
Block a user