1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-01-27 07:17:20 +00:00

stroke shader replacement freeplay text

This commit is contained in:
Cameron Taylor 2021-12-04 22:38:33 -05:00
parent 8795514361
commit 181e950216
2 changed files with 75 additions and 7 deletions

View file

@ -25,6 +25,7 @@ import freeplayStuff.SongMenuItem;
import lime.app.Future;
import lime.utils.Assets;
import shaderslmfao.AngleMask;
import shaderslmfao.StrokeShader;
using StringTools;
@ -201,13 +202,15 @@ class FreeplayState extends MusicBeatSubstate
var fnfFreeplay:FlxText = new FlxText(0, 12, 0, "FREEPLAY", 48);
fnfFreeplay.font = "VCR OSD Mono";
fnfFreeplay.visible = false;
var sillyStroke = new StrokeShader(0xFFFFFFFF, 2, 2);
fnfFreeplay.shader = sillyStroke;
add(fnfFreeplay);
var fnfFreeplayBOLD:FlxSprite = new FlxSprite(0, 12).loadGraphic(Paths.image('freeplayBOLD'));
add(fnfFreeplayBOLD);
fnfFreeplayBOLD.visible = false;
fnfFreeplayBOLD.setGraphicSize(0, 56);
fnfFreeplayBOLD.updateHitbox();
// add(fnfFreeplayBOLD);
// fnfFreeplayBOLD.visible = false;
// fnfFreeplayBOLD.setGraphicSize(0, 56);
// fnfFreeplayBOLD.updateHitbox();
dj.animHITsignal.add(function()
{
@ -216,12 +219,12 @@ class FreeplayState extends MusicBeatSubstate
new FlxTimer().start(1 / 24, function(handShit)
{
fnfFreeplayBOLD.visible = true;
fnfFreeplay.visible = true;
new FlxTimer().start(1.5 / 24, function(bold)
{
fnfFreeplay.visible = true;
fnfFreeplayBOLD.visible = false;
sillyStroke.width = 0;
sillyStroke.height = 0;
});
});

View file

@ -0,0 +1,65 @@
package shaderslmfao;
import flixel.system.FlxAssets.FlxShader;
import flixel.util.FlxColor;
class StrokeShader extends FlxShader
{
// MOSTLY STOLEN FROM AUSTIN EAST LOL!
// https://gist.github.com/AustinEast/d3892fdf6a6079366fffde071f0c2bae
public var width(default, set):Float = 0;
public var height(default, set):Float = 0;
public var col(default, set):FlxColor = 0xFFFFFFFF;
function set_width(val):Float
{
size.value = [val, height];
return val;
}
function set_height(val):Float
{
size.value = [width, val];
return val;
}
function set_col(val:FlxColor):FlxColor
{
color.value = [val.red, val.green, val.blue, val.alpha];
return val;
}
@:glFragmentSource('
#pragma header
uniform vec2 size;
uniform vec4 color;
void main()
{
vec4 sample = flixel_texture2D(bitmap, openfl_TextureCoordv);
if (sample.a == 0.) {
float w = size.x / openfl_TextureSize.x;
float h = size.y / openfl_TextureSize.y;
if (flixel_texture2D(bitmap, vec2(openfl_TextureCoordv.x + w, openfl_TextureCoordv.y)).a != 0.
|| flixel_texture2D(bitmap, vec2(openfl_TextureCoordv.x - w, openfl_TextureCoordv.y)).a != 0.
|| flixel_texture2D(bitmap, vec2(openfl_TextureCoordv.x, openfl_TextureCoordv.y + h)).a != 0.
|| flixel_texture2D(bitmap, vec2(openfl_TextureCoordv.x, openfl_TextureCoordv.y - h)).a != 0.)
sample = color;
}
gl_FragColor = sample;
}
')
public function new(color:FlxColor = 0xFFFFFFFF, width:Float = 1, height:Float = 1)
{
super();
col = color;
this.width = width;
this.height = height;
}
}