// POV to Arrow Keys public void updatePOVhat() { int thumbstickDeadZone = 75; SBC.POVdirection lastDirection = controller.POVhat; if (((Math.Abs(controller.SightChangeX) > thumbstickDeadZone) || (Math.Abs(controller.SightChangeY) > thumbstickDeadZone))) { if (Math.Abs(controller.SightChangeX) > Math.Abs(controller.SightChangeY)) { if (controller.SightChangeX < 0) { controller.POVhat = SBC.POVdirection.LEFT; } else { controller.POVhat = SBC.POVdirection.RIGHT; } } else if (controller.SightChangeY < 0) { controller.POVhat = SBC.POVdirection.DOWN; } else { controller.POVhat = SBC.POVdirection.UP; } } else { controller.POVhat = SBC.POVdirection.CENTER; } if (lastDirection != controller.POVhat) { switch (lastDirection) { case SBC.POVdirection.LEFT: controller.sendKeyUp(Microsoft.DirectX.DirectInput.Key.Left); break; case SBC.POVdirection.RIGHT: controller.sendKeyUp(Microsoft.DirectX.DirectInput.Key.Right); break; case SBC.POVdirection.DOWN: controller.sendKeyUp(Microsoft.DirectX.DirectInput.Key.Up); break; case SBC.POVdirection.UP: controller.sendKeyUp(Microsoft.DirectX.DirectInput.Key.Down); break; } } else { switch (controller.POVhat) { case SBC.POVdirection.LEFT: controller.sendKeyDown(Microsoft.DirectX.DirectInput.Key.Left); break; case SBC.POVdirection.RIGHT: controller.sendKeyDown(Microsoft.DirectX.DirectInput.Key.Right); break; case SBC.POVdirection.DOWN: controller.sendKeyDown(Microsoft.DirectX.DirectInput.Key.Up); break; case SBC.POVdirection.UP: controller.sendKeyDown(Microsoft.DirectX.DirectInput.Key.Down); break; } } }
void updatePOVhat() { SBC.POVdirection lastDirection = controller.POVhat; if (((Math.Abs(controller.SightChangeX) > thumbstickDeadZone) || (Math.Abs(controller.SightChangeY) > thumbstickDeadZone)) && (controller.GearLever == -2))//reverse) { if (Math.Abs(controller.SightChangeX) > Math.Abs(controller.SightChangeY)) { if (controller.SightChangeX < 0) { controller.POVhat = SBC.POVdirection.LEFT; } else { controller.POVhat = SBC.POVdirection.RIGHT; } } else if (controller.SightChangeY < 0) { controller.POVhat = SBC.POVdirection.DOWN; } else { controller.POVhat = SBC.POVdirection.UP; } } else { controller.POVhat = SBC.POVdirection.CENTER; } if (lastDirection != controller.POVhat) { switch (lastDirection) { case SBC.POVdirection.LEFT: controller.sendKeyUp(SBC.VirtualKeyCode.LEFT); break; case SBC.POVdirection.RIGHT: controller.sendKeyUp(SBC.VirtualKeyCode.RIGHT); break; case SBC.POVdirection.DOWN: controller.sendKeyUp(SBC.VirtualKeyCode.VK_I); break; case SBC.POVdirection.UP: controller.sendKeyUp(SBC.VirtualKeyCode.VK_M); break; } } else { switch (controller.POVhat) { case SBC.POVdirection.LEFT: controller.sendKeyDown(SBC.VirtualKeyCode.LEFT); break; case SBC.POVdirection.RIGHT: controller.sendKeyDown(SBC.VirtualKeyCode.RIGHT); break; case SBC.POVdirection.DOWN: controller.sendKeyDown(SBC.VirtualKeyCode.VK_I); break; case SBC.POVdirection.UP: controller.sendKeyDown(SBC.VirtualKeyCode.VK_M); break; } } }