We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import pygame import time from pynput.mouse import Controller as MouseController
pygame.init() mouse = MouseController() pygame.joystick.init()
print("Press Ctrl+C to exit.")
joystick_count = pygame.joystick.get_count() if joystick_count == 0: print("No joystick detected.") pygame.quit() exit()
joystick = pygame.joystick.Joystick(0) joystick.init() print(f"Joystick initialized: {joystick.get_name()}")
try: while True: for event in pygame.event.get(): if event.type == pygame.JOYAXISMOTION:
if event.axis == 0: steering_wheel = event.value print(f"Steering Wheel Position: {steering_wheel:.2f}") if abs(steering_wheel) > 0.1: # Deadzone mouse_movement_x = steering_wheel * 100 # Sensitivity factor mouse.move(int(mouse_movement_x), 0) print(f"Mouse moved by: {int(mouse_movement_x)}") time.sleep(0.01)
except KeyboardInterrupt: print("Exiting...") finally: pygame.quit()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
import pygame
import time
from pynput.mouse import Controller as MouseController
pygame.init()
mouse = MouseController()
pygame.joystick.init()
print("Press Ctrl+C to exit.")
joystick_count = pygame.joystick.get_count()
if joystick_count == 0:
print("No joystick detected.")
pygame.quit()
exit()
joystick = pygame.joystick.Joystick(0)
joystick.init()
print(f"Joystick initialized: {joystick.get_name()}")
try:
while True:
for event in pygame.event.get():
if event.type == pygame.JOYAXISMOTION:
except KeyboardInterrupt:
print("Exiting...")
finally:
pygame.quit()
The text was updated successfully, but these errors were encountered: