Game Development Reference
In-Depth Information
public void reset() {
switch (type) {
case MOVE:
break;
case LOOK:
break;
default:
break;
}
}
private void doMove(int action, Point p) {
// Tell the native engine to move
}
private void doLook(int action, Point p) {
// Tell native engine to look
}
}
MultiTouchGesture executes by checking its type (in this case MOVE or LOOK ). Depending on
the type, a native method could be fired to send the XY coordinates to the game engine. The
action argument tells the gesture what kind of MotionEvent has fired. It can be one of the
following:
MotionEvent.ACTION_DOWN (first finger)
MotionEvent.ACTION_UP (first finger)
MotionEvent.ACTION_MOVE (first finger)
ACTION_POINTER_1_DOWN (second)
ACTION_POINTER_1_UP (second)
ACTION_POINTER_2_DOWN (third)
ACTION_POINTER_2_UP (third)
ACTION_POINTER_3_DOWN (fourth)
ACTION_POINTER_3_UP (fourth)
Tip
Android supports up to four simultaneous pointers/fingers on screen.
MultiTouchScreen
MultiTouchScreen is in charge of storing a list of gestures, checking their bounds, and
interacting with the main activity (see Listing 2-9).
 
 
Search WWH ::




Custom Search