diff --git a/assets b/assets index fd8251b13..bc7e486ba 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit fd8251b139d482146ed79495865a48676a4d1d68 +Subproject commit bc7e486ba4cf52e55893daa951e58b37059b0adb diff --git a/source/funkin/freeplayStuff/CapsuleText.hx b/source/funkin/freeplayStuff/CapsuleText.hx new file mode 100644 index 000000000..dda687f5e --- /dev/null +++ b/source/funkin/freeplayStuff/CapsuleText.hx @@ -0,0 +1,49 @@ +package funkin.freeplayStuff; + +import openfl.filters.BitmapFilterQuality; +import flixel.text.FlxText; +import flixel.group.FlxSpriteGroup; +import funkin.shaderslmfao.GaussianBlurShader; + +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 + { + 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 value; + } +} diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 33a94cbe0..596dfbed4 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -1,5 +1,6 @@ package funkin.freeplayStuff; +import funkin.shaderslmfao.GaussianBlurShader; import flixel.group.FlxGroup; import flixel.FlxSprite; import flixel.graphics.frames.FlxAtlasFrames; @@ -20,7 +21,7 @@ class SongMenuItem extends FlxSpriteGroup public var songTitle:String = "Test"; - public var songText:FlxText; + public var songText:CapsuleText; public var favIcon:FlxSprite; public var ranking:FlxSprite; @@ -81,9 +82,7 @@ class SongMenuItem extends FlxSpriteGroup ranking.x -= 10; } - songText = new FlxText(capsule.width * 0.26, 45, 0, songTitle, Std.int(40 * realScaled)); - songText.font = "5by7"; - songText.color = 0xFF43C1EA; + songText = new CapsuleText(capsule.width * 0.26, 45, songTitle, Std.int(40 * realScaled)); add(songText); grpHide.add(songText); @@ -91,7 +90,6 @@ class SongMenuItem extends FlxSpriteGroup pixelIcon.makeGraphic(32, 32, 0x00000000); pixelIcon.antialiasing = false; pixelIcon.active = false; - add(pixelIcon); grpHide.add(pixelIcon); @@ -297,6 +295,7 @@ class SongMenuItem extends FlxSpriteGroup // cute one liners, lol! diffGrayscale.setAmount(value ? 0 : 0.8); songText.alpha = value ? 1 : 0.6; + songText.blurredText.visible = value ? true : false; capsule.offset.x = value ? 0 : -5; capsule.animation.play(value ? "selected" : "unselected"); ranking.alpha = value ? 1 : 0.7; diff --git a/source/funkin/shaderslmfao/GaussianBlurShader.hx b/source/funkin/shaderslmfao/GaussianBlurShader.hx new file mode 100644 index 000000000..ad472ac31 --- /dev/null +++ b/source/funkin/shaderslmfao/GaussianBlurShader.hx @@ -0,0 +1,25 @@ +package funkin.shaderslmfao; + +import flixel.addons.display.FlxRuntimeShader; +import funkin.Paths; +import openfl.utils.Assets; + +/** + * Note... not actually gaussian! + */ +class GaussianBlurShader extends FlxRuntimeShader +{ + public var amount:Float; + + public function new(amount:Float = 1.0) + { + super(Assets.getText(Paths.frag("gaussianBlur"))); + setAmount(amount); + } + + public function setAmount(value:Float):Void + { + this.amount = value; + this.setFloat("amount", amount); + } +}