From eacd76a0fa1437f118413054a9e8c5c25956423a Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 11 Aug 2023 21:45:34 -0400 Subject: [PATCH] difficulty rankings and grayscale mockup --- art | 2 +- assets | 2 +- source/funkin/freeplayStuff/SongMenuItem.hx | 14 +++++++++++++ source/funkin/shaderslmfao/Grayscale.hx | 22 +++++++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 source/funkin/shaderslmfao/Grayscale.hx diff --git a/art b/art index f4acf8d6e..fbe23f8b5 160000 --- a/art +++ b/art @@ -1 +1 @@ -Subproject commit f4acf8d6e1981ea4d1a28e7e512e335b2a4f261f +Subproject commit fbe23f8b59831ca0123727a35e02cdfb49f3ce60 diff --git a/assets b/assets index abbbc89a8..e5aad64d7 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit abbbc89a83f48317568b5b25eaf831ae16f88a8c +Subproject commit e5aad64d7b5201d23cd28cf740cff48fae6ebf74 diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 184846805..780a7b2ad 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -8,6 +8,7 @@ import flixel.math.FlxMath; import flixel.math.FlxPoint; import flixel.text.FlxText; import flixel.util.FlxTimer; +import funkin.shaderslmfao.Grayscale; class SongMenuItem extends FlxSpriteGroup { @@ -24,6 +25,11 @@ class SongMenuItem extends FlxSpriteGroup var ranks:Array = ["fail", "average", "great", "excellent", "perfect"]; + // lol... + var diffRanks:Array = [ + "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "14", "15" + ]; + public var targetPos:FlxPoint = new FlxPoint(); public var doLerp:Bool = false; public var doJumpIn:Bool = false; @@ -31,6 +37,7 @@ class SongMenuItem extends FlxSpriteGroup public var doJumpOut:Bool = false; public var onConfirm:Void->Void; + public var diffGrayscale:Grayscale; public function new(x:Float, y:Float, song:String, ?character:String) { @@ -53,6 +60,12 @@ class SongMenuItem extends FlxSpriteGroup ranking.alpha = 0.75; add(ranking); + diffGrayscale = new Grayscale(1); + + var diffRank = new FlxSprite(145, 90).loadGraphic(Paths.image("freeplay/diffRankings/diff" + FlxG.random.getObject(diffRanks))); + diffRank.shader = diffGrayscale; + add(diffRank); + switch (rank) { case "perfect": @@ -236,6 +249,7 @@ class SongMenuItem extends FlxSpriteGroup function set_selected(value:Bool):Bool { // cute one liners, lol! + diffGrayscale.setAmount(value ? 0 : 0.8); songText.alpha = value ? 1 : 0.6; capsule.offset.x = value ? 0 : -5; capsule.animation.play(value ? "selected" : "unselected"); diff --git a/source/funkin/shaderslmfao/Grayscale.hx b/source/funkin/shaderslmfao/Grayscale.hx new file mode 100644 index 000000000..016d64b46 --- /dev/null +++ b/source/funkin/shaderslmfao/Grayscale.hx @@ -0,0 +1,22 @@ +package funkin.shaderslmfao; + +import flixel.addons.display.FlxRuntimeShader; +import funkin.Paths; +import openfl.utils.Assets; + +class Grayscale extends FlxRuntimeShader +{ + public var amount:Float = 1; + + public function new(amount:Float = 1) + { + super(Assets.getText(Paths.frag("grayscale"))); + setAmount(amount); + } + + public function setAmount(value:Float):Void + { + amount = value; + this.setFloat("amount", amount); + } +}