controller axen variablen

Hier werden alle anderen GUI-Toolkits sowie Spezial-Toolkits wie Spiele-Engines behandelt.
Antworten
simon1234567
User
Beiträge: 4
Registriert: Samstag 21. April 2018, 10:07

pygame?

hi ich will mit pygame meinen controller abfragen was auch klappt aber ich will jetzt meinen axen verschiedene variablen zuorden also z.B x = axe 1 dah ich in dem modul pygame neu bin und ich zu blöd zum googel bin fehlt mir ein bsp Danke für alle antworten
#!python

import pygame

pygame.init()



#Loop until the user clicks the close button.
done = False


# Initialize the joysticks
pygame.joystick.init()
# Get ready to print


# -------- Main Program Loop -----------
while done==False:
# EVENT PROCESSING STEP
for event in pygame.event.get():
if event.type == pygame.QUIT:
done=True #


if event.type == pygame.JOYBUTTONDOWN:
print("Joystick button pressed.")
if event.type == pygame.JOYBUTTONUP:
print("button releasd")



# Get count of joysticks
joystick_count = pygame.joystick.get_count()

# For each joystick:
for i in range(joystick_count):
joystick = pygame.joystick.Joystick(i)
joystick.init()



axes = joystick.get_numaxes()


for i in range( axes ):
axis = joystick.get_axis( i )
print "Axis {} value: {:>6.3f}".format(i, axis)
__deets__
User
Beiträge: 14493
Registriert: Mittwoch 14. Oktober 2015, 14:29

Code: Alles auswählen

x = joystick.get_axis(0)
Antworten