public void Receive(Input.InputEvent ie) { bool state = ie.EventType == Input.InputEventType.Press; string button = ie.LogicalButton.ToString(); Buttons[button] = state; //For controller input, we want Shift+X to register as both Shift and X (for Keyboard controllers) string[] subgroups = button.Split('+'); if (subgroups.Length > 0) { foreach (string s in subgroups) { Buttons[s] = state; } } //when a button is released, all modified variants of it are released as well if (!state) { var releases = Buttons.Where((kvp) => kvp.Key.Contains("+") && kvp.Key.EndsWith(ie.LogicalButton.Button)).ToArray(); foreach (var kvp in releases) Buttons[kvp.Key] = false; } }
public void Receive(Input.InputEvent ie) { bool state = ie.EventType == Input.InputEventType.Press; string button = ie.LogicalButton.ToString(); Buttons[button] = state; //when a button is released, all modified variants of it are released as well if (!state) { var releases = Buttons.Where(kvp => kvp.Key.Contains("+") && kvp.Key.EndsWith(ie.LogicalButton.Button)).ToArray(); foreach (var kvp in releases) Buttons[kvp.Key] = false; } }
public static void Initialize(IntPtr parent) { #if WINDOWS KeyInput.Initialize(parent); GamePad.Initialize(parent); BizHawk.Client.EmuHawk.GamePad360.Initialize(); #endif Instance = new Input(); }