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