From 7c3815d117b63fbafd85461caed78d01cdde7003 Mon Sep 17 00:00:00 2001 From: Yoshman29 Date: Wed, 12 Oct 2022 23:21:10 +0200 Subject: [PATCH] keybinds settings --- Project.xml | 3 + buildnumber.txt | 2 +- source/Main.hx | 3 + source/Options.hx | 6 - source/funkin/menus/FreeplayState.hx | 3 +- source/funkin/menus/MainMenuState.hx | 16 +- source/funkin/menus/StoryMenuState.hx | 6 +- source/funkin/options/KeybindsOptions.hx | 200 +++++++++++++++++++++++ source/funkin/options/Options.hx | 125 ++++++++++++++ source/funkin/options/OptionsMenu.hx | 72 ++++++++ source/funkin/options/OptionsScreen.hx | 16 ++ source/funkin/system/Controls.hx | 84 +++------- source/funkin/system/CoolUtil.hx | 8 + 13 files changed, 466 insertions(+), 78 deletions(-) delete mode 100644 source/Options.hx create mode 100644 source/funkin/options/KeybindsOptions.hx create mode 100644 source/funkin/options/Options.hx create mode 100644 source/funkin/options/OptionsMenu.hx create mode 100644 source/funkin/options/OptionsScreen.hx diff --git a/Project.xml b/Project.xml index cf1975a8..440c0e7d 100644 --- a/Project.xml +++ b/Project.xml @@ -146,4 +146,7 @@ + + + diff --git a/buildnumber.txt b/buildnumber.txt index e8a4e6b7..b0e9f8d0 100644 --- a/buildnumber.txt +++ b/buildnumber.txt @@ -1 +1 @@ -329 \ No newline at end of file +358 \ No newline at end of file diff --git a/source/Main.hx b/source/Main.hx index 2051267c..d518fa32 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -2,6 +2,7 @@ package; import funkin.menus.TitleState; import funkin.game.Highscore; +import funkin.options.Options; import flixel.FlxGame; import flixel.FlxState; import openfl.Assets; @@ -117,6 +118,8 @@ class Main extends Sprite FlxG.fixedTimestep = false; FlxG.autoPause = false; + Options.load(); + var diamond:FlxGraphic = FlxGraphic.fromClass(GraphicTransTileDiamond); diamond.persist = true; diamond.destroyOnNoUse = false; diff --git a/source/Options.hx b/source/Options.hx deleted file mode 100644 index f392a8b1..00000000 --- a/source/Options.hx +++ /dev/null @@ -1,6 +0,0 @@ -package; - -class Options -{ - public static var masterVolume:Float = 1; -} diff --git a/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx index 102a5f3d..62692e5a 100644 --- a/source/funkin/menus/FreeplayState.hx +++ b/source/funkin/menus/FreeplayState.hx @@ -212,6 +212,7 @@ class FreeplayState extends MusicBeatState if (controls.BACK) { + CoolUtil.playMenuSFX(2, 0.4); FlxG.switchState(new MainMenuState()); } @@ -253,7 +254,7 @@ class FreeplayState extends MusicBeatState function changeSelection(change:Int = 0) { - FlxG.sound.play(Paths.sound('scrollMenu'), 0.4); + CoolUtil.playMenuSFX(0, 0.4); curSelected += change; diff --git a/source/funkin/menus/MainMenuState.hx b/source/funkin/menus/MainMenuState.hx index 87ff8884..3228c41b 100644 --- a/source/funkin/menus/MainMenuState.hx +++ b/source/funkin/menus/MainMenuState.hx @@ -17,6 +17,8 @@ import flixel.tweens.FlxTween; import flixel.util.FlxColor; import lime.app.Application; +import funkin.options.OptionsMenu; + using StringTools; class MainMenuState extends MusicBeatState @@ -54,7 +56,7 @@ class MainMenuState extends MusicBeatState var bg:FlxSprite = new FlxSprite(-80).loadGraphic(Paths.image('menuBG')); bg.scrollFactor.x = 0; bg.scrollFactor.y = 0.18; - bg.setGraphicSize(Std.int(bg.width * 1.1)); + bg.scale.set(1.15, 1.15); bg.updateHitbox(); bg.screenCenter(); bg.antialiasing = true; @@ -66,7 +68,7 @@ class MainMenuState extends MusicBeatState magenta = new FlxSprite(-80).loadGraphic(Paths.image('menuDesat')); magenta.scrollFactor.x = 0; magenta.scrollFactor.y = 0.18; - magenta.setGraphicSize(Std.int(magenta.width * 1.1)); + magenta.scale.set(1.15, 1.15); magenta.updateHitbox(); magenta.screenCenter(); magenta.visible = false; @@ -123,13 +125,13 @@ class MainMenuState extends MusicBeatState { if (controls.UP_P) { - FlxG.sound.play(Paths.sound('scrollMenu')); + CoolUtil.playMenuSFX(0); changeItem(-1); } if (controls.DOWN_P) { - FlxG.sound.play(Paths.sound('scrollMenu')); + CoolUtil.playMenuSFX(0); changeItem(1); } @@ -151,7 +153,7 @@ class MainMenuState extends MusicBeatState else { selectedSomethin = true; - FlxG.sound.play(Paths.sound('confirmMenu')); + CoolUtil.playMenuSFX(1); FlxFlicker.flicker(magenta, 1.1, 0.15, false); @@ -173,9 +175,7 @@ class MainMenuState extends MusicBeatState trace("Freeplay Menu Selected"); case 'options': - FlxTransitionableState.skipNextTransIn = true; - FlxTransitionableState.skipNextTransOut = true; - // FlxG.switchState(new OptionsMenu()); + FlxG.switchState(new OptionsMenu()); } }); }); diff --git a/source/funkin/menus/StoryMenuState.hx b/source/funkin/menus/StoryMenuState.hx index 97557695..65c2e041 100644 --- a/source/funkin/menus/StoryMenuState.hx +++ b/source/funkin/menus/StoryMenuState.hx @@ -281,7 +281,7 @@ class StoryMenuState extends MusicBeatState if (controls.BACK && !movedBack && !selectedWeek) { - FlxG.sound.play(Paths.sound('cancelMenu')); + CoolUtil.playMenuSFX(2); movedBack = true; FlxG.switchState(new MainMenuState()); } @@ -299,7 +299,7 @@ class StoryMenuState extends MusicBeatState { if (stopspamming == false) { - FlxG.sound.play(Paths.sound('confirmMenu')); + CoolUtil.playMenuSFX(1); grpWeekText.members[curWeek].startFlashing(); grpWeekCharacters.members[1].animation.play('bfConfirm'); @@ -393,7 +393,7 @@ class StoryMenuState extends MusicBeatState bullShit++; } - FlxG.sound.play(Paths.sound('scrollMenu')); + CoolUtil.playMenuSFX(0); updateText(); } diff --git a/source/funkin/options/KeybindsOptions.hx b/source/funkin/options/KeybindsOptions.hx new file mode 100644 index 00000000..52a84349 --- /dev/null +++ b/source/funkin/options/KeybindsOptions.hx @@ -0,0 +1,200 @@ +package funkin.options; + +import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; +import flixel.addons.transition.FlxTransitionableState; +import flixel.group.FlxGroup.FlxTypedGroup; +import funkin.ui.Alphabet; +import flixel.util.FlxColor; +import flixel.math.FlxMath; +import flixel.FlxObject; +import flixel.FlxSprite; +import flixel.FlxG; + +using StringTools; + +class KeybindsOptions extends MusicBeatState { + public var categories = [ + { + name: 'Notes', + settings: [ + { + name: '{noteLeft}', + control: 'LEFT' + }, + { + name: '{noteDown}', + control: 'DOWN' + }, + { + name: '{noteUp}', + control: 'UP' + }, + { + name: '{noteRight}', + control: 'RIGHT' + }, + { + name: 'Reset', + control: 'RESET' + }, + { + name: 'Pause', + control: 'PAUSE' + }, + ] + }, + { + name: 'UI', + settings: [ + { + name: 'Accept', + control: 'ACCEPT' + }, + { + name: 'Back', + control: 'BACK' + } + ] + } + ]; + + public var curSelected:Int = -1; + public var alphabets:FlxTypedGroup; + public var bg:FlxSprite; + public var coloredBG:FlxSprite; + public var noteColors:Array = [ + 0xFFC24B99, + 0xFF00FFFF, + 0xFF12FA05, + 0xFFF9393F + ]; + public var camFollow:FlxObject = new FlxObject(0, 0, 2, 2); + + public override function create() { + super.create(); + + alphabets = new FlxTypedGroup(); + bg = new FlxSprite(-80).loadGraphic(Paths.image('menuBGBlue')); + coloredBG = new FlxSprite(-80).loadGraphic(Paths.image('menuDesat')); + for(bg in [bg, coloredBG]) { + bg.scrollFactor.set(); + bg.scale.set(1.15, 1.15); + bg.updateHitbox(); + bg.screenCenter(); + bg.antialiasing = true; + add(bg); + } + coloredBG.alpha = 0; + + var k:Int = 0; + for(category in categories) { + k++; + var title = new Alphabet(0, k * 75, category.name, true); + title.screenCenter(X); + add(title); + + k++; + for(e in category.settings) { + // TODO!! + var xOffset:Float = 200; + if (e.name.startsWith('{note')) {// is actually a note!! + var note:FlxSprite = new FlxSprite(100, k * 75); + note.frames = Paths.getSparrowAtlas('NOTE_assets'); + var animName = '${switch(e.name) { + case '{noteLeft}': + "purple"; + case '{noteDown}': + "blue"; + case '{noteUp}': + "green"; + default: + "red"; + }}0'; + e.name = e.name.substring(5, e.name.length - 1); + note.antialiasing = true; + note.animation.addByPrefix('note', animName, 24, true); + note.animation.play('note'); + note.setGraphicSize(75, 75); + note.updateHitbox(); + var min = Math.min(note.scale.x, note.scale.y); + note.scale.set(min, min); + add(note); + } + + var text = new Alphabet(0, k * 75, e.name, true); + text.x = xOffset; + alphabets.add(text); + k++; + } + } + add(alphabets); + changeSelection(1); + + FlxG.camera.follow(camFollow, LOCKON, 0.125); + add(camFollow); + } + + public override function update(elapsed:Float) { + super.update(elapsed); + + if (curSelected < 4) { + if (coloredBG.alpha == 0) + coloredBG.color = noteColors[curSelected]; + else + coloredBG.color = CoolUtil.lerpColor(coloredBG.color, noteColors[curSelected], 0.0625); + + coloredBG.alpha = lerp(coloredBG.alpha, 1, 0.0625); + } else + coloredBG.alpha = lerp(coloredBG.alpha, 0, 0.0625); + + changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0)); + + if (controls.BACK) { + FlxTransitionableState.skipNextTransIn = true; + FlxTransitionableState.skipNextTransOut = true; + FlxG.switchState(new OptionsMenu()); + } + } + + public function changeSelection(change:Int) { + if (change == 0) return; + CoolUtil.playMenuSFX(0, 0.4); + curSelected = FlxMath.wrap(curSelected + change, 0, alphabets.length-1); + alphabets.forEach(function(e) { + e.alpha = 0.6; + }); + if (alphabets.members[curSelected] != null) { + var alphabet = alphabets.members[curSelected]; + alphabet.alpha = 1; + var minH = FlxG.height / 2; + var maxH = alphabets.members[alphabets.length-1].y + alphabets.members[alphabets.length-1].height - (FlxG.height / 2); + if (minH < maxH) + camFollow.setPosition(FlxG.width / 2, FlxMath.bound(alphabet.y + (alphabet.height / 2) + 75, minH, maxH)); + else + camFollow.setPosition(FlxG.width / 2, FlxG.height / 2); + } + } +} + +class KeybindSetting extends FlxTypedGroup { + public var title:Alphabet; + public var bind1:Alphabet; + public function new(x:Float, y:Float, name:String, value:String, ?sparrowIcon:String, ?sparrowAnim:String) { + super(); + title = new Alphabet(0, 0, name, true); + title.setPosition(100, 0); + add(title); + + for(i in 1...2) { + var b = null; + if (i == 1) + b = bind1 = new Alphabet(0, 0, "", false); + else + b = bind2 = new Alphabet(0, 0, "", false); + b.text = "test"; + b.x = FlxG.width * (0.25 * (i+1)); + add(b); + } + setPosition(x, y); + } +} \ No newline at end of file diff --git a/source/funkin/options/Options.hx b/source/funkin/options/Options.hx new file mode 100644 index 00000000..16951808 --- /dev/null +++ b/source/funkin/options/Options.hx @@ -0,0 +1,125 @@ +package funkin.options; + +import flixel.util.FlxSave; +import flixel.input.keyboard.FlxKey; + +class Options +{ + @:dox(hide) public static var __save:FlxSave; + + /** + * GAMEPLAY SETTINGS + */ + public static var naughtyness:Bool = true; + public static var downscroll:Bool = false; + public static var flashingMenu:Bool = true; + public static var camZoomOnBeat:Bool = true; + public static var fpsCounter:Bool = true; + public static var autoPause:Bool = true; + + /** + * PLAYER 1 CONTROLS + */ + public static var P1_LEFT:Array = [A]; + public static var P1_DOWN:Array = [S]; + public static var P1_UP:Array = [W]; + public static var P1_RIGHT:Array = [D]; + public static var P1_ACCEPT:Array = [Z, SPACE, ENTER]; + public static var P1_BACK:Array = [BACKSPACE, ESCAPE]; + public static var P1_PAUSE:Array = [ESCAPE, ENTER, P]; + public static var P1_RESET:Array = [R]; + + /** + * PLAYER 2 CONTROLS (ALT) + */ + public static var P2_LEFT:Array = [LEFT]; + public static var P2_DOWN:Array = [DOWN]; + public static var P2_UP:Array = [UP]; + public static var P2_RIGHT:Array = [RIGHT]; + public static var P2_ACCEPT:Array = []; + public static var P2_BACK:Array = []; + public static var P2_PAUSE:Array = []; + public static var P2_RESET:Array = []; + + /** + * SOLO GETTERS & SETTERS + */ + public static var SOLO_LEFT(get, null):Array; + public static var SOLO_DOWN(get, null):Array; + public static var SOLO_UP(get, null):Array; + public static var SOLO_RIGHT(get, null):Array; + public static var SOLO_ACCEPT(get, null):Array; + public static var SOLO_BACK(get, null):Array; + public static var SOLO_PAUSE(get, null):Array; + public static var SOLO_RESET(get, null):Array; + + // GETTERS REGION + #if REGION + private static function get_SOLO_LEFT() { + var a:Array = []; + for(e in P1_LEFT) a.push(e); + for(e in P2_LEFT) a.push(e); + return a; + } + private static function get_SOLO_DOWN() { + var a:Array = []; + for(e in P1_DOWN) a.push(e); + for(e in P2_DOWN) a.push(e); + return a; + } + private static function get_SOLO_UP() { + var a:Array = []; + for(e in P1_UP) a.push(e); + for(e in P2_UP) a.push(e); + return a; + } + private static function get_SOLO_RIGHT() { + var a:Array = []; + for(e in P1_RIGHT) a.push(e); + for(e in P2_RIGHT) a.push(e); + return a; + } + private static function get_SOLO_ACCEPT() { + var a:Array = []; + for(e in P1_ACCEPT) a.push(e); + for(e in P2_ACCEPT) a.push(e); + return a; + } + private static function get_SOLO_BACK() { + var a:Array = []; + for(e in P1_BACK) a.push(e); + for(e in P2_BACK) a.push(e); + return a; + } + private static function get_SOLO_PAUSE() { + var a:Array = []; + for(e in P1_PAUSE) a.push(e); + for(e in P2_PAUSE) a.push(e); + return a; + } + private static function get_SOLO_RESET() { + var a:Array = []; + for(e in P1_RESET) a.push(e); + for(e in P2_RESET) a.push(e); + return a; + } + #end + + public static function load() { + __save = new FlxSave(); + __save.bind("options"); + for(field in Reflect.fields(__save.data)) { + var obj = Reflect.field(__save.data, field); + Reflect.setProperty(Options, field, obj); + } + } + + public static function save() { + for(field in Reflect.fields(Options)) { + var obj = Reflect.field(Options, field); + if (Reflect.isFunction(obj) || obj is FlxSave) continue; + Reflect.setField(__save.data, field, obj); + } + __save.flush(); + } +} diff --git a/source/funkin/options/OptionsMenu.hx b/source/funkin/options/OptionsMenu.hx new file mode 100644 index 00000000..35116c54 --- /dev/null +++ b/source/funkin/options/OptionsMenu.hx @@ -0,0 +1,72 @@ +package funkin.options; + +import flixel.addons.transition.FlxTransitionableState; +import flixel.group.FlxGroup.FlxTypedGroup; +import funkin.ui.Alphabet; +import flixel.math.FlxMath; +import flixel.FlxSprite; +import flixel.FlxG; +import flixel.effects.FlxFlicker; + +class OptionsMenu extends MusicBeatState { + public var options = [ + { + name: 'Controls', + desc: 'Change Controls for Player 1 and Player 2!', + state: funkin.options.KeybindsOptions + }, + { + name: 'Visuals', + desc: 'Change Gameplay options such as Downscroll, Scroll Speed...', + state: null + } + ]; + + public var curSelected:Int = -1; + public var canSelect:Bool = true; + public var alphabets:FlxTypedGroup; + public override function create() { + var bg:FlxSprite = new FlxSprite(-80).loadGraphic(Paths.image('menuBGBlue')); + bg.scrollFactor.set(); + bg.scale.set(1.15, 1.15); + bg.updateHitbox(); + bg.screenCenter(); + bg.antialiasing = true; + add(bg); + + super.create(); + alphabets = new FlxTypedGroup(); + for(k=>e in options) { + var alphabet = new Alphabet(0, (k+1) * 100, e.name, true, false); + alphabet.screenCenter(X); + alphabets.add(alphabet); + } + add(alphabets); + changeSelection(1); + } + + public override function update(elapsed:Float) { + super.update(elapsed); + if (!canSelect) return; + changeSelection((controls.UP_P ? -1 : 0) + (controls.DOWN_P ? 1 : 0)); + if (controls.ACCEPT && alphabets.members[curSelected] != null) { + CoolUtil.playMenuSFX(1); + FlxFlicker.flicker(alphabets.members[curSelected], 1, 0.06, false, false, function(flick:FlxFlicker) + { + FlxTransitionableState.skipNextTransIn = true; + FlxTransitionableState.skipNextTransOut = true; + FlxG.switchState(Type.createInstance(options[curSelected].state, [])); + }); + } + } + + public function changeSelection(change:Int) { + if (change == 0) return; + CoolUtil.playMenuSFX(0, 0.4); + curSelected = FlxMath.wrap(curSelected + change, 0, options.length-1); + alphabets.forEach(function(e) { + e.alpha = 0.6; + }); + if (alphabets.members[curSelected] != null) alphabets.members[curSelected].alpha = 1; + } +} \ No newline at end of file diff --git a/source/funkin/options/OptionsScreen.hx b/source/funkin/options/OptionsScreen.hx new file mode 100644 index 00000000..60bcd164 --- /dev/null +++ b/source/funkin/options/OptionsScreen.hx @@ -0,0 +1,16 @@ +package funkin.options; + +/** + * Direct replica from Week 7 lol + */ +class OptionsScreen extends MusicBeatState { + public static inline var defaultBGColor:FlxColor = 0xFFFDE871; + + public var bgColor:FlxColor = 0xFFFDE871; + public var bg:FlxSprite; + + public override function create() { + super.create(); + + } +} \ No newline at end of file diff --git a/source/funkin/system/Controls.hx b/source/funkin/system/Controls.hx index 4da0b806..c50fff35 100644 --- a/source/funkin/system/Controls.hx +++ b/source/funkin/system/Controls.hx @@ -1,5 +1,6 @@ package funkin.system; +import funkin.options.Options; import flixel.FlxG; import flixel.input.FlxInput; import flixel.input.actions.FlxAction; @@ -494,73 +495,38 @@ class Controls extends FlxActionSet keyboardScheme = scheme; - #if (haxe >= "4.0.0") switch (scheme) { case Solo: - inline bindKeys(Control.UP, [W, FlxKey.UP]); - inline bindKeys(Control.DOWN, [S, FlxKey.DOWN]); - inline bindKeys(Control.LEFT, [A, FlxKey.LEFT]); - inline bindKeys(Control.RIGHT, [D, FlxKey.RIGHT]); - inline bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]); - inline bindKeys(Control.BACK, [BACKSPACE, ESCAPE]); - inline bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]); - inline bindKeys(Control.RESET, [R]); + inline bindKeys(Control.UP, Options.SOLO_UP); + inline bindKeys(Control.DOWN, Options.SOLO_DOWN); + inline bindKeys(Control.LEFT, Options.SOLO_LEFT); + inline bindKeys(Control.RIGHT, Options.SOLO_RIGHT); + inline bindKeys(Control.ACCEPT, Options.SOLO_ACCEPT); + inline bindKeys(Control.BACK, Options.SOLO_BACK); + inline bindKeys(Control.PAUSE, Options.SOLO_PAUSE); + inline bindKeys(Control.RESET, Options.SOLO_RESET); case Duo(true): - inline bindKeys(Control.UP, [W]); - inline bindKeys(Control.DOWN, [S]); - inline bindKeys(Control.LEFT, [A]); - inline bindKeys(Control.RIGHT, [D]); - inline bindKeys(Control.ACCEPT, [G, Z]); - inline bindKeys(Control.BACK, [H, X]); - inline bindKeys(Control.PAUSE, [ONE]); - inline bindKeys(Control.RESET, [R]); + inline bindKeys(Control.UP, Options.P1_UP); + inline bindKeys(Control.DOWN, Options.P1_DOWN); + inline bindKeys(Control.LEFT, Options.P1_LEFT); + inline bindKeys(Control.RIGHT, Options.P1_RIGHT); + inline bindKeys(Control.ACCEPT, Options.P1_ACCEPT); + inline bindKeys(Control.BACK, Options.P1_BACK); + inline bindKeys(Control.PAUSE, Options.P1_PAUSE); + inline bindKeys(Control.RESET, Options.P1_RESET); case Duo(false): - inline bindKeys(Control.UP, [FlxKey.UP]); - inline bindKeys(Control.DOWN, [FlxKey.DOWN]); - inline bindKeys(Control.LEFT, [FlxKey.LEFT]); - inline bindKeys(Control.RIGHT, [FlxKey.RIGHT]); - inline bindKeys(Control.ACCEPT, [O]); - inline bindKeys(Control.BACK, [P]); - inline bindKeys(Control.PAUSE, [ENTER]); - inline bindKeys(Control.RESET, [BACKSPACE]); + inline bindKeys(Control.UP, Options.P2_UP); + inline bindKeys(Control.DOWN, Options.P2_DOWN); + inline bindKeys(Control.LEFT, Options.P2_LEFT); + inline bindKeys(Control.RIGHT, Options.P2_RIGHT); + inline bindKeys(Control.ACCEPT, Options.P2_ACCEPT); + inline bindKeys(Control.BACK, Options.P2_BACK); + inline bindKeys(Control.PAUSE, Options.P2_PAUSE); + inline bindKeys(Control.RESET, Options.P2_RESET); case None: // nothing case Custom: // nothing } - #else - switch (scheme) - { - case Solo: - bindKeys(Control.UP, [W, FlxKey.UP]); - bindKeys(Control.DOWN, [S, FlxKey.DOWN]); - bindKeys(Control.LEFT, [A, FlxKey.LEFT]); - bindKeys(Control.RIGHT, [D, FlxKey.RIGHT]); - bindKeys(Control.ACCEPT, [Z, SPACE, ENTER]); - bindKeys(Control.BACK, [BACKSPACE, ESCAPE]); - bindKeys(Control.PAUSE, [P, ENTER, ESCAPE]); - bindKeys(Control.RESET, [R]); - case Duo(true): - bindKeys(Control.UP, [W]); - bindKeys(Control.DOWN, [S]); - bindKeys(Control.LEFT, [A]); - bindKeys(Control.RIGHT, [D]); - bindKeys(Control.ACCEPT, [G, Z]); - bindKeys(Control.BACK, [H, X]); - bindKeys(Control.PAUSE, [ONE]); - bindKeys(Control.RESET, [R]); - case Duo(false): - bindKeys(Control.UP, [FlxKey.UP]); - bindKeys(Control.DOWN, [FlxKey.DOWN]); - bindKeys(Control.LEFT, [FlxKey.LEFT]); - bindKeys(Control.RIGHT, [FlxKey.RIGHT]); - bindKeys(Control.ACCEPT, [O]); - bindKeys(Control.BACK, [P]); - bindKeys(Control.PAUSE, [ENTER]); - bindKeys(Control.RESET, [BACKSPACE]); - case None: // nothing - case Custom: // nothing - } - #end } function removeKeyboard() diff --git a/source/funkin/system/CoolUtil.hx b/source/funkin/system/CoolUtil.hx index e72d2b01..87ddd248 100644 --- a/source/funkin/system/CoolUtil.hx +++ b/source/funkin/system/CoolUtil.hx @@ -83,6 +83,14 @@ class CoolUtil return null; } + public static function playMenuSFX(menuSFX:Int = 0, volume:Float = 1) { + FlxG.sound.play(Paths.sound(switch(menuSFX) { + case 1: 'confirmMenu'; + case 2: 'cancelMenu'; + default: 'scrollMenu'; + }), volume); + } + public static function difficultyString():String { return difficultyArray[PlayState.storyDifficulty];