예제 #1
0
        bool IsAxisBind(IntPtr gamecontroller, GameControllerAxis axis)
        {
            GameControllerButtonBind bind =
                SDL.GameControllerGetBindForAxis(gamecontroller, axis);

            return(bind.BindType == GameControllerBindType.Axis);
        }
예제 #2
0
        GamePadAxes TranslateAxis(GameControllerAxis axis)
        {
            switch (axis)
            {
            case GameControllerAxis.LeftX:
                return(GamePadAxes.LeftX);

            case GameControllerAxis.LeftY:
                return(GamePadAxes.LeftY);

            case GameControllerAxis.RightX:
                return(GamePadAxes.RightX);

            case GameControllerAxis.RightY:
                return(GamePadAxes.RightY);

            case GameControllerAxis.TriggerLeft:
                return(GamePadAxes.LeftTrigger);

            case GameControllerAxis.TriggerRight:
                return(GamePadAxes.RightTrigger);

            default:
                throw new ArgumentOutOfRangeException(
                          String.Format("[SDL] Unknown axis {0}", axis));
            }
        }
예제 #3
0
 public static string GameControllerGetStringForAxis(
     GameControllerAxis axis
     )
 {
     return(UTF8_ToManaged(
                INTERNAL_GameControllerGetStringForAxis(
                    axis
                    )
                ));
 }
예제 #4
0
        public GameControllerBind?GetBind(GameControllerAxis axis)
        {
            var ret = GameControllerBind.Create(SDL_GameControllerGetBindForAxis(j, axis));

            if (ret == null)
            {
                var err = GetError();
                if (err != null)
                {
                    throw err;
                }
            }
            return(ret);
        }
예제 #5
0
 public short this[GameControllerAxis index]
 {
     get
     {
         var v = SDL_GameControllerGetAxis(j, index);
         if (v == 0)
         {
             var err = GetError();
             if (err != null)
             {
                 throw err;
             }
         }
         return(v);
     }
 }
예제 #6
0
        public static GameControllerButtonBind GameControllerGetBindForAxis(
            IntPtr gamecontroller,
            GameControllerAxis axis
            )
        {
            // This is guaranteed to never be null
            INTERNAL_GameControllerButtonBind dumb = INTERNAL_GameControllerGetBindForAxis(
                gamecontroller,
                axis
                );
            GameControllerButtonBind result = new GameControllerButtonBind();

            result.BindType          = (GameControllerBindType)dumb.BindType;
            result.Value.Hat.Hat     = dumb.UnionVal0;
            result.Value.Hat.HatMask = dumb.UnionVal1;
            return(result);
        }
예제 #7
0
 private static extern INTERNAL_GameControllerButtonBind INTERNAL_GameControllerGetBindForAxis(
     IntPtr gamecontroller,
     GameControllerAxis axis
     );
예제 #8
0
 /// <summary>
 /// Maps an axis to a name.
 /// </summary>
 /// <param name="axis">The axis.</param>
 /// <returns>The name.</returns>
 public static string GetStringForAxis(GameControllerAxis axis) =>
 Native.SDL_GameControllerGetStringForAxis(axis);
예제 #9
0
 private static extern IntPtr INTERNAL_GameControllerGetStringForAxis(
     GameControllerAxis axis
     );
예제 #10
0
        GamePadAxes TranslateAxis(GameControllerAxis axis)
        {
            switch (axis)
            {
                case GameControllerAxis.LeftX:
                    return GamePadAxes.LeftX;
                
                case GameControllerAxis.LeftY:
                    return GamePadAxes.LeftY;

                case GameControllerAxis.RightX:
                    return GamePadAxes.RightX;

                case GameControllerAxis.RightY:
                    return GamePadAxes.RightY;

                case GameControllerAxis.TriggerLeft:
                    return GamePadAxes.LeftTrigger;

                case GameControllerAxis.TriggerRight:
                    return GamePadAxes.RightTrigger;

                default:
                    throw new ArgumentOutOfRangeException(
                        String.Format("[SDL] Unknown axis {0}", axis));
            }
        }
예제 #11
0
 bool IsAxisBind(IntPtr gamecontroller, GameControllerAxis axis)
 {
     GameControllerButtonBind bind =
         SDL.GameControllerGetBindForAxis(gamecontroller, axis);
     return bind.BindType == GameControllerBindType.Axis;
 }
예제 #12
0
 /// <summary>
 /// The axis value.
 /// </summary>
 /// <param name="axis">The axis.</param>
 /// <returns>The value.</returns>
 public short GetAxis(GameControllerAxis axis) =>
 Native.SDL_GameControllerGetAxis(Pointer, axis);
예제 #13
0
 public static extern short SDL_GameControllerGetAxis(GameController gamecontroller, GameControllerAxis axis);
예제 #14
0
 public static extern /*const char*/ byte *SDL_GameControllerGetStringForAxis(GameControllerAxis axis);
예제 #15
0
 public static unsafe string AxisName(GameControllerAxis b)
 => ErrorIfNull(UTF8ToString(SDL_GameControllerGetStringForAxis(b))) ?? "";
예제 #16
0
 public static string GameControllerGetStringForAxisString(GameControllerAxis axis)
 {
     return(GetString(GameControllerGetStringForAxis(axis)));
 }
예제 #17
0
 public static extern byte *GameControllerGetStringForAxis(GameControllerAxis axis);
예제 #18
0
 public static extern GameControllerButtonBind GameControllerGetBindForAxis(GameController gameController, GameControllerAxis axis);
예제 #19
0
 public static extern short GameControllerGetAxis(IntPtr gamecontroller, GameControllerAxis axis);
예제 #20
0
 public static extern short GameControllerGetAxis(
     IntPtr gamecontroller,
     GameControllerAxis axis
     );
예제 #21
0
 public static extern GameControllerButtonBind GameControllerGetBindForAxis(IntPtr gamecontroller, GameControllerAxis axis);
예제 #22
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="gameControllerAxis"></param>
 /// <returns></returns>
 public static SDL.SDL_GameControllerAxis ToSdl(this GameControllerAxis gameControllerAxis)
 {
     return((SDL.SDL_GameControllerAxis)gameControllerAxis);
 }
예제 #23
0
 /// <summary>
 /// Gets the binding for the axis.
 /// </summary>
 /// <param name="axis">The axis.</param>
 /// <returns>The binding.</returns>
 public GameControllerBinding?GetAxisBinding(GameControllerAxis axis) =>
 GameControllerBinding.FromNative(Native.SDL_GameControllerGetBindForAxis(Pointer, axis));