/** * Convenience method to create a texture with a given internal format. * * @param width the width of the empty texture * @param height the height of the empty texture * @param filter the filter to use * @param format the internal format * @return a generated texture */ public static Texture createTexture(int width, int height, ImageData.Format format, int filter) throws SlickException { EmptyImageData data = new EmptyImageData(width, height); ByteBuffer dataBuffer = data.getImageBufferData(); String ref = "pixelhandler:" + width + "x" + height + ":" + format.toString(); try { return InternalTextureLoader.get() .createTexture(data, dataBuffer, ref, GL11.GL_TEXTURE_2D, filter, filter, false, format); } catch (IOException e) { throw new SlickException("Error generating texture", e); } }
/** * Inicia el Visor OpenGL indicando la instancia de partido, las dimensiones de la pantalla * (sx,sy), si Se ejecuta en pantalla completa(fullscreen), e indicando la instancia del jframe * Principal(dejar nulo) * * @param partido * @param sx * @param sy * @param fullscreen * @param principal * @throws SlickException */ public VisorOpenGl(Partido partido, int sx, int sy, boolean fullscreen, PrincipalFrame principal) throws SlickException { this.partido = partido; this.sx = sx; this.sy = sy; this.dxsaque = (sx + 300 * 2) / 75; sx2 = sx / 2; sy2 = sy / 2; this.principal = principal; AppGameContainer container = new AppGameContainer(this); container.setForceExit(false); container.setDisplayMode(sx, sy, fullscreen); container.start(); SoundStore.get().clear(); InternalTextureLoader.get().clear(); }
void stop() { SoundStore.get().clear(); InternalTextureLoader.get().clear(); if (partido.fueGrabado()) { if (JOptionPane.showConfirmDialog( principal, "Desea guardar el partido?", "Guardar Partido", JOptionPane.YES_NO_OPTION) == 0) { if (jfc.showSaveDialog(principal) == JFileChooser.APPROVE_OPTION) { try { partido.getPartidoGuardado().save(jfc.getSelectedFile()); if (principal != null) { principal.addGuardadoLocal(new File[] {jfc.getSelectedFile()}); } } catch (Exception ex) { logger.error("Error al guardar partido", ex); } } } } if (sonidos) { for (Sound s : ambiente) { s.stop(); } gol.stop(); remate[0].stop(); remate[1].stop(); poste[0].stop(); poste[1].stop(); ovacion[0].stop(); ovacion[1].stop(); rebote.stop(); silbato.stop(); } if (principal != null) { principal.setVisible(true); principal.requestFocus(); } else { System.exit(0); } }
/** * Inicia el Visor OpenGL indicando la instancia de partido guardado, las dimensiones de la * pantalla (sx,sy), si Se ejecuta en pantalla completa(fullscreen), e indicando la instancia del * jframe Principal(dejar nulo) */ public VisorOpenGl( PartidoGuardado partido, int sx, int sy, boolean fullscreen, PrincipalFrame principal) throws SlickException { pg = (PartidoGuardado) partido; guardado = true; progreso = true; inicio = 0; fin = pg.getIterciones() - 1; // System.out.println("Reproduciendo partido guardado..."); this.partido = partido; this.sx = sx; this.sy = sy; this.dxsaque = (sx + 300 * 2) / 75; sx2 = sx / 2; sy2 = sy / 2; this.principal = principal; AppGameContainer container = new AppGameContainer(this); container.setForceExit(false); container.setDisplayMode(sx, sy, fullscreen); container.start(); SoundStore.get().clear(); InternalTextureLoader.get().clear(); }