October 2017
Intermediate to advanced
294 pages
6h 49m
English
Let's start by using the code from the Example25-GLDrawing. Processing user interactions is quite simple, as we have already seen in our previous examples. We don't have to do anything different than before, just override the onTouchEvent() method in our class extending GLSurfaceView and react properly to the different MotionEvents we will receive. For instance, if we don't return true when we receive a MotionEvent.ACTION_DOWN, we will not receive any further events, as we are basically saying that we are not handling the event.
Once we have the source code of the example, let's add a simple implementation of the onTouchEvent() that tracks drag events:
private float dragX; private float dragY; @Override public boolean ...
Read now
Unlock full access