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");
   }
 }