@Override public Sound getMusic(String path) { return getSound(path, true); }
@Override public byte[] getBytesSync(String path) throws Exception { return requireResource(path).readBytes(); }
public byte[] readBytes() throws IOException { return toByteArray(openStream()); } public String readString() throws Exception {
@Override protected ImageImpl.Data load (String path) throws Exception { Exception error = null; for (Scale.ScaledResource rsrc : assetScale().getScaledResources(path)) { try { BufferedImage image = requireResource(rsrc.path).readImage(); // if image is at a higher scale factor than the view, scale to the view display factor Scale viewScale = plat.graphics().scale(), imageScale = rsrc.scale; float viewImageRatio = viewScale.factor / imageScale.factor; if (viewImageRatio < 1) { image = scaleImage(image, viewImageRatio); imageScale = viewScale; } if (plat.config.convertImagesOnLoad) { BufferedImage convertedImage = JavaGraphics.convertImage(image); if (convertedImage != image) { plat.log().debug("Converted image: " + path + " [type=" + image.getType() + "]"); image = convertedImage; } } return new ImageImpl.Data(imageScale, image, image.getWidth(), image.getHeight()); } catch (FileNotFoundException fnfe) { error = fnfe; // keep going, checking for lower resolution images } } plat.log().warn("Could not load image: " + path + " [error=" + error + "]"); throw error != null ? error : new FileNotFoundException(path); }
@Override protected ImageImpl.Data load (String path) throws Exception { Exception error = null; for (Scale.ScaledResource rsrc : assetScale().getScaledResources(path)) { try { BufferedImage image = requireResource(rsrc.path).readImage(); // if image is at a higher scale factor than the view, scale to the view display factor Scale viewScale = plat.graphics().scale(), imageScale = rsrc.scale; float viewImageRatio = viewScale.factor / imageScale.factor; if (viewImageRatio < 1) { image = scaleImage(image, viewImageRatio); imageScale = viewScale; } if (plat.config.convertImagesOnLoad) { BufferedImage convertedImage = JavaGraphics.convertImage(image); if (convertedImage != image) { plat.log().debug("Converted image: " + path + " [type=" + image.getType() + "]"); image = convertedImage; } } return new ImageImpl.Data(imageScale, image, image.getWidth(), image.getHeight()); } catch (FileNotFoundException fnfe) { error = fnfe; // keep going, checking for lower resolution images } } plat.log().warn("Could not load image: " + path + " [error=" + error + "]"); throw error != null ? error : new FileNotFoundException(path); }
@Override protected Image loadImage(String fullPath, ImageReceiver<BufferedImage> recv) { Exception error = null; for (Scale.ScaledResource rsrc : assetScale().getScaledResources(fullPath)) { try { BufferedImage image = requireResource(rsrc.path).readImage(); image = scaleImage(image, viewImageRatio); imageScale = viewScale;
@Override public String getTextSync(String path) throws Exception { return requireResource(path).readString(); }
public String readString() throws Exception { return new String(toByteArray(openStream()), "UTF-8"); } }
@Override public Sound getSound(String path) { return getSound(path, false); }
@Override protected Image loadImage(String fullPath, ImageReceiver<BufferedImage> recv) { Exception error = null; for (Scale.ScaledResource rsrc : assetScale().getScaledResources(fullPath)) { try { BufferedImage image = requireResource(rsrc.path).readImage(); image = scaleImage(image, viewImageRatio); imageScale = viewScale;
@Override public ByteBuffer getBytesSync(String path) throws Exception { return requireResource(path).readBytes(); }
public byte[] readBytes() throws IOException { return toByteArray(openStream()); } public String readString() throws Exception {
@Override public Sound getMusic(String path) { return getSound(path, true); }
/** * Loads a Java font from {@code path}. Currently only TrueType ({@code .ttf}) fonts are * supported. * * @param path the path to the font resource (relative to the asset manager's path prefix). * @throws Exception if an error occurs loading or decoding the font. */ public Font getFont(String path) throws Exception { return requireResource(path).createFont(); }
public ByteBuffer readBytes() throws IOException { return ByteBuffer.wrap(toByteArray(openStream())); } public String readString() throws Exception {
@Override public Sound getSound(String path) { return getSound(path, false); }
/** * Loads a Java font from {@code path}. Currently only TrueType ({@code .ttf}) fonts are * supported. * * @param path the path to the font resource (relative to the asset manager's path prefix). * @throws Exception if an error occurs loading or decoding the font. */ public Font getFont(String path) throws Exception { return requireResource(path).createFont(); }
public String readString() throws Exception { return new String(toByteArray(openStream()), "UTF-8"); } }
@Override public Sound getMusic(String path) { return getSound(path, true); }
@Override public String getTextSync(String path) throws Exception { return requireResource(path).readString(); }