1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 14:03:22 +08:00
osu-lazer/osu.Game/Graphics/Cursor/OsuCursorContainer.cs
Dean Herbert cc0f61f545 Merge branch 'refs/heads/master' into dependency-injection
# Conflicts:
#	osu-framework
#	osu.Game/GameModes/OsuGameMode.cs
#	osu.Game/GameModes/Play/Player.cs
#	osu.Game/OsuGame.cs
#	osu.Game/Overlays/MusicController.cs
#	osu.Game/Overlays/Options/EditorSection.cs
#	osu.Game/Overlays/Options/Input/MouseOptions.cs
#	osu.Game/Overlays/Options/Online/InGameChatOptions.cs
#	osu.Game/Overlays/Options/SkinSection.cs
2016-11-12 20:18:26 +09:00

57 lines
1.7 KiB
C#

//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
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);
}
class OsuCursor : Container
{
public OsuCursor()
{
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
Children = new Drawable[]
{
new Sprite
{
Texture = textures.Get(@"Cursor/cursor")
}
};
}
}
}
}