Beispiel #1
0
    def __init__(self, UI):
        self.Joystick = 0
        self.deadZone = 15
        self.minValue = 0
        self.maxValue = 400
        foundController = False
        UI.textwrite(
            50, 250,
            "Looking for controller, press A to choose the controller", 10, 10,
            10, 50)
        UI.update()

        while not foundController:
            for i in range(0, 5):
                Joystick.update()
                if Joystick.is_connected(i):
                    Joystick.update()
                    if Joystick.is_button_pressed(i, A):
                        foundController = True
                        self.joystick = i
            UI.shouldQuit()

        UI.textdelete(
            50, 250,
            "Looking for controller, press A to choose the controller", 50)
        UI.textwrite(450, 250, "Found " + str(self.joystick), 10, 10, 10, 50)
        UI.update()
        time.sleep(2)

        UI.textdelete(450, 250, "Found " + str(self.joystick), 50)
Beispiel #2
0
def isConnected():
    """Returns True if joystick is connected."""
    return j.is_connected(0)
Beispiel #3
0
def isConnected():
    return Joystick.is_connected(joystick)
Beispiel #4
0
if platform == "linux" or platform == "linux2":
    L_JOYSTICK_CLICK = 9
    R_JOYSTICK_CLICK = 10
    WIN_BUTTON = 8

#loop to find the correct controller
joystick = 0

foundController = False

print "looking for controller, press A to chose the controller"
while not foundController:
    for i in range(0, 5):
        Joystick.update()
        if Joystick.is_connected(i):
            Joystick.update()
            if Joystick.is_button_pressed(i, A):
                foundController = True
                joystick = i

print "found controller ", i

print "buttons: ", Joystick.get_button_count(i)


# used inside the class, not necessary to call from outside this class, use the other calls
def getAxis(joyStickNumber, axis):
    size = maxValue - minValue
    return ((applyDeadZone(Joystick.get_axis_position(joyStickNumber, axis)) /
             (100.0 - deadZone)) * size) - minValue
Beispiel #5
0
def isConnected():
    """Returns True if joystick is connected."""
    return j.is_connected(0)
Beispiel #6
0
 def isConnected(self):
     return Joystick.is_connected(self.joystick)
Beispiel #7
0
def isConnected():
    return Joystick.is_connected(joystick)
Beispiel #8
0
if platform == "linux" or platform == "linux2":
    L_JOYSTICK_CLICK = 9
    R_JOYSTICK_CLICK = 10
    WIN_BUTTON = 8

#loop to find the correct controller
joystick = 0;

foundController = False

print "looking for controller, press A to chose the controller"
while not foundController:
    for i in range(0,5):
        Joystick.update()
        if Joystick.is_connected(i):
            Joystick.update()
            if Joystick.is_button_pressed(i, A):
                foundController = True
                joystick = i

print "found controller ", i

print "buttons: ", Joystick.get_button_count(i)

# used inside the class, not necessary to call from outside this class, use the other calls
def getAxis(joyStickNumber, axis):
    size = maxValue - minValue
    return ((applyDeadZone(Joystick.get_axis_position(joyStickNumber, axis))/(100.0-deadZone)) * size) - minValue

def getPrimaryX():