//private void Update() //{ // if (Input.GetMouseButton(0)) // { // Debug.Log(Input.mousePosition); // } //} private void OnEnable() { Debug.Log(string.Format("TUIO listening on port {0}... (Press escape to quit)", port)); if (IsShowTip) { if (_tipObjects.Count == 0) { GameObject prefab = new GameObject("tip", typeof(Image)); Canvas canvas = FindObjectOfType <Canvas>(); for (int i = 0; i < 15; i++) { GameObject go = Instantiate(prefab, canvas.transform); Image image = go.GetComponent <Image>(); image.rectTransform.position = Vector3.zero; _tipObjects.Add(image); go.SetActive(false); } } } _screenWidth = Screen.width; _screenHeight = Screen.height; // tuio CursorProcessor cursorProcessor = new CursorProcessor(); cursorProcessor.CursorAdded += OnCursorAdded; cursorProcessor.CursorUpdated += OnCursorUpdated; cursorProcessor.CursorRemoved += OnCursorRemoved; BlobProcessor blobProcessor = new BlobProcessor(); blobProcessor.BlobAdded += OnBlobAdded; blobProcessor.BlobUpdated += OnBlobUpdated; blobProcessor.BlobRemoved += OnBlobRemoved; ObjectProcessor objectProcessor = new ObjectProcessor(); objectProcessor.ObjectAdded += OnObjectAdded; objectProcessor.ObjectUpdated += OnObjectUpdated; objectProcessor.ObjectRemoved += OnObjectRemoved; // listen... Connect(); _tuioServer.AddDataProcessor(cursorProcessor); _tuioServer.AddDataProcessor(blobProcessor); _tuioServer.AddDataProcessor(objectProcessor); Debug.Log("connect"); }
private static void ListenForTUIO() { Console.WriteLine(string.Format("TUIO listening on port {0}... (Press escape to quit)", port)); // tuio tuioServer = new TuioServer(port); CursorProcessor cursorProcessor = new CursorProcessor(); cursorProcessor.CursorAdded += OnCursorAdded; cursorProcessor.CursorUpdated += OnCursorUpdated; cursorProcessor.CursorRemoved += OnCursorRemoved; BlobProcessor blobProcessor = new BlobProcessor(); blobProcessor.BlobAdded += OnBlobAdded; blobProcessor.BlobUpdated += OnBlobUpdated; blobProcessor.BlobRemoved += OnBlobRemoved; ObjectProcessor objectProcessor = new ObjectProcessor(); objectProcessor.ObjectAdded += OnObjectAdded; objectProcessor.ObjectUpdated += OnObjectUpdated; objectProcessor.ObjectRemoved += OnObjectRemoved; // listen... tuioServer.Connect(); tuioServer.AddDataProcessor(cursorProcessor); tuioServer.AddDataProcessor(blobProcessor); tuioServer.AddDataProcessor(objectProcessor); do { while (!Console.KeyAvailable) { Thread.Sleep(100); } } while (Console.ReadKey(true).Key != ConsoleKey.Escape); // done tuioServer.Disconnect(); tuioServer = null; Console.WriteLine("Bye!"); }
/// <inheritdoc /> protected override void init() { cursorProcessor = new CursorProcessor(); cursorProcessor.CursorAdded += OnCursorAdded; cursorProcessor.CursorUpdated += OnCursorUpdated; cursorProcessor.CursorRemoved += OnCursorRemoved; blobProcessor = new BlobProcessor(); blobProcessor.BlobAdded += OnBlobAdded; blobProcessor.BlobUpdated += OnBlobUpdated; blobProcessor.BlobRemoved += OnBlobRemoved; objectProcessor = new ObjectProcessor(); objectProcessor.ObjectAdded += OnObjectAdded; objectProcessor.ObjectUpdated += OnObjectUpdated; objectProcessor.ObjectRemoved += OnObjectRemoved; connect(); }
/// <inheritdoc /> protected override void OnEnable() { base.OnEnable(); screenWidth = Screen.width; screenHeight = Screen.height; cursorProcessor = new CursorProcessor(); cursorProcessor.CursorAdded += OnCursorAdded; cursorProcessor.CursorUpdated += OnCursorUpdated; cursorProcessor.CursorRemoved += OnCursorRemoved; blobProcessor = new BlobProcessor(); blobProcessor.BlobAdded += OnBlobAdded; blobProcessor.BlobUpdated += OnBlobUpdated; blobProcessor.BlobRemoved += OnBlobRemoved; objectProcessor = new ObjectProcessor(); objectProcessor.ObjectAdded += OnObjectAdded; objectProcessor.ObjectUpdated += OnObjectUpdated; objectProcessor.ObjectRemoved += OnObjectRemoved; connect(); }
private void OnEnable() { Debug.Log(string.Format("TUIO listening on port {0}... (Press escape to quit)", port)); screenWidth = Screen.width; screenHeight = Screen.height; // tuio CursorProcessor cursorProcessor = new CursorProcessor(); cursorProcessor.CursorAdded += OnCursorAdded; cursorProcessor.CursorUpdated += OnCursorUpdated; cursorProcessor.CursorRemoved += OnCursorRemoved; BlobProcessor blobProcessor = new BlobProcessor(); blobProcessor.BlobAdded += OnBlobAdded; blobProcessor.BlobUpdated += OnBlobUpdated; blobProcessor.BlobRemoved += OnBlobRemoved; ObjectProcessor objectProcessor = new ObjectProcessor(); objectProcessor.ObjectAdded += OnObjectAdded; objectProcessor.ObjectUpdated += OnObjectUpdated; objectProcessor.ObjectRemoved += OnObjectRemoved; // listen... connect(); tuioServer.AddDataProcessor(cursorProcessor); tuioServer.AddDataProcessor(blobProcessor); tuioServer.AddDataProcessor(objectProcessor); Debug.Log("connect"); }