Added new setting : Scroll Speed (added to cnc & ra)
This commit is contained in:
@@ -69,6 +69,7 @@ namespace OpenRA.GameRules
|
|||||||
// Behaviour settings
|
// Behaviour settings
|
||||||
public bool ViewportEdgeScroll = true;
|
public bool ViewportEdgeScroll = true;
|
||||||
public bool InverseDragScroll = false;
|
public bool InverseDragScroll = false;
|
||||||
|
public float ViewportEdgeScrollStep = 0.1f; // 0.1f equals 10 - Gecko
|
||||||
|
|
||||||
// Internal game settings
|
// Internal game settings
|
||||||
public int Timestep = 40;
|
public int Timestep = 40;
|
||||||
|
|||||||
@@ -54,6 +54,14 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
return true;
|
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");
|
var inverseScroll = general.GetWidget<CheckboxWidget>("INVERSE_SCROLL");
|
||||||
inverseScroll.Checked = () => Game.Settings.Game.InverseDragScroll;
|
inverseScroll.Checked = () => Game.Settings.Game.InverseDragScroll;
|
||||||
inverseScroll.OnMouseDown = mi =>
|
inverseScroll.OnMouseDown = mi =>
|
||||||
|
|||||||
@@ -141,14 +141,16 @@ namespace OpenRA.Widgets
|
|||||||
if(Keyboard != ScrollDirection.None || Edge != ScrollDirection.None)
|
if(Keyboard != ScrollDirection.None || Edge != ScrollDirection.None)
|
||||||
{
|
{
|
||||||
var scroll = new float2(0, 0);
|
var scroll = new float2(0, 0);
|
||||||
|
|
||||||
|
// Modified to use the ViewportEdgeScrollStep setting - Gecko
|
||||||
if (Keyboard.Includes(ScrollDirection.Up) || Edge.Includes(ScrollDirection.Up))
|
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))
|
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))
|
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))
|
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);
|
Game.viewport.Scroll(scroll);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,6 +90,18 @@ Background@SETTINGS_MENU:
|
|||||||
Width:200
|
Width:200
|
||||||
Height:20
|
Height:20
|
||||||
Text: Enable Edge Scrolling
|
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:
|
Checkbox@INVERSE_SCROLL:
|
||||||
Id:INVERSE_SCROLL
|
Id:INVERSE_SCROLL
|
||||||
X:0
|
X:0
|
||||||
|
|||||||
@@ -91,6 +91,18 @@ Background@SETTINGS_MENU:
|
|||||||
Width:200
|
Width:200
|
||||||
Height:20
|
Height:20
|
||||||
Text: Enable Edge Scrolling
|
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:
|
Checkbox@INVERSE_SCROLL:
|
||||||
Id:INVERSE_SCROLL
|
Id:INVERSE_SCROLL
|
||||||
X:0
|
X:0
|
||||||
|
|||||||
Reference in New Issue
Block a user