From 45dc7260b4755dbf4178c65feba55ec0c2304438 Mon Sep 17 00:00:00 2001 From: yugecin Date: Sun, 20 Nov 2016 13:19:21 +0100 Subject: [PATCH] ensure minimumsize for buttons (mods, random map, options, ..) in songmenu and add ctrl+o shortcut to go to options screen (close #58) --- src/itdelatrisu/opsu/states/SongMenu.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/itdelatrisu/opsu/states/SongMenu.java b/src/itdelatrisu/opsu/states/SongMenu.java index cfb2bda6..805e3f78 100644 --- a/src/itdelatrisu/opsu/states/SongMenu.java +++ b/src/itdelatrisu/opsu/states/SongMenu.java @@ -367,9 +367,17 @@ public class SongMenu extends BasicGameState { // selection buttons Image selectionMods = GameImage.SELECTION_MODS.getImage(); - float selectX = width * 0.183f + selectionMods.getWidth() / 2f; - float selectY = height - selectionMods.getHeight() / 2f; - float selectOffset = selectionMods.getWidth() * 1.05f; + int selectButtonsWidth = selectionMods.getWidth(); + int selectButtonsHeight = selectionMods.getHeight(); + if (selectButtonsHeight < 20) { + selectButtonsHeight = 100; + } + if (selectButtonsWidth < 20) { + selectButtonsWidth = 100; + } + float selectX = width * 0.183f + selectButtonsWidth / 2f; + float selectY = height - selectButtonsHeight / 2f; + float selectOffset = selectButtonsWidth * 1.05f; selectModsButton = new MenuButton(GameImage.SELECTION_MODS_OVERLAY.getImage(), selectX, selectY); selectRandomButton = new MenuButton(GameImage.SELECTION_RANDOM_OVERLAY.getImage(), @@ -1063,6 +1071,11 @@ public class SongMenu extends BasicGameState { case Input.KEY_PRIOR: changeIndex(-MAX_SONG_BUTTONS); break; + case Input.KEY_O: + if (input.isKeyDown(Input.KEY_LCONTROL) || input.isKeyDown(Input.KEY_RCONTROL)) { + game.enterState(Opsu.STATE_OPTIONSMENU, new EmptyTransition(), new FadeInTransition()); + } + break; default: // wait for user to finish typing // TODO: accept all characters (current conditions are from TextField class)