-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
46 lines (34 loc) · 782 Bytes
/
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
from bearlibterminal import terminal as t
from world import World
from entity import Entity
from actor import Actor
from player import Player
world = World()
World.set(world)
def end():
import sys
t.close()
sys.exit(0)
def draw():
global world
world.draw()
def update(key):
global world
world.update(key)
def main():
t.open()
t.set("window.size = 120x40")
t.set("input.filter = [keyboard, mouse]")
t.set("input.precise = true")
while True:
draw()
key = -1
if t.has_input():
while t.has_input():
key = t.read()
if key == t.TK_CLOSE:
end()
update(key)
t.delay(1)
if __name__ == "__main__":
main()