ensure minimumsize for buttons (mods, random map, options, ..) in songmenu and add ctrl+o shortcut to go to options screen (close #58)

This commit is contained in:
yugecin 2016-11-20 13:19:21 +01:00
parent e025fd70d5
commit 45dc7260b4

View File

@ -367,9 +367,17 @@ public class SongMenu extends BasicGameState {
// selection buttons // selection buttons
Image selectionMods = GameImage.SELECTION_MODS.getImage(); Image selectionMods = GameImage.SELECTION_MODS.getImage();
float selectX = width * 0.183f + selectionMods.getWidth() / 2f; int selectButtonsWidth = selectionMods.getWidth();
float selectY = height - selectionMods.getHeight() / 2f; int selectButtonsHeight = selectionMods.getHeight();
float selectOffset = selectionMods.getWidth() * 1.05f; 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(), selectModsButton = new MenuButton(GameImage.SELECTION_MODS_OVERLAY.getImage(),
selectX, selectY); selectX, selectY);
selectRandomButton = new MenuButton(GameImage.SELECTION_RANDOM_OVERLAY.getImage(), selectRandomButton = new MenuButton(GameImage.SELECTION_RANDOM_OVERLAY.getImage(),
@ -1063,6 +1071,11 @@ public class SongMenu extends BasicGameState {
case Input.KEY_PRIOR: case Input.KEY_PRIOR:
changeIndex(-MAX_SONG_BUTTONS); changeIndex(-MAX_SONG_BUTTONS);
break; 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: default:
// wait for user to finish typing // wait for user to finish typing
// TODO: accept all characters (current conditions are from TextField class) // TODO: accept all characters (current conditions are from TextField class)