Display.sync(frameRateCap);
Display.sync(30);
@Override public void postUpdate(GameState currentState, float delta) { Display.update(); if (!displayThreadActions.isEmpty()) { List<Runnable> actions = Lists.newArrayListWithExpectedSize(displayThreadActions.size()); displayThreadActions.drainTo(actions); actions.forEach(Runnable::run); } int frameLimit = context.get(Config.class).getRendering().getFrameLimit(); if (frameLimit > 0) { Display.sync(frameLimit); } currentState.render(); lwjglDisplay.update(); if (lwjglDisplay.isCloseRequested()) { engine.shutdown(); } }
void render (boolean shouldRender) throws LWJGLException { if (!running) return; setGlobals(); canvas.setCursor(cursor); int width = Math.max(1, graphics.getWidth()); int height = Math.max(1, graphics.getHeight()); if (lastWidth != width || lastHeight != height) { lastWidth = width; lastHeight = height; Gdx.gl.glViewport(0, 0, lastWidth, lastHeight); resize(width, height); listener.resize(width, height); shouldRender = true; } if (executeRunnables()) shouldRender = true; // If one of the runnables set running to false, for example after an exit(). if (!running) return; shouldRender |= graphics.shouldRender(); input.processEvents(); if (audio != null) audio.update(); if (shouldRender) { graphics.updateTime(); graphics.frameId++; listener.render(); canvas.swapBuffers(); } Display.sync(getFrameRate() * instanceCount); }
void render (boolean shouldRender) throws LWJGLException { if (!running) return; setGlobals(); canvas.setCursor(cursor); int width = Math.max(1, graphics.getWidth()); int height = Math.max(1, graphics.getHeight()); if (lastWidth != width || lastHeight != height) { lastWidth = width; lastHeight = height; Gdx.gl.glViewport(0, 0, lastWidth, lastHeight); resize(width, height); listener.resize(width, height); shouldRender = true; } if (executeRunnables()) shouldRender = true; // If one of the runnables set running to false, for example after an exit(). if (!running) return; shouldRender |= graphics.shouldRender(); input.processEvents(); if (audio != null) audio.update(); if (shouldRender) { graphics.updateTime(); graphics.frameId++; listener.render(); canvas.swapBuffers(); } Display.sync(getFrameRate() * instanceCount); }
protected void runLoop(){ if (!created.get()) { throw new IllegalStateException(); } if (pbuffer.isBufferLost()) { pbuffer.destroy(); try { pbuffer = new Pbuffer(width, height, pixelFormat, null); pbuffer.makeCurrent(); // Context MUST be reset here to avoid invalid objects! renderer.invalidateState(); } catch (LWJGLException ex) { listener.handleError("Failed to restore pbuffer content", ex); } } listener.update(); assert checkGLError(); renderer.postFrame(); // Need to flush GL commands // to see any result on the pbuffer's front buffer. GL11.glFlush(); int frameRate = settings.getFrameRate(); if (frameRate >= 1) { Display.sync(frameRate); } }
Display.sync(getFrameRate()); } catch (Throwable ex) { exception(ex);
Display.sync(getFrameRate()); } catch (Throwable ex) { exception(ex);
if (frameRate == 0) frameRate = 30; if (frameRate > 0) Display.sync(frameRate);
if (frameRate == 0) frameRate = 30; if (frameRate > 0) Display.sync(frameRate);
Display.sync(frameRateCap);
Display.sync(30);
protected void runLoop(){ if (!created.get()) { throw new IllegalStateException(); } if (pbuffer.isBufferLost()) { pbuffer.destroy(); try { pbuffer = new Pbuffer(width, height, pixelFormat, null); pbuffer.makeCurrent(); // Context MUST be reset here to avoid invalid objects! renderer.invalidateState(); } catch (LWJGLException ex) { listener.handleError("Failed to restore pbuffer content", ex); } } listener.update(); checkGLError(); renderer.postFrame(); // Need to flush GL commands // to see any result on the pbuffer's front buffer. GL11.glFlush(); int frameRate = settings.getFrameRate(); if (frameRate >= 1) { Display.sync(frameRate); } }
@Override protected void loop () { boolean wasActive = Display.isActive(); while (!Display.isCloseRequested()) { // notify the app if lose or regain focus (treat said as pause/resume) boolean newActive = Display.isActive(); if (wasActive != newActive) { dispatchEvent(lifecycle, wasActive ? Lifecycle.PAUSE : Lifecycle.RESUME); wasActive = newActive; } ((LWJGLGraphics)graphics()).checkScaleFactor(); // process frame, if we don't need to provide true pausing if (newActive || !config.truePause) processFrame(); Display.update(); // sleep until it's time for the next frame Display.sync(60); } }
@Override public void run(final Game game) { if (!config.headless) { try { Display.create(); } catch (LWJGLException e) { throw new RuntimeException(e); } } init(game); boolean wasActive = Display.isActive(); while (!Display.isCloseRequested()) { // Notify the app if lose or regain focus (treat said as pause/resume). boolean newActive = Display.isActive(); if (wasActive != newActive) { if (wasActive) onPause(); else onResume(); wasActive = newActive; } // Process frame, if we don't need to provide true pausing if (newActive || !config.truePause) processFrame(game); Display.update(); // Sleep until it's time for the next frame. Display.sync(60); } shutdown(); }
@Override public void run(final Game game) { if (!config.headless) { try { Display.create(); } catch (LWJGLException e) { throw new RuntimeException(e); } } init(game); boolean wasActive = Display.isActive(); while (!Display.isCloseRequested()) { // Notify the app if lose or regain focus (treat said as pause/resume). boolean newActive = Display.isActive(); if (wasActive != newActive) { if (wasActive) onPause(); else onResume(); wasActive = newActive; } // Process frame, if we don't need to provide true pausing if (newActive || !config.truePause) processFrame(game); Display.update(); // Sleep until it's time for the next frame. Display.sync(60); } shutdown(); }
void render (boolean shouldRender) throws LWJGLException { if (!running) return; setGlobals(); canvas.setCursor(cursor); int width = Math.max(1, graphics.getWidth()); int height = Math.max(1, graphics.getHeight()); if (lastWidth != width || lastHeight != height) { lastWidth = width; lastHeight = height; Gdx.gl.glViewport(0, 0, lastWidth, lastHeight); resize(width, height); listener.resize(width, height); shouldRender = true; } if (executeRunnables()) shouldRender = true; // If one of the runnables set running to false, for example after an exit(). if (!running) return; shouldRender |= graphics.shouldRender(); input.processEvents(); if (audio != null) audio.update(); if (shouldRender) { graphics.updateTime(); graphics.frameId++; listener.render(); canvas.swapBuffers(); } Display.sync(getFrameRate() * instanceCount); }
Display.sync(getFrameRate()); } catch (Throwable ex) { exception(ex);
Display.sync(60); checkGLError("VanillaFix GUI Loop");