Jelajahi Sumber

* AssetPathURL now accepts non-relative asset paths
* ZipLocator will now crash if the specified zip file does not exist
* Fixed crash when restarting context with pixel format changes

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7914 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

sha..rd 14 tahun lalu
induk
melakukan
73aa30785b

+ 1 - 1
engine/src/core/com/jme3/app/Application.java

@@ -158,7 +158,7 @@ public class Application implements SystemListener {
                 } catch (MalformedURLException ex) {
                 } catch (MalformedURLException ex) {
                 }
                 }
                 if (url == null) {
                 if (url == null) {
-                    url = Application.class.getResource(assetCfg);
+                    url = Application.class.getClassLoader().getResource(assetCfg);
                     if (url == null) {
                     if (url == null) {
                         logger.log(Level.SEVERE, "Unable to access AssetConfigURL in asset config:{0}", assetCfg);
                         logger.log(Level.SEVERE, "Unable to access AssetConfigURL in asset config:{0}", assetCfg);
                         return;
                         return;

+ 3 - 4
engine/src/desktop/com/jme3/asset/plugins/ZipLocator.java

@@ -34,12 +34,12 @@ package com.jme3.asset.plugins;
 
 
 import com.jme3.asset.AssetInfo;
 import com.jme3.asset.AssetInfo;
 import com.jme3.asset.AssetKey;
 import com.jme3.asset.AssetKey;
+import com.jme3.asset.AssetLoadException;
 import com.jme3.asset.AssetLocator;
 import com.jme3.asset.AssetLocator;
 import com.jme3.asset.AssetManager;
 import com.jme3.asset.AssetManager;
 import java.io.File;
 import java.io.File;
 import java.io.IOException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStream;
-import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.logging.Logger;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 import java.util.zip.ZipFile;
@@ -66,9 +66,8 @@ public class ZipLocator implements AssetLocator {
             try{
             try{
                 return zipfile.getInputStream(entry);
                 return zipfile.getInputStream(entry);
             }catch (IOException ex){
             }catch (IOException ex){
-                logger.log(Level.WARNING, "Failed to load zip entry: "+entry, ex);
+                throw new AssetLoadException("Failed to load zip entry: "+entry, ex);
             }
             }
-            return null;
         }
         }
     }
     }
 
 
@@ -76,7 +75,7 @@ public class ZipLocator implements AssetLocator {
         try{
         try{
             zipfile = new ZipFile(new File(rootPath), ZipFile.OPEN_READ);
             zipfile = new ZipFile(new File(rootPath), ZipFile.OPEN_READ);
         }catch (IOException ex){
         }catch (IOException ex){
-            logger.log(Level.WARNING, "Failed to open zip file: "+rootPath, ex);
+            throw new AssetLoadException("Failed to open zip file: " + rootPath, ex);
         }
         }
     }
     }
 
 

+ 1 - 1
engine/src/lwjgl-ogl/com/jme3/system/lwjgl/LwjglDisplay.java

@@ -126,7 +126,7 @@ public class LwjglDisplay extends LwjglAbstractDisplay {
         
         
         Display.setVSyncEnabled(settings.isVSync());
         Display.setVSyncEnabled(settings.isVSync());
         
         
-        if (created.get()){
+        if (created.get() && !pixelFormatChanged){
             Display.releaseContext();
             Display.releaseContext();
             Display.makeCurrent();
             Display.makeCurrent();
             Display.update();
             Display.update();