1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-04 20:53:57 +00:00
Funkin/source/funkin/ui/freeplay/CapsuleText.hx

57 lines
1.4 KiB
Haxe
Raw Normal View History

package funkin.ui.freeplay;
2023-08-14 06:49:18 +00:00
import openfl.filters.BitmapFilterQuality;
import flixel.text.FlxText;
import flixel.group.FlxSpriteGroup;
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
{
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)
];
return text = value;
2023-08-14 06:49:18 +00:00
}
}