fixed issue with signed/unsigned code dialog popping up
This commit is contained in:
parent
74d25bcffe
commit
29ff75e8d5
|
@ -33,6 +33,7 @@ package org.lwjgl.examples.spaceinvaders;
|
|||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.Image;
|
||||
import java.awt.color.ColorSpace;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ColorModel;
|
||||
|
@ -41,7 +42,6 @@ import java.awt.image.DataBuffer;
|
|||
import java.awt.image.DataBufferByte;
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.WritableRaster;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
|
@ -50,7 +50,7 @@ import java.nio.IntBuffer;
|
|||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.ImageIcon;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
|
||||
|
@ -277,7 +277,14 @@ public class TextureLoader {
|
|||
throw new IOException("Cannot find: " + ref);
|
||||
}
|
||||
|
||||
BufferedImage bufferedImage = ImageIO.read(new BufferedInputStream(getClass().getClassLoader().getResourceAsStream(ref)));
|
||||
// due to an issue with ImageIO and mixed signed code
|
||||
// we are now using good oldfashioned ImageIcon to load
|
||||
// images and the paint it on top of a new BufferedImage
|
||||
Image img = new ImageIcon(url).getImage();
|
||||
BufferedImage bufferedImage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);
|
||||
Graphics g = bufferedImage.getGraphics();
|
||||
g.drawImage(img, 0, 0, null);
|
||||
g.dispose();
|
||||
|
||||
return bufferedImage;
|
||||
}
|
||||
|
|
|
@ -46,6 +46,8 @@ import javax.sound.sampled.AudioSystem;
|
|||
|
||||
import org.lwjgl.openal.AL10;
|
||||
|
||||
import com.sun.media.sound.WaveFileReader;
|
||||
|
||||
/**
|
||||
*
|
||||
* Utitlity class for loading wavefiles.
|
||||
|
@ -92,9 +94,11 @@ public class WaveData {
|
|||
*/
|
||||
public static WaveData create(URL path) {
|
||||
try {
|
||||
return create(
|
||||
AudioSystem.getAudioInputStream(
|
||||
new BufferedInputStream(path.openStream())));
|
||||
// due to an issue with AudioSystem.getAudioInputStream
|
||||
// and mixing unsigned and signed code
|
||||
// we will use the reader directly
|
||||
WaveFileReader wfr = new WaveFileReader();
|
||||
return create(wfr.getAudioInputStream(new BufferedInputStream(path.openStream())));
|
||||
} catch (Exception e) {
|
||||
org.lwjgl.LWJGLUtil.log("Unable to create from: " + path + ", " + e.getMessage());
|
||||
return null;
|
||||
|
|
Loading…
Reference in New Issue