Exemplo n.º 1
0
        private void SetDpad(IVirtualGamepad gamepad, Mapping mapping, bool isKeyDown)
        {
            int direction = (int)mapping.Function;
            int oldValue  = gamepad.GetDpadState();
            int newValue  = isKeyDown ? oldValue | direction : oldValue & ~direction;

            if (oldValue == newValue)
            {
                return;
            }

            gamepad.SetDpadState(newValue);
        }
Exemplo n.º 2
0
        private string SetDpad(IVirtualGamepad gamepad, Mapping mapping, bool isKeyDown)
        {
            int direction = (int)mapping.Function;
            int oldValue  = gamepad.GetDpadState();
            int newValue  = isKeyDown ? oldValue | direction : oldValue & ~direction;

            if (oldValue == newValue)
            {
                return(null);
            }

            gamepad.SetDpadState(newValue);
            return(((XinputButton)newValue).ToString());
        }