Expand menu buttons when hovering.

Added hovering capabilities to GUIMenuButton.  The max scale and direction to expand the image can be modified per object.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2014-12-23 23:41:37 -05:00
parent ce8ae40f79
commit 33f5df030c
8 changed files with 174 additions and 20 deletions

View File

@@ -61,6 +61,7 @@ public class GameRanking extends BasicGameState {
// game-related variables
private StateBasedGame game;
private int state;
private Input input;
public GameRanking(int state) {
this.state = state;
@@ -70,6 +71,7 @@ public class GameRanking extends BasicGameState {
public void init(GameContainer container, StateBasedGame game)
throws SlickException {
this.game = game;
this.input = container.getInput();
score = Game.getGameScore();
@@ -138,6 +140,8 @@ public class GameRanking extends BasicGameState {
public void update(GameContainer container, StateBasedGame game, int delta)
throws SlickException {
Utils.updateCursor(delta);
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
Utils.getBackButton().hoverUpdate(delta, mouseX, mouseY);
}
@Override
@@ -185,6 +189,7 @@ public class GameRanking extends BasicGameState {
public void enter(GameContainer container, StateBasedGame game)
throws SlickException {
Display.setTitle(game.getTitle());
Utils.getBackButton().setScale(1f);
SoundController.playSound(SoundController.SOUND_APPLAUSE);
}
}