Enhance joystick handling in KeyLogger by adding button release and axis motion events

This commit is contained in:
2025-08-19 16:30:52 +02:00
parent 3fa678507c
commit 302d454783
2 changed files with 10 additions and 3 deletions
+7
View File
@@ -41,6 +41,13 @@ class KeyLogger:
self.message = f"Joystick button {button} pressed"
if button == 9: # Assuming button 0 is the right trigger
self.running = False
elif event.type == sdl2.SDL_JOYBUTTONUP:
button = event.jbutton.button
self.message = f"Joystick button {button} released"
elif event.type == sdl2.SDL_JOYAXISMOTION:
axis = event.jaxis.axis
value = event.jaxis.value
self.message = f"Joystick axis {axis} moved to {value}"
elif event.type == sdl2.SDL_QUIT:
self.running = False