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


C# MotionEvent.GetAxisValue方法代码示例

本文整理汇总了C#中Android.Views.MotionEvent.GetAxisValue方法的典型用法代码示例。如果您正苦于以下问题:C# MotionEvent.GetAxisValue方法的具体用法?C# MotionEvent.GetAxisValue怎么用?C# MotionEvent.GetAxisValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Views.MotionEvent的用法示例。


在下文中一共展示了MotionEvent.GetAxisValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnGenericMotionEvent

		public override bool OnGenericMotionEvent (MotionEvent e)
		{
			AmazonFireGameController.SetDPad(e.GetAxisValue(Axis.HatX));
			AmazonFireGameController.SetLeftAnalogStick (e.GetAxisValue (Axis.X));

			return true;
		}
开发者ID:geekish-interlude,项目名称:mobile-samples,代码行数:7,代码来源:MainActivity.cs

示例2: OnGenericMotionEvent

		public override bool OnGenericMotionEvent (MotionEvent e)
		{
			if (e.Source != InputSourceType.Touchscreen)
			{
				AmazonFireGameController.SetDPad (e.GetAxisValue (Axis.HatX));
				AmazonFireGameController.SetLeftAnalogStick (e.GetAxisValue (Axis.X));

				return true;
			}
			else
			{
				return false;
			}
		}
开发者ID:CodeSensei,项目名称:mobile-samples,代码行数:14,代码来源:MainActivity.cs

示例3: DebugMotionEvent

 public static void DebugMotionEvent(MotionEvent motionEvent)
 {
     foreach (Axis axis in Enum.GetValues(typeof (Axis)))
     {
         Log.Info(TAG, string.Format("({0}) {1} = {2}", (int)axis, axis, motionEvent.GetAxisValue(axis)));
     }
 }
开发者ID:JhonH3avy,项目名称:ouya-sdk-examples,代码行数:7,代码来源:DebugInput.cs

示例4: DebugOuyaMotionEvent

 public static void DebugOuyaMotionEvent(MotionEvent motionEvent)
 {
     Log.Info(TAG, "OuyaController.AXIS_LS_X value=" + motionEvent.GetAxisValue((Axis)OuyaController.AXIS_LS_X));
     Log.Info(TAG, "OuyaController.AXIS_LS_Y value=" + motionEvent.GetAxisValue((Axis)OuyaController.AXIS_LS_Y));
     Log.Info(TAG, "OuyaController.AXIS_RS_X value=" + motionEvent.GetAxisValue((Axis)OuyaController.AXIS_RS_X));
     Log.Info(TAG, "OuyaController.AXIS_RS_Y value=" + motionEvent.GetAxisValue((Axis)OuyaController.AXIS_RS_Y));
     Log.Info(TAG, "OuyaController.AXIS_L2 value=" + motionEvent.GetAxisValue((Axis)OuyaController.AXIS_L2));
     Log.Info(TAG, "OuyaController.AXIS_R2 value=" + motionEvent.GetAxisValue((Axis)OuyaController.AXIS_R2));
 }
开发者ID:JhonH3avy,项目名称:ouya-sdk-examples,代码行数:9,代码来源:DebugInput.cs

示例5: OnGenericMotionEvent

        internal static bool OnGenericMotionEvent(MotionEvent e)
        {
            var gamePad = GetGamePad(e.Device);
            if (gamePad == null)
                return false;

            if (e.Action != MotionEventActions.Move)
                return false;

            gamePad._leftStick = new Vector2(e.GetAxisValue(Axis.X), -e.GetAxisValue(Axis.Y));
            gamePad._rightStick = new Vector2(e.GetAxisValue(Axis.Z), -e.GetAxisValue(Axis.Rz));
            gamePad._leftTrigger = e.GetAxisValue(Axis.Ltrigger);
            gamePad._rightTrigger = e.GetAxisValue(Axis.Rtrigger);

            return true;
        }
开发者ID:KennethYap,项目名称:MonoGame,代码行数:16,代码来源:GamePad.Ouya.cs

示例6: GetCenteredAxis

		//Get the centered position for the joystick axis
		private float GetCenteredAxis(MotionEvent e, InputDevice device, Axis axis)
		{
			InputDevice.MotionRange range = device.GetMotionRange (axis, e.Source);
			if (range != null) {
				float flat = range.Flat;
				float value = e.GetAxisValue (axis);
				if (System.Math.Abs (value) > flat) 
					return value;
			}

			return 0;

		}
开发者ID:assanee,项目名称:monodroid-samples,代码行数:14,代码来源:FullScreenActivity.cs

示例7: OnTouchOrHoverEvent

			bool OnTouchOrHoverEvent (MotionEvent e, bool isTouch)
			{
				MotionEventButtonState buttonState = e.ButtonState;
				MotionEventButtonState pressedButtons = buttonState & ~mOldButtonState;
				mOldButtonState = buttonState;

				if ((pressedButtons & MotionEventButtonState.Secondary) != 0) {
					// Advance color when the right mouse button or first stylus button
					// is pressed.
					AdvanceColor ();
				}

				PaintMode mode;
				if ((buttonState & MotionEventButtonState.Tertiary) != 0) {
					// Splat paint when the middle mouse button or second stylus button is pressed.
					mode = PaintMode.Splat;
				} else if (isTouch || (buttonState & MotionEventButtonState.Primary) != 0) {
					// Draw paint when touching or if the primary button is pressed.
					mode = PaintMode.Draw;
				} else {
					// Otherwise, do not paint anything.
					return false;
				}

				MotionEventActions action = e.ActionMasked;
				if (action ==  MotionEventActions.Down || action == MotionEventActions.Move
					|| action == MotionEventActions.HoverMove) {
					int N = e.HistorySize;
					int P = e.PointerCount;
					for (int i = 0; i < N; i++) {
						for (int j = 0; j < P; j++) {
							Paint (GetPaintModeForTool (e.GetToolType (j), mode),
								e.GetHistoricalX (j, i),
								e.GetHistoricalY(j, i),
								e.GetHistoricalPressure (j, i),
								e.GetHistoricalTouchMajor (j, i),
								e.GetHistoricalTouchMinor (j, i),
								e.GetHistoricalOrientation (j, i),
								e.GetHistoricalAxisValue (Axis.Distance, j, i),
								e.GetHistoricalAxisValue (Axis.Tilt, j, i));
						}
					}
					for (int j = 0; j < P; j++) {
						Paint (GetPaintModeForTool (e.GetToolType (j), mode),
							e.GetX (j),
							e.GetY (j),
							e.GetPressure (j),
							e.GetTouchMajor (j),
							e.GetTouchMinor (j),
							e.GetOrientation (j),
							e.GetAxisValue (Axis.Distance, j),
							e.GetAxisValue (Axis.Tilt, j));
					}
					mCurX = e.GetX ();
					mCurY = e.GetY ();
				}
				return true;
			}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:58,代码来源:TouchPaint.cs


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