Added support for multiple GameImage file extensions.

Specifically, the main menu background and pause/fail backgrounds now accept JPGs as well as PNGs.

Other changes:
- Don't draw the default pause/fail background if the buttons are skinned and the background is unskinned.
- Preload logo and main menu background.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-01-15 18:16:46 -05:00
parent 516e6280c7
commit f8dad2889f
4 changed files with 224 additions and 146 deletions

View File

@@ -84,11 +84,19 @@ public class GamePauseMenu extends BasicGameState {
@Override
public void render(GameContainer container, StateBasedGame game, Graphics g)
throws SlickException {
// background
if (gameState.getRestart() != Game.Restart.LOSE)
GameImage.PAUSE_OVERLAY.getImage().draw();
// get background image
GameImage bg = (gameState.getRestart() == Game.Restart.LOSE) ?
GameImage.FAIL_BACKGROUND : GameImage.PAUSE_OVERLAY;
// don't draw default background if button skinned and background unskinned
boolean buttonsSkinned =
GameImage.PAUSE_CONTINUE.hasSkinImage() ||
GameImage.PAUSE_RETRY.hasSkinImage() ||
GameImage.PAUSE_BACK.hasSkinImage();
if (!buttonsSkinned || bg.hasSkinImage())
bg.getImage().draw();
else
GameImage.FAIL_BACKGROUND.getImage().draw();
g.setBackground(Color.black);
// draw buttons
if (gameState.getRestart() != Game.Restart.LOSE)