Cursor becomes vector.

This commit is contained in:
Dean Herbert
2017-02-04 22:56:56 +09:00
parent 714c94b7a8
commit d97f02a219
2 changed files with 55 additions and 7 deletions

View File

@ -2,6 +2,7 @@
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@ -41,12 +42,13 @@ namespace osu.Game.Graphics.Cursor
class OsuCursor : Container
{
private Container cursorContainer;
private BindableDouble cursorScale;
private Sprite sprite;
public OsuCursor()
{
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
Size = new Vector2(42);
}
[BackgroundDependencyLoader]
@ -56,18 +58,64 @@ namespace osu.Game.Graphics.Cursor
Children = new Drawable[]
{
sprite = new Sprite
cursorContainer = new CircularContainer
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Scale = new Vector2((float)cursorScale),
Texture = textures.Get(@"Cursor/cursor")
Masking = true,
BorderThickness = Size.X / 6,
BorderColour = Color4.White,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0.01f,
},
new CircularContainer
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Masking = true,
BorderThickness = Size.X / 3,
BorderColour = Color4.White.Opacity(0.5f),
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0.01f,
},
},
},
new CircularContainer
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Scale = new Vector2(0.1f),
Masking = true,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White,
},
},
},
}
},
};
cursorScale.ValueChanged += scaleChanged;
}
private void scaleChanged(object sender, EventArgs e)
{
sprite.Scale = new Vector2((float)cursorScale);
cursorContainer.Scale = new Vector2((float)cursorScale);
}
}
}

View File

@ -39,7 +39,7 @@ namespace osu.Game.Graphics.UserInterface
fill = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0.01f, //todo: remove once we figure why containers aren't drawing at all times
Alpha = 0.01f,
},
};
}