Add joystick hat motion handling in KeyLogger
This commit is contained in:
@@ -48,6 +48,10 @@ class KeyLogger:
|
|||||||
axis = event.jaxis.axis
|
axis = event.jaxis.axis
|
||||||
value = event.jaxis.value
|
value = event.jaxis.value
|
||||||
self.message = f"Joystick axis {axis} moved to {value}"
|
self.message = f"Joystick axis {axis} moved to {value}"
|
||||||
|
elif event.type == sdl2.SDL_JOYHATMOTION:
|
||||||
|
hat = event.jhat.hat
|
||||||
|
value = event.jhat.value
|
||||||
|
self.message = f"Joystick hat {hat} moved to {value}"
|
||||||
elif event.type == sdl2.SDL_QUIT:
|
elif event.type == sdl2.SDL_QUIT:
|
||||||
self.running = False
|
self.running = False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user