Exemplo n.º 1
0
 public void onSurfaceCreated(GL10 gl, EGLConfig config) {
   NativeInterface.onSurfaceCreated();
   if (!NativeInterface.Running) {
     NativeInterface.setVariables(NativeInterface.DataPath, NativeInterface.ArchivePath);
     String args[] = {NativeInterface.ApkPath}; // adding argv[0]
     NativeInterface.init(args);
     NativeInterface.Running = true;
     // needed for keyboard height
     NativeInterface.Activity.getWindow()
         .getDecorView()
         .getViewTreeObserver()
         .addOnGlobalLayoutListener(
             new ViewTreeObserver.OnGlobalLayoutListener() {
               @Override
               public void onGlobalLayout() {
                 View view = NativeInterface.AprilActivity.getView();
                 Rect r = new Rect();
                 view.getWindowVisibleDisplayFrame(r);
                 float heightRatio =
                     1.0f - (float) (r.bottom - r.top) / view.getRootView().getHeight();
                 NativeInterface.onVirtualKeyboardChanged((heightRatio > 0.15f), heightRatio);
               }
             });
   }
 }
Exemplo n.º 2
0
 public void onDrawFrame(GL10 gl) {
   if (!NativeInterface.render()) {
     NativeInterface.Activity.finish();
   }
 }