From 21e05b72c631e024beac9944bb7583d60437f5fd Mon Sep 17 00:00:00 2001
From: Cameron Taylor <cameron.taylor.ninja@gmail.com>
Date: Mon, 16 Aug 2021 23:20:00 -0600
Subject: [PATCH] outline shader thing in progress

---
 source/FreeplayState.hx             | 10 ++++++
 source/Main.hx                      |  3 ++
 source/TitleState.hx                | 14 +++++++--
 source/shaderslmfao/TitleOutline.hx | 49 +++++++++++++++++++++++++++++
 4 files changed, 74 insertions(+), 2 deletions(-)
 create mode 100644 source/shaderslmfao/TitleOutline.hx

diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx
index bd77b90fb..0979ca617 100644
--- a/source/FreeplayState.hx
+++ b/source/FreeplayState.hx
@@ -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)
diff --git a/source/Main.hx b/source/Main.hx
index 289a3c245..11000f64d 100644
--- a/source/Main.hx
+++ b/source/Main.hx
@@ -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;
 
diff --git a/source/TitleState.hx b/source/TitleState.hx
index e6a0aa516..de4579ca4 100644
--- a/source/TitleState.hx
+++ b/source/TitleState.hx
@@ -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;
diff --git a/source/shaderslmfao/TitleOutline.hx b/source/shaderslmfao/TitleOutline.hx
new file mode 100644
index 000000000..cf0e331b8
--- /dev/null
+++ b/source/shaderslmfao/TitleOutline.hx
@@ -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();
+	}
+}