1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-08-19 06:24:56 +00:00

outline shader thing in progress

This commit is contained in:
Cameron Taylor 2021-08-16 23:20:00 -06:00
parent 0e15495796
commit 21e05b72c6
4 changed files with 74 additions and 2 deletions

View file

@ -213,6 +213,16 @@ class FreeplayState extends MusicBeatState
var downP = controls.UI_DOWN_P;
var accepted = controls.ACCEPT;
#if mobile
for (touch in FlxG.touches.list)
{
if (touch.justPressed)
{
accepted = true;
}
}
#end
if (upP)
changeSelection(-1);
if (downP)

View file

@ -2,6 +2,7 @@ package;
import flixel.FlxGame;
import flixel.FlxState;
import flixel.util.FlxColor;
import openfl.Assets;
import openfl.Lib;
import openfl.display.FPS;
@ -93,6 +94,8 @@ class Main extends Sprite
private function setupGame():Void
{
// Lib.current.stage.color = null;
var stageWidth:Int = Lib.current.stage.stageWidth;
var stageHeight:Int = Lib.current.stage.stageHeight;

View file

@ -36,6 +36,7 @@ import openfl.net.NetStream;
import shaderslmfao.BuildingShaders.BuildingShader;
import shaderslmfao.BuildingShaders;
import shaderslmfao.ColorSwap;
import shaderslmfao.TitleOutline;
import ui.PreferencesMenu;
import ui.stageBuildShit.StageBuilderState;
@ -266,7 +267,8 @@ class TitleState extends MusicBeatState
logoBl.updateHitbox();
logoBl.shader = swagShader.shader;
// logoBl.shader = swagShader.shader;
logoBl.shader = new TitleOutline();
// logoBl.shader = alphaShader.shader;
// trace();
@ -282,6 +284,8 @@ class TitleState extends MusicBeatState
gfDance.shader = swagShader.shader;
// gfDance.shader = new TitleOutline();
add(logoBl);
titleText = new FlxSprite(100, FlxG.height * 0.8);
@ -302,7 +306,7 @@ class TitleState extends MusicBeatState
// FlxTween.tween(logoBl, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG});
// FlxTween.tween(logo, {y: logoBl.y + 50}, 0.6, {ease: FlxEase.quadInOut, type: PINGPONG, startDelay: 0.1});
var animShit:ComboCounter = new ComboCounter(200, 200, 1423);
add(animShit);
// add(animShit);
credGroup = new FlxGroup();
add(credGroup);
@ -381,6 +385,9 @@ class TitleState extends MusicBeatState
var transitioning:Bool = false;
var fnfShit:String = "Friday Night Funkin'";
var thingOffset:Int = 0;
override function update(elapsed:Float)
{
if (FlxG.keys.justPressed.Y)
@ -450,7 +457,10 @@ class TitleState extends MusicBeatState
for (touch in FlxG.touches.list)
{
if (touch.justPressed)
{
FlxG.switchState(new FreeplayState());
pressedEnter = true;
}
}
#end
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;

View file

@ -0,0 +1,49 @@
package shaderslmfao;
import flixel.system.FlxAssets.FlxShader;
class TitleOutline extends FlxShader
{
@:glFragmentSource('
#pragma header
// uniform float alphaShit;
vec3 rgb2hsv(vec3 c)
{
vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));
vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));
float d = q.x - min(q.w, q.y);
float e = 1.0e-10;
return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
}
void main()
{
vec4 color = flixel_texture2D(bitmap, openfl_TextureCoordv);
vec2 size = vec2(200, 20);
if (color.a == 0.0) {
float w = size.x / openfl_TextureSize.x;
float h = size.y / openfl_TextureSize.y;
vec4 colorOffset = flixel_texture2D(bitmap, vec2(openfl_TextureCoordv.x - w, openfl_TextureCoordv.y - h));
vec3 hsvShit = rgb2hsv(vec3(colorOffset.r, colorOffset.g, colorOffset.b));
if (hsvShit.b <= 0.1 && colorOffset.a != 0.)
color = vec4(0.0, 1.0, 0.8, color.a);
}
gl_FragColor = color;
}
')
public function new()
{
super();
}
}