2016-09-28 16:32:38 +08:00
|
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2016-10-10 16:17:26 +08:00
|
|
|
|
using osu.Framework;
|
2016-11-09 07:13:20 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2016-09-28 16:32:38 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Cursor;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2016-11-09 07:13:20 +08:00
|
|
|
|
using osu.Framework.Graphics.Textures;
|
2016-09-28 16:32:38 +08:00
|
|
|
|
using osu.Framework.Graphics.Transformations;
|
|
|
|
|
using osu.Framework.Input;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.Cursor
|
|
|
|
|
{
|
|
|
|
|
class OsuCursorContainer : CursorContainer
|
|
|
|
|
{
|
|
|
|
|
protected override Drawable CreateCursor() => new OsuCursor();
|
|
|
|
|
|
|
|
|
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
ActiveCursor.Scale = new OpenTK.Vector2(1);
|
|
|
|
|
ActiveCursor.ScaleTo(1.2f, 100, EasingTypes.OutQuad);
|
|
|
|
|
return base.OnMouseDown(state, args);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
|
|
|
|
{
|
|
|
|
|
if (!state.Mouse.HasMainButtonPressed)
|
|
|
|
|
ActiveCursor.ScaleTo(1, 200, EasingTypes.OutQuad);
|
|
|
|
|
return base.OnMouseUp(state, args);
|
|
|
|
|
}
|
|
|
|
|
|
2016-10-22 16:50:42 +08:00
|
|
|
|
class OsuCursor : Container
|
2016-09-28 16:32:38 +08:00
|
|
|
|
{
|
|
|
|
|
public OsuCursor()
|
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.Centre;
|
2016-10-22 16:50:42 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both;
|
2016-09-28 16:32:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-09 07:13:20 +08:00
|
|
|
|
[Initializer]
|
|
|
|
|
private void Load(TextureStore textures)
|
2016-09-28 16:32:38 +08:00
|
|
|
|
{
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Sprite
|
|
|
|
|
{
|
2016-11-09 07:13:20 +08:00
|
|
|
|
Texture = textures.Get(@"Cursor/cursor")
|
2016-09-28 16:32:38 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|