From 60e00766429795fa63a101184b84bc06f1082a72 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 14 Sep 2021 16:40:20 -0400 Subject: [PATCH] moved shader camera stuff to CoolUtil, for use later? --- source/CoolUtil.hx | 23 +++++++++++++++++++++++ source/MainMenuState.hx | 13 ------------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/source/CoolUtil.hx b/source/CoolUtil.hx index afdefa09f..27ba2e415 100644 --- a/source/CoolUtil.hx +++ b/source/CoolUtil.hx @@ -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 diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index f52018913..8d4a8173c 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -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();