You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
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:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user