2020年4月17日金曜日

Cocos2d-x マルチタップを無効にする方法(Android)

cocos2d-xはAndroidだけなぜかマルチタップができてしまう。
無効にするには以下の修正が必要となる。
なお、ver4.0で確認しているがこれより古い3系でも同様の対処でOKだと思われる


libcocos2dx→java→org.cocos2dx.lib→Cocos2dxGLSurfaceView.java


228行目あたりのswitch文「case MotionEvent.ACTION_POINTER_DOWN:」の部分を全てコメントアウトにする


switch (pMotionEvent.getAction() & MotionEvent.ACTION_MASK) {
    /*
    case MotionEvent.ACTION_POINTER_DOWN:

        final int indexPointerDown = pMotionEvent.getAction() >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
        if (!mMultipleTouchEnabled && indexPointerDown != 0) {
            break;
        }
        final int idPointerDown = pMotionEvent.getPointerId(indexPointerDown);
        final float xPointerDown = pMotionEvent.getX(indexPointerDown);
        final float yPointerDown = pMotionEvent.getY(indexPointerDown);

        this.queueEvent(new Runnable() {
            @Override
            public void run() {
                Cocos2dxGLSurfaceView.this.mCocos2dxRenderer.handleActionDown(idPointerDown, xPointerDown, yPointerDown);
            }
        });
        break;

     */

    case MotionEvent.ACTION_DOWN:


0 件のコメント:

コメントを投稿