moving shader stuff in progress

This commit is contained in:
Cameron Taylor 2021-08-18 23:00:39 -04:00
parent 21e05b72c6
commit 8b172ac99d
2 changed files with 35 additions and 2 deletions

View file

@ -224,6 +224,7 @@ class TitleState extends MusicBeatState
} }
var logoBl:FlxSprite; var logoBl:FlxSprite;
var outlineShaderShit:TitleOutline;
var gfDance:FlxSprite; var gfDance:FlxSprite;
var danceLeft:Bool = false; var danceLeft:Bool = false;
@ -267,8 +268,9 @@ class TitleState extends MusicBeatState
logoBl.updateHitbox(); logoBl.updateHitbox();
outlineShaderShit = new TitleOutline();
// logoBl.shader = swagShader.shader; // logoBl.shader = swagShader.shader;
logoBl.shader = new TitleOutline(); logoBl.shader = outlineShaderShit;
// logoBl.shader = alphaShader.shader; // logoBl.shader = alphaShader.shader;
// trace(); // trace();
@ -390,6 +392,14 @@ class TitleState extends MusicBeatState
override function update(elapsed:Float) 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) 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}); FlxTween.tween(FlxG.stage.window, {x: FlxG.stage.window.x + 300}, 1.4, {ease: FlxEase.quadInOut, type: PINGPONG, startDelay: 0.35});

View file

@ -1,13 +1,33 @@
package shaderslmfao; package shaderslmfao;
import flixel.math.FlxPoint;
import flixel.system.FlxAssets.FlxShader; import flixel.system.FlxAssets.FlxShader;
class TitleOutline extends 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(' @:glFragmentSource('
#pragma header #pragma header
// uniform float alphaShit; // uniform float alphaShit;
uniform float xPos;
uniform float yPos;
vec3 rgb2hsv(vec3 c) vec3 rgb2hsv(vec3 c)
{ {
@ -23,7 +43,7 @@ class TitleOutline extends FlxShader
void main() void main()
{ {
vec4 color = flixel_texture2D(bitmap, openfl_TextureCoordv); vec4 color = flixel_texture2D(bitmap, openfl_TextureCoordv);
vec2 size = vec2(200, 20); vec2 size = vec2(xPos, yPos);
if (color.a == 0.0) { if (color.a == 0.0) {
float w = size.x / openfl_TextureSize.x; float w = size.x / openfl_TextureSize.x;
@ -45,5 +65,8 @@ class TitleOutline extends FlxShader
public function new() public function new()
{ {
super(); super();
xPos.value = [0];
yPos.value = [0];
} }
} }