I'm using a pygame.joystick.Joystick
object and want to be able to print a message asking the user to reconnect a usb joystick once it's been unplugged.
right now I have (roughly):
js = pygame.joystick.Joystick(0)
#... some game code and stuff
pygame.joystick.quit()
pygame.joystick.init()
while pygame.joystick.get_count() == 0:
print 'please reconnect joystick'
pygame.joystick.quit()
pygame.joystick.init()
js = pygame.joystick.Joystick(0)
js.init()
but it doesn't reconnect properly, idk what exactly it's doing, but it's definitely wrong. Any direction on this would be helpful
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…