Esempio n. 1
0
 public void surfaceDestroyed(SurfaceHolder holder) {
   if (thread != null) {
     boolean retry = true;
     thread.setRunning(false);
     while (retry) {
       try {
         thread.join();
         retry = false;
       } catch (InterruptedException e) {
       }
     }
   }
   thread = null;
 }
Esempio n. 2
0
  public void surfaceCreated(SurfaceHolder holder) {
    if (thread == null && !shutdown) {
      thread =
          new GameThread(
              this,
              game,
              holder,
              new Handler() {
                @Override
                public void handleMessage(Message m) {}
              });

      thread.start();
    }
  }
Esempio n. 3
0
 public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
   if (thread != null) thread.setSurfaceSize(width, height);
 }
Esempio n. 4
0
 @Override
 public void onWindowFocusChanged(boolean hasWindowFocus) {
   if (thread != null) {
     thread.onWindowFocusChanged(hasWindowFocus);
   }
 }
Esempio n. 5
0
  @Override
  public boolean onKeyUp(int keyCode, KeyEvent msg) {
    if (thread != null) return thread.doKeyUp(keyCode, msg);

    return false;
  }