mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-23 16:17:53 -05:00
pico stage shader
This commit is contained in:
parent
8f2b147d58
commit
2f63837430
3 changed files with 67 additions and 1 deletions
|
@ -43,6 +43,8 @@ import openfl.display.BitmapData;
|
|||
import openfl.display.BlendMode;
|
||||
import openfl.display.StageQuality;
|
||||
import openfl.filters.ShaderFilter;
|
||||
import shaderslmfao.BuildingShaders.BuildingShader;
|
||||
import shaderslmfao.BuildingShaders;
|
||||
import shaderslmfao.ColorSwap;
|
||||
import ui.PreferencesMenu;
|
||||
|
||||
|
@ -157,6 +159,7 @@ class PlayState extends MusicBeatState
|
|||
#end
|
||||
|
||||
var camPos:FlxPoint;
|
||||
var lightFadeShader:BuildingShaders;
|
||||
|
||||
override public function create()
|
||||
{
|
||||
|
@ -254,7 +257,9 @@ class PlayState extends MusicBeatState
|
|||
city.updateHitbox();
|
||||
add(city);
|
||||
|
||||
lightFadeShader = new BuildingShaders();
|
||||
phillyCityLights = new FlxTypedGroup<FlxSprite>();
|
||||
|
||||
add(phillyCityLights);
|
||||
|
||||
for (i in 0...5)
|
||||
|
@ -265,6 +270,7 @@ class PlayState extends MusicBeatState
|
|||
light.setGraphicSize(Std.int(light.width * 0.85));
|
||||
light.updateHitbox();
|
||||
light.antialiasing = true;
|
||||
light.shader = lightFadeShader.shader;
|
||||
phillyCityLights.add(light);
|
||||
}
|
||||
|
||||
|
@ -936,6 +942,7 @@ class PlayState extends MusicBeatState
|
|||
var vid:FlxVideo = new FlxVideo('music/ughCutscene.mp4');
|
||||
vid.finishCallback = function()
|
||||
{
|
||||
FlxTween.tween(FlxG.camera, {zoom: defaultCamZoom}, (Conductor.crochet / 1000) * 5, {ease: FlxEase.quadInOut});
|
||||
startCountdown();
|
||||
cameraMovement();
|
||||
};
|
||||
|
@ -1942,7 +1949,8 @@ class PlayState extends MusicBeatState
|
|||
trainFrameTiming = 0;
|
||||
}
|
||||
}
|
||||
// phillyCityLights.members[curLight].alpha -= (Conductor.crochet / 1000) * FlxG.elapsed;
|
||||
|
||||
lightFadeShader.update((Conductor.crochet / 1000) * FlxG.elapsed * 1.5); // phillyCityLights.members[curLight].alpha -= (Conductor.crochet / 1000) * FlxG.elapsed;
|
||||
}
|
||||
|
||||
super.update(elapsed);
|
||||
|
@ -3002,6 +3010,8 @@ class PlayState extends MusicBeatState
|
|||
|
||||
if (curBeat % 4 == 0)
|
||||
{
|
||||
lightFadeShader.reset();
|
||||
|
||||
phillyCityLights.forEach(function(light:FlxSprite)
|
||||
{
|
||||
light.visible = false;
|
||||
|
|
|
@ -29,6 +29,8 @@ import openfl.events.NetStatusEvent;
|
|||
import openfl.media.Video;
|
||||
import openfl.net.NetConnection;
|
||||
import openfl.net.NetStream;
|
||||
import shaderslmfao.BuildingShaders.BuildingShader;
|
||||
import shaderslmfao.BuildingShaders;
|
||||
import shaderslmfao.ColorSwap;
|
||||
import ui.PreferencesMenu;
|
||||
|
||||
|
@ -57,6 +59,7 @@ class TitleState extends MusicBeatState
|
|||
var wackyImage:FlxSprite;
|
||||
var lastBeat:Int = 0;
|
||||
var swagShader:ColorSwap;
|
||||
var alphaShader:BuildingShaders;
|
||||
var thingie:FlxSprite;
|
||||
|
||||
var video:Video;
|
||||
|
@ -73,6 +76,7 @@ class TitleState extends MusicBeatState
|
|||
FlxG.game.focusLostFramerate = 60;
|
||||
|
||||
swagShader = new ColorSwap();
|
||||
alphaShader = new BuildingShaders();
|
||||
|
||||
FlxG.sound.muteKeys = [ZERO];
|
||||
|
||||
|
@ -249,6 +253,7 @@ class TitleState extends MusicBeatState
|
|||
logoBl.updateHitbox();
|
||||
|
||||
logoBl.shader = swagShader.shader;
|
||||
// logoBl.shader = alphaShader.shader;
|
||||
|
||||
// trace();
|
||||
// logoBl.screenCenter();
|
||||
|
@ -465,11 +470,13 @@ class TitleState extends MusicBeatState
|
|||
if (controls.UI_LEFT)
|
||||
{
|
||||
swagShader.update(-elapsed * 0.1);
|
||||
// alphaShader.update(-elapsed * 0.1);
|
||||
}
|
||||
|
||||
if (controls.UI_RIGHT)
|
||||
{
|
||||
swagShader.update(elapsed * 0.1);
|
||||
// alphaShader.update(elapsed * 0.1);
|
||||
}
|
||||
|
||||
super.update(elapsed);
|
||||
|
|
49
source/shaderslmfao/BuildingShaders.hx
Normal file
49
source/shaderslmfao/BuildingShaders.hx
Normal file
|
@ -0,0 +1,49 @@
|
|||
package shaderslmfao;
|
||||
|
||||
import flixel.system.FlxAssets.FlxShader;
|
||||
|
||||
class BuildingShaders
|
||||
{
|
||||
public var shader(default, null):BuildingShader;
|
||||
public var daAlpha:Float = 1;
|
||||
|
||||
public function new():Void
|
||||
{
|
||||
shader = new BuildingShader();
|
||||
shader.alphaShit.value = [0];
|
||||
}
|
||||
|
||||
public function update(elapsed:Float):Void
|
||||
{
|
||||
shader.alphaShit.value[0] += elapsed;
|
||||
}
|
||||
|
||||
public function reset()
|
||||
{
|
||||
shader.alphaShit.value[0] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
class BuildingShader extends FlxShader
|
||||
{
|
||||
@:glFragmentSource('
|
||||
#pragma header
|
||||
|
||||
uniform float alphaShit;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = flixel_texture2D(bitmap, openfl_TextureCoordv);
|
||||
|
||||
if (color.a > 0.0)
|
||||
color -= alphaShit;
|
||||
|
||||
gl_FragColor = color;
|
||||
}
|
||||
|
||||
')
|
||||
public function new()
|
||||
{
|
||||
super();
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue