Java Code Examples for android.opengl.GLSurfaceView#setOnTouchListener()

The following examples show how to use android.opengl.GLSurfaceView#setOnTouchListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DemoWithGLSurfaceView.java    From Pano360 with MIT License 6 votes vote down vote up
private void init(){
    Pano360ConfigBundle configBundle= (Pano360ConfigBundle) getIntent().getSerializableExtra(PanoPlayerActivity.CONFIG_BUNDLE);
    if(configBundle==null){
        configBundle=Pano360ConfigBundle.newInstance();
    }
    configBundle.setRemoveHotspot(true);
    GLSurfaceView glSurfaceView=(GLSurfaceView) findViewById(R.id.surface_view);
    panoViewWrapper =PanoViewWrapper.with(this)
            .setConfig(configBundle)
            .setGlSurfaceView(glSurfaceView)
            .init();
    glSurfaceView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            //Logger.logTouchEvent(v,event);
            return panoViewWrapper.handleTouchEvent(event);
        }
    });
}
 
Example 2
Source File: Game.java    From PD-classes with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate( Bundle savedInstanceState ) {
	super.onCreate( savedInstanceState );
	
	BitmapCache.context = TextureCache.context = instance = this;
	
	DisplayMetrics m = new DisplayMetrics();
	getWindowManager().getDefaultDisplay().getMetrics( m );
	density = m.density;
	
	try {
		version = getPackageManager().getPackageInfo( getPackageName(), 0 ).versionName;
	} catch (NameNotFoundException e) {
		version = "???";
	}
	
	setVolumeControlStream( AudioManager.STREAM_MUSIC );
	
	view = new GLSurfaceView( this );
	view.setEGLContextClientVersion( 2 );
	view.setEGLConfigChooser( false );
	view.setRenderer( this );
	view.setOnTouchListener( this );
	setContentView( view );
}
 
Example 3
Source File: Game.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate( Bundle savedInstanceState ) {
	super.onCreate( savedInstanceState );
	
	BitmapCache.context = TextureCache.context = instance = this;
	
	DisplayMetrics m = new DisplayMetrics();
	getWindowManager().getDefaultDisplay().getMetrics( m );
	density = m.density;
	
	try {
		version = getPackageManager().getPackageInfo( getPackageName(), 0 ).versionName;
		versionNum = getPackageManager().getPackageInfo( getPackageName(), 0 ).versionCode;
	} catch (NameNotFoundException e) {
		version = "???";
           versionNum = 0;
	}
	
	setVolumeControlStream( AudioManager.STREAM_MUSIC );
	
	view = new GLSurfaceView( this );
	view.setEGLContextClientVersion( 2 );
	view.setEGLConfigChooser( false );
	view.setRenderer( this );
	view.setOnTouchListener( this );
	setContentView( view );
}
 
Example 4
Source File: AndroidInputHandler.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
protected void addListeners(GLSurfaceView view) {
    view.setOnTouchListener(this);
    view.setOnKeyListener(this);
    AndroidGestureProcessor gestureHandler = new AndroidGestureProcessor(touchInput);
    touchInput.setGestureDetector(new GestureDetector(
            view.getContext(), gestureHandler));
    touchInput.setScaleDetector(new ScaleGestureDetector(
            view.getContext(), gestureHandler));
}
 
Example 5
Source File: Game.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    iap = new Iap(this);

    try {
        version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
        versionCode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode;
    } catch (NameNotFoundException e) {
        version = "???";
        versionCode = 0;
    }

    setVolumeControlStream(AudioManager.STREAM_MUSIC);

    view = new GLSurfaceView(this);
    view.setEGLContextClientVersion(2);

    // Hope this allow game work on broader devices list
    // view.setEGLConfigChooser( false );
    view.setRenderer(this);
    view.setOnTouchListener(this);

    layout = new LinearLayout(this);
    getLayout().setOrientation(LinearLayout.VERTICAL);
    getLayout().addView(view);

    setContentView(getLayout());
}
 
Example 6
Source File: GameActivity.java    From Tanks with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState)
{
  super.onCreate(savedInstanceState);

  requestWindowFeature(Window.FEATURE_NO_TITLE);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

  handler = new Handler();
  renderer = new Renderer();

  initializeContext();
  initializeFactory();

  // OpenGL init
  glView = new GLSurfaceView(this);
  glView.getHolder().setFormat(PixelFormat.RGBA_8888);
  glView.setEGLContextClientVersion(2);
  glView.setEGLConfigChooser(new ConfigChooser());
  glView.setRenderer(renderer);
  glView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);

  // Bind listener
  glView.setOnTouchListener(this);

  // Set view
  setContentView(glView);

  // Set menu and world
  initializeContent();
}
 
Example 7
Source File: AndroidInputHandler.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
protected void removeListeners(GLSurfaceView view) {
    view.setOnTouchListener(null);
    view.setOnKeyListener(null);
    touchInput.setGestureDetector(null);
    touchInput.setScaleDetector(null);
}