mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Add option to disable cursor rotation.
This commit is contained in:
@ -54,6 +54,8 @@ namespace osu.Game.Configuration
|
|||||||
// Graphics
|
// Graphics
|
||||||
Set(OsuSetting.ShowFpsDisplay, false);
|
Set(OsuSetting.ShowFpsDisplay, false);
|
||||||
|
|
||||||
|
Set(OsuSetting.CursorRotation, true);
|
||||||
|
|
||||||
Set(OsuSetting.MenuParallax, true);
|
Set(OsuSetting.MenuParallax, true);
|
||||||
|
|
||||||
Set(OsuSetting.SnakingInSliders, true);
|
Set(OsuSetting.SnakingInSliders, true);
|
||||||
@ -96,6 +98,7 @@ namespace osu.Game.Configuration
|
|||||||
AudioOffset,
|
AudioOffset,
|
||||||
MenuMusic,
|
MenuMusic,
|
||||||
MenuVoice,
|
MenuVoice,
|
||||||
|
CursorRotation,
|
||||||
MenuParallax,
|
MenuParallax,
|
||||||
BeatmapDetailTab,
|
BeatmapDetailTab,
|
||||||
Username,
|
Username,
|
||||||
|
@ -26,28 +26,30 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
|
|
||||||
protected override bool OnMouseMove(InputState state)
|
protected override bool OnMouseMove(InputState state)
|
||||||
{
|
{
|
||||||
if (dragging)
|
if (((Cursor)ActiveCursor).DragRotating) {
|
||||||
{
|
if (dragging) {
|
||||||
Debug.Assert (state.Mouse.PositionMouseDown != null);
|
Debug.Assert (state.Mouse.PositionMouseDown != null);
|
||||||
|
|
||||||
// don't start rotating until we're moved a minimum distance away from the mouse down location,
|
// don't start rotating until we're moved a minimum distance away from the mouse down location,
|
||||||
// else it can have an annoying effect.
|
// else it can have an annoying effect.
|
||||||
startRotation |= Vector2Extensions.Distance (state.Mouse.Position, state.Mouse.PositionMouseDown.Value) > 30;
|
startRotation |= Vector2Extensions.Distance (state.Mouse.Position, state.Mouse.PositionMouseDown.Value) > 30;
|
||||||
|
|
||||||
if (startRotation)
|
if (startRotation) {
|
||||||
{
|
|
||||||
Vector2 offset = state.Mouse.Position - state.Mouse.PositionMouseDown.Value;
|
Vector2 offset = state.Mouse.Position - state.Mouse.PositionMouseDown.Value;
|
||||||
float degrees = (float)MathHelper.RadiansToDegrees (Math.Atan2 (-offset.X, offset.Y)) + 24.3f;
|
float degrees = (float)MathHelper.RadiansToDegrees (Math.Atan2 (-offset.X, offset.Y)) + 24.3f;
|
||||||
|
|
||||||
// Always rotate in the direction of least distance
|
// Always rotate in the direction of least distance
|
||||||
float diff = (degrees - ActiveCursor.Rotation) % 360;
|
float diff = (degrees - ActiveCursor.Rotation) % 360;
|
||||||
if (diff < -180) diff += 360;
|
if (diff < -180)
|
||||||
if (diff > 180) diff -= 360;
|
diff += 360;
|
||||||
|
if (diff > 180)
|
||||||
|
diff -= 360;
|
||||||
degrees = ActiveCursor.Rotation + diff;
|
degrees = ActiveCursor.Rotation + diff;
|
||||||
|
|
||||||
ActiveCursor.RotateTo (degrees, 600, Easing.OutQuint);
|
ActiveCursor.RotateTo (degrees, 600, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return base.OnMouseMove(state);
|
return base.OnMouseMove(state);
|
||||||
}
|
}
|
||||||
@ -106,10 +108,14 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
{
|
{
|
||||||
private Container cursorContainer;
|
private Container cursorContainer;
|
||||||
private Bindable<double> cursorScale;
|
private Bindable<double> cursorScale;
|
||||||
|
public Bindable<bool> cursorRotate;
|
||||||
|
|
||||||
private const float base_scale = 0.15f;
|
private const float base_scale = 0.15f;
|
||||||
|
|
||||||
public Sprite AdditiveLayer;
|
public Sprite AdditiveLayer;
|
||||||
|
|
||||||
|
public bool DragRotating;
|
||||||
|
|
||||||
public Cursor()
|
public Cursor()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
@ -143,6 +149,10 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
cursorScale = config.GetBindable<double>(OsuSetting.MenuCursorSize);
|
cursorScale = config.GetBindable<double>(OsuSetting.MenuCursorSize);
|
||||||
cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale * base_scale);
|
cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale * base_scale);
|
||||||
cursorScale.TriggerChange();
|
cursorScale.TriggerChange();
|
||||||
|
|
||||||
|
cursorRotate = config.GetBindable<bool> (OsuSetting.CursorRotation);
|
||||||
|
cursorRotate.ValueChanged += newValue => this.DragRotating = newValue;
|
||||||
|
cursorRotate.TriggerChange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,26 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings.Sections.Graphics
|
namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||||
{
|
{
|
||||||
public class DetailSettings : SettingsSubsection
|
public class DetailSettings : SettingsSubsection
|
||||||
{
|
{
|
||||||
protected override string Header => "Detail Settings";
|
protected override string Header => "Detail Settings";
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuConfigManager config)
|
||||||
|
{
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new SettingsCheckbox
|
||||||
|
{
|
||||||
|
LabelText = "Rotate cursor when dragging",
|
||||||
|
Bindable = config.GetBindable<bool>(OsuSetting.CursorRotation)
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user