/** Logs {@code msg} at the info level. */ public void info (String msg) { info(msg, (Throwable)null); }
/** Logs {@code msg} at the debug level. */ public void debug (String msg) { debug(msg, (Throwable)null); }
public void reportError(String message, Throwable err) { log.warn(message, err); } };
/** Logs {@code msg} at the info level. * @param args additional arguments formatted via {@link #format} and appended to the message. * {@code args} may contain an exception as its lone final argument which will be logged long * with the formatted message. */ public void info (String msg, Object... args) { info(format(msg, args), getCause(args)); }
/** Logs {@code msg} at the error level. * @param args additional arguments formatted via {@link #format} and appended to the message. * {@code args} may contain an exception as its lone final argument which will be logged long * with the formatted message. */ public void error (String msg, Object... args) { error(format(msg, args), getCause(args)); }
/** Logs {@code msg} at the debug level. * @param args additional arguments formatted via {@link #format} and appended to the message. * {@code args} may contain an exception as its lone final argument which will be logged long * with the formatted message. */ public void debug (String msg, Object... args) { debug(format(msg, args), getCause(args)); }
public void log (Level level, String ident, String message, Throwable t) { String msg = ident + ": " + message; switch (level) { case DEBUG: if (t != null) plat.log().debug(msg, t); else plat.log().debug(msg); break; default: case INFO: if (t != null) plat.log().info(msg, t); else plat.log().info(msg); break; case WARNING: if (t != null) plat.log().warn(msg, t); else plat.log().warn(msg); break; case ERROR: if (t != null) plat.log().error(msg, t); else plat.log().error(msg); break; } } }
@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); }
/** Logs {@code msg} at the error level. */ public void error (String msg) { error(msg, (Throwable)null); }
/** Logs {@code msg} at the warn level. * @param args additional arguments formatted via {@link #format} and appended to the message. * {@code args} may contain an exception as its lone final argument which will be logged long * with the formatted message. */ public void warn (String msg, Object... args) { warn(format(msg, args), getCause(args)); }
@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); }
/** Logs {@code msg} at the error level. */ public void error (String msg) { error(msg, (Throwable)null); }
/** Logs {@code msg} at the info level. * @param args additional arguments formatted via {@link #format} and appended to the message. * {@code args} may contain an exception as its lone final argument which will be logged long * with the formatted message. */ public void info (String msg, Object... args) { info(format(msg, args), getCause(args)); }
/** Logs {@code msg} at the debug level. * @param args additional arguments formatted via {@link #format} and appended to the message. * {@code args} may contain an exception as its lone final argument which will be logged long * with the formatted message. */ public void debug (String msg, Object... args) { debug(format(msg, args), getCause(args)); }
/** Logs {@code msg} at the warn level. * @param args additional arguments formatted via {@link #format} and appended to the message. * {@code args} may contain an exception as its lone final argument which will be logged long * with the formatted message. */ public void warn (String msg, Object... args) { warn(format(msg, args), getCause(args)); }
/** Logs {@code msg} at the error level. * @param args additional arguments formatted via {@link #format} and appended to the message. * {@code args} may contain an exception as its lone final argument which will be logged long * with the formatted message. */ public void error (String msg, Object... args) { error(format(msg, args), getCause(args)); }
/** Logs {@code msg} at the info level. */ public void info (String msg) { info(msg, (Throwable)null); }
@Override public void invoke(long window, int keyCode, int scancode, int action, int mods) { double time = System.currentTimeMillis(); Key key = translateKey(keyCode); boolean pressed = action == GLFW_PRESS || action == GLFW_REPEAT; if (key != null) emitKeyPress(toModifierFlags(mods), time, key, pressed); else plat.log().warn("Unknown keyCode:" + keyCode); } };