• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Touch.GestureSample类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: Update

        public void Update(GestureSample gesture)
        {
            if (State == GameState.Idle)
            {
                _startShootingTime = gesture.Timestamp;
                _startPosition = new Vector2(gesture.Position.X, gesture.Position.Y);
                State = GameState.Shooting;
            }

            _currentPosition = new Vector2(gesture.Position.X, gesture.Position.Y);
        }
开发者ID:koboldul,项目名称:Cocos2DGame1,代码行数:11,代码来源:ShootManager.cs


示例17: ApplyPinchZoom

        /// <summary>
        /// A helper function which automatically calls GetScaleFactor and GetTranslationDelta and applies them to the
        /// given object position and scale. You can either use this function or call GetScaleFactor and GetTranslationDelta
        /// manually. This function assumes that the origin of your object is at its center, and that the position
        /// given is in screen-space.
        /// </summary>
        /// <param name="gesture">The gesture sample containing the pinch gesture data. The GestureType must be
        /// GestureType.Pinch.</param>
        /// <param name="objectPos">The current position of your object, in screen-space.</param>
        /// <param name="objectScale">The current scale of your object.</param>
        public static void ApplyPinchZoom(GestureSample gesture, ref Vector2 objectPos, ref float objectScale)
        {
            System.Diagnostics.Debug.Assert(gesture.GestureType == GestureType.Pinch);

            float scaleFactor = PinchZoom.GetScaleFactor(gesture.Position, gesture.Position2,
                gesture.Delta, gesture.Delta2);
            Vector2 translationDelta = PinchZoom.GetTranslationDelta(gesture.Position, gesture.Position2,
                gesture.Delta, gesture.Delta2, objectPos, scaleFactor);

            objectScale *= scaleFactor;
            objectPos += translationDelta;
        }
开发者ID:milesgray,项目名称:resatiate,代码行数:22,代码来源:PinchZoom.cs


示例18: InteractGesture

 public virtual bool InteractGesture(GestureSample gesture)
 {
     if (TapDelegate != null
         && gesture.GestureType == GestureType.Tap
         && gesture.Position.X < ScreenPosition.X + Size.X && gesture.Position.X > ScreenPosition.X
         && gesture.Position.Y < ScreenPosition.Y + Size.Y && gesture.Position.Y > ScreenPosition.Y)
     {
         TapDelegate();
         return true;
     }
     return false;
 }
开发者ID:steveyaz,项目名称:Warlock,代码行数:12,代码来源:ScreenObjectBase.cs


示例19: OnDoubleTap

		/// <summary>
		/// convert the DoubleTapEvent to a Gesture
		/// </summary>
		/// <param name='e'>
		/// If set to <c>true</c> e.
		/// </param>
		public override bool OnDoubleTap (MotionEvent e)
		{
			if ((TouchPanel.EnabledGestures & GestureType.DoubleTap) != 0)
			{				
				Vector2 positon = new Vector2(e.GetX(), e.GetY());
				AndroidGameActivity.Game.Window.UpdateTouchPosition(ref positon);
				var gs = new GestureSample(GestureType.DoubleTap, AndroidGameActivity.Game.TargetElapsedTime, 
					positon, Vector2.Zero, Vector2.Zero, Vector2.Zero);
				TouchPanel.GestureList.Enqueue(gs);
			}
			return base.OnDoubleTap (e);
		}
开发者ID:ValXp,项目名称:MonoGame,代码行数:18,代码来源:GestureListener.cs


示例20: LoadContent

        /// <summary>
        /// Call this to initialize a Behaviour with data supplied in a file.
        /// </summary>
        /// <param name="fileName">The file to load from.</param>
        public override void LoadContent(String fileName)
        {
            base.LoadContent(fileName);

            mGesture = new GestureSample();

            mFxMenuSelect = GameObjectManager.pInstance.pContentManager.Load<SoundEffect>("Audio\\FX\\MenuSelect");

            mGameRestartMsg = new Player.OnGameRestartMessage();
            mGetCurrentStateMsg = new Player.GetCurrentStateMessage();
            mGetCurrentHitCountMsg = new HitCountDisplay.GetCurrentHitCountMessage();
        }
开发者ID:vigomes03,项目名称:mbhswipetapsmash,代码行数:16,代码来源:GameOver.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Touch.TouchLocation类代码示例发布时间:2022-05-26
下一篇:
C# Input.MouseState类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap