Beispiel #1
0
        public void OnEmulatorButtonEvent(Microsoft.Xna.Framework.Input.Touch.TouchLocation touch, float touchX, float touchY)
        {
            if (!visible)
            {
                return;
            }
            switch (touch.State)
            {
            case Microsoft.Xna.Framework.Input.Touch.TouchLocationState.Pressed:
                offsetTouchX = touchX;
                offsetTouchY = touchY;
                Hit(touch.Id, touchX, touchY, false);
                break;

            case Microsoft.Xna.Framework.Input.Touch.TouchLocationState.Released:
                Unhit(touch.Id, touchX, touchY);
                break;

            case Microsoft.Xna.Framework.Input.Touch.TouchLocationState.Moved:
                offsetMoveX = touchX;
                offsetMoveY = touchY;
                if (MathUtils.Abs(offsetTouchX - offsetMoveX) > 5 ||
                    MathUtils.Abs(offsetTouchY - offsetMoveY) > 5)
                {
                    Hit(touch.Id, touchX, touchY, true);
                }
                break;

            case Microsoft.Xna.Framework.Input.Touch.TouchLocationState.Invalid:
                Unhit(touch.Id, touchX, touchY);
                break;
            }
        }
Beispiel #2
0
        /// <summary>
        /// 当触发模拟按钮时,自动分配事件
        /// </summary>
        /// <param name="touch"></param>
        /// <param name="touchX"></param>
        /// <param name="touchY"></param>
        public void OnEmulatorButtonEvent(Microsoft.Xna.Framework.Input.Touch.TouchLocation touch, float touchX, float touchY)
        {
            if (!visible)
            {
                return;
            }
            switch (touch.State)
            {
            case Microsoft.Xna.Framework.Input.Touch.TouchLocationState.Pressed:
                Hit(touch.Id, touchX, touchY);
                break;

            case Microsoft.Xna.Framework.Input.Touch.TouchLocationState.Released:
                Unhit(touch.Id);
                break;

            case Microsoft.Xna.Framework.Input.Touch.TouchLocationState.Moved:
                Hit(touch.Id, touchX, touchY);
                break;

            case Microsoft.Xna.Framework.Input.Touch.TouchLocationState.Invalid:
                Unhit(touch.Id);
                break;
            }
        }
Beispiel #3
0
        public override void OnTouchDown(Microsoft.Xna.Framework.Input.Touch.TouchLocation state)
        {
            this.Focus();
            base.OnTouchDown(state);

            SetCursorIndexByPosition(state.Position);
        }
Beispiel #4
0
 public override void OnTouchMove(Microsoft.Xna.Framework.Input.Touch.TouchLocation state)
 {
     base.OnTouchMove(state);
     if (IsFocused && state.State == Microsoft.Xna.Framework.Input.Touch.TouchLocationState.Moved)
     {
         SetCursorIndexByPosition(state.Position);
     }
 }
Beispiel #5
0
 public override void OnTouchMove(Microsoft.Xna.Framework.Input.Touch.TouchLocation state)
 {
     base.OnTouchMove(state);
     if (moving)
     {
         var x = state.Position.X - startPosX;
         this.Value = (x / factor) + startValue;
     }
 }
Beispiel #6
0
 public override void OnTouchDown(Microsoft.Xna.Framework.Input.Touch.TouchLocation state)
 {
     base.OnTouchDown(state);
     if (cmdTrack.IsTouchDown)
     {
         startPosX  = state.Position.X;
         startValue = this.Value;
         moving     = true;
     }
 }
 void p_OnPickedGesture(SegmentInterceptInfo SegmentInterceptInfo, Microsoft.Xna.Framework.Input.Touch.TouchLocation TouchLocation)
 {
     destiny = VectorUtils.ToVector2(SegmentInterceptInfo.ImpactPosition);
     for (int i = 0; i < Simulator.getNumAgents(); i++)
     {
         Vector2 rvopos   = Simulator.getAgentPosition(i);
         Vector2 agentpos = new Vector2(rvopos.X, rvopos.Y);
         Vector2 vv       = Vector2.Normalize(destiny - agentpos);
         Vector2 v        = new Vector2(vv.X, vv.Y);
         Simulator.setAgentPrefVelocity(i, v);
     }
 }
Beispiel #8
0
        private void ProcessTouch()
        {
            var touches = Input.touch.currentTouches;

            foreach (var touch in touches)
            {
                var previousLocation = new Microsoft.Xna.Framework.Input.Touch.TouchLocation();
                if (!touch.TryGetPreviousLocation(out previousLocation))
                {
                    position = touch.scaledPosition();
                    Android.Util.Log.Info("Player", "ID: " + touch.Id.ToString() + "Position: " + position.X.ToString() + " , " + position.Y.ToString());
                    ProcessCollision();
                }
            }
        }
Beispiel #9
0
 void pick_OnPickedGesture(SegmentInterceptInfo SegmentInterceptInfo, Microsoft.Xna.Framework.Input.Touch.TouchLocation TouchLocation)
 {
     result = "Position " + SegmentInterceptInfo.ImpactPosition + " - " + SegmentInterceptInfo.PhysicObject.ObjectOwner.Name;
 }
Beispiel #10
0
 //--------------------------------------------------------------------------------------
 /// <summary>
 /// VarmintWidgetTextInput_OnTouchDown
 /// </summary>
 //--------------------------------------------------------------------------------------
 private EventHandledState VarmintWidgetTextInput_OnTouchDown(VarmintWidget arg1, Microsoft.Xna.Framework.Input.Touch.TouchLocation arg2)
 {
     return(EventHandledState.Handled);
 }
Beispiel #11
0
 public override void OnTouchUp(Microsoft.Xna.Framework.Input.Touch.TouchLocation state)
 {
     base.OnTouchUp(state);
     moving = false;
 }
 public bool Equals(Microsoft.Xna.Framework.Input.Touch.TouchLocation touchLocation)
 {
     throw new NotImplementedException();
 }