Example #1
0
    boolean doKeyUp(int keyCode, KeyEvent msg) {
      synchronized (surfaceHolder) {
        game.onKeyUp(keyCode);
      }

      return true;
    }
Example #2
0
 @Override
 public void run() {
   while (running) {
     Canvas c = null;
     try {
       c = surfaceHolder.lockCanvas(null);
       synchronized (surfaceHolder) {
         if (!game.onEnterFrame(c)) {
           running = false;
           game.shutdown(true);
           view.shutdown();
         }
       }
     } finally {
       // do this in a finally so that if an exception is thrown
       // during the above, we don't leave the Surface in an
       // inconsistent state
       if (c != null) {
         surfaceHolder.unlockCanvasAndPost(c);
       }
     }
   }
 }
Example #3
0
 public void onWindowFocusChanged(boolean hasWindowFocus) {
   synchronized (surfaceHolder) {
     if (hasWindowFocus) game.onFocus();
     else game.onFocusLost();
   }
 }