mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 18:23:04 +08:00
Add option to disable cursor rotation.
This commit is contained in:
parent
7f18990582
commit
e8462ac134
@ -54,6 +54,8 @@ namespace osu.Game.Configuration
|
||||
// Graphics
|
||||
Set(OsuSetting.ShowFpsDisplay, false);
|
||||
|
||||
Set(OsuSetting.CursorRotation, true);
|
||||
|
||||
Set(OsuSetting.MenuParallax, true);
|
||||
|
||||
Set(OsuSetting.SnakingInSliders, true);
|
||||
@ -96,6 +98,7 @@ namespace osu.Game.Configuration
|
||||
AudioOffset,
|
||||
MenuMusic,
|
||||
MenuVoice,
|
||||
CursorRotation,
|
||||
MenuParallax,
|
||||
BeatmapDetailTab,
|
||||
Username,
|
||||
|
@ -26,26 +26,28 @@ namespace osu.Game.Graphics.Cursor
|
||||
|
||||
protected override bool OnMouseMove(InputState state)
|
||||
{
|
||||
if (dragging)
|
||||
{
|
||||
Debug.Assert(state.Mouse.PositionMouseDown != null);
|
||||
if (((Cursor)ActiveCursor).DragRotating) {
|
||||
if (dragging) {
|
||||
Debug.Assert (state.Mouse.PositionMouseDown != null);
|
||||
|
||||
// don't start rotating until we're moved a minimum distance away from the mouse down location,
|
||||
// else it can have an annoying effect.
|
||||
startRotation |= Vector2Extensions.Distance(state.Mouse.Position, state.Mouse.PositionMouseDown.Value) > 30;
|
||||
// don't start rotating until we're moved a minimum distance away from the mouse down location,
|
||||
// else it can have an annoying effect.
|
||||
startRotation |= Vector2Extensions.Distance (state.Mouse.Position, state.Mouse.PositionMouseDown.Value) > 30;
|
||||
|
||||
if (startRotation)
|
||||
{
|
||||
Vector2 offset = state.Mouse.Position - state.Mouse.PositionMouseDown.Value;
|
||||
float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f;
|
||||
if (startRotation) {
|
||||
Vector2 offset = state.Mouse.Position - state.Mouse.PositionMouseDown.Value;
|
||||
float degrees = (float)MathHelper.RadiansToDegrees (Math.Atan2 (-offset.X, offset.Y)) + 24.3f;
|
||||
|
||||
// Always rotate in the direction of least distance
|
||||
float diff = (degrees - ActiveCursor.Rotation) % 360;
|
||||
if (diff < -180) diff += 360;
|
||||
if (diff > 180) diff -= 360;
|
||||
degrees = ActiveCursor.Rotation + diff;
|
||||
// Always rotate in the direction of least distance
|
||||
float diff = (degrees - ActiveCursor.Rotation) % 360;
|
||||
if (diff < -180)
|
||||
diff += 360;
|
||||
if (diff > 180)
|
||||
diff -= 360;
|
||||
degrees = ActiveCursor.Rotation + diff;
|
||||
|
||||
ActiveCursor.RotateTo(degrees, 600, Easing.OutQuint);
|
||||
ActiveCursor.RotateTo (degrees, 600, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,10 +108,14 @@ namespace osu.Game.Graphics.Cursor
|
||||
{
|
||||
private Container cursorContainer;
|
||||
private Bindable<double> cursorScale;
|
||||
public Bindable<bool> cursorRotate;
|
||||
|
||||
private const float base_scale = 0.15f;
|
||||
|
||||
public Sprite AdditiveLayer;
|
||||
|
||||
public bool DragRotating;
|
||||
|
||||
public Cursor()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
@ -143,6 +149,10 @@ namespace osu.Game.Graphics.Cursor
|
||||
cursorScale = config.GetBindable<double>(OsuSetting.MenuCursorSize);
|
||||
cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale * base_scale);
|
||||
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>.
|
||||
// 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
|
||||
{
|
||||
public class DetailSettings : SettingsSubsection
|
||||
{
|
||||
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)
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user