Enhance joystick handling in KeyLogger by adding button release and axis motion events
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user