コード例 #1
0
            /// <summary>
            ///
            /// </summary>
            /// <param name="delta">这个是手机中传过来的移动速度</param>
            public void ProcessData(RemoteXControlMessage data)
            {
                System.Drawing.Point point      = new System.Drawing.Point((int)data.Values[0], (int)data.Values[1]);
                MoveCursor           moveCursor = new MoveCursor(false);

                moveCursor.MoveTo(point);
            }
コード例 #2
0
        /*
         * private void onReceiveData(BTTask btTask, byte[] message)
         * {
         *  RemoteXDataLibary.RemoteXControlMessage[] datas = null;
         *  try
         *  {
         *      datas = RemoteXDataLibary.RemoteXControlMessage.FromBytes(message);
         *  }
         *  catch (Exception exception)
         *  {
         *      System.Diagnostics.Debug.WriteLine("XJ2::" + exception.Message);
         *  }
         *  ControllerManager controllerManager = controllerManagers[btTask.taskId];
         *  if (datas != null)
         *  {
         *      foreach (var data in datas)
         *      {
         *          controllerManager.addData(data);
         *          RemoteXDebugBackend.DebugBackend.Instance.Set(data);
         *          Debug.WriteLine(data);
         *      }
         *  }
         * }*/
        private void Button_MoveCursor_Click(object sender, RoutedEventArgs e)
        {
            System.Drawing.Point point = new System.Drawing.Point();
            point.X = Convert.ToInt32(TextBox_SetMousePositionX.Text);
            point.Y = Convert.ToInt32(TextBox_SetMousePositionY.Text);
            MoveCursor moveCursor = new MoveCursor();

            moveCursor.MoveTo(point);
        }
コード例 #3
0
            public void processData(RemoteXControlMessage data)
            {
                Vector3    gyroData   = new Vector3(data.Values[0], data.Values[1], data.Values[2]);
                MoveCursor moveCursor = new MoveCursor(false);

                System.Drawing.Point point = new System.Drawing.Point();
                point.X = (int)(-gyroData.x * mouseSpeedFactor.x);
                point.Y = (int)(gyroData.z * mouseSpeedFactor.y);
                moveCursor.MoveTo(point);
            }
コード例 #4
0
            public void processData(RemoteXControlMessage data)
            {
                Quaternion rot          = new Quaternion(data.Values[0], data.Values[1], data.Values[2], data.Values[3]);
                Vector3    readyPointer = mouseBoundary.quaternionToVector(rot);

                lastMousePointers.Add(readyPointer);
                if (lastMousePointers.Count > averDataCount)
                {
                    lastMousePointers.RemoveAt(0);
                }
                Vector3 sumVec = Vector3.zero;

                foreach (Vector3 v in lastMousePointers)
                {
                    sumVec += v;
                }
                if (lastMousePointers.Count >= averDataCount)
                {
                    Vector3 currAverMousepointer = (sumVec / averDataCount).normalized;

                    if ((lastAverMousePointer - readyPointer).magnitude > mousePointerThreshold)
                    {
                        this.mouseBoundary.qPointer = rot;
                        Vector2 devicePosition = this.mouseBoundary.getDevicePositionByVPointer(currAverMousepointer);
                        devicePosition.x *= 66000;
                        devicePosition.y *= 66000;
                        MoveCursor           moveCursor = new MoveCursor();
                        System.Drawing.Point point      = new System.Drawing.Point();
                        point.X = (int)devicePosition.x;
                        point.Y = (int)devicePosition.y;
                        moveCursor.MoveTo(point);
                        lastAverMousePointer = sumVec / averDataCount;
                    }
                }
                else
                {
                    if (lastMousePointers.Count != 0)
                    {
                        lastAverMousePointer = (sumVec / lastMousePointers.Count).normalized;
                    }
                }
                lastMousePointer = readyPointer;
            }