protected int getFrameRate () { int frameRate = Display.isActive() ? graphics.config.foregroundFPS : graphics.config.backgroundFPS; if (frameRate == -1) frameRate = 10; if (frameRate == 0) frameRate = graphics.config.backgroundFPS; if (frameRate == 0) frameRate = 30; return frameRate; }
protected int getFrameRate () { int frameRate = Display.isActive() ? graphics.config.foregroundFPS : graphics.config.backgroundFPS; if (frameRate == -1) frameRate = 10; if (frameRate == 0) frameRate = graphics.config.backgroundFPS; if (frameRate == 0) frameRate = 30; return frameRate; }
@Override public boolean hasFocus() { return Display.isActive(); }
listener.requestClose(false); if (wasActive != Display.isActive()) { if (!wasActive) { listener.gainFocus();
if (Display.isCloseRequested()) exit(); boolean isActive = Display.isActive(); if (wasActive && !isActive) { // if it's just recently minimized from active state wasActive = false;
if (Display.isCloseRequested()) exit(); boolean isActive = Display.isActive(); if (wasActive && !isActive) { // if it's just recently minimized from active state wasActive = false;
/** * @see org.newdawn.slick.GameContainer#hasFocus() */ public boolean hasFocus() { // hmm, not really the right thing, talk to the LWJGL guys return Display.isActive(); }
protected int getFrameRate () { int frameRate = Display.isActive() ? graphics.config.foregroundFPS : graphics.config.backgroundFPS; if (frameRate == -1) frameRate = 10; if (frameRate == 0) frameRate = graphics.config.backgroundFPS; if (frameRate == 0) frameRate = 30; return frameRate; }
@Override public boolean isGameWindowReady() { return Display.isActive(); }
private void checkFocus() { // focusLost should be true if it is already true (hasn't been read/cleared yet), or // the display is presently not in focus _focusLost = _focusLost || !(Display.isActive() && Display.isVisible()); }
public boolean isActive() { return Display.isCreated() && Display.isActive(); }
private void checkFocus() { // focusLost should be true if it is already true (hasn't been read/cleared yet), or // the display is presently not in focus _focusLost = _focusLost || !(Display.isActive() && Display.isVisible()); // // final boolean newFocus = // // if (!focusLost && newFocus) { // // didn't use to have focus, but now we do // // do nothing for now, just keep track of the fact that we have focus // focusLost = newFocus; // } else if (focusLost && !newFocus) { // // had focus, but don't anymore - notify the physical input layer // physicalLayer.lostFocus(); // focusLost = newFocus; // } }
@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); } }
listener.requestClose(false); if (wasActive != Display.isActive()) { if (!wasActive) { listener.gainFocus();
@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(); }
if (Display.isCloseRequested()) exit(); boolean isActive = Display.isActive(); if (wasActive && !isActive) { // if it's just recently minimized from active state wasActive = false;
boolean isGameActive = Display.isActive(); if (wasActive && !isGameActive) { // if it's just recently minimized