Wire up the settings panel

This commit is contained in:
Paul Chote
2011-05-14 22:25:56 +12:00
parent ce901427bc
commit cb565e5d3c
8 changed files with 366 additions and 97 deletions

View File

@@ -20,6 +20,9 @@ namespace OpenRA.Widgets
public Func<float> GetOffset;
public int Ticks = 0;
public int TrackHeight = 5;
// TODO: Changing this breaks the semantics of Get/SetOffset
// This is bogus
public float2 Range = new float2(0f, 1f);
private float Offset = 0;

View File

@@ -37,11 +37,15 @@ namespace OpenRA.Widgets
// TODO: ViewportScrollController doesn't support delegate methods for mouse input
public override bool HandleMouseInput(MouseInput mi)
{
var scrolltype = Game.Settings.Game.MouseScroll;
if (scrolltype == OpenRA.GameRules.MouseScrollType.Disabled)
return false;
if (mi.Event == MouseInputEvent.Move &&
(mi.Button == MouseButton.Middle || mi.Button == (MouseButton.Left | MouseButton.Right)))
{
int InverseScroll = Game.Settings.Game.InverseDragScroll ? -1 : 1;
Game.viewport.Scroll((Viewport.LastMousePos - mi.Location) * InverseScroll);
var d = scrolltype == OpenRA.GameRules.MouseScrollType.Inverted ? -1 : 1;
Game.viewport.Scroll((Viewport.LastMousePos - mi.Location) * d);
return true;
}
return false;