Inverse Drag Scrolling
This commit is contained in:
committed by
Chris Forbes
parent
f6a880e524
commit
228852a55d
5
OpenRA.Game/GameRules/UserSettings.cs
Normal file → Executable file
5
OpenRA.Game/GameRules/UserSettings.cs
Normal file → Executable file
@@ -19,8 +19,9 @@ namespace OpenRA.GameRules
|
||||
{
|
||||
public class UserSettings
|
||||
{
|
||||
// Behaviour settings
|
||||
public bool ViewportEdgeScroll = true;
|
||||
// Behaviour settings
|
||||
public bool ViewportEdgeScroll = true;
|
||||
public bool InverseDragScroll = false;
|
||||
|
||||
// Debug settings
|
||||
public bool PerfDebug = false;
|
||||
|
||||
26
OpenRA.Game/Widgets/Delegates/SettingsMenuDelegate.cs
Normal file → Executable file
26
OpenRA.Game/Widgets/Delegates/SettingsMenuDelegate.cs
Normal file → Executable file
@@ -44,15 +44,23 @@ namespace OpenRA.Widgets.Delegates
|
||||
else
|
||||
Game.Settings.PlayerName = name.Text;
|
||||
};
|
||||
name.OnEnterKey = () => { name.LoseFocus(); return true; };
|
||||
|
||||
var edgeScroll = general.GetWidget<CheckboxWidget>("EDGE_SCROLL");
|
||||
edgeScroll.Checked = () => Game.Settings.ViewportEdgeScroll;
|
||||
edgeScroll.OnMouseDown = mi =>
|
||||
{
|
||||
Game.Settings.ViewportEdgeScroll ^= true;
|
||||
return true;
|
||||
};
|
||||
name.OnEnterKey = () => { name.LoseFocus(); return true; };
|
||||
|
||||
var edgeScroll = general.GetWidget<CheckboxWidget>("EDGE_SCROLL");
|
||||
edgeScroll.Checked = () => Game.Settings.ViewportEdgeScroll;
|
||||
edgeScroll.OnMouseDown = mi =>
|
||||
{
|
||||
Game.Settings.ViewportEdgeScroll ^= true;
|
||||
return true;
|
||||
};
|
||||
|
||||
var inverseScroll = general.GetWidget<CheckboxWidget>("INVERSE_SCROLL");
|
||||
inverseScroll.Checked = () => Game.Settings.InverseDragScroll;
|
||||
inverseScroll.OnMouseDown = mi =>
|
||||
{
|
||||
Game.Settings.InverseDragScroll ^= true;
|
||||
return true;
|
||||
};
|
||||
|
||||
// Audio
|
||||
var audio = bg.GetWidget("AUDIO_PANE");
|
||||
|
||||
5
OpenRA.Game/Widgets/ViewportScrollControllerWidget.cs
Normal file → Executable file
5
OpenRA.Game/Widgets/ViewportScrollControllerWidget.cs
Normal file → Executable file
@@ -38,8 +38,9 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
if (mi.Event == MouseInputEvent.Move &&
|
||||
(mi.Button == MouseButton.Middle || mi.Button == (MouseButton.Left | MouseButton.Right)))
|
||||
{
|
||||
Game.viewport.Scroll(Viewport.LastMousePos - mi.Location);
|
||||
{
|
||||
int InverseScroll = Game.Settings.InverseDragScroll ? -1 : 1;
|
||||
Game.viewport.Scroll((Viewport.LastMousePos - mi.Location) * InverseScroll);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -93,6 +93,13 @@ Container@ROOT:
|
||||
Width:200
|
||||
Height:20
|
||||
Text: Enable Edge Scrolling
|
||||
Checkbox@INVERSE_SCROLL:
|
||||
Id:INVERSE_SCROLL
|
||||
X:0
|
||||
Y:60
|
||||
Width:200
|
||||
Height:20
|
||||
Text: Invert Mouse Drag Scrolling
|
||||
Container@AUDIO_PANE:
|
||||
Id:AUDIO_PANE
|
||||
X:37
|
||||
|
||||
@@ -91,6 +91,13 @@ Background@SETTINGS_MENU:
|
||||
Width:200
|
||||
Height:20
|
||||
Text: Enable Edge Scrolling
|
||||
Checkbox@INVERSE_SCROLL:
|
||||
Id:INVERSE_SCROLL
|
||||
X:0
|
||||
Y:60
|
||||
Width:200
|
||||
Height:20
|
||||
Text: Invert Mouse Drag Scrolling
|
||||
Container@AUDIO_PANE:
|
||||
Id:AUDIO_PANE
|
||||
X:37
|
||||
|
||||
Reference in New Issue
Block a user