|
From: <ma...@us...> - 2010-10-12 15:34:33
|
Revision: 3438
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3438&view=rev
Author: matzon
Date: 2010-10-12 15:34:26 +0000 (Tue, 12 Oct 2010)
Log Message:
-----------
fixed issue with signed/unsigned code dialog popping up
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java
trunk/LWJGL/src/java/org/lwjgl/util/WaveData.java
Modified: trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java 2010-10-12 09:32:34 UTC (rev 3437)
+++ trunk/LWJGL/src/java/org/lwjgl/examples/spaceinvaders/TextureLoader.java 2010-10-12 15:34:26 UTC (rev 3438)
@@ -33,6 +33,7 @@
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.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.util.HashMap;
import java.util.Hashtable;
-import javax.imageio.ImageIO;
+import javax.swing.ImageIcon;
import org.lwjgl.BufferUtils;
@@ -277,7 +277,14 @@
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;
}
Modified: trunk/LWJGL/src/java/org/lwjgl/util/WaveData.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/WaveData.java 2010-10-12 09:32:34 UTC (rev 3437)
+++ trunk/LWJGL/src/java/org/lwjgl/util/WaveData.java 2010-10-12 15:34:26 UTC (rev 3438)
@@ -46,6 +46,8 @@
import org.lwjgl.openal.AL10;
+import com.sun.media.sound.WaveFileReader;
+
/**
*
* Utitlity class for loading wavefiles.
@@ -92,9 +94,11 @@
*/
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;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|