Renamed GUIMenuButton class to MenuButton.
The class was originally named with the intent of adding many other GUI classes, but this never happened. Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
parent
9e69afac91
commit
2592faec44
|
@ -54,7 +54,7 @@ public enum GameMod {
|
|||
/**
|
||||
* The button containing the mod image (displayed in Options screen).
|
||||
*/
|
||||
private GUIMenuButton button;
|
||||
private MenuButton button;
|
||||
|
||||
/**
|
||||
* Total number of mods.
|
||||
|
@ -106,7 +106,7 @@ public enum GameMod {
|
|||
|
||||
// create button
|
||||
img.setAlpha(0.5f);
|
||||
this.button = new GUIMenuButton(img, x + (offsetX * id), y);
|
||||
this.button = new MenuButton(img, x + (offsetX * id), y);
|
||||
this.button.setHoverScale(1.15f);
|
||||
} catch (SlickException e) {
|
||||
Log.error(String.format("Failed to initialize game mod '%s'.", this), e);
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.newdawn.slick.Image;
|
|||
* Consists of an image or animation and coordinates.
|
||||
* Multi-part images and animations currently do not support hover updates.
|
||||
*/
|
||||
public class GUIMenuButton {
|
||||
public class MenuButton {
|
||||
/**
|
||||
* The image associated with the button.
|
||||
*/
|
||||
|
@ -73,7 +73,7 @@ public class GUIMenuButton {
|
|||
/**
|
||||
* Creates a new button from an Image.
|
||||
*/
|
||||
public GUIMenuButton(Image img, float x, float y) {
|
||||
public MenuButton(Image img, float x, float y) {
|
||||
this.img = img;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
|
@ -85,7 +85,7 @@ public class GUIMenuButton {
|
|||
/**
|
||||
* Creates a new button from a 3-part Image.
|
||||
*/
|
||||
public GUIMenuButton(Image imgCenter, Image imgLeft, Image imgRight,
|
||||
public MenuButton(Image imgCenter, Image imgLeft, Image imgRight,
|
||||
float x, float y) {
|
||||
this.img = imgCenter;
|
||||
this.imgL = imgLeft;
|
||||
|
@ -100,7 +100,7 @@ public class GUIMenuButton {
|
|||
/**
|
||||
* Creates a new button from an Animation.
|
||||
*/
|
||||
public GUIMenuButton(Animation anim, float x, float y) {
|
||||
public MenuButton(Animation anim, float x, float y) {
|
||||
this.anim = anim;
|
||||
this.x = x;
|
||||
this.y = y;
|
|
@ -53,7 +53,7 @@ public enum SongSort {
|
|||
/**
|
||||
* The tab associated with the sort (displayed in Song Menu screen).
|
||||
*/
|
||||
private GUIMenuButton tab;
|
||||
private MenuButton tab;
|
||||
|
||||
/**
|
||||
* Total number of sorts.
|
||||
|
@ -181,7 +181,7 @@ public enum SongSort {
|
|||
public void init(Image img, int width, int height) {
|
||||
float buttonX = width * 0.6f;
|
||||
float tabOffset = (width - buttonX - img.getWidth()) / (SIZE - 1);
|
||||
this.tab = new GUIMenuButton(img,
|
||||
this.tab = new MenuButton(img,
|
||||
(buttonX + (img.getWidth() / 2f)) + (id * tabOffset),
|
||||
(height * 0.15f) - (img.getHeight() / 2f) - 2f
|
||||
);
|
||||
|
|
|
@ -84,7 +84,7 @@ public class Utils {
|
|||
/**
|
||||
* Back button (shared by other states).
|
||||
*/
|
||||
private static GUIMenuButton backButton;
|
||||
private static MenuButton backButton;
|
||||
|
||||
/**
|
||||
* Tab image (shared by other states).
|
||||
|
@ -195,10 +195,10 @@ public class Utils {
|
|||
Image back = new Image("menu-back.png");
|
||||
float scale = (height * 0.1f) / back.getHeight();
|
||||
back = back.getScaledCopy(scale);
|
||||
backButton = new GUIMenuButton(back,
|
||||
backButton = new MenuButton(back,
|
||||
back.getWidth() / 2f,
|
||||
height - (back.getHeight() / 2f));
|
||||
backButton.setHoverDir(GUIMenuButton.Expand.UP_RIGHT);
|
||||
backButton.setHoverDir(MenuButton.Expand.UP_RIGHT);
|
||||
|
||||
// set default game images
|
||||
for (GameImage img : GameImage.values())
|
||||
|
@ -219,9 +219,9 @@ public class Utils {
|
|||
public static Image getTabImage() { return tab; }
|
||||
|
||||
/**
|
||||
* Returns the 'menu-back' GUIMenuButton.
|
||||
* Returns the 'menu-back' MenuButton.
|
||||
*/
|
||||
public static GUIMenuButton getBackButton() { return backButton; }
|
||||
public static MenuButton getBackButton() { return backButton; }
|
||||
|
||||
/**
|
||||
* Draws an image based on its center with a color filter.
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package itdelatrisu.opsu.states;
|
||||
|
||||
import itdelatrisu.opsu.GUIMenuButton;
|
||||
import itdelatrisu.opsu.MenuButton;
|
||||
import itdelatrisu.opsu.GameImage;
|
||||
import itdelatrisu.opsu.GameMod;
|
||||
import itdelatrisu.opsu.GameScore;
|
||||
|
@ -133,7 +133,7 @@ public class Game extends BasicGameState {
|
|||
/**
|
||||
* Skip button (displayed at song start, when necessary).
|
||||
*/
|
||||
private GUIMenuButton skipButton;
|
||||
private MenuButton skipButton;
|
||||
|
||||
/**
|
||||
* Minimum time before start of song, in milliseconds, to process skip-related actions.
|
||||
|
@ -870,10 +870,10 @@ public class Game extends BasicGameState {
|
|||
GameImage.SKIP.setImage(skip);
|
||||
GameImage.SKIP.setScaled();
|
||||
}
|
||||
skipButton = new GUIMenuButton(skip,
|
||||
skipButton = new MenuButton(skip,
|
||||
width - (skip.getWidth() / 2f),
|
||||
height - (skip.getHeight() / 2f));
|
||||
skipButton.setHoverDir(GUIMenuButton.Expand.UP_LEFT);
|
||||
skipButton.setHoverDir(MenuButton.Expand.UP_LEFT);
|
||||
|
||||
// countdown
|
||||
float countdownHeight = height / 3f;
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package itdelatrisu.opsu.states;
|
||||
|
||||
import itdelatrisu.opsu.GUIMenuButton;
|
||||
import itdelatrisu.opsu.MenuButton;
|
||||
import itdelatrisu.opsu.GameImage;
|
||||
import itdelatrisu.opsu.MusicController;
|
||||
import itdelatrisu.opsu.Opsu;
|
||||
|
@ -58,7 +58,7 @@ public class GamePauseMenu extends BasicGameState {
|
|||
/**
|
||||
* "Continue", "Retry", and "Back" buttons.
|
||||
*/
|
||||
private GUIMenuButton continueButton, retryButton, backButton;
|
||||
private MenuButton continueButton, retryButton, backButton;
|
||||
|
||||
// game-related variables
|
||||
private GameContainer container;
|
||||
|
@ -196,9 +196,9 @@ public class GamePauseMenu extends BasicGameState {
|
|||
int height = container.getHeight();
|
||||
|
||||
// initialize buttons
|
||||
continueButton = new GUIMenuButton(GameImage.PAUSE_CONTINUE.getImage(), width / 2f, height * 0.25f);
|
||||
retryButton = new GUIMenuButton(GameImage.PAUSE_RETRY.getImage(), width / 2f, height * 0.5f);
|
||||
backButton = new GUIMenuButton(GameImage.PAUSE_BACK.getImage(), width / 2f, height * 0.75f);
|
||||
continueButton = new MenuButton(GameImage.PAUSE_CONTINUE.getImage(), width / 2f, height * 0.25f);
|
||||
retryButton = new MenuButton(GameImage.PAUSE_RETRY.getImage(), width / 2f, height * 0.5f);
|
||||
backButton = new MenuButton(GameImage.PAUSE_BACK.getImage(), width / 2f, height * 0.75f);
|
||||
|
||||
// pause background image
|
||||
if (!GameImage.PAUSE_OVERLAY.isScaled()) {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package itdelatrisu.opsu.states;
|
||||
|
||||
import itdelatrisu.opsu.GUIMenuButton;
|
||||
import itdelatrisu.opsu.MenuButton;
|
||||
import itdelatrisu.opsu.GameMod;
|
||||
import itdelatrisu.opsu.GameScore;
|
||||
import itdelatrisu.opsu.MusicController;
|
||||
|
@ -56,7 +56,7 @@ public class GameRanking extends BasicGameState {
|
|||
/**
|
||||
* "Retry" and "Exit" buttons.
|
||||
*/
|
||||
private GUIMenuButton retryButton, exitButton;
|
||||
private MenuButton retryButton, exitButton;
|
||||
|
||||
// game-related variables
|
||||
private StateBasedGame game;
|
||||
|
@ -84,11 +84,11 @@ public class GameRanking extends BasicGameState {
|
|||
float scale = (height * 0.15f) / retry.getHeight();
|
||||
retry = retry.getScaledCopy(scale);
|
||||
exit = exit.getScaledCopy(scale);
|
||||
retryButton = new GUIMenuButton(retry,
|
||||
retryButton = new MenuButton(retry,
|
||||
width - (retry.getWidth() / 2f),
|
||||
(height * 0.97f) - (exit.getHeight() * 1.5f)
|
||||
);
|
||||
exitButton = new GUIMenuButton(exit,
|
||||
exitButton = new MenuButton(exit,
|
||||
width - (exit.getWidth() / 2f),
|
||||
(height * 0.97f) - (exit.getHeight() / 2f)
|
||||
);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package itdelatrisu.opsu.states;
|
||||
|
||||
import itdelatrisu.opsu.GUIMenuButton;
|
||||
import itdelatrisu.opsu.MenuButton;
|
||||
import itdelatrisu.opsu.MusicController;
|
||||
import itdelatrisu.opsu.Opsu;
|
||||
import itdelatrisu.opsu.OsuFile;
|
||||
|
@ -58,7 +58,7 @@ public class MainMenu extends BasicGameState {
|
|||
/**
|
||||
* Logo button that reveals other buttons on click.
|
||||
*/
|
||||
private GUIMenuButton logo;
|
||||
private MenuButton logo;
|
||||
|
||||
/**
|
||||
* Whether or not the logo has been clicked.
|
||||
|
@ -73,12 +73,12 @@ public class MainMenu extends BasicGameState {
|
|||
/**
|
||||
* Main "Play" and "Exit" buttons.
|
||||
*/
|
||||
private GUIMenuButton playButton, exitButton;
|
||||
private MenuButton playButton, exitButton;
|
||||
|
||||
/**
|
||||
* Music control buttons.
|
||||
*/
|
||||
private GUIMenuButton musicPlay, musicPause, musicNext, musicPrevious;
|
||||
private MenuButton musicPlay, musicPause, musicNext, musicPrevious;
|
||||
|
||||
/**
|
||||
* Application start time, for drawing the total running time.
|
||||
|
@ -127,7 +127,7 @@ public class MainMenu extends BasicGameState {
|
|||
Image logoImg = new Image("logo.png");
|
||||
float buttonScale = (height / 1.2f) / logoImg.getHeight();
|
||||
Image logoImgScaled = logoImg.getScaledCopy(buttonScale);
|
||||
logo = new GUIMenuButton(logoImgScaled, width / 2f, height / 2f);
|
||||
logo = new MenuButton(logoImgScaled, width / 2f, height / 2f);
|
||||
logo.setHoverScale(1.05f);
|
||||
|
||||
Image playImg = new Image("menu-play.png");
|
||||
|
@ -135,10 +135,10 @@ public class MainMenu extends BasicGameState {
|
|||
playImg = playImg.getScaledCopy((logoImg.getWidth() * 0.83f) / playImg.getWidth());
|
||||
exitImg = exitImg.getScaledCopy((logoImg.getWidth() * 0.66f) / exitImg.getWidth());
|
||||
float exitOffset = (playImg.getWidth() - exitImg.getWidth()) / 3f;
|
||||
playButton = new GUIMenuButton(playImg.getScaledCopy(buttonScale),
|
||||
playButton = new MenuButton(playImg.getScaledCopy(buttonScale),
|
||||
width * 0.75f, (height / 2) - (logoImgScaled.getHeight() / 5f)
|
||||
);
|
||||
exitButton = new GUIMenuButton(exitImg.getScaledCopy(buttonScale),
|
||||
exitButton = new MenuButton(exitImg.getScaledCopy(buttonScale),
|
||||
width * 0.75f - exitOffset, (height / 2) + (exitImg.getHeight() / 2f)
|
||||
);
|
||||
playButton.setHoverScale(1.05f);
|
||||
|
@ -147,10 +147,10 @@ public class MainMenu extends BasicGameState {
|
|||
// initialize music buttons
|
||||
int musicWidth = 48;
|
||||
int musicHeight = 30;
|
||||
musicPlay = new GUIMenuButton(new Image("music-play.png"), width - (2 * musicWidth), musicHeight);
|
||||
musicPause = new GUIMenuButton(new Image("music-pause.png"), width - (2 * musicWidth), musicHeight);
|
||||
musicNext = new GUIMenuButton(new Image("music-next.png"), width - musicWidth, musicHeight);
|
||||
musicPrevious = new GUIMenuButton(new Image("music-previous.png"), width - (3 * musicWidth), musicHeight);
|
||||
musicPlay = new MenuButton(new Image("music-play.png"), width - (2 * musicWidth), musicHeight);
|
||||
musicPause = new MenuButton(new Image("music-pause.png"), width - (2 * musicWidth), musicHeight);
|
||||
musicNext = new MenuButton(new Image("music-next.png"), width - musicWidth, musicHeight);
|
||||
musicPrevious = new MenuButton(new Image("music-previous.png"), width - (3 * musicWidth), musicHeight);
|
||||
musicPlay.setHoverScale(1.5f);
|
||||
musicPause.setHoverScale(1.5f);
|
||||
musicNext.setHoverScale(1.5f);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package itdelatrisu.opsu.states;
|
||||
|
||||
import itdelatrisu.opsu.GUIMenuButton;
|
||||
import itdelatrisu.opsu.MenuButton;
|
||||
import itdelatrisu.opsu.Opsu;
|
||||
import itdelatrisu.opsu.Utils;
|
||||
|
||||
|
@ -44,7 +44,7 @@ public class MainMenuExit extends BasicGameState {
|
|||
/**
|
||||
* "Yes" and "No" buttons.
|
||||
*/
|
||||
private GUIMenuButton yesButton, noButton;
|
||||
private MenuButton yesButton, noButton;
|
||||
|
||||
/**
|
||||
* Initial x coordinate offsets left/right of center (for shifting animation).
|
||||
|
@ -76,10 +76,10 @@ public class MainMenuExit extends BasicGameState {
|
|||
Image buttonL = new Image("button-left.png");
|
||||
Image buttonR = new Image("button-right.png");
|
||||
button = button.getScaledCopy(width / 2, button.getHeight());
|
||||
yesButton = new GUIMenuButton(button, buttonL, buttonR,
|
||||
yesButton = new MenuButton(button, buttonL, buttonR,
|
||||
width / 2f + centerOffset, height * 0.2f
|
||||
);
|
||||
noButton = new GUIMenuButton(button, buttonL, buttonR,
|
||||
noButton = new MenuButton(button, buttonL, buttonR,
|
||||
width / 2f - centerOffset, height * 0.2f + (button.getHeight() * 1.25f)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package itdelatrisu.opsu.states;
|
||||
|
||||
import itdelatrisu.opsu.GUIMenuButton;
|
||||
import itdelatrisu.opsu.MenuButton;
|
||||
import itdelatrisu.opsu.GameMod;
|
||||
import itdelatrisu.opsu.Opsu;
|
||||
import itdelatrisu.opsu.OsuFile;
|
||||
|
@ -168,7 +168,7 @@ public class Options extends BasicGameState {
|
|||
/**
|
||||
* Option tab buttons.
|
||||
*/
|
||||
private static GUIMenuButton[] optionTabs = new GUIMenuButton[TAB_MAX];
|
||||
private static MenuButton[] optionTabs = new MenuButton[TAB_MAX];
|
||||
|
||||
/**
|
||||
* Current tab.
|
||||
|
@ -440,7 +440,7 @@ public class Options extends BasicGameState {
|
|||
float tabOffset = (float) Math.min(tab.getWidth(),
|
||||
((width - subtextWidth - tab.getWidth()) / 2) / TAB_MAX);
|
||||
for (int i = 0; i < optionTabs.length; i++)
|
||||
optionTabs[i] = new GUIMenuButton(tab, tabX + (i * tabOffset), tabY);
|
||||
optionTabs[i] = new MenuButton(tab, tabX + (i * tabOffset), tabY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
package itdelatrisu.opsu.states;
|
||||
|
||||
import itdelatrisu.opsu.GUIMenuButton;
|
||||
import itdelatrisu.opsu.MenuButton;
|
||||
import itdelatrisu.opsu.MusicController;
|
||||
import itdelatrisu.opsu.Opsu;
|
||||
import itdelatrisu.opsu.OsuFile;
|
||||
|
@ -92,7 +92,7 @@ public class SongMenu extends BasicGameState {
|
|||
/**
|
||||
* The options button (to enter the "Game Options" menu).
|
||||
*/
|
||||
private GUIMenuButton optionsButton;
|
||||
private MenuButton optionsButton;
|
||||
|
||||
/**
|
||||
* The search textfield.
|
||||
|
@ -179,7 +179,7 @@ public class SongMenu extends BasicGameState {
|
|||
|
||||
// options button
|
||||
Image optionsIcon = new Image("options.png").getScaledCopy(iconScale);
|
||||
optionsButton = new GUIMenuButton(optionsIcon, search.getX() - (optionsIcon.getWidth() * 1.5f), search.getY());
|
||||
optionsButton = new MenuButton(optionsIcon, search.getX() - (optionsIcon.getWidth() * 1.5f), search.getY());
|
||||
optionsButton.setHoverScale(1.75f);
|
||||
|
||||
// music note
|
||||
|
|
Loading…
Reference in New Issue
Block a user