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

    return false;
  }