loadNatives(); logger.log(Level.FINE, "Using LWJGL {0}", Sys.getVersion()); if (!initInThread()) { logger.log(Level.SEVERE, "Display initialization failed. Cannot continue."); return; runLoop(); deinitInThread();
public void destroy() { if (!context.isRenderable()) return; Keyboard.destroy(); logger.fine("Keyboard destroyed."); }
/** * De-initialize in the OpenGL thread. */ protected void deinitInThread(){ destroyContext(); listener.destroy(); logger.fine("Display destroyed."); super.internalDestroy(); }
public void destroy(boolean waitFor){ needClose.set(true); if (waitFor) waitFor(false); }
public void uncaughtException(Thread thread, Throwable thrown) { listener.handleError("Uncaught exception thrown in "+thread.toString(), thrown); if (needClose.get()){ // listener.handleError() has requested the // context to close. Satisfy request. deinitInThread(); } } });
public void setCursorVisible(boolean visible){ cursorVisible = visible; if (!context.isRenderable()) return; Mouse.setGrabbed(!visible); }
@Override public void runLoop(){ // This method is overriden to do restart if (needRestart.getAndSet(false)) { try { createContext(settings); } catch (LWJGLException ex) { logger.log(Level.SEVERE, "Failed to set display settings!", ex); } listener.reshape(settings.getWidth(), settings.getHeight()); logger.fine("Display restarted."); } else if (Display.wasResized()) { int newWidth = Display.getWidth(); int newHeight = Display.getHeight(); settings.setResolution(newWidth, newHeight); listener.reshape(newWidth, newHeight); } super.runLoop(); }
/** * De-initialize in the OpenGL thread. */ protected void deinitInThread(){ destroyContext(); listener.destroy(); logger.fine("Display destroyed."); super.internalDestroy(); }
public void destroy(boolean waitFor){ needClose.set(true); if (waitFor) waitFor(false); }
public void uncaughtException(Thread thread, Throwable thrown) { listener.handleError("Uncaught exception thrown in "+thread.toString(), thrown); if (needClose.get()){ // listener.handleError() has requested the // context to close. Satisfy request. deinitInThread(); } } });
loadNatives(); logger.log(Level.FINE, "Using LWJGL {0}", Sys.getVersion()); if (!initInThread()) { logger.log(Level.SEVERE, "Display initialization failed. Cannot continue."); return; runLoop(); deinitInThread();
public void destroy() { if (!context.isRenderable()) return; Mouse.destroy(); // Destroy the cursor cache for (Cursor cursor : cursorMap.values()) { cursor.destroy(); } cursorMap.clear(); logger.fine("Mouse destroyed."); }
public void initialize() { if (!context.isRenderable()) return; try { Keyboard.create(); Keyboard.enableRepeatEvents(true); logger.fine("Keyboard created."); } catch (LWJGLException ex) { logger.log(Level.SEVERE, "Error while creating keyboard.", ex); } }
@Override public void runLoop(){ // This method is overriden to do restart if (needRestart.getAndSet(false)) { try { createContext(settings); } catch (LWJGLException ex) { logger.log(Level.SEVERE, "Failed to set display settings!", ex); } listener.reshape(settings.getWidth(), settings.getHeight()); logger.fine("Display restarted."); } else if (Display.wasResized()) { int newWidth = Display.getWidth(); int newHeight = Display.getHeight(); settings.setResolution(newWidth, newHeight); listener.reshape(newWidth, newHeight); } super.runLoop(); }