@Override public boolean onKeyUp(int keyCode, KeyEvent event) { GiderosApplication app = GiderosApplication.getInstance(); if (app != null && app.onKeyUp(keyCode, event) == true) return true; return super.onKeyUp(keyCode, event); }
@Override public void onLowMemory() { super.onLowMemory(); GiderosApplication app = GiderosApplication.getInstance(); if (app != null) app.onLowMemory(); }
@Override protected void onResume() { super.onResume(); if (mHasFocus == true && mPlaying == false) { mGLView.onResume(); GiderosApplication.getInstance().onResume(); mPlaying = true; } }
@Override protected void onPause() { if (mPlaying == true) { GiderosApplication.getInstance().onPause(); mGLView.onPause(); mPlaying = false; } super.onPause(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mGLView = new GiderosGLSurfaceView(this); setContentView(mGLView); mGLView.setOnTouchListener(this); WeakActivityHolder.set(this); GiderosApplication.onCreate(externalClasses); }
@Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); mHasFocus = hasFocus; if (mHasFocus == true && mPlaying == false) { mGLView.onResume(); GiderosApplication.getInstance().onResume(); mPlaying = true; } }
public boolean onTouch(View v, MotionEvent event) { GiderosApplication app = GiderosApplication.getInstance(); if (app == null) return false; int size = event.getPointerCount(); for (int i = 0; i < size; i++) { id[i] = event.getPointerId(i); x[i] = (int) event.getX(i); y[i] = (int) event.getY(i); } int actionMasked = event.getActionMasked(); boolean isPointer = (actionMasked == MotionEvent.ACTION_POINTER_DOWN || actionMasked == MotionEvent.ACTION_POINTER_UP); int actionIndex = isPointer ? event.getActionIndex() : 0; if (actionMasked == MotionEvent.ACTION_DOWN || actionMasked == MotionEvent.ACTION_POINTER_DOWN) { app.onTouchesBegin(size, id, x, y, actionIndex); } else if (actionMasked == MotionEvent.ACTION_MOVE) { app.onTouchesMove(size, id, x, y); } else if (actionMasked == MotionEvent.ACTION_UP || actionMasked == MotionEvent.ACTION_POINTER_UP) { app.onTouchesEnd(size, id, x, y, actionIndex); } else if (actionMasked == MotionEvent.ACTION_CANCEL) { app.onTouchesCancel(size, id, x, y); } return true; }
@Override public void onDestroy() { GiderosApplication.onDestroy(); super.onDestroy(); }
@Override public void onStop() { GiderosApplication.getInstance().onStop(); super.onStop(); }
@Override public void onRestart() { super.onRestart(); GiderosApplication.getInstance().onRestart(); }
public void onDrawFrame(GL10 gl) { GiderosApplication app = GiderosApplication.getInstance(); if (app != null) app.onDrawFrame(); }
public void onSurfaceChanged(GL10 gl, int w, int h) { GiderosApplication.getInstance().onSurfaceChanged(w, h); }
public void onSurfaceCreated(GL10 gl, EGLConfig config) { GiderosApplication.getInstance().onSurfaceCreated(); }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); GiderosApplication.getInstance().onActivityResult(requestCode, resultCode, data); }