Beispiel #1
0
    /*public void EnableTapGestures() {
     *      leap_controller_.EnableGesture(Gesture.GestureType.TYPESCREENTAP);
     *      leap_controller_.EnableGesture(Gesture.GestureType.TYPEKEYTAP);
     *
     *      leap_controller_.Config.SetFloat("Gesture.ScreenTap.MinForwardVelocity", 30.0f);
     *      leap_controller_.Config.SetFloat("Gesture.ScreenTap.HistorySeconds", .5f);
     *      leap_controller_.Config.SetFloat("Gesture.ScreenTap.MinDistance", 1.0f);
     *
     *      leap_controller_.Config.SetFloat("Gesture.KeyTap.MinDownVelocity", 40.0f);
     *      leap_controller_.Config.SetFloat("Gesture.KeyTap.HistorySeconds", .2f);
     *      leap_controller_.Config.SetFloat("Gesture.KeyTap.MinDistance", 1.0f);
     *      leap_controller_.Config.Save();
     * }*/

    public void EnableCustomGestures(Gesture.GestureType gestureType, bool enable)
    {
        if (!enable)
        {
            leap_controller_.EnableGesture(Gesture.GestureType.TYPESCREENTAP, enable);
            return;
        }

        switch (gestureType)
        {
        case Gesture.GestureType.TYPESCREENTAP:
            leap_controller_.EnableGesture(Gesture.GestureType.TYPESCREENTAP);
            leap_controller_.Config.SetFloat("Gesture.ScreenTap.MinForwardVelocity", 30.0f);
            leap_controller_.Config.SetFloat("Gesture.ScreenTap.HistorySeconds", .5f);
            leap_controller_.Config.SetFloat("Gesture.ScreenTap.MinDistance", 1.0f);
            break;

        case Gesture.GestureType.TYPEKEYTAP:
            leap_controller_.EnableGesture(Gesture.GestureType.TYPEKEYTAP);
            leap_controller_.Config.SetFloat("Gesture.KeyTap.MinDownVelocity", 40.0f);
            leap_controller_.Config.SetFloat("Gesture.KeyTap.HistorySeconds", .2f);
            leap_controller_.Config.SetFloat("Gesture.KeyTap.MinDistance", 1.0f);
            break;

        case Gesture.GestureType.TYPESWIPE:
            leap_controller_.EnableGesture(Gesture.GestureType.TYPESWIPE);
            leap_controller_.Config.SetFloat("Gesture.Swipe.MinLength", 200.0f);
            leap_controller_.Config.SetFloat("Gesture.Swipe.MinVelocity", 1000f);
            break;

        default:
            break;
        }
        leap_controller_.Config.Save();
    }
Beispiel #2
0
 //generic enable
 void HandleEnableGesture(IDiffSpread <bool> pin, Gesture.GestureType gestureType)
 {
     if (pin.IsChanged)
     {
         FLeapController.EnableGesture(gestureType, pin[0]);
     }
 }
Beispiel #3
0
    private IEnumerator DelayNextGesture(Gesture.GestureType type, float delay)
    {
        LeapInputEx.Controller.EnableGesture(type, false);
        yield return(new WaitForSeconds(delay));

        LeapInputEx.Controller.EnableGesture(type);
    }
Beispiel #4
0
    void Start()
    {
        correctGestureType = Gesture.GestureType.TYPESWIPE;
        handIcon = this.transform.Find("HandIcon").GetComponent<SpriteRenderer>();
        actionIcon = this.transform.Find("ActionIcon").GetComponent<SpriteRenderer>();

        RandomizeHand();
        RandomizeAction();
    }
Beispiel #5
0
        public void GestureType()
        {
            tlog.Debug(tag, $"GestureType START");
            try
            {
                var longPressGesture = new LongPressGesture(Gesture.StateType.Cancelled);
                Assert.IsNotNull(longPressGesture, "Can't create success object LongPressGesture");
                var gesture = new Gesture(longPressGesture);
                Assert.IsNotNull(gesture, "Can't create success object Gesture");
                Assert.IsInstanceOf <Gesture>(gesture, "Should be an instance of Gesture type.");
                Gesture.GestureType type = gesture.Type;
                Assert.AreEqual(Gesture.GestureType.LongPress, type, "Should be same value");

                gesture.Dispose();
                longPressGesture.Dispose();
            }
            catch (Exception e)
            {
                Tizen.Log.Error(tag, "Caught Exception" + e.ToString());
                Assert.Fail("Caught Exception" + e.ToString());
            }
            tlog.Debug(tag, $"GestureType END (OK)");
            Assert.Pass("GestureType");
        }
Beispiel #6
0
 /// <summary>
 /// Allows deriving classes to disable any of the gesture detectors.<br />
 /// Like EnableGestureDetection, this can also be called using bitwise or one at a time.<br />
 /// </summary>
 /// <param name="type">The gesture type(s) to disable.</param>
 internal void DisableGestureDetection(Gesture.GestureType type)
 {
     viewWrapperImpl.DisableGestureDetection(type);
 }
Beispiel #7
0
 /// <summary>
 /// Allows deriving classes to enable any of the gesture detectors that are available.<br />
 /// Gesture detection can be enabled one at a time or in a bitwise format.<br />
 /// </summary>
 /// <param name="type">The gesture type(s) to enable.</param>
 /// <since_tizen> 3 </since_tizen>
 public void EnableGestureDetection(Gesture.GestureType type)
 {
     viewWrapperImpl.EnableGestureDetection(type);
 }
Beispiel #8
0
 public void EnableGestureDetection(Gesture.GestureType type)
 {
     customView.EnableGestureDetection(type);
 }
Beispiel #9
0
        /// <summary>
        /// Called many (many) times a second. This system handles all gesture actions and responses
        /// </summary>
        /// <param name="controller"></param>
        public override void OnFrame(Controller controller)
        {
            var frame    = controller.Frame();
            var gestures = frame.Gestures();

            // Grab the current count of objects that the device
            // can see and store that data for later use
            _visibleFingers = frame.Fingers.Count();
            _visibleTools   = frame.Tools.Count();
            _visibleHands   = frame.Hands.Count();

            #if DEBUG
            SendDebugMessage("Fingers: " + _visibleFingers);
            SendDebugMessage("Tools: " + _visibleTools);
            SendDebugMessage("Hands: " + _visibleHands);
            #endif

            // If we're not currently tracking any gestures in this frame, do a cleanup check and don't continue on
            if (!gestures.Any() || (_lastGestureEvent != DateTime.MinValue && DateTime.Now < _lastGestureEvent.AddMilliseconds(TimeBeforeNextAction)))
            {
                if ((DateTime.Now - _lastGestureEvent).TotalSeconds > 2 && _currentlyTracking)
                {
                    _currentlyTracking     = false;
                    _currentlyTrackingType = Gesture.GestureType.TYPEINVALID;

                    #if DEBUG
                    SendDebugMessage("Idle Device - Resetting gestures");
                    #endif
                }

                return;
            }

            // If there's no gesture in progress, make sure our active counts are set to zero
            if (!_currentlyTracking)
            {
                _currentActionFingers = 0;
                _currentActionTools   = 0;
            }
            else
            {
                // Else set all our active counts to the highest amount of objects there are for each type
                if (_currentActionFingers < _visibleFingers)
                {
                    _currentActionFingers = _visibleFingers;
                }

                if (_currentActionTools < _visibleTools)
                {
                    _currentActionTools = _visibleTools;
                }

                if (_currentActionHands < _visibleHands)
                {
                    _currentActionHands = _visibleHands;
                }
            }

            // There may be many, but we only care about the first.
            var thisGesture = gestures.First();

            switch (thisGesture.Type)
            {
            case Gesture.GestureType.TYPESWIPE:
                var swipe = new SwipeGesture(thisGesture);
                ProcessSwipe(swipe);     // Swipe.cs
                break;

            case Gesture.GestureType.TYPESCREENTAP:
                var screenTap = new ScreenTapGesture(thisGesture);
                ProcessScreenTap(screenTap);     // Tap.cs
                break;

            case Gesture.GestureType.TYPEKEYTAP:
                var keyTap = new KeyTapGesture(thisGesture);
                ProcessKeyTap(keyTap);     // Tap.cs
                break;

            case Gesture.GestureType.TYPECIRCLE:
                var circle = new CircleGesture(thisGesture);
                ProcessCircle(circle);     // Circle.cs
                break;
            }
        }
 public GestureRecognizedEventArgs(string nom, Gesture.GestureType type = Gesture.GestureType.Unknown)
 {
     nomGeste  = nom;
     typeGeste = type;
 }