From 76f29d797abfa7f7b5d1864762a1eca497a2679d Mon Sep 17 00:00:00 2001 From: Yoshman29 <81191621+YoshiCrafter29@users.noreply.github.com> Date: Tue, 20 Dec 2022 23:14:42 +0100 Subject: [PATCH] homosexual update screen --- assets/shaders/updaterShader.frag | 34 ++++++++++++++++++++++++++ buildnumber.txt | 2 +- source/funkin/updating/UpdateScreen.hx | 11 +++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 assets/shaders/updaterShader.frag diff --git a/assets/shaders/updaterShader.frag b/assets/shaders/updaterShader.frag new file mode 100644 index 00000000..6f26da11 --- /dev/null +++ b/assets/shaders/updaterShader.frag @@ -0,0 +1,34 @@ +#pragma header + +uniform float elapsed; +uniform float strength; + +vec3 rgb2hsv(vec3 c) +{ + vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); + vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); +} + +vec3 hsv2rgb(vec3 c) +{ + vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); +} + +void main() { + vec2 coords = getCamPos(openfl_TextureCoordv); + vec4 color = flixel_texture2D(bitmap, openfl_TextureCoordv); + vec3 hsv = rgb2hsv(color.rgb); + + hsv.g = (1.0/3.0) * strength * coords.y; + + hsv.r = mod(elapsed + coords.x + coords.y, 1); + + gl_FragColor = vec4(hsv2rgb(hsv), color.a); +} \ No newline at end of file diff --git a/buildnumber.txt b/buildnumber.txt index 3dfef23a..54d8728c 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -1598 \ No newline at end of file +1601 \ No newline at end of file diff --git a/source/funkin/updating/UpdateScreen.hx b/source/funkin/updating/UpdateScreen.hx index 37c1719e..3fabe4b4 100644 --- a/source/funkin/updating/UpdateScreen.hx +++ b/source/funkin/updating/UpdateScreen.hx @@ -1,5 +1,6 @@ package funkin.updating; +import funkin.shaders.CustomShader; import flixel.util.FlxDestroyUtil; import funkin.ui.FunkinText; import funkin.menus.TitleState; @@ -24,6 +25,8 @@ class UpdateScreen extends MusicBeatState { public var generalProgress:FunkinText; public var partProgress:FunkinText; + public var rainbowShader:CustomShader; + public function new(check:UpdateCheckCallback) { super(false); updater = new AsyncUpdater(check.updates); @@ -59,6 +62,8 @@ class UpdateScreen extends MusicBeatState { overSound = FlxG.sound.load(Paths.sound('gameOverEnd')); updater.execute(); + + FlxG.camera.addShader(rainbowShader = new CustomShader("updaterShader")); } @@ -66,6 +71,12 @@ class UpdateScreen extends MusicBeatState { super.update(elapsed); elapsedTime += elapsed; + rainbowShader.hset("elapsed", elapsedTime / 5); + if (elapsedTime >= 3) + rainbowShader.hset("strength", 1); + else + rainbowShader.hset("strength", elapsedTime / 5); + progressBar.y = FlxG.height - (60 + (Math.sin(elapsedTime * Math.PI / 2) * 15)); if (done) return;