コード例 #1
0
 public void commandAction(Command command, Displayable displayable) {
   if (command == exitCommand) {
     midlet.notifyDestroyed();
   }
   if (command == atrasCommand) {
     midlet.notifyDestroyed();
   }
   if (command == atrasCommand2) {
     midlet.notifyDestroyed();
   }
 }
コード例 #2
0
  private void jMenuItem3ActionPerformed(
      java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jMenuItem3ActionPerformed
    if (JOptionPane.showConfirmDialog(
            rootPane, "Esta seguro de cerrar la sesion actual?", "Cerrar sesión", 1)
        == 0) {

      this.dispose();
      Inicio ini = new Inicio();
      Dimension pantall = Toolkit.getDefaultToolkit().getScreenSize();
      // obtenemos el tamaño de la ventana
      Dimension ventan = ini.getSize();
      // para centrar la ventana lo hacemos con el siguiente calculo
      ini.setLocation((pantall.width - ventan.width) / 2, (pantall.height - ventan.height) / 2);
      ini.setVisible(true);
    }
  } // GEN-LAST:event_jMenuItem3ActionPerformed
コード例 #3
0
ファイル: JuegoNuevo.java プロジェクト: 6xhhs/biolipsis
  public void actualizar() {
    if (fondoJuego1 != null) {
      fondoJuego1.mover(10);
      fondoJuego2.mover(10);
      juegoNuevo.mover(2);
      continuar.mover(2);
      seleccion = null;
    }
    if (seleccion != null) {
      seleccion.actualizar();
    }

    if (highLight != null) {
      int estado = menu.getKeyStates();
      if (estado == 0) {
        tecla = false;
      }
      if (highLight.getPrioridad() == regresar.getPrioridad()) {
        if ((estado & DOWN_PRESSED) != 0 && !tecla) {
          highLight.setPosicion(juegoNuevo.getX(), juegoNuevo.getY());
          highLight.setPrioridad(juegoNuevo.getPrioridad());
          tecla = true;
        }
        if ((estado & UP_PRESSED) != 0 && !tecla) {
          highLight.setPosicion(continuar.getX(), continuar.getY());
          highLight.setPrioridad(continuar.getPrioridad());
          tecla = true;
        }
        if ((estado & FIRE_PRESSED) != 0 && !tecla) {
          inicio.crearImagenes();
          borrarTodo();
          tecla = true;
        }
      } else if (highLight.getPrioridad() == juegoNuevo.getPrioridad()) {
        if ((estado & UP_PRESSED) != 0 && !tecla) {
          highLight.setPosicion(regresar.getX(), regresar.getY());
          highLight.setPrioridad(regresar.getPrioridad());
          tecla = true;
        }
        if ((estado & FIRE_PRESSED) != 0 && !tecla) {
          seleccion = new SeleccionPersonaje(menu, this, null);
          borrarTodo();
          tecla = true;
        }
      } else if (highLight.getPrioridad() == continuar.getPrioridad()) {
        if ((estado & DOWN_PRESSED) != 0 && !tecla) {
          highLight.setPosicion(regresar.getX(), regresar.getY());
          highLight.setPrioridad(regresar.getPrioridad());
          tecla = true;
        }
        if ((estado & FIRE_PRESSED) != 0 && !tecla) {}
      }
    }
  }
コード例 #4
0
ファイル: Menu.java プロジェクト: 6xhhs/biolipsis
 /** El metodo actualizar se encarga del manejo del teclado y de movimiento de las imagenes */
 public void actualizar() {
   if (fondo1 != null) {
     fondo1.mover(10);
     fondo2.mover(10);
     fondo3.mover(10);
     fondo4.mover(10);
     puntajes.mover(1);
     ayuda.mover(1);
     creditos.mover(1);
     salir.mover(1);
     titulo.mover(1);
     menuPuntajes = null;
     menuAyuda = null;
     menuCreditos = null;
     menuSalir = null;
     menuInicio = null;
   }
   if (menuPuntajes != null) {
     try {
       menuPuntajes.actualizar();
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   }
   if (menuAyuda != null) {
     try {
       menuAyuda.actualizar();
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   }
   if (menuCreditos != null) {
     try {
       menuCreditos.actualizar();
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   }
   if (menuSalir != null) {
     try {
       menuSalir.actualizar();
     } catch (Exception ex) {
       ex.printStackTrace();
     }
     if (menuSalir.getSalir()) {
       midlet.terminar();
       animador.terminar();
       midlet.detenerMusica();
       terminar = true;
     }
   }
   if (menuInicio != null) {
     try {
       menuInicio.actualizar();
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   }
   if (highLight != null) {
     int estado = getKeyStates();
     if (estado == 0) {
       bandera = false;
     }
     if (highLight.getPrioridad() == juego.getPrioridad()) {
       if ((estado & UP_PRESSED) != 0 && !bandera) {
         highLight.setPosicion(puntajes.getX() - 1, puntajes.getY() - 1);
         highLight.setPrioridad(puntajes.getPrioridad());
         bandera = true;
       }
       if ((estado & DOWN_PRESSED) != 0 && !bandera) {
         highLight.setPosicion(salir.getX(), salir.getY());
         highLight.setPrioridad(salir.getPrioridad());
         bandera = true;
       }
       if ((estado & FIRE_PRESSED) != 0 && !bandera) {
         menuInicio = new Inicio(this);
         borrarTodo();
         bandera = true;
       }
     } else if (highLight.getPrioridad() == creditos.getPrioridad()) {
       if ((estado & UP_PRESSED) != 0 && !bandera) {
         highLight.setPosicion(juego.getX(), juego.getY());
         highLight.setPrioridad(juego.getPrioridad());
         bandera = true;
       }
       if ((estado & LEFT_PRESSED) != 0 && !bandera) {
         highLight.setPosicion(salir.getX(), salir.getY());
         highLight.setPrioridad(salir.getPrioridad());
         bandera = true;
       }
       if ((estado & FIRE_PRESSED) != 0) {
         menuCreditos = new Creditos(this);
         borrarTodo();
         bandera = true;
       }
     } else if (highLight.getPrioridad() == puntajes.getPrioridad()) {
       if ((estado & RIGHT_PRESSED) != 0 && !bandera) {
         highLight.setPosicion(ayuda.getX(), ayuda.getY());
         highLight.setPrioridad(ayuda.getPrioridad());
         bandera = true;
       }
       if ((estado & DOWN_PRESSED) != 0 && !bandera) {
         highLight.setPosicion(juego.getX(), juego.getY());
         highLight.setPrioridad(juego.getPrioridad());
         bandera = true;
       }
       if ((estado & FIRE_PRESSED) != 0) {
         try {
           menuPuntajes = new Puntajes(this, lecturaScores());
         } catch (IOException ex) {
           menuPuntajes = new Puntajes(this, "0");
         }
         borrarTodo();
         bandera = true;
       }
     } else if (highLight.getPrioridad() == salir.getPrioridad()) {
       if ((estado & RIGHT_PRESSED) != 0 && !bandera) {
         highLight.setPosicion(creditos.getX(), creditos.getY());
         highLight.setPrioridad(creditos.getPrioridad());
         bandera = true;
       }
       if ((estado & UP_PRESSED) != 0 && !bandera) {
         highLight.setPosicion(juego.getX(), juego.getY());
         highLight.setPrioridad(juego.getPrioridad());
         bandera = true;
       }
       if ((estado & FIRE_PRESSED) != 0) {
         menuSalir = new Salir(this);
         borrarTodo();
         bandera = true;
       }
     } else if (highLight.getPrioridad() == ayuda.getPrioridad()) {
       if ((estado & LEFT_PRESSED) != 0 && !bandera) {
         highLight.setPosicion(puntajes.getX(), puntajes.getY());
         highLight.setPrioridad(puntajes.getPrioridad());
         bandera = true;
       }
       if ((estado & DOWN_PRESSED) != 0 && !bandera) {
         highLight.setPosicion(juego.getX(), juego.getY());
         highLight.setPrioridad(juego.getPrioridad());
         bandera = true;
       }
       if ((estado & FIRE_PRESSED) != 0) {
         menuAyuda = new Ayuda(this);
         borrarTodo();
         bandera = true;
       }
     }
   }
 }
コード例 #5
0
ファイル: Menu.java プロジェクト: 6xhhs/biolipsis
  /** Este metodo te permite dibujar todas las opciones del menu asi como los respectivos fondos. */
  public void dibujar() {
    if (logoTec != null) {
      dibujarLogoTec();
    }
    logoTec = null;
    if (fondo4 != null) {
      fondo1.dibujar(g);
      fondo2.dibujar(g);
      fondo3.dibujar(g);
      fondo4.dibujar(g);
      if (fondo4.getY() >= 108) {
        puntajes.dibujar(g);
        if (highLight.getPrioridad() == puntajes.getPrioridad()) {
          tituloPuntajes.dibujar(g);
        }

        ayuda.dibujar(g);
        if (highLight.getPrioridad() == ayuda.getPrioridad()) {
          tituloAyuda.dibujar(g);
        }

        creditos.dibujar(g);
        if (highLight.getPrioridad() == creditos.getPrioridad()) {
          tituloCreditos.dibujar(g);
        }

        salir.dibujar(g);
        if (highLight.getPrioridad() == salir.getPrioridad()) {
          tituloSalir.dibujar(g);
        }

        juego.dibujar(g);
        if (puntajes.getX() <= 20) {
          if (highLight.getPrioridad() == juego.getPrioridad()) {
            tituloJuego1.dibujar(g);
            tituloJuego2.dibujar(g);
            tituloJuego3.dibujar(g);
            tituloJuego4.dibujar(g);
          }
        }

        highLight.dibujar(g);
        titulo.dibujar(g);
      }
    }

    if (menuPuntajes != null) {
      menuPuntajes.g = this.getGraphics();
      menuPuntajes.dibujar();
    }

    if (menuAyuda != null) {
      menuAyuda.g = this.getGraphics();
      menuAyuda.dibujar();
    }

    if (menuCreditos != null) {
      menuCreditos.g = this.getGraphics();
      menuCreditos.dibujar();
    }

    if (menuSalir != null) {
      menuSalir.g = this.getGraphics();
      menuSalir.dibujar();
    }

    if (menuInicio != null) {
      menuInicio.g = this.getGraphics();
      menuInicio.dibujar();
    }

    flushGraphics();
  }