mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 21:03:21 +08:00
Always confine mouse to screen when running fullscreen
This commit is contained in:
parent
a21311f029
commit
7c0edb796e
@ -18,6 +18,8 @@ namespace osu.Game.Input
|
|||||||
public class ConfineMouseTracker : Component
|
public class ConfineMouseTracker : Component
|
||||||
{
|
{
|
||||||
private Bindable<ConfineMouseMode> frameworkConfineMode;
|
private Bindable<ConfineMouseMode> frameworkConfineMode;
|
||||||
|
private Bindable<WindowMode> frameworkWindowMode;
|
||||||
|
|
||||||
private Bindable<OsuConfineMouseMode> osuConfineMode;
|
private Bindable<OsuConfineMouseMode> osuConfineMode;
|
||||||
private IBindable<bool> localUserPlaying;
|
private IBindable<bool> localUserPlaying;
|
||||||
|
|
||||||
@ -25,6 +27,9 @@ namespace osu.Game.Input
|
|||||||
private void load(OsuGame game, FrameworkConfigManager frameworkConfigManager, OsuConfigManager osuConfigManager)
|
private void load(OsuGame game, FrameworkConfigManager frameworkConfigManager, OsuConfigManager osuConfigManager)
|
||||||
{
|
{
|
||||||
frameworkConfineMode = frameworkConfigManager.GetBindable<ConfineMouseMode>(FrameworkSetting.ConfineMouseMode);
|
frameworkConfineMode = frameworkConfigManager.GetBindable<ConfineMouseMode>(FrameworkSetting.ConfineMouseMode);
|
||||||
|
frameworkWindowMode = frameworkConfigManager.GetBindable<WindowMode>(FrameworkSetting.WindowMode);
|
||||||
|
frameworkWindowMode.BindValueChanged(_ => updateConfineMode());
|
||||||
|
|
||||||
osuConfineMode = osuConfigManager.GetBindable<OsuConfineMouseMode>(OsuSetting.ConfineMouseMode);
|
osuConfineMode = osuConfigManager.GetBindable<OsuConfineMouseMode>(OsuSetting.ConfineMouseMode);
|
||||||
localUserPlaying = game.LocalUserPlaying.GetBoundCopy();
|
localUserPlaying = game.LocalUserPlaying.GetBoundCopy();
|
||||||
|
|
||||||
@ -38,16 +43,18 @@ namespace osu.Game.Input
|
|||||||
if (frameworkConfineMode.Disabled)
|
if (frameworkConfineMode.Disabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (frameworkWindowMode.Value == WindowMode.Fullscreen)
|
||||||
|
{
|
||||||
|
frameworkConfineMode.Value = ConfineMouseMode.Fullscreen;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (osuConfineMode.Value)
|
switch (osuConfineMode.Value)
|
||||||
{
|
{
|
||||||
case OsuConfineMouseMode.Never:
|
case OsuConfineMouseMode.Never:
|
||||||
frameworkConfineMode.Value = ConfineMouseMode.Never;
|
frameworkConfineMode.Value = ConfineMouseMode.Never;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OsuConfineMouseMode.Fullscreen:
|
|
||||||
frameworkConfineMode.Value = ConfineMouseMode.Fullscreen;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OsuConfineMouseMode.DuringGameplay:
|
case OsuConfineMouseMode.DuringGameplay:
|
||||||
frameworkConfineMode.Value = localUserPlaying.Value ? ConfineMouseMode.Always : ConfineMouseMode.Never;
|
frameworkConfineMode.Value = localUserPlaying.Value ? ConfineMouseMode.Always : ConfineMouseMode.Never;
|
||||||
break;
|
break;
|
||||||
|
@ -17,11 +17,6 @@ namespace osu.Game.Input
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Never,
|
Never,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The mouse cursor will be locked to the window bounds while in fullscreen mode.
|
|
||||||
/// </summary>
|
|
||||||
Fullscreen,
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The mouse cursor will be locked to the window bounds during gameplay,
|
/// The mouse cursor will be locked to the window bounds during gameplay,
|
||||||
/// but may otherwise move freely.
|
/// but may otherwise move freely.
|
||||||
|
Loading…
Reference in New Issue
Block a user