Ejemplo n.º 1
0
 public void listenInput(GameContainer gc, StateBasedGame sbg, int delta) {
   Input input = gc.getInput();
   if (input.isKeyPressed(Input.KEY_DOWN)) {
     cursor = Math.min(cursor + 1, 2);
   } else if (input.isKeyPressed(Input.KEY_UP)) {
     cursor = Math.max(cursor - 1, 0);
   }
   if (cursor == 0 && input.isKeyDown(Input.KEY_RIGHT)) {
     control.changeVolume(delta * 0.5f);
   } else if (cursor == 0 && input.isKeyDown(Input.KEY_LEFT)) {
     control.changeVolume(-delta * 0.5f);
   }
   if (cursor == 1 && input.isKeyDown(Input.KEY_RIGHT)) {
     control.goFullScreen(true);
   } else if (cursor == 1 && input.isKeyDown(Input.KEY_LEFT)) {
     control.goFullScreen(false);
   }
   if (cursor == 2 && input.isKeyDown(Input.KEY_RIGHT)) {
     control.changeBrightness(+5);
   } else if (cursor == 2 && input.isKeyDown(Input.KEY_LEFT)) {
     control.changeBrightness(-5);
   } else if (input.isKeyDown(Input.KEY_ENTER)) {
     ((GameController) gc).changeState("pause");
     //			sbg.enterState(((Game)sbg).prevState);
     ((GameController) gc).changeState(((Game) sbg).prevState);
   }
 }
Ejemplo n.º 2
0
 public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
   Input input = gc.getInput();
   if (Mouse.getX() > 89 && Mouse.getX() < 276 && Mouse.getY() > 15 && Mouse.getY() < 69) {
     Instructions = new Image("res/InstructionsMenu.png");
     if (input.isMouseButtonDown(0)) {
       sbg.enterState(0);
     }
   } else {
     Instructions = new Image("res/Instructions.png");
   }
 }
Ejemplo n.º 3
0
  /**
   * @see org.newdawn.slick.state.BasicGameState#render(org.newdawn.slick.GameContainer,
   *     org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.Graphics)
   */
  public void render(GameContainer container, StateBasedGame game, Graphics g) {
    // Hintergrund rendern
    background.draw(0, 0);

    g.setFont(font);
    g.setColor(Color.white);

    g.drawString("GAME PAUSED", container.getWidth() / 2 - (font.getWidth("GAME PAUSED") / 2), 180);

    for (int i = 0; i < options.length; i++) {
      g.setColor(Color.white);
      if (selected == i) {
        g.setColor(Color.red);
        // g.drawRect(200, 390 + (i * 50), 400, 50);
      }
      g.drawString(options[i], 400 - (font.getWidth(options[i]) / 2), 230 + (i * 50));
    }
  }
Ejemplo n.º 4
0
 @Override
 public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
   g.setFont(TPP.font);
   g.setColor(Color.red);
   g.drawString("Loading Now" + dots, gc.getWidth() / 3, gc.getHeight() / 30 * 12);
 }