public static X.Gamepad.GamepadButtons GetInput() { while (isStopped) { System.Threading.Thread.Sleep(20); } if (Mode == Modes.AdvanceFrame) { isStopped = true; } if (Mode == Modes.AdvanceSlow) { System.Threading.Thread.Sleep(100); } // Advance switch (Controller.Mode) { case Controller.Modes.Recording: Controller.Add(input); break; case Controller.Modes.Replaying: if (Controller.MoveNext()) { input = Controller.Current; } else { Controller.Mode = Controller.Modes.None; ProcessInputs(); } break; } return(input); }
public static bool Convert(string str, out X.Gamepad.GamepadButtons action) { return(StringToActions.TryGetValue( str.ToUpper(new CultureInfo("en-US", false)), out action )); }
public GameState.GameKeys?TranslateKey(X.Gamepad.GamepadButtons Button) { if (ControllerKeyLookup.ContainsKey(Button)) { return(ControllerKeyLookup[Button]); } return(null); }
private bool IsPressed(X.Gamepad.GamepadButtons button) { if (!m_pressedButtons.ContainsKey(button)) { return(false); } var value = !m_pressedButtons[button] && (m_gamepad.Buttons & (short)(int)button) != 0; return(value); }
private static void ProcessInputs() { input = (X.Gamepad.GamepadButtons) 0 | (gamepad.A_down ? X.Gamepad.GamepadButtons.A : 0) | (gamepad.B_down ? X.Gamepad.GamepadButtons.B : 0) | (gamepad.X_down ? X.Gamepad.GamepadButtons.X : 0) | (gamepad.Y_down ? X.Gamepad.GamepadButtons.Y : 0) | (gamepad.Dpad_Down_down ? X.Gamepad.GamepadButtons.Dpad_Down : 0) | (gamepad.Dpad_Up_down ? X.Gamepad.GamepadButtons.Dpad_Up : 0) | (gamepad.Dpad_Left_down ? X.Gamepad.GamepadButtons.Dpad_Left : 0) | (gamepad.Dpad_Right_down ? X.Gamepad.GamepadButtons.Dpad_Right : 0) | (gamepad.Start_down ? X.Gamepad.GamepadButtons.Start : 0) | (gamepad.LBumper_down ? X.Gamepad.GamepadButtons.LBumper : 0) | (gamepad.RBumper_down ? X.Gamepad.GamepadButtons.RBumper : 0); }
public ControllerButtonEventArgs(X.Gamepad.GamepadButtons pButton) { button = pButton; }
private bool GetButtonState(X.Gamepad pad, X.Gamepad.GamepadButtons button) { return(((short)pad.Buttons & (short)button) == (short)button); }