support tap-and-drag

This commit is contained in:
Josh Holtrop 2012-11-19 22:20:35 -05:00
parent 758435fd63
commit 989d510673

View File

@ -197,13 +197,16 @@ public class MyRenderer implements GLSurfaceView.Renderer
public boolean onTouchEvent(MotionEvent e) public boolean onTouchEvent(MotionEvent e)
{ {
if (e.getAction() == MotionEvent.ACTION_DOWN) if (e.getAction() == MotionEvent.ACTION_DOWN ||
e.getAction() == MotionEvent.ACTION_MOVE)
{ {
float x = m_aspect * ((e.getX() / (float) m_width) * 2.0f - 1.0f); float x = m_aspect * ((e.getX() / (float) m_width) * 2.0f - 1.0f);
float y = -((e.getY() / (float) m_height) * 2.0f - 1.0f); float y = -((e.getY() / (float) m_height) * 2.0f - 1.0f);
m_x = x; m_x = x;
m_y = y; m_y = y;
return true;
} }
return false; return false;