mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Cursor becomes vector.
This commit is contained in:
@ -2,6 +2,7 @@
|
|||||||
//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 OpenTK;
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -41,12 +42,13 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
|
|
||||||
class OsuCursor : Container
|
class OsuCursor : Container
|
||||||
{
|
{
|
||||||
|
private Container cursorContainer;
|
||||||
private BindableDouble cursorScale;
|
private BindableDouble cursorScale;
|
||||||
private Sprite sprite;
|
|
||||||
public OsuCursor()
|
public OsuCursor()
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
AutoSizeAxes = Axes.Both;
|
Size = new Vector2(42);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -56,18 +58,64 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
sprite = new Sprite
|
cursorContainer = new CircularContainer
|
||||||
{
|
{
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
Scale = new Vector2((float)cursorScale),
|
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;
|
cursorScale.ValueChanged += scaleChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scaleChanged(object sender, EventArgs e)
|
private void scaleChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
sprite.Scale = new Vector2((float)cursorScale);
|
cursorContainer.Scale = new Vector2((float)cursorScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
fill = new Box
|
fill = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Alpha = 0.01f, //todo: remove once we figure why containers aren't drawing at all times
|
Alpha = 0.01f,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user