Example #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;
 }
Example #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();
    }
  }
Example #3
0
 public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
   if (thread != null) thread.setSurfaceSize(width, height);
 }
Example #4
0
 @Override
 public void onWindowFocusChanged(boolean hasWindowFocus) {
   if (thread != null) {
     thread.onWindowFocusChanged(hasWindowFocus);
   }
 }
Example #5
0
  @Override
  public boolean onKeyUp(int keyCode, KeyEvent msg) {
    if (thread != null) return thread.doKeyUp(keyCode, msg);

    return false;
  }