forked from ppy/osu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAndroidStylusSettings.cs
More file actions
53 lines (49 loc) · 2.53 KB
/
Copy pathAndroidStylusSettings.cs
File metadata and controls
53 lines (49 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// 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 System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Localisation;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Overlays.Settings;
using osu.Game.Overlays.Settings.Sections.Input;
namespace osu.Android.Input
{
/// <summary>
/// Android-specific stylus / S Pen settings subsection. Reuses the standard
/// <see cref="TabletSettings"/> area-mapping UI and adds the Android-only
/// "Treat S Pen as touch" toggle so it lives next to the related stylus settings
/// (rather than buried inside the Android Performance graphics subsection).
/// </summary>
public partial class AndroidStylusSettings : TabletSettings
{
public AndroidStylusSettings(AndroidStylusHandler handler)
: base(handler)
{
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager osuConfig)
{
// Appended after the base TabletSettings.AddRange (the area-selection UI),
// so the toggles appear at the bottom of the section. Settings search
// (FilterTerms below) still surfaces them under "s pen" / "stylus" / "touch".
Add(new SettingsItemV2(new FormCheckBox
{
Caption = "Disable pen click",
HintText = "When enabled, pressing the S Pen tip does not register as a left click. Useful if you want to use the pen purely for cursor positioning (e.g. when using a keyboard or gamepad for input).",
Current = osuConfig.GetBindable<bool>(OsuSetting.AndroidStylusDisableClick),
}));
Add(new SettingsItemV2(new FormCheckBox
{
Caption = "Treat S Pen as touch",
HintText = "When enabled, S Pen / stylus input is enqueued as touch events (TouchSource.Touch1) rather than mouse events. Useful if a touch-only ruleset (e.g. mania touch columns, osu! touch-device mod) should treat the pen as a finger, or if the stylus pipeline misbehaves on your device.",
Current = osuConfig.GetBindable<bool>(OsuSetting.AndroidStylusAsTouch),
}));
}
public override IEnumerable<LocalisableString> FilterTerms => base.FilterTerms.Concat(new LocalisableString[]
{
@"s pen", @"spen", @"stylus", @"pen", @"touch", @"samsung", @"click", @"disable",
});
}
}