-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
49 lines (35 loc) · 1.06 KB
/
main.py
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from lib import *
scene: Scene = Scene()
new_scene: Scene = Scene()
hideCursor()
for i in range(25):
scene.add(Rect.rand_gen(True))
for i in range(25):
scene.add(Triangle.rand_gen(True))
for i in range(25):
scene.add(rand_gen_bitimage(True, './font/k.font'))
object:List[Type[Object]] = [Triangle, Rect, BitImage]
tty.setraw(sys.stdin)
while True:
time.sleep(1/10)
rlist, _, _ = select([sys.stdin], [], [], 0.01)
if rlist:
key_input:str = rlist[0].read(1)
# import ipdb; ipdb.set_trace()
if key_input == 'q':
sys.exit()
resetColor()
clearScreen(Color.RED)
for obj in scene.objects:
obj.draw()
obj.update()
if obj.pos.y < int(scene.window_rows) - 10:
new_scene.add(obj)
else:
obj_cls = random.choice(object)
if obj_cls == BitImage:
scene.add(rand_gen_bitimage(True, "./font/k.font"))
else:
new_scene.add(obj_cls.rand_gen(False))
scene = new_scene
new_scene = Scene()