Beispiel #1
0
 public virtual bool updateMultitouch(MultitouchReport report)
 {
     if (connected)
     {
         MultitouchPointerInfoRaw[] touches = report.getTouchesRaw();
         return(vmulti_update_multitouch(vmulti, touches, report.getTouchesCountRaw(), report.getRequestType(), report.getReportControlId()));
     }
     else
     {
         return(false);
     }
 }
        public void processEventFrame()
        {
            touchscreenMutex.WaitOne();
            List<MultitouchPointerInfo> toFire = new List<MultitouchPointerInfo>();

            ulong timestamp = (ulong)Stopwatch.GetTimestamp();
            WiiContact contact;
            while (contactQueue.Count > 0)
            {
                contact = contactQueue.Dequeue();
                if (Settings.Default.pointer_customCursor && (contact.Type == ContactType.Hover || contact.Type == ContactType.EndFromHover))
                {
                    //If we are using the custom cursor and it's more than 1 touchpoints, we skip the hovering because otherwise it's not working with edge guestures for example.
                }
                else
                {
                    ContactType type = contact.Type;

                    MultitouchPointerInfo pointerInfo = new MultitouchPointerInfo();

                    pointerInfo.X = contact.NormalPosition.X;
                    pointerInfo.Y = contact.NormalPosition.Y;

                    pointerInfo.Down = type == ContactType.Start || type == ContactType.Move;

                    pointerInfo.ID = (byte)contact.ID;

                    toFire.Add(pointerInfo);
                }
            }
            //fire the events
            if (toFire.Count > 0)
            {
                MultitouchReport report = new MultitouchReport(toFire);
                if (!VmultiDevice.Current.updateMultitouch(report))
                {
                    Console.WriteLine("Could not send touch input, count " + toFire.Count);
                }
            }
            touchscreenMutex.ReleaseMutex();
        }
Beispiel #3
0
        private void multitouchTest(VMulti vmulti)
        {
            double x = 500;
            double y = 500;

            while (true)
            {
                List<MultitouchPointerInfo> touches = new List<MultitouchPointerInfo>();
                bool spacePressed = Convert.ToBoolean(GetKeyState(0x20) & 0x8000);
                MultitouchPointerInfo pointer = new MultitouchPointerInfo();

                bool rightPressed = Convert.ToBoolean(GetKeyState(0x27) & 0x8000);
                if (rightPressed)
                    x += 10;
                bool downPressed = Convert.ToBoolean(GetKeyState(0x28) & 0x8000);
                if (downPressed)
                    y += 10;
                bool leftPressed = Convert.ToBoolean(GetKeyState(0x25) & 0x8000);
                if (leftPressed)
                    x -= 10;
                bool upPressed = Convert.ToBoolean(GetKeyState(0x26) & 0x8000);
                if (upPressed)
                    y -= 10;

                if (spacePressed)
                {
                    Console.WriteLine("pressed");
                    pointer.Down = true;
                }
                else
                {
                    pointer.Down = false;
                }

                Point mousePos = Control.MousePosition;
                Console.WriteLine(mousePos);
                pointer.X = x / Screen.PrimaryScreen.Bounds.Width;
                pointer.Y = y / Screen.PrimaryScreen.Bounds.Height;

                Console.WriteLine("X: " + pointer.X);
                Console.WriteLine("Y: " + pointer.Y);

                touches.Add(pointer);

                MultitouchReport report = new MultitouchReport(touches);

                if (!vmulti.updateMultitouch(report))
                {
                    Console.WriteLine("fail");
                }

                System.Threading.Thread.Sleep(10);
            }
        }
Beispiel #4
0
 public virtual bool updateMultitouch(MultitouchReport report)
 {
     if (connected)
     {
         MultitouchPointerInfoRaw[] touches = report.getTouchesRaw();
         return vmulti_update_multitouch(vmulti, touches, report.getTouchesCountRaw(), report.getRequestType(), report.getReportControlId());
     }
     else
     {
         return false;
     }
 }