1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:22:55 +08:00

Button and text.

This commit is contained in:
Huo Yaoyuan 2016-10-24 13:00:06 +08:00
parent 0f2b5e8370
commit b0d72c5f84

View File

@ -1,11 +1,15 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input;
using osu.Game.Graphics;
namespace osu.Game.Overlays
{
@ -13,6 +17,7 @@ namespace osu.Game.Overlays
{
private Sprite background;
private Box progress;
private SpriteText title, artist;
public override void Load(BaseGame game)
{
base.Load(game);
@ -32,6 +37,24 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.Both,
Colour = new Color4(0, 0, 0, 127)
},
title = new SpriteText
{
Origin = Anchor.BottomCentre,
Anchor = Anchor.TopCentre,
Position = new Vector2(0, 40),
TextSize = 20,
Colour = Color4.White,
Text = @"Title Title Title"//placeholder
},
artist = new SpriteText
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Position = new Vector2(0, 45),
TextSize = 12,
Colour = Color4.White,
Text = @"Artist Artist Artist"//placeholder
},
new Box
{
RelativeSizeAxes = Axes.X,
@ -40,6 +63,38 @@ namespace osu.Game.Overlays
Anchor = Anchor.BottomCentre,
Colour = new Color4(0, 0, 0, 127)
},
new ClickableTextAwesome
{
TextSize = 30,
Icon = FontAwesome.play_circle_o,
Origin = Anchor.Centre,
Anchor = Anchor.BottomCentre,
Position = new Vector2(0, 30)
},
new ClickableTextAwesome
{
TextSize = 15,
Icon = FontAwesome.step_backward,
Origin = Anchor.Centre,
Anchor = Anchor.BottomCentre,
Position = new Vector2(-30, 30)
},
new ClickableTextAwesome
{
TextSize = 15,
Icon = FontAwesome.step_forward,
Origin = Anchor.Centre,
Anchor = Anchor.BottomCentre,
Position = new Vector2(30, 30)
},
new ClickableTextAwesome
{
TextSize = 15,
Icon = FontAwesome.bars,
Origin = Anchor.Centre,
Anchor = Anchor.BottomRight,
Position = new Vector2(20, 30)
},
progress = new Box
{
RelativeSizeAxes = Axes.X,
@ -57,4 +112,15 @@ namespace osu.Game.Overlays
protected override void PopOut() => FadeOut(500);
}
public class ClickableTextAwesome : TextAwesome
{
public Action<ClickableTextAwesome> Action;
protected override bool OnClick(InputState state)
{
Action?.Invoke(this);
return true;
}
}
}