mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-03-24 19:09:21 +00:00
proper result screen masking !
This commit is contained in:
parent
3f28fdb92c
commit
6a01c3008c
source/funkin
|
@ -11,6 +11,7 @@ import flixel.util.FlxDirectionFlags;
|
||||||
import flixel.util.FlxTimer;
|
import flixel.util.FlxTimer;
|
||||||
import funkin.audiovis.SpectogramSprite;
|
import funkin.audiovis.SpectogramSprite;
|
||||||
import funkin.shaderslmfao.ColorSwap;
|
import funkin.shaderslmfao.ColorSwap;
|
||||||
|
import funkin.shaderslmfao.LeftMaskShader;
|
||||||
import funkin.shaderslmfao.TitleOutline;
|
import funkin.shaderslmfao.TitleOutline;
|
||||||
import funkin.ui.AtlasText;
|
import funkin.ui.AtlasText;
|
||||||
import funkin.util.Constants;
|
import funkin.util.Constants;
|
||||||
|
@ -133,6 +134,7 @@ class TitleState extends MusicBeatState
|
||||||
var gfDance:FlxSprite;
|
var gfDance:FlxSprite;
|
||||||
var danceLeft:Bool = false;
|
var danceLeft:Bool = false;
|
||||||
var titleText:FlxSprite;
|
var titleText:FlxSprite;
|
||||||
|
var maskShader = new LeftMaskShader();
|
||||||
|
|
||||||
function startIntro()
|
function startIntro()
|
||||||
{
|
{
|
||||||
|
@ -166,6 +168,9 @@ class TitleState extends MusicBeatState
|
||||||
|
|
||||||
add(gfDance);
|
add(gfDance);
|
||||||
|
|
||||||
|
// maskShader.swagSprX = gfDance.x;
|
||||||
|
// maskShader.swagMaskX = gfDance.x + 200;
|
||||||
|
// maskShader.frameUV = gfDance.frame.uv;
|
||||||
// gfDance.shader = maskShader;
|
// gfDance.shader = maskShader;
|
||||||
|
|
||||||
// gfDance.shader = swagShader.shader;
|
// gfDance.shader = swagShader.shader;
|
||||||
|
@ -436,6 +441,17 @@ class TitleState extends MusicBeatState
|
||||||
super.update(elapsed);
|
super.update(elapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override function draw()
|
||||||
|
{
|
||||||
|
super.draw();
|
||||||
|
|
||||||
|
// if (gfDance != null)
|
||||||
|
// {
|
||||||
|
// trace(gfDance.frame.uv);
|
||||||
|
// maskShader.frameUV = gfDance.frame.uv;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
var cheatArray:Array<Int> = [0x0001, 0x0010, 0x0001, 0x0010, 0x0100, 0x1000, 0x0100, 0x1000];
|
var cheatArray:Array<Int> = [0x0001, 0x0010, 0x0001, 0x0010, 0x0100, 0x1000, 0x0100, 0x1000];
|
||||||
var curCheatPos:Int = 0;
|
var curCheatPos:Int = 0;
|
||||||
var cheatActive:Bool = false;
|
var cheatActive:Bool = false;
|
||||||
|
|
|
@ -6,6 +6,7 @@ import flixel.graphics.frames.FlxAtlasFrames;
|
||||||
import flixel.graphics.frames.FlxBitmapFont;
|
import flixel.graphics.frames.FlxBitmapFont;
|
||||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||||
import flixel.math.FlxPoint;
|
import flixel.math.FlxPoint;
|
||||||
|
import flixel.math.FlxRect;
|
||||||
import flixel.text.FlxBitmapText;
|
import flixel.text.FlxBitmapText;
|
||||||
import flixel.text.FlxText;
|
import flixel.text.FlxText;
|
||||||
import flixel.tweens.FlxEase;
|
import flixel.tweens.FlxEase;
|
||||||
|
@ -121,7 +122,7 @@ class ResultState extends MusicBeatSubstate
|
||||||
songName.shader = maskShaderSongName;
|
songName.shader = maskShaderSongName;
|
||||||
difficulty.shader = maskShaderDifficulty;
|
difficulty.shader = maskShaderDifficulty;
|
||||||
|
|
||||||
maskShaderSongName.swagMaskX = difficulty.x - 15;
|
// maskShaderSongName.swagMaskX = difficulty.x - 15;
|
||||||
maskShaderDifficulty.swagMaskX = difficulty.x - 15;
|
maskShaderDifficulty.swagMaskX = difficulty.x - 15;
|
||||||
|
|
||||||
var blackTopBar:FlxSprite = new FlxSprite().loadGraphic(Paths.image("resultScreen/topBarBlack"));
|
var blackTopBar:FlxSprite = new FlxSprite().loadGraphic(Paths.image("resultScreen/topBarBlack"));
|
||||||
|
@ -252,9 +253,23 @@ class ResultState extends MusicBeatSubstate
|
||||||
var movingSongStuff:Bool = false;
|
var movingSongStuff:Bool = false;
|
||||||
var speedOfTween:FlxPoint = FlxPoint.get(-1, 0.1);
|
var speedOfTween:FlxPoint = FlxPoint.get(-1, 0.1);
|
||||||
|
|
||||||
|
override function draw():Void
|
||||||
|
{
|
||||||
|
super.draw();
|
||||||
|
|
||||||
|
if (songName != null)
|
||||||
|
{
|
||||||
|
songName.clipRect = FlxRect.get(Math.max(0, 540 - songName.x), 0, FlxG.width, songName.height);
|
||||||
|
// PROBABLY SHOULD FIX MEMORY FREE OR WHATEVER THE PUT() FUNCTION DOES !!!! FEELS LIKE IT STUTTERS!!!
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (songName != null && songName.frame != null)
|
||||||
|
// maskShaderSongName.frameUV = songName.frame.uv;
|
||||||
|
}
|
||||||
|
|
||||||
override function update(elapsed:Float)
|
override function update(elapsed:Float)
|
||||||
{
|
{
|
||||||
maskShaderSongName.swagSprX = songName.x;
|
// maskShaderSongName.swagSprX = songName.x;
|
||||||
maskShaderDifficulty.swagSprX = difficulty.x;
|
maskShaderDifficulty.swagSprX = difficulty.x;
|
||||||
|
|
||||||
if (movingSongStuff)
|
if (movingSongStuff)
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
package funkin.shaderslmfao;
|
package funkin.shaderslmfao;
|
||||||
|
|
||||||
|
import flixel.math.FlxRect;
|
||||||
import flixel.system.FlxAssets.FlxShader;
|
import flixel.system.FlxAssets.FlxShader;
|
||||||
|
|
||||||
class LeftMaskShader extends FlxShader
|
class LeftMaskShader extends FlxShader
|
||||||
{
|
{
|
||||||
public var swagMaskX(default, set):Float = 0;
|
public var swagMaskX(default, set):Float = 0;
|
||||||
public var swagSprX(default, set):Float = 0;
|
public var swagSprX(default, set):Float = 0;
|
||||||
|
public var frameUV(default, set):FlxRect;
|
||||||
|
|
||||||
function set_swagSprX(x:Float):Float
|
function set_swagSprX(x:Float):Float
|
||||||
{
|
{
|
||||||
|
@ -21,12 +23,26 @@ class LeftMaskShader extends FlxShader
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function set_frameUV(uv:FlxRect):FlxRect
|
||||||
|
{
|
||||||
|
trace("SETTING FRAMEUV");
|
||||||
|
trace(uv);
|
||||||
|
|
||||||
|
uvFrameX.value[0] = uv.x;
|
||||||
|
uvFrameY.value[0] = uv.y;
|
||||||
|
|
||||||
|
return uv;
|
||||||
|
}
|
||||||
|
|
||||||
@:glFragmentSource('
|
@:glFragmentSource('
|
||||||
#pragma header
|
#pragma header
|
||||||
|
|
||||||
uniform float sprX;
|
uniform float sprX;
|
||||||
uniform float maskX;
|
uniform float maskX;
|
||||||
|
|
||||||
|
uniform float uvFrameX;
|
||||||
|
uniform float uvFrameY;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -37,12 +53,15 @@ class LeftMaskShader extends FlxShader
|
||||||
|
|
||||||
vec4 color = flixel_texture2D(bitmap, uv);
|
vec4 color = flixel_texture2D(bitmap, uv);
|
||||||
|
|
||||||
if (uv.x < sprPos)
|
if (uv.x < sprPos + uvFrameX)
|
||||||
{
|
{
|
||||||
color = vec4(0.0, 0.0, 0.0, 0.0);
|
color = vec4(0.0, 0.0, 0.0, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_FragColor = color;
|
gl_FragColor = color;
|
||||||
|
// vec4 testCol = vec4(openfl_Position.x, openfl_Position.y, openfl_Position.z, 1.0);
|
||||||
|
//gl_FragColor = vec4(1.0, openfl_TextureSize.x, 1.0, 1.0);
|
||||||
|
|
||||||
}
|
}
|
||||||
')
|
')
|
||||||
public function new()
|
public function new()
|
||||||
|
@ -51,5 +70,7 @@ class LeftMaskShader extends FlxShader
|
||||||
|
|
||||||
sprX.value = [0];
|
sprX.value = [0];
|
||||||
maskX.value = [0];
|
maskX.value = [0];
|
||||||
|
uvFrameX.value = [0];
|
||||||
|
uvFrameY.value = [0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue