示例#1
0
        // Create a new XInputState given this KeyState
        public XInputState ToXinputState()
        {
            XInputState state = new XInputState();

            // Set regular keys
            foreach (KeyValuePair <Key, ushort> entry in KEY_TO_MASK)
            {
                state.Gamepad.Buttons |= (ushort)((Buttons[(int)entry.Key] ? 1 : 0) * KEY_TO_MASK[entry.Key]);
            }

            // Set triggers
            state.Gamepad.LeftTrigger  = (byte)(Buttons[(int)Key.LEFT_TRIGGER] ? 255 : 0);
            state.Gamepad.RightTrigger = (byte)(Buttons[(int)Key.RIGHT_TRIGGER] ? 255 : 0);

            return(state);
        }
示例#2
0
        /**
         * Given an XInput, set state in vController
         */
        public int Input(KeyState keyState)
        {
            XInputState state = keyState.ToXinputState();

            return(ViGEmWrapper_Input(out state));
        }
示例#3
0
 private extern static int ViGEmWrapper_Input(out XInputState state);