Esempio n. 1
0
        private void HandleTouchEvent(EmulatorTouchEvent touchEvent)
        {
            if (touchEvent.pointers.Count < 1)
            {
                return;
            }
            EmulatorTouchEvent.Pointer pointer = touchEvent.pointers[0];

            lock (state) {
                state.touchPos = new Vector2(pointer.normalizedX, pointer.normalizedY);
                switch (touchEvent.getActionMasked())
                {
                case EmulatorTouchEvent.Action.kActionDown:
                    state.buttonsState |= GvrControllerButton.TouchPadTouch;
                    break;

                case EmulatorTouchEvent.Action.kActionMove:
                    state.buttonsState |= GvrControllerButton.TouchPadTouch;
                    break;

                case EmulatorTouchEvent.Action.kActionUp:
                    state.buttonsState &= ~GvrControllerButton.TouchPadTouch;
                    break;
                }
            }
        }
        private void HandleTouchEvent(EmulatorTouchEvent touchEvent)
        {
            if (touchEvent.pointers.Count < 1)
            {
                return;
            }
            EmulatorTouchEvent.Pointer pointer = touchEvent.pointers[0];

            lock (state) {
                state.touchPos = new Vector2(pointer.normalizedX, pointer.normalizedY);
                switch (touchEvent.getActionMasked())
                {
                case EmulatorTouchEvent.Action.kActionDown:
                    state.touchDown  = true;
                    state.isTouching = true;
                    break;

                case EmulatorTouchEvent.Action.kActionMove:
                    state.isTouching = true;
                    break;

                case EmulatorTouchEvent.Action.kActionUp:
                    state.isTouching = false;
                    state.touchUp    = true;
                    break;
                }
            }
        }