2017-02-07 12:59:30 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
2017-01-31 17:53:52 +08:00
|
|
|
|
|
2017-02-08 10:19:17 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
2017-01-31 17:53:52 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2017-02-08 10:19:17 +08:00
|
|
|
|
using osu.Framework.MathUtils;
|
|
|
|
|
using OpenTK;
|
|
|
|
|
using OpenTK.Graphics;
|
2017-01-31 17:53:52 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.Sprites
|
|
|
|
|
{
|
2017-02-10 15:26:43 +08:00
|
|
|
|
public class OsuSpriteText : SpriteText
|
2017-01-31 17:53:52 +08:00
|
|
|
|
{
|
|
|
|
|
public const float FONT_SIZE = 16;
|
|
|
|
|
|
|
|
|
|
public OsuSpriteText()
|
|
|
|
|
{
|
|
|
|
|
Shadow = true;
|
|
|
|
|
TextSize = FONT_SIZE;
|
|
|
|
|
}
|
2017-02-08 10:19:17 +08:00
|
|
|
|
|
2017-02-08 15:01:48 +08:00
|
|
|
|
protected override Drawable CreateFallbackCharacterDrawable()
|
2017-02-08 10:19:17 +08:00
|
|
|
|
{
|
|
|
|
|
var tex = GetTextureForCharacter('?');
|
|
|
|
|
|
|
|
|
|
if (tex != null)
|
|
|
|
|
{
|
|
|
|
|
float adjust = (RNG.NextSingle() - 0.5f) * 2;
|
|
|
|
|
return new Sprite
|
|
|
|
|
{
|
|
|
|
|
Texture = tex,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Scale = new Vector2(1 + adjust * 0.2f),
|
|
|
|
|
Rotation = adjust * 15,
|
|
|
|
|
Colour = Color4.White,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-08 15:01:48 +08:00
|
|
|
|
return base.CreateFallbackCharacterDrawable();
|
2017-02-08 10:19:17 +08:00
|
|
|
|
}
|
2017-01-31 17:53:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|