Added new setting : Scroll Speed (added to cnc & ra)

This commit is contained in:
unknown
2010-09-30 02:12:11 +02:00
committed by Chris Forbes
parent c0ca35a4ff
commit de429a4c62
5 changed files with 199 additions and 164 deletions

View File

@@ -69,6 +69,7 @@ namespace OpenRA.GameRules
// Behaviour settings
public bool ViewportEdgeScroll = true;
public bool InverseDragScroll = false;
public float ViewportEdgeScrollStep = 0.1f; // 0.1f equals 10 - Gecko
// Internal game settings
public int Timestep = 40;

View File

@@ -54,6 +54,14 @@ namespace OpenRA.Widgets.Delegates
return true;
};
// Added scroll sensitivity - Gecko
var edgeScrollSlider = general.GetWidget<SliderWidget>("EDGE_SCROLL_AMOUNT");
if (edgeScrollSlider != null) // Backwards compatible - Gecko
{
edgeScrollSlider.OnChange += x => { x += 0.1f; Game.Settings.Game.ViewportEdgeScrollStep = x; };
edgeScrollSlider.GetOffset = () => { return Game.Settings.Game.ViewportEdgeScrollStep - 0.1f; };
}
var inverseScroll = general.GetWidget<CheckboxWidget>("INVERSE_SCROLL");
inverseScroll.Checked = () => Game.Settings.Game.InverseDragScroll;
inverseScroll.OnMouseDown = mi =>

View File

@@ -141,14 +141,16 @@ namespace OpenRA.Widgets
if(Keyboard != ScrollDirection.None || Edge != ScrollDirection.None)
{
var scroll = new float2(0, 0);
// Modified to use the ViewportEdgeScrollStep setting - Gecko
if (Keyboard.Includes(ScrollDirection.Up) || Edge.Includes(ScrollDirection.Up))
scroll += new float2(0, -10);
scroll += new float2(0, -(Game.Settings.Game.ViewportEdgeScrollStep * 100));
if (Keyboard.Includes(ScrollDirection.Right) || Edge.Includes(ScrollDirection.Right))
scroll += new float2(10, 0);
scroll += new float2((Game.Settings.Game.ViewportEdgeScrollStep * 100), 0);
if (Keyboard.Includes(ScrollDirection.Down) || Edge.Includes(ScrollDirection.Down))
scroll += new float2(0, 10);
scroll += new float2(0, (Game.Settings.Game.ViewportEdgeScrollStep * 100));
if (Keyboard.Includes(ScrollDirection.Left) || Edge.Includes(ScrollDirection.Left))
scroll += new float2(-10, 0);
scroll += new float2(-(Game.Settings.Game.ViewportEdgeScrollStep * 100), 0);
Game.viewport.Scroll(scroll);
}

View File

@@ -90,6 +90,18 @@ Background@SETTINGS_MENU:
Width:200
Height:20
Text: Enable Edge Scrolling
Label@EDGE_SCROLL_AMOUNT_LABEL:
Id:EDGE_SCROLL_AMOUNT_LABEL
X:0
Y:70
Text: Scroll Speed
Slider@EDGE_SCROLL_AMOUNT:
Id:EDGE_SCROLL_AMOUNT
X:130
Y:60
Width:250
Height:20
Ticks:100
Checkbox@INVERSE_SCROLL:
Id:INVERSE_SCROLL
X:0

View File

@@ -91,6 +91,18 @@ Background@SETTINGS_MENU:
Width:200
Height:20
Text: Enable Edge Scrolling
Label@EDGE_SCROLL_AMOUNT_LABEL:
Id:EDGE_SCROLL_AMOUNT_LABEL
X:0
Y:70
Text: Scroll Speed
Slider@EDGE_SCROLL_AMOUNT:
Id:EDGE_SCROLL_AMOUNT
X:130
Y:60
Width:250
Height:20
Ticks:100
Checkbox@INVERSE_SCROLL:
Id:INVERSE_SCROLL
X:0