default back button

This commit is contained in:
yugecin
2017-02-02 01:06:56 +01:00
parent 61340eb9ee
commit 62b5d574da
11 changed files with 239 additions and 17 deletions

View File

@@ -253,6 +253,8 @@ public enum GameImage {
}
},
MENU_BACK ("menu-back", "menu-back-%d", "png"),
MENU_BACK_CHEVRON ("menu-back-chevron", "png"),
MENU_BACK_SLOPE("menu-back-slope", "png"),
MENU_BUTTON_BG ("menu-button-background", "png", false, false),
MENU_TAB ("selection-tab", "png", false, false) {
@Override

View File

@@ -519,7 +519,7 @@ public class DownloadsMenu extends ComplexOpsuState {
// back button
else
UI.getBackButton().draw();
UI.getBackButton().draw(g);
UI.draw(g);
}

View File

@@ -99,7 +99,7 @@ public class GameRanking extends BaseOpsuState {
replayButton.draw();
if (data.isGameplay() && !GameMod.AUTO.isActive())
retryButton.draw();
UI.getBackButton().draw();
UI.getBackButton().draw(g);
UI.draw(g);

View File

@@ -715,7 +715,7 @@ public class SongMenu extends ComplexOpsuState {
// back button
else
UI.getBackButton().draw();
UI.getBackButton().draw(g);
UI.draw(g);

View File

@@ -33,6 +33,8 @@ import org.newdawn.slick.Color;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import yugecin.opsudance.core.DisplayContainer;
import yugecin.opsudance.events.ResolutionOrSkinChangedEvent;
import yugecin.opsudance.ui.BackButton;
/**
* Draws common UI components.
@@ -40,7 +42,7 @@ import yugecin.opsudance.core.DisplayContainer;
public class UI {
/** Back button. */
private static MenuButton backButton;
private static BackButton backButton;
/** Time to show volume image, in milliseconds. */
private static final int VOLUME_DISPLAY_TIME = 1500;
@@ -68,18 +70,10 @@ public class UI {
*/
public static void init(DisplayContainer displayContainer) {
UI.displayContainer = displayContainer;
}
// back button
if (GameImage.MENU_BACK.getImages() != null) {
Animation back = GameImage.MENU_BACK.getAnimation(120);
backButton = new MenuButton(back, back.getWidth() / 2f, displayContainer.height - (back.getHeight() / 2f));
} else {
Image back = GameImage.MENU_BACK.getImage();
backButton = new MenuButton(back, back.getWidth() / 2f, displayContainer.height - (back.getHeight() / 2f));
}
backButton.setHoverAnimationDuration(350);
backButton.setHoverAnimationEquation(AnimationEquation.IN_OUT_BACK);
backButton.setHoverExpand(MenuButton.Expand.UP_RIGHT);
public static void revalidate() {
backButton = new BackButton(displayContainer);
}
/**
@@ -110,7 +104,7 @@ public class UI {
/**
* Returns the 'menu-back' MenuButton.
*/
public static MenuButton getBackButton() { return backButton; }
public static BackButton getBackButton() { return backButton; }
/**
* Draws a tab image and text centered at a location.