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