public void removeCursor(TuioCursor cursor) { if (!activeEvents.ContainsKey(cursor.getSessionID())) { return; } mtEvent anEvent = activeEvents[cursor.getSessionID()]; anEvent.eventState = mtEventState.Ended; lock (eventQueueLock) { eventQueue.Add(anEvent); } activeEvents.Remove(cursor.getSessionID()); didChange = true; }
public void updateCursor(TuioCursor cursor) { if (!activeEvents.ContainsKey(cursor.getSessionID())) { return; } mtEvent anEvent = activeEvents[cursor.getSessionID()]; anEvent.lastScreenPosition = anEvent.screenPosition; anEvent.screenPosition = new Vector3(cursor.getX() * cameraPixelWidth, 0, (1.0f - cursor.getY()) * cameraPixelHeight); anEvent.tuioPosition = new Vector2(cursor.getX(), (1.0f - cursor.getY())); anEvent.eventState = mtEventState.Moved; lock (eventQueueLock) eventQueue.Add(anEvent); didChange = true; }
public void newCursor(TuioCursor cursor) { mtEvent newEvent = new mtEvent(cursor.getSessionID()); newEvent.tuioPosition = new Vector2(cursor.getX(),(1.0f - cursor.getY())); //switching y and z (y is up axis by default in unity) newEvent.screenPosition = new Vector3(cursor.getX() * cameraPixelWidth, 0,(1.0f - cursor.getY()) * cameraPixelHeight); newEvent.lastScreenPosition = newEvent.screenPosition; newEvent.eventState = mtEventState.Began; if (activeEvents.ContainsKey(cursor.getSessionID())) { //Already on list, remove old - add new activeEvents.Remove(cursor.getSessionID()); } activeEvents.Add( cursor.getSessionID(), newEvent ); // queue it up for processing lock (eventQueueLock) eventQueue.Add(newEvent); didChange = true; }
public void newCursor(TuioCursor cursor) { mtEvent newEvent = new mtEvent(cursor.getSessionID()); newEvent.tuioPosition = new Vector2(cursor.getX(), (1.0f - cursor.getY())); //switching y and z (y is up axis by default in unity) newEvent.screenPosition = new Vector3(cursor.getX() * cameraPixelWidth, 0, (1.0f - cursor.getY()) * cameraPixelHeight); newEvent.lastScreenPosition = newEvent.screenPosition; newEvent.eventState = mtEventState.Began; if (activeEvents.ContainsKey(cursor.getSessionID())) { //Already on list, remove old - add new activeEvents.Remove(cursor.getSessionID()); } activeEvents.Add(cursor.getSessionID(), newEvent); // queue it up for processing lock (eventQueueLock) eventQueue.Add(newEvent); didChange = true; }