bool IsButtonBind(IntPtr gamecontroller, GameControllerButton button) { GameControllerButtonBind bind = SDL.GameControllerGetBindForButton(gamecontroller, button); return(bind.BindType == GameControllerBindType.Button); }
public static string GameControllerGetStringForButton( GameControllerButton button ) { return(UTF8_ToManaged( INTERNAL_GameControllerGetStringForButton(button) )); }
Buttons TranslateButton(GameControllerButton button) { switch (button) { case GameControllerButton.A: return(Buttons.A); case GameControllerButton.B: return(Buttons.B); case GameControllerButton.X: return(Buttons.X); case GameControllerButton.Y: return(Buttons.Y); case GameControllerButton.LEFTSHOULDER: return(Buttons.LeftShoulder); case GameControllerButton.RIGHTSHOULDER: return(Buttons.RightShoulder); case GameControllerButton.LEFTSTICK: return(Buttons.LeftStick); case GameControllerButton.RIGHTSTICK: return(Buttons.RightStick); case GameControllerButton.DPAD_UP: return(Buttons.DPadUp); case GameControllerButton.DPAD_DOWN: return(Buttons.DPadDown); case GameControllerButton.DPAD_LEFT: return(Buttons.DPadLeft); case GameControllerButton.DPAD_RIGHT: return(Buttons.DPadRight); case GameControllerButton.BACK: return(Buttons.Back); case GameControllerButton.START: return(Buttons.Start); case GameControllerButton.GUIDE: return(Buttons.BigButton); default: Debug.Print("[SDL2] Unknown button {0}", button); return(0); } }
public static VirtualKeys GetVirtualKey(GameControllerButton button) { switch (button) { case GameControllerButton.A: return(VirtualKeys.C); case GameControllerButton.B: return(VirtualKeys.D); case GameControllerButton.X: return(VirtualKeys.X); case GameControllerButton.Y: return(VirtualKeys.S); case GameControllerButton.Back: return(VirtualKeys.N2); case GameControllerButton.Guide: return(VirtualKeys.Escape); case GameControllerButton.Start: return(VirtualKeys.N1); case GameControllerButton.LeftStick: return(VirtualKeys.A); case GameControllerButton.LeftShoulder: return(VirtualKeys.W); case GameControllerButton.RightStick: return(VirtualKeys.F); case GameControllerButton.RightShoulder: return(VirtualKeys.E); case GameControllerButton.DpadUp: return(VirtualKeys.Up); case GameControllerButton.DpadDown: return(VirtualKeys.Down); case GameControllerButton.DpadLeft: return(VirtualKeys.Left); case GameControllerButton.DpadRight: return(VirtualKeys.Right); default: return(VirtualKeys.Noname); } }
public GameControllerButtonState GetButtonState(GameControllerButton button) { switch (button) { case GameControllerButton.A: return(A); case GameControllerButton.B: return(B); case GameControllerButton.X: return(X); case GameControllerButton.Y: return(Y); case GameControllerButton.Back: return(Back); case GameControllerButton.Guide: return(Guide); case GameControllerButton.Start: return(Start); case GameControllerButton.LeftStick: return(LeftStick); case GameControllerButton.LeftShoulder: return(LeftShoulder); case GameControllerButton.RightStick: return(RightStick); case GameControllerButton.RightShoulder: return(RightShoulder); case GameControllerButton.DpadUp: return(DpadUp); case GameControllerButton.DpadDown: return(DpadDown); case GameControllerButton.DpadLeft: return(DpadLeft); case GameControllerButton.DpadRight: return(DpadRight); default: return(GameControllerButtonState.None); } }
public GameControllerBind?GetBind(GameControllerButton button) { var ret = GameControllerBind.Create(SDL_GameControllerGetBindForButton(j, button)); if (ret == null) { var err = GetError(); if (err != null) { throw err; } } return(ret); }
public bool this[GameControllerButton index] { get { bool b = SDL_GameControllerGetButton(j, index) == 1; if (!b) { var err = GetError(); if (err != null) { throw err; } } return(b); } }
public static GameControllerButtonBind GameControllerGetBindForButton( IntPtr gamecontroller, GameControllerButton button ) { // This is guaranteed to never be null INTERNAL_GameControllerButtonBind dumb = INTERNAL_GameControllerGetBindForButton( gamecontroller, button ); GameControllerButtonBind result = new GameControllerButtonBind(); result.BindType = (GameControllerBindType)dumb.BindType; result.Value.Hat.Hat = dumb.UnionVal0; result.Value.Hat.HatMask = dumb.UnionVal1; return(result); }
public static extern byte *GameControllerGetStringForButton(GameControllerButton button);
public static extern bool GameControllerGetButton(IntPtr gamecontroller, GameControllerButton button);
public static extern SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(GameController gamecontroller, GameControllerButton button);
public static extern byte SDL_GameControllerGetButton(GameController gamecontroller, GameControllerButton button);
/// <summary> /// Maps an button to a name. /// </summary> /// <param name="button">The button.</param> /// <returns>The name.</returns> public static string GetStringForButton(GameControllerButton button) => Native.SDL_GameControllerGetStringForButton(button);
/// <summary> /// Gets the binding for the button. /// </summary> /// <param name="button">The button.</param> /// <returns>The binding.</returns> public GameControllerBinding?GetButtonBinding(GameControllerButton button) => GameControllerBinding.FromNative(Native.SDL_GameControllerGetBindForButton(Pointer, button));
bool IsButtonBind(IntPtr gamecontroller, GameControllerButton button) { GameControllerButtonBind bind = SDL.GameControllerGetBindForButton(gamecontroller, button); return bind.BindType == GameControllerBindType.Button; }
public static extern GameControllerButtonBind GameControllerGetBindForButton(GameController gameController, GameControllerButton buttons);
/// <summary> /// The button value. /// </summary> /// <param name="button">The button.</param> /// <returns>Whether the button is pressed.</returns> public bool GetButton(GameControllerButton button) => Native.SDL_GameControllerGetButton(Pointer, button);
Buttons TranslateButton(GameControllerButton button) { switch (button) { case GameControllerButton.A: return Buttons.A; case GameControllerButton.B: return Buttons.B; case GameControllerButton.X: return Buttons.X; case GameControllerButton.Y: return Buttons.Y; case GameControllerButton.LEFTSHOULDER: return Buttons.LeftShoulder; case GameControllerButton.RIGHTSHOULDER: return Buttons.RightShoulder; case GameControllerButton.LEFTSTICK: return Buttons.LeftStick; case GameControllerButton.RIGHTSTICK: return Buttons.RightStick; case GameControllerButton.DPAD_UP: return Buttons.DPadUp; case GameControllerButton.DPAD_DOWN: return Buttons.DPadDown; case GameControllerButton.DPAD_LEFT: return Buttons.DPadLeft; case GameControllerButton.DPAD_RIGHT: return Buttons.DPadRight; case GameControllerButton.BACK: return Buttons.Back; case GameControllerButton.START: return Buttons.Start; case GameControllerButton.GUIDE: return Buttons.BigButton; default: Debug.Print("[SDL2] Unknown button {0}", button); return 0; } }
public static string GameControllerGetStringForButtonString(GameControllerButton button) { return(GetString(GameControllerGetStringForButton(button))); }
private static extern IntPtr INTERNAL_GameControllerGetStringForButton( GameControllerButton button );
public static unsafe string ButtonName(GameControllerButton b) => ErrorIfNull(UTF8ToString(SDL_GameControllerGetStringForButton(b))) ?? "";
private static extern INTERNAL_GameControllerButtonBind INTERNAL_GameControllerGetBindForButton( IntPtr gamecontroller, GameControllerButton button );
public static SDL.SDL_GameControllerButton ToSdl(this GameControllerButton button) { return((SDL.SDL_GameControllerButton)button); }
public static extern byte GameControllerGetButton( IntPtr gamecontroller, GameControllerButton button );
// Start is called before the first frame update void Start() { instance = this; player = GameObject.FindGameObjectWithTag("Player").GetComponent <Player>(); }
public static extern GameControllerButtonBind GameControllerGetBindForButton( IntPtr gamecontroller, GameControllerButton button);
public static extern /*const char*/ byte *SDL_GameControllerGetStringForButton(GameControllerButton button);