joystick.py

"""Bend a curve with two joysticks.
   by stephan)
"""
from slut import *

class Atlantis(World):
    def onSetup(self):
        self.name = "Joy"
        self.joy0 = 200
        self.joy1 = 200

    def onJoyAxisMotion(self, event):
        if event.joy == 0:
            if event.axis == 1:
                self.joy0 = (event.value * 200) + 200
                self.joy0_ = (event.value * 200) + 150
        elif event.joy == 1:
            if event.axis == 1:
                self.joy1 = (event.value * 200) + 200

    def onDrawOrtho(self):
        curve([0, 200], [150, self.joy0], [250, self.joy1], [400, 200])


atlantis = Atlantis()
atlantis.run()
Initiated by Stephan Hechenberger
Thanks to CADRE's 103