1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 10:22:55 +08:00

Merge pull request #305 from EVAST9919/cursor_size

Cursor scale
This commit is contained in:
Dean Herbert 2017-02-02 21:19:30 +09:00 committed by GitHub
commit 30801b24c1

View File

@ -3,6 +3,7 @@
using OpenTK; using OpenTK;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
@ -10,6 +11,8 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Game.Configuration;
using System;
namespace osu.Game.Graphics.Cursor namespace osu.Game.Graphics.Cursor
{ {
@ -38,6 +41,8 @@ namespace osu.Game.Graphics.Cursor
class OsuCursor : Container class OsuCursor : Container
{ {
private BindableDouble cursorScale;
private Sprite sprite;
public OsuCursor() public OsuCursor()
{ {
Origin = Anchor.Centre; Origin = Anchor.Centre;
@ -45,15 +50,24 @@ namespace osu.Game.Graphics.Cursor
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore textures) private void load(TextureStore textures, OsuConfigManager config)
{ {
cursorScale = (BindableDouble)config.GetBindable<double>(OsuConfig.CursorSize);
Children = new Drawable[] Children = new Drawable[]
{ {
new Sprite sprite = new Sprite
{ {
Scale = new Vector2((float)cursorScale),
Texture = textures.Get(@"Cursor/cursor") Texture = textures.Get(@"Cursor/cursor")
} }
}; };
cursorScale.ValueChanged += scaleChanged;
}
private void scaleChanged(object sender, EventArgs e)
{
sprite.Scale = new Vector2((float)cursorScale);
} }
} }
} }