boolean doKeyUp(int keyCode, KeyEvent msg) { synchronized (surfaceHolder) { game.onKeyUp(keyCode); } return true; }
@Override public void run() { while (running) { Canvas c = null; try { c = surfaceHolder.lockCanvas(null); synchronized (surfaceHolder) { if (!game.onEnterFrame(c)) { running = false; game.shutdown(true); view.shutdown(); } } } finally { // do this in a finally so that if an exception is thrown // during the above, we don't leave the Surface in an // inconsistent state if (c != null) { surfaceHolder.unlockCanvasAndPost(c); } } } }
public void onWindowFocusChanged(boolean hasWindowFocus) { synchronized (surfaceHolder) { if (hasWindowFocus) game.onFocus(); else game.onFocusLost(); } }