当前位置: 首页>>代码示例>>C#>>正文


C# Touch.GestureSample类代码示例

本文整理汇总了C#中Microsoft.Xna.Framework.Input.Touch.GestureSample的典型用法代码示例。如果您正苦于以下问题:C# GestureSample类的具体用法?C# GestureSample怎么用?C# GestureSample使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GestureSample类属于Microsoft.Xna.Framework.Input.Touch命名空间,在下文中一共展示了GestureSample类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessTouch

        public new bool ProcessTouch(GestureSample gesture)
        {
            Point localGesturePoint = Spotlight.TranslateScreenVectorToWorldPoint(gesture.Position);

            if (!CanRespond()) return false;

            if (RespondsToWorldTouch(localGesturePoint) || IsFirstResponder())
            {

                switch (gesture.GestureType)
                {
                    case GestureType.FreeDrag:
                        SetCenter(localGesturePoint);
                        BecomeFirstResponder();
                        break;
                    case GestureType.DragComplete:
                        ResignFirstResponder();
                        break;
                    default:
                        return false;
                }
                return true;
            }

            return false;
        }
开发者ID:virusmarathe,项目名称:Portfolio,代码行数:26,代码来源:CommandTarget.cs

示例2: InteractGesture

 public bool InteractGesture(GestureSample gesture)
 {
     bool ret = false;
     ret |= m_centerButton.InteractGesture(gesture);
     ret |= m_contextMenu.InteractGesture(gesture);
     return ret;
 }
开发者ID:steveyaz,项目名称:Warlock,代码行数:7,代码来源:HUD.cs

示例3: ProcessTouch

        /// <summary>
        /// Process a touch gesture and return an indicator of whether or not the user has advanced past this cutscene.
        /// This is abberant behavior from our usual application paradigm because a cutscene it treated as a special case. 
        /// </summary>
        /// <param name="gesture"></param>
        /// <returns>true if the user has touched the Continue button. False otherwise. </returns>
        public override bool ProcessTouch(GestureSample gesture)
        {
            if (continueButton.ProcessTouch(gesture))
            {
                return true;
            }

            switch (gesture.GestureType)
            {
                case GestureType.FreeDrag:
                    offset -= gesture.Delta;
                    motionTarget = Vector2.Zero;
                    EnforceBoundaries();
                    return false;
                case GestureType.Flick:
                    Vector2 normal = gesture.Delta;
                    normal.Normalize();
                    motionTarget = offset - (normal * 200);
                    return false;
                case GestureType.Tap:
                    motionTarget = Vector2.Zero;
                    return false;
                default:
                    return false;

            }
        }
开发者ID:virusmarathe,项目名称:Portfolio,代码行数:33,代码来源:Cutscene.cs

示例4: RespondToTouch

        public void RespondToTouch(GestureSample gesture)
        {
            //if (gesture.GestureType == GestureType.Flick)
            //{
            //    var move = new Vector2(MathHelper.Clamp(gesture.Delta.X, -flickLimit, flickLimit), MathHelper.Clamp(gesture.Delta.Y, -flickLimit, flickLimit));
            //    Body.ApplyLinearImpulse(ConvertUnits.ToSimUnits(move * 50));
            //}

            if (gesture.GestureType == GestureType.Tap)
            {
                if (currentJumpCount >= consecutiveJumps)
                {
                    //return;
                }

                lastJumpTime = DateTime.Now;
                currentJumpCount++;

                if (!isOnGround)
                {
                    //Body.ResetDynamics();
                }
                sphere.Body.ApplyForce(new Vector2(0, -jumpForce));
                //isOnGround = false;
            }
        }
开发者ID:dreasgrech,项目名称:FPE3Sandbox,代码行数:26,代码来源:Sphere.cs

示例5: Update

        public static void Update()
        {
            m_Gesture = TouchPanel.IsGestureAvailable ? TouchPanel.ReadGesture() : new GestureSample();

            if (CurrentTouchCollection.Count > 0)
            {
                OldTouchCollection = CurrentTouchCollection;
            }

            CurrentTouchCollection = TouchPanel.GetState();

                    if (CurrentTouchCollection.Count > 0)
                    {
                        while (TouchPanel.IsGestureAvailable)
                        {
                            TouchPanel.ReadGesture();
                        }
                    }

            #if !Windows
            m_LastKeyboardState = m_CurrentKeyboardState;
            m_CurrentKeyboardState = Keyboard.GetState();

            m_LastMouseState = m_CurrentMouseState;
            m_CurrentMouseState = Mouse.GetState();
            #endif
        }
开发者ID:JonathanMcCaffrey,项目名称:tank-gauntlet,代码行数:27,代码来源:Input.cs

示例6: InteractGesture

        public bool InteractGesture(GestureSample gesture)
        {
            foreach (TextScreenObject contextMenuItem in m_contextMenuItems)
                if (contextMenuItem.InteractGesture(gesture))
                    return true;

            return false;
        }
开发者ID:steveyaz,项目名称:Warlock,代码行数:8,代码来源:ContextMenu.cs

示例7: GestureDefinition

 public GestureDefinition(GestureType theGestureType, Rectangle theGestureArea)
 {
     Gesture = new GestureSample(theGestureType, new TimeSpan(0),
                                 Vector2.Zero, Vector2.Zero,
                                 Vector2.Zero, Vector2.Zero);
     Type = theGestureType;
     CollisionArea = theGestureArea;
 }
开发者ID:Vintharas,项目名称:War-of-the-Orbs,代码行数:8,代码来源:GestureDefinition.cs

示例8: ProcessTouch

        public new bool ProcessTouch(GestureSample gesture)
        {
            if (gesture.GestureType != GestureType.FreeDrag) return false;
            if (hidden || !Contains(gesture.Position)) return false;

            SetCenter(gesture.Position);

            return true;
        }
开发者ID:virusmarathe,项目名称:Portfolio,代码行数:9,代码来源:CommandTarget.cs

示例9: InteractGesture

 public void InteractGesture(GestureSample gesture)
 {
     if (gesture.GestureType == GestureType.Tap
         && gesture.Position.X < m_textPosition.X + WarlockGame.m_spriteFont.MeasureString(m_buttonText).X && gesture.Position.X > m_textPosition.X
         && gesture.Position.Y < m_textPosition.Y + WarlockGame.m_spriteFont.MeasureString(m_buttonText).Y && gesture.Position.Y > m_textPosition.Y)
     {
         Execute();
     }
 }
开发者ID:steveyaz,项目名称:Warlock,代码行数:9,代码来源:CitySplashButton.cs

示例10: ProcessTouch

        public override bool ProcessTouch(GestureSample gesture)
        {
            if (hidden) return false;
            if (!base.ProcessTouch(gesture)) return false; //Easy out

            if (gesture.GestureType != GestureType.Tap) return false;

            SetSelected(true);
            return true;
        }
开发者ID:virusmarathe,项目名称:Portfolio,代码行数:10,代码来源:Button.cs

示例11: OnSingleTapConfirmed

 /// <summary>
 /// Process the Single Tag into a Gesture
 /// </summary>
 /// <param name='e'>
 /// If set to <c>true</c> e.
 /// </param>
 public override bool OnSingleTapConfirmed(MotionEvent e)
 {
     if ((TouchPanel.EnabledGestures & GestureType.Tap) != 0)
     {
         var gs = new GestureSample(GestureType.Tap, activity.Game.TargetElapsedTime,
             new Vector2(e.GetX(), e.GetY()), Vector2.Zero, Vector2.Zero, Vector2.Zero);
         TouchPanel.GestureList.Enqueue(gs);
     }
     return base.OnSingleTapConfirmed (e);
 }
开发者ID:ncoder,项目名称:MonoGame,代码行数:16,代码来源:GestureListener.cs

示例12: Create

        internal IMessage Create(GestureSample gestureSample)
        {
            switch (gestureSample.GestureType)
            {
                case GestureType.Tap:
                    return new Message<TapGesture>(new TapGesture(gestureSample));
            }

            return null;
        }
开发者ID:naighes,项目名称:AsteroidChallenge,代码行数:10,代码来源:GestureMessageFactory.cs

示例13: ComputeVelocity

        private Vector2 ComputeVelocity(GestureSample gesture)
        {
            Vector2 diff = _currentPosition - _startPosition;

            float magnitude = Math.Min(diff.Length(), 100) * 5;
            diff.Normalize();
            Vector2 result = diff * magnitude;

            return result;
        }
开发者ID:koboldul,项目名称:Cocos2DGame1,代码行数:10,代码来源:ShootManager.cs

示例14: InteractGesture

 public bool InteractGesture(GestureSample gesture)
 {
     if (gesture.GestureType == GestureType.Tap
         && gesture.Position.X < ExitButton.X + WarlockGame.TextureDictionary["leavecity"].Width && gesture.Position.X > ExitButton.X
         && gesture.Position.Y < ExitButton.Y + WarlockGame.TextureDictionary["leavecity"].Height && gesture.Position.Y > ExitButton.Y)
     {
         Execute();
         return true;
     }
     return false;
 }
开发者ID:steveyaz,项目名称:Warlock,代码行数:11,代码来源:ExitCityButton.cs

示例15: EndShooting

        public Vector2 EndShooting(GestureSample gesture)
        {
            Vector2 velocity = ComputeVelocity(gesture);

            _startShootingTime = default(TimeSpan);
            _startPosition = default(Vector2);

            State = GameState.Idle;

            return velocity;
        }
开发者ID:koboldul,项目名称:Cocos2DGame1,代码行数:11,代码来源:ShootManager.cs


注:本文中的Microsoft.Xna.Framework.Input.Touch.GestureSample类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。