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

@@ -101,6 +101,10 @@ public class GamePauseMenu extends BasicGameState {
public void update(GameContainer container, StateBasedGame game, int delta)
throws SlickException {
Utils.updateCursor(delta);
int mouseX = input.getMouseX(), mouseY = input.getMouseY();
continueButton.hoverUpdate(delta, mouseX, mouseY);
retryButton.hoverUpdate(delta, mouseX, mouseY);
backButton.hoverUpdate(delta, mouseX, mouseY);
}
@Override
@@ -165,6 +169,9 @@ public class GamePauseMenu extends BasicGameState {
SoundController.playSound(SoundController.SOUND_FAIL);
} else
MusicController.pause();
continueButton.setScale(1f);
retryButton.setScale(1f);
backButton.setScale(1f);
}
/**