Beispiel #1
0
        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;
                }
            }
        }
Beispiel #2
0
        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;
                }
            }
        }