1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-27 23:46:45 +00:00

moved shader camera stuff to CoolUtil, for use later?

This commit is contained in:
Cameron Taylor 2021-09-14 16:40:20 -04:00
parent f3bf578d4e
commit 60e0076642
2 changed files with 23 additions and 13 deletions

View file

@ -1,15 +1,21 @@
package;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.graphics.FlxGraphic;
import flixel.graphics.frames.FlxAtlasFrames;
import flixel.math.FlxMath;
import flixel.math.FlxPoint;
import flixel.math.FlxRect;
import flixel.system.FlxAssets.FlxGraphicAsset;
import flixel.tweens.FlxEase;
import flixel.tweens.FlxTween;
import haxe.Json;
import haxe.format.JsonParser;
import lime.math.Rectangle;
import lime.utils.Assets;
import openfl.filters.ShaderFilter;
import shaderslmfao.ScreenWipeShader;
using StringTools;
@ -89,6 +95,23 @@ class CoolUtil
return lerp * (FlxG.elapsed / (1 / 60));
}
public static function coolSwitchState(state:FlxState, transitionTex:String = "shaderTransitionStuff/coolDots", time:Float = 2)
{
var screenShit:FlxSprite = new FlxSprite().loadGraphic(Paths.image("shaderTransitionStuff/coolDots"));
var screenWipeShit:ScreenWipeShader = new ScreenWipeShader();
screenWipeShit.funnyShit.input = screenShit.pixels;
FlxTween.tween(screenWipeShit, {daAlphaShit: 1}, time, {
ease: FlxEase.quadInOut,
onComplete: function(twn)
{
screenShit.destroy();
FlxG.switchState(new MainMenuState());
}
});
FlxG.camera.setFilters([new ShaderFilter(screenWipeShit)]);
}
/**
* Hashlink json encoding fix for some wacky bullshit
* https://github.com/HaxeFoundation/haxe/issues/6930#issuecomment-384570392

View file

@ -252,19 +252,6 @@ class MainMenuState extends MusicBeatState
override function update(elapsed:Float)
{
if (FlxG.keys.justPressed.N)
{
var screenShit:FlxSprite = new FlxSprite().loadGraphic(Paths.image("shaderTransitionStuff/coolDots"));
var screenWipeShit:ScreenWipeShader = new ScreenWipeShader();
screenWipeShit.funnyShit.input = screenShit.pixels;
FlxTween.tween(screenWipeShit, {daAlphaShit: 1}, 2, {ease: FlxEase.quadInOut});
FlxG.camera.setFilters([new ShaderFilter(screenWipeShit)]);
}
if (FlxG.onMobile)
{
var touch:FlxTouch = FlxG.touches.getFirst();