aboutsummaryrefslogtreecommitdiff
path: root/turtetris_master/__init__.py
blob: e7f9fabb3a269d2d2e119a475c8de562cae4b5c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import time
from .led_output import Matrix
from .usb_input import Gamepad
from .screen_checker import ScreenChecker


def main():
    "Main function"
    inpt = Gamepad()
    mtrx = Matrix()
    sc = ScreenChecker(mtrx)
    mtrx.display()  # Display first state
    while True:
        tstart = time.time()
        ##
        #print(inpt.check())
        if sc.tick():
            mtrx.display()
            #print(mtrx.__mat__[2])
        ##
        trest = (1/60) - (time.time() - tstart)
        if trest > 0:
            time.sleep(trest)
        else:
            print("Output took too long!!")


if __name__ == '__main__':
    main()