Ejemplo n.º 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;
                }
            }
        }
Ejemplo n.º 2
0
 protected override void OnEnter(EventArgs e)
 {
     Input.Instance.ClearEvents();
     _lastPress = null;
     _timer.Start();
     BackColor = Color.FromArgb(unchecked ((int)0xFFC0FFFF));            // Color.LightCyan is too light on Windows 8, this is a bit darker
 }
Ejemplo n.º 3
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;
                }
            }
        }