/// <summary> /// Invoked any time the window is refreshed. /// For every Path, it updates timestamps since last frame was added, /// and triggers executions if over a certain threshold. /// </summary> private void TimeTick(TuioTime frameTime) { long timeInc = frameTime.TotalMilliseconds - lastTimeTick; if (cMode == ControlMode.Execute) { var keys = new List <int>(fiduTimes.Keys); // http://stackoverflow.com/a/2260472 foreach (var key in keys) { fiduTimes[key] += timeInc; if (fiduTimes[key] > maxTimeInc) { SendPathToRobot(key); } } } else if (cMode == ControlMode.Stream) { //idleTime += timeInc; //if (awake && idleTime > maxTimeInc) //{ // MakeRobotSleep(); //} } //Console.WriteLine("IDLE TIME: " + idleTime); lastTimeTick = frameTime.TotalMilliseconds; }
// this is the end of a single frame // we only really need to call the frame end if something actually happened this frame public void refresh(TuioTime ftime) { if (!cursorDidChange) { return; } cursorDidChange = false; }
private void HandleMessageEnded(TuioTime time) { OnEvents?.Invoke(new TrackerEvents( _markerEvents.ToArray(), _pointerEvents.ToArray() )); _pointerEvents.Clear(); _markerEvents.Clear(); }
public void refresh(TuioTime frameTime) { //Console.WriteLine("Refreshing"); //Console.WriteLine("secs: " + frameTime.Seconds); // seconds elapsed since program start //Console.WriteLine("totalsecs: " + frameTime.TotalMilliseconds); // millis elapsed since program start //Console.WriteLine("micros: " + frameTime.Microseconds); // micros elapsed since last whole second // ROBOT TimeTick(frameTime); Invalidate(); }
// this is the end of a single frame // we only really need to call the frame end if something actually happened this frame public void refresh(TuioTime ftime) { if (!cursorDidChange) { return; } if (eventDelegate) { eventDelegate.finishFrame(); } cursorDidChange = false; }
public void Refresh(TuioTime frameTime) { Trace.WriteLine(string.Format("refresh {0}", frameTime.getTotalMilliseconds()), "TUIO"); _refreshTimer.Stop(); if (this.IsContactEnabled && this.IsWindowsKeyPressEnabled) { if (_pointerTouchInfos.Count.Equals(this.WindowsKeyPressTouchCount)) { #pragma warning disable 4014 InjectWindowsKeyPress(); #pragma warning restore 4014 return; } } InjectPointerTouchInfos(); if (_pointerTouchInfos.Count > 0) { for (int i = _pointerTouchInfos.Count - 1; i >= 0; i--) { if (_pointerTouchInfos[i].PointerInfo.PointerFlags.HasFlag(PointerFlags.UP)) { _pointerTouchInfos.RemoveAt(i); } } if (_pointerTouchInfos.Count > 0) { for (int i = 0, ic = _pointerTouchInfos.Count; i < ic; i++) { if (_pointerTouchInfos[i].PointerInfo.PointerFlags.HasFlag(PointerFlags.DOWN)) { PointerTouchInfo pointerTouchInfo = _pointerTouchInfos[i]; pointerTouchInfo.PointerInfo.PointerFlags = PointerFlags.UPDATE | PointerFlags.INRANGE | ((this.IsContactEnabled) ? PointerFlags.INCONTACT : PointerFlags.NONE); _pointerTouchInfos[i] = pointerTouchInfo; } } _refreshTimer.Start(); } } }
private void TuioChannelHelper_OnTuioRefresh(TuioTime t) { OnTuioRefreshEvent(t); }
private void TuioChannel_OnTuioRefresh(TuioTime t) { //TODO: re-enable frequent screen monitoring //if (frameCount % checkScreenEvery == 0) // ScanScreens(); //loop through the TuioObjects List <PointerTouchInfo> toFire = new List <PointerTouchInfo>(); List <long> removeList = new List <long>(); foreach (var kvp in channel.CursorList) { TuioCursor cur = kvp.Value.TuioCursor; IncomingType type = kvp.Value.Type; int[] injectionCoordinates = ToInjectionCoordinates(cur.X, cur.Y); int radius = 12; //make a new pointertouchinfo with all neccessary information PointerTouchInfo contact = new PointerTouchInfo(); contact.PointerInfo.pointerType = PointerInputType.TOUCH; contact.TouchFlags = TouchFlags.NONE; //contact.Orientation = (uint)cur.getAngleDegrees();//this is only valid for TuioObjects contact.Pressure = 1024; contact.TouchMasks = TouchMask.CONTACTAREA | TouchMask.ORIENTATION | TouchMask.PRESSURE; contact.PointerInfo.PtPixelLocation.X = injectionCoordinates[0]; contact.PointerInfo.PtPixelLocation.Y = injectionCoordinates[1]; contact.PointerInfo.PointerId = (uint)cur.CursorID; contact.ContactArea.left = injectionCoordinates[0] - radius; contact.ContactArea.right = injectionCoordinates[0] + radius; contact.ContactArea.top = injectionCoordinates[1] - radius; contact.ContactArea.bottom = injectionCoordinates[1] + radius; //contact.PointerInfo.FrameId = frameCount; //set the right flags if (type == IncomingType.New) { contact.PointerInfo.PointerFlags = PointerFlags.DOWN | PointerFlags.INRANGE | PointerFlags.INCONTACT; kvp.Value.Type = IncomingType.Update; } else if (type == IncomingType.Update) { contact.PointerInfo.PointerFlags = PointerFlags.UPDATE | PointerFlags.INRANGE | PointerFlags.INCONTACT; } else if (type == IncomingType.Remove) { contact.PointerInfo.PointerFlags = PointerFlags.UP; removeList.Add(kvp.Key); } //add it to 'toFire' toFire.Add(contact); } //fire the events bool success = TCD.System.TouchInjection.TouchInjector.InjectTouchInput(toFire.Count, toFire.ToArray()); //remove those with type == IncomingType.Remove foreach (long key in removeList) { channel.CursorList.Remove(key);//remove from the tuio channel } //count up frameCount++; }
// this is the end of a single frame // we only really need to call the frame end if something actually happened this frame public void refresh(TuioTime ftime) { }
// this is the end of a single frame public void refresh(TuioTime ftime) { // we dont need to do anything here really }
public void refresh(TuioTime frameTime) { try { OnTuioRefresh(frameTime); } catch { } }
public void refresh(TuioTime frameTime) { Invalidate(); }
public void refresh(TuioTime ftime) => OnRefresh?.Invoke(ftime);
void TuioListener.refresh(TuioTime ftime) { //throw new System.NotImplementedException(); }
public void refresh(TuioTime ftime) { // Intentionally left empty. We don't need the extra update loop but TUIO forces us to implent it. }
public void refresh(TuioTime ftime) { //Do nothing }
public void refresh(TuioTime bundleTime) { }
public void refresh(TuioTime frameTime) { }
public void refresh(TuioTime frameTime) { //Console.WriteLine("refresh "+frameTime.getTotalMilliseconds()); }
public static void OnTuioRefreshEvent(TuioTime t) { try { OnTuioRefresh(t); } catch { } }