Пример #1
0
        public override Action Start()
        {
            IntPtr handle = Process.GetCurrentProcess().MainWindowHandle;

            mouseDevice = new Mouse(directInputInstance);
            if (mouseDevice == null)
                throw new Exception("Failed to create mouse device");

            mouseDevice.SetCooperativeLevel(handle, CooperativeLevel.Background | CooperativeLevel.Nonexclusive);
            mouseDevice.Properties.AxisMode = DeviceAxisMode.Relative;   // Get delta values
            mouseDevice.Acquire();

            getButtonPressedStrategy = new GetPressedStrategy<int>(IsButtonDown);
            setButtonPressedStrategy = new SetPressedStrategy(SetButtonDown, SetButtonUp);
          
            OnStarted(this, new EventArgs());
            return null;
        }
Пример #2
0
 public Device(Joystick joystick)
 {
     this.joystick = joystick;
     SetRange(-1000, 1000);
     getPressedStrategy = new GetPressedStrategy(GetDown);
 }
Пример #3
0
        public override Action Start()
        {

            IntPtr handle = Process.GetCurrentProcess().MainWindowHandle;

            KeyboardDevice = new Keyboard(DirectInputInstance);
            if (KeyboardDevice == null)
                throw new Exception("Failed to create keyboard device");

            KeyboardDevice.SetCooperativeLevel(handle, CooperativeLevel.Background | CooperativeLevel.Nonexclusive);
            KeyboardDevice.Acquire();

            KeyboardDevice.GetCurrentState(ref KeyState);

            setKeyPressedStrategy = new SetPressedStrategy(KeyDown, KeyUp);
            getKeyPressedStrategy = new GetPressedStrategy<int>(IsKeyDown);

            OnStarted(this, new EventArgs());
            return null;
        }
Пример #4
0
 public WiimoteButtonState(IWiimoteData data, out Action trigger) : base(out trigger)
 {
     this.data = data;
     buttonPressed = new GetPressedStrategy<WiimoteButtons>(button_down);
 }