Exemplo n.º 1
0
 public SlimDXMouse(Window window)
 {
     positionTranslater = new CursorPositionTranslater(window);
     mouseCounter       = new MouseDeviceCounter();
     directInput        = new DInput.DirectInput();
     mouse = new DInput.Mouse(directInput);
     mouse.Properties.AxisMode = DInput.DeviceAxisMode.Absolute;
     mouse.Acquire();
     currentState = new DInput.MouseState();
 }
Exemplo n.º 2
0
        public MouseState GetMouseState()
        {
            MouseState none = new MouseState(0.0f, 0.0f, 0.0f, false, false);

            if (_mouse.Acquire().IsFailure)
            {
                return(none);
            }

            if (_mouse.Poll().IsFailure)
            {
                return(none);
            }

            SlimDX.DirectInput.MouseState dxState = _mouse.GetCurrentState();

            return(new MouseState(dxState.X, dxState.Y, dxState.Z, dxState.IsPressed(0), dxState.IsPressed(1)));
        }