Skip to content

Commit

Permalink
Merge pull request #25399 from Susko3/mobile-touch-settings
Browse files Browse the repository at this point in the history
Show touch input settings on mobile
  • Loading branch information
peppy authored Nov 10, 2023
2 parents a8cf105 + 1b08f31 commit 7c4e950
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
4 changes: 4 additions & 0 deletions osu.Android/OsuGameAndroid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using osu.Framework.Platform;
using osu.Game;
using osu.Game.Overlays.Settings;
using osu.Game.Overlays.Settings.Sections.Input;
using osu.Game.Updater;
using osu.Game.Utils;

Expand Down Expand Up @@ -97,6 +98,9 @@ public override SettingsSubsection CreateSettingsSubsectionFor(InputHandler hand
case AndroidJoystickHandler jh:
return new AndroidJoystickSettings(jh);

case AndroidTouchHandler th:
return new TouchSettings(th);

default:
return base.CreateSettingsSubsectionFor(handler);
}
Expand Down
6 changes: 3 additions & 3 deletions osu.Game/OsuGameBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -575,14 +575,14 @@ public virtual SettingsSubsection CreateSettingsSubsectionFor(InputHandler handl

case JoystickHandler jh:
return new JoystickSettings(jh);

case TouchHandler th:
return new TouchSettings(th);
}
}

switch (handler)
{
case TouchHandler th:
return new TouchSettings(th);

case MidiHandler:
return new InputSection.HandlerSection(handler);

Expand Down
12 changes: 8 additions & 4 deletions osu.Game/Overlays/Settings/Sections/Input/TouchSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System.Collections.Generic;
using System.Linq;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Input.Handlers;
using osu.Framework.Localisation;
Expand All @@ -28,11 +29,14 @@ public TouchSettings(InputHandler handler)
[BackgroundDependencyLoader]
private void load(OsuConfigManager osuConfig)
{
Add(new SettingsCheckbox
if (!RuntimeInfo.IsMobile) // don't allow disabling the only input method (touch) on mobile.
{
LabelText = CommonStrings.Enabled,
Current = handler.Enabled
});
Add(new SettingsCheckbox
{
LabelText = CommonStrings.Enabled,
Current = handler.Enabled
});
}

Add(new SettingsCheckbox
{
Expand Down
6 changes: 4 additions & 2 deletions osu.Game/Screens/Play/PlayerSettings/InputSettings.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Configuration;
Expand All @@ -22,8 +23,9 @@ private void load(OsuConfigManager config)
{
new PlayerCheckbox
{
LabelText = MouseSettingsStrings.DisableClicksDuringGameplay,
Current = config.GetBindable<bool>(OsuSetting.MouseDisableButtons)
// TODO: change to touchscreen detection once https://github.com/ppy/osu/pull/25348 makes it in
LabelText = RuntimeInfo.IsDesktop ? MouseSettingsStrings.DisableClicksDuringGameplay : TouchSettingsStrings.DisableTapsDuringGameplay,
Current = config.GetBindable<bool>(RuntimeInfo.IsDesktop ? OsuSetting.MouseDisableButtons : OsuSetting.TouchDisableGameplayTaps)
}
};
}
Expand Down

0 comments on commit 7c4e950

Please sign in to comment.