@Override public long getNoMouseMovementTime() { long now = timeProvider.getMsTime(); return now - lastMouseMoveEventTime; }
/** * Get the current timestamp. * * @return the current timestamp */ private static long now() { return timeProvider.getMsTime(); } }
/** * The standard constructor. You'll use this in production code. Using this * constructor will configure the RenderDevice to not log FPS on System.out. */ public Lwjgl3RenderDevice(final long glfwWindow) { this.glfwWindow = glfwWindow; time = timeProvider.getMsTime(); frames = 0; }
/** * The standard constructor. You'll use this in production code. Using this * constructor will configure the RenderDevice to not log FPS on System.out. */ public LwjglRenderDevice() { time = timeProvider.getMsTime(); frames = 0; }
public void start() { startTime = timeProvider.getMsTime(); } }
public long stop() { return timeProvider.getMsTime() - startTime; }
/** * The standard constructor. You'll use this in production code. Using this constructor will * configure the RenderDevice to not log FPS on System.out. * @param newtWindow the current window handling the rendering context */ public JoglRenderDevice(final Window newtWindow) { if(newtWindow == null) log.warning("newtWindow parameter is null - some RenderDevice operations may not work properly"); this.newtWindow = newtWindow; time = timeProvider.getMsTime(); frames = 0; }
public NiftyMouseImpl( @Nonnull final RenderDevice renderDevice, @Nonnull final InputSystem inputSystem, @Nonnull final TimeProvider timeProvider) { this.renderDevice = renderDevice; this.inputSystem = inputSystem; this.timeProvider = timeProvider; lastMouseMoveEventTime = timeProvider.getMsTime(); registeredMouseCursors = new HashMap<String, MouseCursor>(); }
public void updateMousePosition(final int x, final int y) { if (positionChanged(x, y)) { lastMouseMoveEventTime = timeProvider.getMsTime(); } mouseX = x; mouseY = y; }
/** * start the interpolation. */ public void start() { interpolatorProvider.start(); value = 0.0f; startTime = timeProvider.getMsTime() + startDelayParam; }
private void updateSoundSystem() { long current = timeProvider.getMsTime(); int delta = (int) (current - lastTime); soundSystem.update(delta); lastTime = current; }
/** * Reset the pulsator. */ public void reset() { pulsateProvider.reset(timeProvider.getMsTime()); }
/** * update the value. * * @return true when still active and false when done */ public float update() { return pulsateProvider.getValue(timeProvider.getMsTime()); } }
public boolean validateNiftyXml( @Nonnull final String schemaId, @Nonnull @WillClose final InputStream inputStreamXml) throws Exception { long start = timeProvider.getMsTime(); validate(schemaId, inputStreamXml); long end = timeProvider.getMsTime(); log.fine("validating nifty xml took [" + (end - start) + " ms]"); return true; }
/** * update the value. * * @return true when still active and false when done */ public final boolean update() { long now = timeProvider.getMsTime(); long timePassed = now - startTime; if (timePassed < 0) { return true; } this.value = interpolatorProvider.getValue(lengthParam, timePassed); if (this.value > 1.0f) { this.value = 1.0f; return false; } else { return true; } }
/** * load from the given file. * * @param stream stream to load */ void loadFromStream(@Nonnull @WillClose final InputStream stream) { log.fine("loadFromStream []"); try { long start = timeProvider.getMsTime(); NiftyType niftyType = loader.loadNiftyXml("nifty.nxs", stream); niftyType.create(this, timeProvider); if (log.isLoggable(Level.FINE)) { log.fine(niftyType.output()); } long end = timeProvider.getMsTime(); log.fine("loadFromStream took [" + (end - start) + "]"); } catch (Exception e) { throw new RuntimeException(e); } }
/** * load from the given file. * * @param filename filename to load */ void loadFromFile(@Nonnull final String filename) { log.fine("loadFromFile [" + filename + "]"); try { long start = timeProvider.getMsTime(); final InputStream stream = getResourceAsStream(filename); if (stream == null) { throw new IOException("Failed to open stream to resource \"" + filename + "\" for loading."); } NiftyType niftyType = loader.loadNiftyXml("nifty.nxs", stream); niftyType.create(this, timeProvider); if (log.isLoggable(Level.FINE)) { log.fine(niftyType.output()); } long end = timeProvider.getMsTime(); log.fine("loadFromFile took [" + (end - start) + "]"); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void endFrame() { log.fine("endFrame"); frames++; long diff = timeProvider.getMsTime() - time; if (diff >= 1000) { time += diff; lastFrames = frames; if (logFPS) { System.out.println("fps: " + frames); } frames = 0; } if (displayFPS && fpsFont != null) { renderFont(fpsFont, "FPS: " + String.valueOf(lastFrames), 10, getHeight() - fpsFont.getHeight() - 10, Color.WHITE, 1.0f, 1.0f); } }
log.fine("endFrame"); frames++; long diff = timeProvider.getMsTime() - time; if (diff >= 1000) { time += diff;
log.fine("endFrame"); frames++; long diff = timeProvider.getMsTime() - time; if (diff >= 1000) { time += diff;