Bluecora Posted April 26, 2012 at 10:31 PM Report #451683 Posted April 26, 2012 at 10:31 PM Oi pessoal não consigo tirar screenshot's ao meu jogo Java, o resultado e sempre uma imagem branca :S, alguém pode dar uma ajuda sff
HappyHippyHippo Posted April 26, 2012 at 10:41 PM Report #451688 Posted April 26, 2012 at 10:41 PM estas a dizer que queres tirar uma screenshot do teu jogo com código ou somente a carregar na tecla "PrintScreen" ?? se o teu problema é a primeira tens http://www.java-tips.org/java-se-tips/java.awt/how-to-capture-screenshot.html IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
Bluecora Posted April 26, 2012 at 10:51 PM Author Report #451689 Posted April 26, 2012 at 10:51 PM hum meti o código que me deste ele realmente cria o ficheiro no directório que eu lhe digo mas a imagem continua branca ;S
HappyHippyHippo Posted April 26, 2012 at 10:55 PM Report #451691 Posted April 26, 2012 at 10:55 PM estranho ... estás a usar opengl ?? se sim, deverias ter dito à partida porque são coisas diferetes tenta isto http://coitweb.uncc.edu/~krs/courses/4120-5120/handouts/jogl-tutorial.pdf IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
Bluecora Posted April 26, 2012 at 10:57 PM Author Report #451692 Posted April 26, 2012 at 10:57 PM Estou usar o eclipse :S será esta a resposta certa?
HappyHippyHippo Posted April 26, 2012 at 10:59 PM Report #451694 Posted April 26, 2012 at 10:59 PM não .. resposta errada ... faz post do teu código de apresentação de imagens para ver o método que usas IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
Bluecora Posted April 26, 2012 at 11:04 PM Author Report #451697 Posted April 26, 2012 at 11:04 PM if(keyCode==KeyEvent.VK_PRINTSCREEN){ try { Robot robot = new Robot(); // Capture the screen shot of the area of the screen defined by the rectangle BufferedImage bi=robot.createScreenCapture(new Rectangle(800,600)); ImageIO.write(bi, "jpg", new File("C:/Users/Rui/Desktop/imageTest.jpg")); } catch (AWTException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } }
HappyHippyHippo Posted April 26, 2012 at 11:15 PM Report #451699 Posted April 26, 2012 at 11:15 PM não .. resposta errada ... faz post do teu código de apresentação de imagens para ver o método que usas esse foi o código que te disse para usares !!! não é o código que te pedi .... eu pedi o código que usas para apresentar as tuas imagens do jogo na janela !!! IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
Bluecora Posted April 27, 2012 at 02:23 PM Author Report #451782 Posted April 27, 2012 at 02:23 PM public void draw(Graphics g){ if(start){ g.drawImage(menu,0,0,null); if(emCimaB1) g.drawImage(botao1,310,300,null); else g.drawImage(botao2,310,300,null); } else{ g.drawImage(bg,0,0,null); g.drawImage(picos,150,390 ,null ); g.drawImage(baseFinal,605,450,null); g.drawImage(baseInicial,0,450,null); g.drawImage(prisao,600,0,null); g.drawImage(preso1.getImage(),0,0,null); g.drawImage(preso2.getImage(),80,0,null); g.drawImage(preso3.getImage(),160,0,null); g.drawImage(preso4.getImage(),210,0,null); g.drawImage(sprite.getImage(), Math.round(sprite.getX()),Math.round(sprite.getY()),null); g.drawImage(policia.getImage(),40,322,null); Window w =s.getFullScreenWindow(); g.setColor(w.getForeground()); g.drawString(mess,400,600); g.setColor(w.getForeground()); g.drawString(messe,40,50); } }
Bluecora Posted April 30, 2012 at 08:40 AM Author Report #452192 Posted April 30, 2012 at 08:40 AM Resolvido resulta em Ubunto mas nao resulta em windos x)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now