Make a 2D rectangle, touchable and clickable...

Tutorials concerning the OpenGL® ES cross-platform API for full-function 2D and 3D graphics on the Google-Android platform.

Make a 2D rectangle, touchable and clickable...

Postby sblantipodi » Mon Mar 29, 2010 11:44 pm

Hi,
suppose that I want to draw a rectangle on a canvas using
canvas.drawRect()...

Using JavaME If I want to make this shape clickable and touchable I need
to know the X,Y position of the shape in the canvas,
and then listen for the events that if corresponds to the correct X,Y where the rectangle is located, do something.

Is there a smarter way in android?
Something that make 2D shape clickable without knowig every time
the X,Y position of the shape?

Thanks.
sblantipodi
Senior Developer
Senior Developer
 
Posts: 122
Joined: Fri Mar 26, 2010 1:41 pm

Top

Re: Make a 2D rectangle, touchable and clickable...

Postby mb_zi » Tue Mar 30, 2010 3:16 am

i tried to implement some sort of picking before but ran into trouble. the easiest way is what you describe. check x,y and then compare. im not sure theres another android way...
mb_zi
Junior Developer
Junior Developer
 
Posts: 17
Joined: Sat Feb 27, 2010 2:16 am

Top

Return to Android 2D/3D Graphics - OpenGL Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests