* Fix android runtime error due to BufferedImage being used in AppSettings

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7621 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
sha..rd 14 years ago
parent 524dadca71
commit 39a7c743af
  1. 7
      engine/src/core/com/jme3/system/AppSettings.java
  2. 5
      engine/src/desktop/com/jme3/app/SettingsDialog.java
  3. 8
      engine/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglDisplay.java

@ -32,7 +32,6 @@
package com.jme3.system; package com.jme3.system;
import com.jme3.renderer.Renderer; import com.jme3.renderer.Renderer;
import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
@ -376,7 +375,7 @@ public class AppSettings extends HashMap<String, Object> {
* @param value An array of BufferedImages to use as icons. * @param value An array of BufferedImages to use as icons.
* (Default: not set) * (Default: not set)
*/ */
public void setIcons(BufferedImage[] value) { public void setIcons(Object[] value) {
put("Icons", value); put("Icons", value);
} }
@ -440,8 +439,8 @@ public class AppSettings extends HashMap<String, Object> {
return getString("AudioRenderer"); return getString("AudioRenderer");
} }
public BufferedImage[] getIcons() { public Object[] getIcons() {
return (BufferedImage[]) get("Icons"); return (Object[]) get("Icons");
} }
public void setSettingsDialogImage(String path) { public void setSettingsDialogImage(String path) {

@ -45,6 +45,7 @@ import java.awt.event.KeyEvent;
import java.awt.event.KeyListener; import java.awt.event.KeyListener;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.awt.image.BufferedImage;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
@ -250,8 +251,8 @@ public final class SettingsDialog extends JDialog {
} }
}); });
if(source.getIcons()!=null){ if (source.getIcons() != null) {
safeSetIconImages(Arrays.asList(source.getIcons())); safeSetIconImages( (List<BufferedImage>) Arrays.asList((BufferedImage[]) source.getIcons()) );
} }
setTitle("Select Display Settings"); setTitle("Select Display Settings");

@ -113,8 +113,9 @@ public class LwjglDisplay extends LwjglAbstractDisplay {
if (displayMode != null) if (displayMode != null)
Display.setDisplayMode(displayMode); Display.setDisplayMode(displayMode);
if (settings.getIcons() != null) if (settings.getIcons() != null) {
Display.setIcon(imagesToByteBuffers(settings.getIcons())); Display.setIcon(imagesToByteBuffers(settings.getIcons()));
}
Display.setFullscreen(settings.isFullscreen()); Display.setFullscreen(settings.isFullscreen());
Display.setVSyncEnabled(settings.isVSync()); Display.setVSyncEnabled(settings.isVSync());
@ -190,10 +191,11 @@ public class LwjglDisplay extends LwjglAbstractDisplay {
Display.setTitle(title); Display.setTitle(title);
} }
private ByteBuffer[] imagesToByteBuffers(BufferedImage[] images) { private ByteBuffer[] imagesToByteBuffers(Object[] images) {
ByteBuffer[] out = new ByteBuffer[images.length]; ByteBuffer[] out = new ByteBuffer[images.length];
for (int i = 0; i < images.length; i++) { for (int i = 0; i < images.length; i++) {
out[i] = imageToByteBuffer(images[i]); BufferedImage image = (BufferedImage) images[i];
out[i] = imageToByteBuffer(image);
} }
return out; return out;
} }

Loading…
Cancel
Save