public InputEvent generateMouseEvent(TouchEvent event) {
        InputEvent inputEvent = null;
        int newX;
        int newY;
        int newDX;
        int newDY;

        // MouseEvents do not support multi-touch, so only evaluate 1 finger pointer events
        if (!isSimulateMouse() || numPointers > 1) {
            return null;
        }


        if (isMouseEventsInvertX()) {
            newX = (int) (invertX(event.getX()));
            newDX = (int)event.getDeltaX() * -1;
        } else {
            newX = (int) event.getX();
            newDX = (int)event.getDeltaX();
        }

        if (isMouseEventsInvertY()) {
            newY = (int) (invertY(event.getY()));
            newDY = (int)event.getDeltaY() * -1;
        } else {
            newY = (int) event.getY();
            newDY = (int)event.getDeltaY();
        }

        switch (event.getType()) {
            case DOWN:
                // Handle mouse down event
                inputEvent = new MouseButtonEvent(0, true, newX, newY);
                inputEvent.setTime(event.getTime());
                break;

            case UP:
                // Handle mouse up event
                inputEvent = new MouseButtonEvent(0, false, newX, newY);
                inputEvent.setTime(event.getTime());
                break;

            case HOVER_MOVE:
            case MOVE:
                inputEvent = new MouseMotionEvent(newX, newY, newDX, newDY, (int)event.getScaleSpan(), (int)event.getDeltaScaleSpan());
                inputEvent.setTime(event.getTime());
                break;
        }

        return inputEvent;
    }
AndroidTouchInput is the base class that receives touch inputs from the
Android system and creates the TouchEvents for jME.  This class is designed
to handle the base touch events for Android rev 9 (Android 2.3).  This is
extended by other classes to add features that were introduced after
Android rev 9.

@author iwgeric
jme3-android/src/main/java/com/jme3/input/android/AndroidTouchInput.java