コード例 #1
0
        public GameInput(string description, UInt16 keyCode)
        {
            _input      = new VirtualInputController.NativeInput.INPUT();
            _inputArray = new NativeInput.INPUT[1];

            _input.type = 1; //hardcode keyboard inputs for now
            _input.Data.keyboard.ScanCode   = keyCode;
            _input.Data.keyboard.VirtualKey = 0;
            _input.Data.keyboard.Time       = 0;
            _input.Data.keyboard.ExtraInfo  = IntPtr.Zero;

            _description = description;
            //since the state of the key is essentially unknown on startup
            _isPressed = false;
            ReleaseKey();
        }
コード例 #2
0
 private void SendInput(NativeInput.INPUT input)
 {
     _inputArray[0] = input;
     NativeInput.SendInput(1, _inputArray, Marshal.SizeOf(input));
 }