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

    return false;
  }