src/api-impl/android/view/Choreographer.java: implement enough for games using swappy to work (tested with sample Unity app)

This commit is contained in:
Mis012
2022-12-31 17:00:27 +01:00
parent 9a3b5b21b6
commit f0cae244ae

View File

@@ -1,5 +1,25 @@
package android.view;
public final class Choreographer {
public static interface FrameCallback {}
public static interface FrameCallback {
public void doFrame(long frametime_in_nanoseconds);
}
public static Choreographer getInstance() {
return new Choreographer();
}
public void postFrameCallback(Choreographer.FrameCallback callback) {
postFrameCallbackDelayed(callback, 0);
}
public void postFrameCallbackDelayed(final Choreographer.FrameCallback callback, long delayMillis) {
// TODO - do the delay part
// NOTE: if we do this synchronously, it gets stuck
Thread async = new Thread(new Runnable() {
public void run() {
callback.doFrame(System.nanoTime());
}});
async.start();
}
}