/** Logs {@code msg} at the debug level. */ public void debug (String msg) { debug(msg, (Throwable)null); }
/** Logs {@code msg} at the debug level. */ public void debug (String msg) { debug(msg, (Throwable)null); }
@Override public String getTextSync(String path) throws Exception { plat.log().debug("Loading text " + path); ByteBuffer data = getBytesSync(path); byte[] bytes; if (data.hasArray()) bytes = data.array(); else data.get(bytes = new byte[data.remaining()]); return new String(bytes, "UTF-8"); }
@Override public byte[] getBytesSync(String path) throws Exception { File fullPath = resolvePath(path); platform.log().debug("Loading bytes " + fullPath); FileInputStream in = new FileInputStream(fullPath); try { byte[] data = new byte[(int)fullPath.length()]; if (in.read(data) != data.length) { throw new IOException("Failed to read entire file: " + fullPath); } return data; } finally { in.close(); } }
@Override public String getTextSync(String path) throws Exception { platform.log().debug("Loading text " + path); return new String(getBytesSync(path), "UTF-8"); }
/** 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 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 FlashMovieImplPlayN() { if (Window.Navigator.getUserAgent().indexOf("MSIE") != -1) { impl = new FlashMovieImplIE6(); } else { impl = new FlashMovieImplSafari(); } PlayN.log().debug("CHOSE: " + impl.getClass().getName()); }
@Override public void setMouseLocked(boolean locked) { if (locked) { if (hasMouseLock()) { isRequestingMouseLock = true; plat.log().debug("Requesting mouse lock (supported)"); } else { plat.log().debug("Requesting mouse lock -- but unsupported"); } } else { plat.log().debug("Requesting mouse unlock"); if (hasMouseLock()) { isRequestingMouseLock = false; unlockImpl(); } } }
@Override public void setMouseLocked(boolean locked) { if (locked) { if (hasMouseLock()) { isRequestingMouseLock = true; plat.log().debug("Requesting mouse lock (supported)"); } else { plat.log().debug("Requesting mouse lock -- but unsupported"); } } else { plat.log().debug("Requesting mouse unlock"); if (hasMouseLock()) { isRequestingMouseLock = false; unlockImpl(); } } }
public HtmlAudio (HtmlPlatform plat) { this.plat = plat; @SuppressWarnings("deprecation") SoundType[] types = soundController.getPreferredSoundTypes(); plat.log().debug("Preferred sound type(s): " + types); // Attempt to create Web Audio API audio context audioContext = maybeCreateAudioContext(); }
boolean isFlash9AudioPluginMissingImpl() { boolean supported = FlashMovie.isExternalInterfaceSupported(); int version = FlashMovie.getMajorVersion(); plat.log().debug("FlashMovie.isExternalInterfaceSupported: " + supported + ", getMajorVersion: " + version); // if Flash plugin is operational and at least version 9, then it's not "missing" return (supported && version < 9); } }
@Override public void unlock() { PlayN.log().debug("Requesting mouse unlock"); isRequestingMouseLock = false; if (isLockSupported()) { unlockImpl(); } }
public HtmlAudio (HtmlPlatform plat) { this.plat = plat; @SuppressWarnings("deprecation") SoundType[] types = soundController.getPreferredSoundTypes(); plat.log().debug("Preferred sound type(s): " + types); // Attempt to create Web Audio API audio context audioContext = maybeCreateAudioContext(); }
boolean isFlash9AudioPluginMissingImpl() { boolean supported = FlashMovie.isExternalInterfaceSupported(); int version = FlashMovie.getMajorVersion(); plat.log().debug("FlashMovie.isExternalInterfaceSupported: " + supported + ", getMajorVersion: " + version); // if Flash plugin is operational and at least version 9, then it's not "missing" return (supported && version < 9); } }
private static void print (Log log, Layer layer, String prefix) { log.debug(prefix + layer); if (layer instanceof GroupLayer) { String gprefix = prefix + " "; GroupLayer glayer = (GroupLayer)layer; for (int ii = 0, ll = glayer.children(); ii < ll; ii++) { print(log, glayer.childAt(ii), gprefix); } } } }
@Override public ByteBuffer getBytesSync(String path) throws Exception { File fullPath = resolvePath(path); plat.log().debug("Loading bytes " + fullPath); // this NSData will release resources when garbage collected return NSData.read(fullPath, READ_OPTS).asByteBuffer(); }
@Override public void setSize (int width, int height, boolean fullscreen) { if (plat.config.fullscreen != fullscreen) { plat.log().warn("fullscreen cannot be changed via setSize, use config.fullscreen instead"); return; } GLFWVidMode vidMode = glfwGetVideoMode(glfwGetPrimaryMonitor()); if (width > vidMode.width()) { plat.log().debug("Capping window width at desktop width: " + width + " -> " + vidMode.width()); width = vidMode.width(); } if (height > vidMode.height()) { plat.log().debug("Capping window height at desktop height: " + height + " -> " + vidMode.height()); height = vidMode.height(); } glfwSetWindowSize(window, width, height); // plat.log().info("setSize: " + width + "x" + height); viewSizeM.setSize(width, height); IntBuffer fbSize = BufferUtils.createIntBuffer(2); long addr = MemoryUtil.memAddress(fbSize); nglfwGetFramebufferSize(window, addr, addr + 4); viewportAndScaleChanged(fbSize.get(0), fbSize.get(1)); }
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; } } }