2023-11-07 09:04:22 +00:00
|
|
|
package funkin.ui.freeplay;
|
2023-08-14 06:49:18 +00:00
|
|
|
|
|
|
|
import openfl.filters.BitmapFilterQuality;
|
|
|
|
import flixel.text.FlxText;
|
|
|
|
import flixel.group.FlxSpriteGroup;
|
2023-11-07 09:04:22 +00:00
|
|
|
import funkin.graphics.shaders.GaussianBlurShader;
|
2023-08-14 06:49:18 +00:00
|
|
|
|
|
|
|
class CapsuleText extends FlxSpriteGroup
|
|
|
|
{
|
|
|
|
public var blurredText:FlxText;
|
|
|
|
|
|
|
|
var whiteText:FlxText;
|
|
|
|
|
|
|
|
public var text(default, set):String;
|
|
|
|
|
|
|
|
public function new(x:Float, y:Float, songTitle:String, size:Float)
|
|
|
|
{
|
|
|
|
super(x, y);
|
|
|
|
|
|
|
|
blurredText = initText(songTitle, size);
|
|
|
|
blurredText.shader = new GaussianBlurShader(1);
|
|
|
|
whiteText = initText(songTitle, size);
|
|
|
|
// whiteText.shader = new GaussianBlurShader(0.3);
|
|
|
|
text = songTitle;
|
|
|
|
|
|
|
|
blurredText.color = 0xFF00ccff;
|
|
|
|
whiteText.color = 0xFFFFFFFF;
|
|
|
|
add(blurredText);
|
|
|
|
add(whiteText);
|
|
|
|
}
|
|
|
|
|
|
|
|
function initText(songTitle, size:Float):FlxText
|
|
|
|
{
|
|
|
|
var text:FlxText = new FlxText(0, 0, 0, songTitle, Std.int(size));
|
|
|
|
text.font = "5by7";
|
|
|
|
return text;
|
|
|
|
}
|
|
|
|
|
|
|
|
function set_text(value:String):String
|
|
|
|
{
|
2023-11-29 01:52:45 +00:00
|
|
|
if (value == null) return value;
|
|
|
|
if (blurredText == null || whiteText == null)
|
|
|
|
{
|
|
|
|
trace('WARN: Capsule not initialized properly');
|
|
|
|
return text = value;
|
|
|
|
}
|
|
|
|
|
2023-08-14 06:49:18 +00:00
|
|
|
blurredText.text = value;
|
|
|
|
whiteText.text = value;
|
|
|
|
whiteText.textField.filters = [
|
|
|
|
new openfl.filters.GlowFilter(0x00ccff, 1, 5, 5, 210, BitmapFilterQuality.MEDIUM),
|
|
|
|
// new openfl.filters.BlurFilter(5, 5, BitmapFilterQuality.LOW)
|
|
|
|
];
|
2023-11-29 01:52:45 +00:00
|
|
|
return text = value;
|
2023-08-14 06:49:18 +00:00
|
|
|
}
|
|
|
|
}
|