mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 08:49:59 +09:00
Add basic tweening mouse cursor.
# Conflicts: # osu-framework
This commit is contained in:
Submodule osu-resources updated: 5cc6e0a311...fd4a3dd522
53
osu.Game/Graphics/Cursor/OsuCursorContainer.cs
Normal file
53
osu.Game/Graphics/Cursor/OsuCursorContainer.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
//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.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
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 : AutoSizeContainer
|
||||||
|
{
|
||||||
|
public OsuCursor()
|
||||||
|
{
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Load()
|
||||||
|
{
|
||||||
|
base.Load();
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Sprite
|
||||||
|
{
|
||||||
|
Texture = Game.Textures.Get(@"Cursor/cursor")
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -4,6 +4,7 @@ using osu.Framework.Graphics.Cursor;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Graphics.Processing;
|
using osu.Game.Graphics.Processing;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new CursorContainer()
|
new OsuCursorContainer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
<Compile Include="Graphics\Containers\OsuComponent.cs" />
|
<Compile Include="Graphics\Containers\OsuComponent.cs" />
|
||||||
<Compile Include="Graphics\Containers\OsuGameMode.cs" />
|
<Compile Include="Graphics\Containers\OsuGameMode.cs" />
|
||||||
<Compile Include="Graphics\Containers\OsuLargeComponent.cs" />
|
<Compile Include="Graphics\Containers\OsuLargeComponent.cs" />
|
||||||
|
<Compile Include="Graphics\Cursor\OsuCursorContainer.cs" />
|
||||||
<Compile Include="Graphics\Processing\RatioAdjust.cs" />
|
<Compile Include="Graphics\Processing\RatioAdjust.cs" />
|
||||||
<Compile Include="Graphics\TextAwesome.cs" />
|
<Compile Include="Graphics\TextAwesome.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\KeyCounter.cs" />
|
<Compile Include="Graphics\UserInterface\KeyCounter.cs" />
|
||||||
|
Reference in New Issue
Block a user