예제 #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);
  }
예제 #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;
  }
예제 #3
0
  @Override
  public void onLowMemory() {
    super.onLowMemory();

    GiderosApplication app = GiderosApplication.getInstance();
    if (app != null) app.onLowMemory();
  }
예제 #4
0
  @Override
  protected void onResume() {
    super.onResume();

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

    super.onPause();
  }
예제 #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;
    }
  }
예제 #7
0
 @Override
 public void onStop() {
   GiderosApplication.getInstance().onStop();
   super.onStop();
 }
예제 #8
0
 @Override
 public void onRestart() {
   super.onRestart();
   GiderosApplication.getInstance().onRestart();
 }
예제 #9
0
 public void onDrawFrame(GL10 gl) {
   GiderosApplication app = GiderosApplication.getInstance();
   if (app != null) app.onDrawFrame();
 }
예제 #10
0
 public void onSurfaceChanged(GL10 gl, int w, int h) {
   GiderosApplication.getInstance().onSurfaceChanged(w, h);
 }
예제 #11
0
 public void onSurfaceCreated(GL10 gl, EGLConfig config) {
   GiderosApplication.getInstance().onSurfaceCreated();
 }
예제 #12
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   GiderosApplication.getInstance().onActivityResult(requestCode, resultCode, data);
 }