From 8b172ac99da2d27543e72f56eedc0ca8e141ef44 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 18 Aug 2021 23:00:39 -0400 Subject: [PATCH] moving shader stuff in progress --- source/TitleState.hx | 12 +++++++++++- source/shaderslmfao/TitleOutline.hx | 25 ++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/source/TitleState.hx b/source/TitleState.hx index de4579ca4..3e9e7a0b7 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -224,6 +224,7 @@ class TitleState extends MusicBeatState } var logoBl:FlxSprite; + var outlineShaderShit:TitleOutline; var gfDance:FlxSprite; var danceLeft:Bool = false; @@ -267,8 +268,9 @@ class TitleState extends MusicBeatState logoBl.updateHitbox(); + outlineShaderShit = new TitleOutline(); // logoBl.shader = swagShader.shader; - logoBl.shader = new TitleOutline(); + logoBl.shader = outlineShaderShit; // logoBl.shader = alphaShader.shader; // trace(); @@ -390,6 +392,14 @@ class TitleState extends MusicBeatState override function update(elapsed:Float) { + if (FlxG.keys.justPressed.I) + { + FlxTween.tween(outlineShaderShit, {funnyX: 50, funnyY: 50}, 0.6, {ease: FlxEase.quartOut}); + } + if (FlxG.keys.pressed.D) + outlineShaderShit.funnyX += 1; + // outlineShaderShit.xPos.value[0] += 1; + if (FlxG.keys.justPressed.Y) { FlxTween.tween(FlxG.stage.window, {x: FlxG.stage.window.x + 300}, 1.4, {ease: FlxEase.quadInOut, type: PINGPONG, startDelay: 0.35}); diff --git a/source/shaderslmfao/TitleOutline.hx b/source/shaderslmfao/TitleOutline.hx index cf0e331b8..ca4511789 100644 --- a/source/shaderslmfao/TitleOutline.hx +++ b/source/shaderslmfao/TitleOutline.hx @@ -1,13 +1,33 @@ package shaderslmfao; +import flixel.math.FlxPoint; import flixel.system.FlxAssets.FlxShader; class TitleOutline extends FlxShader { + public var funnyX(default, set):Float = 0; + public var funnyY(default, set):Float = 0; + + function set_funnyX(x:Float):Float + { + xPos.value[0] = x; + + return x; + } + + function set_funnyY(y:Float):Float + { + yPos.value[0] = y; + + return y; + } + @:glFragmentSource(' #pragma header // uniform float alphaShit; + uniform float xPos; + uniform float yPos; vec3 rgb2hsv(vec3 c) { @@ -23,7 +43,7 @@ class TitleOutline extends FlxShader void main() { vec4 color = flixel_texture2D(bitmap, openfl_TextureCoordv); - vec2 size = vec2(200, 20); + vec2 size = vec2(xPos, yPos); if (color.a == 0.0) { float w = size.x / openfl_TextureSize.x; @@ -45,5 +65,8 @@ class TitleOutline extends FlxShader public function new() { super(); + + xPos.value = [0]; + yPos.value = [0]; } }