mirror of
https://github.com/ppy/osu.git
synced 2025-01-30 06:52:53 +08:00
Add on-screen display support for RawInput and CursorSensitivity
Also allows resetting both at once using Ctrl+Alt+R. - Depends on https://github.com/ppy/osu-framework/pull/807
This commit is contained in:
parent
067a5a2401
commit
028364b2d9
@ -77,8 +77,10 @@ namespace osu.Game
|
|||||||
public void ToggleDirect() => direct.ToggleVisibility();
|
public void ToggleDirect() => direct.ToggleVisibility();
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(FrameworkConfigManager frameworkConfig)
|
||||||
{
|
{
|
||||||
|
this.frameworkConfig = frameworkConfig;
|
||||||
|
|
||||||
if (!Host.IsPrimaryInstance)
|
if (!Host.IsPrimaryInstance)
|
||||||
{
|
{
|
||||||
Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error);
|
Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error);
|
||||||
@ -259,6 +261,14 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
switch (args.Key)
|
switch (args.Key)
|
||||||
{
|
{
|
||||||
|
case Key.R:
|
||||||
|
if (state.Keyboard.AltPressed)
|
||||||
|
{
|
||||||
|
frameworkConfig.Set(FrameworkSetting.ActiveInputHandlers, string.Empty);
|
||||||
|
frameworkConfig.Set(FrameworkSetting.CursorSensitivity, 1.0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case Key.T:
|
case Key.T:
|
||||||
Toolbar.ToggleVisibility();
|
Toolbar.ToggleVisibility();
|
||||||
return true;
|
return true;
|
||||||
@ -284,6 +294,7 @@ namespace osu.Game
|
|||||||
private Container overlayContent;
|
private Container overlayContent;
|
||||||
|
|
||||||
private OsuScreen currentScreen;
|
private OsuScreen currentScreen;
|
||||||
|
private FrameworkConfigManager frameworkConfig;
|
||||||
|
|
||||||
private void screenChanged(Screen newScreen)
|
private void screenChanged(Screen newScreen)
|
||||||
{
|
{
|
||||||
|
@ -125,6 +125,14 @@ namespace osu.Game.Overlays
|
|||||||
trackSetting(frameworkConfig.GetBindable<int>(FrameworkSetting.Width), v => displayResolution());
|
trackSetting(frameworkConfig.GetBindable<int>(FrameworkSetting.Width), v => displayResolution());
|
||||||
trackSetting(frameworkConfig.GetBindable<int>(FrameworkSetting.Height), v => displayResolution());
|
trackSetting(frameworkConfig.GetBindable<int>(FrameworkSetting.Height), v => displayResolution());
|
||||||
|
|
||||||
|
trackSetting(frameworkConfig.GetBindable<double>(FrameworkSetting.CursorSensitivity), v => display(v, "Cursor Sensitivity", v.ToString(@"0.##x"), "Ctrl+Alt+R to reset"));
|
||||||
|
trackSetting(frameworkConfig.GetBindable<string>(FrameworkSetting.ActiveInputHandlers),
|
||||||
|
delegate (string v)
|
||||||
|
{
|
||||||
|
bool raw = v.Contains("Raw");
|
||||||
|
display(raw, "Raw Input", raw ? "enabled" : "disabled", "Ctrl+Alt+R to reset");
|
||||||
|
});
|
||||||
|
|
||||||
trackSetting(frameworkConfig.GetBindable<WindowMode>(FrameworkSetting.WindowMode), v => display(v, "Screen Mode", v.ToString(), "Alt+Enter"));
|
trackSetting(frameworkConfig.GetBindable<WindowMode>(FrameworkSetting.WindowMode), v => display(v, "Screen Mode", v.ToString(), "Alt+Enter"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,6 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager osuConfig, FrameworkConfigManager config)
|
private void load(OsuConfigManager osuConfig, FrameworkConfigManager config)
|
||||||
{
|
{
|
||||||
activeInputHandlers = config.GetBindable<string>(FrameworkSetting.ActiveInputHandlers);
|
|
||||||
rawInputToggle.Value = activeInputHandlers.Value.Contains("Raw");
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
@ -66,7 +63,9 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
sensitivity.Bindable.Disabled = !enabled;
|
sensitivity.Bindable.Disabled = !enabled;
|
||||||
};
|
};
|
||||||
|
|
||||||
rawInputToggle.TriggerChange();
|
activeInputHandlers = config.GetBindable<string>(FrameworkSetting.ActiveInputHandlers);
|
||||||
|
activeInputHandlers.ValueChanged += handlers => rawInputToggle.Value = handlers.Contains("Raw");
|
||||||
|
activeInputHandlers.TriggerChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SensitivitySetting : SettingsSlider<double, SensitivitySlider>
|
private class SensitivitySetting : SettingsSlider<double, SensitivitySlider>
|
||||||
|
Loading…
Reference in New Issue
Block a user