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 GamewinState extends BasicGameState {
int stateID = 3;
GamewinState( 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.yellow);
g.fillRect(0,0,Game.app_x,Game.app_y);
Text.drawString(250, Text.extractLength("CONGRATS!", 250), 100, "CONGRATS!", Color.red);
Text.drawString(80, Text.extractLength("You won the game!", 80), 200, "You won the game!", Color.red);
Text.drawString(200, Text.extractLength("Press ENTER", 200), 305, "Press ENTER", Color.white, 2);
Text.drawString(200, Text.extractLength("to replay", 200), 410, "to replay", 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);
}
}