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

      return true;
    }
예제 #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);
       }
     }
   }
 }
예제 #3
0
 public void onWindowFocusChanged(boolean hasWindowFocus) {
   synchronized (surfaceHolder) {
     if (hasWindowFocus) game.onFocus();
     else game.onFocusLost();
   }
 }