示例#1
0
    /// <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;
    }
示例#2
0
 // 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;
 }
示例#3
0
        private void HandleMessageEnded(TuioTime time)
        {
            OnEvents?.Invoke(new TrackerEvents(
                                 _markerEvents.ToArray(),
                                 _pointerEvents.ToArray()
                                 ));

            _pointerEvents.Clear();
            _markerEvents.Clear();
        }
示例#4
0
    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();
    }
示例#5
0
 // 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();
                }
            }
        }
示例#7
0
 private void TuioChannelHelper_OnTuioRefresh(TuioTime t)
 {
     OnTuioRefreshEvent(t);
 }
示例#8
0
        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++;
        }
示例#9
0
 // 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)
 {
 }
示例#10
0
 // this is the end of a single frame
 public void refresh(TuioTime ftime)
 {
     // we dont need to do anything here really
 }
示例#11
0
 public void refresh(TuioTime frameTime)
 {
     try { OnTuioRefresh(frameTime); }
     catch { }
 }
示例#12
0
 public void refresh(TuioTime frameTime)
 {
     Invalidate();
 }
示例#13
0
 public void refresh(TuioTime ftime) => OnRefresh?.Invoke(ftime);
示例#14
0
 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.
 }
示例#16
0
 public void refresh(TuioTime ftime)
 {
     //Do nothing
 }
示例#17
0
 public void refresh(TuioTime bundleTime)
 {
 }
 public void refresh(TuioTime frameTime)
 {
 }
示例#19
0
 public void refresh(TuioTime frameTime)
 {
     //Console.WriteLine("refresh "+frameTime.getTotalMilliseconds());
 }
示例#20
0
 public static void OnTuioRefreshEvent(TuioTime t)
 {
     try { OnTuioRefresh(t); }
     catch { }
 }