More graphical updates, some code cleanup, and minor fixes.

- The MenuButton class now fully supports hover effects (scale, fade, rotate) for Animations.
- Used a fixed location for the selection buttons in the song menu (previously based on the "back" button width, which varies widely in different skins).
- Added hover effects for "retry" and "exit" buttons in the ranking screen.
- Changed animation speed of back/skip buttons.
- Fixed a bug where main menu showed the incorrect number of songs loaded during searches.
- Removed unneeded draw() methods in Utils for color filters (since 69f5aa5).
- Moved Utils.drawCentered(Image, ...) into the Image class.
- Added overwritten Image class to Maven excludes.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-02-19 00:33:32 -05:00
parent 1a4120a736
commit 25a7a826f1
14 changed files with 107 additions and 108 deletions

View File

@@ -485,7 +485,7 @@ public class ButtonMenu extends BasicGameState {
RESET_MODS ("Reset All Mods", Color.red) {
@Override
public void click(GameContainer container, StateBasedGame game) {
SoundController.playSound(SoundEffect.MENUHIT);
SoundController.playSound(SoundEffect.MENUCLICK);
for (GameMod mod : GameMod.values()) {
if (mod.isActive())
mod.toggle(false);

View File

@@ -810,7 +810,7 @@ public class Game extends BasicGameState {
// skip button
if (GameImage.SKIP.getImages() != null) {
Animation skip = GameImage.SKIP.getAnimation(200);
Animation skip = GameImage.SKIP.getAnimation(120);
skipButton = new MenuButton(skip, width - skip.getWidth() / 2f, height - (skip.getHeight() / 2f));
} else {
Image skip = GameImage.SKIP.getImage();

View File

@@ -84,6 +84,8 @@ public class GameRanking extends BasicGameState {
width - (exit.getWidth() / 2f),
(height * 0.97f) - (exit.getHeight() / 2f)
);
retryButton.setHoverFade(0.6f);
exitButton.setHoverFade(0.6f);
}
@Override
@@ -119,6 +121,10 @@ public class GameRanking extends BasicGameState {
Utils.updateCursor(delta);
Utils.updateVolumeDisplay(delta);
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
if (data.isGameplay()) {
retryButton.hoverUpdate(delta, mouseX, mouseY);
exitButton.hoverUpdate(delta, mouseX, mouseY);
}
Utils.getBackButton().hoverUpdate(delta, mouseX, mouseY);
}
@@ -174,8 +180,11 @@ public class GameRanking extends BasicGameState {
if (!data.isGameplay()) {
if (!MusicController.isTrackDimmed())
MusicController.toggleTrackDimmed(0.5f);
} else
} else {
SoundController.playSound(SoundEffect.APPLAUSE);
retryButton.resetHover();
exitButton.resetHover();
}
}
@Override

View File

@@ -236,7 +236,7 @@ public class MainMenu extends BasicGameState {
g.setFont(Utils.FONT_MEDIUM);
int lineHeight = Utils.FONT_MEDIUM.getLineHeight() * 9 / 10;
g.drawString(String.format("Loaded %d songs and %d beatmaps.",
OsuGroupList.get().size(), OsuGroupList.get().getMapCount()), marginX, marginY);
OsuGroupList.get().getMapSetCount(), OsuGroupList.get().getMapCount()), marginX, marginY);
if (MusicController.isTrackLoading())
g.drawString("Track loading...", marginX, marginY + lineHeight);
else if (MusicController.trackExists()) {

View File

@@ -253,9 +253,10 @@ public class SongMenu extends BasicGameState {
search.setMaxLength(60);
// selection buttons
float selectX = GameImage.MENU_BACK.getAnimation(1).getWidth() * 1.75f;
float selectY = height - GameImage.SELECTION_MODS.getImage().getHeight() / 2f;
float selectOffset = GameImage.SELECTION_MODS.getImage().getWidth() * 1.05f;
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;
selectModsButton = new MenuButton(GameImage.SELECTION_MODS_OVERLAY.getImage(),
selectX, selectY);
selectRandomButton = new MenuButton(GameImage.SELECTION_RANDOM_OVERLAY.getImage(),