package ru.vagrant_ai.questionmarkgame.main;
import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
import ru.vagrant_ai.questionmarkgame.util.Text;
public class GameoverState extends BasicGameState {
int stateID = 2;
GameoverState( int stateID )
{
this.stateID = stateID;
}
public int getID()
{
return stateID;
}
public void init(GameContainer gc, StateBasedGame sbg)
{
}
public void render(GameContainer gc, StateBasedGame sbg, Graphics g)
{
g.setColor(Color.red);
g.fillRect(0,0,Game.app_x,Game.app_y);
g.setColor(Color.black);
Text.drawString(250, Text.extractLength("LF/DY", 250), 100, "LF/DY");
Text.drawString(80, Text.extractLength("Game over...", 80), 200, "Game over...");
Text.drawString(200, Text.extractLength("Press ENTER", 200), 305, "Press ENTER", Color.white, 2);
Text.drawString(200, Text.extractLength("to restart", 200), 410, "to restart", Color.white, 2);
Text.drawString(120, Text.extractLength("Esc - exit to main menu", 120), 545, "Esc - exit to main menu", Color.black, 0);
}
public void update(GameContainer gc, StateBasedGame sbg, int delta)
{
Input input = gc.getInput();
if (input.isKeyPressed(Input.KEY_ENTER)) sbg.enterState(Game.GAMEPLAYSTATE);
else if (input.isKeyPressed(Input.KEY_ESCAPE)) sbg.enterState(Game.MAINMENUSTATE);
}
}