Ejemplo n.º 1
0
  @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);
  }
Ejemplo n.º 2
0
  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;
  }
Ejemplo n.º 3
0
  @Override
  public void onLowMemory() {
    super.onLowMemory();

    GiderosApplication app = GiderosApplication.getInstance();
    if (app != null) app.onLowMemory();
  }
Ejemplo n.º 4
0
  @Override
  protected void onResume() {
    super.onResume();

    if (mHasFocus == true && mPlaying == false) {
      mGLView.onResume();
      GiderosApplication.getInstance().onResume();
      mPlaying = true;
    }
  }
Ejemplo n.º 5
0
  @Override
  protected void onPause() {
    if (mPlaying == true) {
      GiderosApplication.getInstance().onPause();
      mGLView.onPause();
      mPlaying = false;
    }

    super.onPause();
  }
Ejemplo n.º 6
0
  @Override
  public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);

    mHasFocus = hasFocus;

    if (mHasFocus == true && mPlaying == false) {
      mGLView.onResume();
      GiderosApplication.getInstance().onResume();
      mPlaying = true;
    }
  }
Ejemplo n.º 7
0
 @Override
 public void onStop() {
   GiderosApplication.getInstance().onStop();
   super.onStop();
 }
Ejemplo n.º 8
0
 @Override
 public void onRestart() {
   super.onRestart();
   GiderosApplication.getInstance().onRestart();
 }
Ejemplo n.º 9
0
 public void onDrawFrame(GL10 gl) {
   GiderosApplication app = GiderosApplication.getInstance();
   if (app != null) app.onDrawFrame();
 }
Ejemplo n.º 10
0
 public void onSurfaceChanged(GL10 gl, int w, int h) {
   GiderosApplication.getInstance().onSurfaceChanged(w, h);
 }
Ejemplo n.º 11
0
 public void onSurfaceCreated(GL10 gl, EGLConfig config) {
   GiderosApplication.getInstance().onSurfaceCreated();
 }
Ejemplo n.º 12
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   GiderosApplication.getInstance().onActivityResult(requestCode, resultCode, data);
 }