Package org.newdawn.slick

Examples of org.newdawn.slick.Input


    int paso = 0;

    /**Actualiza el juego, uso interno*/
    @Override
    public void update(GameContainer gc, int fps) throws SlickException {
        Input i = gc.getInput();
        if (guardado && progreso) {
            if (i.isMouseButtonDown(0)) {
                double y = 1 - (double) (Math.max(20, Math.min(i.getMouseY(), sy - 20)) - 20) / (double) (sy - 40);
                PartidoGuardado pguardado = (PartidoGuardado) partido;
                pguardado.setTiempo((int) (y * (double) pguardado.getIterciones()));
            }
        }
        if (i.isKeyDown(Input.KEY_SUBTRACT)) {
            escala = escala * 0.970;
        } else if (i.isKeyDown(Input.KEY_ADD)) {
            escala = escala / 0.970;
        }
        if (i.isKeyPressed(Input.KEY_F1)) {
            estadio = !estadio;
        }
        if (i.isKeyPressed(Input.KEY_F2)) {
            entorno = !entorno;
        }
        if (i.isKeyPressed(Input.KEY_F3)) {
            showfps = !showfps;
            gc.setShowFPS(showfps);
        }
        if (i.isKeyPressed(Input.KEY_F4)) {
            tipoTexto = (tipoTexto + 1) % 5;
        }
        if (i.isKeyPressed(Input.KEY_F5)) {
            marcador = !marcador;
        }
        if (i.isKeyDown(Input.KEY_ESCAPE)) {
            gc.setSoundVolume(0);
            gc.setSoundOn(false);
            stop();
            gc.exit();
        }
        if (i.isKeyDown(Input.KEY_P)) {
            pause = !pause;
            if (pause) {
                gc.pause();
            } else {
                gc.resume();
            }
        }
        if (guardado && i.isKeyPressed(Input.KEY_LEFT)) {
            if (incremento == 0) {
                incremento = -1;
            } else if (incremento == -1) {
                incremento = -2;
            } else if (incremento == -2) {
                incremento = -4;
            } else if (incremento == -4) {
                incremento = -4;
            } else if (incremento == 1) {
                incremento = 0;
            } else if (incremento == 2) {
                incremento = 1;
            } else if (incremento == 4) {
                incremento = 2;
            }
            iteracionControl = 30;
        }
        if (guardado && i.isKeyPressed(Input.KEY_RIGHT)) {
            if (incremento == 0) {
                incremento = 1;
            } else if (incremento == 1) {
                incremento = 2;
            } else if (incremento == 2) {
                incremento = 4;
            } else if (incremento == 4) {
                incremento = 4;
            } else if (incremento == -1) {
                incremento = 0;
            } else if (incremento == -2) {
                incremento = -1;
            } else if (incremento == -4) {
                incremento = -2;
            }
            iteracionControl = 30;
        }
        paso = 0;
        if (guardado && i.isKeyPressed(Input.KEY_UP)) {
            incremento = 0;
            paso = 1;
        }
        if (guardado && i.isKeyPressed(Input.KEY_DOWN)) {
            incremento = 0;
            paso = -1;
        }
        if (guardado && i.isKeyPressed(Input.KEY_HOME)) {
            inicio = pg.getTiempo();
        }
        if (guardado && i.isKeyPressed(Input.KEY_END)) {
            fin = pg.getTiempo();
        }
        if (guardado && i.isKeyPressed(Input.KEY_DELETE)) {
            if (JOptionPane.showConfirmDialog(null, "Desea eliminar los frames seleccionados?", "Eliminar Frames", JOptionPane.YES_NO_OPTION) == 0) {
                if (inicio < fin) {
                    pg.delete(inicio, fin);
                    fin = inicio;
                } else {
                    pg.delete(inicio, pg.getIterciones() - 1);
                    pg.delete(0, fin);
                    inicio = 0;
                    fin = pg.getIterciones() - 1;
                    pg.setTiempo(0);
                }
            }
        }
        if (guardado && i.isKeyPressed(Input.KEY_S)) {
            if (JOptionPane.showConfirmDialog(null, "Desea gardar el partido?", "Guardar Partido", JOptionPane.YES_NO_OPTION) == 0) {
                System.out.println(pg.getURL().getProtocol());
                if (jfc.showSaveDialog(null) == JFileChooser.APPROVE_OPTION) {
                    try {
                        pg.save(jfc.getSelectedFile());
View Full Code Here


   
   

    @Override
    public void update(GameContainer gc, int d) throws SlickException {
        Input input = gui.guiContext.getInput();
        listener.handleInput(input);
       
            float dx=0,dy=0;
        if(gc.getInput().isKeyDown(gc.getInput().KEY_LEFT)){
            dx=-0.2f;
View Full Code Here

    mouseDownImage = image;

    currentColor = normalColor;

    state = NORMAL;
    Input input = container.getInput();
    over = area.contains(input.getMouseX(), input.getMouseY());
    mouseDown = input.isMouseButtonDown(0);
    updateImage();
  }
View Full Code Here

  public boolean check(String command) {
    if (!commands.containsKey(command))
      return false;

    int[] checked = commands.get(command);
    Input input = world.container.getInput();
    for (int i = 0; i < checked.length; i++) {
      if (input.isKeyDown(checked[i])) {
        return true;
      } else if (checked[i] < 10) {
        // 10 is max number of button on a mouse, @see Input
        if (input.isMousePressed(checked[i])) {
          return true;
        }
      }
    }
    return false;
View Full Code Here

  public boolean pressed(String command) {
    if (!commands.containsKey(command))
      return false;

    int[] checked = commands.get(command);
    Input input = world.container.getInput();
    for (int i = 0; i < checked.length; i++) {
      if (input.isKeyPressed(checked[i])) {
        return true;
      } else if (checked[i] == Input.MOUSE_LEFT_BUTTON
          || checked[i] == Input.MOUSE_RIGHT_BUTTON) {
        if (input.isMousePressed(checked[i])) {
          return true;
        }
      }
    }
    return false;
View Full Code Here

    // set turret position to parent
    x = parent.x;
    y = parent.y;

    // calculate heading of turret
    Input input = container.getInput();
    float mx = input.getMouseX();
    float my = input.getMouseY();
    // TODO Going to add the offset here! HACK
    // mx -= 20;
    // my -= 15;
    angle = (int) calculateAngle(x, y, mx, my);
View Full Code Here

  @Override
  public void update(GameContainer container, int delta)
      throws SlickException {
    super.update(container, delta);

    Input input = container.getInput();
    if (collidePoint(input.getMouseX(), input.getMouseY())) {
      renderBorder = true;
    } else {
      renderBorder = false;
    }

    if (enableClick && renderBorder
        && input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)) {
      if (getText().equalsIgnoreCase("boss")) {
        FuzzyMain.gotoLevel = 11;
      } else {
        FuzzyMain.gotoLevel = Integer.valueOf(getText());
      }
View Full Code Here

  @Override
  public void update(GameContainer container, StateBasedGame game, int delta)
      throws SlickException {
    super.update(container, game, delta);

    Input input = container.getInput();
    if (input.isKeyPressed(Input.KEY_SPACE)) {
      hideTiles = hideTiles ? false : true;
    }
  }
View Full Code Here

      throws SlickException {
    super.update(container, delta);
    if (motion != null)
      motion.update(delta);

    Input input = container.getInput();
    // change tween's ease
    if (check("CHANGE_MODE")) {
      if (currentEase + 1 <= 26) {
        currentEase++;
      } else {
        currentEase = 0;
      }
    }
    // check controls
    if (check("MOVE")) {
      // set new tween for player
      motion = new LinearMotion(x, y, input.getMouseX(),
          input.getMouseY(), 100, currentEase);
    }
    if (check("START")) {
      // start tween update
      motion.start();
    }
View Full Code Here

      throws SlickException {
    super.update(container, delta);
    if (motion != null)
      motion.update(delta);

    Input input = container.getInput();
    // change tween's ease
    if (check("CHANGE_MODE")) {
      if (currentEase + 1 <= 26) {
        currentEase++;
      } else {
        currentEase = 0;
      }
    }
    // check controls
    if (check("MOVE")) {
      // set new tween for player
      motion = new LinearMotion(x, y, input.getMouseX(),
          input.getMouseY(), 100, currentEase);
    }
    if (check("START")) {
      // start tween update
      motion.start();
    }
View Full Code Here

TOP

Related Classes of org.newdawn.slick.Input

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.