Exemplo n.º 1
0
 public virtual void touchesMoved(object sender, TouchpadEventArgs arg)
 {
     if (!Global.UseTPforControls[deviceNum])
     {
         cursor.touchesMoved(arg, dragging || dragging2);
         wheel.touchesMoved(arg, dragging || dragging2);
     }
     else
     {
         if (!(swipeUp || swipeDown || swipeLeft || swipeRight) && arg.touches.Length == 1)
         {
             if (arg.touches[0].hwX - firstTouch.hwX > 400)
             {
                 swipeRight = true;
             }
             if (arg.touches[0].hwX - firstTouch.hwX < -400)
             {
                 swipeLeft = true;
             }
             if (arg.touches[0].hwY - firstTouch.hwY > 300)
             {
                 swipeDown = true;
             }
             if (arg.touches[0].hwY - firstTouch.hwY < -300)
             {
                 swipeUp = true;
             }
         }
         swipeUpB    = (byte)Math.Min(255, Math.Max(0, (firstTouch.hwY - arg.touches[0].hwY) * 1.5f));
         swipeDownB  = (byte)Math.Min(255, Math.Max(0, (arg.touches[0].hwY - firstTouch.hwY) * 1.5f));
         swipeLeftB  = (byte)Math.Min(255, Math.Max(0, firstTouch.hwX - arg.touches[0].hwX));
         swipeRightB = (byte)Math.Min(255, Math.Max(0, arg.touches[0].hwX - firstTouch.hwX));
     }
     if (Math.Abs(firstTouch.hwY - arg.touches[0].hwY) < 50 && arg.touches.Length == 2)
     {
         if (arg.touches[0].hwX - firstTouch.hwX > 200 && !slideleft)
         {
             slideright = true;
         }
         else if (firstTouch.hwX - arg.touches[0].hwX > 200 && !slideright)
         {
             slideleft = true;
         }
     }
     dev.getCurrentState(s);
     synthesizeMouseButtons();
 }
Exemplo n.º 2
0
        public virtual void touchesMoved(object sender, TouchpadEventArgs arg)
        {
            s = dev.getCurrentStateRef();

            if (Global.getUseTPforControls(deviceNum) == false)
            {
                int[] disArray = Global.getTouchDisInvertTriggers(deviceNum);
                tempBool = true;
                for (int i = 0, arlen = disArray.Length; tempBool && i < arlen; i++)
                {
                    if (getDS4ControlsByName(disArray[i]) == false)
                    {
                        tempBool = false;
                    }
                }

                cursor.touchesMoved(arg, dragging || dragging2, tempBool);
                wheel.touchesMoved(arg, dragging || dragging2);
            }
            else
            {
                if (!(swipeUp || swipeDown || swipeLeft || swipeRight) && arg.touches.Length == 1)
                {
                    if (arg.touches[0].hwX - firstTouch.hwX > 400)
                    {
                        swipeRight = true;
                    }
                    if (arg.touches[0].hwX - firstTouch.hwX < -400)
                    {
                        swipeLeft = true;
                    }
                    if (arg.touches[0].hwY - firstTouch.hwY > 300)
                    {
                        swipeDown = true;
                    }
                    if (arg.touches[0].hwY - firstTouch.hwY < -300)
                    {
                        swipeUp = true;
                    }
                }

                swipeUpB    = (byte)Math.Min(255, Math.Max(0, (firstTouch.hwY - arg.touches[0].hwY) * 1.5f));
                swipeDownB  = (byte)Math.Min(255, Math.Max(0, (arg.touches[0].hwY - firstTouch.hwY) * 1.5f));
                swipeLeftB  = (byte)Math.Min(255, Math.Max(0, firstTouch.hwX - arg.touches[0].hwX));
                swipeRightB = (byte)Math.Min(255, Math.Max(0, arg.touches[0].hwX - firstTouch.hwX));
            }

            if (Math.Abs(firstTouch.hwY - arg.touches[0].hwY) < 50 && arg.touches.Length == 2)
            {
                if (arg.touches[0].hwX - firstTouch.hwX > 200 && !slideleft)
                {
                    slideright = true;
                }
                else if (firstTouch.hwX - arg.touches[0].hwX > 200 && !slideright)
                {
                    slideleft = true;
                }
            }

            synthesizeMouseButtons();
        }
Exemplo n.º 3
0
        public virtual void touchesMoved(object sender, TouchpadEventArgs arg)
        {
            s = dev.getCurrentStateRef();

            if (Global.getUseTPforControls(deviceNum) == false)
            {
                int[] disArray = Global.getTouchDisInvertTriggers(deviceNum);
                tempBool = true;
                for (int i = 0, arlen = disArray.Length; tempBool && i < arlen; i++)
                {
                    if (getDS4ControlsByName(disArray[i]) == false)
                    {
                        tempBool = false;
                    }
                }

                if (Global.getTrackballMode(deviceNum))
                {
                    int iIndex = trackballBufferTail;
                    trackballXBuffer[iIndex] = (arg.touches[0].deltaX * TRACKBALL_SCALE) / dev.getCurrentStateRef().elapsedTime;
                    trackballYBuffer[iIndex] = (arg.touches[0].deltaY * TRACKBALL_SCALE) / dev.getCurrentStateRef().elapsedTime;
                    trackballBufferTail      = (iIndex + 1) % TRACKBALL_BUFFER_LEN;
                    if (trackballBufferHead == trackballBufferTail)
                    {
                        trackballBufferHead = (trackballBufferHead + 1) % TRACKBALL_BUFFER_LEN;
                    }
                }

                cursor.touchesMoved(arg, dragging || dragging2, tempBool);
                wheel.touchesMoved(arg, dragging || dragging2);
            }
            else
            {
                if (!(swipeUp || swipeDown || swipeLeft || swipeRight) && arg.touches.Length == 1)
                {
                    if (arg.touches[0].hwX - firstTouch.hwX > 400)
                    {
                        swipeRight = true;
                    }
                    if (arg.touches[0].hwX - firstTouch.hwX < -400)
                    {
                        swipeLeft = true;
                    }
                    if (arg.touches[0].hwY - firstTouch.hwY > 300)
                    {
                        swipeDown = true;
                    }
                    if (arg.touches[0].hwY - firstTouch.hwY < -300)
                    {
                        swipeUp = true;
                    }
                }

                swipeUpB    = (byte)Math.Min(255, Math.Max(0, (firstTouch.hwY - arg.touches[0].hwY) * 1.5f));
                swipeDownB  = (byte)Math.Min(255, Math.Max(0, (arg.touches[0].hwY - firstTouch.hwY) * 1.5f));
                swipeLeftB  = (byte)Math.Min(255, Math.Max(0, firstTouch.hwX - arg.touches[0].hwX));
                swipeRightB = (byte)Math.Min(255, Math.Max(0, arg.touches[0].hwX - firstTouch.hwX));
            }

            if (Math.Abs(firstTouch.hwY - arg.touches[0].hwY) < 50 && arg.touches.Length == 2)
            {
                if (arg.touches[0].hwX - firstTouch.hwX > 200 && !slideleft)
                {
                    slideright = true;
                }
                else if (firstTouch.hwX - arg.touches[0].hwX > 200 && !slideright)
                {
                    slideleft = true;
                }
            }

            synthesizeMouseButtons();
        }