Android Open Source - AndroidExperiments Touch Demo View






From Project

Back to project page AndroidExperiments.

License

The source code is released under:

MIT License

If you think the Android project AndroidExperiments listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.brandonlight.gles2demos;
//from w w  w.j a  v  a2s . c  o m
import android.content.Context;
import android.opengl.GLSurfaceView;
import android.util.Log;
import android.view.MotionEvent;


public class TouchDemoView extends GLSurfaceView {
  
  TouchDemoRenderer mRenderer;
  
  public TouchDemoView(Context context)
  {
    super(context);
    setDebugFlags(DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS);
    setEGLContextClientVersion(2);
    mRenderer = new TouchDemoRenderer();
    
    setRenderer(mRenderer);
  }
  
  public boolean onTouchEvent(final MotionEvent event)
    {

      int width = getWidth();
      int height = getHeight();

      //android.util.Log.d("gldemos", s);
      
      if (event.getAction() == MotionEvent.ACTION_DOWN)
      {
        Log.d("INPUT", "Touch down");
      }
      
      switch (event.getAction())
      {
        case MotionEvent.ACTION_MOVE:
          Log.d("INPUT", "Touch Move");
          break;
        case MotionEvent.ACTION_UP:
          Log.d("INPUT", "Touch up");
          break;
        case MotionEvent.ACTION_HOVER_ENTER:
          Log.d("INPUT", "Hover Enter");
          break;
        
        default:
          break;
      
      }
        
      
      return true;
    }


}




Java Source Code List

com.brandonlight.gles2demos.GLES2DemosActivitity.java
com.brandonlight.gles2demos.ParticleTestRenderer.java
com.brandonlight.gles2demos.ParticleTestView.java
com.brandonlight.gles2demos.TouchDemoRenderer.java
com.brandonlight.gles2demos.TouchDemoView.java
com.brandonlight.gles2demos.TriColorVertRenderer.java
com.brandonlight.gles2demos.TriColorVertView.java