From 9fc56f1cc7e916a7c41f7073be25b47642860df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Mon, 29 Apr 2024 13:07:36 +0200 Subject: [PATCH] Apply adjustments after migration of android to SDL3 --- osu.Android/AndroidJoystickSettings.cs | 76 -------------------- osu.Android/AndroidMouseSettings.cs | 97 -------------------------- osu.Android/OsuGameAndroid.cs | 22 ------ 3 files changed, 195 deletions(-) delete mode 100644 osu.Android/AndroidJoystickSettings.cs delete mode 100644 osu.Android/AndroidMouseSettings.cs diff --git a/osu.Android/AndroidJoystickSettings.cs b/osu.Android/AndroidJoystickSettings.cs deleted file mode 100644 index bf69461f0d..0000000000 --- a/osu.Android/AndroidJoystickSettings.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Allocation; -using osu.Framework.Android.Input; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Localisation; -using osu.Game.Localisation; -using osu.Game.Overlays.Settings; - -namespace osu.Android -{ - public partial class AndroidJoystickSettings : SettingsSubsection - { - protected override LocalisableString Header => JoystickSettingsStrings.JoystickGamepad; - - private readonly AndroidJoystickHandler joystickHandler; - - private readonly Bindable enabled = new BindableBool(true); - - private SettingsSlider deadzoneSlider = null!; - - private Bindable handlerDeadzone = null!; - - private Bindable localDeadzone = null!; - - public AndroidJoystickSettings(AndroidJoystickHandler joystickHandler) - { - this.joystickHandler = joystickHandler; - } - - [BackgroundDependencyLoader] - private void load() - { - // use local bindable to avoid changing enabled state of game host's bindable. - handlerDeadzone = joystickHandler.DeadzoneThreshold.GetBoundCopy(); - localDeadzone = handlerDeadzone.GetUnboundCopy(); - - Children = new Drawable[] - { - new SettingsCheckbox - { - LabelText = CommonStrings.Enabled, - Current = enabled - }, - deadzoneSlider = new SettingsSlider - { - LabelText = JoystickSettingsStrings.DeadzoneThreshold, - KeyboardStep = 0.01f, - DisplayAsPercentage = true, - Current = localDeadzone, - }, - }; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - enabled.BindTo(joystickHandler.Enabled); - enabled.BindValueChanged(e => deadzoneSlider.Current.Disabled = !e.NewValue, true); - - handlerDeadzone.BindValueChanged(val => - { - bool disabled = localDeadzone.Disabled; - - localDeadzone.Disabled = false; - localDeadzone.Value = val.NewValue; - localDeadzone.Disabled = disabled; - }, true); - - localDeadzone.BindValueChanged(val => handlerDeadzone.Value = val.NewValue); - } - } -} diff --git a/osu.Android/AndroidMouseSettings.cs b/osu.Android/AndroidMouseSettings.cs deleted file mode 100644 index fd01b11164..0000000000 --- a/osu.Android/AndroidMouseSettings.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using Android.OS; -using osu.Framework.Allocation; -using osu.Framework.Android.Input; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Localisation; -using osu.Game.Configuration; -using osu.Game.Localisation; -using osu.Game.Overlays.Settings; -using osu.Game.Overlays.Settings.Sections.Input; - -namespace osu.Android -{ - public partial class AndroidMouseSettings : SettingsSubsection - { - private readonly AndroidMouseHandler mouseHandler; - - protected override LocalisableString Header => MouseSettingsStrings.Mouse; - - private Bindable handlerSensitivity = null!; - - private Bindable localSensitivity = null!; - - private Bindable relativeMode = null!; - - public AndroidMouseSettings(AndroidMouseHandler mouseHandler) - { - this.mouseHandler = mouseHandler; - } - - [BackgroundDependencyLoader] - private void load(OsuConfigManager osuConfig) - { - // use local bindable to avoid changing enabled state of game host's bindable. - handlerSensitivity = mouseHandler.Sensitivity.GetBoundCopy(); - localSensitivity = handlerSensitivity.GetUnboundCopy(); - - relativeMode = mouseHandler.UseRelativeMode.GetBoundCopy(); - - // High precision/pointer capture is only available on Android 8.0 and up - if (Build.VERSION.SdkInt >= BuildVersionCodes.O) - { - AddRange(new Drawable[] - { - new SettingsCheckbox - { - LabelText = MouseSettingsStrings.HighPrecisionMouse, - TooltipText = MouseSettingsStrings.HighPrecisionMouseTooltip, - Current = relativeMode, - Keywords = new[] { @"raw", @"input", @"relative", @"cursor", @"captured", @"pointer" }, - }, - new MouseSettings.SensitivitySetting - { - LabelText = MouseSettingsStrings.CursorSensitivity, - Current = localSensitivity, - }, - }); - } - - AddRange(new Drawable[] - { - new SettingsCheckbox - { - LabelText = MouseSettingsStrings.DisableMouseWheelVolumeAdjust, - TooltipText = MouseSettingsStrings.DisableMouseWheelVolumeAdjustTooltip, - Current = osuConfig.GetBindable(OsuSetting.MouseDisableWheel), - }, - new SettingsCheckbox - { - LabelText = MouseSettingsStrings.DisableClicksDuringGameplay, - Current = osuConfig.GetBindable(OsuSetting.MouseDisableButtons), - }, - }); - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - relativeMode.BindValueChanged(relative => localSensitivity.Disabled = !relative.NewValue, true); - - handlerSensitivity.BindValueChanged(val => - { - bool disabled = localSensitivity.Disabled; - - localSensitivity.Disabled = false; - localSensitivity.Value = val.NewValue; - localSensitivity.Disabled = disabled; - }, true); - - localSensitivity.BindValueChanged(val => handlerSensitivity.Value = val.NewValue); - } - } -} diff --git a/osu.Android/OsuGameAndroid.cs b/osu.Android/OsuGameAndroid.cs index 52cfb67f42..a235913ef3 100644 --- a/osu.Android/OsuGameAndroid.cs +++ b/osu.Android/OsuGameAndroid.cs @@ -5,13 +5,9 @@ using System; using Android.App; using Microsoft.Maui.Devices; using osu.Framework.Allocation; -using osu.Framework.Android.Input; using osu.Framework.Extensions.ObjectExtensions; -using osu.Framework.Input.Handlers; 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; @@ -88,24 +84,6 @@ namespace osu.Android protected override BatteryInfo CreateBatteryInfo() => new AndroidBatteryInfo(); - public override SettingsSubsection CreateSettingsSubsectionFor(InputHandler handler) - { - switch (handler) - { - case AndroidMouseHandler mh: - return new AndroidMouseSettings(mh); - - case AndroidJoystickHandler jh: - return new AndroidJoystickSettings(jh); - - case AndroidTouchHandler th: - return new TouchSettings(th); - - default: - return base.CreateSettingsSubsectionFor(handler); - } - } - private class AndroidBatteryInfo : BatteryInfo { public override double? ChargeLevel => Battery.ChargeLevel;