Exemple #1
0
 private void Move(TouchEvent touchEvent)
 {
     Touch currPointer = touchEvent.Touches[0];
     this.manager.OnMove((int)(this.prevPointer.Location.X - currPointer.Location.X),
                         (int)(this.prevPointer.Location.Y - currPointer.Location.Y));
     this.prevPointer = currPointer;
 }
Exemple #2
0
        internal override void Enter(TouchEvent touchEvent)
        {
            this.startPointer = touchEvent.Touches[0];
            this.longTapTimer.AutoReset = false;
            longTapTimer.Elapsed += (s, e) =>
            {
                this.manager.OnLongTap();
                this.manager.OnDown();
                this.machine.ChangeState(new MarkingState(this.machine, this.manager), new TouchEvent(this.startPointer));
            };

            longTapTimer.Start();
            this.tapWatch.Start();
        }
Exemple #3
0
        public TouchEvent DecodeTouch(UnPacker unpacker)
        {
            int length = unpacker.UnpackByte();
            Touch[] touches = new Touch[length];
            for (int i = 0; i < length; i++)
            {
                Touch touch;
                touch.Location.X = unpacker.UnpackShort();
                touch.Location.Y = unpacker.UnpackShort();
                touch.Pressure = unpacker.UnpackByte() / 256.0f;
                touches[i] = touch;
            }

            return new TouchEvent(touches);
        }
Exemple #4
0
 internal override void Update(TouchEvent touchEvent)
 {
     if (touchEvent.Touches.Count == 1)
     {
         Touch currPointer = touchEvent.Touches[0];
         this.manager.OnMove((int)(this.prevPointer.Location.X - currPointer.Location.X),
                             (int)(this.prevPointer.Location.Y - currPointer.Location.Y));
         this.prevPointer = currPointer;
     }
     else if (touchEvent.Touches.Count == 0)
     {
         this.machine.ChangeState(new NullState(machine, manager), null);
     }
     else
     {
         this.machine.ChangeState(new MultiMoveState(this.machine, this.manager), touchEvent);
     }
 }
Exemple #5
0
 internal override void Enter(TouchEvent touchEvent)
 {
     this.prevPointer = touchEvent.Touches[0];
 }
Exemple #6
0
 private void TransitionToMoveState(TouchEvent touchEvent, Touch pointer)
 {
     this.manager.OnMove((int)(this.startPointer.Location.X - pointer.Location.X),
                         (int)(this.startPointer.Location.Y - pointer.Location.Y));
     this.machine.ChangeState(new MoveState(this.machine, this.manager), touchEvent);
 }