1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 23:12:56 +08:00

Add support for framework-level mouse confining.

This commit is contained in:
Dean Herbert 2017-05-02 17:45:42 +09:00
parent bef15fe637
commit 1b0f353af3
5 changed files with 14 additions and 25 deletions

View File

@ -29,7 +29,7 @@ namespace osu.Desktop.VisualTests
host.DrawThread.InactiveHz = host.DrawThread.ActiveHz; host.DrawThread.InactiveHz = host.DrawThread.ActiveHz;
host.InputThread.InactiveHz = host.InputThread.ActiveHz; host.InputThread.InactiveHz = host.InputThread.ActiveHz;
host.Window.CursorState = CursorState.Hidden; host.Window.CursorState |= CursorState.Hidden;
} }
} }
} }

View File

@ -43,7 +43,7 @@ namespace osu.Desktop
var desktopWindow = host.Window as DesktopGameWindow; var desktopWindow = host.Window as DesktopGameWindow;
if (desktopWindow != null) if (desktopWindow != null)
{ {
desktopWindow.CursorState = CursorState.Hidden; desktopWindow.CursorState |= CursorState.Hidden;
desktopWindow.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); desktopWindow.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
desktopWindow.Title = Name; desktopWindow.Title = Name;

View File

@ -1,12 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Configuration
{
public enum ConfineMouseMode
{
Never,
Fullscreen,
Always
}
}

View File

@ -2,7 +2,9 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -13,44 +15,44 @@ namespace osu.Game.Overlays.Options.Sections.Input
protected override string Header => "Mouse"; protected override string Header => "Mouse";
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager osuConfig, FrameworkConfigManager config)
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
new OptionSlider<double, SensitivitySlider> new OptionSlider<double, SensitivitySlider>
{ {
LabelText = "Sensitivity", LabelText = "Sensitivity",
Bindable = config.GetBindable<double>(OsuConfig.MouseSpeed) Bindable = osuConfig.GetBindable<double>(OsuConfig.MouseSpeed)
}, },
new OsuCheckbox new OsuCheckbox
{ {
LabelText = "Raw input", LabelText = "Raw input",
Bindable = config.GetBindable<bool>(OsuConfig.RawInput) Bindable = osuConfig.GetBindable<bool>(OsuConfig.RawInput)
}, },
new OsuCheckbox new OsuCheckbox
{ {
LabelText = "Map absolute raw input to the osu! window", LabelText = "Map absolute raw input to the osu! window",
Bindable = config.GetBindable<bool>(OsuConfig.AbsoluteToOsuWindow) Bindable = osuConfig.GetBindable<bool>(OsuConfig.AbsoluteToOsuWindow)
}, },
new OptionEnumDropdown<ConfineMouseMode> new OptionEnumDropdown<ConfineMouseMode>
{ {
LabelText = "Confine mouse cursor", LabelText = "Confine mouse cursor",
Bindable = config.GetBindable<ConfineMouseMode>(OsuConfig.ConfineMouse), Bindable = config.GetBindable<ConfineMouseMode>(FrameworkConfig.ConfineMouseMode),
}, },
new OsuCheckbox new OsuCheckbox
{ {
LabelText = "Disable mouse wheel in play mode", LabelText = "Disable mouse wheel during gameplay",
Bindable = config.GetBindable<bool>(OsuConfig.MouseDisableWheel) Bindable = osuConfig.GetBindable<bool>(OsuConfig.MouseDisableWheel)
}, },
new OsuCheckbox new OsuCheckbox
{ {
LabelText = "Disable mouse buttons in play mode", LabelText = "Disable mouse buttons during gameplay",
Bindable = config.GetBindable<bool>(OsuConfig.MouseDisableButtons) Bindable = osuConfig.GetBindable<bool>(OsuConfig.MouseDisableButtons)
}, },
new OsuCheckbox new OsuCheckbox
{ {
LabelText = "Cursor ripples", LabelText = "Cursor ripples",
Bindable = config.GetBindable<bool>(OsuConfig.CursorRipple) Bindable = osuConfig.GetBindable<bool>(OsuConfig.CursorRipple)
}, },
}; };
} }

View File

@ -385,7 +385,6 @@
<Compile Include="Configuration\ScoreMeterType.cs" /> <Compile Include="Configuration\ScoreMeterType.cs" />
<Compile Include="Configuration\ReleaseStream.cs" /> <Compile Include="Configuration\ReleaseStream.cs" />
<Compile Include="Configuration\ScreenshotFormat.cs" /> <Compile Include="Configuration\ScreenshotFormat.cs" />
<Compile Include="Configuration\ConfineMouseMode.cs" />
<Compile Include="Graphics\OsuColour.cs" /> <Compile Include="Graphics\OsuColour.cs" />
<Compile Include="Screens\Select\FilterControl.cs" /> <Compile Include="Screens\Select\FilterControl.cs" />
<Compile Include="Screens\Select\SearchTextBox.cs" /> <Compile Include="Screens\Select\SearchTextBox.cs" />