Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added frame identification support. #2298

Merged
merged 1 commit into from Sep 7, 2014
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -69,6 +69,7 @@
protected long lastFrameTime = System.nanoTime();
protected float deltaTime = 0;
protected long frameStart = System.nanoTime();
protected long frameId = -1;
protected int frames = 0;
protected int fps;
protected WindowedMean mean = new WindowedMean(5);
@@ -411,6 +412,7 @@ public void onDrawFrame (javax.microedition.khronos.opengles.GL10 gl) {
}
}
app.getInput().processEvents();
frameId++;
app.getApplicationListener().render();
}

@@ -444,6 +446,11 @@ public void onDrawFrame (javax.microedition.khronos.opengles.GL10 gl) {
frames++;
}

@Override
public long getFrameId () {
return frameId;
}

/** {@inheritDoc} */
@Override
public float getDeltaTime () {
@@ -217,6 +217,7 @@ public void onDrawFrame (javax.microedition.khronos.opengles.GL10 gl) {
*/

app.getInput().processEvents();
frameId++;
app.getApplicationListener().render();
}

@@ -120,6 +120,7 @@ void mainLoop () {
t = n + renderInterval;

executeRunnables();
graphics.incrementFrameId();
listener.render();
graphics.updateTime();

@@ -24,6 +24,7 @@
* server and client as simple as possible.
*/
public class MockGraphics implements Graphics {
long frameId = -1;
float deltaTime = 0;
long frameStart = 0;
int frames = 0;
@@ -55,6 +56,11 @@ public int getHeight() {
return 0;
}

@Override
public long getFrameId() {
return frameId;
}

@Override
public float getDeltaTime() {
return deltaTime;
@@ -178,4 +184,8 @@ public void updateTime () {
frames++;
}

public void incrementFrameId () {
frameId++;
}

}
@@ -53,6 +53,7 @@
private volatile boolean isContinuous = true, renderRequested;
volatile boolean foreground, minimized;

private long frameId = -1;
private float deltaTime;
private long frameStart, lastTime = -1;
private int frames, fps;
@@ -155,6 +156,7 @@ void frameStart (long time) {
frameStart = time;
}
frames++;
frameId++;
}

void sizeChanged (int width, int height) {
@@ -192,6 +194,10 @@ public int getHeight () {
return height;
}

public long getFrameId () {
return frameId;
}

public float getDeltaTime () {
return deltaTime;
}
@@ -256,6 +256,7 @@ void render () {

input.processEvents();
if (running) {
graphics.frameId++;
listener.render();
if (audio != null) {
audio.update();
@@ -203,6 +203,7 @@ void mainLoop () {
int frameRate = isActive ? graphics.config.foregroundFPS : graphics.config.backgroundFPS;
if (shouldRender) {
graphics.updateTime();
graphics.frameId++;
listener.render();
Display.update(false);
} else {
@@ -222,6 +222,7 @@ public void run () {

input.update();
input.processEvents();
graphics.frameId++;
listener.render();
if (audio != null) audio.update();
Display.update();
@@ -41,6 +41,7 @@

GL20 gl20;
GL30 gl30;
long frameId = -1;
float deltaTime = 0;
long frameStart = 0;
int frames = 0;
@@ -94,6 +95,10 @@ public boolean isGL20Available () {
return gl20 != null;
}

public long getFrameId () {
return frameId;
}

public float getDeltaTime () {
return deltaTime;
}
@@ -216,6 +216,7 @@ void mainLoop() {
runnablesHelper.get(i).run();
}
runnablesHelper.clear();
graphics.frameId++;
listener.render();
input.reset();
}
@@ -34,6 +34,7 @@
String extensions;
float fps = 0;
long lastTimeStamp = System.currentTimeMillis();
long frameId = -1;
float deltaTime = 0;
float time = 0;
int frames;
@@ -80,6 +81,11 @@ public int getHeight () {
return canvas.getHeight();
}

@Override
public long getFrameId () {
return frameId;
}

@Override
public float getDeltaTime () {
return deltaTime;
@@ -116,6 +116,13 @@ public String toString () {
/** @return the height in pixels of the display surface */
public int getHeight ();

/** Returns the id of the current frame. The general contract of this method is that the id is incremented only when the
* application is in the running state right before calling the {@link ApplicationListener#render()} method. Also, the id of
* the first frame is 0; the id of subsequent frames is guaranteed to take increasing values for 2<sup>63</sup>-1 rendering
* cycles.
* @return the id of the current frame */
public long getFrameId ();

/** @return the time span between the current frame and the last frame in seconds. Might be smoothed over n frames. */
public float getDeltaTime ();

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.