Skip to content

Commit

Permalink
More tooltips!
Browse files Browse the repository at this point in the history
  • Loading branch information
mempler committed Oct 29, 2021
1 parent 153c122 commit b33b294
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
8 changes: 6 additions & 2 deletions Qsor.Game/Graphics/ClickableIcon.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;

namespace Qsor.Game.Graphics
{
public class ClickableIcon : SpriteIcon
public class ClickableIcon : SpriteIcon, IHasTooltip
{
public LocalisableString TooltipText { get; set; }

public delegate bool ClickDelegate(ClickEvent e);
public ClickDelegate ClickEvent;

Expand Down
1 change: 0 additions & 1 deletion Qsor.Game/Graphics/Containers/QsorTooltipContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ private void Load()
new Box
{
Colour = Color4.Black,
Alpha = .5f,
RelativeSizeAxes = Axes.Both,
},
_textFlowContainer = new TextFlowContainer
Expand Down
6 changes: 5 additions & 1 deletion Qsor.Game/Graphics/DragProgressbar.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
using System.Linq;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osuTK.Input;
using Qsor.Game.Overlays.Drawables;

namespace Qsor.Game.Graphics
{
public class DragProgressbar : DrawableProgressbar
public class DragProgressbar : DrawableProgressbar, IHasTooltip
{
public LocalisableString TooltipText { get; set; }

public bool IsDragging { get; private set; }
public bool JustClicked { get; set; } // TODO: use an action

Expand Down
20 changes: 18 additions & 2 deletions Qsor.Game/Overlays/MusicPlayerOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private void Load(NotificationOverlay notificationOverlay, BeatmapManager beatma
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(6)
Spacing = new Vector2(6),
};

_Icons = new FillFlowContainer<ClickableIcon>
Expand All @@ -52,6 +52,8 @@ private void Load(NotificationOverlay notificationOverlay, BeatmapManager beatma
Icon = FontAwesome.Solid.StepBackward,
Size = new Vector2(16),

TooltipText = "Previous track",

ClickEvent = e =>
{
notificationOverlay.AddBigNotification("<< Prev !Unimplemented!", 1100);
Expand All @@ -65,6 +67,8 @@ private void Load(NotificationOverlay notificationOverlay, BeatmapManager beatma
Icon = FontAwesome.Solid.Play,
Size = new Vector2(16),

TooltipText = "Play",

ClickEvent = _ =>
{
notificationOverlay.AddBigNotification("Play", 1100);
Expand All @@ -91,6 +95,8 @@ private void Load(NotificationOverlay notificationOverlay, BeatmapManager beatma
Icon = FontAwesome.Solid.Pause,
Size = new Vector2(16),

TooltipText = "Pause",

ClickEvent = e =>
{
beatmapManager?.WorkingBeatmap?.Value?.Track?.Start();
Expand Down Expand Up @@ -123,6 +129,8 @@ private void Load(NotificationOverlay notificationOverlay, BeatmapManager beatma
Icon = FontAwesome.Solid.Stop,
Size = new Vector2(16),

TooltipText = "Stop the music!",

ClickEvent = e =>
{
notificationOverlay.AddBigNotification("Stop Playing", 1100);
Expand All @@ -139,6 +147,8 @@ private void Load(NotificationOverlay notificationOverlay, BeatmapManager beatma
Icon = FontAwesome.Solid.StepForward,
Size = new Vector2(16),

TooltipText = "Next track",

ClickEvent = e =>
{
notificationOverlay.AddBigNotification(">> Next !Unimplemented!", 1100);
Expand All @@ -151,6 +161,8 @@ private void Load(NotificationOverlay notificationOverlay, BeatmapManager beatma
Icon = FontAwesome.Solid.Info,
Size = new Vector2(16),

TooltipText = "View song info",

ClickEvent = e =>
{
notificationOverlay.AddBigNotification("Song info will be permanently displayed.", 1100);
Expand All @@ -163,6 +175,8 @@ private void Load(NotificationOverlay notificationOverlay, BeatmapManager beatma
Icon = FontAwesome.Solid.Bars,
Size = new Vector2(16),

TooltipText = "Jump To window",

ClickEvent = e =>
{
notificationOverlay.AddBigNotification("!Unimplemented!", 1100);
Expand All @@ -174,7 +188,9 @@ private void Load(NotificationOverlay notificationOverlay, BeatmapManager beatma

_flow.Add(Progressbar = new DragProgressbar
{
Position = new Vector2(0, 24)
Position = new Vector2(0, 24),

TooltipText = "Drag to seek to a specific point in the song.",
});

Progressbar.Current.ValueChanged += e =>
Expand Down

0 comments on commit b33b294

Please sign in to comment.