Ejemplo n.º 1
0
        private void MouseDown(IGesture gesture, GameTime time, IInputDevice device)
        {
            if (RespondOnMouseDown)
                OnSelected();

            _mouseDown = true;
        }
Ejemplo n.º 2
0
        public virtual void HandlePointerEvent(IPointerEvent evnt)
        {
            double        scale   = 1.0 / Zoom;
            IPointerEvent subEvnt = new PointerEventAdapter(evnt,
                                                            (int)(0.5 + (evnt.RawX - Canvas.RawWidth / 2.0) * scale + CenterX),
                                                            (int)(0.5 + (evnt.RawY - Canvas.RawHeight / 2.0) * scale + CenterY));

            IGesture gest = gesture;

            if (gest != null)
            {
                switch (evnt.Type)
                {
                case PointerEventType.GestureStart:
                    gest.GestureStart(subEvnt);
                    break;

                case PointerEventType.GestureMove:
                    gest.GestureMove(subEvnt);
                    break;

                case PointerEventType.GestureEnd:
                    gest.GestureComplete(subEvnt);
                    break;
                }
            }
        }
Ejemplo n.º 3
0
 void Reset()
 {
     if (gesture == null)
     {
         gesture = GetComponent <IGesture>();
     }
 }
Ejemplo n.º 4
0
 private void MouseUp(IGesture gesture, GameTime time, IInputDevice device)
 {
     if (!RespondOnMouseDown && mouseDown)
     {
         OnSelected();
     }
 }
Ejemplo n.º 5
0
        public static List <IGesture> GetRelatedGestures(this IEnumerable <IApplication> applications, IEnumerable <IGesture> gestures)
        {
            var result = new List <IGesture>();

            foreach (var app in applications)
            {
                if (app.Actions == null)
                {
                    continue;
                }
                foreach (var action in app.Actions)
                {
                    if (action == null || string.IsNullOrEmpty(action.GestureName))
                    {
                        continue;
                    }
                    IGesture gesture = gestures.FirstOrDefault(g => g.Name == action.GestureName);
                    if (gesture != null && !result.Contains(gesture))
                    {
                        result.Add(gesture);
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Initialiazes a new <see cref="RepeatGesture"/> instance
 /// with a <see cref="Form"/> instance.
 /// </summary>
 /// <param name="form">
 /// Target <see cref="Form"/>
 /// </param>
 /// <param name="gesture">
 /// The gesture to be repeated
 /// </param>
 /// <param name="repeatCount">
 /// The number of repetition</param>
 public RepeatGesture(Form form, IGesture gesture, int repeatCount)
     : base(form)
 {
     if (gesture == null)
         throw new ArgumentNullException("gesture");
     this.gesture = gesture;
 }
Ejemplo n.º 7
0
 public void RegisterGesture(IGesture gesture,GestureEventHandler callback)
 {
     if (!_registeredGestures.ContainsKey(gesture))
     {
         _registeredGestures.Add(gesture,callback);
     }
 }
 private void RunGesture(IGesture gesture)
 {
     ThreadRunner runner = new ThreadRunner(new ThreadStart(gesture.Start));
     runner.Run();
     if (runner.CatchedException != null)
         Assert.Fail(runner.CatchedException.ToString());
 }
Ejemplo n.º 9
0
        private TrackingData RetrieveTrackingData(int skeletonID, Skeleton skel)
        {
            TrackingData result;

            trackingMapper.TryGetValue(skeletonID, out result);
            if (result == null)
            {
                IGesture[] gestures = new IGesture[]
                {
                    new RHSWaveGesture(),
                    new JumpGesture(skel)
                };

                gestures[0].OnRecognized += OnWaveRecognized;

                /* Give the kalman filter some time to converge before firing events */
                var kalman_wait_time = 1; // in seconds
                var dispatcherTimer  = new DispatcherTimer();
                dispatcherTimer.Tick += (sender, e) =>
                {
                    Debug.WriteLine("Delayed subscription on JUMP");
                    gestures[1].OnRecognized += OnJumpRecognized;
                    dispatcherTimer.Stop();
                };
                dispatcherTimer.Interval = new TimeSpan(0, 0, kalman_wait_time);
                dispatcherTimer.Start();

                result = new TrackingData(skeletonID, gestures);

                trackingMapper[skeletonID] = result;
            }

            return(result);
        }
Ejemplo n.º 10
0
        public void ClickButtonTwo()
        {
            IGesture gesture = factory.MouseClick(form.button2);

            RunGesture(gesture);
            Assert.AreEqual(1, form.button2ClickCount);
        }
Ejemplo n.º 11
0
        void RemoveGestureEvent( IGesture gesture ) {

            EventTouchBegan.RemoveListener( gesture.OnStart );
            EventTouchMoved.RemoveListener( gesture.OnUpdate );
            EventTouchStationary.RemoveListener( gesture.OnUpdate );
            EventTouchEnd.RemoveListener( gesture.OnFinish );
        }
Ejemplo n.º 12
0
        void AddGestureEvent( IGesture gesture ) {

            EventTouchBegan.AddListener( gesture.OnStart );
            EventTouchMoved.AddListener( gesture.OnUpdate );
            EventTouchStationary.AddListener( gesture.OnUpdate );
            EventTouchEnd.AddListener( gesture.OnFinish );
        }
Ejemplo n.º 13
0
 /// <summary>
 /// Creates a new <see cref="RepeatGesture"/> with
 /// the gesture and the repeat count
 /// </summary>
 /// <param name="gesture">
 /// Target <see cref="IGesture"/> instance
 /// </param>
 /// <param name="repeatCount">
 /// Number of repetition
 /// </param>
 /// <returns>
 /// A <see cref="RepeatGesture"/> instance
 /// </returns>
 public RepeatGesture Repeat(IGesture gesture, int repeatCount)
 {
     if (gesture == null)
     {
         throw new ArgumentNullException("gesture");
     }
     return(new RepeatGesture(this.Form, gesture, repeatCount));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Edit gesture or add new one.
 /// </summary>
 public GestureDefinition(IGesture gesture, bool reName)
     : this()
 {
     _capturedPointPatterns = gesture.PointPatterns;
     GestureManager.Instance.GestureName = gesture.Name;
     if (reName) _existingGestureName = gesture.Name;
     this.ReName = reName;
 }
Ejemplo n.º 15
0
        /// <summary>
        /// Creates a <see cref="Thread"/> for the
        /// <see cref="IGesture.Start"/> method and starts it.
        /// </summary>
        /// <param name="gesture">
        /// The <see cref="IGesture"/> to execute
        /// </param>
        /// <returns>
        /// The started <see cref="Thread"/> instance
        /// </returns>
        public static Thread Start(IGesture gesture)
        {
            ThreadStart start  = new ThreadStart(gesture.Start);
            Thread      thread = new Thread(start);

            thread.Start();
            return(thread);
        }
Ejemplo n.º 16
0
 public void Add(IGesture gesture)
 {
     if (gesture == null)
     {
         throw new ArgumentNullException("gesture");
     }
     this.List.Add(gesture);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Adds a gesture to the gesture recognizer's set of gestures to recognize
 /// </summary>
 /// <param name="currentView">The current view to associate with the gesture</param>
 /// <param name="gesture">The gesture to add</param>
 public void AddGesture(IView currentView, IGesture gesture)
 {
     if (currentView != null)
     {
         if (!gestureMap.ContainsKey(currentView)) gestureMap.Add(currentView, new List<IGesture>());
         gestureMap[currentView].Add(gesture);
     }
     gestures.Add(gesture);
 }
Ejemplo n.º 18
0
        private void MouseDown(IGesture gesture, GameTime time, IInputDevice device)
        {
            if (RespondOnMouseDown)
            {
                OnSelected();
            }

            mouseDown = true;
        }
Ejemplo n.º 19
0
 public void UnRegisterGesture(IGesture gesture)
 {
     if (gesture == null)
     {
         throw new ArgumentNullException("gesture");
     }
     _bodyFrameReader.FrameArrived -= gesture.FrameArrived;
     _gestures.Remove(gesture);
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Initialiazes a new <see cref="RepeatGesture"/> instance
 /// with a <see cref="Form"/> instance.
 /// </summary>
 /// <param name="form">
 /// Target <see cref="Form"/>
 /// </param>
 /// <param name="gesture">
 /// The gesture to be repeated
 /// </param>
 /// <param name="repeatCount">
 /// The number of repetition</param>
 public RepeatGesture(Form form, IGesture gesture, int repeatCount)
     : base(form)
 {
     if (gesture == null)
     {
         throw new ArgumentNullException("gesture");
     }
     this.gesture = gesture;
 }
Ejemplo n.º 21
0
        public GestureBuilderParameters(IGesture gesture, SkeletonRenderFrames skeletonRenderFrames, DateTime gestureStartTime, DateTime gestureEndTime, GestureBuilder.BuildStrategy buildStrategy)
        {
            this.gesture = gesture;
            this.skeletonRenderFrames = skeletonRenderFrames;

            this.gestureStartTime = gestureStartTime;
            this.gestureEndTime = gestureEndTime;

            this.buildStrategy = buildStrategy;
        }
Ejemplo n.º 22
0
        private void RunGesture(IGesture gesture)
        {
            ThreadRunner runner = new ThreadRunner(new ThreadStart(gesture.Start));

            runner.Run();
            if (runner.CatchedException != null)
            {
                Assert.Fail(runner.CatchedException.ToString());
            }
        }
Ejemplo n.º 23
0
        public GestureBuilderParameters(IGesture gesture, SkeletonRenderFrames skeletonRenderFrames, DateTime gestureStartTime, DateTime gestureEndTime, GestureBuilder.BuildStrategy buildStrategy)
        {
            this.gesture = gesture;
            this.skeletonRenderFrames = skeletonRenderFrames;

            this.gestureStartTime = gestureStartTime;
            this.gestureEndTime   = gestureEndTime;

            this.buildStrategy = buildStrategy;
        }
Ejemplo n.º 24
0
 void Reset()
 {
     _target = null;
     //_prevType = Gesture.Press;
     if (_activeState != null && _activeState != _idle)
     {
         _idle.Activate();
     }
     _activeState = _idle;
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Edit gesture or add new one.
 /// </summary>
 public GestureDefinition(IGesture gesture, bool reName)
     : this()
 {
     _capturedPointPatterns = gesture.PointPatterns;
     GestureManager.Instance.GestureName = gesture.Name;
     if (reName)
     {
         _existingGestureName = gesture.Name;
     }
     this.ReName = reName;
 }
Ejemplo n.º 26
0
        public void ClickButtonOneAndTwo()
        {
            IGesture gesture1 = factory.MouseClick(form.button1);
            IGesture gesture2 = factory.MouseClick(form.button2);
            IGesture gesture  = factory.Sequence(gesture1, gesture2);

            RunGesture(gesture);

            Assert.AreEqual(1, form.button1ClickCount);
            Assert.AreEqual(1, form.button2ClickCount);
        }
Ejemplo n.º 27
0
        void OnGestureDone(IGesture a_Gesture, bool a_Error)
        {
            Dictionary <string, object> response = new Dictionary <string, object>();

            response["event"]      = "execute_done";
            response["gestureId"]  = a_Gesture.GetGestureId();
            response["instanceId"] = a_Gesture.GetInstanceId();
            response["error"]      = a_Error;

            TopicClient.Instance.Publish("gesture-manager", Json.Serialize(response));
        }
Ejemplo n.º 28
0
        private void Init()
        {
            if (_isInited)
            {
                return;
            }
            _guiDrawer          = new GUI.Drawer();
            _guiDrawer.OnClose += () => _isShowingGUI = false;
            var gestureLeastLength = (Screen.width + Screen.height) / 4;

            _gesture = new CircleGesture(new TouchProvider(), gestureLeastLength);
        }
Ejemplo n.º 29
0
        //! Callback for sensor-manager topic.
        void OnGestureManagerEvent(TopicClient.Payload a_Payload)
        {
            IDictionary json = Json.Deserialize(Encoding.UTF8.GetString(a_Payload.Data)) as IDictionary;

            bool   bFailed    = false;
            string gestureId  = json["gestureId"] as string;
            string instanceId = json["instanceId"] as string;
            string gestureKey = gestureId + "/" + instanceId;
            string event_name = json["event"] as string;

            IGesture gesture = null;

            if (m_Gestures.ContainsKey(gestureKey))
            {
                if (m_Gestures.TryGetValue(gestureKey, out gesture))
                {
                    if (event_name.CompareTo("execute_gesture") == 0)
                    {
                        if (!gesture.Execute(OnGestureDone, json["params"] as IDictionary))
                        {
                            Log.Error("GestureManager", "Failed to execute gesture {0}", gestureId);
                            bFailed = true;
                        }
                    }
                    else if (event_name.CompareTo("abort_gesture") == 0)
                    {
                        if (!gesture.Abort())
                        {
                            Log.Error("GestureManager", "Failed to abort gesture {0}", gestureId);
                            bFailed = true;
                        }
                    }
                }
                else
                {
                    Log.Error("GestureManager", "Failed to find gesture {0}", gestureKey);
                    bFailed = true;
                }

                // if we failed, send the message back with a different event
                if (bFailed)
                {
                    json["failed_event"] = event_name;
                    json["event"]        = "error";

                    TopicClient.Publish("gesture-manager", Json.Serialize(json));
                }
            }
            else
            {
                //do nothing
            }
        }
Ejemplo n.º 30
0
 public void RegisterGesture(IGesture gesture)
 {
     if (gesture == null)
     {
         throw new ArgumentNullException("gesture");
     }
     if (_gestures.Contains(gesture))
     {
         return;
     }
     _gestures.Add(gesture);
     _bodyFrameReader.FrameArrived += gesture.FrameArrived;
 }
Ejemplo n.º 31
0
 private void OnPreviousCommand(IGesture gesture, GameTime gameTime, IInputDevice device)
 {
     if (commandScrollPointer == null)
     {
         commandScrollPointer = previousCommands.Last;
         WritePreviousCommand();
     }
     else if (commandScrollPointer.Previous != null)
     {
         commandScrollPointer = commandScrollPointer.Previous;
         WritePreviousCommand();
     }
 }
Ejemplo n.º 32
0
        private void BuildMovingGestureTree()
        {
            IGesture gesture = null;
            DateTime start   = (DateTime)gestureStartTimeListBox.SelectedItem;
            DateTime end     = (DateTime)gestureEndTimeListBox.SelectedItem;

            GestureBuilderParameters parameters = new GestureBuilderParameters(gesture, renderCanvas.SkeletonRenderFrames, start, end, GestureBuilder.BuildStrategy.StandardTolerance);
            GestureBuilder           builder    = new GestureBuilder();

            movingGestureTree = builder.BuildMovingGestureTree(parameters);
            renderCanvas.SaveCanvasFrames("C:\\Users\\Robert\\Documents\\GitHub\\docs\\files\\render bin\\gesture_8_half_wave.xml");
            Serializer.SerializeToXml <MovingGestureTree>(movingGestureTree, "C:\\Users\\Robert\\Documents\\GitHub\\docs\\files\\gesture bin\\gesture_7_half_wave.xml");
        }
Ejemplo n.º 33
0
 /// <summary>
 /// Adds a gesture to the gesture recognizer's set of gestures to recognize
 /// </summary>
 /// <param name="currentView">The current view to associate with the gesture</param>
 /// <param name="gesture">The gesture to add</param>
 public void AddGesture(IView currentView, IGesture gesture)
 {
     if (currentView != null)
     {
         if (!gestureMap.ContainsKey(currentView))
         {
             gestureMap.Add(currentView, new List <IGesture>());
         }
         gestureMap[currentView].Add(gesture);
     }
     //addedGestures.Add(gesture);
     gestures.Add(gesture);
 }
Ejemplo n.º 34
0
        private void GestureStart(IPointerEvent evnt, bool considerPoke)
        {
            IGesture newGesture = GetGesture(evnt, considerPoke);

            if (newGesture != null)
            {
                if (current != null)
                {
                    current = null;
                    evnt.RepaintCanvas();
                }
                layoutCanvas.Gesture = newGesture;
                newGesture.GestureStart(evnt);
            }
        }
        public void PerformGesture(IGesture gesture)
        {
            // TODO Works only for default portrait orientation, need to take orientation into account
            var array = gesture.GetScreenPoints().ToArray();

            foreach (var point in array.Take(array.Length - 1))
            {
                this.MoveCursorTo(point);
                this.LeftButtonDown();
                Thread.Sleep(gesture.PeriodBetweenPoints);
            }

            this.MoveCursorTo(array.Last());
            this.LeftButtonUp();
        }
Ejemplo n.º 36
0
 private void OnNextCommand(IGesture gesture, GameTime gameTime, IInputDevice device)
 {
     if (commandScrollPointer != null)
     {
         if (commandScrollPointer.Next != null)
         {
             commandScrollPointer = commandScrollPointer.Next;
             WritePreviousCommand();
         }
         else
         {
             textBox.Text         = "";
             commandScrollPointer = null;
         }
     }
 }
Ejemplo n.º 37
0
        private bool SaveGesture(IGesture gesture)
        {
            if (string.IsNullOrEmpty(gesture.Name))
            {
                gesture.Name = GestureManager.GetNewGestureName();
            }

            if (GestureManager.Instance.GestureExists(gesture.Name))
            {
                GestureManager.Instance.DeleteGesture(gesture.Name);
            }
            GestureManager.Instance.AddGesture(gesture);

            GestureManager.Instance.SaveGestures();

            return(true);
        }
Ejemplo n.º 38
0
 private void OnPreviousCommand(IGesture gesture, GameTime gameTime, IInputDevice device)
 {
     if (_commandScrollPointer == null)
     {
         _commandScrollPointer = _previousCommands.Last;
         WritePreviousCommand();
     }
     else if (_commandScrollPointer.Previous != null)
     {
         _commandScrollPointer = _commandScrollPointer.Previous;
         WritePreviousCommand();
     }
 }
Ejemplo n.º 39
0
 public GestureEventArgs(IGesture gesture)
 {
     this.Gesture = gesture;
 }
 public void AddGesture(IGesture gesture)
 {
     _gestures.Add(gesture);
 }
Ejemplo n.º 41
0
 public void Add(IGesture gesture)
 {
     if (gesture == null)
         throw new ArgumentNullException("gesture");
     this.List.Add(gesture);
 }
        /// <summary>
        /// Register passed gesture instance to be recognized by this API. Gesture can be any type implementing interface IGesture. 
        /// This function should used for gestures, that require external datafile to load his configuration.
        /// </summary>
        /// <param name="gesture">Instance of gesture. Must impement IGesture interface.</param>
        /// <param name="gestureDataFile">Path to file containing gesture definition or configuration data.</param>
        /// <param name="forcedGestureRecognition">If true, thist gesture will be evaluated for every valid sequence and will be emited event for it. 
        /// This means that event wil be emited for thist gesture every possible time not depending on his current likehood or if this event have maximal likehooh.</param>
        /// <returns>Returns passed gesture.</returns>
        /// <seealso cref="IGesture"/>
        /// <exception cref="KinectStateException">Gesture with this id already registered.</exception>
        /// <exception cref="GestureStateException">On some error in gesture initialization or loading.</exception>
        public IGesture RegisterGesture(IGesture gesture, string gestureDataFile, bool forcedGestureRecognition = false)
        {
            if (gestureStore.Select(gest => gest.Key.Id == gesture.Id).Contains(true))
                throw new KinectStateException("Cannot register two gestures with same ID.");

            gestureStore.Add(gesture, forcedGestureRecognition);
            gesture.LoadData(gestureDataFile);
            players.RegisterGestureForAll(gesture, forcedGestureRecognition);
            return gesture;
        }
 public void DoGesture(IGesture gesture)
 {
     gesture.Perform(this);
     Pause(PauseDurationAfterPerformingGesture);
 }
 public void RemoveGesture(IGesture gesture)
 {
     _gestures.Remove(gesture);
 }
Ejemplo n.º 45
0
        private void OnAutocomplete(IGesture gesture, GameTime gameTime, IInputDevice device)
        {
            if (_help.HasValue && _help.Value.PossibleCommands.Length > 0)
            {
                var h = _help.Value;
                string similarity = "";

                int letter = 0;
                bool b = true;
                while (true)
                {
                    char c = ' ';
                    for (int i = 0; i < _help.Value.PossibleCommands.Length; i++)
                    {
                        if (letter >= _help.Value.PossibleCommands[i].Length)
                        {
                            b = false;
                            break;
                        }

                        if (c == ' ')
                            c = _help.Value.PossibleCommands[i][letter];
                        else
                        {
                            if (c != _help.Value.PossibleCommands[i][letter])
                            {
                                b = false;
                                break;
                            }
                        }
                    }
                    if (!b)
                        break;

                    similarity += c;
                    letter++;
                }

                _textBox.Text = h.Command.Substring(0, h.TabStart) + similarity;
            }
        }
Ejemplo n.º 46
0
 private void MouseUp(IGesture gesture, GameTime time, IInputDevice device)
 {
     if (!RespondOnMouseDown && _mouseDown)
         OnSelected();
 }
Ejemplo n.º 47
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="gesture"></param>
 /// <returns></returns>
 public IDisposable Subscribe(IGesture gesture)
 {
     return Subscribe((IObserver<Skeleton[]>) gesture);
 }
Ejemplo n.º 48
0
 private void PreviousOption(IGesture gesture, GameTime time, IInputDevice device)
 {
     SelectedOption--;
 }
 public void DoGesture(IGesture gesture)
 {
     // Irrelevant to actual devices
 }
Ejemplo n.º 50
0
 /// <summary>
 /// Creates a <see cref="Thread"/> for the 
 /// <see cref="IGesture.Start"/> method and starts it.
 /// </summary>
 /// <param name="gesture">
 /// The <see cref="IGesture"/> to execute
 /// </param>
 /// <returns>
 /// The started <see cref="Thread"/> instance
 /// </returns>
 public static Thread Start(IGesture gesture)
 {
     ThreadStart start = new ThreadStart(gesture.Start);
     Thread thread = new Thread(start);
     thread.Start();
     return thread;
 }
Ejemplo n.º 51
0
        /// <summary>
        /// Creates a new <see cref="RepeatGesture"/> with
        /// the gesture and the repeat count
        /// </summary>
        /// <param name="gesture">
        /// Target <see cref="IGesture"/> instance
        /// </param>
        /// <param name="repeatCount">
        /// Number of repetition
        /// </param>
        /// <returns>
        /// A <see cref="RepeatGesture"/> instance
        /// </returns>
        public RepeatGesture Repeat(IGesture gesture, int repeatCount)
        {
            if (gesture == null)
                throw new ArgumentNullException("gesture");
            return new RepeatGesture(this.Form, gesture, repeatCount);

        }
Ejemplo n.º 52
0
 public GestureEvent(IGesture gesture)
 {
     _gesture = gesture;
 }
Ejemplo n.º 53
0
 private void NextOption(IGesture gesture, GameTime time, IInputDevice device)
 {
     SelectedOption++;
 }
Ejemplo n.º 54
0
 private void OnNextCommand(IGesture gesture, GameTime gameTime, IInputDevice device)
 {
     if (_commandScrollPointer != null)
     {
         if (_commandScrollPointer.Next != null)
         {
             _commandScrollPointer = _commandScrollPointer.Next;
             WritePreviousCommand();
         }
         else
         {
             _textBox.Text = "";
             _commandScrollPointer = null;
         }
     }
 }
Ejemplo n.º 55
0
 private void Select(IGesture gesture, GameTime time, IInputDevice device)
 {
     OnSelected();
 }
Ejemplo n.º 56
0
 public void RemoveGesture(IGesture gesture)
 {
     //removedGestures.Add(gesture);
     gestures.Remove(gesture);
 }
        public void PerformGesture(IGesture gesture)
        {
            // TODO Works only for default portrait orientation, need to take orientation into account
            var array = gesture.GetScreenPoints().ToArray();

            foreach (var point in array.Take(array.Length - 1))
            {
                this.MoveCursorTo(point);
                this.LeftButtonDown();
                Thread.Sleep(gesture.PeriodBetweenPoints);
            }

            this.MoveCursorTo(array.Last());
            this.LeftButtonUp();
        }
Ejemplo n.º 58
0
Archivo: Menu.cs Proyecto: ylyking/Myre
 private void NextOption(IGesture gesture, GameTime time, IInputDevice device)
 {
     NextOption();
 }
Ejemplo n.º 59
0
 /// <summary>
 /// Processes a skeleton frame from the Kinect controller
 /// </summary>
 /// <param name="frame">The skeleton frame to process</param>
 public void ProcessSkeleton(SkeletonData skeleton)
 {
     if (activeGesture != null)
     {
         if (activeGesture.IsComplete(skeleton))
         {
             if (GestureCompleted != null)
             {
                 GestureCompleted.Invoke(this, new GestureEventArgs(activeGesture));
             }
             activeGesture.Deactivate();
             activeGesture = null;
         }
         else if (activeGesture.IsOut(skeleton))
         {
             if (GestureLeft != null)
             {
                 GestureLeft.Invoke(this, new GestureEventArgs(activeGesture));
             }
             activeGesture.Deactivate();
             activeGesture = null;
         }
     }
     if (activeGesture == null)
     {
         double maxScore = 0;
         IGesture maxGesture = null;
         foreach (IGesture gesture in gestures)
         {
             double score = gesture.GetTriggerScore(skeleton);
             if (score > Math.Max(maxScore, THRESHOLD))
             {
                 maxScore = score;
                 maxGesture = gesture;
             }
         }
         if (maxGesture != null)
         {
             activeGesture = maxGesture;
             if (GestureStarted != null)
             {
                 GestureStarted.Invoke(this, new GestureEventArgs(activeGesture));
             }
             activeGesture.Activate();
         }
     }
 }
Ejemplo n.º 60
0
Archivo: Menu.cs Proyecto: ylyking/Myre
 private void PreviousOption(IGesture gesture, GameTime time, IInputDevice device)
 {
     PreviousOption();
 }