/// <summary> /// Forward the given touch message. /// </summary> /// <param name="?"></param> public void Forward(TouchMessage Message) { if (Message != null) { System.Console.WriteLine(Message.ToString()); } }
/// <summary> /// Forward the given touch message. /// </summary> /// <param name="?"></param> public void Forward(TouchMessage Message) { if (Message != null) System.Console.WriteLine(Message.ToString()); // Convert coords into appt. pixel space. int x = (int)( lScreens[iScreenIndex].WorkArea.Left + (Message.X * lScreens[iScreenIndex].WorkArea.Width) ); int y = (int)( lScreens[iScreenIndex].WorkArea.Top + (Message.Y * lScreens[iScreenIndex].WorkArea.Height) ); // Handle move. if (Message.Type == TouchMessage.Nature.Move) { Mouse.Move(x, y); } // Handle down. else if (Message.Type == TouchMessage.Nature.Down) { Mouse.Move(x, y); Mouse.LeftDown(x, y); } // Handle up. else if (Message.Type == TouchMessage.Nature.Up) { Mouse.Move(x, y); Mouse.LeftUp(x,y); } }
public void CreateTouchMessage() { var message = new TouchMessage(new Vector2D[0], new bool[0]); Assert.AreEqual(0, message.Positions.Length); Assert.AreEqual(0, message.PressedTouches.Length); }
/// <summary> /// Forward the given touch message. /// </summary> /// <param name="?"></param> public void Forward(TouchMessage Message) { if (Message != null) { System.Console.WriteLine(Message.ToString()); } // Convert coords into appt. pixel space. int x = (int)(lScreens[iScreenIndex].WorkArea.Left + (Message.X * lScreens[iScreenIndex].WorkArea.Width)); int y = (int)(lScreens[iScreenIndex].WorkArea.Top + (Message.Y * lScreens[iScreenIndex].WorkArea.Height)); // Handle move. if (Message.Type == TouchMessage.Nature.Move) { Mouse.Move(x, y); } // Handle down. else if (Message.Type == TouchMessage.Nature.Down) { Mouse.Move(x, y); Mouse.LeftDown(x, y); } // Handle up. else if (Message.Type == TouchMessage.Nature.Up) { Mouse.Move(x, y); Mouse.LeftUp(x, y); } }
/// <summary> /// Forward the given touch message. /// </summary> /// <param name="?"></param> public void Forward(TouchMessage Message) { // Skip bad messages if (Message == null) { return; } // If we have a bad startup condition. if (pUDPWriter == null) { return; } // Create an new TUIO Bundle OSCBundle pBundle = new OSCBundle(); // Create a fseq message and save it. This is to associate a unique frame id with a bundle of SET and ALIVE. OSCMessage pMessageFseq = new OSCMessage("/tuio/2Dcur"); pMessageFseq.Append("fseq"); pMessageFseq.Append(++iFrame); pBundle.Append(pMessageFseq); // Create a alive message. OSCMessage pMessageAlive = new OSCMessage("/tuio/2Dcur"); pMessageAlive.Append("alive"); // Compile the set message. OSCMessage pMessage = new OSCMessage("/tuio/2Dcur"); pMessage.Append("set"); // set pMessage.Append((int)Message.ID); // session pMessage.Append((float)Message.X); // x pMessage.Append((float)Message.Y); // y pMessage.Append(0f); // dx pMessage.Append(0f); // dy pMessage.Append(0f); // motion pMessage.Append(1f); // height pMessage.Append(1f); // width // Append it to the bundle. pBundle.Append(pMessage); // Append the alive message for this contact to tbe bundle. pMessageAlive.Append((int)Message.ID); // Save the alive message. pBundle.Append(pMessageAlive); // Send the message off. this.pUDPWriter.Send(pBundle); }
/// <summary> /// Forward the given touch message. /// </summary> /// <param name="?"></param> public void Forward(TouchMessage Message) { const uint PRESSURE = 32000; const uint ORIENTATION = 0; const int RADIUS = 1; // Convert coords into appt. pixel space. int x = (int)(lScreens[iScreenIndex].WorkArea.Left + (Message.X * lScreens[iScreenIndex].WorkArea.Width)); int y = (int)(lScreens[iScreenIndex].WorkArea.Top + (Message.Y * lScreens[iScreenIndex].WorkArea.Height)); TouchInjector.InjectTouchInput(1, new PointerTouchInfo[] { TouchInjector.MakePointerTouchInfo(x, y, RADIUS, (uint)Message.ID, ORIENTATION, PRESSURE) }); }
/// <summary> /// Forward the given touch message. /// </summary> /// <param name="?"></param> public void Forward(TouchMessage Message) { // Skip bad messages if (Message == null) return; // If we have a bad startup condition. if (pUDPWriter == null) return; // Create an new TUIO Bundle OSCBundle pBundle = new OSCBundle(); // Create a fseq message and save it. This is to associate a unique frame id with a bundle of SET and ALIVE. OSCMessage pMessageFseq = new OSCMessage("/tuio/2Dcur"); pMessageFseq.Append("fseq"); pMessageFseq.Append(++iFrame); pBundle.Append(pMessageFseq); // Create a alive message. OSCMessage pMessageAlive = new OSCMessage("/tuio/2Dcur"); pMessageAlive.Append("alive"); // Compile the set message. OSCMessage pMessage = new OSCMessage("/tuio/2Dcur"); pMessage.Append("set"); // set pMessage.Append((int)Message.ID); // session pMessage.Append((float)Message.X); // x pMessage.Append((float)Message.Y); // y pMessage.Append(0f); // dx pMessage.Append(0f); // dy pMessage.Append(0f); // motion pMessage.Append(1f); // height pMessage.Append(1f); // width // Append it to the bundle. pBundle.Append(pMessage); // Append the alive message for this contact to tbe bundle. pMessageAlive.Append((int)Message.ID); // Save the alive message. pBundle.Append(pMessageAlive); // Send the message off. this.pUDPWriter.Send(pBundle); }
public void Update() { if (Input.GetMouseButtonDown(0)) { upMessage = TouchMessage.EMPTY_MESSAGE; moveMessages.Clear(); lastMessage = downMessage = new TouchMessage(TouchType.Down, GetMousePosScreen()); } else if (Input.GetMouseButtonUp(0)) { lastMessage = upMessage = new TouchMessage(TouchType.Up, GetMousePosScreen()); } else if (Input.GetMouseButton(0)) { lastMessage = new TouchMessage(TouchType.Moving, GetMousePosScreen()); moveMessages.AddLast(lastMessage); if(moveMessages.Count > STORED_TOUCHED_MAX_NUM) moveMessages.RemoveFirst(); } }
/// <summary> /// Forward the given touch message. /// </summary> /// <param name="?"></param> public void Forward(TouchMessage Message) { if (Message != null) System.Console.WriteLine(Message.ToString()); }
public void CreateTouchMessage() { touchMessage = new TouchMessage(new[] { Vector2D.Half }, new[] { true }); }
/// <summary> /// Forward the given touch message. /// </summary> /// <param name="?">The touch message to forward it with.</param> public void Forward(TouchMessage Message) { const int HID_CONTACT_INFO_SIZE = 14; // Number of bytes per contact report element. const int MaxSize = 32767; // Highest 16 bit signed int --- used to compute touch point coordinates as a 0-1 mutiplier. const ushort PRESSURE = 1; // Finger pressure. const ushort WIDTH = 1; // Finger width and height. const ushort HEIGHT = 1; // Create a report with two spaces + one byte for end char. var pReport = new HidReport(2 * HID_CONTACT_INFO_SIZE + 1); pReport.ReportId = 1; // Multi-touch report id // Write out the report data. using (BinaryWriter pWriter = new BinaryWriter(new MemoryStream(pReport.Data))) { // Write the contact data in the correct format for the contact. if (Message.Type == TouchMessage.Nature.Down) { // First contact. pWriter.Write((ushort)2); // pWriter.Write((ushort)(Message.X * MaxSize)); // X pWriter.Write((ushort)(Message.Y * MaxSize)); // Y pWriter.Write(PRESSURE); // Pressure pWriter.Write(WIDTH); // Width pWriter.Write(HEIGHT); // Height pWriter.Write((ushort)Message.ID); // ID // Write the rest full of 0s. pWriter.Write(new byte[HID_CONTACT_INFO_SIZE]); // If it is our first report then write the byte which contains the number in the report sequence. pWriter.Write((byte)1); } else if (Message.Type == TouchMessage.Nature.Up) { // First contact. pWriter.Write((ushort)2); pWriter.Write((ushort)(Message.X * MaxSize)); // X pWriter.Write((ushort)(Message.Y * MaxSize)); // Y pWriter.Write(PRESSURE); // Pressure pWriter.Write(WIDTH); // Width pWriter.Write(HEIGHT); // Height pWriter.Write((ushort)Message.ID); // ID // Secnd contact. pWriter.Write((ushort)0); pWriter.Write((ushort)(Message.X * MaxSize)); // X pWriter.Write((ushort)(Message.Y * MaxSize)); // Y pWriter.Write(PRESSURE); // Pressure pWriter.Write(WIDTH); // Width pWriter.Write(HEIGHT); // Height pWriter.Write((ushort)Message.ID); // ID // If it is our first report then write the byte which contains the number in the report sequence. pWriter.Write((byte)2); } else if (Message.Type == TouchMessage.Nature.Move) { // First contact. pWriter.Write((ushort)3); pWriter.Write((ushort)(Message.X * MaxSize)); // X pWriter.Write((ushort)(Message.Y * MaxSize)); // Y pWriter.Write(PRESSURE); // Pressure pWriter.Write(WIDTH); // Width pWriter.Write(HEIGHT); // Height pWriter.Write((ushort)Message.ID); // ID // Write the rest full of 0s. pWriter.Write(new byte[HID_CONTACT_INFO_SIZE]); // If it is our first report then write the byte which contains the number in the report sequence. pWriter.Write((byte)1); } } // Push it to the driver. pDevice.WriteReport(pReport); }