java - Using "TouchDown" for a specific area with GestureListener from LibGDX? -


is possible register input specific area of screen (like say, texture region) in libgdx using gesture listener class?

i using touchdown method so:

@override     public boolean touchdown(float x, float y, int pointer, int button) {         if(gameisover) {           restart();         }          if (gameisnotover) {             if (x == regionobject.getregionx()){             system.out.println("touched");          }     }   } 

where regionobject texture region. works first part (gameisover), since registers touch on whole screen.

but can't work on specific area.

should use inputmultiplexer? or should else entirely?

is possible @ gesturelistener/detecter?

any specific use of gesturelistener ?

touch can detected using inputprocessor or using adapter class (inputadapter)

specific area need bound, can use sprite, holds geometry, color, , texture information drawing.

sprite sprite=new sprite(textureregion);  if(sprite.getboundingrectangle().contains(x,y))     gdx.app.log("tag","touch on particular area");   

Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -