mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 14:12:54 +08:00
use GameHost to check if caps lock is enabled
This commit is contained in:
parent
c29d3437ba
commit
d81956e974
@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using System;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Platform;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
@ -65,10 +66,12 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
private class CapsWarning : SpriteIcon, IHasTooltip
|
||||
{
|
||||
public string TooltipText => Console.CapsLock ? @"Caps lock is active" : string.Empty;
|
||||
public string TooltipText => host.CapsLockEnabled ? @"Caps lock is active" : string.Empty;
|
||||
|
||||
public override bool HandleInput => true;
|
||||
|
||||
private GameHost host;
|
||||
|
||||
public CapsWarning()
|
||||
{
|
||||
Icon = FontAwesome.fa_warning;
|
||||
@ -80,9 +83,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour)
|
||||
private void load(OsuColour colour, GameHost host)
|
||||
{
|
||||
Colour = colour.YellowLight;
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
@ -91,7 +95,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
updateVisibility();
|
||||
}
|
||||
|
||||
private void updateVisibility() => this.FadeTo(Console.CapsLock ? 1 : 0, 250, Easing.OutQuint);
|
||||
private void updateVisibility() => this.FadeTo(host.CapsLockEnabled ? 1 : 0, 250, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user