Пример #1
0
        private void DispatchTouch(MouseMake.Event e, TouchMake.Event.Kind kind)
        {
            float ex = e.x, ey = e.y;

            TouchMake.Event touch = ToTouch(e.time, ex, ey, kind, 0);
            TouchMake.Event[]
            evs = (_pivot == null) ? new TouchMake.Event[] { touch }
                    : new TouchMake.Event[] { touch, ToTouch(e.time, 2 * _pivot.x - ex, 2 * _pivot.y - ey, kind, 1) };
            touchEvents.Emit(evs);
        }
Пример #2
0
        protected void UpdateTouchInput(int flags)
        {
            if (!_isConnected)
            {
                return;
            }
            _currentTouches = TouchPanel.GetState();
            int count = _currentTouches.Count;
            int idx   = 0;

            TouchMake.Event[] touchs = new TouchMake.Event[count];
            foreach (TouchLocation touch in _currentTouches)
            {
                Vector2 pos = touch.Position;
                switch (touch.State)
                {
                case TouchLocationState.Pressed:
                    touchs[idx] = new TouchMake.Event(flags, TimeUtils.Millis(), pos.X, pos.Y, TouchMake.Event.Kind.START, touch.Id, touch.Pressure, idx);
                    break;

                case TouchLocationState.Released:
                    touchs[idx] = new TouchMake.Event(flags, TimeUtils.Millis(), pos.X, pos.Y, TouchMake.Event.Kind.END, touch.Id, touch.Pressure, idx);
                    break;

                case TouchLocationState.Moved:
                    touchs[idx] = new TouchMake.Event(flags, TimeUtils.Millis(), pos.X, pos.Y, TouchMake.Event.Kind.MOVE, touch.Id, touch.Pressure, idx);
                    break;

                case TouchLocationState.Invalid:
                    touchs[idx] = new TouchMake.Event(flags, TimeUtils.Millis(), pos.X, pos.Y, TouchMake.Event.Kind.CANCEL, touch.Id, touch.Pressure, idx);
                    break;
                }
                idx++;
            }
            touchEvents.Emit(touchs);
        }