# Tests with the Gamepad
# Myro
# Doug Blank
# CS110 Fall 2009

from myro import *

win = GraphWin()
circle = Circle(Point(getWidth(win)/2,
                      getHeight(win)/2), 10)

circle.setFill("red")
circle.draw(win)

def test1():
    while timeRemaining(10):
        axis = getGamepad("axis")
        circle.move(axis[0], axis[1])


def test2():
    while timeRemaining(10):
        axis = getGamepadNow("axis")
        circle.move(axis[0], axis[1])
        wait(.01)

def test3():
    while timeRemaining(10):
        axis = getGamepadNow("axis")
        if (circle.p1.x + axis[0] > 0 and
            circle.p2.x + axis[0] < getWidth(win) and
            circle.p1.y + axis[1] > 0 and
            circle.p2.y + axis[1] < getHeight(win)):
            circle.move(axis[0], axis[1])
            wait(.01)
    
