예제 #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            ControllerData.UpdateAllData();

            TouchActions.Run();


            for (int i = 0; i < ControllerData.controller.Count(); i++)
            {
                debugText[i] = "side: " + ControllerData.controller[i].side + "\n\n" +

                               "X: " + ControllerData.controller[i].x +
                               "\nY: " + ControllerData.controller[i].y +
                               "\nZ: " + ControllerData.controller[i].z + "\n\n" +

                               "q0: " + ControllerData.controller[i].q0 +
                               "\nq1: " + ControllerData.controller[i].q1 +
                               "\nq2: " + ControllerData.controller[i].q2 +
                               "\nq3: " + ControllerData.controller[i].q3 + "\n\n" +

                               "yaw: " + ControllerData.controller[i].yaw +
                               "\npitch: " + ControllerData.controller[i].pitch +
                               "\nroll: " + ControllerData.controller[i].roll + "\n\n" +

                               "joyX: " + ControllerData.controller[i].joyx +
                               "\njoyY: " + ControllerData.controller[i].joyy + "\n\n" +

                               "joybutton: " + ControllerData.controller[i].joybutton +
                               "\ntrigger: " + ControllerData.controller[i].trigger +
                               "\nbumper: " + ControllerData.controller[i].bumper +
                               "\nstart: " + ControllerData.controller[i].start + "\n\n" +

                               "one: " + ControllerData.controller[i].one +
                               "\ntwo: " + ControllerData.controller[i].two +
                               "\nthree: " + ControllerData.controller[i].three +
                               "\nfour: " + ControllerData.controller[i].four + "\n\n" +

                               "docked: " + ControllerData.controller[i].docked;
            }

            lblDebug0.Text = debugText[0];
            lblDebug1.Text = debugText[1];
            lblDebug2.Text = debugCounter + "\n" + debugText[2];
            lblDebug3.Text = debugText[3];

            //label1.Text = ControllerData.rotMat[1].M11 + "   " + ControllerData.rotMat[1].M12 + "   " + ControllerData.rotMat[1].M13 + "\n" +
            //                ControllerData.rotMat[1].M21 + "   " + ControllerData.rotMat[1].M22 + "   " + ControllerData.rotMat[1].M23 + "\n" +
            //                ControllerData.rotMat[1].M31 + "   " + ControllerData.rotMat[1].M32 + "   " + ControllerData.rotMat[1].M33;
        }
예제 #2
0
파일: Program.cs 프로젝트: roju/HydraTouch
        static void Main()
        {
            ControllerData.plugin.Start(); // Start the Hydra plugin

            ControllerData.controller.Add(new HydraPluginGlobal(0, ControllerData.plugin));
            ControllerData.controller.Add(new HydraPluginGlobal(1, ControllerData.plugin));

            TouchInjector.InitializeTouchInjection(256, TouchFeedback.INDIRECT); //initialize touch injection with num max touch points, indirect feedback to show hover position
            TouchActions.InitializeContacts();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Task Settings = Task.Factory.StartNew(() => Application.Run(new SettingsWindow()));
            //Task InjectTouch = Task.Factory.StartNew(() => TouchActions.Run());
            //Task.WaitAll(Settings, InjectTouch);

            Application.Run(new SettingsWindow());
        }
예제 #3
0
        public static void Run()
        {
            for (int i = 0; i < numControllers; i++)
            {
                SetActiveContact(contacts[i], i); //determine whether the contact is active (undocked)
            }



            for (int i = 0; i < numControllers; i++)
            {
                int index = (numActiveContacts() - 1) * i;
                //int index = contacts[i].ID;
                //int index = (int)injector[i].PointerInfo.PointerId;
                //int index = contacts[i].ControllerIndex;

                if (contacts[i].Active)
                {
                    if (ControllerData.controller[i].one == true && contacts[i].Holding == false) // pressed
                    {
                        contacts[i].JustPressed = true;
                        contacts[i].Holding     = true;
                    }

                    if (ControllerData.controller[i].one == false && contacts[i].Holding == true) // released
                    {
                        contacts[i].JustReleased = true;
                        contacts[i].Holding      = false;
                    }


                    if (contacts[i].JustPressed)
                    {
                        contacts[i].JustPressed = false;
                        TouchActions.TouchDown(index);
                    }

                    if (contacts[i].JustReleased)
                    {
                        contacts[i].JustReleased = false;
                        TouchActions.Release(index);
                    }

                    if (contacts[i].Holding == false)
                    {
                        TouchActions.SetHover(index);
                    }

                    if (ControllerData.controller[i].start == true)
                    {
                        LaserPointer.Calibrate(index);
                    }

                    injector[index].PointerInfo.PtPixelLocation.X = (int)lp.intersectPoint(i).X;
                    injector[index].PointerInfo.PtPixelLocation.Y = (int)lp.intersectPoint(i).Y;
                }
            }

            bool s = TouchInjector.InjectTouchInput(numActiveContacts(), injector);


            //for (int i = 0; i < numControllers; i++)
            //{
            //    int index = (numActiveContacts() - 1) * i;
            //    //int index = contacts[i].ID;
            //    //int index = (int)injector[i].PointerInfo.PointerId;

            //    if (contacts[i].Active)
            //    {

            //        if (ControllerData.controller[i].one == true && contacts[i].Holding == false) // pressed
            //        {
            //            contacts[i].JustPressed = true;
            //            contacts[i].Holding = true;
            //        }

            //        if (ControllerData.controller[i].one == false && contacts[i].Holding == true) // released
            //        {
            //            contacts[i].JustReleased = true;
            //            contacts[i].Holding = false;
            //        }


            //        if (contacts[i].JustPressed)
            //        {
            //            contacts[i].JustPressed = false;
            //            TouchActions.TouchDown(index);
            //        }

            //        if (contacts[i].JustReleased)
            //        {
            //            contacts[i].JustReleased = false;
            //            TouchActions.Release(index);
            //        }

            //        if (contacts[i].Holding == false)
            //            TouchActions.SetHover(index);

            //        if (ControllerData.controller[i].start == true)
            //            LaserPointer.Calibrate(index);

            //        injector[index].PointerInfo.PtPixelLocation.X = (int)lp.intersectPoint(i).X;
            //        injector[index].PointerInfo.PtPixelLocation.Y = (int)lp.intersectPoint(i).Y;
            //    }
            //}



            SettingsWindow.debugText[2] =
                "\nnumActiveContacts: " + numActiveContacts() +
                "\nc0 active: " + contacts[0].Active +
                "\nc1 active: " + contacts[1].Active +
                "\nc0 ID: " + contacts[0].ID +
                "\nc1 ID: " + contacts[1].ID +
                "\ninjectorlist count: " + injectorList.Count();
            //"\ninjectorArray leng: " + injector.Count();
        }