

The problem is that i dont have a gamepad to experiment most of the time, so i tried with my keyboard to detect key which are pressed but i doesn't work either. It detect the gamepad but doesn't return me anything buttons/hats/joystick all the value stays at 0.Įven when i try it with my keyboard it detect the device but always return me 0 even when keys are pressed with _pressed() # If you forget this line, the program will 'hang' # Go ahead and update the screen with what we've drawn. # ALL CODE TO DRAW SHOULD GO ABOVE THIS COMMENT TextPrint.print(screen, "Number of joysticks: ".format(i, str(hat)) )

# above this, or they will be erased with this command. # Possible joystick actions: JOYAXISMOTION JOYBALLMOTION JOYBUTTONDOWN JOYBUTTONUP JOYHATMOTION If event.type = pygame.QUIT: # If user clicked closeĭone=True # Flag that we are done so we exit this loop # Used to manage how fast the screen updatesįor event in (): # User did something #Loop until the user clicks the close button. # Set the width and height of the screen # It has nothing to do with the joysticks, just outputing the # This is a simple class that will help us print to the screen Hi i'm using pygame for a school project but it seems to not work correctly.įirst of all i try to use it with a gamepad and to make it return me joystick position but even when i use their own program import pygame
