/** * Loads a JSON encoded library synchronously. * @param baseDir The base directory, containing library.json and texture atlases. */ public static Library loadLibrarySync (final Platform plat, String baseDir) throws Exception { final ImageLoader syncLoader = new ImageLoader() { @Override public Image load (String path) { return plat.assets().getImageSync(path); } }; String text = plat.assets().getTextSync(baseDir + "/library.json"); Try<Library> result = decodeLibrary(plat.json().parse(text), baseDir, syncLoader).result(); if (result.isSuccess()) return result.get(); Throwable error = result.getFailure(); if (error instanceof Exception) throw (Exception)error; else throw new RuntimeException(error); }